[Bf-blender-cvs] [276b533] object_nodes: Fix for stack index assignment to graph outputs.

Lukas Tönne noreply at git.blender.org
Thu Nov 26 14:13:04 CET 2015


Commit: 276b533ffe5575b9208d340e0d59363cbc8c7329
Author: Lukas Tönne
Date:   Thu Nov 26 14:12:30 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB276b533ffe5575b9208d340e0d59363cbc8c7329

Fix for stack index assignment to graph outputs.

===================================================================

M	source/blender/blenvm/compile/bvm_codegen.cc
M	source/blender/blenvm/compile/bvm_nodegraph.h

===================================================================

diff --git a/source/blender/blenvm/compile/bvm_codegen.cc b/source/blender/blenvm/compile/bvm_codegen.cc
index 0ddc061..374cf8b 100644
--- a/source/blender/blenvm/compile/bvm_codegen.cc
+++ b/source/blender/blenvm/compile/bvm_codegen.cc
@@ -324,6 +324,13 @@ static void count_output_users(const NodeGraph &graph, SocketUserMap &users)
 			}
 		}
 	}
+	for (NodeGraph::OutputList::const_iterator it = graph.outputs.begin(); it != graph.outputs.end(); ++it) {
+		const NodeGraph::Output &output = *it;
+		
+		if (output.key.node) {
+			users[output.key] += 1;
+		}
+	}
 }
 
 static OpCode ptr_init_opcode(const TypeDesc &typedesc)
@@ -481,7 +488,8 @@ Function *BVMCompiler::codegen_function(const NodeGraph &graph)
 		const NodeSocket *socket = output.key.node->type->find_output(output.key.socket);
 		ReturnValue &rval = fn->add_return_value(socket->typedesc, output.name);
 		
-		rval.stack_offset = input_index[output.key.node->input(0)];
+		assert(output_index.find(output.key) != output_index.end());
+		rval.stack_offset = output_index[output.key];
 	}
 	
 	push_opcode(OP_END);
diff --git a/source/blender/blenvm/compile/bvm_nodegraph.h b/source/blender/blenvm/compile/bvm_nodegraph.h
index b49ce98..6a53859 100644
--- a/source/blender/blenvm/compile/bvm_nodegraph.h
+++ b/source/blender/blenvm/compile/bvm_nodegraph.h
@@ -176,7 +176,7 @@ struct SocketPair {
 	    node(node), socket(socket)
 	{}
 	
-	operator ConstSocketPair()
+	operator ConstSocketPair() const
 	{
 		return ConstSocketPair(node, socket);
 	}




More information about the Bf-blender-cvs mailing list