Back to Content

GPUTexture: destroy() method

files/en-us/web/api/gputexture/destroy/index.md

latest656 B
Original Source

{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}

The destroy() method of the {{domxref("GPUTexture")}} interface destroys the GPUTexture.

Syntax

js-nolint
destroy()

Parameters

None.

Return value

None ({{jsxref("Undefined")}}).

Examples

js
// …

const depthTexture = device.createTexture({
  size: [canvas.width, canvas.height],
  format: "depth24plus",
  usage: GPUTextureUsage.RENDER_ATTACHMENT,
});

// some time later

depthTexture.destroy();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also