Skip to content

Commit ae675c6

Browse files
authored
WebGPU: fix mipLevelCount and arrayLayerCount undefined value (#17324)
1 parent b5d6443 commit ae675c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library_webgpu.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
COPY_STRIDE_UNDEFINED: 0xFFFFFFFF,
9393
LIMIT_U32_UNDEFINED: 0xFFFFFFFF,
9494
WHOLE_MAP_SIZE: 0xFFFFFFFF, // use 32-bit uint max
95+
MIP_LEVEL_COUNT_UNDEFINED: 0xFFFFFFFF,
96+
ARRAY_LAYER_COUNT_UNDEFINED: 0xFFFFFFFF,
9597
AdapterType: {
9698
Unknown: 3,
9799
},
@@ -1975,15 +1977,17 @@ var LibraryWebGPU = {
19751977
var desc;
19761978
if (descriptor) {
19771979
{{{ gpu.makeCheckDescriptor('descriptor') }}}
1980+
var mipLevelCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.mipLevelCount) }}};
1981+
var arrayLayerCount = {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.arrayLayerCount) }}};
19781982
desc = {
19791983
"format": WebGPU.TextureFormat[
19801984
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.format) }}}],
19811985
"dimension": WebGPU.TextureViewDimension[
19821986
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.dimension) }}}],
19831987
"baseMipLevel": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.baseMipLevel) }}},
1984-
"mipLevelCount": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.mipLevelCount) }}},
1988+
"mipLevelCount": mipLevelCount === {{{ gpu.MIP_LEVEL_COUNT_UNDEFINED }}} ? undefined : mipLevelCount,
19851989
"baseArrayLayer": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.baseArrayLayer) }}},
1986-
"arrayLayerCount": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.arrayLayerCount) }}},
1990+
"arrayLayerCount": arrayLayerCount === {{{ gpu.ARRAY_LAYER_COUNT_UNDEFINED }}} ? undefined : arrayLayerCount,
19871991
"aspect": WebGPU.TextureAspect[
19881992
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUTextureViewDescriptor.aspect) }}}],
19891993
};

0 commit comments

Comments
 (0)