Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-03-15 00:40:56 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-15 00:44:27 +0300
commit6fa400182423d1a9200fe93ed0b7a45e37552c3e (patch)
tree60660d6e41c028c04f0f5b01232b30455d543695 /intern
parent75de653e4d6204f2fc87388a1c99abcceed04ef1 (diff)
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.
Diffstat (limited to 'intern')
-rw-r--r--intern/gawain/src/gwn_batch.c8
1 files changed, 6 insertions, 2 deletions
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);
}