Skip to content

Feedback after porting a few hundred GLSL lines to WGSL #1364

@baptistemanson

Description

@baptistemanson

Hi all,

I like to author some shaders in WebGL, on shadertoy or inside some work projects.
Here is my humble feedback after about 5h tinkering with WGSL:

  • var x : vec2<f32> = vec2<f32>(1. , 1.); gets old to type, vs vec2 x = vec2(1.,1.); for GLSL. I so often forget to put the type annotation, and current parsers are not that kind to point us towards the error.
  • Couldn't figure out how to bump the precision up. It caused a bunch of division by zero which do not fail but do garbage hard to debug
  • For buffer uniforms, I didn't find any way to expose them over except wrapped through a struct, which forced me to use more accessors.
  • I could not swizzle on function returns, like textureSample(my_vec2).x, maybe an implementation limitation?
  • Accessors such as .rgba didn't work. Also maybe an implementation limitation?
  • I didn't know how to handle const uniform expression, I usually put those outside the main in GLSL, but in WGSL it seems we put them into the main function and the compiler optimizes correctly. It's nice, but should be expressed somewhere, or documented I guess?

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions