From 39b654f4ff123e3e9bc345b25d4883df4de4ad5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 6 Apr 2018 14:30:20 +0200 Subject: UI: Perf: Use widget base batching Overall 10% more performance on general UI drawing time. This commit can introduce ordering problem on some elements. In this case you need to flush the widget cache to ensure the element that is going to be drawn is drawn on top of any widget base. To flush the cache use UI_widgetbase_draw_cache_flush. This is already done for BLF and Icons. --- source/blender/blenfont/intern/blf_font.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 07e568dd279..cc7eb336b21 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -58,6 +58,8 @@ #include "BIF_gl.h" #include "BLF_api.h" +#include "UI_interface.h" + #include "GPU_immediate.h" #include "GPU_matrix.h" #include "GPU_batch.h" @@ -184,6 +186,9 @@ void blf_batch_draw(void) glEnable(GL_BLEND); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + /* We need to flush widget base first to ensure correct ordering. */ + UI_widgetbase_draw_cache_flush(); + BLI_assert(g_batch.font->tex_bind_state != 0); /* must still be valid */ glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, g_batch.font->tex_bind_state); -- cgit v1.2.3