[Bf-blender-cvs] [9295e3bddec] functions: pass (currently empty) execution context into tuple call

Jacques Lucke noreply at git.blender.org
Tue Mar 26 11:22:11 CET 2019


Commit: 9295e3bddec0b4d5016d61db36af629421187410
Author: Jacques Lucke
Date:   Tue Mar 26 09:31:23 2019 +0100
Branches: functions
https://developer.blender.org/rB9295e3bddec0b4d5016d61db36af629421187410

pass (currently empty) execution context into tuple call

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

M	source/blender/functions/CMakeLists.txt
M	source/blender/functions/FN_tuple_call.hpp
M	source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
M	source/blender/functions/backends/llvm/ir_to_tuple_call.cpp
A	source/blender/functions/backends/tuple_call/execution_context.hpp
M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M	source/blender/functions/backends/tuple_call/lazy_to_normal.cpp
M	source/blender/functions/backends/tuple_call/tuple_call.hpp
M	source/blender/functions/c_wrapper.cpp
M	source/blender/functions/frontends/data_flow_nodes/inserters.cpp
M	source/blender/functions/functions/lists.cpp
M	source/blender/functions/functions/object_input.cpp
M	source/blender/functions/functions/random.cpp
M	source/blender/functions/functions/scalar_math.cpp
M	source/blender/functions/functions/simple_conversions.cpp
M	source/blender/functions/functions/switch.cpp
M	source/blender/functions/functions/vectors.cpp

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

diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt
index 64f085170f3..ed8daf5d283 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -43,6 +43,7 @@ set(SRC
 	backends/tuple_call/tuple.cpp
 	backends/tuple_call/lazy_to_normal.hpp
 	backends/tuple_call/lazy_to_normal.cpp
+	backends/tuple_call/execution_context.hpp
 
 	backends/dependencies/dependencies.hpp
 	backends/dependencies/dependencies.cpp
diff --git a/source/blender/functions/FN_tuple_call.hpp b/source/blender/functions/FN_tuple_call.hpp
index 24276d0386f..f066b66a7fa 100644
--- a/source/blender/functions/FN_tuple_call.hpp
+++ b/source/blender/functions/FN_tuple_call.hpp
@@ -4,4 +4,5 @@
 #include "backends/tuple_call/tuple.hpp"
 #include "backends/tuple_call/tuple_call.hpp"
 #include "backends/tuple_call/fgraph_tuple_call.hpp"
-#include "backends/tuple_call/lazy_to_normal.hpp"
\ No newline at end of file
+#include "backends/tuple_call/lazy_to_normal.hpp"
+#include "backends/tuple_call/execution_context.hpp"
\ No newline at end of file
diff --git a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
index cd72e909190..cb301d9ed26 100644
--- a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
+++ b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
@@ -22,7 +22,9 @@ namespace FN {
 		Tuple fn_out(meta_out, data_out, initialized_out, false);
 
 		fn_in.set_all_initialized();
-		body->call(fn_in, fn_out);
+
+		ExecutionContext ctx;
+		body->call(fn_in, fn_out, ctx);
 
 		/* This way the data is not freed with the tuples. */
 		fn_out.set_all_uninitialized();
diff --git a/source/blender/functions/backends/llvm/ir_to_tuple_call.cpp b/source/blender/functions/backends/llvm/ir_to_tuple_call.cpp
index ed1f36502c0..acd47c52158 100644
--- a/source/blender/functions/backends/llvm/ir_to_tuple_call.cpp
+++ b/source/blender/functions/backends/llvm/ir_to_tuple_call.cpp
@@ -99,7 +99,7 @@ namespace FN {
 			m_call = (LLVMCallFN)m_compiled->function_ptr();
 		}
 
-		void call(Tuple &fn_in, Tuple &fn_out) const override
+		void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &UNUSED(ctx)) const override
 		{
 			fn_out.destruct_all();
 			BLI_assert(fn_in.all_initialized());
diff --git a/source/blender/functions/backends/tuple_call/execution_context.hpp b/source/blender/functions/backends/tuple_call/execution_context.hpp
new file mode 100644
index 00000000000..e7b10ae1e02
--- /dev/null
+++ b/source/blender/functions/backends/tuple_call/execution_context.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+namespace FN {
+
+	class ExecutionContext {
+
+	};
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index b4174be2637..9a760e88915 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -269,7 +269,7 @@ namespace FN {
 			computed_nodes.add(node);
 		}
 
-		void call(Tuple &fn_in, Tuple &fn_out) const override
+		void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx) const override
 		{
 			void *buffer = alloca(m_combined_tuples_size);
 			for (Task &task : m_tasks) {
@@ -301,7 +301,7 @@ namespace FN {
 					{
 						Tuple &fn_in = this->get_tuple(buffer, task.data.call.index_in);
 						Tuple &fn_out = this->get_tuple(buffer, task.data.call.index_out);
-						task.data.call.body->call(fn_in, fn_out);
+						task.data.call.body->call(fn_in, fn_out, ctx);
 						break;
 					}
 					case OpCode::GetInput:
@@ -366,21 +366,23 @@ namespace FN {
 			}
 		}
 
-		void call(Tuple &fn_in, Tuple &fn_out) const override
+		void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx) const override
 		{
 			for (uint i = 0; i < m_outputs.size(); i++) {
-				this->compute_socket(fn_in, fn_out, i, m_outputs[i]);
+				this->compute_socket(fn_in, fn_out, i, m_outputs[i], ctx);
 			}
 		}
 
-		void compute_socket(Tuple &fn_in, Tuple &out, uint out_index, Socket socket) const
+		void compute_socket(
+			Tuple &fn_in, Tuple &out, uint out_index,
+			Socket socket, ExecutionContext &ctx) const
 		{
 			if (m_inputs.contains(socket)) {
 				uint index = m_inputs.index(socket);
 				Tuple::copy_element(fn_in, index, out, out_index);
 			}
 			else if (socket.is_input()) {
-				this->compute_socket(fn_in, out, out_index, socket.origin());
+				this->compute_socket(fn_in, out, out_index, socket.origin(), ctx);
 			}
 			else {
 				Node *node = socket.node();
@@ -390,10 +392,10 @@ namespace FN {
 				FN_TUPLE_STACK_ALLOC(tmp_out, body->meta_out());
 
 				for (uint i = 0; i < node->input_amount(); i++) {
-					this->compute_socket(fn_in, tmp_in, i, node->input(i));
+					this->compute_socket(fn_in, tmp_in, i, node->input(i), ctx);
 				}
 
-				body->call(tmp_in, tmp_out);
+				body->call(tmp_in, tmp_out, ctx);
 
 				Tuple::copy_element(tmp_out, socket.index(), out, out_index);
 			}
@@ -423,7 +425,7 @@ namespace FN {
 			}
 		}
 
-		void call(Tuple &fn_in, Tuple &fn_out) const override
+		void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx) const override
 		{
 			SocketSet required_sockets = m_fgraph.find_required_sockets();
 			for (Socket socket : m_fgraph.inputs()) {
@@ -452,7 +454,7 @@ namespace FN {
 
 			for (uint i = 0; i < m_fgraph.outputs().size(); i++) {
 				Socket socket = m_fgraph.outputs()[i];
-				this->compute_socket(socket, temp_storage, socket_indices);
+				this->compute_socket(socket, temp_storage, socket_indices, ctx);
 			}
 
 			for (uint i = 0; i < m_fgraph.outputs().size(); i++) {
@@ -466,7 +468,8 @@ namespace FN {
 		void compute_socket(
 			Socket socket,
 			Tuple &temp_storage,
-			const SmallMap<Socket, uint> &socket_indices) const
+			const SmallMap<Socket, uint> &socket_indices,
+			ExecutionContext &ctx) const
 		{
 			uint socket_index = socket_indices.lookup(socket);
 			if (temp_storage.is_initialized(socket_index)) {
@@ -474,7 +477,7 @@ namespace FN {
 			}
 			else if (socket.is_input()) {
 				Socket origin_socket = socket.origin();
-				this->compute_socket(origin_socket, temp_storage, socket_indices);
+				this->compute_socket(origin_socket, temp_storage, socket_indices, ctx);
 				Tuple::copy_element(
 					temp_storage, socket_indices.lookup(origin_socket),
 					temp_storage, socket_indices.lookup(socket));
@@ -492,7 +495,7 @@ namespace FN {
 					for (uint input_index : body->always_required()) {
 						Socket input_socket = node->input(input_index);
 						this->compute_socket(
-							input_socket, temp_storage, socket_indices);
+							input_socket, temp_storage, socket_indices, ctx);
 						Tuple::copy_element(
 							temp_storage, socket_indices.lookup(input_socket),
 							fn_in, input_index);
@@ -503,11 +506,11 @@ namespace FN {
 
 					while (!lazy_state.is_done()) {
 						lazy_state.start_next_entry();
-						body->call(fn_in, fn_out, lazy_state);
+						body->call(fn_in, fn_out, ctx, lazy_state);
 						for (uint input_index : lazy_state.requested_inputs()) {
 							Socket input_socket = node->input(input_index);
 							this->compute_socket(
-								input_socket, temp_storage, socket_indices);
+								input_socket, temp_storage, socket_indices, ctx);
 							Tuple::copy_element(
 								temp_storage, socket_indices.lookup(input_socket),
 								fn_in, input_index);
@@ -531,13 +534,13 @@ namespace FN {
 					for (uint input_index = 0; input_index < node->input_amount(); input_index++) {
 						Socket input_socket = node->input(input_index);
 						this->compute_socket(
-							input_socket, temp_storage, socket_indices);
+							input_socket, temp_storage, socket_indices, ctx);
 						Tuple::copy_element(
 							temp_storage, socket_indices.lookup(input_socket),
 							fn_in, input_index);
 					}
 
-					body->call(fn_in, fn_out);
+					body->call(fn_in, fn_out, ctx);
 					BLI_assert(fn_out.all_initialized());
 
 					for (uint output_index = 0; output_index < node->output_amount(); output_index++) {
diff --git a/source/blender/functions/backends/tuple_call/lazy_to_normal.cpp b/source/blender/functions/backends/tuple_call/lazy_to_normal.cpp
index ad5adf1ad07..9309ffb568f 100644
--- a/source/blender/functions/backends/tuple_call/lazy_to_normal.cpp
+++ b/source/blender/functions/backends/tuple_call/lazy_to_normal.cpp
@@ -13,13 +13,13 @@ namespace FN {
 			: m_lazy_body(body),
 			  m_user_data_size(body->user_data_size()) {}
 
-		void call(Tuple &fn_in, Tuple &fn_out) const override
+		void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx) const override
 		{
 			void *user_data = alloca(m_user_data_size);
 			LazyState state(user_data);
 			while (!state.is_done()) {
 				state.start_next_entry();
-				m_lazy_body->call(fn_in, fn_out, state);
+				m_lazy_body->call(fn_in, fn_out, ctx, state);
 			}
 		}
 	};
diff --git a/source/blender/functions/backends/tuple_call/tuple_call.hpp b/source/blender/functions/backends/tuple_call/tuple_call.hpp
index 295d9406723..93a01b3bd9d 100644
--- a/source/blender/functions/backends/tuple_call/tuple_call.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple_call.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "tuple.hpp"
+#include "execution_context.hpp"
 
 namespace FN {
 
@@ -32,7 +33,7 @@ namespace FN {
 	public:
 		BLI_COMPOSITION_DECLARATION(TupleCallBody);
 
-		virtual void call(Tuple &fn_in, Tuple &fn_out) const = 0;
+		virtual void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx) const = 0;
 	};
 
 	class LazyState {
@@ -89,7 +90,7 @@ namespace FN {
 
 		virtual uint user_data_size() const;
 		virtual const SmallVector<uint> &always_required() const;
-		virtual void call(Tuple &fn_in, Tuple &fn_out, LazyState &state) const = 0;
+		virtual void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext &ctx, LazyState &state) const = 0;
 	};
 
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/c_wrapper.cpp b/source/blender/functions/c_wrapper.cpp
index bedb47456ea..bae6bc9ad79 100644
--- a/source/blender/functions/c_wrapper.cpp
+++ b/s

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list