GPUTexture:format 属性
注意:此功能在 Web Workers 中可用。
GPUTexture 接口的format 只读属性表示 GPUTexture 的格式。
此属性通过传入到原始的 GPUDevice.createTexture() 调用中的描述符对象的 format 属性设置。
值
一个枚举值。有关所有可能的值,请参阅规范中的纹理格式(Texture formats)部分。
示例
js
// …
const depthTexture = device.createTexture({
size: [canvas.width, canvas.height],
format: "depth24plus",
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
console.log(depthTexture.format); // "depth24plus"
规范
| 规范 |
|---|
| WebGPU # dom-gputexture-format |
浏览器兼容性
加载中…