53 releases (17 breaking)

✓ Uses Rust 2018 edition

0.18.0 Mar 8, 2020
0.17.0 Jan 30, 2020
0.16.0 Sep 8, 2019
0.15.0 Jul 4, 2019
0.4.1 Nov 22, 2017

#19 in Rendering engine

Download history 1929/week @ 2019-12-10 1043/week @ 2019-12-17 1098/week @ 2019-12-24 1127/week @ 2019-12-31 1394/week @ 2020-01-07 1381/week @ 2020-01-14 964/week @ 2020-01-21 748/week @ 2020-01-28 1148/week @ 2020-02-04 963/week @ 2020-02-11 1399/week @ 2020-02-18 1300/week @ 2020-02-25 1343/week @ 2020-03-03 1115/week @ 2020-03-10 1975/week @ 2020-03-17 1966/week @ 2020-03-24

5,185 downloads per month
Used in 61 crates (7 directly)

MIT/Apache

1.5MB
42K SLoC

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