GPUCanvasContext: unconfigure() 方法

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

安全上下文: 此功能僅在安全上下文(HTTPS)中可用,且支援此功能的瀏覽器數量有限。

注意:此功能在 Web Workers 中可用。

GPUCanvasContext 介面的 unconfigure() 方法移除任何先前設定的上下文配置,並銷燬在畫布上下文配置期間透過 getCurrentTexture() 返回的任何紋理。

語法

js
unconfigure()

引數

無。

返回值

無 (undefined)。

示例

js
const canvas = document.querySelector("#gpuCanvas");
const context = canvas.getContext("webgpu");

context.configure({
  device,
  format: navigator.gpu.getPreferredCanvasFormat(),
  alphaMode: "premultiplied",
});

// Later on
context.unconfigure();

規範

規範
WebGPU
# dom-gpucanvascontext-unconfigure

瀏覽器相容性

另見