KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.91k stars 816 forks source link

[HLSL] $Global constant buffer is not recognized as constant buffer. #1355

Open bkaradzic opened 6 years ago

bkaradzic commented 6 years ago

glslangValidator -V -D -e main test.frag

uniform float4 u_test0;

cbuffer : register(b0)
{
    float4 u_test1;
};

void main(out float4 fragColor : SV_TARGET0)
{
    fragColor = u_test0 * u_test1;
}

spirv-reflect frag.spv

will output only descriptor binding for unnamed constant buffer that contains u_test1.

Issue was first reported in SPIRV-Reflect but it seems to be glslangValidator output issue: https://github.com/chaoticbob/SPIRV-Reflect/issues/47

johnkslang commented 6 years ago

What trigger is being looked for?

The SPIR-V looks quite similar for the two.

$Global:

                         Decorate 13($Global) Block
13($Global):             TypeStruct 7(fvec4)
         14:             TypePointer Uniform 13($Global)
         15:     14(ptr) Variable Uniform

u_test1:

                         Decorate 21 Block
         21:             TypeStruct 7(fvec4)
         22:             TypePointer Uniform 21(struct)
         23:     22(ptr) Variable Uniform