Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
magcius opened this issue Oct 3, 2024 · 0 comments
Labels
kind: diagnostics Error message should be better naga Shader Translator

Comments

@magcius
Copy link
Contributor

magcius commented Oct 3, 2024

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

@teoxoy teoxoy added naga Shader Translator kind: diagnostics Error message should be better labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: diagnostics Error message should be better naga Shader Translator
Projects
Status: Todo
Development

No branches or pull requests

2 participants