#spirv #cross

spirv_cross

Safe wrapper around SPIRV-Cross

61 releases

0.23.1 Mar 3, 2021
0.22.2 Dec 19, 2020
0.22.1 Nov 17, 2020
0.20.0 May 6, 2020
0.4.1 Nov 22, 2017

#146 in Graphics APIs

Download history 6914/week @ 2023-10-19 15124/week @ 2023-10-26 11837/week @ 2023-11-02 10032/week @ 2023-11-09 15271/week @ 2023-11-16 17792/week @ 2023-11-23 9016/week @ 2023-11-30 8545/week @ 2023-12-07 14681/week @ 2023-12-14 8921/week @ 2023-12-21 4808/week @ 2023-12-28 6135/week @ 2024-01-04 4940/week @ 2024-01-11 8994/week @ 2024-01-18 7511/week @ 2024-01-25 4428/week @ 2024-02-01

28,485 downloads per month
Used in 167 crates (11 directly)

MIT/Apache

2MB
49K SLoC

C++ 40K SLoC // 0.1% comments Rust 9K 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