From b069218a5563662b08b3057c96e5e0be877c16ca Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 7 Dec 2021 10:33:55 +0100 Subject: DrawManager: Engine Instance Data. In the original design draw engines had to copy with a limitation that they were not allowed to reuse complex data structures between drawing calls. Data that could be reused were limited to: - GPUFramebuffers - GPUTextures - Memory that could be removed calling MEM_freeN (storage list) - DRWPass This is fine when the storage list contains arrays or structs but when more complex data types (vectors, maps) etc wasn't possible. This patch adds instance_data that can be reused between drawing calls. The instance_data is controlled by the draw engine and doesn't need to be limited as described above. When an engines stores instance_data it must implement the `DrawEngineType.instance_free` callback to free the data. The patch originates from eevee rewrite. But was added to master as the image engine rewrite also has a need for it. Reviewed By: fclem Differential Revision: https://developer.blender.org/D13425 --- source/blender/draw/engines/select/select_debug_engine.c | 1 + source/blender/draw/engines/select/select_engine.c | 1 + 2 files changed, 2 insertions(+) (limited to 'source/blender/draw/engines/select') 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, -- cgit v1.2.3