( texture: GPUTextureDescriptor, )
| 4 | import type { Uint8Array_ } from "./_types.ts"; |
| 5 | |
| 6 | function textureDimensionArrayLayerCount( |
| 7 | texture: GPUTextureDescriptor, |
| 8 | ): number { |
| 9 | switch (texture.dimension) { |
| 10 | case "1d": |
| 11 | case "3d": |
| 12 | return 1; |
| 13 | case undefined: |
| 14 | case "2d": |
| 15 | return normalizeExtent3D(texture.size).depthOrArrayLayers ?? 1; |
| 16 | default: |
| 17 | throw new TypeError( |
| 18 | `Cannot count texture dimension layer: dimension value is "${texture.dimension}"`, |
| 19 | ); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | function normalizeExtent3D(size: GPUExtent3D): GPUExtent3DDict { |
| 24 | if (Array.isArray(size)) { |
no test coverage detected