Sitelet https://github.com/gpuweb/gpuweb/issues/2213
Skip to content

☂️ Initial internal feedback #2213

Description

@litherum

Here's some feedback that one of the internal teams had when starting out with WGSL:

  1. Explicit post-fix requirements: It’s a bit surprising to have to stick post-fix modifiers on so many numbers in order to get simple operations to work: vert.VertexIndex % 3u == 0u Requiring integral-valued float literals to have .0 seems gratuitous #739
  2. Lack of promotion to floating point: It's a bit weird to also have to explicitly add .0 to numbers to make them floating point: vec4<f32>(1, 0, 0, 1) must be vec4<f32>(1.0, 0.0, 0.0, 1.0) Requiring integral-valued float literals to have .0 seems gratuitous #739
  3. Post-fix prohibitions: It's even weird to be prohibited from point a f at the back of floating given the above requirements. It's not obvious how doubles would be supported. Allow f suffix for float literals #2210
  4. Explicit brace requirements on 1-liners: Surprising. Consider not requiring braces in some situations #2211
  5. elseif instead of else if: Okay, but why? Consider replacing elseif with else if #2212

Summary: Shaders authors expect a C-like syntax, even Metal being C++ like still supports C style syntax. WGSL is surprising in that it seems to be neither fully C-style nor C++-style.

Update

  1. C-style casts don't work: output.position.x = (float)(vert.VertexID / 2u) * 4.0 - 1.0; C-style casts #2220

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions