[Bf-blender-cvs] [6fa40018242] blender2.8: GWN: Batch: Perf: Comment out glBindVertexArray(0)

Clément Foucault noreply at git.blender.org
Wed Mar 14 22:44:36 CET 2018


Commit: 6fa400182423d1a9200fe93ed0b7a45e37552c3e
Author: Clément Foucault
Date:   Wed Mar 14 22:40:56 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB6fa400182423d1a9200fe93ed0b7a45e37552c3e

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.

===================================================================

M	intern/gawain/src/gwn_batch.c

===================================================================

diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c
index b447106432c..062cdd5e63e 100644
--- a/intern/gawain/src/gwn_batch.c
+++ b/intern/gawain/src/gwn_batch.c
@@ -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);
 	}



More information about the Bf-blender-cvs mailing list