diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-25 17:35:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-25 17:35:14 +0300 |
commit | 4c16973fc8a5fd3d44b32a11abef29c8ed16fcc4 (patch) | |
tree | fc9a65bf193b5193671eaec9d4f7c0314798ecb1 /source | |
parent | 38a1aad4f29b327180c5b4a5d36f8e7b5a155c5b (diff) |
Add draw manager sync callbacks
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view_data.cc | 16 |
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3be2ddf5173..813189c0cfc 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1001,6 +1001,8 @@ static void drw_engines_init(void) static void drw_engines_cache_init(void) { + DRW_manager_begin_sync(); + DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) { if (data->text_draw_cache) { DRW_text_cache_destroy(data->text_draw_cache); @@ -1072,6 +1074,8 @@ static void drw_engines_cache_finish(void) engine->cache_finish(data); } } + + DRW_manager_end_sync(); } static void drw_engines_draw_scene(void) diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index a29f2fa7507..83ebe1b3c3b 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -694,6 +694,9 @@ bool drw_engine_data_engines_data_validate(GPUViewport *viewport, void **engine_ void drw_engine_data_cache_release(GPUViewport *viewport); void drw_engine_data_free(GPUViewport *viewport); +void DRW_manager_begin_sync(void); +void DRW_manager_end_sync(void); + #ifdef __cplusplus } #endif diff --git a/source/blender/draw/intern/draw_view_data.cc b/source/blender/draw/intern/draw_view_data.cc index b8131b06d06..38cfed00c2a 100644 --- a/source/blender/draw/intern/draw_view_data.cc +++ b/source/blender/draw/intern/draw_view_data.cc @@ -257,3 +257,19 @@ draw::ObjectRef DRW_object_ref_get(Object *object) BLI_assert(DST.view_data_active->manager); return {object, DST.dupli_source, DST.dupli_parent}; } + +void DRW_manager_begin_sync() +{ + if (DST.view_data_active->manager == nullptr) { + return; + } + reinterpret_cast<draw::Manager *>(DST.view_data_active->manager)->begin_sync(); +} + +void DRW_manager_end_sync() +{ + if (DST.view_data_active->manager == nullptr) { + return; + } + reinterpret_cast<draw::Manager *>(DST.view_data_active->manager)->end_sync(); +} |