-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Replace glsl-to-spirv and spirv-reflect with Naga #209
Replace glsl-to-spirv and spirv-reflect with Naga #209
Conversation
I love this. Naga is a big step forward in terms of build complexity and compile times. I'll try to review as soon as I can. |
22e6ff1
to
9a1a498
Compare
I also just added a preprocessor in the |
a47749c
to
1355128
Compare
FYI I just tried rebasing this onto the current master commit, applied the fixes I've been experimenting with for wasm for the non-rendering-related stuff, and managed to compile all crates to wasm! No idea yet if rendering will actually work on the web, but the tests still pass and examples still run on Linux, and without this PR I couldn't get anything depending on the renderer to compile to wasm at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lachlansneff Great job! I'm just going to give it a chance in webgl2_renderer backend. Could you rebase it on current master? Do you have an idea will it work with "300 es" shaders? Thanks!
EDIT:
I played a bit with this PR and bevy's 2d sprite and sprite_sheet examples. First I've rebased it on current master and changed naga to latest version (some minor changes were required: mrk-its@14ada61). Then I was able to compile sprite
example. Unfortunately it panics a lot:
- vertex sprite shader was parsed, but it failed while writing spirv data.
- after disabling conversion to spirv it failed on parsing fragment shader.
(Float, 4) => VertexFormat::Float, | ||
_ => return Err(()), | ||
}, | ||
Vector { size, kind, width } => match (size, kind, width) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have this (size, kind, width) information preserved. Take a look on my webgl2_renderer: https://github.com/bevyengine/bevy/pull/613/files#diff-d4ccfb870bfebbfae7f1b458a69aed63 - I have to recreate this information from this enum :)
I tried updating this PR to current bevy main and released |
Dang. Thanks for checking. Hopefully we'll be able to use it Soon™ 😄 |
Replace both
bevy-glsl-to-spirv
(a fork ofglsl-to-spirv
) andspirv-reflect
withnaga
This should reduce compile times a lot, as well make it easier to cross-compile for platforms like android, ios, and webassembly.
The glsl frontends and spirv backend for
naga
are not very mature yet. They're progressing pretty quickly, but they're still not usable for real applications yet. Hopefully this will change in the upcoming weeks.