Skip to content
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

spirv-builder 0.10 not on crates.io #39

Open
ArrEssJay opened this issue Oct 16, 2024 · 5 comments
Open

spirv-builder 0.10 not on crates.io #39

ArrEssJay opened this issue Oct 16, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@ArrEssJay
Copy link
Contributor

Expected Behaviour

Latest published spirv-builder crate on crates.io is 0.9 - this requires toolchain nightly-2023-05-27, which is inconsistent with nightly-2024-04-24 currently referred to in rust-gpu top level rust-toolchain.toml.

This appears to be resolved in spirv-builder 0.10, however this is not published.

@LegNeato LegNeato added the bug Something isn't working label Oct 17, 2024
@LegNeato
Copy link
Collaborator

Ah, we should push a new version every time we bump on master as folks may be using builder directly via cargo. Until it is published you can use a git dependency. Let me know if for some reason that doesn't work.

@utensil
Copy link

utensil commented Oct 17, 2024

Sorry to barge in. I have a related question:

From the wgpu runner examples of rust-gpu, and from how GraphiteEditor handle it, one can see that the building of rust shader crates into SPIRV is done via a standalone CLI program (GraphiteEditor made a lightweight wrapper around it to call the CLI from Rust to compile shader crates).

Is this the encouraged practice? I was imagining a more rust native way to integrate the host program (handles non-GPU logic, and GPU runtime and the execution of shaders) and the compilation of shader crates.

Particularly, if the host rust program need to use a newer rust nightly toolchain (maybe required by other crates in the host program) than spirv-builder (which needs significant more work to bump rust toolchain, thus moving slower), this way seems to be the only option? GraphiteEditor seems to choose to use the same rust toolchain for the host program as spirv-builder.

@LegNeato
Copy link
Collaborator

LegNeato commented Oct 17, 2024

Yes, some projects use the required pinned nightly via spirv-builder, generate the .spv file, and then consume that via their host rust program using stable / whatever rust version they need for their application. Another example is https://github.com/charles-r-earp/krnl I believe. We support this and want to add documentation and examples to make it easier to discover.

The project's goal is to track nightly so at least if folks are using nightly they can use one toolchain, and then create a tool (cargo gpu) to handle all the manual gyrations for other modes and reduce toil in general for folks who don't need to control the build system themselves.

Long-term we want to be in rustc 😄

@schell
Copy link
Contributor

schell commented Oct 17, 2024

@utensil I also do this in renderling/shaders. I prefer this setup because it makes recompilation explicit and indeed, you can keep using latest stable or nightly for the rest of your project. It also enables other workflows, like using naga to translate the generated SPIR-V into WGSL for web.

@utensil
Copy link

utensil commented Oct 18, 2024

Thank you both for the explanations and pointers to examples ❤️

I had starred both repos before but didn't realize that they are both based on rust-gpu 😮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants