KhronosGroup / SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
Apache License 2.0
672 stars 147 forks source link

Add baseline Spec Constant API support #242

Closed spencer-lunarg closed 8 months ago

spencer-lunarg commented 8 months ago

the goal is not to dismiss https://github.com/KhronosGroup/SPIRV-Reflect/pull/197 or https://github.com/KhronosGroup/SPIRV-Reflect/pull/154 but instead create a more gradual first step to at least get "something" as a baseline for support

With this there is a spvReflectEnumerateSpecializationConstants which can be queried and returned a SpvReflectSpecializationConstant object.

For now SpvReflectSpecializationConstant is the bare minimum until it is better examined (and tested) what should be added, but then it will be a more simple additive process to what is already exposed

(cc @muraj @zbendefy it would be awesome to get feedback if this helps solve your problems or not)

zbendefy commented 7 months ago

Hi @spencer-lunarg ! Thanks this is definitely useful, however I'm currently missing the name of the constant in SpvReflectSpecializationConstant.

The way I set things up is that I use variable names in the frontend code, that later get resolved to specialization constant ids in the backend code. So it would help me a lot if I could also access the name of the constant in 'SpvReflectSpecializationConstant'.