GPUTexture: format property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
Theformat read-only property of theGPUTexture interface represents the format of theGPUTexture.
This is set via theformat property in the descriptor object passed into the originatingGPUDevice.createTexture() call.
In this article
Value
An enumerated value. See the specification'sTexture formats section for all the possible values. Also seeTier 1 and Tier 2 texture formats.
Examples
js
// …const depthTexture = device.createTexture({ size: [canvas.width, canvas.height], format: "depth24plus", usage: GPUTextureUsage.RENDER_ATTACHMENT,});console.log(depthTexture.format); // "depth24plus"Specifications
| Specification |
|---|
| WebGPU> # dom-gputexture-format> |
Browser compatibility
See also
- TheWebGPU API