GWN: Batch: Perf: Comment out glBindVertexArray(0)
Even if they are for safety they are not free to use ! On my system (Mesa + AMD Vega GPU) calling: glBindVertexArray(1); glDrawArrays(GL_TRIANGLES, 0, 3); glBindVertexArray(0); in a loop, shows the same overhead as a full vao switching (which is more or less 10 times slower than just calling glDrawArrays) Moreover, now that we use OpenGL 3.3 binding a VAO is REQUIRED to issue a drawcall so it is garanted to be overwritten before the next drawcall. Problem can only happen if someone draws directly with opengl commands.
This commit is contained in:
parent
75de653e4d
commit
6fa4001824
|
@ -592,7 +592,9 @@ void GWN_batch_draw_range_ex(Gwn_Batch* batch, int v_first, int v_count, bool fo
|
|||
glDrawArrays(batch->gl_prim_type, v_first, v_count);
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
// Performance hog if you are drawing with the same vao multiple time.
|
||||
// Only activate for debugging.
|
||||
// glBindVertexArray(0);
|
||||
}
|
||||
|
||||
// just draw some vertices and let shader place them where we want.
|
||||
|
@ -604,5 +606,7 @@ void GWN_draw_primitive(Gwn_PrimType prim_type, int v_count)
|
|||
GLenum type = convert_prim_type_to_gl(prim_type);
|
||||
glDrawArrays(type, 0, v_count);
|
||||
|
||||
glBindVertexArray(0);
|
||||
// Performance hog if you are drawing with the same vao multiple time.
|
||||
// Only activate for debugging.
|
||||
// glBindVertexArray(0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue