fralonra / wgshadertoy

A WGSL playground inspired by Shadertoy.
MIT License
90 stars 6 forks source link

Handle invalid shaders #1

Open fralonra opened 1 year ago

fralonra commented 1 year ago

Issues

Currently invalid shader input would panic at device.create_shader_module: https://github.com/fralonra/wgshadertoy/blob/87e36ac295b9c02f4c0e6dd1dc31231fa549ad59/src/runtime.rs#L280 Thus makes the whole program to crash.

The approaches I've tried

Helps needed

I'm glad to hear useful infomation about how to handle invalid shaders. Thanks a lot!

fralonra commented 1 year ago

Currently I skip the naga check, and use error scopes to capture validation error: https://github.com/fralonra/wgshadertoy/commit/22705e420e78d3e22a2728a8d6a35c84817244b6