7 releases
0.25.1 | Feb 12, 2024 |
---|---|
0.25.0 | Feb 11, 2024 |
0.24.0 | Feb 11, 2024 |
0.23.5 | Jan 26, 2023 |
#77 in Graphics APIs
1,387 downloads per month
Used in 8 crates
(3 directly)
2.5MB
58K
SLoC
librashader-spirv-cross
(Hopefully) temporary fork of spirv_cross while some changes get upstreamed.
Please do not use this.
spirv_cross
Example
spirv_cross
provides a safe wrapper around SPIRV-Cross for use with Rust. For example, here is a simple function to parse a SPIR-V module and compile it to HLSL and MSL:
extern crate spirv_cross;
use spirv_cross::{spirv, hlsl, msl, ErrorCode};
fn example(module: spirv::Module) -> Result<(), ErrorCode> {
// Compile to HLSL
let ast = spirv::Ast::<hlsl::Target>::parse(&module)?;
println!("{}", ast.compile()?);
// Compile to MSL
let ast = spirv::Ast::<msl::Target>::parse(&module)?;
println!("{}", ast.compile()?);
Ok(())
}
License
This project is licensed under either of Apache License, Version 2.0 or MIT license, at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache 2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.