diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-02 12:46:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-02 18:09:44 +0300 |
commit | 65e6654c85a5b2fd44444057e87bd36d6ee0597a (patch) | |
tree | 15399f3ecb648f3ce99b93b17317a8a7e838c730 /source/blender | |
parent | 2f4dea0ef987abe0e2c11ed01df1645a59c58a74 (diff) |
Depsgraph: Allow per-depsgraph debug flags
Currently only affects EVALUATION debug messages, rest are to be
supported on per-depsgraph level.
Diffstat (limited to 'source/blender')
19 files changed, 110 insertions, 75 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 2f2193db51b..4eeabd7a4da 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2949,7 +2949,7 @@ void BKE_animsys_eval_animdata(Depsgraph *depsgraph, ID *id) Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates, * which should get handled as part of the dependency graph instead... */ - DEG_debug_print_eval_time(__func__, id->name, id, ctime); + DEG_debug_print_eval_time(depsgraph, __func__, id->name, id, ctime); short recalc = ADT_RECALC_ANIM; const Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); /* If animation component is directly tagged for update, we always apply f-curves. */ @@ -2991,7 +2991,7 @@ void BKE_animsys_eval_driver(Depsgraph *depsgraph, fcu = find_driver_from_evaluated_id(id, fcu); DEG_debug_print_eval_subdata_index( - __func__, id->name, id, "fcu", fcu->rna_path, fcu, fcu->array_index); + depsgraph, __func__, id->name, id, "fcu", fcu->rna_path, fcu, fcu->array_index); RNA_id_pointer_create(id, &id_ptr); diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index e626ed42062..bf21019a948 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -567,14 +567,14 @@ BLI_INLINE bPoseChannel *pose_pchan_get_indexed(Object *ob, int pchan_index) return pose->chan_array[pchan_index]; } -void BKE_pose_eval_init(struct Depsgraph *UNUSED(depsgraph), +void BKE_pose_eval_init(struct Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob) { bPose *pose = ob->pose; BLI_assert(pose != NULL); - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); @@ -601,7 +601,7 @@ void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -624,7 +624,7 @@ void BKE_pose_eval_bone(struct Depsgraph *depsgraph, { bPoseChannel *pchan = pose_pchan_get_indexed(ob, pchan_index); DEG_debug_print_eval_subdata( - __func__, ob->id.name, ob, "pchan", pchan->name, pchan); + depsgraph, __func__, ob->id.name, ob, "pchan", pchan->name, pchan); BLI_assert(ob->type == OB_ARMATURE); bArmature *arm = (bArmature *)ob->data; if (arm->edbo || (arm->flag & ARM_RESTPOS)) { @@ -661,7 +661,7 @@ void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph, { bPoseChannel *pchan = pose_pchan_get_indexed(ob, pchan_index); DEG_debug_print_eval_subdata( - __func__, ob->id.name, ob, "pchan", pchan->name, pchan); + depsgraph, __func__, ob->id.name, ob, "pchan", pchan->name, pchan); bArmature *arm = (bArmature *)ob->data; if (arm->flag & ARM_RESTPOS) { return; @@ -677,13 +677,13 @@ void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph, } } -void BKE_pose_bone_done(struct Depsgraph *UNUSED(depsgraph), +void BKE_pose_bone_done(struct Depsgraph *depsgraph, struct Object *ob, int pchan_index) { bPoseChannel *pchan = pose_pchan_get_indexed(ob, pchan_index); float imat[4][4]; - DEG_debug_print_eval(__func__, pchan->name, pchan); + DEG_debug_print_eval(depsgraph, __func__, pchan->name, pchan); if (pchan->bone) { invert_m4_m4(imat, pchan->bone->arm_mat); mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat); @@ -697,7 +697,7 @@ void BKE_pose_iktree_evaluate(struct Depsgraph *depsgraph, { bPoseChannel *rootchan = pose_pchan_get_indexed(ob, rootchan_index); DEG_debug_print_eval_subdata( - __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); + depsgraph, __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -715,7 +715,7 @@ void BKE_pose_splineik_evaluate(struct Depsgraph *depsgraph, { bPoseChannel *rootchan = pose_pchan_get_indexed(ob, rootchan_index); DEG_debug_print_eval_subdata( - __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); + depsgraph, __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -725,7 +725,7 @@ void BKE_pose_splineik_evaluate(struct Depsgraph *depsgraph, BKE_splineik_execute_tree(depsgraph, scene, ob, rootchan, ctime); } -void BKE_pose_eval_flush(struct Depsgraph *UNUSED(depsgraph), +void BKE_pose_eval_flush(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -733,7 +733,7 @@ void BKE_pose_eval_flush(struct Depsgraph *UNUSED(depsgraph), BLI_assert(pose != NULL); float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); /* release the IK tree */ @@ -744,10 +744,10 @@ void BKE_pose_eval_flush(struct Depsgraph *UNUSED(depsgraph), pose->chan_array = NULL; } -void BKE_pose_eval_proxy_copy(struct Depsgraph *UNUSED(depsgraph), Object *ob) +void BKE_pose_eval_proxy_copy(struct Depsgraph *depsgraph, Object *ob) { BLI_assert(ID_IS_LINKED(ob) && ob->proxy_from != NULL); - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) { printf("Proxy copy error, lib Object: %s proxy Object: %s\n", ob->id.name + 2, ob->proxy_from->id.name + 2); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 661ffdbcd27..cea5685a7a1 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -5255,10 +5255,10 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *t /* **** Depsgraph evaluation **** */ -void BKE_curve_eval_geometry(Depsgraph *UNUSED(depsgraph), +void BKE_curve_eval_geometry(Depsgraph *depsgraph, Curve *curve) { - DEG_debug_print_eval(__func__, curve->id.name, curve); + DEG_debug_print_eval(depsgraph, __func__, curve->id.name, curve); if (curve->bb == NULL || (curve->bb->flag & BOUNDBOX_DIRTY)) { BKE_curve_texspace_calc(curve); } diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index ae031d21b88..f2c9bfdd974 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -384,6 +384,6 @@ void BKE_group_handle_recalc_and_update(struct Depsgraph *depsgraph, Scene *scen void BKE_group_eval_view_layers(struct Depsgraph *depsgraph, Group *group) { - DEG_debug_print_eval(__func__, group->id.name, group); + DEG_debug_print_eval(depsgraph, __func__, group->id.name, group); BKE_layer_eval_view_layer(depsgraph, &group->id, group->view_layer); } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 215826454a9..9ab318bc58d 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -54,6 +54,7 @@ #include "DNA_workspace_types.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_debug.h" #include "DEG_depsgraph_query.h" #include "DRW_engine.h" @@ -2369,9 +2370,9 @@ static void idproperty_reset(IDProperty **props, IDProperty *props_ref) } } -static void layer_eval_layer_collection_pre(ID *owner_id, ViewLayer *view_layer) +static void layer_eval_layer_collection_pre(Depsgraph *depsgraph, ID *owner_id, ViewLayer *view_layer) { - DEG_debug_print_eval(__func__, view_layer->name, view_layer); + DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer); Scene *scene = (GS(owner_id->name) == ID_SCE) ? (Scene *)owner_id : NULL; for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) { @@ -2415,7 +2416,7 @@ static void layer_eval_layer_collection(Depsgraph *depsgraph, LayerCollection *layer_collection, LayerCollection *parent_layer_collection) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { + if (DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) { /* TODO)sergey): Try to make it more generic and handled by depsgraph messaging. */ printf("%s on %s (%p) [%s], parent %s (%p) [%s]\n", __func__, @@ -2471,9 +2472,9 @@ static void layer_eval_layer_collection(Depsgraph *depsgraph, } } -static void layer_eval_layer_collection_post(ViewLayer *view_layer) +static void layer_eval_layer_collection_post(Depsgraph *depsgraph, ViewLayer *view_layer) { - DEG_debug_print_eval(__func__, view_layer->name, view_layer); + DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer); /* Create array of bases, for fast index-based lookup. */ const int num_object_bases = BLI_listbase_count(&view_layer->object_bases); MEM_SAFE_FREE(view_layer->object_bases_array); @@ -2511,11 +2512,11 @@ void BKE_layer_eval_view_layer(struct Depsgraph *depsgraph, struct ID *owner_id, ViewLayer *view_layer) { - layer_eval_layer_collection_pre(owner_id, view_layer); + layer_eval_layer_collection_pre(depsgraph, owner_id, view_layer); layer_eval_collections_recurse(depsgraph, &view_layer->layer_collections, NULL); - layer_eval_layer_collection_post(view_layer); + layer_eval_layer_collection_post(depsgraph, view_layer); } void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 651bcddc84a..55939f8eadf 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -901,7 +901,7 @@ void BKE_mask_layer_evaluate_deform(MaskLayer *masklay, const float ctime) void BKE_mask_eval_animation(struct Depsgraph *depsgraph, Mask *mask) { float ctime = DEG_get_ctime(depsgraph); - DEG_debug_print_eval(__func__, mask->id.name, mask); + DEG_debug_print_eval(depsgraph, __func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) @@ -913,7 +913,7 @@ void BKE_mask_eval_animation(struct Depsgraph *depsgraph, Mask *mask) void BKE_mask_eval_update(struct Depsgraph *depsgraph, Mask *mask) { float ctime = DEG_get_ctime(depsgraph); - DEG_debug_print_eval(__func__, mask->id.name, mask); + DEG_debug_print_eval(depsgraph, __func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 2f2f2fb3599..725a7b07194 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1309,9 +1309,9 @@ void paste_matcopybuf(Material *ma) ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, G.main, false); } -void BKE_material_eval(struct Depsgraph *UNUSED(depsgraph), Material *material) +void BKE_material_eval(struct Depsgraph *depsgraph, Material *material) { - DEG_debug_print_eval(__func__, material->id.name, material); + DEG_debug_print_eval(depsgraph, __func__, material->id.name, material); if ((BLI_listbase_is_empty(&material->gpumaterial) == false)) { GPU_material_uniform_buffer_tag_dirty(&material->gpumaterial); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 184e6af7abc..9bd1b587abd 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2747,10 +2747,10 @@ Mesh *BKE_mesh_new_from_object( /* **** Depsgraph evaluation **** */ -void BKE_mesh_eval_geometry(Depsgraph *UNUSED(depsgraph), +void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh) { - DEG_debug_print_eval(__func__, mesh->id.name, mesh); + DEG_debug_print_eval(depsgraph, __func__, mesh->id.name, mesh); if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) { BKE_mesh_texspace_calc(mesh); } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 36a5a60635a..d742bcea69d 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1609,8 +1609,8 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip, return result; } -void BKE_movieclip_eval_update(struct Depsgraph *UNUSED(depsgraph), MovieClip *clip) +void BKE_movieclip_eval_update(struct Depsgraph *depsgraph, MovieClip *clip) { - DEG_debug_print_eval(__func__, clip->id.name, clip); + DEG_debug_print_eval(depsgraph, __func__, clip->id.name, clip); BKE_tracking_dopesheet_tag_update(&clip->tracking); } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index b209b96e3fb..f3fd8b69b2c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3765,10 +3765,10 @@ void BKE_nodetree_copy_default_values(bNodeTree *ntree_dst, } } -void BKE_nodetree_shading_params_eval(struct Depsgraph *UNUSED(depsgraph), +void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph, bNodeTree *ntree_dst, const bNodeTree *ntree_src) { - DEG_debug_print_eval(__func__, ntree_src->id.name, ntree_dst); + DEG_debug_print_eval(depsgraph, __func__, ntree_src->id.name, ntree_dst); BKE_nodetree_copy_default_values(ntree_dst, ntree_src); } diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index c8612c1d55c..e3d42f3ad60 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -68,10 +68,9 @@ #include "DEG_depsgraph_query.h" -void BKE_object_eval_local_transform(Depsgraph *UNUSED(depsgraph), - Object *ob) +void BKE_object_eval_local_transform(Depsgraph *depsgraph, Object *ob) { - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* calculate local matrix */ BKE_object_to_mat4(ob, ob->obmat); @@ -79,7 +78,7 @@ void BKE_object_eval_local_transform(Depsgraph *UNUSED(depsgraph), /* Evaluate parent */ /* NOTE: based on solve_parenting(), but with the cruft stripped out */ -void BKE_object_eval_parent(Depsgraph *UNUSED(depsgraph), +void BKE_object_eval_parent(Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -89,7 +88,7 @@ void BKE_object_eval_parent(Depsgraph *UNUSED(depsgraph), float tmat[4][4]; float locmat[4][4]; - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* get local matrix (but don't calculate it, as that was done already!) */ // XXX: redundant? @@ -118,7 +117,7 @@ void BKE_object_eval_constraints(Depsgraph *depsgraph, bConstraintOb *cob; float ctime = BKE_scene_frame_get(scene); - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* evaluate constraints stack */ /* TODO: split this into: @@ -134,9 +133,9 @@ void BKE_object_eval_constraints(Depsgraph *depsgraph, BKE_constraints_clear_evalob(cob); } -void BKE_object_eval_done(Depsgraph *UNUSED(depsgraph), Object *ob) +void BKE_object_eval_done(Depsgraph *depsgraph, Object *ob) { - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* Set negative scale flag in object. */ if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; @@ -315,7 +314,7 @@ void BKE_object_eval_uber_data(Depsgraph *depsgraph, Scene *scene, Object *ob) { - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); BLI_assert(ob->type != OB_ARMATURE); BKE_object_handle_data_update(depsgraph, scene, ob); @@ -389,11 +388,11 @@ void BKE_object_eval_uber_data(Depsgraph *depsgraph, } } -void BKE_object_eval_cloth(Depsgraph *UNUSED(depsgraph), +void BKE_object_eval_cloth(Depsgraph *depsgraph, Scene *scene, Object *object) { - DEG_debug_print_eval(__func__, object->id.name, object); + DEG_debug_print_eval(depsgraph, __func__, object->id.name, object); BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH); } @@ -413,19 +412,17 @@ void BKE_object_eval_transform_all(Depsgraph *depsgraph, BKE_object_eval_done(depsgraph, object); } -void BKE_object_eval_update_shading(Depsgraph *UNUSED(depsgraph), - Object *object) +void BKE_object_eval_update_shading(Depsgraph *depsgraph, Object *object) { - DEG_debug_print_eval(__func__, object->id.name, object); + DEG_debug_print_eval(depsgraph, __func__, object->id.name, object); if (object->type == OB_MESH) { BKE_mesh_batch_cache_dirty(object->data, BKE_MESH_BATCH_DIRTY_SHADING); } } -void BKE_object_data_select_update(Depsgraph *UNUSED(depsgraph), - struct ID *object_data) +void BKE_object_data_select_update(Depsgraph *depsgraph, ID *object_data) { - DEG_debug_print_eval(__func__, object_data->name, object_data); + DEG_debug_print_eval(depsgraph, __func__, object_data->name, object_data); switch (GS(object_data->name)) { case ID_ME: BKE_mesh_batch_cache_dirty((Mesh *)object_data, @@ -444,7 +441,7 @@ void BKE_object_data_select_update(Depsgraph *UNUSED(depsgraph), } } -void BKE_object_eval_flush_base_flags(Depsgraph *UNUSED(depsgraph), +void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph, Scene *scene, const int view_layer_index, Object *object, int base_index, const bool is_from_set) @@ -459,7 +456,7 @@ void BKE_object_eval_flush_base_flags(Depsgraph *UNUSED(depsgraph), Base *base = view_layer->object_bases_array[base_index]; BLI_assert(base->object == object); - DEG_debug_print_eval(__func__, object->id.name, object); + DEG_debug_print_eval(depsgraph, __func__, object->id.name, object); /* Make sure we have the base collection settings is already populated. * This will fail when BKE_layer_eval_layer_collection_pre hasn't run yet. diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index af1fa74b25f..ab307ebdbe8 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4432,11 +4432,11 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, /* **** Depsgraph evaluation **** */ -void BKE_particle_system_eval_init(struct Depsgraph *UNUSED(depsgraph), +void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { - DEG_debug_print_eval(__func__, ob->id.name, ob); + DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); for (ParticleSystem *psys = ob->particlesystem.first; psys != NULL; psys = psys->next) diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index fdeba7186e8..1c16d57ab12 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1696,7 +1696,7 @@ void BKE_rigidbody_rebuild_sim(struct Depsgraph *depsgraph, Scene *scene) { float ctime = BKE_scene_frame_get(scene); - DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); + DEG_debug_print_eval_time(depsgraph, __func__, scene->id.name, scene, ctime); /* rebuild sim data (i.e. after resetting to start of timeline) */ if (BKE_scene_check_rigidbody_active(scene)) { BKE_rigidbody_rebuild_world(depsgraph, scene, ctime); @@ -1707,20 +1707,20 @@ void BKE_rigidbody_eval_simulation(struct Depsgraph *depsgraph, Scene *scene) { float ctime = BKE_scene_frame_get(scene); - DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); + DEG_debug_print_eval_time(depsgraph, __func__, scene->id.name, scene, ctime); /* evaluate rigidbody sim */ if (BKE_scene_check_rigidbody_active(scene)) { BKE_rigidbody_do_simulation(depsgraph, scene, ctime); } } -void BKE_rigidbody_object_sync_transforms(struct Depsgraph *UNUSED(depsgraph), +void BKE_rigidbody_object_sync_transforms(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { RigidBodyWorld *rbw = scene->rigidbody_world; float ctime = BKE_scene_frame_get(scene); - DEG_debug_print_eval_time(__func__, ob->id.name, ob, ctime); + DEG_debug_print_eval_time(depsgraph, __func__, ob->id.name, ob, ctime); /* read values pushed into RBO from sim/cache... */ BKE_rigidbody_sync_transforms(rbw, ob, ctime); } diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index a158279a9d1..5fffd8d7fcf 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -234,18 +234,21 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, /* Evaluation Debug ------------------------------ */ -void DEG_debug_print_eval(const char* function_name, +void DEG_debug_print_eval(struct Depsgraph *depsgraph, + const char* function_name, const char* object_name, const void* object_address); -void DEG_debug_print_eval_subdata(const char *function_name, +void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address, const char *subdata_comment, const char *subdata_name, const void *subdata_address); -void DEG_debug_print_eval_subdata_index(const char *function_name, +void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address, const char *subdata_comment, @@ -253,7 +256,8 @@ void DEG_debug_print_eval_subdata_index(const char *function_name, const void *subdata_address, const int subdata_index); -void DEG_debug_print_eval_time(const char* function_name, +void DEG_debug_print_eval_time(struct Depsgraph *depsgraph, + const char* function_name, const char* object_name, const void* object_address, float time); diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h index 363749dab26..2f4cfc86955 100644 --- a/source/blender/depsgraph/DEG_depsgraph_debug.h +++ b/source/blender/depsgraph/DEG_depsgraph_debug.h @@ -45,6 +45,13 @@ struct ViewLayer; /* ------------------------------------------------ */ +/* NOTE: Those flags are same bitmask as G.debug_flags */ + +void DEG_set_debug_flags(struct Depsgraph *depsgraph, int flags); +int DEG_get_debug_flags(const struct Depsgraph *depsgraph); + +/* ------------------------------------------------ */ + void DEG_stats_simple(const struct Depsgraph *graph, size_t *r_outer, size_t *r_operations, diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index a4aff826af4..36de325daf0 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -57,6 +57,7 @@ extern "C" { #include <cstring> #include "DEG_depsgraph.h" +#include "DEG_depsgraph_debug.h" #include "intern/eval/deg_eval_copy_on_write.h" @@ -108,6 +109,7 @@ Depsgraph::Depsgraph(Scene *scene, BLI_spin_init(&lock); id_hash = BLI_ghash_ptr_new("Depsgraph id hash"); entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags"); + debug_flags = G.debug; } Depsgraph::~Depsgraph() @@ -600,11 +602,12 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, /* Evaluation and debug */ -void DEG_debug_print_eval(const char *function_name, +void DEG_debug_print_eval(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address) { - if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + if ((DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } fprintf(stdout, @@ -617,14 +620,15 @@ void DEG_debug_print_eval(const char *function_name, fflush(stdout); } -void DEG_debug_print_eval_subdata(const char *function_name, +void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address, const char *subdata_comment, const char *subdata_name, const void *subdata_address) { - if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + if ((DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } fprintf(stdout, @@ -642,7 +646,8 @@ void DEG_debug_print_eval_subdata(const char *function_name, fflush(stdout); } -void DEG_debug_print_eval_subdata_index(const char *function_name, +void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address, const char *subdata_comment, @@ -650,7 +655,7 @@ void DEG_debug_print_eval_subdata_index(const char *function_name, const void *subdata_address, const int subdata_index) { - if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + if ((DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } fprintf(stdout, @@ -669,12 +674,13 @@ void DEG_debug_print_eval_subdata_index(const char *function_name, fflush(stdout); } -void DEG_debug_print_eval_time(const char *function_name, +void DEG_debug_print_eval_time(struct Depsgraph *depsgraph, + const char *function_name, const char *object_name, const void *object_address, float time) { - if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + if ((DEG_get_debug_flags(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) { return; } fprintf(stdout, diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h index 284dc28031b..9c61b9a1fc6 100644 --- a/source/blender/depsgraph/intern/depsgraph.h +++ b/source/blender/depsgraph/intern/depsgraph.h @@ -202,6 +202,9 @@ struct Depsgraph { * Stored here to save us form doing hash lookup. */ Scene *scene_cow; + + /* NITE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */ + int debug_flags; }; } // namespace DEG diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc index 78b1c6f88c5..4e8d684f697 100644 --- a/source/blender/depsgraph/intern/depsgraph_debug.cc +++ b/source/blender/depsgraph/intern/depsgraph_debug.cc @@ -50,6 +50,20 @@ extern "C" { #include "util/deg_util_foreach.h" +void DEG_set_debug_flags(Depsgraph *depsgraph, int flags) +{ + DEG::Depsgraph *deg_graph = + reinterpret_cast<DEG::Depsgraph *>(depsgraph); + deg_graph->debug_flags = flags; +} + +int DEG_get_debug_flags(const Depsgraph *depsgraph) +{ + const DEG::Depsgraph *deg_graph = + reinterpret_cast<const DEG::Depsgraph *>(depsgraph); + return deg_graph->debug_flags; +} + bool DEG_debug_compare(const struct Depsgraph *graph1, const struct Depsgraph *graph2) { diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 53d8319a8f0..2c6186a4fe5 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -578,10 +578,13 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph, create_placeholders); } -static void deg_update_copy_on_write_animation(const Depsgraph * /*depsgraph*/, +static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph, const IDDepsNode *id_node) { - DEG_debug_print_eval(__func__, id_node->id_orig->name, id_node->id_cow); + DEG_debug_print_eval((::Depsgraph *)depsgraph, + __func__, + id_node->id_orig->name, + id_node->id_cow); BKE_animdata_copy_id(NULL, id_node->id_cow, id_node->id_orig, false, false); } @@ -774,7 +777,7 @@ void deg_evaluate_copy_on_write(struct ::Depsgraph *graph, const IDDepsNode *id_node) { const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph); - DEG_debug_print_eval(__func__, id_node->id_orig->name, id_node->id_cow); + DEG_debug_print_eval(graph, __func__, id_node->id_orig->name, id_node->id_cow); if (id_node->id_orig == &depsgraph->scene->id) { /* NOTE: This is handled by eval_ctx setup routines, which * ensures scene and view layer pointers are valid. |