Add preliminary support for Rust as an output format (via rust-gpu
)
#5175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds preliminary support for Rust as a naga output format. Currently it only supports
rust-gpu
but the intention is to support CPU as well.I broke this into commits that touch non-Rust backend things and then a big 'ol commit adding the Rust backend. Happy to split out any changes into different PRs. I kept all the Rust conversion logic in one file for now but intend to break it up for readability in the future.
I studied the existing backends and it looks like the wild west...some use shared abstractions, some don't. I tried to match to the GLSL backend style where possible but didn't worry too much about doing so.
I am still heavily working on this, though it is at the point where it actually does something(ish). I mainly wanted to put this up so that a) folks know this is coming and b) folks can iterate on this with me if they want.
If you'd prefer to wait until functionality is close to complete to land rather than iterating in-repo, I am totally fine with closing this PR and working on the backend in my fork.
Testing
cargo test --all-features --release rust
RUST_LOG=trace cargo run --release -- /tmp/whatever.frag /tmp/whatever.rs && cat /tmp/whatever.rs
Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.Failed on my machine with unrealted error.
CHANGELOG.md
. See simple instructions inside file.Not adding to changelog as it is still WIP / incomplete.