From 8294452b14fac54443f31fe11950d19370e27b43 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 25 Nov 2015 13:46:51 +0500 Subject: Fix T46782: Updating Shaders very slow with complex nodegraph The issue was caused by not really optimal graph traversal for gathering nodes dependencies which could have exponential complexity with a long tree branches connected with multiple connections between them. Now we optimize the depth traversal and perform early output if the node was already traversed. Please note that this adds some limitations to the use of SVM compiler's find_dependencies() in the cases when skip_node is not NULL and one wants to perform dependencies find sequentially with the same set. This doesn't happen in the code, but one should be aware of this. --- intern/cycles/render/graph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/cycles/render/graph.cpp') diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 3e417d13d4d..e888cb37137 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -306,7 +306,7 @@ void ShaderGraph::find_dependencies(ShaderNodeSet& dependencies, ShaderInput *in /* find all nodes that this input depends on directly and indirectly */ ShaderNode *node = (input->link)? input->link->parent: NULL; - if(node) { + if(node != NULL && dependencies.find(node) == dependencies.end()) { foreach(ShaderInput *in, node->inputs) find_dependencies(dependencies, in); -- cgit v1.2.3