[Bf-blender-cvs] [bdf1522fae9] functions: move CPU specific stuff to backend folder
Jacques Lucke
noreply at git.blender.org
Fri Mar 1 15:35:07 CET 2019
Commit: bdf1522fae9920be1b75ec35c2aa0471f9c04540
Author: Jacques Lucke
Date: Fri Mar 1 15:34:11 2019 +0100
Branches: functions
https://developer.blender.org/rBbdf1522fae9920be1b75ec35c2aa0471f9c04540
move CPU specific stuff to backend folder
===================================================================
M source/blender/functions/CMakeLists.txt
M source/blender/functions/FN_all.hpp
M source/blender/functions/FN_core.hpp
A source/blender/functions/FN_tuple_call.hpp
A source/blender/functions/backends/tuple_call/cpp_types.cpp
A source/blender/functions/backends/tuple_call/cpp_types.hpp
R093 source/blender/functions/core/graph_to_function.cpp source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.cpp
A source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.hpp
R061 source/blender/functions/core/cpu.hpp source/blender/functions/backends/tuple_call/tuple.hpp
R056 source/blender/functions/core/cpu.cpp source/blender/functions/backends/tuple_call/tuple_call.cpp
A source/blender/functions/backends/tuple_call/tuple_call.hpp
M source/blender/functions/c_wrapper.cpp
D source/blender/functions/core/graph_to_function.hpp
M source/blender/functions/frontends/data_flow_nodes/function_generation.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/socket_input.cpp
M source/blender/functions/functions/vectors.cpp
M source/blender/functions/types/numeric.cpp
===================================================================
diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt
index 15c49a3854f..0b6a7c7e512 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -22,20 +22,24 @@ set(SRC
core/core.hpp
core/core.cpp
- core/cpu.hpp
- core/cpu.cpp
core/data_flow_graph.hpp
core/data_flow_graph.cpp
core/dependencies.hpp
core/dependencies.cpp
core/dot_export.cpp
- core/graph_to_function.hpp
- core/graph_to_function.cpp
core/type_inferencing.hpp
core/type_inferencing.cpp
core/type_relations.hpp
core/type_relations.cpp
+ backends/tuple_call/cpp_types.hpp
+ backends/tuple_call/cpp_types.cpp
+ backends/tuple_call/tuple_call.hpp
+ backends/tuple_call/tuple_call.cpp
+ backends/tuple_call/fgraph_to_tuple_call.hpp
+ backends/tuple_call/fgraph_to_tuple_call.cpp
+ backends/tuple_call/tuple.hpp
+
types/numeric.cpp
types/numeric.hpp
diff --git a/source/blender/functions/FN_all.hpp b/source/blender/functions/FN_all.hpp
index 76c4c76fcb7..0cdfe59a52d 100644
--- a/source/blender/functions/FN_all.hpp
+++ b/source/blender/functions/FN_all.hpp
@@ -3,4 +3,5 @@
#include "FN_core.hpp"
#include "FN_types.hpp"
#include "FN_functions.hpp"
+#include "FN_tuple_call.hpp"
#include "FN_data_flow_nodes.hpp"
\ No newline at end of file
diff --git a/source/blender/functions/FN_core.hpp b/source/blender/functions/FN_core.hpp
index c3e17fedc63..d455c5c6f9a 100644
--- a/source/blender/functions/FN_core.hpp
+++ b/source/blender/functions/FN_core.hpp
@@ -2,7 +2,6 @@
#include "core/core.hpp"
#include "core/data_flow_graph.hpp"
-#include "core/graph_to_function.hpp"
+#include "core/dependencies.hpp"
#include "core/type_relations.hpp"
-#include "core/type_inferencing.hpp"
-#include "core/cpu.hpp"
\ No newline at end of file
+#include "core/type_inferencing.hpp"
\ No newline at end of file
diff --git a/source/blender/functions/FN_tuple_call.hpp b/source/blender/functions/FN_tuple_call.hpp
new file mode 100644
index 00000000000..d1d68f99636
--- /dev/null
+++ b/source/blender/functions/FN_tuple_call.hpp
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "backends/tuple_call/cpp_types.hpp"
+#include "backends/tuple_call/tuple.hpp"
+#include "backends/tuple_call/tuple_call.hpp"
+#include "backends/tuple_call/fgraph_to_tuple_call.hpp"
\ No newline at end of file
diff --git a/source/blender/functions/backends/tuple_call/cpp_types.cpp b/source/blender/functions/backends/tuple_call/cpp_types.cpp
new file mode 100644
index 00000000000..4e2a69ad711
--- /dev/null
+++ b/source/blender/functions/backends/tuple_call/cpp_types.cpp
@@ -0,0 +1,16 @@
+#include "cpp_types.hpp"
+
+namespace FN {
+
+ const char *CPPTypeInfo::identifier_in_composition()
+ {
+ return "C++ Type Info";
+ }
+
+ void CPPTypeInfo::free_self(void *value)
+ {
+ CPPTypeInfo *value_ = (CPPTypeInfo *)value;
+ delete value_;
+ }
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/backends/tuple_call/cpp_types.hpp b/source/blender/functions/backends/tuple_call/cpp_types.hpp
new file mode 100644
index 00000000000..d65c371a867
--- /dev/null
+++ b/source/blender/functions/backends/tuple_call/cpp_types.hpp
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "FN_core.hpp"
+
+namespace FN {
+
+ class CPPTypeInfo {
+ public:
+ static const char* identifier_in_composition();
+ static void free_self(void *value);
+
+ virtual ~CPPTypeInfo() {};
+
+ virtual uint size_of_type() const = 0;
+ virtual void construct_default(void *ptr) const = 0;
+ virtual void destruct_type(void *ptr) const = 0;
+ virtual void copy_to_initialized(void *src, void *dst) const = 0;
+ virtual void copy_to_uninitialized(void *src, void *dst) const = 0;
+ };
+
+ template<typename T>
+ class CPPTypeInfoForType : public CPPTypeInfo {
+ public:
+ virtual uint size_of_type() const override
+ {
+ return sizeof(T);
+ }
+
+ virtual void construct_default(void *ptr) const override
+ {
+ new(ptr) T();
+ }
+
+ virtual void destruct_type(void *ptr) const override
+ {
+ T *ptr_ = (T *)ptr;
+ ptr_->~T();
+ }
+
+ virtual void copy_to_initialized(void *src, void *dst) const override
+ {
+ T *dst_ = (T *)dst;
+ T *src_ = (T *)src;
+ std::copy(src_, src_ + 1, dst_);
+ }
+
+ virtual void copy_to_uninitialized(void *src, void *dst) const override
+ {
+ T *dst_ = (T *)dst;
+ T *src_ = (T *)src;
+ std::uninitialized_copy(src_, src_ + 1, dst_);
+ }
+ };
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/graph_to_function.cpp b/source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.cpp
similarity index 93%
rename from source/blender/functions/core/graph_to_function.cpp
rename to source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.cpp
index bb686942276..8217927a8b4 100644
--- a/source/blender/functions/core/graph_to_function.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.cpp
@@ -1,5 +1,4 @@
-#include "graph_to_function.hpp"
-#include "cpu.hpp"
+#include "fgraph_to_tuple_call.hpp"
namespace FN {
@@ -58,7 +57,7 @@ namespace FN {
}
};
- TupleCallBody *function_graph_to_callable(
+ TupleCallBody *fgraph_to_tuple_call(
const FunctionGraph &function_graph)
{
return new ExecuteGraph(function_graph);
diff --git a/source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.hpp b/source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.hpp
new file mode 100644
index 00000000000..7cca739e626
--- /dev/null
+++ b/source/blender/functions/backends/tuple_call/fgraph_to_tuple_call.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "tuple_call.hpp"
+
+namespace FN {
+
+ TupleCallBody *fgraph_to_tuple_call(
+ const FunctionGraph &function_graph);
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/cpu.hpp b/source/blender/functions/backends/tuple_call/tuple.hpp
similarity index 61%
rename from source/blender/functions/core/cpu.hpp
rename to source/blender/functions/backends/tuple_call/tuple.hpp
index ff9b283067e..48aaf084f36 100644
--- a/source/blender/functions/core/cpu.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple.hpp
@@ -1,74 +1,9 @@
#pragma once
-#include "core.hpp"
-#include "dependencies.hpp"
+#include "cpp_types.hpp"
namespace FN {
- class Tuple;
- class TupleCallBody;
- class CPPTypeInfo;
-
- class TupleCallBody {
- public:
- static const char *identifier_in_composition();
- static void free_self(void *value);
-
- virtual ~TupleCallBody() {};
-
- virtual void call(const Tuple &fn_in, Tuple &fn_out) const = 0;
- virtual void dependencies(Dependencies &UNUSED(deps)) const {}
- virtual void init_defaults(Tuple &fn_in) const;
- };
-
- class CPPTypeInfo {
- public:
- static const char* identifier_in_composition();
- static void free_self(void *value);
-
- virtual ~CPPTypeInfo() {};
-
- virtual uint size_of_type() const = 0;
- virtual void construct_default(void *ptr) const = 0;
- virtual void destruct_type(void *ptr) const = 0;
- virtual void copy_to_initialized(void *src, void *dst) const = 0;
- virtual void copy_to_uninitialized(void *src, void *dst) const = 0;
- };
-
- template<typename T>
- class CPPTypeInfoForType : public CPPTypeInfo {
- public:
- virtual uint size_of_type() const override
- {
- return sizeof(T);
- }
-
- virtual void construct_default(void *ptr) const override
- {
- new(ptr) T();
- }
-
- virtual void destruct_type(void *ptr) const override
- {
- T *ptr_ = (T *)ptr;
- ptr_->~T();
- }
-
- virtual void copy_to_initialized(void *src, void *dst) const override
- {
- T *dst_ = (T *)dst;
- T *src_ = (T *)src;
- std::copy(src_, src_ + 1, dst_);
- }
-
- virtual void copy_to_uninitialized(void *src, void *dst) const override
- {
- T *dst_ = (T *)dst;
- T *src_ = (T *)src;
- std::uninitialized_copy(src_, src_ + 1, dst_);
- }
- };
-
class Tuple {
public:
Tuple(const SmallTypeVector &types = {})
diff --git a/source/blender/functions/core/cpu.cpp b/source/blender/functions/backends/tuple_call/tuple_call.cpp
similarity index 56%
rename from source/blender/functions/core/cpu.cpp
rename to source/blender/functions/backends/tuple_call/tuple_call.cpp
index 6d670060662..dd34f687973 100644
--- a/source/blender/functions/core/cpu.cpp
+++ b/source/blender/functions/backends/tuple_call/tuple_call.cpp
@@ -1,4 +1,4 @@
-#include "cpu.hpp"
+#include "tuple_call.hpp"
namespace FN {
@@ -18,16 +18,4 @@ namespace FN {
fn_in.init_default_all();
}
-
- const char *CPPTypeInfo::identifier_in_composition()
- {
- return "C++ Type Info";
- }
-
- void CPPTypeInfo::free_self(void *value)
- {
- CPPTypeInfo *value_ = (CPPTypeInfo *)value;
- delete value_;
- }
-
} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/backends/tuple_call/tuple_call.hpp b/source/blender/functions/backends/tuple_call/tuple_call.hpp
new file mode 100644
index 00000000000..a3e3c1cc62d
--- /dev/null
+++ b/source/blender/functions/backends/tuple_call/tuple_call.hpp
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "tuple.hpp"
+
+namespace FN {
+
+ class TupleCallBody {
+ public:
+ static const char *identifier_in_composition();
+ static void free_self(void *value);
+
+ virtual ~TupleCallBody() {};
+
+ virtual void call(const Tuple &fn_in, Tuple &fn_out) const = 0;
+ virtual void dependencies(Dependencies &UNUSED(deps)) const {}
+ virtual void init_defaults(Tuple &fn_in) const;
+ };
+
+} /* 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 476300a6af8..da8ab969603 100644
--- a/source/blender/functions/c_wrapper.cpp
+++ b/source/blender/functions/c_wrapper.cpp
@@ -5,15 +5,21 @@
#include <iostream>
+using namespace BLI;
+
+using namespace FN;
+using namespace FN::Types;
+using namespace FN::DataFlowNodes;
+
#define WRAPPERS(T1, T2) \
inline T1 unwrap(T2 value) { return (T1)value; } \
inline T2 wrap(T1 value) { return (T2)value; }
-WRAPPERS(BLI::RefCounted<FN::Function> *, FnFunction);
-WRAPPERS(BLI::RefCounted<FN::Type> *, FnType);
-WRAPPERS(FN::Tuple *, FnTuple);
-WRAPPERS(const FN::TupleCallBody
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list