Skip to content

Commit

Permalink
clamp validation: conditionally include test function (#3904)
Browse files Browse the repository at this point in the history
Add variants where the function containing the function call being
tested is both in and not-in the tested shader, i.e. statically
accessed or not.

This matters for override validation.
  • Loading branch information
dneto0 authored Aug 14, 2024
1 parent a17d71d commit 5c57149
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ Validates that low <= high.
const scalar = scalarTypeOf(ty);
return scalar !== Type.abstractInt && scalar !== Type.abstractFloat;
})
// in_shader: Is the function call statically accessed by the entry point?
.combine('in_shader', [false, true] as const)
)
.beforeAllSubcases(t => {
const ty = kValuesTypes[t.params.type];
Expand Down Expand Up @@ -176,7 +178,10 @@ fn foo() {
const shader_error =
error && t.params.lowStage === 'constant' && t.params.highStage === 'constant';
const pipeline_error =
error && t.params.lowStage !== 'runtime' && t.params.highStage !== 'runtime';
t.params.in_shader &&
error &&
t.params.lowStage !== 'runtime' &&
t.params.highStage !== 'runtime';
t.expectCompileResult(!shader_error, wgsl);
if (!shader_error) {
const constants: Record<string, number> = {};
Expand All @@ -187,7 +192,7 @@ fn foo() {
code: wgsl,
constants,
reference: ['o_low', 'o_high'],
statements: ['foo();'],
statements: t.params.in_shader ? ['foo();'] : [],
});
}
});
Expand Down

0 comments on commit 5c57149

Please sign in to comment.