From 93b2871cf5c4a3c5346d9861c01b011021b7384d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Dec 2017 17:54:52 +0100 Subject: Depsgraph: Remove node class stored in both type info and node This is something deliver form node type, there is no reason to try cache it anywhere, especially since it's not used in any performance critical code. Lighter weight dependency graph is what we want. --- .../depsgraph/intern/debug/deg_debug_graphviz.cc | 14 +++++----- source/blender/depsgraph/intern/depsgraph_intern.h | 3 --- source/blender/depsgraph/intern/nodes/deg_node.cc | 6 ----- source/blender/depsgraph/intern/nodes/deg_node.h | 31 +++++++++++----------- 4 files changed, 23 insertions(+), 31 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc index 159e9bcf9a7..6d8fda97321 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc @@ -115,7 +115,7 @@ static int deg_debug_node_color_index(const DepsNode *node) break; } /* Do others based on class. */ - switch (node->tclass) { + switch (node->get_class()) { case DEG_NODE_CLASS_OPERATION: return 4; case DEG_NODE_CLASS_COMPONENT: @@ -202,7 +202,7 @@ static void deg_debug_graphviz_node_color(const DebugContext &ctx, const char *color_update = "dodgerblue3"; const char *color = color_default; if (ctx.show_tags) { - if (node->tclass == DEG_NODE_CLASS_OPERATION) { + if (node->get_class() == DEG_NODE_CLASS_OPERATION) { OperationDepsNode *op_node = (OperationDepsNode *)node; if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) { color = color_modified; @@ -223,7 +223,7 @@ static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx, float penwidth_update = 4.0f; float penwidth = penwidth_default; if (ctx.show_tags) { - if (node->tclass == DEG_NODE_CLASS_OPERATION) { + if (node->get_class() == DEG_NODE_CLASS_OPERATION) { OperationDepsNode *op_node = (OperationDepsNode *)node; if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) { penwidth = penwidth_modified; @@ -261,14 +261,14 @@ static void deg_debug_graphviz_node_style(const DebugContext &ctx, const DepsNod { const char *base_style = "filled"; /* default style */ if (ctx.show_tags) { - if (node->tclass == DEG_NODE_CLASS_OPERATION) { + if (node->get_class() == DEG_NODE_CLASS_OPERATION) { OperationDepsNode *op_node = (OperationDepsNode *)node; if (op_node->flag & (DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE)) { base_style = "striped"; } } } - switch (node->tclass) { + switch (node->get_class()) { case DEG_NODE_CLASS_GENERIC: deg_debug_fprintf(ctx, "\"%s\"", base_style); break; @@ -293,7 +293,7 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx, BLI_snprintf(buf, sizeof(buf), " (Layers: %u)", id_node->layers); name += buf; } - if (ctx.show_eval_priority && node->tclass == DEG_NODE_CLASS_OPERATION) { + if (ctx.show_eval_priority && node->get_class() == DEG_NODE_CLASS_OPERATION) { priority = ((OperationDepsNode *)node)->eval_priority; } deg_debug_fprintf(ctx, "// %s\n", name.c_str()); @@ -440,7 +440,7 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node) static bool deg_debug_graphviz_is_owner(const DepsNode *node, const DepsNode *other) { - switch (node->tclass) { + switch (node->get_class()) { case DEG_NODE_CLASS_COMPONENT: { ComponentDepsNode *comp_node = (ComponentDepsNode *)node; diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h index f562f5d64f8..40229ef8f37 100644 --- a/source/blender/depsgraph/intern/depsgraph_intern.h +++ b/source/blender/depsgraph/intern/depsgraph_intern.h @@ -59,7 +59,6 @@ namespace DEG { /* Typeinfo Struct (nti) */ struct DepsNodeFactory { virtual eDepsNode_Type type() const = 0; - virtual eDepsNode_Class tclass() const = 0; virtual const char *tname() const = 0; virtual int id_recalc_tag() const = 0; @@ -71,7 +70,6 @@ struct DepsNodeFactory { template struct DepsNodeFactoryImpl : public DepsNodeFactory { eDepsNode_Type type() const { return NodeType::typeinfo.type; } - eDepsNode_Class tclass() const { return NodeType::typeinfo.tclass; } const char *tname() const { return NodeType::typeinfo.tname; } int id_recalc_tag() const { return NodeType::typeinfo.id_recalc_tag; } @@ -81,7 +79,6 @@ struct DepsNodeFactoryImpl : public DepsNodeFactory { /* populate base node settings */ node->type = type(); - node->tclass = tclass(); if (name[0] != '\0') { /* set name if provided ... */ diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc index e163e88e0ed..2c6c29fc14d 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node.cc +++ b/source/blender/depsgraph/intern/nodes/deg_node.cc @@ -56,12 +56,6 @@ DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type, tname(tname), id_recalc_tag(id_recalc_tag) { - if (type == DEG_NODE_TYPE_OPERATION) - this->tclass = DEG_NODE_CLASS_OPERATION; - else if (type < DEG_NODE_TYPE_PARAMETERS) - this->tclass = DEG_NODE_CLASS_GENERIC; - else - this->tclass = DEG_NODE_CLASS_COMPONENT; } DepsNode::DepsNode() diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h index 54042ae4a1b..05c787fba11 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node.h +++ b/source/blender/depsgraph/intern/nodes/deg_node.h @@ -52,23 +52,10 @@ struct DepsNode { /* Helper class for static typeinfo in subclasses. */ struct TypeInfo { TypeInfo(eDepsNode_Type type, const char *tname, int id_recalc_tag = 0); - eDepsNode_Type type; - eDepsNode_Class tclass; const char *tname; - int id_recalc_tag; }; - - /* Identifier - mainly for debugging purposes. */ - const char *name; - - /* Structural type of node. */ - eDepsNode_Type type; - - /* Type of data/behaviour represented by node... */ - eDepsNode_Class tclass; - /* Relationships between nodes * The reason why all depsgraph nodes are descended from this type (apart * from basic serialization benefits - from the typeinfo) is that we can have @@ -76,9 +63,12 @@ struct DepsNode { */ typedef vector Relations; + /* Identifier - mainly for debugging purposes. */ + const char *name; + /* Structural type of node. */ + eDepsNode_Type type; /* Nodes which this one depends on. */ Relations inlinks; - /* Nodes which depend on this one. */ Relations outlinks; @@ -87,7 +77,6 @@ struct DepsNode { int tag; /* Methods. */ - DepsNode(); virtual ~DepsNode(); @@ -101,6 +90,18 @@ struct DepsNode { virtual OperationDepsNode *get_entry_operation() { return NULL; } virtual OperationDepsNode *get_exit_operation() { return NULL; } + + virtual eDepsNode_Class get_class() const { + if (type == DEG_NODE_TYPE_OPERATION) { + return DEG_NODE_CLASS_OPERATION; + } + else if (type < DEG_NODE_TYPE_PARAMETERS) { + return DEG_NODE_CLASS_GENERIC; + } + else { + return DEG_NODE_CLASS_COMPONENT; + } + } }; /* Macros for common static typeinfo. */ -- cgit v1.2.3 From 0ed3a72012ab311dc0c267b3b389d9938ae2d95c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 21 Dec 2017 10:37:00 +0100 Subject: Depsgraph: Remove unused component context functions --- source/blender/depsgraph/intern/nodes/deg_node_component.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h index c6625e55857..985716deaac 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_component.h +++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h @@ -124,19 +124,6 @@ struct ComponentDepsNode : public DepsNode { void tag_update(Depsgraph *graph); - /* Evaluation Context Management .................. */ - - /* Initialize component's evaluation context used for the specified - * purpose. - */ - virtual bool eval_context_init(EvaluationContext * /*eval_ctx*/) { return false; } - /* Free data in component's evaluation context which is used for - * the specified purpose - * - * NOTE: this does not free the actual context in question - */ - virtual void eval_context_free(EvaluationContext * /*eval_ctx*/) {} - OperationDepsNode *get_entry_operation(); OperationDepsNode *get_exit_operation(); -- cgit v1.2.3 From f906f5cc58559bc3e4d5593921fd2121f3c04d6b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 21 Dec 2017 11:13:22 +0100 Subject: Depsgraph: Remove eval priority from debugger This needs to be redone anyway, to correspond to possibly new priorities calculated for evaluaiton. --- .../depsgraph/intern/debug/deg_debug_graphviz.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc index 6d8fda97321..88954f6f0dc 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc @@ -139,7 +139,6 @@ static int deg_debug_node_color_index(const DepsNode *node) struct DebugContext { FILE *file; bool show_tags; - bool show_eval_priority; }; static void deg_debug_fprintf(const DebugContext &ctx, const char *fmt, ...) ATTR_PRINTF_FORMAT(2, 3); @@ -286,28 +285,17 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx, { const char *shape = "box"; string name = node->identifier(); - float priority = -1.0f; if (node->type == DEG_NODE_TYPE_ID_REF) { IDDepsNode *id_node = (IDDepsNode *)node; char buf[256]; BLI_snprintf(buf, sizeof(buf), " (Layers: %u)", id_node->layers); name += buf; } - if (ctx.show_eval_priority && node->get_class() == DEG_NODE_CLASS_OPERATION) { - priority = ((OperationDepsNode *)node)->eval_priority; - } deg_debug_fprintf(ctx, "// %s\n", name.c_str()); deg_debug_fprintf(ctx, "\"node_%p\"", node); deg_debug_fprintf(ctx, "["); // deg_debug_fprintf(ctx, "label=<%s>", name); - if (priority >= 0.0f) { - deg_debug_fprintf(ctx, "label=<%s
(%.2f)>", - name.c_str(), - priority); - } - else { - deg_debug_fprintf(ctx, "label=<%s>", name.c_str()); - } + deg_debug_fprintf(ctx, "label=<%s>", name.c_str()); deg_debug_fprintf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname); deg_debug_fprintf(ctx, ",fontsize=%f", deg_debug_graphviz_node_label_size); deg_debug_fprintf(ctx, ",shape=%s", shape); @@ -530,7 +518,7 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx, } // namespace DEG -void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label, bool show_eval) +void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label) { if (!graph) { return; @@ -540,8 +528,6 @@ void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label, bool DEG::DebugContext ctx; ctx.file = f; - ctx.show_tags = show_eval; - ctx.show_eval_priority = show_eval; DEG::deg_debug_fprintf(ctx, "digraph depgraph {" NL); DEG::deg_debug_fprintf(ctx, "rankdir=LR;" NL); -- cgit v1.2.3 From f6b2fbb02922e9c303b95ffbdd93cd047a640338 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 21 Dec 2017 11:15:21 +0100 Subject: Depsgraph: Remove evaluation priority completely --- source/blender/depsgraph/intern/depsgraph_eval.cc | 3 --- source/blender/depsgraph/intern/nodes/deg_node_operation.cc | 1 - source/blender/depsgraph/intern/nodes/deg_node_operation.h | 1 - 3 files changed, 5 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index ab10f9730c0..0448dbe2c8d 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -57,9 +57,6 @@ extern "C" { static bool use_legacy_depsgraph = true; #endif -/* Unfinished and unused, and takes quite some pre-processing time. */ -#undef USE_EVAL_PRIORITY - bool DEG_depsgraph_use_legacy(void) { #ifdef DISABLE_NEW_DEPSGRAPH diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc index 0fc87a52005..cbc0fbb4241 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_operation.cc +++ b/source/blender/depsgraph/intern/nodes/deg_node_operation.cc @@ -45,7 +45,6 @@ namespace DEG { /* Inner Nodes */ OperationDepsNode::OperationDepsNode() : - eval_priority(0.0f), flag(0), customdata_mask(0) { diff --git a/source/blender/depsgraph/intern/nodes/deg_node_operation.h b/source/blender/depsgraph/intern/nodes/deg_node_operation.h index ffb95a53b5d..c172f73be5f 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_operation.h +++ b/source/blender/depsgraph/intern/nodes/deg_node_operation.h @@ -76,7 +76,6 @@ struct OperationDepsNode : public DepsNode { /* How many inlinks are we still waiting on before we can be evaluated. */ uint32_t num_links_pending; - float eval_priority; bool scheduled; /* Identifier for the operation being performed. */ -- cgit v1.2.3