diff options
Diffstat (limited to 'testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js')
-rw-r--r-- | testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js | 91 |
1 files changed, 53 insertions, 38 deletions
diff --git a/testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js b/testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js index 1c09dcfcfd..14601e20a1 100644 --- a/testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js +++ b/testing/web-platform/mozilla/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxStorageBuffersPerShaderStage.spec.js @@ -1,9 +1,11 @@ /** * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts **/import { range, reorder, - kReorderOrderKeys } from + kReorderOrderKeys, + assert } from '../../../../../common/util/util.js'; +import { kShaderStageCombinationsWithStage } from '../../../../capability_info.js'; import { GPUConst } from '../../../../constants.js'; import { @@ -13,8 +15,14 @@ import { kBindingCombinations, getPipelineTypeForBindingCombination, getPerStageWGSLForBindingCombination } from + './limit_utils.js'; +const kExtraLimits = { + maxBindingsPerBindGroup: 'adapterLimit', + maxBindGroups: 'adapterLimit' +}; + const limit = 'maxStorageBuffersPerShaderStage'; export const { g, description } = makeLimitTestGroup(limit); @@ -48,34 +56,31 @@ desc( ). params( kMaximumLimitBaseParams. - combine('visibility', [ - GPUConst.ShaderStage.VERTEX, - GPUConst.ShaderStage.FRAGMENT, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.FRAGMENT, - GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.FRAGMENT | GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.FRAGMENT | GPUConst.ShaderStage.COMPUTE] - ). + combine('visibility', kShaderStageCombinationsWithStage). combine('type', ['storage', 'read-only-storage']). - combine('order', kReorderOrderKeys) + combine('order', kReorderOrderKeys). + filter( + ({ visibility, type }) => + (visibility & GPUConst.ShaderStage.VERTEX) === 0 || type !== 'storage' + ) ). fn(async (t) => { const { limitTest, testValueName, visibility, order, type } = t.params; - if (visibility & GPUConst.ShaderStage.VERTEX && type === 'storage') { - // vertex stage does not support storage buffers - return; - } - await t.testDeviceWithRequestedMaximumLimits( limitTest, testValueName, async ({ device, testValue, shouldError }) => { + t.skipIf( + t.adapter.limits.maxBindingsPerBindGroup < testValue, + `maxBindingsPerBindGroup = ${t.adapter.limits.maxBindingsPerBindGroup} which is less than ${testValue}` + ); + await t.expectValidationError(() => { createBindGroupLayout(device, visibility, type, order, testValue); }, shouldError); - } + }, + kExtraLimits ); }); @@ -90,41 +95,44 @@ desc( ). params( kMaximumLimitBaseParams. - combine('visibility', [ - GPUConst.ShaderStage.VERTEX, - GPUConst.ShaderStage.FRAGMENT, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.FRAGMENT, - GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.FRAGMENT | GPUConst.ShaderStage.COMPUTE, - GPUConst.ShaderStage.VERTEX | GPUConst.ShaderStage.FRAGMENT | GPUConst.ShaderStage.COMPUTE] - ). + combine('visibility', kShaderStageCombinationsWithStage). combine('type', ['storage', 'read-only-storage']). - combine('order', kReorderOrderKeys) + combine('order', kReorderOrderKeys). + filter( + ({ visibility, type }) => + (visibility & GPUConst.ShaderStage.VERTEX) === 0 || type !== 'storage' + ) ). fn(async (t) => { const { limitTest, testValueName, visibility, order, type } = t.params; - if (visibility & GPUConst.ShaderStage.VERTEX && type === 'storage') { - // vertex stage does not support storage buffers - return; - } - await t.testDeviceWithRequestedMaximumLimits( limitTest, testValueName, - async ({ device, testValue, shouldError }) => { - const kNumGroups = 3; + async ({ device, testValue, shouldError, actualLimit }) => { + const maxBindingsPerBindGroup = Math.min( + t.device.limits.maxBindingsPerBindGroup, + actualLimit + ); + const kNumGroups = Math.ceil(testValue / maxBindingsPerBindGroup); + + // Not sure what to do in this case but best we get notified if it happens. + assert(kNumGroups <= t.device.limits.maxBindGroups); + const bindGroupLayouts = range(kNumGroups, (i) => { - const minInGroup = Math.floor(testValue / kNumGroups); - const numInGroup = i ? minInGroup : testValue - minInGroup * (kNumGroups - 1); + const numInGroup = Math.min( + testValue - i * maxBindingsPerBindGroup, + maxBindingsPerBindGroup + ); return createBindGroupLayout(device, visibility, type, order, numInGroup); }); + await t.expectValidationError( () => device.createPipelineLayout({ bindGroupLayouts }), shouldError ); - } + }, + kExtraLimits ); }); @@ -152,12 +160,18 @@ fn(async (t) => { limitTest, testValueName, async ({ device, testValue, actualLimit, shouldError }) => { + t.skipIf( + bindGroupTest === 'sameGroup' && testValue > device.limits.maxBindingsPerBindGroup, + `can not test ${testValue} bindings in same group because maxBindingsPerBindGroup = ${device.limits.maxBindingsPerBindGroup}` + ); + const code = getPerStageWGSLForBindingCombination( bindingCombination, order, bindGroupTest, (i, j) => `var<storage> u${j}_${i}: f32`, (i, j) => `_ = u${j}_${i};`, + device.limits.maxBindGroups, testValue ); const module = device.createShaderModule({ code }); @@ -169,6 +183,7 @@ fn(async (t) => { shouldError, `actualLimit: ${actualLimit}, testValue: ${testValue}\n:${code}` ); - } + }, + kExtraLimits ); });
\ No newline at end of file |