From 3ed497b59345978f8460b5e375e7cd18f3b98872 Mon Sep 17 00:00:00 2001 From: petermcneeleychromium <96925679+petermcneeleychromium@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:00:41 -0500 Subject: [PATCH] Smoothstep validation changes : No compiler error for anything except low == high (for const/override) (#4082) * Update smoothstep validation to only fail on low/high equal * Change to triple equals --------- Co-authored-by: Peter McNeeley --- .../expression/call/builtin/smoothstep.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/webgpu/shader/validation/expression/call/builtin/smoothstep.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/smoothstep.spec.ts index 2879055ab216..2adaac41a371 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/smoothstep.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/smoothstep.spec.ts @@ -51,8 +51,8 @@ Validates that constant evaluation and override evaluation of ${builtin}() rejec .fn(t => { const type = kValuesTypes[t.params.type]; - // We expect to fail if low >= high. - const expectedResult = t.params.value1 < t.params.value2; + // We expect to fail if low == high. + const expectedResult = t.params.value1 !== t.params.value2; validateConstOrOverrideBuiltinEval( t, @@ -66,7 +66,7 @@ Validates that constant evaluation and override evaluation of ${builtin}() rejec const kStages = [...kConstantAndOverrideStages, 'runtime'] as const; g.test('partial_eval_errors') - .desc('Validates that low < high') + .desc('Validates that low != high') .params(u => u .combine('lowStage', kStages) @@ -127,7 +127,7 @@ fn foo() { let tmp = smoothstep(${lowArg}, ${highArg}, x); }`; - const error = t.params.low >= t.params.high; + const error = t.params.low === t.params.high; const shader_error = error && t.params.lowStage === 'constant' && t.params.highStage === 'constant'; const pipeline_error = @@ -349,7 +349,7 @@ g.test('early_eval_errors') validateConstOrOverrideBuiltinEval( t, builtin, - /* expectedResult */ t.params.low < t.params.high, + /* expectedResult */ t.params.low !== t.params.high, [f32(t.params.low), f32(t.params.high), f32(0)], t.params.stage );