#spirv #cross

spirv_cross

Safe wrapper around SPIRV-Cross

51 releases (15 breaking)

✓ Uses Rust 2018 edition

0.16.0 Sep 8, 2019
0.15.0 Jul 4, 2019
0.14.2 Jun 27, 2019
0.12.1 Jan 18, 2019
0.4.1 Nov 22, 2017

#2 in #spirv

Download history 457/week @ 2019-06-28 746/week @ 2019-07-05 594/week @ 2019-07-12 696/week @ 2019-07-19 735/week @ 2019-07-26 562/week @ 2019-08-02 584/week @ 2019-08-09 836/week @ 2019-08-16 914/week @ 2019-08-23 907/week @ 2019-08-30 1030/week @ 2019-09-06 938/week @ 2019-09-13 1045/week @ 2019-09-20 1034/week @ 2019-09-27 658/week @ 2019-10-04

2,984 downloads per month
Used in 36 crates (7 directly)

MIT/Apache

4MB
112K SLoC

GLSL 73K SLoC // 0.0% comments C++ 31K SLoC // 0.1% comments Rust 6.5K SLoC // 0.0% comments Python 632 SLoC // 0.0% comments C 162 SLoC Shell 108 SLoC // 0.1% comments Assembly 55 SLoC // 0.1% comments

spirv_cross

Safe wrapper around SPIR-V Cross

Crate Travis Build Status Appveyor Build Status Gitter Codecov

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