A single vertex shader input location (aka: vertex attribute) represents up to 4 scalar values worth of data. It cannot be more than 4.
From the OpenGL API side of the data, the format of the up-to-4 elements for each attribute is defined by a single invocation of glVertexAttribFormat/Pointer
for that attribute location. Subsequent calls that try to use the same location in that VAO will overwrite the previous format specification.
From the GLSL side that receives the data, the mapping from locations to variables is not quite so strict. Some variable types naturally take up more than one location; layout(location = 0) in mat4 matrix;
will consume 4 attribute locations (0-3).
Similarly, for basic types or vectors with fewer than 4 elements, multiple input variables can share the same location through the component
layout qualifier:
layout(location = 0, component = 0) in vec2 first_two;
layout(location = 0, component = 2) in float third;
layout(location = 0, component = 3) in float fourth;
All 3 variables use the same attribute location, but they use different parts of it. first_two
uses the first two components of the location, third
comes from the third component, and fourth
comes from the fourth.
From the API side, it is still just using a format of glVertexAttribFormat(0, 4, ...);
The 4 components simply feed 3 separate variables.
There are of course restrictions. The components of two different variables using the same location are not allowed to overlap. Also, their basic types (float, double, or integer) must be the same for all variables that use the same location.