Skip to content

Commit 36a23bf

Browse files
authored
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.
1 parent aa7ab4f commit 36a23bf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { assert, range } from '../../../../../common/util/util.js';
1+
import { range } from '../../../../../common/util/util.js';
22

3-
import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js';
3+
import { kMaximumLimitBaseParams, LimitsRequest, makeLimitTestGroup } from './limit_utils.js';
44

55
function getTypeForNumComponents(numComponents: number) {
66
return numComponents > 1 ? `vec${numComponents}f` : 'f32';
@@ -21,7 +21,6 @@ function getPipelineDescriptor(
2121

2222
const maxInterStageVariables = device.limits.maxInterStageShaderVariables;
2323
const numComponents = Math.min(maxVertexShaderOutputComponents, maxFragmentShaderInputComponents);
24-
assert(Math.ceil(numComponents / 4) <= maxInterStageVariables);
2524

2625
const num4ComponentVaryings = Math.floor(numComponents / 4);
2726
const lastVaryingNumComponents = numComponents % 4;
@@ -127,6 +126,10 @@ g.test('createRenderPipeline,at_over')
127126
sampleMaskIn,
128127
sampleMaskOut,
129128
} = t.params;
129+
// Request the largest value of maxInterStageShaderVariables to allow the test using as many
130+
// inter-stage shader components as possible without being limited by
131+
// maxInterStageShaderVariables.
132+
const extraLimits: LimitsRequest = { maxInterStageShaderVariables: 'adapterLimit' };
130133
await t.testDeviceWithRequestedMaximumLimits(
131134
limitTest,
132135
testValueName,
@@ -142,6 +145,7 @@ g.test('createRenderPipeline,at_over')
142145
);
143146

144147
await t.testCreateRenderPipeline(pipelineDescriptor, async, shouldError, code);
145-
}
148+
},
149+
extraLimits
146150
);
147151
});

0 commit comments

Comments
 (0)