0

I have a GLSL vertex shader where one of the attributes is only used if a push constant is set:

layout(location = 0) in ivec2 a_pos;
layout(location = 1) in ivec2 a_nrm;
layout(location = 2) in float a_Height;

void main()
{
<...>
float Offset = ( u_enabling_flag > 0.0 ) ? a_Height : 0.0;
< some calculation involving Offset >

I get the following validation error:

vkDebug: Validation: 0: Validation Error: [ UNASSIGNED-CoreValidation-Shader-InputNotProduced ] Object 0: handle = 0x3a000000003a, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x23e43bb7 | Vertex shader consumes input at location 2 but not provided

The graphical output looks fine but is there a possibility to get rid of the error?

Regards.

Anonymous Asked question May 14, 2021