diff --git a/src/webgpu/shader/validation/expression/binary/div_rem.spec.ts b/src/webgpu/shader/validation/expression/binary/div_rem.spec.ts index 02922ef2d909..4169786cb69b 100644 --- a/src/webgpu/shader/validation/expression/binary/div_rem.spec.ts +++ b/src/webgpu/shader/validation/expression/binary/div_rem.spec.ts @@ -58,6 +58,7 @@ g.test('scalar_vector') .combine('compound_assignment', [false, true] as const) .beginSubcases() .combine('op', keysOf(kOperators)) + .combine('rhs_value', [0, 1] as const) ) .beforeAllSubcases(t => { if ( @@ -82,19 +83,26 @@ g.test('scalar_vector') ${hasF16 ? 'enable f16;' : ''} fn f() { var v = ${lhs.create(0).wgsl()}; - v ${op.op}= ${rhs.create(0).wgsl()}; + v ${op.op}= ${rhs.create(t.params.rhs_value).wgsl()}; } ` : ` ${hasF16 ? 'enable f16;' : ''} const lhs = ${lhs.create(1).wgsl()}; -const rhs = ${rhs.create(1).wgsl()}; +const rhs = ${rhs.create(t.params.rhs_value).wgsl()}; const foo ${resTypeIsTypeable ? `: ${resType}` : ''} = lhs ${op.op} rhs; `; + const scalarLHS = scalarTypeOf(concreteTypeOf(lhs)); + const integral = scalarLHS === Type.u32 || scalarLHS === Type.i32; let valid = !hasBool && resType !== null; if (valid && t.params.compound_assignment) { - valid = valid && isConvertible(resType!, concreteTypeOf(lhs)); + valid = + valid && + isConvertible(resType!, concreteTypeOf(lhs)) && + (!integral || t.params.rhs_value === 1); + } else { + valid = valid && t.params.rhs_value === 1; } t.expectCompileResult(valid, code); });