Reflection API in rust for SPIR-V shader byte code, intended for Vulkan applications.
This crate provides an FFI layer and idiomatic rust wrappers for the excellent SPIRV-Reflect C/C++ library.
- Extract descriptor bindings from SPIR-V bytecode, to assist in the generation of Vulkan descriptor set and pipeline layouts.
- Extract push constant block size from SPIR-V bytecode to assist in the generation of pipeline layouts.
- Extract full layout data for uniform buffer and push constant blocks from SPIR-V bytecode, to assist in application updates of these structures.
- Extract input/output variables from SPIR-V bytecode (including semantic decorations for HLSL shaders), to assist in validation of pipeline input/output settings.
- Easily map Vulkan types to DirectX 12 resource types
- Remap descriptor bindings, and update the source SPIR-V bytecode accordingly.
- Log all reflection data as human-readable text.
- Extensive unit tests and examples.
- Pure rust version.
- Command line tool for reflection and manipulation.
Add this to your Cargo.toml
:
[dependencies]
spirv-reflect = "0.1.8"
and add this to your crate root:
extern crate spirv_reflect;
Currently there is only a single monolithic demo
example, which shows some usage. A CLI tool is planned that will be useful on its own, and as a clean example of usage patterns.
cargo run --release --example demo
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
- Hai Nguyen (Author of C/C++ library)
- Cort Stratton (Author of C/C++ library)
- Daniel Collin (Code Review)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Contributions are always welcome; please look at the issue tracker to see what known improvements are documented.
Contribution to the spirv-reflect crate is organized under the terms of the Contributor Covenant, the maintainer of spirv-reflect, @gwihlidal, promises to intervene to uphold that code of conduct.