From ae2ae9e4e45bc91b11141b2aaf45bb070bf35044 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Mon, 16 Dec 2024 14:47:56 +0900 Subject: [PATCH 1/2] Compat: update pipeline_bind_group_compat for 0 storage bufs/textures --- .../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..cabc8ce22abb 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), ]; From edc3e9ac925858f3e80f13dc947b5b6754a8e4cb Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 17 Dec 2024 09:51:45 +0900 Subject: [PATCH 2/2] address comments --- .../encoding/programmable/pipeline_bind_group_compat.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 cabc8ce22abb..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 @@ -790,14 +790,14 @@ g.test('bgl_resource_type_mismatch') t.isCompatibility && resourceIsStorageTexture(plResourceType) && !(t.device.limits.maxStorageTexturesInFragmentStage! >= 1), - `maxStorageTexturesInFragmentStage(${t.device.limits.maxStorageTexturesInFragmentStage} is not >= 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` + `maxStorageBuffersInFragmentStage(${t.device.limits.maxStorageBuffersInFragmentStage}) is not >= 1` ); const bglEntries: Array = [