spirv-cross2
Safe and sound Rust bindings to SPIRV-Cross.
All backends exposed by the SPIRV-Cross C API are fully supported, including
- GLSL
- HLSL
- MSL
- JSON
- C++
- Reflection Only
The API provided is roughly similar to the SPIRV-Cross Compiler C++ API,
with some inspiration from naga. A best effort has been
made to ensure that these bindings are sound, and that mutations occur strictly within Rust's borrow rules.
Usage
Here is an example of using the API to do some reflection and compile to GLSL.
use ;
use ;
use GlslVersion;
use ;
use spirv;
use Glsl;
Features
By default, the glsl, hlsl, and msl features are enabled by default. The cpp and json targets can be enabled
in Cargo.toml
[]
= { = ["cpp", "json"] }
SPIRV-Cross will only be built with support for enabled targets. If you want to only perform reflection and shrink the binary size,
you can disable all but the None target.
[]
= { = false }
To enable all features, including f16 and vector constant support, use the full feature.
[]
= { = ["full"] }
f16 and vector specialization constants support
When querying specialization constants, spirv-cross2 includes optional support for f16 via half and Vec2, Vec3, Vec4, and Mat4 types
via gfx-maths.
[]
= { = ["f16", "half"] }
License
This project is licensed under either of Apache License, Version 2.0 or MIT license, at your option.
Contributing
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed under the terms of both the Apache License, Version 2.0 and the MIT license without any additional terms or conditions.