Skip to content

Commit

Permalink
extractBits validation: conditionally include tested code in the shad…
Browse files Browse the repository at this point in the history
…er (#3906)

This matters when exercising the'override' cases.
  • Loading branch information
dneto0 authored Aug 15, 2024
1 parent 67dc033 commit c279d02
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Validates that count and offset must be smaller than the size of the primitive.
{ offset: 0, count: 33 },
{ offset: 1, count: 33 },
] as const)
// in_shader: Is the function call statically accessed by the entry point?
.combine('in_shader', [false, true] as const)
)
.fn(t => {
let offsetArg = '';
Expand Down Expand Up @@ -138,7 +140,10 @@ fn foo() {
const shader_error =
error && t.params.offsetStage === 'constant' && t.params.countStage === 'constant';
const pipeline_error =
error && t.params.offsetStage !== 'runtime' && t.params.countStage !== 'runtime';
t.params.in_shader &&
error &&
t.params.offsetStage !== 'runtime' &&
t.params.countStage !== 'runtime';
t.expectCompileResult(!shader_error, wgsl);
if (!shader_error) {
const constants: Record<string, number> = {};
Expand All @@ -149,6 +154,7 @@ fn foo() {
code: wgsl,
constants,
reference: ['o_offset', 'o_count'],
statements: t.params.in_shader ? ['foo();'] : [],
});
}
});
Expand Down

0 comments on commit c279d02

Please sign in to comment.