DRW: Add debug utility for batch cache requests

This commit is contained in:
Clément Foucault 2019-04-30 12:50:17 +02:00
parent 782917648f
commit e8daa61570
Notes: blender-bot 2023-02-14 02:50:19 +01:00
Referenced by issue #64611, Bone Size property is not copied when a bone is copied.
Referenced by issue #64612, Pose Bone data is lost when undoing an Edit Bone deletion.
Referenced by issue #64091, Crash when changing BBone scale in pose mode.
3 changed files with 29 additions and 4 deletions

View File

@ -205,10 +205,19 @@ struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(struct Object *ob
struct PTCacheEdit *edit);
/* Common */
#define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) \
(flag |= DRW_vbo_requested(vbo) ? (value) : 0)
#define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) \
(flag |= DRW_ibo_requested(ibo) ? (value) : 0)
// #define DRW_DEBUG_MESH_CACHE_REQUEST
#ifdef DRW_DEBUG_MESH_CACHE_REQUEST
# define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) \
(flag |= DRW_vbo_requested(vbo) ? (printf(" VBO requested " #vbo "\n") ? value : value) : 0)
# define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) \
(flag |= DRW_ibo_requested(ibo) ? (printf(" IBO requested " #ibo "\n") ? value : value) : 0)
#else
# define DRW_ADD_FLAG_FROM_VBO_REQUEST(flag, vbo, value) \
(flag |= DRW_vbo_requested(vbo) ? (value) : 0)
# define DRW_ADD_FLAG_FROM_IBO_REQUEST(flag, ibo, value) \
(flag |= DRW_ibo_requested(ibo) ? (value) : 0)
#endif
/* Test and assign NULL if test fails */
#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL))

View File

@ -988,6 +988,10 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
}
}
#ifdef DRW_DEBUG_MESH_CACHE_REQUEST
printf("-- %s %s --\n", __func__, ob->id.name + 2);
#endif
/* Generate MeshRenderData flags */
int mr_flag = 0;
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.pos_nor, CU_DATATYPE_SURFACE);
@ -1011,6 +1015,10 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->surf_per_mat_tris[i], CU_DATATYPE_SURFACE);
}
#ifdef DRW_DEBUG_MESH_CACHE_REQUEST
printf(" mr_flag %d\n\n", mr_flag);
#endif
CurveRenderData *rdata = curve_render_data_create(cu, ob->runtime.curve_cache, mr_flag);
/* DispLists */

View File

@ -5112,6 +5112,10 @@ void DRW_mesh_batch_cache_create_requested(
return;
}
#ifdef DRW_DEBUG_MESH_CACHE_REQUEST
printf("-- %s %s --\n", __func__, ob->id.name + 2);
#endif
/* Generate MeshRenderData flags */
eMRDataType mr_flag = 0, mr_edit_flag = 0;
DRW_ADD_FLAG_FROM_VBO_REQUEST(
@ -5198,6 +5202,10 @@ void DRW_mesh_batch_cache_create_requested(
Mesh *me_original = me;
MBC_GET_FINAL_MESH(me);
#ifdef DRW_DEBUG_MESH_CACHE_REQUEST
printf(" mr_flag %u, mr_edit_flag %u\n\n", mr_flag, mr_edit_flag);
#endif
if (me_original == me) {
mr_flag |= mr_edit_flag;
}