From ce2c15deafcb8e2d2b5a8f2b46572fb24c439ce9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 10 May 2016 11:25:57 +0200 Subject: [PATCH] Depsgraph: Avoid multipel editors update per same ID Simple thing, and apparently fps goes up to 80 with the demo file from jpbouza. Not sure why at this point fps is so much higher than the old dependency graph here now. And it's definitely something what others should verify as well. --- source/blender/depsgraph/intern/depsgraph_tag.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 7c660caa2f9..a433c932b3a 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -282,7 +282,12 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph) it != graph->operations.end(); ++it) { + /* ID node's done flag is used to avoid multiple editors update + * for the same ID. + */ OperationDepsNode *node = *it; + IDDepsNode *id_node = node->owner->owner; + id_node->done = 0; node->scheduled = false; node->owner->flags &= ~DEPSCOMP_FULLY_SCHEDULED; } @@ -301,7 +306,10 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph) OperationDepsNode *node = *it; IDDepsNode *id_node = node->owner->owner; queue.push(node); - deg_editors_id_update(bmain, id_node->id); + if (id_node->done == 0) { + deg_editors_id_update(bmain, id_node->id); + id_node->done = 1; + } node->scheduled = true; } @@ -346,7 +354,10 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph) to_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE; queue.push(to_node); to_node->scheduled = true; - deg_editors_id_update(bmain, id_node->id); + if (id_node->done == 0) { + deg_editors_id_update(bmain, id_node->id); + id_node->done = 1; + } } }