[Bf-blender-cvs] [7dfa1b18c1f] master: Depsgraph: use BLI::Set for entry_tags

Jacques Lucke noreply at git.blender.org
Tue Apr 28 17:43:03 CEST 2020


Commit: 7dfa1b18c1fc32d983f34dd72fcb8c0363a53157
Author: Jacques Lucke
Date:   Tue Apr 28 17:40:23 2020 +0200
Branches: master
https://developer.blender.org/rB7dfa1b18c1fc32d983f34dd72fcb8c0363a53157

Depsgraph: use BLI::Set for entry_tags

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7555

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_eval.cc
M	source/blender/depsgraph/intern/depsgraph_query.cc
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index a1bd4d57a05..108081dbde6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -337,7 +337,7 @@ void DepsgraphNodeBuilder::begin_build()
     id_node->id_cow = nullptr;
   }
 
-  GSET_FOREACH_BEGIN (OperationNode *, op_node, graph_->entry_tags) {
+  for (OperationNode *op_node : graph_->entry_tags) {
     ComponentNode *comp_node = op_node->owner;
     IDNode *id_node = comp_node->owner;
 
@@ -349,12 +349,11 @@ void DepsgraphNodeBuilder::begin_build()
     entry_tag.name_tag = op_node->name_tag;
     saved_entry_tags_.push_back(entry_tag);
   }
-  GSET_FOREACH_END();
 
   /* Make sure graph has no nodes left from previous state. */
   graph_->clear_all_nodes();
   graph_->operations.clear();
-  BLI_gset_clear(graph_->entry_tags, nullptr);
+  graph_->entry_tags.clear();
 }
 
 void DepsgraphNodeBuilder::end_build()
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 4fa73e36170..8fd04375862 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -81,7 +81,6 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
       is_render_pipeline_depsgraph(false)
 {
   BLI_spin_init(&lock);
-  entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags");
   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));
@@ -90,7 +89,6 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
 Depsgraph::~Depsgraph()
 {
   clear_id_nodes();
-  BLI_gset_free(entry_tags, nullptr);
   if (time_source != nullptr) {
     OBJECT_GUARDED_DELETE(time_source, TimeSourceNode);
   }
@@ -231,7 +229,7 @@ void Depsgraph::add_entry_tag(OperationNode *node)
    * from.
    * NOTE: this is necessary since we have several thousand nodes to play
    * with. */
-  BLI_gset_insert(entry_tags, node);
+  entry_tags.add(node);
 }
 
 void Depsgraph::clear_all_nodes()
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 67c93353411..1459bd4e255 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -119,7 +119,7 @@ struct Depsgraph {
   /* Quick-Access Temp Data ............. */
 
   /* Nodes which have been tagged as "directly modified". */
-  GSet *entry_tags;
+  Set<OperationNode *> entry_tags;
 
   /* Special entry tag for time source. Allows to tag invisible dependency graphs for update when
    * scene frame changes, so then when dependency graph becomes visible it is on a proper state. */
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index 9251d975125..26ceaaa899c 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -87,5 +87,5 @@ void DEG_evaluate_on_framechange(Main *bmain, Depsgraph *graph, float ctime)
 bool DEG_needs_eval(Depsgraph *graph)
 {
   DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
-  return BLI_gset_len(deg_graph->entry_tags) != 0 || deg_graph->need_update_time;
+  return !deg_graph->entry_tags.is_empty() || deg_graph->need_update_time;
 }
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 6e85b2e8bd9..7c124b08161 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -319,7 +319,7 @@ bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
     return false;
   }
   /* Check whether IDs are up to date. */
-  if (BLI_gset_len(deg_graph->entry_tags) > 0) {
+  if (!deg_graph->entry_tags.is_empty()) {
     return false;
   }
   return true;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index e61bcb961ae..9e060a0efe9 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -364,7 +364,7 @@ void depsgraph_ensure_view_layer(Depsgraph *graph)
 void deg_evaluate_on_refresh(Depsgraph *graph)
 {
   /* Nothing to update, early out. */
-  if (BLI_gset_len(graph->entry_tags) == 0) {
+  if (graph->entry_tags.is_empty()) {
     return;
   }
 
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 15a965ad2b0..9afe748079a 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -116,7 +116,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
 
 BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
 {
-  GSET_FOREACH_BEGIN (OperationNode *, op_node, graph->entry_tags) {
+  for (OperationNode *op_node : graph->entry_tags) {
     queue->push_back(op_node);
     op_node->scheduled = true;
     DEG_DEBUG_PRINTF((::Depsgraph *)graph,
@@ -124,7 +124,6 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue)
                      "Operation is entry point for update: %s\n",
                      op_node->identifier().c_str());
   }
-  GSET_FOREACH_END();
 }
 
 BLI_INLINE void flush_handle_id_node(IDNode *id_node)
@@ -345,7 +344,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
     graph->ctime = ctime;
     time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME);
   }
-  if (BLI_gset_len(graph->entry_tags) == 0) {
+  if (graph->entry_tags.is_empty()) {
     return;
   }
   /* Reset all flags, get ready for the flush. */
@@ -391,7 +390,7 @@ void deg_graph_clear_tags(Depsgraph *graph)
                     DEPSOP_FLAG_USER_MODIFIED);
   }
   /* Clear any entry tags which haven't been flushed. */
-  BLI_gset_clear(graph->entry_tags, nullptr);
+  graph->entry_tags.clear();
 }
 
 }  // namespace DEG



More information about the Bf-blender-cvs mailing list