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

Misleading error message when f64 is used in shader #4559

Open
TrueDoctor opened this issue Jun 19, 2023 · 3 comments
Open

Misleading error message when f64 is used in shader #4559

TrueDoctor opened this issue Jun 19, 2023 · 3 comments
Labels
area: validation Issues related to validation, diagnostics, and error handling kind: diagnostics Error message should be better naga Shader Translator

Comments

@TrueDoctor
Copy link

TrueDoctor commented Jun 19, 2023

When using a double-precision float in a shader without enabling the wgpu SHADER_F64 feature, the validation fails with this error message:

thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_shader_module
      note: label = `gpu::eval`

Shader validation error:
  ┌─ gpu::eval:1:1
  │
1 │
  │   naga::Constant [6]


    Constant [6] '' is invalid
    The type doesn't match the constant

', /home/dennis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.1/src/backend/direct.rs:3019:5

https://github.com/gfx-rs/naga/blob/f31093fb3b0c8183069037fcac99a90d3adef2bd/src/valid/mod.rs#L306-L310

This throws an invalid type error even though spirv-val and naga-cli pass.
Does it make sense to throw a more descriptive error here?

https://github.com/gfx-rs/naga/blob/f31093fb3b0c8183069037fcac99a90d3adef2bd/src/valid/type.rs#L217-L224

@eddyb
Copy link
Contributor

eddyb commented Jun 19, 2023

My two cents: the message for InvalidType is simply wrong (not a mismatch but rather the type itself is not supported) and it should be wrapping a TypeError which itself would have all the necessary information to explain what went wrong with the constant's type.

@ErichDonGubler ErichDonGubler added the area: validation Issues related to validation, diagnostics, and error handling label Jul 25, 2023
@teoxoy teoxoy added the kind: diagnostics Error message should be better label Jul 27, 2023
@teoxoy
Copy link
Member

teoxoy commented Jul 27, 2023

I think the changes in gfx-rs/naga#2266 (which is part of the 0.13 release) resolved this issue. You should now get the proper error (capability error). Could you try it again?

@TrueDoctor
Copy link
Author

Yes, I should have time to try that out in the next few days

@cwfitzgerald cwfitzgerald transferred this issue from gfx-rs/naga Oct 25, 2023
@cwfitzgerald cwfitzgerald added the naga Shader Translator label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling kind: diagnostics Error message should be better naga Shader Translator
Projects
None yet
Development

No branches or pull requests

5 participants