[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51055] trunk/blender/intern/cycles/render : Fix #31806: cycles crash rendering a particular node setup with multiple mix/add

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Oct 4 22:12:16 CEST 2012


Revision: 51055
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51055
Author:   blendix
Date:     2012-10-04 20:12:16 +0000 (Thu, 04 Oct 2012)
Log Message:
-----------
Fix #31806: cycles crash rendering a particular node setup with multiple mix/add
shader nodes.

Modified Paths:
--------------
    trunk/blender/intern/cycles/render/graph.cpp
    trunk/blender/intern/cycles/render/svm.cpp

Modified: trunk/blender/intern/cycles/render/graph.cpp
===================================================================
--- trunk/blender/intern/cycles/render/graph.cpp	2012-10-04 20:12:05 UTC (rev 51054)
+++ trunk/blender/intern/cycles/render/graph.cpp	2012-10-04 20:12:16 UTC (rev 51055)
@@ -181,14 +181,14 @@
 	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 @@
 			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 */

Modified: trunk/blender/intern/cycles/render/svm.cpp
===================================================================
--- trunk/blender/intern/cycles/render/svm.cpp	2012-10-04 20:12:05 UTC (rev 51054)
+++ trunk/blender/intern/cycles/render/svm.cpp	2012-10-04 20:12:16 UTC (rev 51055)
@@ -274,6 +274,17 @@
 
 				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);
+				}
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list