Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/NOD_geometry_exec.hh')
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh55
1 files changed, 53 insertions, 2 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index f341cb28dce..52d7e097f0d 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -96,7 +96,18 @@ class GeoNodeExecParamsProvider {
* Prepare a memory buffer for an output value of the node. The returned memory has to be
* initialized by the caller. The identifier and type are expected to be correct.
*/
- virtual GMutablePointer alloc_output_value(StringRef identifier, const CPPType &type) = 0;
+ virtual GMutablePointer alloc_output_value(const CPPType &type) = 0;
+
+ /**
+ * The value has been allocated with #alloc_output_value.
+ */
+ virtual void set_output(StringRef identifier, GMutablePointer value) = 0;
+
+ /* A description for these methods is provided in GeoNodeExecParams. */
+ virtual void set_input_unused(StringRef identifier) = 0;
+ virtual bool output_is_required(StringRef identifier) const = 0;
+ virtual bool lazy_require_input(StringRef identifier) = 0;
+ virtual bool lazy_output_is_required(StringRef identifier) const = 0;
};
class GeoNodeExecParams {
@@ -174,8 +185,48 @@ class GeoNodeExecParams {
#ifdef DEBUG
this->check_output_access(identifier, type);
#endif
- GMutablePointer gvalue = provider_->alloc_output_value(identifier, type);
+ GMutablePointer gvalue = provider_->alloc_output_value(type);
new (gvalue.get()) StoredT(std::forward<T>(value));
+ provider_->set_output(identifier, gvalue);
+ }
+
+ /**
+ * Tell the evaluator that a specific input won't be used anymore.
+ */
+ void set_input_unused(StringRef identifier)
+ {
+ provider_->set_input_unused(identifier);
+ }
+
+ /**
+ * Returns true when the output has to be computed.
+ * Nodes that support lazyness could use the #lazy_output_is_required variant to possibly avoid
+ * some computations.
+ */
+ bool output_is_required(StringRef identifier) const
+ {
+ return provider_->output_is_required(identifier);
+ }
+
+ /**
+ * Tell the evaluator that a specific input is required.
+ * This returns true when the input will only be available in the next execution.
+ * False is returned if the input is available already.
+ * This can only be used when the node supports lazyness.
+ */
+ bool lazy_require_input(StringRef identifier)
+ {
+ return provider_->lazy_require_input(identifier);
+ }
+
+ /**
+ * Asks the evaluator if a specific output is required right now. If this returns false, the
+ * value might still need to be computed later.
+ * This can only be used when the node supports lazyness.
+ */
+ bool lazy_output_is_required(StringRef identifier)
+ {
+ return provider_->lazy_output_is_required(identifier);
}
/**