From 36a23bf8254095e8308ce64fcea3864b27b8a021 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Fri, 27 Oct 2023 13:09:01 +0800 Subject: [PATCH] Use largest maxInterStageShaderVariables in maxInterStageShaderComponents tests (#3104) This patch uses the largest value of maxInterStageShaderVariables supported on current adapter in the tests about maxInterStageShaderComponents when creating devices so that when the value we use as maxInterStageShaderComponents is larger than the default one, we won't be limited by the default value of maxInterStageShaderVariables. This patch also removes the assertion that the value of maxInterStageShaderVariables must be larger than a quarter of maxInterStageShaderComponents as on many backends the largest value of maxInterStageShaderComponents is equal to 4x maxInterStageShaderVaraibles, so in "overLimit" tests the value of maxInterStageShaderComponents can be greater than 4x device.limits.maxInterStageShaderVaraibles. --- .../limits/maxInterStageShaderComponents.spec.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.ts index 7a36d1aa14e0..b9c43683b221 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.ts @@ -1,6 +1,6 @@ -import { assert, range } from '../../../../../common/util/util.js'; +import { range } from '../../../../../common/util/util.js'; -import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; +import { kMaximumLimitBaseParams, LimitsRequest, makeLimitTestGroup } from './limit_utils.js'; function getTypeForNumComponents(numComponents: number) { return numComponents > 1 ? `vec${numComponents}f` : 'f32'; @@ -21,7 +21,6 @@ function getPipelineDescriptor( const maxInterStageVariables = device.limits.maxInterStageShaderVariables; const numComponents = Math.min(maxVertexShaderOutputComponents, maxFragmentShaderInputComponents); - assert(Math.ceil(numComponents / 4) <= maxInterStageVariables); const num4ComponentVaryings = Math.floor(numComponents / 4); const lastVaryingNumComponents = numComponents % 4; @@ -127,6 +126,10 @@ g.test('createRenderPipeline,at_over') sampleMaskIn, sampleMaskOut, } = t.params; + // Request the largest value of maxInterStageShaderVariables to allow the test using as many + // inter-stage shader components as possible without being limited by + // maxInterStageShaderVariables. + const extraLimits: LimitsRequest = { maxInterStageShaderVariables: 'adapterLimit' }; await t.testDeviceWithRequestedMaximumLimits( limitTest, testValueName, @@ -142,6 +145,7 @@ g.test('createRenderPipeline,at_over') ); await t.testCreateRenderPipeline(pipelineDescriptor, async, shouldError, code); - } + }, + extraLimits ); });