From 71d7250ec692846828875e41cc152d1c0cdffbe0 Mon Sep 17 00:00:00 2001 From: Greggman Date: Mon, 16 Dec 2024 16:56:19 -0800 Subject: [PATCH] Compat: update pipeline_bind_group_compat for 0 storage bufs/textures (#4095) --- .../pipeline_bind_group_compat.spec.ts | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts b/src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts index 2d247837c8d8..46402e190310 100644 --- a/src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts +++ b/src/webgpu/api/validation/encoding/programmable/pipeline_bind_group_compat.spec.ts @@ -21,6 +21,7 @@ import { ValidBindableResource, } from '../../../../capability_info.js'; import { GPUConst } from '../../../../constants.js'; +import { MaxLimitsTestMixin } from '../../../../gpu_test.js'; import { ProgrammableEncoderType, kProgrammableEncoderTypes, @@ -424,7 +425,7 @@ class F extends ValidationTest { } } -export const g = makeTestGroup(F); +export const g = makeTestGroup(MaxLimitsTestMixin(F)); g.test('bind_groups_and_pipeline_layout_mismatch') .desc( @@ -531,6 +532,13 @@ g.test('buffer_binding,render_pipeline') .fn(t => { const { type } = t.params; + t.skipIf( + (type === 'storage' || type === 'read-only-storage') && + t.isCompatibility && + !(t.device.limits.maxStorageBuffersInFragmentStage! > 1), + `maxStorageBuffersInFragmentStage(${t.device.limits.maxStorageBuffersInFragmentStage}) is not >= 1` + ); + // Create fixed bindGroup const uniformBuffer = t.getUniformBuffer(); @@ -748,6 +756,18 @@ g.test('bgl_visibility_mismatch') ); }); +function resourceIsStorageTexture(resourceType: ValidBindableResource) { + return ( + resourceType === 'readonlyStorageTex' || + resourceType === 'readwriteStorageTex' || + resourceType === 'writeonlyStorageTex' + ); +} + +function resourceIsStorageBuffer(resourceType: ValidBindableResource) { + return resourceType === 'storageBuf'; +} + g.test('bgl_resource_type_mismatch') .desc( ` @@ -766,6 +786,20 @@ g.test('bgl_resource_type_mismatch') const { encoderType, call, callWithZero, bgResourceType, plResourceType, useU32Array } = t.params; + t.skipIf( + t.isCompatibility && + resourceIsStorageTexture(plResourceType) && + !(t.device.limits.maxStorageTexturesInFragmentStage! >= 1), + `maxStorageTexturesInFragmentStage(${t.device.limits.maxStorageTexturesInFragmentStage}) is not >= 1` + ); + + t.skipIf( + t.isCompatibility && + resourceIsStorageBuffer(plResourceType) && + !(t.device.limits.maxStorageBuffersInFragmentStage! >= 1), + `maxStorageBuffersInFragmentStage(${t.device.limits.maxStorageBuffersInFragmentStage}) is not >= 1` + ); + const bglEntries: Array = [ t.createBindGroupLayoutEntry(encoderType, bgResourceType, useU32Array), ];