|
Blender V5.3
|
#include <FN_lazy_function.hh>
Inherited by blender::fn::lazy_function::GraphExecutor, blender::fn::lazy_function::tests::AddLazyFunction, blender::fn::lazy_function::tests::PartialEvaluationTestFunction, blender::fn::lazy_function::tests::StoreValueFunction, blender::nodes::LazyFunctionForEnableOutputSocketUsage, blender::nodes::LazyFunctionForExtractingReferenceSet, blender::nodes::LazyFunctionForIndexSwitchSocketUsage, blender::nodes::LazyFunctionForJoinReferenceSets, blender::nodes::LazyFunctionForLogicalOr, blender::nodes::LazyFunctionForSwitchSocketUsage, and blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage.
Public Member Functions | |
| virtual | ~LazyFunction ()=default |
| virtual std::string | name () const |
| virtual std::string | input_name (int index) const |
| virtual std::string | output_name (int index) const |
| virtual void * | init_storage (LinearAllocator<> &allocator) const |
| virtual void | destruct_storage (void *storage) const |
| virtual void | possible_output_dependencies (int output_index, FunctionRef< void(Span< int >)> fn) const |
| bool | always_used_inputs_available (const Params ¶ms) const |
| bool | allow_missing_requested_inputs () const |
#LazyFunction Inline Methods | |
| Span< Input > | inputs () const |
| Span< Output > | outputs () const |
| void | execute (Params ¶ms, const Context &context) const |
Protected Attributes | |
| const char * | debug_name_ = "unknown" |
| Vector< Input > | inputs_ |
| Vector< Output > | outputs_ |
| bool | allow_missing_requested_inputs_ = false |
A function that can compute outputs and request inputs lazily. For more details see the comment at the top of the file.
Definition at line 247 of file FN_lazy_function.hh.
|
virtualdefault |
|
inline |
If true, the function can be executed even when some requested inputs are not available yet. This allows the function to make some progress and maybe to compute some outputs that are passed into this function again (lazy-function graphs may contain cycles as long as there aren't actually data dependencies).
Definition at line 314 of file FN_lazy_function.hh.
References allow_missing_requested_inputs_.
| bool LazyFunction::always_used_inputs_available | ( | const Params & | params | ) | const |
Utility to check that the guarantee by #Input::usage is followed.
Definition at line 50 of file lazy_function.cc.
References allow_missing_requested_inputs_, inputs_, blender::fn::lazy_function::Params::try_get_input_data_ptr(), blender::fn::lazy_function::Input::usage, and blender::fn::lazy_function::Used.
Referenced by execute(), and ~LazyFunction().
|
virtual |
Destruct the storage created in init_storage.
Reimplemented in blender::fn::lazy_function::GraphExecutor.
Definition at line 33 of file lazy_function.cc.
References blender::BLI_assert(), storage, and UNUSED_VARS_NDEBUG.
Referenced by ~LazyFunction().
During execution the function retrieves inputs and sets outputs in #params. For some functions, this method is called more than once. After execution, the function either has computed all required outputs or is waiting for more inputs.
Definition at line 341 of file FN_lazy_function.hh.
References always_used_inputs_available(), blender::BLI_assert(), debug_name_, blender::Default, PRF_scope_set_dynamic_name, and PRF_scope_with_name.
Referenced by ~LazyFunction().
|
virtual |
Allocates storage for this function. The storage will be passed to every call to execute. If the function does not keep track of any state, this does not have to be implemented.
Reimplemented in blender::fn::lazy_function::GraphExecutor.
Definition at line 28 of file lazy_function.cc.
Referenced by ~LazyFunction().
|
virtual |
Reimplemented in blender::fn::lazy_function::GraphExecutor.
Definition at line 18 of file lazy_function.cc.
References inputs_.
Referenced by ~LazyFunction().
Inputs of the function.
Definition at line 331 of file FN_lazy_function.hh.
References inputs_.
Referenced by blender::fn::lazy_function::Params::set_input_unused(), blender::fn::lazy_function::Params::try_get_input_data_ptr(), blender::fn::lazy_function::Params::try_get_input_data_ptr_or_request(), and ~LazyFunction().
|
virtual |
Get a name of the function or an input or output. This is mainly used for debugging. These are virtual functions because the names are often not used outside of debugging workflows. This way the names are only generated when they are actually needed.
Definition at line 13 of file lazy_function.cc.
References debug_name_.
Referenced by blender::nodes::LazyFunctionForJoinReferenceSets::execute_impl(), blender::nodes::LazyFunctionForExtractingReferenceSet::gather_references_from_field(), blender::fn::lazy_function::Node::name(), and ~LazyFunction().
|
virtual |
Reimplemented in blender::fn::lazy_function::GraphExecutor.
Definition at line 23 of file lazy_function.cc.
References outputs_.
Referenced by ~LazyFunction().
Outputs of the function.
Definition at line 336 of file FN_lazy_function.hh.
References outputs_.
Referenced by blender::fn::lazy_function::Params::get_output_data_ptr(), blender::fn::lazy_function::Params::get_output_usage(), blender::fn::lazy_function::Params::output_set(), blender::fn::lazy_function::Params::output_was_set(), and ~LazyFunction().
|
virtual |
Calls fn with the input indices that the given output_index may depend on. By default every output depends on every input.
Reimplemented in blender::fn::lazy_function::tests::PartialEvaluationTestFunction.
Definition at line 39 of file lazy_function.cc.
References inputs_.
Referenced by ~LazyFunction().
|
protected |
Allow executing the function even if previously requested values are not yet available.
Definition at line 255 of file FN_lazy_function.hh.
Referenced by allow_missing_requested_inputs(), always_used_inputs_available(), blender::fn::lazy_function::GraphExecutor::GraphExecutor(), and blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction().
|
protected |
Definition at line 249 of file FN_lazy_function.hh.
Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), execute(), blender::fn::lazy_function::GraphExecutor::GraphExecutor(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage::LazyFunctionForMenuSwitchSocketUsage(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), name(), blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction(), and blender::fn::lazy_function::tests::StoreValueFunction::StoreValueFunction().
Definition at line 250 of file FN_lazy_function.hh.
Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), always_used_inputs_available(), blender::nodes::LazyFunctionForLogicalOr::execute_impl(), input_name(), inputs(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::node_geo_menu_switch_cc::LazyFunctionForMenuSwitchSocketUsage::LazyFunctionForMenuSwitchSocketUsage(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction(), possible_output_dependencies(), and blender::fn::lazy_function::tests::StoreValueFunction::StoreValueFunction().
Definition at line 251 of file FN_lazy_function.hh.
Referenced by blender::fn::lazy_function::tests::AddLazyFunction::AddLazyFunction(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::execute_impl(), blender::nodes::LazyFunctionForEnableOutputSocketUsage::LazyFunctionForEnableOutputSocketUsage(), blender::nodes::LazyFunctionForExtractingReferenceSet::LazyFunctionForExtractingReferenceSet(), blender::nodes::LazyFunctionForIndexSwitchSocketUsage::LazyFunctionForIndexSwitchSocketUsage(), blender::nodes::LazyFunctionForJoinReferenceSets::LazyFunctionForJoinReferenceSets(), blender::nodes::LazyFunctionForLogicalOr::LazyFunctionForLogicalOr(), blender::nodes::LazyFunctionForSwitchSocketUsage::LazyFunctionForSwitchSocketUsage(), output_name(), outputs(), and blender::fn::lazy_function::tests::PartialEvaluationTestFunction::PartialEvaluationTestFunction().