OpenJK
OpenJK copied to clipboard
AZDO: Vertex array objects per vertex format
To reduce driver overhead, we can reduce the number of calls to glVertexAttribPointer and co. Ahead of time, any model will know what format their vertex data is stored in. We can create a vertex array object per vertex format, each with a large vertex buffer. When allocating GPU mem for vertex data, we sub allocate out of these vertex buffers. At render time, draw calls can be sorted by vertex format and the base vertex can be used to specify which section of the vertex buffer to use:
bind vertex array object
for each object with this format:
draw object with base vertex