GPUTexture: depthOrArrayLayers 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.
ThedepthOrArrayLayers read-only property of theGPUTexture interface represents the depth or layer count of theGPUTexture.
This is set based on thesize property in the descriptor object passed into the originatingGPUDevice.createTexture() call.
In this article
Value
A number. This represents:
- The depth in pixels, in the case of textures with a
"3d"GPUTexture.dimension. - The number of layers, in the case of layered textures with a
"2d"GPUTexture.dimension.
In cases where theGPUTexture does not have a depth or layers, the value is 1.
Examples
js
// …const test = device.createTexture({ size: [128], format: "r8uint", dimension: "1d", usage: GPUTextureUsage.COPY_SRC,});console.log(test.depthOrArrayLayers); // 1Specifications
| Specification |
|---|
| WebGPU> # dom-gputexture-depthorarraylayers> |
Browser compatibility
See also
- TheWebGPU API