#spirv #cross

spirv_cross

Safe wrapper around SPIRV-Cross

56 releases (20 breaking)

0.21.0 Aug 31, 2020
0.20.0 May 6, 2020
0.19.0 Apr 13, 2020
0.18.0 Mar 8, 2020
0.4.1 Nov 22, 2017

#13 in Graphics APIs

Download history 5251/week @ 2020-05-28 4773/week @ 2020-06-04 4595/week @ 2020-06-11 4735/week @ 2020-06-18 4573/week @ 2020-06-25 4189/week @ 2020-07-02 4576/week @ 2020-07-09 5479/week @ 2020-07-16 5295/week @ 2020-07-23 3667/week @ 2020-07-30 3834/week @ 2020-08-06 4975/week @ 2020-08-13 5487/week @ 2020-08-20 7136/week @ 2020-08-27 7625/week @ 2020-09-03 6902/week @ 2020-09-10

20,263 downloads per month
Used in 108 crates (7 directly)

MIT/Apache

2MB
46K SLoC

C++ 37K 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