Skip to content

Commit

Permalink
Compat: Fix compat tests for depthOrArrayLayers restrictions
Browse files Browse the repository at this point in the history
textureBindingViewDimension = '2d' must have depthOrArrayLayers = 1
textureBindingViewDimension = 'cube' must have depthOrArrayLayers = 6
  • Loading branch information
greggman committed Dec 4, 2023
1 parent eb48ff8 commit 6590a34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/webgpu/compat/api/validation/createBindGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ function isValidViewDimensionForDepthOrArrayLayers(
depthOrArrayLayers: number
) {
switch (viewDimension) {
case '2d':
return depthOrArrayLayers === 1;
case 'cube':
return depthOrArrayLayers === 6;
case 'cube-array':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ g.test('invalidTextureBindingViewDimension')
)
.fn(t => {
const { dimension, textureBindingViewDimension } = t.params;
const depthOrArrayLayers = textureBindingViewDimension === '1d' || textureBindingViewDimension === '2d' ? 1 : 6;
const shouldError = getTextureDimensionFromView(textureBindingViewDimension) !== dimension;
t.expectGPUError(
'validation',
() => {
const texture = t.device.createTexture({
size: [1, 1, dimension === '1d' ? 1 : 6],
size: [1, 1, depthOrArrayLayers],
format: 'rgba8unorm',
usage: GPUTextureUsage.TEXTURE_BINDING,
dimension,
Expand Down

0 comments on commit 6590a34

Please sign in to comment.