From f6ad53804099802ab3f5eafa830f95f8545eb888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 29 Mar 2018 03:21:03 +0200 Subject: UI: Perf: widgetbase: Replace imm usage by a batch cache. Introduce a UI batch cache. For the moment it's only used by widgetbase so leaving it interface_widgets.c. If it grows, it can have its own file. Like all preset batches (batches used by UI context), vaos must be refreshed each time a new window context is binded. This still does 3 GWN_batch_draw in the worst cases but at least it does not use the IMM api. I will continue and batch the 3 calls together since we are really CPU bound, so shader complexity does not really matters. I cannot spot any difference on all the widgets I could test. I did not use any unit tests so I cannot tell if there is really any defects. This is not a complete rewrite but it adresses the top bottleneck found after a profilling session. --- source/blender/gpu/intern/gpu_batch_presets.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/gpu/intern/gpu_batch_presets.c') diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c index 696143a3857..1eb1b737bee 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.c +++ b/source/blender/gpu/intern/gpu_batch_presets.c @@ -33,6 +33,8 @@ #include "BLI_math.h" #include "BLI_threads.h" +#include "UI_interface.h" + #include "GPU_batch.h" #include "gpu_shader_private.h" @@ -202,6 +204,8 @@ void gpu_batch_presets_reset(void) gwn_batch_vao_cache_clear(g_presets_3d.batch.sphere_high); gwn_batch_vao_cache_clear(g_presets_3d.batch.sphere_wire_low); gwn_batch_vao_cache_clear(g_presets_3d.batch.sphere_wire_med); + + ui_widget_batch_preset_reset(); } void gpu_batch_presets_exit(void) @@ -211,4 +215,6 @@ void gpu_batch_presets_exit(void) GWN_batch_discard(g_presets_3d.batch.sphere_high); GWN_batch_discard(g_presets_3d.batch.sphere_wire_low); GWN_batch_discard(g_presets_3d.batch.sphere_wire_med); + + ui_widget_batch_preset_exit(); } -- cgit v1.2.3