#version 400
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
layout(location = 0) out vec4 fs_color;
struct Test
{
float value;
};
layout(std140,set = 0,binding = 0) uniform UTest
{
Test t;
} u_test;
float get_value(Test t) {return t.value;}
void main()
{
fs_color = vec4(get_value(u_test.t),0.0,0.0,1.0);
}
The GLSL code above causes the following SPIR-V compiler error:
Object: 0x0 | SPIR-V module not valid: OpFunctionCall Argument <id> '29's type does not match Function <id> '8's parameter type.
The error comes from the get_value function call in main. The error happens whenever I try to pass a struct instance as a function argument, if that instance is part of a uniform (In this case u_test). If the struct is not part of a uniform, it compiles fine.
Why is this a problem and what can I do to get around it?