17 releases

0.4.8 Nov 16, 2020
0.4.7 Sep 13, 2020
0.4.6 Aug 31, 2020
0.4.1 Jan 23, 2020
0.0.3 Dec 12, 2019

#84 in Graphics APIs

Download history 42/week @ 2020-08-08 75/week @ 2020-08-15 32/week @ 2020-08-22 45/week @ 2020-08-29 79/week @ 2020-09-05 33/week @ 2020-09-12 19/week @ 2020-09-19 25/week @ 2020-09-26 31/week @ 2020-10-03 16/week @ 2020-10-10 42/week @ 2020-10-17 19/week @ 2020-10-24 18/week @ 2020-10-31 32/week @ 2020-11-07 36/week @ 2020-11-14 30/week @ 2020-11-21

144 downloads per month
Used in 3 crates

MIT/Apache

130KB
2.5K SLoC

SPIR-Q

Build Status Crate Documentation

SPIR-Q is a light weight library for SPIR-V pipeline metadata query, supporting upto SPIR-V 1.5 specification aligned with Vulkan 1.2.

Why SPIR-Q?

Back in days of OpenGL, we have glGetActiveUniformsiv and other APIs to get pipeline metadata, so that we can determine the sizes, names, array strides and other information dynamically at runtime. However, the next-gen API, Vulkan, was deisgned not to support shader reflection so that the driver can be kept as thin as possible. SPIR-Q is an attempt to fill this gap.

SPIR-Q can be very useful for scenarios where we want some dynamic in pipeline construction, so that we don't have to refill those redundantly long VkXxxCreateInfos all the time. It can also be used to automate filler code generation at compile time.

It should be noted that SPIR-V is targeting at Vulkan so OpenCL binaries are not supported.

Usage

Please refer to the attached examples:

  • query: Query separate entry points in SPIR-V binaries.
  • pipeline: Query a (conceptual) pipeline built from multiple shader modules.
  • spirv-spec: Reflection of an example fragment shader program, which can be found in section 1.10 of the SPIR-V specification.
  • walk: Enumerate offsets, symbols and types of all descriptor variables.
  • sampler-state: Separable sampler state support for HLSL-sourced SPIR-Vs.
  • benchmark: Feel how fast SPIR-Q can be. (The log was generated from a debug run.)

Sample output are attached in the same directories as the code files.

License

This project is licensed under either of

at your option.

Dependencies

~0.7–1.2MB
~28K SLoC