Awesome
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
- miri the MIR interpreter.
- rustc_trans::mir.
- mir2wasm
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
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.