27 releases

0.4.18 Nov 23, 2021
0.4.16 Oct 16, 2021
0.4.14 Jul 3, 2021
0.4.12 Feb 25, 2021
0.1.0 Dec 28, 2019

#57 in Graphics APIs

Download history 20/week @ 2021-08-10 29/week @ 2021-08-17 12/week @ 2021-08-24 8/week @ 2021-08-31 32/week @ 2021-09-07 5/week @ 2021-09-14 63/week @ 2021-09-21 46/week @ 2021-09-28 13/week @ 2021-10-05 56/week @ 2021-10-12 17/week @ 2021-10-19 29/week @ 2021-10-26 14/week @ 2021-11-02 38/week @ 2021-11-09 8/week @ 2021-11-16 34/week @ 2021-11-23

103 downloads per month
Used in 3 crates


3.5K SLoC


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.


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.


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.
  • inspect: Customize shader reflection with your own inspector function.
  • benchmark: Feel how fast SPIR-Q can be. (The log was generated from a release run.)
  • ray-tracing: Vulkan ray-tracing shader support.
  • gallery: All data types in GLSL.

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


This project is licensed under either of

at your option.


~25K SLoC