#spirv #cross #msl #parser #hlsl #parse #spirv-cross

librashader-spirv-cross

Temporary spirv_cross fork for librashader purposes

4 releases

0.23.5 Jan 26, 2023
0.23.4 Jan 26, 2023
0.23.3 Jan 21, 2023
0.23.2 Jan 21, 2023

#118 in Graphics APIs

Download history 90/week @ 2023-01-19 187/week @ 2023-01-26

277 downloads per month
Used in 7 crates (5 directly)

MIT/Apache

4.5MB
103K SLoC

C++ 46K SLoC // 0.1% comments GLSL 29K SLoC // 0.0% comments Rust 9K SLoC // 0.0% comments ActionScript 5.5K SLoC Assembly 3.5K SLoC // 0.0% comments C 2.5K SLoC // 0.1% comments FORTRAN Legacy 2K SLoC // 0.0% comments Forth 2K SLoC Python 873 SLoC // 0.0% comments Coq 613 SLoC Objective-C 396 SLoC SWIG 359 SLoC GNU Style Assembly 343 SLoC D 173 SLoC Shell 151 SLoC // 0.1% comments Scheme 69 SLoC Swift 60 SLoC // 0.1% comments R 52 SLoC // 0.1% comments AsciiDoc 6 SLoC // 0.3% comments

librashader-spirv-cross

(Hopefully) temporary fork of spirv_cross while some changes get upstreamed.

Please do not use this.

spirv_cross

Safe wrapper around SPIR-V Cross

Crate Travis Build Status Appveyor Build Status

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