diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts index ddd0f8b39f..b2d1939a4f 100644 --- a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts @@ -8,6 +8,7 @@ import { makeTestGroup } from '../../../common/framework/test_group.js'; import { assert, makeValueTestVariant, unreachable } from '../../../common/util/util.js'; import { allBindingEntries, + BindableResource, bindingTypeInfo, bufferBindingEntries, bufferBindingTypeInfo, @@ -106,7 +107,7 @@ g.test('binding_must_contain_resource_defined_in_layout') .desc( 'Test that only compatible resource types specified in the BindGroupLayout are allowed for each entry.' ) - .paramsSubcasesOnly(u => + .params(u => u // .combine('resourceType', kBindableResources) .combine('entry', allBindingEntries(false)) @@ -121,6 +122,17 @@ g.test('binding_must_contain_resource_defined_in_layout') const resource = t.getBindingResource(resourceType); + const IsStorageTextureResourceType = (resourceType: BindableResource) => { + switch (resourceType) { + case 'readonlyStorageTex': + case 'readwriteStorageTex': + case 'writeonlyStorageTex': + return true; + default: + return false; + } + }; + let resourceBindingIsCompatible; switch (info.resource) { // Either type of sampler may be bound to a filtering sampler binding. @@ -131,6 +143,11 @@ g.test('binding_must_contain_resource_defined_in_layout') case 'nonFiltSamp': resourceBindingIsCompatible = resourceType === 'nonFiltSamp'; break; + case 'readonlyStorageTex': + case 'readwriteStorageTex': + case 'writeonlyStorageTex': + resourceBindingIsCompatible = IsStorageTextureResourceType(resourceType); + break; default: resourceBindingIsCompatible = info.resource === resourceType; break; @@ -166,7 +183,7 @@ g.test('texture_binding_must_have_correct_usage') const descriptor = { size: { width: 16, height: 16, depthOrArrayLayers: 1 }, - format: 'rgba8unorm' as const, + format: 'r32float' as const, usage: appliedUsage, sampleCount: info.resource === 'sampledTexMS' ? 4 : 1, }; @@ -313,6 +330,19 @@ g.test('texture_must_have_correct_dimension') }); t.skipIfTextureViewDimensionNotSupported(viewDimension, dimension); + if (t.isCompatibility && texture.dimension === '2d') { + if (depthOrArrayLayers === 1) { + t.skipIf( + viewDimension !== '2d', + '1 layer 2d textures default to textureBindingViewDimension: "2d" in compat mode' + ); + } else { + t.skipIf( + viewDimension !== '2d-array', + '> 1 layer 2d textures default to textureBindingViewDimension "2d-array" in compat mode' + ); + } + } const shouldError = viewDimension !== dimension; const textureView = texture.createView({ dimension }); @@ -526,9 +556,7 @@ g.test('buffer,resource_state') g.test('texture,resource_state') .desc('Test bind group creation with various texture resource states') .paramsSubcasesOnly(u => - u - .combine('state', kResourceStates) - .combine('entry', sampledAndStorageBindingEntries(true, 'rgba8unorm')) + u.combine('state', kResourceStates).combine('entry', sampledAndStorageBindingEntries(true)) ) .fn(t => { const { state, entry } = t.params; @@ -548,10 +576,11 @@ g.test('texture,resource_state') const usage = entry.texture?.multisampled ? info.usage | GPUConst.TextureUsage.RENDER_ATTACHMENT : info.usage; + const format = entry.storageTexture !== undefined ? 'r32float' : 'rgba8unorm'; const texture = t.createTextureWithState(state, { usage, size: [1, 1], - format: 'rgba8unorm', + format, sampleCount: entry.texture?.multisampled ? 4 : 1, }); @@ -626,7 +655,9 @@ g.test('binding_resources,device_mismatch') { buffer: { type: 'storage' } }, { sampler: { type: 'filtering' } }, { texture: { multisampled: false } }, - { storageTexture: { access: 'write-only', format: 'rgba8unorm' } }, + { storageTexture: { access: 'write-only', format: 'r32float' } }, + { storageTexture: { access: 'read-only', format: 'r32float' } }, + { storageTexture: { access: 'read-write', format: 'r32float' } }, ] as const) .beginSubcases() .combineWithParams([ @@ -784,6 +815,10 @@ g.test('storage_texture,format') .combine('storageTextureFormat', kStorageTextureFormats) .combine('resourceFormat', kStorageTextureFormats) ) + .beforeAllSubcases(t => { + const { storageTextureFormat, resourceFormat } = t.params; + t.skipIfTextureFormatNotUsableAsStorageTexture(storageTextureFormat, resourceFormat); + }) .fn(t => { const { storageTextureFormat, resourceFormat } = t.params; |