gpuweb / cts

WebGPU Conformance Test Suite
https://gpuweb.github.io/cts/
BSD 3-Clause "New" or "Revised" License
121 stars 72 forks source link

Make `virtualMipSize` take a `GPUExtent3D` #3792

Closed greggman closed 2 weeks ago

greggman commented 2 weeks ago

Updated the TODO for making it return a GPUExtent3DDict

Note: I'm torn on which is better, 3 numbers or the object. The object seems verbose. The object is also inconsistent with workgroup_size

Being able to compute the number of texels with

numTexels = size.reduce((acc, v) => acc * v);

Seems nice though I admit it's hardly that different than

numTexls = size.width * size.height * size.depthOrArrayLayers;

It's also nice to be able to pass the size. For example algos which take a size of texture passed to a compute shader

pass.dispatchWorkgroups(...size);

vs

pass.dispatchWorkgroups(size.width, size.height, size.depthOrArrayLayers);

Or putting it into a uniform/storage buffer with

someTypedArray.set(size, offset);

Though again it's not that big if a deal. I get that it's kind of more readable to see the names but if that's the case the same argument applies to workgroup_size so 🤷‍ 😅

Size as an array also matches textureDimensions which returns a vec2u or vec3u which can be indexed with [0], [1], [2] and which is often useful directly in texture coordinate calculations texelCoord = uv * size

anyway, I'm not suggesting changing more now. Mostly voicing that I'd mildly prefer it not be changed to return a GPUExtent3DDict in the future.