diff --git a/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts b/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts index 6b99f9f84f67..8654bc6feba6 100644 --- a/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts +++ b/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts @@ -3,6 +3,7 @@ Tests for capability checking for features enabling optional texture formats. `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; +import { getGPU } from '../../../../../common/util/navigator_gpu.js'; import { assert } from '../../../../../common/util/util.js'; import { kAllTextureFormats, kTextureFormatInfo } from '../../../../format_info.js'; import { kAllCanvasTypes, createCanvas } from '../../../../util/create_elements.js'; @@ -437,3 +438,18 @@ g.test('render_bundle_encoder_descriptor_depth_stencil_format') }); }); }); + +g.test('check_capability_guarantees') + .desc( + `check "texture-compression-bc" is supported or both "texture-compression-etc2" and "texture-compression-astc" are supported.` + ) + .fn(async t => { + const adapter = await getGPU(t.rec).requestAdapter(); + assert(adapter !== null); + + const features = adapter.features; + t.expect( + features.has('texture-compression-bc') || + (features.has('texture-compression-etc2') && features.has('texture-compression-astc')) + ); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts index 2d3e1dcc95aa..2b987175c542 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts @@ -85,3 +85,11 @@ g.test('setBindGroup,at_over') } ); }); + +g.test('validate,maxBindGroupsPlusVertexBuffers') + .desc(`Test that ${limit} <= maxBindGroupsPlusVertexBuffers`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxBindGroupsPlusVertexBuffers')); + t.expect(adapterLimit <= adapter.limits.maxBindGroupsPlusVertexBuffers); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts index 7948cce8af97..6d394f998cda 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'X'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts index 4585676fb2a4..26eeaa9a64fe 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Y'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts index 8be1aa4b4770..9a199f4cd3f5 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Z'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts index 997fa46a7e71..cff50726ba12 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts @@ -77,3 +77,21 @@ g.test('dispatchWorkgroups,at_over') } ); }); + +g.test('validate') + .desc( + `Test that ${limit} <= maxComputeWorkgroupSizeX x maxComputeWorkgroupSizeY x maxComputeWorkgroupSizeZ` + ) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + const defaultMaxComputeWorkgroupSizeProduct = + t.getDefaultLimit('maxComputeWorkgroupSizeX') * + t.getDefaultLimit('maxComputeWorkgroupSizeY') * + t.getDefaultLimit('maxComputeWorkgroupSizeZ'); + const maxComputeWorkgroupSizeProduct = + adapter.limits.maxComputeWorkgroupSizeX * + adapter.limits.maxComputeWorkgroupSizeY * + adapter.limits.maxComputeWorkgroupSizeZ; + t.expect(defaultLimit <= defaultMaxComputeWorkgroupSizeProduct); + t.expect(adapterLimit <= maxComputeWorkgroupSizeProduct); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts index 15fca54445a6..d504d0b7fb64 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts @@ -144,6 +144,14 @@ g.test('createBindGroup,at_over') ); }); +g.test('validate') + .desc(`Test that ${limit} is a multiple of 4 bytes`) + .fn(t => { + const { defaultLimit, adapterLimit } = t; + t.expect(defaultLimit % 4 === 0); + t.expect(adapterLimit % 4 === 0); + }); + g.test('validate,maxBufferSize') .desc(`Test that ${limit} <= maxBufferSize`) .fn(t => { diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts index 950323105570..0af5724f2a2a 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts @@ -111,3 +111,11 @@ g.test('createRenderPipeline,at_over') } ); }); + +g.test('validate') + .desc(`Test that ${limit} is a multiple of 4 bytes`) + .fn(t => { + const { defaultLimit, adapterLimit } = t; + t.expect(defaultLimit % 4 === 0); + t.expect(adapterLimit % 4 === 0); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts index 97a1c241287b..04e0fe72fa44 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts @@ -90,3 +90,11 @@ g.test('setVertexBuffer,at_over') } ); }); + +g.test('validate,maxBindGroupsPlusVertexBuffers') + .desc(`Test that ${limit} <= maxBindGroupsPlusVertexBuffers`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxBindGroupsPlusVertexBuffers')); + t.expect(adapterLimit <= adapter.limits.maxBindGroupsPlusVertexBuffers); + }); diff --git a/src/webgpu/capability_info.ts b/src/webgpu/capability_info.ts index 3626877544af..f0b5e938a134 100644 --- a/src/webgpu/capability_info.ts +++ b/src/webgpu/capability_info.ts @@ -667,6 +667,7 @@ const [ 'maxTextureArrayLayers': [ , 256, 256, ], 'maxBindGroups': [ , 4, 4, ], + 'maxBindGroupsPlusVertexBuffers': [ , 24, 24, ], 'maxBindingsPerBindGroup': [ , 1000, 1000, ], 'maxDynamicUniformBuffersPerPipelineLayout': [ , 8, 8, ], 'maxDynamicStorageBuffersPerPipelineLayout': [ , 4, 4, ],