MCPcopy Create free account
hub / github.com/denoland/std / textureDimensionArrayLayerCount

Function textureDimensionArrayLayerCount

webgpu/texture_with_data.ts:6–21  ·  view source on GitHub ↗
(
  texture: GPUTextureDescriptor,
)

Source from the content-addressed store, hash-verified

4import type { Uint8Array_ } from "./_types.ts";
5
6function 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
23function normalizeExtent3D(size: GPUExtent3D): GPUExtent3DDict {
24 if (Array.isArray(size)) {

Callers 1

createTextureWithDataFunction · 0.85

Calls 1

normalizeExtent3DFunction · 0.85

Tested by

no test coverage detected