Upon further investigation when trying to use GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING as a workaround, I think that this query is also subtly wrong - it seems to me to behave exactly as VERTEX_BINDING_BUFFER does, in that the index passed to glGetVertexAttribiv returns the vertex buffer bound there, regardless of what the attribute binding is. It's not clear from the original code, but modifying the above code like so (with appropriate buffer creation) shows the problem:
glBindVertexBuffer(0, vertex_buffer[0], 32, 16); glBindVertexBuffer(1, vertex_buffer[1], 32, 16); glBindVertexBuffer(2, vertex_buffer[2], 32, 16); glBindVertexBuffer(3, vertex_buffer[3], 32, 16); glVertexAttribBinding(0, 1); glVertexAttribBinding(1, 1); glVertexAttribBinding(2, 1); glVertexAttribBinding(3, 1); for(int i=0; i < 4; i++) { glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint *)&attrib_buf_binding); glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_BINDING, (GLint *)&attrib_binding); printf("C%d: %d %d\n", i, attrib_buf_binding, attrib_binding); }
which prints:
C0: 1 1 C1: 2 1 C2: 3 1 C3: 4 1
when it should print
C0: 2 1 C1: 2 1 C2: 2 1 C3: 2 1
Since all four vertex attribs (0, 1, 2, 3) are pointing at the same vertex buffer (that in slot 1 - buffer 2).