From 908bb0363062168e16c608e13b9340724510e2cd Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 27 Apr 2021 13:03:40 +0200 Subject: Geometry Nodes: improve geometry nodes evaluator internal api This is a first step towards T87620. It should not have any functional changes. Goals of this refactor: * Move the evaluator out of `MOD_nodes.cc`. That makes it easier to improve it in isolation. * Extract core input/out parameter management out of `GeoNodeExecParams`. Managing this is the responsibility of the evaluator. This separation of concerns will be useful once we have lazy evaluation of certain inputs/outputs. Differential Revision: https://developer.blender.org/D11085 --- source/blender/functions/FN_cpp_type.hh | 2 +- source/blender/functions/FN_generic_pointer.hh | 10 ++++++++++ source/blender/functions/FN_generic_value_map.hh | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'source/blender/functions') diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index 54ea0103fe5..cd1597a742c 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -666,7 +666,7 @@ class CPPType : NonCopyable, NonMovable { template bool is() const { - return this == &CPPType::get(); + return this == &CPPType::get>(); } }; diff --git a/source/blender/functions/FN_generic_pointer.hh b/source/blender/functions/FN_generic_pointer.hh index 2bd66daa7fe..f88ff09f916 100644 --- a/source/blender/functions/FN_generic_pointer.hh +++ b/source/blender/functions/FN_generic_pointer.hh @@ -66,6 +66,16 @@ class GMutablePointer { return type_ != nullptr && type_->is(); } + template T relocate_out() + { + BLI_assert(this->is_type()); + T value; + type_->relocate_to_initialized(data_, &value); + data_ = nullptr; + type_ = nullptr; + return value; + } + void destruct() { BLI_assert(data_ != nullptr); diff --git a/source/blender/functions/FN_generic_value_map.hh b/source/blender/functions/FN_generic_value_map.hh index 68cb945f1af..4e7fe298874 100644 --- a/source/blender/functions/FN_generic_value_map.hh +++ b/source/blender/functions/FN_generic_value_map.hh @@ -93,6 +93,11 @@ template class GValueMap { return values_.pop_as(key); } + template GPointer lookup(const ForwardKey &key) const + { + return values_.lookup_as(key); + } + /* Remove the value for the given name from the container and remove it. */ template T extract(const ForwardKey &key) { -- cgit v1.2.3