glslang
glslang copied to clipboard
Missing flat decoration for integer members of nested structs in HLSL
When compiling HLSL source, there is no need to add the nointerpolation
qualifier for integer outputs of a vertex shader, for example:
struct VSOutput
{
float4 Pos : SV_Position;
uint SomeIndex : MyIndex; // nointerpolation is not required
};
The struct above compiles and works fine. However, if integer member is in a substruct, e.g.
struct SubStruct
{
uint SomeIndex : MyIndex; // nointerpolation is required
};
struct VSOutput
{
float4 Pos : SV_Position;
SubStruct Substr;
};
then without the nointerpolation
, the shader compiles, but SPIRV-Tools then produce the following error:
Spirv optimizer error: [VUID-StandaloneSpirv-Flat-04744] Fragment OpEntryPoint operand 2165 with Input interfaces with integer or float type must have a Flat decoration for Entry Point id 4.
%In_VSOut_SomeIndex = OpVariable %_ptr_Input_uint Input
The shader also does not work correctly. Adding the nointerpolation
fixes the issues.
Yes, glslang needs to add a Flat decoration for the second case.