Open Bug 1923924 Opened 2 years ago Updated 1 year ago

WGSL does not force parentheses in equal-precedence operations in expressions

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

People

(Reporter: ErichDonGubler, Unassigned)

References

Details

WGSL's implementation in Firefox does not require disambiguation of operators with equal precedence in expressions. This is contrary to WGSL spec. requirements specified in https://www.w3.org/TR/WGSL/#operator-precedence-associativity.

WGPU upstream issue: wgpu#6397

An example of this validation being implemented in Chrome; at time of writing, this snippet compiles without a validation error in Firefox:

fn random_gradient(ix : u32, iy : u32) -> vec2<f32>  {
  let w : u32 = u32(8 * 32);
  let s = w / 2; 
  var a = ix;
  var b = iy;
  a = a * 3284157443;

  b ^= a << s | a >> w - s;
  b = b * 1911520717;

  a ^= b << s | b >> w - s;
  a = a * 2048419325;

  let random = f32(a) * (3.14159265 / ~(0xEFFFFFFF));

  return vec2<f32>(sin(random), cos(random));
}

This example was derived from the description of bug 1923832.

Severity: -- → S3
Summary: WGSL does not force parentheses in equal-precedence operations in expressions per spec. → WGSL does not force parentheses in equal-precedence operations in expressions
You need to log in before you can comment on or make changes to this bug.