google / tour-of-wgsl

https://google.github.io/tour-of-wgsl/
BSD 3-Clause "New" or "Revised" License
111 stars 21 forks source link

Error in provided code of very first page on nightly Firefox #101

Open albertsgarde opened 2 months ago

albertsgarde commented 2 months ago

When I open the webpage at https://google.github.io/tour-of-wgsl/ the code

@binding(0) @group(0) var<uniform> frame : u32;
@vertex
fn vtx_main(@builtin(vertex_index) vertex_index : u32) -> @builtin(position) vec4f {
  const pos = array(
    vec2( 0.0,  0.5),
    vec2(-0.5, -0.5),
    vec2( 0.5, -0.5)
  );

  return vec4f(pos[vertex_index], 0, 1);
}

@fragment
fn frag_main() -> @location(0) vec4f {
  return vec4(1, sin(f32(frame) / 128), 0, 1);
}

and an error

Shader '' parsing error: expected assignment or increment/decrement, found 'pos'
  ┌─ wgsl:4:9
  │
4 │   const pos = array(
  │         ^^^ expected assignment or increment/decrement

This error disappears when I replace const with let, but I then get another error a few lines down which I don't think is relevant here.

I guess this is because I am using Firefox Nightly on Linux instead of Chrome on MacOS or Windows? If this is not supported, it would be nice if that were more clear in the README. If it is, what am I getting wrong?

dj2 commented 2 months ago

This sounds like an issue in the Firefox implementation. I'd suggest filing a bug against Firefox.

albertsgarde commented 2 months ago

Oh wow. If I figure out how to do that I will