diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-05 00:12:16 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-05 00:12:16 +0400 |
commit | 282f98a84dc7d454a36918b9b8b279aa127c4d3b (patch) | |
tree | 2f91ff3f8a27f13a60f334bc9fa3f7e1bbf3eec4 /intern | |
parent | 79b4c0e600c2f2fe539a0602bf752b62210815d6 (diff) |
Fix #31806: cycles crash rendering a particular node setup with multiple mix/add
shader nodes.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/graph.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/render/svm.cpp | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 20fbfa0cf27..62758128a73 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -181,14 +181,14 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to) assert(from && to); if(to->link) { - fprintf(stderr, "ShaderGraph connect: input already connected.\n"); + fprintf(stderr, "Cycles shader graph connect: input already connected.\n"); return; } if(from->type != to->type) { /* for closures we can't do automatic conversion */ if(from->type == SHADER_SOCKET_CLOSURE || to->type == SHADER_SOCKET_CLOSURE) { - fprintf(stderr, "ShaderGraph connect: can only connect closure to closure " + fprintf(stderr, "Cycles shader graph connect: can only connect closure to closure " "(ShaderNode:%s, ShaderOutput:%s , type:%d -> to ShaderNode:%s, ShaderInput:%s, type:%d).\n", from->parent->name.c_str(), from->name, (int)from->type, to->parent->name.c_str(), to->name, (int)to->type); @@ -363,7 +363,7 @@ void ShaderGraph::break_cycles(ShaderNode *node, vector<bool>& visited, vector<b if(on_stack[depnode->id]) { /* break cycle */ disconnect(input); - fprintf(stderr, "ShaderGraph: detected cycle in graph, connection removed.\n"); + fprintf(stderr, "Cycles shader graph: detected cycle in graph, connection removed.\n"); } else if(!visited[depnode->id]) { /* visit dependencies */ diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 844ce01569f..da287a10199 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -274,6 +274,17 @@ void SVMCompiler::stack_clear_users(ShaderNode *node, set<ShaderNode*>& done) foreach(ShaderInput *in, output->links) in->stack_offset = SVM_STACK_INVALID; + + /* unmark any nodes that have no more valid outputs, see [#31806] */ + if(done.find(output->parent) != done.end()) { + all_done = true; + foreach(ShaderOutput *pout, output->parent->outputs) + if(pout->stack_offset != SVM_STACK_INVALID) + all_done = false; + + if(all_done) + done.erase(output->parent); + } } } } |