From b97cd0e6908b133514232c57509861ca06eca91e Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 4 Dec 2018 13:58:29 +0300 Subject: Depsgraph: execute all COPY_ON_WRITE nodes first as a separate stage. COW nodes in the graph are mostly connected via a relation type that doesn't propagate the update flags. Unfortunately, due to the scheduling implementation that means the relations don't actually guarantee execution order for indirect dependencies. Relations also don't guarantee order in case of cycles. As mentioned in IRC, the simplest way to fix possible problems is to execute all COW nodes as a separate execution stage. This seems to fix crashes with Data Transfer modifier in a cycle. Staging works by simply delaying actual scheduling of tasks for non-COW nodes until the second run of schedule_graph. Reviewers: sergey Differential Revision: https://developer.blender.org/D4027 --- source/blender/depsgraph/intern/depsgraph.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/depsgraph/intern/depsgraph.cc') diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 664d30fdaf6..f3f4d788da2 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -405,6 +405,9 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from, rel->flag |= flags; return rel; } + /* COW nodes can only depend on other COW nodes. */ + BLI_assert(to->owner->type != DEG_NODE_TYPE_COPY_ON_WRITE || + from->owner->type == DEG_NODE_TYPE_COPY_ON_WRITE); /* Create new relation, and add it to the graph. */ rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, description); rel->flag |= flags; -- cgit v1.2.3