Is it OK to make (per-draw-call) uniform and (per-vertex) attribute to share same channel (location = X)
explicitly?
Vertex Shader :-
layout(location = 2) in vec3 perVertex_pos;
layout(location = 2) uniform vec3 perInstance_color;
//^ same "location = 2" ... valid?
I am trying to keep location
to a low figure as much as possible to fix an error C5102: input semantic attribute "ATTR" has too big of a numeric index
.
References :
https://www.khronos.org/opengl/wiki/Layout_Qualifier_(GLSL)
https://www.khronos.org/opengl/wiki/Uniform_(GLSL)/Explicit_Uniform_Location
They explain each type (uniform & attribute) individually, but do not tell whether I can share the index.
Edit: A similar-but-perpendicular question : Are OpenGL indices and locations the same thing for uniforms and vertex attributes?