diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-11 02:58:23 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-13 15:20:24 +0300 |
commit | ac60a67b3f6eacbcff5b5c4716fd5e3902511a29 (patch) | |
tree | 486054624ca8c881751b2569cc872b37fb0b8695 | |
parent | efc97b3919ea4fd46b9d2e931ca3fea27e7ea31c (diff) |
Cleanup: GPU: Remove Batch vao cache reset
This is done at drawtime automatically.
m--------- | release/datafiles/locale | 0 | ||||
m--------- | release/scripts/addons | 0 | ||||
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 3 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 5 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 7 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_internal.h | 1 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 12 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.h | 1 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_inline.h | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/GPU_batch.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/GPU_batch_presets.h | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.cc | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch_presets.c | 25 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_surface.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 |
18 files changed, 3 insertions, 79 deletions
diff --git a/release/datafiles/locale b/release/datafiles/locale -Subproject a7bbfac76c00edd0fb79a4766b7ac7c5dcbcac5 +Subproject 4af22e0492f401c609a0203cad1a9bc7fa00b86 diff --git a/release/scripts/addons b/release/scripts/addons -Subproject 82ed41ec632483fa9260d90dae7afdf3192c509 +Subproject 25b00a0a52c81408b9dc15ea320a79ee956b3c0 diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 9013836fd1e..bf84f5c57b3 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -42,8 +42,7 @@ int BLF_init(void); void BLF_exit(void); void BLF_default_dpi(int dpi); void BLF_default_set(int fontid); -int BLF_default(void); /* get default font ID so we can pass it to other functions */ -void BLF_batch_reset(void); /* call when changing opengl context. */ +int BLF_default(void); /* get default font ID so we can pass it to other functions */ void BLF_cache_clear(void); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 95b074fa2df..c5c2bc3f3ba 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -125,11 +125,6 @@ void BLF_exit(void) blf_font_exit(); } -void BLF_batch_reset(void) -{ - blf_batch_draw_vao_clear(); -} - void BLF_cache_clear(void) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index ff31878a929..76829db755c 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -113,13 +113,6 @@ static void blf_batch_draw_exit(void) GPU_BATCH_DISCARD_SAFE(g_batch.batch); } -void blf_batch_draw_vao_clear(void) -{ - if (g_batch.batch) { - GPU_batch_vao_cache_clear(g_batch.batch); - } -} - void blf_batch_draw_begin(FontBLF *font) { if (g_batch.batch == NULL) { diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index ba0873f4fd4..b616f47a897 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -30,7 +30,6 @@ struct ResultBLF; struct rctf; struct rcti; -void blf_batch_draw_vao_clear(void); void blf_batch_draw_begin(struct FontBLF *font); void blf_batch_draw(void); diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 46b7a88b2a6..4d7440a3276 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -152,18 +152,6 @@ void DRW_shape_cache_free(void) } } -void DRW_shape_cache_reset(void) -{ - uint i = sizeof(SHC) / sizeof(GPUBatch *); - GPUBatch **batch = (GPUBatch **)&SHC; - while (i--) { - if (*batch) { - GPU_batch_vao_cache_clear(*batch); - } - batch++; - } -} - /* -------------------------------------------------------------------- */ /** \name Procedural Batches * \{ */ diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 2a7448ce877..7164a477d8a 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -33,7 +33,6 @@ struct VolumeGrid; struct bGPDstroke; void DRW_shape_cache_free(void); -void DRW_shape_cache_reset(void); /* 3D cursor */ struct GPUBatch *DRW_cache_cursor_get(bool crosshair_lines); diff --git a/source/blender/draw/intern/draw_cache_inline.h b/source/blender/draw/intern/draw_cache_inline.h index 0d24f2e450b..0f0e1785a2a 100644 --- a/source/blender/draw/intern/draw_cache_inline.h +++ b/source/blender/draw/intern/draw_cache_inline.h @@ -72,8 +72,7 @@ BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo) *ibo = GPU_indexbuf_calloc(); } if (batch != NULL) { - GPU_batch_vao_cache_clear(batch); - batch->elem = *ibo; + GPU_batch_elembuf_set(batch, *ibo, false); } } @@ -92,8 +91,7 @@ BLI_INLINE void DRW_vbo_request(GPUBatch *batch, GPUVertBuf **vbo) if (batch != NULL) { /* HACK set first vbo if not init. */ if (batch->verts[0] == NULL) { - GPU_batch_vao_cache_clear(batch); - batch->verts[0] = *vbo; + GPU_batch_vertbuf_add(batch, *vbo); } else { /* HACK: bypass assert */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 4a5e07476a9..e436424b460 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2824,7 +2824,6 @@ void DRW_opengl_context_enable_ex(bool restore) if (!G.background) { immActivate(); } - BLF_batch_reset(); } } } @@ -2888,13 +2887,11 @@ void DRW_gpu_render_context_enable(void *re_gpu_context) BLI_assert(!BLI_thread_is_main()); GPU_context_active_set(re_gpu_context); - DRW_shape_cache_reset(); /* XXX fix that too. */ } /* Needs to be called BEFORE DRW_opengl_render_context_disable() */ void DRW_gpu_render_context_disable(void *UNUSED(re_gpu_context)) { - DRW_shape_cache_reset(); /* XXX fix that too. */ GPU_context_active_set(NULL); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index c01bc01588e..a64d5505ebe 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -642,7 +642,6 @@ static void image_main_region_draw(const bContext *C, ARegion *region) // View2DScrollers *scrollers; float col[3]; - GPU_batch_presets_reset(); GPUViewport *viewport = WM_draw_region_get_viewport(region); GPUFrameBuffer *framebuffer_default, *framebuffer_overlay; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0442a0f35c9..ac70547c293 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1623,10 +1623,6 @@ void view3d_main_region_draw(const bContext *C, ARegion *region) BKE_image_free_old_gputextures(bmain); GPU_pass_cache_garbage_collect(); - /* XXX This is in order to draw UI batches with the DRW - * old context since we now use it for drawing the entire area. */ - gpu_batch_presets_reset(); - /* No depth test for drawing action zones afterwards. */ GPU_depth_test(false); diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index 33d539e3a9e..d57739156f8 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -112,8 +112,6 @@ void GPU_batch_clear(GPUBatch *); void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */ -void GPU_batch_vao_cache_clear(GPUBatch *); - void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo); /* Instancing */ void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo); diff --git a/source/blender/gpu/GPU_batch_presets.h b/source/blender/gpu/GPU_batch_presets.h index 1674cf776db..7a235dd0e12 100644 --- a/source/blender/gpu/GPU_batch_presets.h +++ b/source/blender/gpu/GPU_batch_presets.h @@ -46,11 +46,8 @@ struct GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize, void gpu_batch_presets_init(void); void gpu_batch_presets_register(struct GPUBatch *preset_batch); bool gpu_batch_presets_unregister(struct GPUBatch *preset_batch); -void gpu_batch_presets_reset(void); void gpu_batch_presets_exit(void); -void GPU_batch_presets_reset(void); - #ifdef __cplusplus } #endif diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index 995e1afb236..7b006bdc6c2 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -48,11 +48,6 @@ using namespace blender::gpu; -void GPU_batch_vao_cache_clear(GPUBatch *UNUSED(batch)) -{ - /* TODO remove */ -} - /* -------------------------------------------------------------------- */ /** \name Creation & Deletion * \{ */ diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c index 3d9b4326c7e..71c971d8656 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.c +++ b/source/blender/gpu/intern/gpu_batch_presets.c @@ -380,18 +380,6 @@ bool gpu_batch_presets_unregister(GPUBatch *preset_batch) return false; } -void gpu_batch_presets_reset(void) -{ - BLI_mutex_lock(&g_presets_3d.mutex); - /* Reset vao caches for these every time we switch opengl context. - * This way they will draw correctly for each window. */ - LISTBASE_FOREACH (LinkData *, link, &presets_list) { - GPUBatch *preset = link->data; - GPU_batch_vao_cache_clear(preset); - } - BLI_mutex_unlock(&g_presets_3d.mutex); -} - void gpu_batch_presets_exit(void) { LinkData *link; @@ -404,17 +392,4 @@ void gpu_batch_presets_exit(void) BLI_mutex_end(&g_presets_3d.mutex); } -/** - * This function only needs to be accessed externally because - * we are drawing UI batches with the DRW old context. - * - * And now we use it for drawing the entire area. - * - * XXX (Clément) - to cleanup in the upcoming 2.91 refactor. - **/ -void GPU_batch_presets_reset() -{ - gpu_batch_presets_reset(); -} - /** \} */ diff --git a/source/blender/windowmanager/intern/wm_surface.c b/source/blender/windowmanager/intern/wm_surface.c index 12e55790259..9948434d340 100644 --- a/source/blender/windowmanager/intern/wm_surface.c +++ b/source/blender/windowmanager/intern/wm_surface.c @@ -56,8 +56,6 @@ void wm_surface_clear_drawable(void) WM_opengl_context_release(g_drawable->ghost_ctx); GPU_context_active_set(NULL); - BLF_batch_reset(); - gpu_batch_presets_reset(); immDeactivate(); if (g_drawable->deactivate) { diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 47afa343394..a8a1817be5e 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1112,8 +1112,6 @@ static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool acti void wm_window_clear_drawable(wmWindowManager *wm) { if (wm->windrawable) { - BLF_batch_reset(); - gpu_batch_presets_reset(); immDeactivate(); wm->windrawable = NULL; } |