#spirv #cross

spirv_cross

Safe wrapper around SPIRV-Cross

58 releases (21 breaking)

0.22.1 Nov 17, 2020
0.21.0 Aug 31, 2020
0.20.0 May 6, 2020
0.18.0 Mar 8, 2020
0.4.1 Nov 22, 2017

#8 in Graphics APIs

Download history 4626/week @ 2020-08-09 4976/week @ 2020-08-16 6029/week @ 2020-08-23 8336/week @ 2020-08-30 6812/week @ 2020-09-06 6713/week @ 2020-09-13 5616/week @ 2020-09-20 6713/week @ 2020-09-27 9856/week @ 2020-10-04 7453/week @ 2020-10-11 5641/week @ 2020-10-18 7181/week @ 2020-10-25 7950/week @ 2020-11-01 6799/week @ 2020-11-08 7711/week @ 2020-11-15 8215/week @ 2020-11-22

29,774 downloads per month
Used in 128 crates (7 directly)

MIT/Apache

2MB
47K SLoC

C++ 39K SLoC // 0.1% comments Rust 8K SLoC // 0.0% comments

spirv_cross

Safe wrapper around SPIR-V Cross

Crate Travis Build Status Appveyor Build Status Gitter

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.

Dependencies