Expand description
Pass: broadcast scalar operand of vec/scalar comparisons.
FunctionsΒ§
- is_
arith_ πop - is_
compare_ πop - rewrite_
vec_ πscalar_ compare - HLSL auto-broadcasts the scalar operand of a comparison
(
vec3 >= 0.1β element-wisevec3 >= float3(0.1)); WGSL rejectsvec3<f32> >= f32withInvalidBinaryOperandTypes(a dominant validate-stage cluster, op=Ge/Le/Gt/Lt/Eq/Ne withlhs_type: Vector). Wraps the scalar operand in avecN<f32>(β¦)constructor so the comparison evaluates as a vector-bool. - try_
broadcast_ πscalar_ compare - Inspect a comparison binopβs operands; if one is a known vector and the other is a known scalar f32, emit a constructor wrap around the scalar so the comparison evaluates as a vector-bool. Zero-length insertions only, so the wrap survives even when other passes have also edited the operands.
- try_
promote_ πi32_ arith - Promote an
i32operand of anf32 β¦arithβ§ i32binop tof32by wrapping it infloat(β¦). WGSL refuses mixedf32 * i32arithmetic; corpus shape (martin - pixies party 2 random mosscity.milk): - walk_
block_ πfor_ vsc - walk_
expr_ πfor_ vsc - walk_
stmt_ πfor_ vsc