[Bf-blender-cvs] [31067c97575] blender2.8: Depsgraph: Move CoW tag to ID datablock tag

Sergey Sharybin noreply at git.blender.org
Thu Apr 12 11:43:35 CEST 2018


Commit: 31067c975759255c013a2b4d872082155d41479e
Author: Sergey Sharybin
Date:   Thu Apr 12 11:03:24 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB31067c975759255c013a2b4d872082155d41479e

Depsgraph: Move CoW tag to ID datablock tag

Unless there is an external action from an user, there should not
be need in re-copying original datablock to a copied one.

This brings performance up from 5fps to 11fps with Spring runcycle
(performance in master is 14fps).

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

M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index a230732291c..d1de12f4591 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -280,6 +280,13 @@ void depsgraph_tag_component(Depsgraph *graph,
 			operation_node->tag_update(graph);
 		}
 	}
+	/* If component depends on copy-on-write, tag it as well. */
+	if (DEG_depsgraph_use_copy_on_write() && component_node->depends_on_cow()) {
+		ComponentDepsNode *cow_comp =
+		        id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
+		cow_comp->tag_update(graph);
+		id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE;
+	}
 }
 
 /* This is a tag compatibility with legacy code.
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index c22d27c118b..f7f55610d22 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -135,10 +135,8 @@ BLI_INLINE void flush_handle_id_node(IDDepsNode *id_node)
 }
 
 /* TODO(sergey): We can reduce number of arguments here. */
-BLI_INLINE void flush_handle_component_node(Depsgraph *graph,
-                                            IDDepsNode *id_node,
+BLI_INLINE void flush_handle_component_node(IDDepsNode *id_node,
                                             ComponentDepsNode *comp_node,
-                                            bool use_copy_on_write,
                                             FlushQueue *queue)
 {
 	/* We only handle component once. */
@@ -146,17 +144,6 @@ BLI_INLINE void flush_handle_component_node(Depsgraph *graph,
 		return;
 	}
 	comp_node->done = COMPONENT_STATE_DONE;
-	/* Currently this is needed to get object->mesh to be replaced with
-	 * original mesh (rather than being evaluated_mesh).
-	 *
-	 * TODO(sergey): This is something we need to avoid.
-	 */
-	if (use_copy_on_write && comp_node->depends_on_cow()) {
-		ComponentDepsNode *cow_comp =
-		        id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE);
-		cow_comp->tag_update(graph);
-		id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE;
-	}
 	/* Tag all required operations in component for update.  */
 	foreach (OperationDepsNode *op, comp_node->operations) {
 		/* We don't want to flush tags in "upstream" direction for
@@ -267,7 +254,6 @@ void flush_editors_id_update(Main *bmain,
  */
 void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
 {
-	const bool use_copy_on_write = DEG_depsgraph_use_copy_on_write();
 	/* Sanity checks. */
 	BLI_assert(bmain != NULL);
 	BLI_assert(graph != NULL);
@@ -297,10 +283,8 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
 			ComponentDepsNode *comp_node = op_node->owner;
 			IDDepsNode *id_node = comp_node->owner;
 			flush_handle_id_node(id_node);
-			flush_handle_component_node(graph,
-			                            id_node,
+			flush_handle_component_node(id_node,
 			                            comp_node,
-			                            use_copy_on_write,
 			                            &queue);
 			/* Flush to nodes along links. */
 			op_node = flush_schedule_children(op_node, &queue);



More information about the Bf-blender-cvs mailing list