I made this request before, but I had muddied the idea and since a new spec came out, a new begging:
Basic idea is to have one extra layer of indexing.
New functions:
glEnableIndexAttribute(GLuint attribute_index);
glDisableIndexAttribute(GLuint attribute_index);
glIndexAttributePointer(GLuint attribute_index, GLenum type,
GLsizei stride, const GLvoid*);
Synopsis:
When a index attribute is supported the call
glDrawElements(primitive_type, count, index_type, index_ptr)
is equivalent to:
glBegin(type);
for(int i=0;i<count;++i)
{
for(each attribute j with sourcing from array active)
{
if(index attribute active for attribute j)
{
K=index_attribute_pointer[j][ index_ptr[i] ];
}
else
{
K=index_ptr[i];
}
glVertexAttrib(j, vertex_pointer[j][ K ])
}
}
glEnd();
The above nicely extends naturally to all the instancing calls too. Naturally glIndexAttributePointer would source from the buffer object bound to GL_ELEMENT_ARRAY_BUFFER.
State would be a part of vertex array objects too.
One can simulate this behavior with GL_NV_shader_buffer_load, but I would imagine that asking for that to be core is not a good idea (I can dream though).
The use case is not so much to save memory in repeated values (for example render a cube) but for hierarchy UI’s, in theory can also help instancing quite a bit too. We also avoid using up lots of uniform room to hold the values [there are texture buffer objects, but that forces the format of the data, just as doing this via GL_NV_shader_buffer_load does at well].