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

Print Spec Constant value in type array by default #241

Closed spencer-lunarg closed 8 months ago

spencer-lunarg commented 8 months ago

Instead of printing a mysterious 0xFFFFFFFF, print the default spec constant value and make use of the spec_constant_op_ids field

so something like

layout(constant_id = 3) const int SIZE = 2;
layout(set = 0, binding = 0, std430) buffer SSBO {
    float val[SIZE];
} ssbo;

now shows

// SpvReflectArrayTraits
dims_count = 0
- dims = [0xFFFFFFFF]
- spec_constant_op_ids = [constant_id]
+ dims = [2]
+ spec_constant_op_ids = [3]

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