-
Notifications
You must be signed in to change notification settings - Fork 6
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
Handle invalid shaders #1
Comments
Currently I skip the naga check, and use error scopes to capture validation error: |
I had a typo and mine output an error to the terminal and exited... I assume this is the same issue:
|
Looks like the shader is missing the definition for |
Ah yeah, thank you, of course, but the risk of a typo in your code shouldn't be a crash and a loss of all code. I assumed that was what this issue was about. |
Issues
Currently invalid shader input would panic at
device.create_shader_module
:wgshadertoy/src/runtime.rs
Line 280 in 87e36ac
Thus makes the whole program to crash.
The approaches I've tried
device.on_uncaptured_error
to catch it:wgshadertoy/src/context.rs
Line 48 in 87e36ac
However it would continuously generate errors and block the main thread:
naga
to validate the shader beforehand:wgshadertoy/src/runtime.rs
Line 396 in f52e882
Unfortunately there are some times (
vec2(0.0, 2.0, 4.0)
etc.) the shader has passed the naga check, but still failed at the same check period inwgpu-core
:https://github.com/gfx-rs/wgpu/blob/9f82504d8a3b6e234599b19cc35c299bcec8b138/wgpu-core/src/device/mod.rs#L1249
Helps needed
I'm glad to hear useful infomation about how to handle invalid shaders. Thanks a lot!
The text was updated successfully, but these errors were encountered: