diff options
Diffstat (limited to 'source')
12 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index 8a825a7c81f..228281af2b0 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -265,6 +265,7 @@ DrawEngineType draw_engine_basic_type = { &basic_data_size, NULL, &basic_engine_free, + NULL, /* instance_free */ &basic_cache_init, &basic_cache_populate, &basic_cache_finish, diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index fad9d21b660..fc9b8b0cde4 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -629,6 +629,7 @@ DrawEngineType draw_engine_eevee_type = { &eevee_data_size, &eevee_engine_init, &eevee_engine_free, + NULL, /* instance_free */ &eevee_cache_init, &EEVEE_cache_populate, &eevee_cache_finish, diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index cc548a53a8e..1877d3a4b43 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -451,6 +451,7 @@ DrawEngineType draw_engine_external_type = { &external_data_size, &external_engine_init, &external_engine_free, + NULL, /* instance_free */ &external_cache_init, &external_cache_populate, &external_cache_finish, diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 50e32040522..9bc340a2786 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -990,6 +990,7 @@ DrawEngineType draw_engine_gpencil_type = { &GPENCIL_data_size, &GPENCIL_engine_init, &GPENCIL_engine_free, + NULL, /* instance_free */ &GPENCIL_cache_init, &GPENCIL_cache_populate, &GPENCIL_cache_finish, diff --git a/source/blender/draw/engines/image/image_engine.cc b/source/blender/draw/engines/image/image_engine.cc index 37db7246e67..be5946f34eb 100644 --- a/source/blender/draw/engines/image/image_engine.cc +++ b/source/blender/draw/engines/image/image_engine.cc @@ -191,6 +191,7 @@ DrawEngineType draw_engine_image_type = { &IMAGE_data_size, /* vedata_size */ &IMAGE_engine_init, /* engine_init */ &IMAGE_engine_free, /* engine_free */ + nullptr, /* instance_free */ &IMAGE_cache_init, /* cache_init */ &IMAGE_cache_populate, /* cache_populate */ nullptr, /* cache_finish */ diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index 2bdceb5f3db..12db2bd02cf 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -703,6 +703,7 @@ DrawEngineType draw_engine_overlay_type = { &overlay_data_size, &OVERLAY_engine_init, &OVERLAY_engine_free, + NULL, /* instance_free */ &OVERLAY_cache_init, &OVERLAY_cache_populate, &OVERLAY_cache_finish, diff --git a/source/blender/draw/engines/select/select_debug_engine.c b/source/blender/draw/engines/select/select_debug_engine.c index e9437c5ab92..f66eabdcdcc 100644 --- a/source/blender/draw/engines/select/select_debug_engine.c +++ b/source/blender/draw/engines/select/select_debug_engine.c @@ -120,6 +120,7 @@ DrawEngineType draw_engine_debug_select_type = { &select_debug_data_size, &select_debug_engine_init, &select_debug_engine_free, + NULL, /* instance_free */ NULL, NULL, NULL, diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c index 20edd78597b..7f9645013ce 100644 --- a/source/blender/draw/engines/select/select_engine.c +++ b/source/blender/draw/engines/select/select_engine.c @@ -363,6 +363,7 @@ DrawEngineType draw_engine_select_type = { &select_data_size, &select_engine_init, &select_engine_free, + NULL, /* instance_free */ &select_cache_init, &select_cache_populate, NULL, diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index 4706aeb4477..1db21cb4124 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -629,6 +629,7 @@ DrawEngineType draw_engine_workbench = { &workbench_data_size, &workbench_engine_init, &workbench_engine_free, + NULL, /* instance_free */ &workbench_cache_init, &workbench_cache_populate, &workbench_cache_finish, diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index c1cab931f6a..6491f5ca411 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -121,6 +121,8 @@ typedef struct DrawEngineType { void (*engine_init)(void *vedata); void (*engine_free)(void); + void (*instance_free)(void *instance_data); + void (*cache_init)(void *vedata); void (*cache_populate)(void *vedata, struct Object *ob); void (*cache_finish)(void *vedata); diff --git a/source/blender/draw/intern/draw_view_data.cc b/source/blender/draw/intern/draw_view_data.cc index 55ebbf82c29..af85584a054 100644 --- a/source/blender/draw/intern/draw_view_data.cc +++ b/source/blender/draw/intern/draw_view_data.cc @@ -120,6 +120,12 @@ static void draw_viewport_engines_data_clear(ViewportEngineData *data) MEM_SAFE_FREE(data->stl->storage[i]); } + if (data->instance_data) { + BLI_assert(engine_type->instance_free != nullptr); + engine_type->instance_free(data->instance_data); + data->instance_data = nullptr; + } + MEM_SAFE_FREE(data->fbl); MEM_SAFE_FREE(data->txl); MEM_SAFE_FREE(data->psl); diff --git a/source/blender/draw/intern/draw_view_data.h b/source/blender/draw/intern/draw_view_data.h index c8176170a61..01b614fb021 100644 --- a/source/blender/draw/intern/draw_view_data.h +++ b/source/blender/draw/intern/draw_view_data.h @@ -63,6 +63,12 @@ typedef struct ViewportEngineData { TextureList *txl; PassList *psl; StorageList *stl; + /** + * \brief Memory block that can be freely used by the draw engine. + * When used the draw engine must implement #DrawEngineType.instance_free callback. + */ + void *instance_data; + char info[GPU_INFO_SIZE]; /* we may want to put this elsewhere */ |