Skip to content

Commit

Permalink
Use largest maxInterStageShaderVariables in maxInterStageShaderCompon…
Browse files Browse the repository at this point in the history
…ents 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.
  • Loading branch information
Jiawei-Shao authored Oct 27, 2023
1 parent aa7ab4f commit 36a23bf
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -142,6 +145,7 @@ g.test('createRenderPipeline,at_over')
);

await t.testCreateRenderPipeline(pipelineDescriptor, async, shouldError, code);
}
},
extraLimits
);
});

0 comments on commit 36a23bf

Please sign in to comment.