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
691 stars 149 forks source link

Add block offset to Push Constant BlockVariable #195

Closed spencer-lunarg closed 1 year ago

spencer-lunarg commented 1 year ago

A Push Constant block like

layout(push_constant) uniform uPushConstant {
    layout(offset = 8) vec2 a;
    float b; // offset 16
    layout(offset = 4) float c;
} pc;

should return an offset of 4 instead of 0

Unlike descriptors, the Push Constant Block has a concept of a base offset since

chaoticbob commented 1 year ago

VS is complaining about shadowing in a few places:

spirv_reflect.c(3507,19): error C2220: the following warning is treated as an error [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect-pp.vcxproj]
spirv_reflect.c(3507,19): warning C4456: declaration of 'i' hides previous local declaration [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect-pp.vcxproj]
spirv_reflect.c(3445,15): message : see declaration of 'i' [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect-pp.vcxproj]
spirv_reflect.c(3507,19): error C2220: the following warning is treated as an error [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect.vcxproj]
spirv_reflect.c(3507,19): warning C4456: declaration of 'i' hides previous local declaration [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect.vcxproj]
spirv_reflect.c(3445,15): message : see declaration of 'i' [D:\a\SPIRV-Reflect\SPIRV-Reflect\build\spirv-reflect.vcxproj]