From 3401b070b8d06446449b67b3088dfbc8e507c9b8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 24 Jan 2020 10:55:39 +0100 Subject: Depsgraph: Refactor, wrap debug fields into own structure --- source/blender/depsgraph/intern/depsgraph.cc | 2 +- source/blender/depsgraph/intern/depsgraph.h | 11 ++++++++--- source/blender/depsgraph/intern/depsgraph_debug.cc | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 292c3b361d8..190ff4e929f 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -82,7 +82,7 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati 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; + debug.flags = G.debug; memset(id_type_updated, 0, sizeof(id_type_updated)); memset(id_type_exist, 0, sizeof(id_type_exist)); memset(physics_relations, 0, sizeof(physics_relations)); diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h index 43829f4e045..71603334530 100644 --- a/source/blender/depsgraph/intern/depsgraph.h +++ b/source/blender/depsgraph/intern/depsgraph.h @@ -194,9 +194,14 @@ struct Depsgraph { * to read stuff from. */ bool is_active; - /* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */ - int debug_flags; - string debug_name; + struct { + /* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */ + int flags; + + /* Name of this dependency graph (is used for debug prints, helping to distinguish graphs + * created for different view layer). */ + string name; + } debug; bool is_evaluating; diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc index bb60db5209c..51267491458 100644 --- a/source/blender/depsgraph/intern/depsgraph_debug.cc +++ b/source/blender/depsgraph/intern/depsgraph_debug.cc @@ -47,25 +47,25 @@ extern "C" { void DEG_debug_flags_set(Depsgraph *depsgraph, int flags) { DEG::Depsgraph *deg_graph = reinterpret_cast(depsgraph); - deg_graph->debug_flags = flags; + deg_graph->debug.flags = flags; } int DEG_debug_flags_get(const Depsgraph *depsgraph) { const DEG::Depsgraph *deg_graph = reinterpret_cast(depsgraph); - return deg_graph->debug_flags; + return deg_graph->debug.flags; } void DEG_debug_name_set(struct Depsgraph *depsgraph, const char *name) { DEG::Depsgraph *deg_graph = reinterpret_cast(depsgraph); - deg_graph->debug_name = name; + deg_graph->debug.name = name; } const char *DEG_debug_name_get(struct Depsgraph *depsgraph) { const DEG::Depsgraph *deg_graph = reinterpret_cast(depsgraph); - return deg_graph->debug_name.c_str(); + return deg_graph->debug.name.c_str(); } bool DEG_debug_compare(const struct Depsgraph *graph1, const struct Depsgraph *graph2) -- cgit v1.2.3