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/depsgraph/intern | |
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/depsgraph/intern')
4 files changed, 37 insertions, 11 deletions
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. |