#descriptor-set #spir-v #shader #reflection #hlsl #glsl

spirv-reflect

Reflection API in rust for SPIR-V shader byte code, intended for Vulkan applications

14 releases

0.2.3 Nov 3, 2019
0.2.2 Nov 3, 2019
0.2.1 Mar 30, 2019
0.1.9 Mar 10, 2019
0.1.6 Nov 21, 2018

#18 in Rendering engine

Download history 566/week @ 2024-06-17 669/week @ 2024-06-24 155/week @ 2024-07-01 377/week @ 2024-07-08 711/week @ 2024-07-15 585/week @ 2024-07-22 589/week @ 2024-07-29 527/week @ 2024-08-05 1429/week @ 2024-08-12 626/week @ 2024-08-19 845/week @ 2024-08-26 707/week @ 2024-09-02 503/week @ 2024-09-09 572/week @ 2024-09-16 777/week @ 2024-09-23 841/week @ 2024-09-30

2,783 downloads per month
Used in 47 crates (4 directly)

MIT/Apache

350KB
7K SLoC

Rust 3.5K SLoC // 0.0% comments C 3.5K SLoC // 0.0% comments

spirv-reflect

spirv-reflect on travis-ci.com Latest version Documentation MIT APACHE2

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.

Features

  • 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.

Planned Features

  • Extensive unit tests and examples.
  • Pure rust version.
  • Command line tool for reflection and manipulation.

Usage

Add this to your Cargo.toml:

[dependencies]
spirv-reflect = "0.2.3"

and add this to your crate root:

extern crate spirv_reflect;

Example

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

License

Licensed under either of

at your option.

Credits and Special Thanks

Contribution

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.

Code of Conduct

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.

Dependencies

~0.7–1.7MB
~37K SLoC