[Bf-blender-cvs] [c5d9eb88e21] master: Depsgraph: Replace iteration over ghash with iteration over flat array

Sergey Sharybin noreply at git.blender.org
Mon Dec 18 16:16:34 CET 2017


Commit: c5d9eb88e21001bccf039e5d9ed746a9280302a1
Author: Sergey Sharybin
Date:   Wed Nov 8 14:48:25 2017 +0100
Branches: master
https://developer.blender.org/rBc5d9eb88e21001bccf039e5d9ed746a9280302a1

Depsgraph: Replace iteration over ghash with iteration over flat array

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

M	source/blender/depsgraph/intern/builder/deg_builder.cc
M	source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph_debug.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc
index 26f729a16d7..c79716e5ea5 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -125,8 +125,7 @@ void deg_graph_build_finalize(Depsgraph *graph)
 	 * to do it ahead of a time and don't spend time on flushing updates on
 	 * every frame change.
 	 */
-	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
-	{
+	foreach (IDDepsNode *id_node, graph->id_nodes) {
 		if (id_node->layers == 0) {
 			ID *id = id_node->id;
 			if (GS(id->name) == ID_OB) {
@@ -137,14 +136,12 @@ void deg_graph_build_finalize(Depsgraph *graph)
 			}
 		}
 	}
-	GHASH_FOREACH_END();
 	/* STEP 2: Flush visibility layers from children to parent. */
 	deg_graph_build_flush_layers(graph);
 	/* STEP 3: Re-tag IDs for update if it was tagged before the relations
 	 * update tag.
 	 */
-	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
-	{
+	foreach (IDDepsNode *id_node, graph->id_nodes) {
 		GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp, id_node->components)
 		{
 			id_node->layers |= comp->layers;
@@ -169,7 +166,6 @@ void deg_graph_build_finalize(Depsgraph *graph)
 		}
 		id_node->finalize_build();
 	}
-	GHASH_FOREACH_END();
 }
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
index d7457b9eb6c..528758daeb2 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
@@ -497,11 +497,9 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
 static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
                                            const Depsgraph *graph)
 {
-	GHASH_FOREACH_BEGIN (DepsNode *, node, graph->id_hash)
-	{
+	foreach (DepsNode *node, graph->id_nodes) {
 		deg_debug_graphviz_node(ctx, node);
 	}
-	GHASH_FOREACH_END();
 	TimeSourceDepsNode *time_source = graph->find_time_source();
 	if (time_source != NULL) {
 		deg_debug_graphviz_node(ctx, time_source);
@@ -511,8 +509,7 @@ static void deg_debug_graphviz_graph_nodes(const DebugContext &ctx,
 static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
                                                const Depsgraph *graph)
 {
-	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
-	{
+	foreach (IDDepsNode *id_node, graph->id_nodes) {
 		GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
 		{
 			foreach (OperationDepsNode *op_node, comp_node->operations) {
@@ -521,7 +518,6 @@ static void deg_debug_graphviz_graph_relations(const DebugContext &ctx,
 		}
 		GHASH_FOREACH_END();
 	}
-	GHASH_FOREACH_END();
 
 	TimeSourceDepsNode *time_source = graph->find_time_source();
 	if (time_source != NULL) {
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 0b1156a78ba..f6f3cd06708 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -197,8 +197,7 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
 		size_t tot_outer = 0;
 		size_t tot_rels = 0;
 
-		GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, deg_graph->id_hash)
-		{
+		foreach (DEG::IDDepsNode *id_node, deg_graph->id_nodes) {
 			tot_outer++;
 			GHASH_FOREACH_BEGIN(DEG::ComponentDepsNode *, comp_node, id_node->components)
 			{
@@ -209,7 +208,6 @@ void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
 			}
 			GHASH_FOREACH_END();
 		}
-		GHASH_FOREACH_END();
 
 		DEG::TimeSourceDepsNode *time_source = deg_graph->find_time_source();
 		if (time_source != NULL) {
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 79c30e7904d..2979cf7270d 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -292,8 +292,7 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
 		 * This is mainly needed on file load only, after that updates of invisible objects
 		 * will be stored in the pending list.
 		 */
-		GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
-		{
+		foreach (DEG::IDDepsNode *id_node, graph->id_nodes) {
 			ID *id = id_node->id;
 			if ((id->recalc & ID_RECALC_ALL) != 0 ||
 			    (id_node->layers & scene->lay_updated) == 0)
@@ -319,7 +318,6 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
 				}
 			}
 		}
-		GHASH_FOREACH_END();
 	}
 	scene->lay_updated |= graph->layers;
 	/* If graph is tagged for update, we don't need to bother with updates here,



More information about the Bf-blender-cvs mailing list