I am investigating OpenGL Android deqp test suit and confused with one of the cases. Test is dEQP-GLES31.functional.vertex_attribute_binding.usage.mixed_usage.mixed_api_change_binding_point. Sources can be found here, lines of interest is 1197-1213. I have no idea, that a trick is used.
const int maxUsedLocation = de::max(positionLoc, colorLoc);
const int bindingPoint1 = maxUsedLocation + 1;
const int bindingPoint2 = maxUsedLocation + 2;
// bind data using old api
gl.glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
gl.glVertexAttribPointer(bindingPoint1, 4, GL_FLOAT, GL_FALSE, (glw::GLsizei)(2 * sizeof(tcu::Vec4)), (const deUint8*)DE_NULL);
gl.glVertexAttribPointer(bindingPoint2, 4, GL_FLOAT, GL_FALSE, (glw::GLsizei)(2 * sizeof(tcu::Vec4)), (const deUint8*)DE_NULL + sizeof(tcu::Vec4));
// change buffer binding point with vertex_attrib_binding
gl.glVertexAttribFormat(positionLoc, 4, GL_FLOAT, GL_FALSE, 0);
gl.glVertexAttribFormat(colorLoc, 4, GL_FLOAT, GL_FALSE, 0);
gl.glVertexAttribBinding(positionLoc, bindingPoint1);
gl.glVertexAttribBinding(colorLoc, bindingPoint2);
First of all, bindingPoint1
and bindingPoint2
was initialized in a strange way (increment of max number vertex locations in shader). Then it was used as vertex attrib location(?) in glVertexAttribPointer
. After that it used as vertex buffer binding point in glVertexAttribBinding
. And finally, there are no glBindVertexBuffer
call, which buffer bindingPoint1
and bindingPoint2
was bound to? I try to understand ARB_vertex_attrib_binding extension, but I still don't understand this code.
For me it seems that glVertexAttribPointer
is incorrect because of incorrect vertex attrib locations and glVertexAttribBinding
is incorrect too, because no vertex binding point bound to vertex buffer.
Can someone explain me, that is going on here?