Draw Engine: remove hard coded limit on array sizes
This removes MAX_STORAGE, MAX_BUFFERS, MAX_TEXTURES, MAX_PASSES limits. Actual memory saving isn't so important, it just means we don't need to manually bump these based on changes to engines.
This commit is contained in:
@@ -49,6 +49,9 @@ void DRW_engines_register(void);
|
|||||||
void DRW_engines_free(void);
|
void DRW_engines_free(void);
|
||||||
|
|
||||||
void DRW_engine_register(struct DrawEngineType *draw_engine_type);
|
void DRW_engine_register(struct DrawEngineType *draw_engine_type);
|
||||||
|
void DRW_engine_viewport_data_size_get(
|
||||||
|
const void *engine_type,
|
||||||
|
int *r_fbl_len, int *r_txl_len, int *r_psl_len, int *r_stl_len);
|
||||||
|
|
||||||
void DRW_draw_view(const struct bContext *C);
|
void DRW_draw_view(const struct bContext *C);
|
||||||
|
|
||||||
|
@@ -73,14 +73,12 @@ typedef struct CLAY_Storage {
|
|||||||
DRWShadingGroup *shgrps[MAX_CLAY_MAT];
|
DRWShadingGroup *shgrps[MAX_CLAY_MAT];
|
||||||
} CLAY_Storage;
|
} CLAY_Storage;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct CLAY_StorageList {
|
typedef struct CLAY_StorageList {
|
||||||
struct CLAY_Storage *storage;
|
struct CLAY_Storage *storage;
|
||||||
struct GPUUniformBuffer *mat_ubo;
|
struct GPUUniformBuffer *mat_ubo;
|
||||||
struct g_data *g_data;
|
struct g_data *g_data;
|
||||||
} CLAY_StorageList;
|
} CLAY_StorageList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct CLAY_FramebufferList {
|
typedef struct CLAY_FramebufferList {
|
||||||
/* default */
|
/* default */
|
||||||
struct GPUFrameBuffer *default_fb;
|
struct GPUFrameBuffer *default_fb;
|
||||||
@@ -88,7 +86,6 @@ typedef struct CLAY_FramebufferList {
|
|||||||
struct GPUFrameBuffer *dupli_depth;
|
struct GPUFrameBuffer *dupli_depth;
|
||||||
} CLAY_FramebufferList;
|
} CLAY_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct CLAY_TextureList {
|
typedef struct CLAY_TextureList {
|
||||||
/* default */
|
/* default */
|
||||||
struct GPUTexture *color;
|
struct GPUTexture *color;
|
||||||
@@ -97,7 +94,6 @@ typedef struct CLAY_TextureList {
|
|||||||
struct GPUTexture *depth_dup;
|
struct GPUTexture *depth_dup;
|
||||||
} CLAY_TextureList;
|
} CLAY_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct CLAY_PassList {
|
typedef struct CLAY_PassList {
|
||||||
struct DRWPass *depth_pass;
|
struct DRWPass *depth_pass;
|
||||||
struct DRWPass *depth_pass_cull;
|
struct DRWPass *depth_pass_cull;
|
||||||
@@ -650,9 +646,12 @@ static void CLAY_engine_free(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DrawEngineDataSize CLAY_data_size = DRW_VIEWPORT_DATA_SIZE(CLAY_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_clay_type = {
|
DrawEngineType draw_engine_clay_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("Clay"),
|
N_("Clay"),
|
||||||
|
&CLAY_data_size,
|
||||||
&CLAY_engine_init,
|
&CLAY_engine_init,
|
||||||
&CLAY_engine_free,
|
&CLAY_engine_free,
|
||||||
&CLAY_cache_init,
|
&CLAY_cache_init,
|
||||||
|
@@ -268,9 +268,12 @@ static void EEVEE_collection_settings_create(RenderEngine *UNUSED(engine), IDPro
|
|||||||
// BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false);
|
// BKE_collection_engine_property_add_int(props, "high_quality_sphere_lamps", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EEVEE_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_eevee_type = {
|
DrawEngineType draw_engine_eevee_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("Eevee"),
|
N_("Eevee"),
|
||||||
|
&EEVEE_data_size,
|
||||||
&EEVEE_engine_init,
|
&EEVEE_engine_init,
|
||||||
&EEVEE_engine_free,
|
&EEVEE_engine_free,
|
||||||
&EEVEE_cache_init,
|
&EEVEE_cache_init,
|
||||||
|
@@ -32,7 +32,6 @@ struct Object;
|
|||||||
#define MAX_SHADOW_CASCADE 8
|
#define MAX_SHADOW_CASCADE 8
|
||||||
#define MAX_CASCADE_NUM 4
|
#define MAX_CASCADE_NUM 4
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EEVEE_PassList {
|
typedef struct EEVEE_PassList {
|
||||||
struct DRWPass *shadow_pass;
|
struct DRWPass *shadow_pass;
|
||||||
struct DRWPass *depth_pass;
|
struct DRWPass *depth_pass;
|
||||||
@@ -41,7 +40,6 @@ typedef struct EEVEE_PassList {
|
|||||||
struct DRWPass *tonemap;
|
struct DRWPass *tonemap;
|
||||||
} EEVEE_PassList;
|
} EEVEE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EEVEE_FramebufferList {
|
typedef struct EEVEE_FramebufferList {
|
||||||
struct GPUFrameBuffer *main; /* HDR */
|
struct GPUFrameBuffer *main; /* HDR */
|
||||||
struct GPUFrameBuffer *shadow_cube_fb;
|
struct GPUFrameBuffer *shadow_cube_fb;
|
||||||
@@ -49,7 +47,6 @@ typedef struct EEVEE_FramebufferList {
|
|||||||
struct GPUFrameBuffer *shadow_cascade_fb;
|
struct GPUFrameBuffer *shadow_cascade_fb;
|
||||||
} EEVEE_FramebufferList;
|
} EEVEE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EEVEE_TextureList {
|
typedef struct EEVEE_TextureList {
|
||||||
struct GPUTexture *color; /* R11_G11_B10 */
|
struct GPUTexture *color; /* R11_G11_B10 */
|
||||||
struct GPUTexture *shadow_depth_cube_pool;
|
struct GPUTexture *shadow_depth_cube_pool;
|
||||||
@@ -57,7 +54,6 @@ typedef struct EEVEE_TextureList {
|
|||||||
struct GPUTexture *shadow_depth_cascade_pool;
|
struct GPUTexture *shadow_depth_cascade_pool;
|
||||||
} EEVEE_TextureList;
|
} EEVEE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EEVEE_StorageList {
|
typedef struct EEVEE_StorageList {
|
||||||
/* Lamps */
|
/* Lamps */
|
||||||
/* XXX this should be per-scenelayer and not per_viewport */
|
/* XXX this should be per-scenelayer and not per_viewport */
|
||||||
|
@@ -63,17 +63,38 @@ struct DefaultFramebufferList;
|
|||||||
struct DefaultTextureList;
|
struct DefaultTextureList;
|
||||||
struct LampEngineData;
|
struct LampEngineData;
|
||||||
struct RenderEngineType;
|
struct RenderEngineType;
|
||||||
|
struct ViewportEngineData;
|
||||||
|
struct ViewportEngineData_Info;
|
||||||
|
|
||||||
typedef struct DRWUniform DRWUniform;
|
typedef struct DRWUniform DRWUniform;
|
||||||
typedef struct DRWInterface DRWInterface;
|
typedef struct DRWInterface DRWInterface;
|
||||||
typedef struct DRWPass DRWPass;
|
typedef struct DRWPass DRWPass;
|
||||||
typedef struct DRWShadingGroup DRWShadingGroup;
|
typedef struct DRWShadingGroup DRWShadingGroup;
|
||||||
|
|
||||||
|
#define DRW_VIEWPORT_LIST_SIZE(list) (sizeof(list) == sizeof(char) ? 0 : ((sizeof(list)) / sizeof(void *)))
|
||||||
|
|
||||||
|
/* Unused members must be either pass list or 'char *' when not usd. */
|
||||||
|
#define DRW_VIEWPORT_DATA_SIZE(ty) { \
|
||||||
|
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->fbl)), \
|
||||||
|
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->txl)), \
|
||||||
|
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->psl)), \
|
||||||
|
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->stl)) \
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct DrawEngineDataSize {
|
||||||
|
int fbl_len;
|
||||||
|
int txl_len;
|
||||||
|
int psl_len;
|
||||||
|
int stl_len;
|
||||||
|
} DrawEngineDataSize;
|
||||||
|
|
||||||
typedef struct DrawEngineType {
|
typedef struct DrawEngineType {
|
||||||
struct DrawEngineType *next, *prev;
|
struct DrawEngineType *next, *prev;
|
||||||
|
|
||||||
char idname[32];
|
char idname[32];
|
||||||
|
|
||||||
|
const DrawEngineDataSize *vedata_size;
|
||||||
|
|
||||||
void (*engine_init)(void *vedata);
|
void (*engine_init)(void *vedata);
|
||||||
void (*engine_free)(void);
|
void (*engine_free)(void);
|
||||||
|
|
||||||
|
@@ -1308,6 +1308,7 @@ void DRW_framebuffer_blit(struct GPUFrameBuffer *fb_read, struct GPUFrameBuffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ****************************************** Viewport ******************************************/
|
/* ****************************************** Viewport ******************************************/
|
||||||
|
|
||||||
static void *DRW_viewport_engine_data_get(void *engine_type)
|
static void *DRW_viewport_engine_data_get(void *engine_type)
|
||||||
{
|
{
|
||||||
void *data = GPU_viewport_engine_data_get(DST.viewport, engine_type);
|
void *data = GPU_viewport_engine_data_get(DST.viewport, engine_type);
|
||||||
@@ -1318,6 +1319,26 @@ static void *DRW_viewport_engine_data_get(void *engine_type)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DRW_engine_viewport_data_size_get(
|
||||||
|
const void *engine_type_v,
|
||||||
|
int *r_fbl_len, int *r_txl_len, int *r_psl_len, int *r_stl_len)
|
||||||
|
{
|
||||||
|
const DrawEngineType *engine_type = engine_type_v;
|
||||||
|
|
||||||
|
if (r_fbl_len) {
|
||||||
|
*r_fbl_len = engine_type->vedata_size->fbl_len;
|
||||||
|
}
|
||||||
|
if (r_txl_len) {
|
||||||
|
*r_txl_len = engine_type->vedata_size->txl_len;
|
||||||
|
}
|
||||||
|
if (r_psl_len) {
|
||||||
|
*r_psl_len = engine_type->vedata_size->psl_len;
|
||||||
|
}
|
||||||
|
if (r_stl_len) {
|
||||||
|
*r_stl_len = engine_type->vedata_size->stl_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const float *DRW_viewport_size_get(void)
|
const float *DRW_viewport_size_get(void)
|
||||||
{
|
{
|
||||||
return &DST.size[0];
|
return &DST.size[0];
|
||||||
@@ -1739,7 +1760,7 @@ static void DRW_debug_gpu_stats(void)
|
|||||||
draw_stat(&rect, 0, v, engine->idname, sizeof(engine->idname));
|
draw_stat(&rect, 0, v, engine->idname, sizeof(engine->idname));
|
||||||
v++;
|
v++;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PASSES; ++i) {
|
for (int i = 0; i < engine->vedata_size->psl_len; ++i) {
|
||||||
DRWPass *pass = data->psl->passes[i];
|
DRWPass *pass = data->psl->passes[i];
|
||||||
if (pass != NULL) {
|
if (pass != NULL) {
|
||||||
GLuint64 time;
|
GLuint64 time;
|
||||||
|
@@ -35,24 +35,22 @@
|
|||||||
extern GlobalsUboStorage ts;
|
extern GlobalsUboStorage ts;
|
||||||
|
|
||||||
/* *********** LISTS *********** */
|
/* *********** LISTS *********** */
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_ARMATURE_PassList {
|
typedef struct EDIT_ARMATURE_PassList {
|
||||||
struct DRWPass *bone_solid;
|
struct DRWPass *bone_solid;
|
||||||
struct DRWPass *bone_wire;
|
struct DRWPass *bone_wire;
|
||||||
struct DRWPass *relationship;
|
struct DRWPass *relationship;
|
||||||
} EDIT_ARMATURE_PassList;
|
} EDIT_ARMATURE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_ARMATURE_StorageList {
|
typedef struct EDIT_ARMATURE_StorageList {
|
||||||
struct g_data *g_data;
|
struct g_data *g_data;
|
||||||
} EDIT_ARMATURE_StorageList;
|
} EDIT_ARMATURE_StorageList;
|
||||||
|
|
||||||
typedef struct EDIT_ARMATURE_Data {
|
typedef struct EDIT_ARMATURE_Data {
|
||||||
void *engine_type;
|
void *engine_type;
|
||||||
void *fbl;
|
char *fbl;
|
||||||
void *txl;
|
char *txl;
|
||||||
EDIT_ARMATURE_PassList *psl;
|
EDIT_ARMATURE_PassList *psl;
|
||||||
void *stl;
|
EDIT_ARMATURE_StorageList *stl;
|
||||||
} EDIT_ARMATURE_Data;
|
} EDIT_ARMATURE_Data;
|
||||||
|
|
||||||
/* *********** STATIC *********** */
|
/* *********** STATIC *********** */
|
||||||
@@ -126,9 +124,12 @@ void EDIT_ARMATURE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_ARMATURE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_ARMATURE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_armature_type = {
|
DrawEngineType draw_engine_edit_armature_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditArmatureMode"),
|
N_("EditArmatureMode"),
|
||||||
|
&EDIT_ARMATURE_data_size,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&EDIT_ARMATURE_cache_init,
|
&EDIT_ARMATURE_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and EDIT_CURVE_cache_init()
|
* initialize most of them and EDIT_CURVE_cache_init()
|
||||||
* for EDIT_CURVE_PassList */
|
* for EDIT_CURVE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_CURVE_PassList {
|
typedef struct EDIT_CURVE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* EDIT_CURVE_cache_init().
|
* EDIT_CURVE_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct EDIT_CURVE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} EDIT_CURVE_PassList;
|
} EDIT_CURVE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_CURVE_FramebufferList {
|
typedef struct EDIT_CURVE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} EDIT_CURVE_FramebufferList;
|
} EDIT_CURVE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_CURVE_TextureList {
|
typedef struct EDIT_CURVE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct EDIT_CURVE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} EDIT_CURVE_TextureList;
|
} EDIT_CURVE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_CURVE_StorageList {
|
typedef struct EDIT_CURVE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -259,9 +255,12 @@ void EDIT_CURVE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_CURVE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_CURVE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_curve_type = {
|
DrawEngineType draw_engine_edit_curve_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditCurveMode"),
|
N_("EditCurveMode"),
|
||||||
|
&EDIT_CURVE_data_size,
|
||||||
&EDIT_CURVE_engine_init,
|
&EDIT_CURVE_engine_init,
|
||||||
&EDIT_CURVE_engine_free,
|
&EDIT_CURVE_engine_free,
|
||||||
&EDIT_CURVE_cache_init,
|
&EDIT_CURVE_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and EDIT_LATTICE_cache_init()
|
* initialize most of them and EDIT_LATTICE_cache_init()
|
||||||
* for EDIT_LATTICE_PassList */
|
* for EDIT_LATTICE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_LATTICE_PassList {
|
typedef struct EDIT_LATTICE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* EDIT_LATTICE_cache_init().
|
* EDIT_LATTICE_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct EDIT_LATTICE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} EDIT_LATTICE_PassList;
|
} EDIT_LATTICE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_LATTICE_FramebufferList {
|
typedef struct EDIT_LATTICE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} EDIT_LATTICE_FramebufferList;
|
} EDIT_LATTICE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_LATTICE_TextureList {
|
typedef struct EDIT_LATTICE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct EDIT_LATTICE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} EDIT_LATTICE_TextureList;
|
} EDIT_LATTICE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_LATTICE_StorageList {
|
typedef struct EDIT_LATTICE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void EDIT_LATTICE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_LATTICE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_LATTICE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_lattice_type = {
|
DrawEngineType draw_engine_edit_lattice_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditLatticeMode"),
|
N_("EditLatticeMode"),
|
||||||
|
&EDIT_LATTICE_data_size,
|
||||||
&EDIT_LATTICE_engine_init,
|
&EDIT_LATTICE_engine_init,
|
||||||
&EDIT_LATTICE_engine_free,
|
&EDIT_LATTICE_engine_free,
|
||||||
&EDIT_LATTICE_cache_init,
|
&EDIT_LATTICE_cache_init,
|
||||||
|
@@ -54,7 +54,6 @@ extern char datatoc_common_globals_lib_glsl[];
|
|||||||
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
|
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
|
||||||
|
|
||||||
/* *********** LISTS *********** */
|
/* *********** LISTS *********** */
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_MESH_PassList {
|
typedef struct EDIT_MESH_PassList {
|
||||||
struct DRWPass *depth_hidden_wire;
|
struct DRWPass *depth_hidden_wire;
|
||||||
struct DRWPass *edit_face_overlay;
|
struct DRWPass *edit_face_overlay;
|
||||||
@@ -64,18 +63,15 @@ typedef struct EDIT_MESH_PassList {
|
|||||||
struct DRWPass *normals;
|
struct DRWPass *normals;
|
||||||
} EDIT_MESH_PassList;
|
} EDIT_MESH_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_MESH_FramebufferList {
|
typedef struct EDIT_MESH_FramebufferList {
|
||||||
struct GPUFrameBuffer *occlude_wire_fb;
|
struct GPUFrameBuffer *occlude_wire_fb;
|
||||||
} EDIT_MESH_FramebufferList;
|
} EDIT_MESH_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_MESH_TextureList {
|
typedef struct EDIT_MESH_TextureList {
|
||||||
struct GPUTexture *occlude_wire_depth_tx;
|
struct GPUTexture *occlude_wire_depth_tx;
|
||||||
struct GPUTexture *occlude_wire_color_tx;
|
struct GPUTexture *occlude_wire_color_tx;
|
||||||
} EDIT_MESH_TextureList;
|
} EDIT_MESH_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_MESH_StorageList {
|
typedef struct EDIT_MESH_StorageList {
|
||||||
struct g_data *g_data;
|
struct g_data *g_data;
|
||||||
} EDIT_MESH_StorageList;
|
} EDIT_MESH_StorageList;
|
||||||
@@ -85,7 +81,7 @@ typedef struct EDIT_MESH_Data {
|
|||||||
EDIT_MESH_FramebufferList *fbl;
|
EDIT_MESH_FramebufferList *fbl;
|
||||||
EDIT_MESH_TextureList *txl;
|
EDIT_MESH_TextureList *txl;
|
||||||
EDIT_MESH_PassList *psl;
|
EDIT_MESH_PassList *psl;
|
||||||
void *stl;
|
EDIT_MESH_StorageList *stl;
|
||||||
} EDIT_MESH_Data;
|
} EDIT_MESH_Data;
|
||||||
|
|
||||||
/* *********** STATIC *********** */
|
/* *********** STATIC *********** */
|
||||||
@@ -529,9 +525,12 @@ static void EDIT_MESH_engine_free(void)
|
|||||||
DRW_shader_free(e_data.normals_sh);
|
DRW_shader_free(e_data.normals_sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_MESH_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_MESH_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_mesh_type = {
|
DrawEngineType draw_engine_edit_mesh_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditMeshMode"),
|
N_("EditMeshMode"),
|
||||||
|
&EDIT_MESH_data_size,
|
||||||
&EDIT_MESH_engine_init,
|
&EDIT_MESH_engine_init,
|
||||||
&EDIT_MESH_engine_free,
|
&EDIT_MESH_engine_free,
|
||||||
&EDIT_MESH_cache_init,
|
&EDIT_MESH_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and EDIT_METABALL_cache_init()
|
* initialize most of them and EDIT_METABALL_cache_init()
|
||||||
* for EDIT_METABALL_PassList */
|
* for EDIT_METABALL_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_METABALL_PassList {
|
typedef struct EDIT_METABALL_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* EDIT_METABALL_cache_init().
|
* EDIT_METABALL_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct EDIT_METABALL_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} EDIT_METABALL_PassList;
|
} EDIT_METABALL_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_METABALL_FramebufferList {
|
typedef struct EDIT_METABALL_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} EDIT_METABALL_FramebufferList;
|
} EDIT_METABALL_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_METABALL_TextureList {
|
typedef struct EDIT_METABALL_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct EDIT_METABALL_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} EDIT_METABALL_TextureList;
|
} EDIT_METABALL_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_METABALL_StorageList {
|
typedef struct EDIT_METABALL_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void EDIT_METABALL_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_METABALL_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_METABALL_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_metaball_type = {
|
DrawEngineType draw_engine_edit_metaball_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditMetaballMode"),
|
N_("EditMetaballMode"),
|
||||||
|
&EDIT_METABALL_data_size,
|
||||||
&EDIT_METABALL_engine_init,
|
&EDIT_METABALL_engine_init,
|
||||||
&EDIT_METABALL_engine_free,
|
&EDIT_METABALL_engine_free,
|
||||||
&EDIT_METABALL_cache_init,
|
&EDIT_METABALL_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and EDIT_SURFACE_cache_init()
|
* initialize most of them and EDIT_SURFACE_cache_init()
|
||||||
* for EDIT_SURFACE_PassList */
|
* for EDIT_SURFACE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_SURFACE_PassList {
|
typedef struct EDIT_SURFACE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* EDIT_SURFACE_cache_init().
|
* EDIT_SURFACE_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct EDIT_SURFACE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} EDIT_SURFACE_PassList;
|
} EDIT_SURFACE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_SURFACE_FramebufferList {
|
typedef struct EDIT_SURFACE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} EDIT_SURFACE_FramebufferList;
|
} EDIT_SURFACE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_SURFACE_TextureList {
|
typedef struct EDIT_SURFACE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct EDIT_SURFACE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} EDIT_SURFACE_TextureList;
|
} EDIT_SURFACE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_SURFACE_StorageList {
|
typedef struct EDIT_SURFACE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void EDIT_SURFACE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_SURFACE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_SURFACE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_surface_type = {
|
DrawEngineType draw_engine_edit_surface_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditSurfaceMode"),
|
N_("EditSurfaceMode"),
|
||||||
|
&EDIT_SURFACE_data_size,
|
||||||
&EDIT_SURFACE_engine_init,
|
&EDIT_SURFACE_engine_init,
|
||||||
&EDIT_SURFACE_engine_free,
|
&EDIT_SURFACE_engine_free,
|
||||||
&EDIT_SURFACE_cache_init,
|
&EDIT_SURFACE_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and EDIT_TEXT_cache_init()
|
* initialize most of them and EDIT_TEXT_cache_init()
|
||||||
* for EDIT_TEXT_PassList */
|
* for EDIT_TEXT_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct EDIT_TEXT_PassList {
|
typedef struct EDIT_TEXT_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* EDIT_TEXT_cache_init().
|
* EDIT_TEXT_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct EDIT_TEXT_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} EDIT_TEXT_PassList;
|
} EDIT_TEXT_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct EDIT_TEXT_FramebufferList {
|
typedef struct EDIT_TEXT_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} EDIT_TEXT_FramebufferList;
|
} EDIT_TEXT_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct EDIT_TEXT_TextureList {
|
typedef struct EDIT_TEXT_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct EDIT_TEXT_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} EDIT_TEXT_TextureList;
|
} EDIT_TEXT_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct EDIT_TEXT_StorageList {
|
typedef struct EDIT_TEXT_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void EDIT_TEXT_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize EDIT_TEXT_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_TEXT_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_edit_text_type = {
|
DrawEngineType draw_engine_edit_text_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("EditTextMode"),
|
N_("EditTextMode"),
|
||||||
|
&EDIT_TEXT_data_size,
|
||||||
&EDIT_TEXT_engine_init,
|
&EDIT_TEXT_engine_init,
|
||||||
&EDIT_TEXT_engine_free,
|
&EDIT_TEXT_engine_free,
|
||||||
&EDIT_TEXT_cache_init,
|
&EDIT_TEXT_cache_init,
|
||||||
|
@@ -60,7 +60,6 @@ extern char datatoc_object_grid_vert_glsl[];
|
|||||||
extern char datatoc_common_globals_lib_glsl[];
|
extern char datatoc_common_globals_lib_glsl[];
|
||||||
|
|
||||||
/* *********** LISTS *********** */
|
/* *********** LISTS *********** */
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct OBJECT_PassList {
|
typedef struct OBJECT_PassList {
|
||||||
struct DRWPass *non_meshes;
|
struct DRWPass *non_meshes;
|
||||||
struct DRWPass *ob_center;
|
struct DRWPass *ob_center;
|
||||||
@@ -78,30 +77,27 @@ typedef struct OBJECT_PassList {
|
|||||||
struct DRWPass *bone_wire;
|
struct DRWPass *bone_wire;
|
||||||
} OBJECT_PassList;
|
} OBJECT_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct OBJECT_FramebufferList {
|
typedef struct OBJECT_FramebufferList {
|
||||||
struct GPUFrameBuffer *outlines;
|
struct GPUFrameBuffer *outlines;
|
||||||
struct GPUFrameBuffer *blur;
|
struct GPUFrameBuffer *blur;
|
||||||
} OBJECT_FramebufferList;
|
} OBJECT_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct OBJECT_TextureList {
|
typedef struct OBJECT_TextureList {
|
||||||
struct GPUTexture *outlines_depth_tx;
|
struct GPUTexture *outlines_depth_tx;
|
||||||
struct GPUTexture *outlines_color_tx;
|
struct GPUTexture *outlines_color_tx;
|
||||||
struct GPUTexture *outlines_blur_tx;
|
struct GPUTexture *outlines_blur_tx;
|
||||||
} OBJECT_TextureList;
|
} OBJECT_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct OBJECT_StorageList {
|
typedef struct OBJECT_StorageList {
|
||||||
struct g_data *g_data;
|
struct g_data *g_data;
|
||||||
} OBJECT_StorageList;
|
} OBJECT_StorageList;
|
||||||
|
|
||||||
typedef struct OBJECT_Data {
|
typedef struct OBJECT_Data {
|
||||||
void *engine_type;
|
void *engine_type;
|
||||||
void *fbl;
|
OBJECT_FramebufferList *fbl;
|
||||||
void *txl;
|
OBJECT_TextureList *txl;
|
||||||
OBJECT_PassList *psl;
|
OBJECT_PassList *psl;
|
||||||
void *stl;
|
OBJECT_StorageList *stl;
|
||||||
} OBJECT_Data;
|
} OBJECT_Data;
|
||||||
|
|
||||||
/* *********** STATIC *********** */
|
/* *********** STATIC *********** */
|
||||||
@@ -1218,9 +1214,12 @@ void OBJECT_collection_settings_create(IDProperty *props)
|
|||||||
BKE_collection_engine_property_add_int(props, "show_backface_culling", false);
|
BKE_collection_engine_property_add_int(props, "show_backface_culling", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DrawEngineDataSize OBJECT_data_size = DRW_VIEWPORT_DATA_SIZE(OBJECT_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_object_type = {
|
DrawEngineType draw_engine_object_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("ObjectMode"),
|
N_("ObjectMode"),
|
||||||
|
&OBJECT_data_size,
|
||||||
&OBJECT_engine_init,
|
&OBJECT_engine_init,
|
||||||
&OBJECT_engine_free,
|
&OBJECT_engine_free,
|
||||||
&OBJECT_cache_init,
|
&OBJECT_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and PAINT_TEXTURE_cache_init()
|
* initialize most of them and PAINT_TEXTURE_cache_init()
|
||||||
* for PAINT_TEXTURE_PassList */
|
* for PAINT_TEXTURE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct PAINT_TEXTURE_PassList {
|
typedef struct PAINT_TEXTURE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* PAINT_TEXTURE_cache_init().
|
* PAINT_TEXTURE_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct PAINT_TEXTURE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} PAINT_TEXTURE_PassList;
|
} PAINT_TEXTURE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct PAINT_TEXTURE_FramebufferList {
|
typedef struct PAINT_TEXTURE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} PAINT_TEXTURE_FramebufferList;
|
} PAINT_TEXTURE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct PAINT_TEXTURE_TextureList {
|
typedef struct PAINT_TEXTURE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct PAINT_TEXTURE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} PAINT_TEXTURE_TextureList;
|
} PAINT_TEXTURE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct PAINT_TEXTURE_StorageList {
|
typedef struct PAINT_TEXTURE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void PAINT_TEXTURE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize PAINT_TEXTURE_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_TEXTURE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_paint_texture_type = {
|
DrawEngineType draw_engine_paint_texture_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("PaintTextureMode"),
|
N_("PaintTextureMode"),
|
||||||
|
&PAINT_TEXTURE_data_size,
|
||||||
&PAINT_TEXTURE_engine_init,
|
&PAINT_TEXTURE_engine_init,
|
||||||
&PAINT_TEXTURE_engine_free,
|
&PAINT_TEXTURE_engine_free,
|
||||||
&PAINT_TEXTURE_cache_init,
|
&PAINT_TEXTURE_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and PAINT_VERTEX_cache_init()
|
* initialize most of them and PAINT_VERTEX_cache_init()
|
||||||
* for PAINT_VERTEX_PassList */
|
* for PAINT_VERTEX_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct PAINT_VERTEX_PassList {
|
typedef struct PAINT_VERTEX_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* PAINT_VERTEX_cache_init().
|
* PAINT_VERTEX_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct PAINT_VERTEX_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} PAINT_VERTEX_PassList;
|
} PAINT_VERTEX_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct PAINT_VERTEX_FramebufferList {
|
typedef struct PAINT_VERTEX_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} PAINT_VERTEX_FramebufferList;
|
} PAINT_VERTEX_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct PAINT_VERTEX_TextureList {
|
typedef struct PAINT_VERTEX_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct PAINT_VERTEX_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} PAINT_VERTEX_TextureList;
|
} PAINT_VERTEX_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct PAINT_VERTEX_StorageList {
|
typedef struct PAINT_VERTEX_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -257,9 +253,12 @@ void PAINT_VERTEX_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize PAINT_VERTEX_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_VERTEX_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_paint_vertex_type = {
|
DrawEngineType draw_engine_paint_vertex_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("PaintVertexMode"),
|
N_("PaintVertexMode"),
|
||||||
|
&PAINT_VERTEX_data_size,
|
||||||
&PAINT_VERTEX_engine_init,
|
&PAINT_VERTEX_engine_init,
|
||||||
&PAINT_VERTEX_engine_free,
|
&PAINT_VERTEX_engine_free,
|
||||||
&PAINT_VERTEX_cache_init,
|
&PAINT_VERTEX_cache_init,
|
||||||
|
@@ -46,7 +46,6 @@ extern struct GlobalsUboStorage ts; /* draw_common.c */
|
|||||||
* initialize most of them and PAINT_WEIGHT_cache_init()
|
* initialize most of them and PAINT_WEIGHT_cache_init()
|
||||||
* for PAINT_WEIGHT_PassList */
|
* for PAINT_WEIGHT_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct PAINT_WEIGHT_PassList {
|
typedef struct PAINT_WEIGHT_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* PAINT_WEIGHT_cache_init().
|
* PAINT_WEIGHT_cache_init().
|
||||||
@@ -54,14 +53,12 @@ typedef struct PAINT_WEIGHT_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} PAINT_WEIGHT_PassList;
|
} PAINT_WEIGHT_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct PAINT_WEIGHT_FramebufferList {
|
typedef struct PAINT_WEIGHT_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} PAINT_WEIGHT_FramebufferList;
|
} PAINT_WEIGHT_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct PAINT_WEIGHT_TextureList {
|
typedef struct PAINT_WEIGHT_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -69,7 +66,6 @@ typedef struct PAINT_WEIGHT_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} PAINT_WEIGHT_TextureList;
|
} PAINT_WEIGHT_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct PAINT_WEIGHT_StorageList {
|
typedef struct PAINT_WEIGHT_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -254,9 +250,12 @@ void PAINT_WEIGHT_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize PAINT_WEIGHT_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_WEIGHT_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_paint_weight_type = {
|
DrawEngineType draw_engine_paint_weight_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("PaintWeightMode"),
|
N_("PaintWeightMode"),
|
||||||
|
&PAINT_WEIGHT_data_size,
|
||||||
&PAINT_WEIGHT_engine_init,
|
&PAINT_WEIGHT_engine_init,
|
||||||
&PAINT_WEIGHT_engine_free,
|
&PAINT_WEIGHT_engine_free,
|
||||||
&PAINT_WEIGHT_cache_init,
|
&PAINT_WEIGHT_cache_init,
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
* initialize most of them and PARTICLE_cache_init()
|
* initialize most of them and PARTICLE_cache_init()
|
||||||
* for PARTICLE_PassList */
|
* for PARTICLE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct PARTICLE_PassList {
|
typedef struct PARTICLE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* PARTICLE_cache_init().
|
* PARTICLE_cache_init().
|
||||||
@@ -48,14 +47,12 @@ typedef struct PARTICLE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} PARTICLE_PassList;
|
} PARTICLE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct PARTICLE_FramebufferList {
|
typedef struct PARTICLE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} PARTICLE_FramebufferList;
|
} PARTICLE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct PARTICLE_TextureList {
|
typedef struct PARTICLE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -63,7 +60,6 @@ typedef struct PARTICLE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} PARTICLE_TextureList;
|
} PARTICLE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct PARTICLE_StorageList {
|
typedef struct PARTICLE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -252,9 +248,12 @@ void PARTICLE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize PARTICLE_data_size = DRW_VIEWPORT_DATA_SIZE(PARTICLE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_particle_type = {
|
DrawEngineType draw_engine_particle_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("ParticleMode"),
|
N_("ParticleMode"),
|
||||||
|
&PARTICLE_data_size,
|
||||||
&PARTICLE_engine_init,
|
&PARTICLE_engine_init,
|
||||||
&PARTICLE_engine_free,
|
&PARTICLE_engine_free,
|
||||||
&PARTICLE_cache_init,
|
&PARTICLE_cache_init,
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
* initialize most of them and POSE_cache_init()
|
* initialize most of them and POSE_cache_init()
|
||||||
* for POSE_PassList */
|
* for POSE_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct POSE_PassList {
|
typedef struct POSE_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* POSE_cache_init().
|
* POSE_cache_init().
|
||||||
@@ -48,14 +47,12 @@ typedef struct POSE_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} POSE_PassList;
|
} POSE_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct POSE_FramebufferList {
|
typedef struct POSE_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} POSE_FramebufferList;
|
} POSE_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct POSE_TextureList {
|
typedef struct POSE_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -63,7 +60,6 @@ typedef struct POSE_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} POSE_TextureList;
|
} POSE_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct POSE_StorageList {
|
typedef struct POSE_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -252,9 +248,12 @@ void POSE_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize POSE_data_size = DRW_VIEWPORT_DATA_SIZE(POSE_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_pose_type = {
|
DrawEngineType draw_engine_pose_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("PoseMode"),
|
N_("PoseMode"),
|
||||||
|
&POSE_data_size,
|
||||||
&POSE_engine_init,
|
&POSE_engine_init,
|
||||||
&POSE_engine_free,
|
&POSE_engine_free,
|
||||||
&POSE_cache_init,
|
&POSE_cache_init,
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
* initialize most of them and SCULPT_cache_init()
|
* initialize most of them and SCULPT_cache_init()
|
||||||
* for SCULPT_PassList */
|
* for SCULPT_PassList */
|
||||||
|
|
||||||
/* keep it under MAX_PASSES */
|
|
||||||
typedef struct SCULPT_PassList {
|
typedef struct SCULPT_PassList {
|
||||||
/* Declare all passes here and init them in
|
/* Declare all passes here and init them in
|
||||||
* SCULPT_cache_init().
|
* SCULPT_cache_init().
|
||||||
@@ -48,14 +47,12 @@ typedef struct SCULPT_PassList {
|
|||||||
struct DRWPass *pass;
|
struct DRWPass *pass;
|
||||||
} SCULPT_PassList;
|
} SCULPT_PassList;
|
||||||
|
|
||||||
/* keep it under MAX_BUFFERS */
|
|
||||||
typedef struct SCULPT_FramebufferList {
|
typedef struct SCULPT_FramebufferList {
|
||||||
/* Contains all framebuffer objects needed by this engine.
|
/* Contains all framebuffer objects needed by this engine.
|
||||||
* Only contains (GPUFrameBuffer *) */
|
* Only contains (GPUFrameBuffer *) */
|
||||||
struct GPUFrameBuffer *fb;
|
struct GPUFrameBuffer *fb;
|
||||||
} SCULPT_FramebufferList;
|
} SCULPT_FramebufferList;
|
||||||
|
|
||||||
/* keep it under MAX_TEXTURES */
|
|
||||||
typedef struct SCULPT_TextureList {
|
typedef struct SCULPT_TextureList {
|
||||||
/* Contains all framebuffer textures / utility textures
|
/* Contains all framebuffer textures / utility textures
|
||||||
* needed by this engine. Only viewport specific textures
|
* needed by this engine. Only viewport specific textures
|
||||||
@@ -63,7 +60,6 @@ typedef struct SCULPT_TextureList {
|
|||||||
struct GPUTexture *texture;
|
struct GPUTexture *texture;
|
||||||
} SCULPT_TextureList;
|
} SCULPT_TextureList;
|
||||||
|
|
||||||
/* keep it under MAX_STORAGE */
|
|
||||||
typedef struct SCULPT_StorageList {
|
typedef struct SCULPT_StorageList {
|
||||||
/* Contains any other memory block that the engine needs.
|
/* Contains any other memory block that the engine needs.
|
||||||
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
* Only directly MEM_(m/c)allocN'ed blocks because they are
|
||||||
@@ -251,9 +247,12 @@ void SCULPT_collection_settings_create(CollectionEngineSettings *ces)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DrawEngineDataSize SCULPT_data_size = DRW_VIEWPORT_DATA_SIZE(SCULPT_Data);
|
||||||
|
|
||||||
DrawEngineType draw_engine_sculpt_type = {
|
DrawEngineType draw_engine_sculpt_type = {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
N_("SculptMode"),
|
N_("SculptMode"),
|
||||||
|
&SCULPT_data_size,
|
||||||
&SCULPT_engine_init,
|
&SCULPT_engine_init,
|
||||||
&SCULPT_engine_free,
|
&SCULPT_engine_free,
|
||||||
&SCULPT_cache_init,
|
&SCULPT_cache_init,
|
||||||
|
@@ -41,26 +41,21 @@
|
|||||||
|
|
||||||
typedef struct GPUViewport GPUViewport;
|
typedef struct GPUViewport GPUViewport;
|
||||||
|
|
||||||
#define MAX_BUFFERS 8
|
|
||||||
#define MAX_TEXTURES 16
|
|
||||||
#define MAX_PASSES 16
|
|
||||||
#define MAX_STORAGE 9 /* extend if needed */
|
|
||||||
|
|
||||||
/* All FramebufferLists are just the same pointers with different names */
|
/* All FramebufferLists are just the same pointers with different names */
|
||||||
typedef struct FramebufferList {
|
typedef struct FramebufferList {
|
||||||
struct GPUFrameBuffer *framebuffers[MAX_BUFFERS];
|
struct GPUFrameBuffer *framebuffers[0];
|
||||||
} FramebufferList;
|
} FramebufferList;
|
||||||
|
|
||||||
typedef struct TextureList {
|
typedef struct TextureList {
|
||||||
struct GPUTexture *textures[MAX_TEXTURES];
|
struct GPUTexture *textures[0];
|
||||||
} TextureList;
|
} TextureList;
|
||||||
|
|
||||||
typedef struct PassList {
|
typedef struct PassList {
|
||||||
struct DRWPass *passes[MAX_PASSES];
|
struct DRWPass *passes[0];
|
||||||
} PassList;
|
} PassList;
|
||||||
|
|
||||||
typedef struct StorageList {
|
typedef struct StorageList {
|
||||||
void *storage[MAX_STORAGE]; /* custom structs from the engine */
|
void *storage[0]; /* custom structs from the engine */
|
||||||
} StorageList;
|
} StorageList;
|
||||||
|
|
||||||
typedef struct ViewportEngineData {
|
typedef struct ViewportEngineData {
|
||||||
@@ -78,6 +73,13 @@ typedef struct ViewportEngineData {
|
|||||||
double background_time;
|
double background_time;
|
||||||
} ViewportEngineData;
|
} ViewportEngineData;
|
||||||
|
|
||||||
|
typedef struct ViewportEngineData_Info {
|
||||||
|
int fbl_len;
|
||||||
|
int txl_len;
|
||||||
|
int psl_len;
|
||||||
|
int stl_len;
|
||||||
|
} ViewportEngineData_Info;
|
||||||
|
|
||||||
GPUViewport *GPU_viewport_create(void);
|
GPUViewport *GPU_viewport_create(void);
|
||||||
void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect);
|
void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect);
|
||||||
void GPU_viewport_unbind(GPUViewport *viewport);
|
void GPU_viewport_unbind(GPUViewport *viewport);
|
||||||
|
@@ -51,6 +51,9 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
static const int default_fbl_len = (sizeof(DefaultFramebufferList)) / sizeof(void *);
|
||||||
|
static const int default_txl_len = (sizeof(DefaultTextureList)) / sizeof(void *);
|
||||||
|
|
||||||
struct GPUViewport {
|
struct GPUViewport {
|
||||||
float pad[4];
|
float pad[4];
|
||||||
|
|
||||||
@@ -61,19 +64,20 @@ struct GPUViewport {
|
|||||||
ListBase data; /* ViewportEngineData wrapped in LinkData */
|
ListBase data; /* ViewportEngineData wrapped in LinkData */
|
||||||
unsigned int data_hash; /* If hash mismatch we free all ViewportEngineData in this viewport */
|
unsigned int data_hash; /* If hash mismatch we free all ViewportEngineData in this viewport */
|
||||||
|
|
||||||
FramebufferList *fbl;
|
DefaultFramebufferList *fbl;
|
||||||
TextureList *txl;
|
DefaultTextureList *txl;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void GPU_viewport_buffers_free(FramebufferList *fbl, TextureList *txl);
|
static void GPU_viewport_buffers_free(FramebufferList *fbl, int fbl_len, TextureList *txl, int txl_len);
|
||||||
static void GPU_viewport_storage_free(StorageList *stl);
|
static void GPU_viewport_storage_free(StorageList *stl, int stl_len);
|
||||||
static void GPU_viewport_passes_free(PassList *psl);
|
static void GPU_viewport_passes_free(PassList *psl, int psl_len);
|
||||||
|
|
||||||
GPUViewport *GPU_viewport_create(void)
|
GPUViewport *GPU_viewport_create(void)
|
||||||
{
|
{
|
||||||
GPUViewport *viewport = MEM_callocN(sizeof(GPUViewport), "GPUViewport");
|
GPUViewport *viewport = MEM_callocN(sizeof(GPUViewport), "GPUViewport");
|
||||||
viewport->fbl = MEM_callocN(sizeof(FramebufferList), "FramebufferList");
|
viewport->fbl = MEM_callocN(sizeof(DefaultFramebufferList), "FramebufferList");
|
||||||
viewport->txl = MEM_callocN(sizeof(TextureList), "TextureList");
|
viewport->txl = MEM_callocN(sizeof(DefaultTextureList), "TextureList");
|
||||||
|
|
||||||
viewport->size[0] = viewport->size[1] = -1;
|
viewport->size[0] = viewport->size[1] = -1;
|
||||||
|
|
||||||
return viewport;
|
return viewport;
|
||||||
@@ -83,12 +87,16 @@ void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type)
|
|||||||
{
|
{
|
||||||
LinkData *ld = MEM_callocN(sizeof(LinkData), "LinkData");
|
LinkData *ld = MEM_callocN(sizeof(LinkData), "LinkData");
|
||||||
ViewportEngineData *data = MEM_callocN(sizeof(ViewportEngineData), "ViewportEngineData");
|
ViewportEngineData *data = MEM_callocN(sizeof(ViewportEngineData), "ViewportEngineData");
|
||||||
|
int fbl_len, txl_len, psl_len, stl_len;
|
||||||
|
|
||||||
|
DRW_engine_viewport_data_size_get(engine_type, &fbl_len, &txl_len, &psl_len, &stl_len);
|
||||||
|
|
||||||
data->engine_type = engine_type;
|
data->engine_type = engine_type;
|
||||||
|
|
||||||
data->fbl = MEM_callocN(sizeof(FramebufferList), "FramebufferList");
|
data->fbl = MEM_callocN((sizeof(void *) * fbl_len) + sizeof(FramebufferList), "FramebufferList");
|
||||||
data->txl = MEM_callocN(sizeof(TextureList), "TextureList");
|
data->txl = MEM_callocN((sizeof(void *) * txl_len) + sizeof(TextureList), "TextureList");
|
||||||
data->psl = MEM_callocN(sizeof(PassList), "PassList");
|
data->psl = MEM_callocN((sizeof(void *) * psl_len) + sizeof(PassList), "PassList");
|
||||||
data->stl = MEM_callocN(sizeof(StorageList), "StorageList");
|
data->stl = MEM_callocN((sizeof(void *) * stl_len) + sizeof(StorageList), "StorageList");
|
||||||
|
|
||||||
ld->data = data;
|
ld->data = data;
|
||||||
BLI_addtail(&viewport->data, ld);
|
BLI_addtail(&viewport->data, ld);
|
||||||
@@ -98,14 +106,17 @@ void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type)
|
|||||||
|
|
||||||
static void GPU_viewport_engines_data_free(GPUViewport *viewport)
|
static void GPU_viewport_engines_data_free(GPUViewport *viewport)
|
||||||
{
|
{
|
||||||
|
int fbl_len, txl_len, psl_len, stl_len;
|
||||||
|
|
||||||
LinkData *next;
|
LinkData *next;
|
||||||
for (LinkData *link = viewport->data.first; link; link = next) {
|
for (LinkData *link = viewport->data.first; link; link = next) {
|
||||||
next = link->next;
|
next = link->next;
|
||||||
ViewportEngineData *data = link->data;
|
ViewportEngineData *data = link->data;
|
||||||
|
DRW_engine_viewport_data_size_get(data->engine_type, &fbl_len, &txl_len, &psl_len, &stl_len);
|
||||||
|
|
||||||
GPU_viewport_buffers_free(data->fbl, data->txl);
|
GPU_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
|
||||||
GPU_viewport_passes_free(data->psl);
|
GPU_viewport_passes_free(data->psl, psl_len);
|
||||||
GPU_viewport_storage_free(data->stl);
|
GPU_viewport_storage_free(data->stl, stl_len);
|
||||||
|
|
||||||
MEM_freeN(data->fbl);
|
MEM_freeN(data->fbl);
|
||||||
MEM_freeN(data->txl);
|
MEM_freeN(data->txl);
|
||||||
@@ -154,7 +165,9 @@ bool GPU_viewport_cache_validate(GPUViewport *viewport, unsigned int hash)
|
|||||||
if (G.debug_value != 666 && G.debug_value != 667) {
|
if (G.debug_value != 666 && G.debug_value != 667) {
|
||||||
for (LinkData *link = viewport->data.first; link; link = link->next) {
|
for (LinkData *link = viewport->data.first; link; link = link->next) {
|
||||||
ViewportEngineData *data = link->data;
|
ViewportEngineData *data = link->data;
|
||||||
GPU_viewport_passes_free(data->psl);
|
int psl_len;
|
||||||
|
DRW_engine_viewport_data_size_get(data->engine_type, NULL, NULL, &psl_len, NULL);
|
||||||
|
GPU_viewport_passes_free(data->psl, psl_len);
|
||||||
}
|
}
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
@@ -171,8 +184,9 @@ bool GPU_viewport_cache_validate(GPUViewport *viewport, unsigned int hash)
|
|||||||
|
|
||||||
void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
|
void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
|
||||||
{
|
{
|
||||||
DefaultFramebufferList *dfbl = (DefaultFramebufferList *)viewport->fbl;
|
DefaultFramebufferList *dfbl = viewport->fbl;
|
||||||
DefaultTextureList *dtxl = (DefaultTextureList *)viewport->txl;
|
DefaultTextureList *dtxl = viewport->txl;
|
||||||
|
int fbl_len, txl_len;
|
||||||
|
|
||||||
/* add one pixel because of scissor test */
|
/* add one pixel because of scissor test */
|
||||||
int rect_w = BLI_rcti_size_x(rect) + 1;
|
int rect_w = BLI_rcti_size_x(rect) + 1;
|
||||||
@@ -180,11 +194,14 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
|
|||||||
|
|
||||||
if (dfbl->default_fb) {
|
if (dfbl->default_fb) {
|
||||||
if (rect_w != viewport->size[0] || rect_h != viewport->size[1]) {
|
if (rect_w != viewport->size[0] || rect_h != viewport->size[1]) {
|
||||||
GPU_viewport_buffers_free(viewport->fbl, viewport->txl);
|
GPU_viewport_buffers_free(
|
||||||
|
(FramebufferList *)viewport->fbl, default_fbl_len,
|
||||||
|
(TextureList *)viewport->txl, default_txl_len);
|
||||||
|
|
||||||
for (LinkData *link = viewport->data.first; link; link = link->next) {
|
for (LinkData *link = viewport->data.first; link; link = link->next) {
|
||||||
ViewportEngineData *data = link->data;
|
ViewportEngineData *data = link->data;
|
||||||
GPU_viewport_buffers_free(data->fbl, data->txl);
|
DRW_engine_viewport_data_size_get(data->engine_type, &fbl_len, &txl_len, NULL, NULL);
|
||||||
|
GPU_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +260,7 @@ cleanup:
|
|||||||
|
|
||||||
static void draw_ofs_to_screen(GPUViewport *viewport)
|
static void draw_ofs_to_screen(GPUViewport *viewport)
|
||||||
{
|
{
|
||||||
DefaultTextureList *dtxl = (DefaultTextureList *)viewport->txl;
|
DefaultTextureList *dtxl = viewport->txl;
|
||||||
|
|
||||||
GPUTexture *color = dtxl->color;
|
GPUTexture *color = dtxl->color;
|
||||||
|
|
||||||
@@ -282,7 +299,7 @@ static void draw_ofs_to_screen(GPUViewport *viewport)
|
|||||||
|
|
||||||
void GPU_viewport_unbind(GPUViewport *viewport)
|
void GPU_viewport_unbind(GPUViewport *viewport)
|
||||||
{
|
{
|
||||||
DefaultFramebufferList *dfbl = (DefaultFramebufferList *)viewport->fbl;
|
DefaultFramebufferList *dfbl = viewport->fbl;
|
||||||
|
|
||||||
if (dfbl->default_fb) {
|
if (dfbl->default_fb) {
|
||||||
GPU_framebuffer_texture_unbind(dfbl->default_fb, NULL);
|
GPU_framebuffer_texture_unbind(dfbl->default_fb, NULL);
|
||||||
@@ -296,17 +313,18 @@ void GPU_viewport_unbind(GPUViewport *viewport)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GPU_viewport_buffers_free(FramebufferList *fbl, TextureList *txl)
|
static void GPU_viewport_buffers_free(
|
||||||
|
FramebufferList *fbl, int fbl_len,
|
||||||
|
TextureList *txl, int txl_len)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < fbl_len; i++) {
|
||||||
for (i = MAX_BUFFERS - 1; i > -1; --i) {
|
|
||||||
GPUFrameBuffer *fb = fbl->framebuffers[i];
|
GPUFrameBuffer *fb = fbl->framebuffers[i];
|
||||||
if (fb) {
|
if (fb) {
|
||||||
GPU_framebuffer_free(fb);
|
GPU_framebuffer_free(fb);
|
||||||
fbl->framebuffers[i] = NULL;
|
fbl->framebuffers[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = MAX_TEXTURES - 1; i > -1; --i) {
|
for (int i = 0; i < txl_len; i++) {
|
||||||
GPUTexture *tex = txl->textures[i];
|
GPUTexture *tex = txl->textures[i];
|
||||||
if (tex) {
|
if (tex) {
|
||||||
GPU_texture_free(tex);
|
GPU_texture_free(tex);
|
||||||
@@ -315,9 +333,9 @@ static void GPU_viewport_buffers_free(FramebufferList *fbl, TextureList *txl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GPU_viewport_storage_free(StorageList *stl)
|
static void GPU_viewport_storage_free(StorageList *stl, int stl_len)
|
||||||
{
|
{
|
||||||
for (int i = MAX_STORAGE - 1; i > -1; --i) {
|
for (int i = 0; i < stl_len; i++) {
|
||||||
void *storage = stl->storage[i];
|
void *storage = stl->storage[i];
|
||||||
if (storage) {
|
if (storage) {
|
||||||
MEM_freeN(storage);
|
MEM_freeN(storage);
|
||||||
@@ -326,9 +344,9 @@ static void GPU_viewport_storage_free(StorageList *stl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GPU_viewport_passes_free(PassList *psl)
|
static void GPU_viewport_passes_free(PassList *psl, int psl_len)
|
||||||
{
|
{
|
||||||
for (int i = MAX_PASSES - 1; i > -1; --i) {
|
for (int i = 0; i < psl_len; i++) {
|
||||||
struct DRWPass *pass = psl->passes[i];
|
struct DRWPass *pass = psl->passes[i];
|
||||||
if (pass) {
|
if (pass) {
|
||||||
DRW_pass_free(pass);
|
DRW_pass_free(pass);
|
||||||
@@ -342,7 +360,10 @@ void GPU_viewport_free(GPUViewport *viewport)
|
|||||||
{
|
{
|
||||||
GPU_viewport_engines_data_free(viewport);
|
GPU_viewport_engines_data_free(viewport);
|
||||||
|
|
||||||
GPU_viewport_buffers_free(viewport->fbl, viewport->txl);
|
GPU_viewport_buffers_free(
|
||||||
|
(FramebufferList *)viewport->fbl, default_fbl_len,
|
||||||
|
(TextureList *)viewport->txl, default_txl_len);
|
||||||
|
|
||||||
MEM_freeN(viewport->fbl);
|
MEM_freeN(viewport->fbl);
|
||||||
MEM_freeN(viewport->txl);
|
MEM_freeN(viewport->txl);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user