Cleanup: DRW: Remove unused legacy DRWViewport*List

This commit is contained in:
Clément Foucault
2025-02-10 22:49:28 +01:00
committed by Clément Foucault
parent ff34648011
commit 09e7e878e6
17 changed files with 0 additions and 152 deletions

View File

@@ -274,10 +274,6 @@ using namespace blender::draw::compositor_engine;
struct COMPOSITOR_Data {
DrawEngineType *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
Engine *instance_data;
char info[GPU_INFO_SIZE];
};
@@ -342,13 +338,10 @@ static void compositor_engine_update(void *data)
extern "C" {
static const DrawEngineDataSize compositor_data_size = DRW_VIEWPORT_DATA_SIZE(COMPOSITOR_Data);
DrawEngineType draw_engine_compositor_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Compositor"),
/*vedata_size*/ &compositor_data_size,
/*engine_init*/ &compositor_engine_init,
/*engine_free*/ nullptr,
/*instance_free*/ &compositor_engine_free,

View File

@@ -23,10 +23,6 @@ using namespace blender;
struct EEVEE_Data {
DrawEngineType *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
eevee::Instance *instance;
char info[GPU_INFO_SIZE];
@@ -187,15 +183,12 @@ static void eevee_render_update_passes(RenderEngine *engine, Scene *scene, ViewL
eevee::Instance::update_passes(engine, scene, view_layer);
}
static const DrawEngineDataSize eevee_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
extern "C" {
DrawEngineType draw_engine_eevee_next_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("EEVEE"),
/*vedata_size*/ &eevee_data_size,
/*engine_init*/ &eevee_engine_init,
/*engine_free*/ &eevee_engine_free,
/*instance_free*/ &eevee_instance_free,

View File

@@ -41,10 +41,6 @@
struct EXTERNAL_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
void *instance_data;
char info[GPU_INFO_SIZE];
@@ -236,13 +232,10 @@ static void external_draw_scene(void *vedata)
}
}
static const DrawEngineDataSize external_data_size = DRW_VIEWPORT_DATA_SIZE(EXTERNAL_Data);
DrawEngineType draw_engine_external_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("External"),
/*vedata_size*/ &external_data_size,
/*engine_init*/ nullptr,
/*engine_free*/ nullptr,
/*instance_free*/ nullptr,

View File

@@ -316,10 +316,6 @@ struct GPENCIL_Instance {
struct GPENCIL_Data {
void *engine_type; /* Required */
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
struct GPENCIL_Instance *instance;
char info[GPU_INFO_SIZE];

View File

@@ -936,13 +936,10 @@ static void GPENCIL_instance_free(void *instance)
delete reinterpret_cast<GPENCIL_Instance *>(instance);
}
static const DrawEngineDataSize GPENCIL_data_size = DRW_VIEWPORT_DATA_SIZE(GPENCIL_Data);
DrawEngineType draw_engine_gpencil_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("GpencilMode"),
/*vedata_size*/ &GPENCIL_data_size,
/*engine_init*/ &GPENCIL_engine_init,
/*engine_free*/ &GPENCIL_engine_free,
/*instance_free*/ &GPENCIL_instance_free,

View File

@@ -30,10 +30,6 @@ namespace blender::image_engine {
struct IMAGE_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
Instance *instance;
char info[GPU_INFO_SIZE];
};
@@ -85,8 +81,6 @@ static void IMAGE_instance_free(void *instance)
/** \} */
static const DrawEngineDataSize IMAGE_data_size = DRW_VIEWPORT_DATA_SIZE(IMAGE_Data);
} // namespace blender::image_engine
extern "C" {
@@ -97,7 +91,6 @@ DrawEngineType draw_engine_image_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("UV/Image"),
/*vedata_size*/ &IMAGE_data_size,
/*engine_init*/ &IMAGE_engine_init,
/*engine_free*/ &IMAGE_engine_free,
/*instance_free*/ &IMAGE_instance_free,

View File

@@ -96,13 +96,10 @@ static void OVERLAY_next_engine_free()
/** \name Engine Type
* \{ */
static const DrawEngineDataSize overlay_data_size = DRW_VIEWPORT_DATA_SIZE(OVERLAY_Data);
DrawEngineType draw_engine_overlay_next_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Overlay"),
/*vedata_size*/ &overlay_data_size,
/*engine_init*/ &OVERLAY_next_engine_init,
/*engine_free*/ &OVERLAY_next_engine_free,
/*instance_free*/ &OVERLAY_next_instance_free,

View File

@@ -36,10 +36,5 @@ enum OVERLAY_UVLineStyle {
struct OVERLAY_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
void *instance;
};

View File

@@ -27,10 +27,6 @@
struct SELECTIDDEBUG_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
};
static struct {
@@ -78,14 +74,10 @@ static void select_debug_engine_free()
/** \name Engine Type
* \{ */
static const DrawEngineDataSize select_debug_data_size = DRW_VIEWPORT_DATA_SIZE(
SELECTIDDEBUG_Data);
DrawEngineType draw_engine_debug_select_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Select ID Debug"),
/*vedata_size*/ &select_debug_data_size,
/*engine_init*/ nullptr,
/*engine_free*/ &select_debug_engine_free,
/*instance_free*/ nullptr,

View File

@@ -330,13 +330,10 @@ static void select_instance_free(void *instance)
/** \name Engine Type
* \{ */
static const DrawEngineDataSize select_data_size = DRW_VIEWPORT_DATA_SIZE(SELECTID_Data);
DrawEngineType draw_engine_select_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Select ID"),
/*vedata_size*/ &select_data_size,
/*engine_init*/ &select_engine_init,
/*engine_free*/ &select_engine_free,
/*instance_free*/ select_instance_free,

View File

@@ -25,11 +25,6 @@ using Instance = overlay::Instance;
struct SELECT_NextData {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
Instance *instance;
};
@@ -83,13 +78,10 @@ static void SELECT_next_instance_free(void *instance_)
delete instance;
}
static const DrawEngineDataSize SELECT_next_data_size = DRW_VIEWPORT_DATA_SIZE(SELECT_NextData);
DrawEngineType draw_engine_select_next_type = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Select-Next"),
/*vedata_size*/ &SELECT_next_data_size,
/*engine_init*/ &SELECT_next_engine_init,
/*engine_free*/ nullptr,
/*instance_free*/ &SELECT_next_instance_free,

View File

@@ -46,10 +46,6 @@ struct SELECTID_Instance {
struct SELECTID_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
SELECTID_Instance *instance;
char info[GPU_INFO_SIZE];

View File

@@ -531,10 +531,6 @@ using namespace blender;
struct WORKBENCH_Data {
DrawEngineType *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
DRWViewportEmptyList *psl;
DRWViewportEmptyList *stl;
workbench::Instance *instance;
char info[GPU_INFO_SIZE];
@@ -798,13 +794,10 @@ static void workbench_render_update_passes(RenderEngine *engine,
extern "C" {
static const DrawEngineDataSize workbench_data_size = DRW_VIEWPORT_DATA_SIZE(WORKBENCH_Data);
DrawEngineType draw_engine_workbench = {
/*next*/ nullptr,
/*prev*/ nullptr,
/*idname*/ N_("Workbench"),
/*vedata_size*/ &workbench_data_size,
/*engine_init*/ &workbench_engine_init,
/*engine_free*/ &workbench_engine_free,
/*instance_free*/ &workbench_instance_free,

View File

@@ -62,35 +62,11 @@ struct BoundSphere {
float center[3], radius;
};
/* declare members as empty (unused) */
typedef char DRWViewportEmptyList;
#define DRW_VIEWPORT_LIST_SIZE(list) \
(sizeof(list) == sizeof(DRWViewportEmptyList) ? 0 : (sizeof(list) / sizeof(void *)))
/* Unused members must be either pass list or 'char *' when not used. */
#define DRW_VIEWPORT_DATA_SIZE(ty) \
{ \
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->fbl)), \
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->txl)), \
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->psl)), \
DRW_VIEWPORT_LIST_SIZE(*(((ty *)nullptr)->stl)), \
}
struct DrawEngineDataSize {
int fbl_len;
int txl_len;
int psl_len;
int stl_len;
};
struct DrawEngineType {
DrawEngineType *next, *prev;
char idname[32];
const DrawEngineDataSize *vedata_size;
void (*engine_init)(void *vedata);
void (*engine_free)();

View File

@@ -880,9 +880,6 @@ static void drw_engines_init()
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) {
PROFILE_START(stime);
const DrawEngineDataSize *data_size = engine->vedata_size;
memset(data->psl->passes, 0, sizeof(*data->psl->passes) * data_size->psl_len);
if (engine->engine_init) {
engine->engine_init(data);
}

View File

@@ -120,17 +120,6 @@ void DRW_view_data_default_lists_from_viewport(DRWViewData *view_data, GPUViewpo
static void draw_viewport_engines_data_clear(ViewportEngineData *data, bool clear_instance_data)
{
DrawEngineType *engine_type = data->engine_type->draw_engine;
const DrawEngineDataSize *data_size = engine_type->vedata_size;
for (int i = 0; data->fbl && i < data_size->fbl_len; i++) {
GPU_FRAMEBUFFER_FREE_SAFE(data->fbl->framebuffers[i]);
}
for (int i = 0; data->txl && i < data_size->txl_len; i++) {
GPU_TEXTURE_FREE_SAFE(data->txl->textures[i]);
}
for (int i = 0; data->stl && i < data_size->stl_len; i++) {
MEM_SAFE_FREE(data->stl->storage[i]);
}
if (clear_instance_data && data->instance_data) {
BLI_assert(engine_type->instance_free != nullptr);
@@ -138,11 +127,6 @@ static void draw_viewport_engines_data_clear(ViewportEngineData *data, bool clea
data->instance_data = nullptr;
}
MEM_SAFE_FREE(data->fbl);
MEM_SAFE_FREE(data->txl);
MEM_SAFE_FREE(data->psl);
MEM_SAFE_FREE(data->stl);
if (data->text_draw_cache) {
DRW_text_cache_destroy(data->text_draw_cache);
data->text_draw_cache = nullptr;
@@ -189,17 +173,6 @@ ViewportEngineData *DRW_view_data_engine_data_get_ensure(DRWViewData *view_data,
{
for (ViewportEngineData &engine : view_data->engines) {
if (engine.engine_type->draw_engine == engine_type) {
if (engine.fbl == nullptr) {
const DrawEngineDataSize *data_size = engine_type->vedata_size;
engine.fbl = (FramebufferList *)MEM_calloc_arrayN(
data_size->fbl_len, sizeof(GPUFrameBuffer *), "FramebufferList");
engine.txl = (TextureList *)MEM_calloc_arrayN(
data_size->txl_len, sizeof(GPUTexture *), "TextureList");
engine.psl = (PassList *)MEM_calloc_arrayN(
data_size->psl_len, sizeof(DRWPass *), "PassList");
engine.stl = (StorageList *)MEM_calloc_arrayN(
data_size->stl_len, sizeof(void *), "StorageList");
}
return &engine;
}
}

View File

@@ -17,7 +17,6 @@ namespace blender::draw {
class TextureFromPool;
} // namespace blender::draw
struct DRWPass;
struct DRWRegisteredDrawEngine;
struct DRWTextStore;
struct DrawEngineType;
@@ -26,34 +25,10 @@ struct GPUTexture;
struct GPUViewport;
struct ListBase;
/* NOTE: these structs are only here for reading the actual lists from the engine.
* The actual length of them is stored in a ViewportEngineData_Info.
* The length of 1 is just here to avoid compiler warning. */
struct FramebufferList {
GPUFrameBuffer *framebuffers[1];
};
struct TextureList {
GPUTexture *textures[1];
};
struct PassList {
DRWPass *passes[1];
};
/* Stores custom structs from the engine that have been MEM_(m/c)allocN'ed. */
struct StorageList {
void *storage[1];
};
struct ViewportEngineData {
/* Not owning pointer to the draw engine. */
DRWRegisteredDrawEngine *engine_type;
FramebufferList *fbl;
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.