Skip to content

Error messages like "The type of [4] doesn't match the type stored in [5]" are meaningless. #6363

Open
@magcius

Description

@magcius

Description
While working on a GLSL shader bug the other day, I ran into this error message:

error: 
  ┌─ flat-interpolator.vert.glsl:1:1
  │
1 │ void main() {
  │ ^^^^^^^^^^^ naga::Function [0]
2 │     int v = gl_VertexIndex % 4;
  │         ^^^^^^^^^^^^^^^^^^^^^^
  │         │   │
  │         │   naga::Expression [4]
  │         naga::Expression [5]

Function [0] 'main' is invalid:
        The type of [4] doesn't match the type stored in [5]

Repro steps

void main() {
    int v = gl_VertexIndex % 4;
}

Expected vs observed behavior
While printing the expression [4] and [5] is great, it still is difficult to know what the individual types are, so I can have a better idea of where the mismatch is. Please print the actual types.

(There's a separate glsl-in bug with the builtins here which is the underlying cause, but I have encountered frustrating error messages about types too many times, so I care about that one more)

Platform
wgpu 3d584f9
Windows 10

Metadata

Metadata

Labels

kind: diagnosticsError message should be betternagaShader Translator

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions