KhronosGroup/SPIRV-Reflect
FreeSPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
About KhronosGroup/SPIRV-Reflect
SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode, specifically designed for Vulkan applications. It enables developers to extract descriptor bindings, push constant block sizes, and full layout data for uniform buffer and push constant blocks from SPIR-V bytecode. The library also extracts input/output variables, including semantic decorations for HLSL shaders, and supports runtime remapping of descriptor bindings with updates to the source SPIR-V bytecode. All reflection data can be logged as human-readable text. Integration is simple: only spirv_reflect.h and spirv_reflect.c need to be added to a project, with no external dependencies beyond the Vulkan SDK. The repository includes sample applications demonstrating descriptor binding retrieval, HLSL resource type representation, and input/output variable extraction for pipeline vertex input state creation.
Key Features
Pros & Cons
- Lightweight library with minimal dependencies (only Vulkan SDK)
- Simple integration: just add two source files to project
- Provides comprehensive reflection data including descriptor bindings, push constants, and IO variables
- Supports runtime remapping of descriptor bindings
- Human-readable logging of all reflection data
- Includes sample applications for common use cases
- Limited to SPIR-V shader bytecode targeting Vulkan; not applicable to other graphics APIs directly
- Does not support all SPIR-V features; coverage may be incomplete for advanced shader constructs
- No built-in support for non-SPIR-V shader formats
- Requires Vulkan SDK for compilation and examples