-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 wgsl errors in the game of life example #13624
Conversation
This affects other examples, so if this approach is okay, I can repeat it for other examples too. |
IIRC game_of_life is the only example that does that kind of thing, I'm not sure which other example you are referring to. |
I mean there's a pattern of https://github.com/bevyengine/bevy/blob/main/examples/shader/array_texture.rs bevy/examples/shader/array_texture.rs Line 92 in 09fb6b4
https://github.com/bevyengine/bevy/blob/main/assets/shaders/array_texture.wgsl and the example code run outside of bevy's directory structure fails to load the files it depends on, and displays a blank screen:
I'm proposing to move these paths to a |
I'd be happy to see this done more broadly in some form. The current PR is an improvement though so I'll merge it on Monday unless you tell me not to. |
I think moving the shader path into a constant is a great idea. The actual error produced here feels confusing to me, which is unfortunate.
Specifically, the |
The examples won't work when copy-pasted to another project, without also copying their shader files. This change adds constants at the top of the files to bring attention to the dependencies. Follow up to [#13624](#13624 (comment))
Currently copypasting the example into a new project without also copying "shaders/game_of_life.wgsl" gives an unhelpful blank screen.
This change makes it panic instead. I think nicer error handling is outside scope of the example, and this is good enough to point out that the shader code is missing.