msiglreith / inspirv-rust

Rust (MIR) → SPIR-V (Shader) compiler
Other
57 stars 1 forks source link

inspirv-rust

UPDATE 2: Next design iteration would probably be based on HIR instead of MIR. See more details here. In the meantime, you might want to checkout rlsl!

UPDATE: Development currently slowed down as other projects (i.e gfx-rs) have priority over this one. Will keep on working on it in the future (see above)!

An experimental compiler from Rust to SPIR-V, using the rustc compiler and MIR. The code is based upon [rustc_trans::mir], legacy (actually working) version was based on miri and mir2wasm.

rustc 1.17.0-nightly (0e7727795 2017-02-19)

Build

In order to build the standard and core library directly, you can run:

cargo run -- libcore\lib.rs --target=etc/spirv.json
cargo run -- libstd\lib.rs --extern core=libcore.rlib -L . --target=etc/spirv.json

To build the quad example shader:

cargo run -- rust-examples\quad.rs --extern std=libstd.rlib --extern core=libcore.lib -L . --target=etc/spirv.json

Resources

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.