diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureGather.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureGather.spec.ts index 5aae5bafbe5..90fa2f1ed3f 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureGather.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureGather.spec.ts @@ -302,23 +302,35 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('C', ['i32', 'u32'] as const) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); skipIfNeedsFilteringAndIsUnfilterableOrSelectDevice(t, t.params.filt, t.params.format); }) .fn(async t => { - const { format, stage, samplePoints, C, A, modeU, modeV, filt: minFilter, offset } = t.params; + const { + format, + stage, + samplePoints, + C, + A, + modeU, + modeV, + filt: minFilter, + offset, + depthOrArrayLayers, + } = t.params; // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); - const depthOrArrayLayers = 4; const descriptor: GPUTextureDescriptor = { format, size: { width, height, depthOrArrayLayers }, mipLevelCount: 3, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); const sampler: GPUSamplerDescriptor = { @@ -351,7 +363,7 @@ Parameters: }; }); const textureType = appendComponentTypeForFormatToTextureType('texture_2d_array', format); - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, @@ -692,6 +704,7 @@ Parameters: .beginSubcases() .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfDepthTextureCanNotBeUsedWithNonComparisonSampler(); @@ -699,17 +712,17 @@ Parameters: t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); }) .fn(async t => { - const { format, stage, samplePoints, A, modeU, modeV, offset } = t.params; + const { format, stage, samplePoints, A, modeU, modeV, offset, depthOrArrayLayers } = t.params; // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); - const depthOrArrayLayers = 4; const descriptor: GPUTextureDescriptor = { format, size: { width, height, depthOrArrayLayers }, mipLevelCount: 3, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); const sampler: GPUSamplerDescriptor = { @@ -736,7 +749,7 @@ Parameters: }; }); const textureType = 'texture_depth_2d_array'; - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureGatherCompare.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureGatherCompare.spec.ts index e8a2be30bad..86a0c42a6cb 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureGatherCompare.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureGatherCompare.spec.ts @@ -78,6 +78,7 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) .combine('compare', kCompareFunctions) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); @@ -94,15 +95,17 @@ Parameters: filt: minFilter, compare, offset, + depthOrArrayLayers, } = t.params; - const viewDimension = '2d-array'; - const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension }); + const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); + const size = { width, height, depthOrArrayLayers }; const descriptor: GPUTextureDescriptor = { format, size, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, { generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare), diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts index 3d02a52e34f..eafdbda2062 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts @@ -622,6 +622,7 @@ Parameters: { C: 'u32', A: 'i32', L: 'u32' }, { C: 'u32', A: 'u32', L: 'i32' }, ] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { const { format, texture_type } = t.params; @@ -630,15 +631,17 @@ Parameters: t.selectDeviceForTextureFormatOrSkipTestCase(format); }) .fn(async t => { - const { texture_type, format, stage, samplePoints, C, A, L } = t.params; + const { texture_type, format, stage, samplePoints, C, A, L, depthOrArrayLayers } = t.params; // We want at least 4 blocks or something wide enough for 3 mip levels. - const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension: '3d' }); + const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); + const size = { width, height, depthOrArrayLayers }; const descriptor: GPUTextureDescriptor = { format, size, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: maxMipLevelCount({ size }), + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); @@ -660,7 +663,7 @@ Parameters: }; }); const textureType = appendComponentTypeForFormatToTextureType(texture_type, texture.format); - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const sampler = undefined; const results = await doTextureCalls( t, @@ -867,6 +870,7 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('C', ['i32', 'u32'] as const) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIf(!t.hasLanguageFeature('readonly_and_readwrite_storage_textures')); @@ -877,16 +881,18 @@ Parameters: } }) .fn(async t => { - const { format, stage, samplePoints, C, A } = t.params; + const { format, stage, samplePoints, C, A, depthOrArrayLayers } = t.params; skipIfStorageTexturesNotSupportedInStage(t, stage); // We want at least 3 blocks or something wide enough for 3 mip levels. - const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension: '3d' }); + const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); + const size = { width, height, depthOrArrayLayers }; const descriptor: GPUTextureDescriptor = { format, size, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.STORAGE_BINDING, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts index 386101462eb..6ba6df1e0ac 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts @@ -485,23 +485,33 @@ Parameters: .beginSubcases() .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format) ) .fn(async t => { - const { format, samplePoints, A, modeU, modeV, filt: minFilter, offset } = t.params; + const { + format, + samplePoints, + A, + modeU, + modeV, + filt: minFilter, + offset, + depthOrArrayLayers, + } = t.params; skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format); // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); - const depthOrArrayLayers = 4; const descriptor: GPUTextureDescriptor = { format, size: { width, height, depthOrArrayLayers }, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: 3, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); const sampler: GPUSamplerDescriptor = { @@ -532,7 +542,7 @@ Parameters: }; }); const textureType = 'texture_2d_array'; - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, @@ -789,19 +799,20 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) .combine('L', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfDepthTextureCanNotBeUsedWithNonComparisonSampler(); t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); }) .fn(async t => { - const { format, samplePoints, mode, A, L, offset } = t.params; + const { format, samplePoints, mode, A, L, offset, depthOrArrayLayers } = t.params; // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); const descriptor: GPUTextureDescriptor = { format, - size: { width, height }, + size: { width, height, depthOrArrayLayers }, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: 3, ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompare.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompare.spec.ts index e34e66383f5..e4a10e01f71 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompare.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompare.spec.ts @@ -260,22 +260,34 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) .combine('compare', kCompareFunctions) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); }) .fn(async t => { - const { format, samplePoints, A, modeU, modeV, filt: minFilter, compare, offset } = t.params; + const { + format, + samplePoints, + A, + modeU, + modeV, + filt: minFilter, + compare, + offset, + depthOrArrayLayers, + } = t.params; - const viewDimension = '2d-array'; - const size = chooseTextureSize({ minSize: 16, minBlocks: 4, format, viewDimension }); + const [width, height] = chooseTextureSize({ minSize: 16, minBlocks: 4, format }); + const size = { width, height, depthOrArrayLayers }; const descriptor: GPUTextureDescriptor = { format, size, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: 3, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, { generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare), @@ -312,7 +324,7 @@ Parameters: }; }); const textureType = 'texture_depth_2d_array'; - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompareLevel.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompareLevel.spec.ts index 81855908fdd..95b2d147dc5 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompareLevel.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleCompareLevel.spec.ts @@ -279,6 +279,7 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) .combine('compare', kCompareFunctions) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); @@ -295,16 +296,18 @@ Parameters: filt: minFilter, compare, offset, + depthOrArrayLayers, } = t.params; - const viewDimension = '2d-array'; - const size = chooseTextureSize({ minSize: 16, minBlocks: 4, format, viewDimension }); + const [width, height] = chooseTextureSize({ minSize: 16, minBlocks: 4, format }); + const size = { width, height, depthOrArrayLayers }; const descriptor: GPUTextureDescriptor = { format, size, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: 3, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, { generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare), @@ -341,7 +344,7 @@ Parameters: }; }); const textureType = 'texture_depth_2d_array'; - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts index 2019cd3600b..b80ab128f2b 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts @@ -311,23 +311,34 @@ Parameters: .beginSubcases() .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format) ) .fn(async t => { - const { format, stage, samplePoints, A, modeU, modeV, filt: minFilter, offset } = t.params; + const { + format, + stage, + samplePoints, + A, + modeU, + modeV, + filt: minFilter, + offset, + depthOrArrayLayers, + } = t.params; skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format); // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); - const depthOrArrayLayers = 4; const descriptor: GPUTextureDescriptor = { format, size: { width, height, depthOrArrayLayers }, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, mipLevelCount: 3, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); const sampler: GPUSamplerDescriptor = { @@ -359,7 +370,7 @@ Parameters: }; }); const textureType = 'texture_2d_array'; - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleLevel.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleLevel.spec.ts index 78a3c636137..ef5a7269a4c 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleLevel.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleLevel.spec.ts @@ -183,23 +183,34 @@ Parameters: .beginSubcases() .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format) ) .fn(async t => { - const { format, stage, samplePoints, A, modeU, modeV, filt: minFilter, offset } = t.params; + const { + format, + stage, + samplePoints, + A, + modeU, + modeV, + filt: minFilter, + offset, + depthOrArrayLayers, + } = t.params; skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format); // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); - const depthOrArrayLayers = 4; const descriptor: GPUTextureDescriptor = { format, size: { width, height, depthOrArrayLayers }, mipLevelCount: 3, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, + ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }), }; const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor); const sampler: GPUSamplerDescriptor = { @@ -231,7 +242,7 @@ Parameters: }; }); const textureType = appendComponentTypeForFormatToTextureType('texture_2d_array', format); - const viewDescriptor = {}; + const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' }; const results = await doTextureCalls( t, texture, @@ -640,19 +651,20 @@ Parameters: .combine('samplePoints', kSamplePointMethods) .combine('A', ['i32', 'u32'] as const) .combine('L', ['i32', 'u32'] as const) + .combine('depthOrArrayLayers', [1, 8] as const) ) .beforeAllSubcases(t => { t.skipIfDepthTextureCanNotBeUsedWithNonComparisonSampler(); skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format); }) .fn(async t => { - const { format, stage, samplePoints, mode, A, L, offset } = t.params; + const { format, stage, samplePoints, mode, A, L, offset, depthOrArrayLayers } = t.params; // We want at least 4 blocks or something wide enough for 3 mip levels. const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format }); const descriptor: GPUTextureDescriptor = { format, - size: { width, height }, + size: { width, height, depthOrArrayLayers }, mipLevelCount: 3, usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING, ...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),