-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support shader includes #185
Comments
Thinking about this a bit more. If we add PBR for example it would be handy to have a way for a bevy user to include a general "lighting.glsl" include that comes from bevy. This lets them build out their own shader but still hook into our existing lighting and shadow techniques. |
Agreed on all counts. I think this should be a relatively easy win, but if its not id prefer to wait for naga as this won't block progress on the renderer. |
Yeah I think waiting for naga is probably best. Shaderc is just too much, and making your own system is probably not worth it. |
IMO shaderc isn't that bad. It's a bit annoying but it's just a one time install. Basically just install Another option would be to use a Rust crate like glsl-include in the interim |
It's not that simple. You need python too, and I had a hell of a time getting cmake to find python even though it was installed and in the path. |
If building from source is too much of a pain, using precompiled shaderc libs and just pointing the env variable to it is pretty reliable (and the recommended way unless it doesn't work on your platform). https://github.com/google/shaderc-rs#setup (note just linking the above for posterity, not trying to be rude or say you didn't see it or anything) |
Yeah that seems reasonable. I was worried env variables would make it less of a "works out of the box" experience. Is there a way to set env variables in Cargo.toml? |
Don't believe so... not sure that's a great idea even if it was possible. Instead I'd suggest using the same route Amethyst does: Check in precompiled .spv files for all default shaders which can be ingested directly so that no shader compiler is needed by a default user just downloading bevy. Then under a feature flag, add shaderc (and add/point to docs about how to set it up) for those who want to actually mess with shaders. |
I'm experimenting with replacing |
This seems to be resolved as of #3137 and subsequent PRs. It should (?) work for GLSL shaders too, not just WGSL ones. Closing t his issue. |
This is pretty common and looks something like this:
One problem would be that the current shader compiler we use does not support includes. Currently shaderc supports includes, and I believe naga will support them as well.
The text was updated successfully, but these errors were encountered: