From 5c571490b4c077f0319cb6a9b06d77ed39e205dd Mon Sep 17 00:00:00 2001 From: David Neto Date: Wed, 14 Aug 2024 15:38:20 -0400 Subject: [PATCH] clamp validation: conditionally include test function (#3904) 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. --- .../validation/expression/call/builtin/clamp.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts index e94162b1ce5a..ff0114097f90 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts @@ -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]; @@ -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 = {}; @@ -187,7 +192,7 @@ fn foo() { code: wgsl, constants, reference: ['o_low', 'o_high'], - statements: ['foo();'], + statements: t.params.in_shader ? ['foo();'] : [], }); } });