|
Blender V4.3
|
#include "BLI_cpp_type.hh"#include "BLI_function_ref.hh"#include "BLI_generic_pointer.hh"#include "BLI_linear_allocator.hh"#include "BLI_vector.hh"#include <atomic>#include <thread>Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::fn |
| namespace | blender::fn::lazy_function |
Macros | |
| #define | FN_LAZY_FUNCTION_DEBUG_THREADS |
Enumerations | |
| enum class | blender::fn::lazy_function::ValueUsage : uint8_t { blender::fn::lazy_function::Used , blender::fn::lazy_function::Maybe , blender::fn::lazy_function::Unused } |
A LazyFunction encapsulates a computation which has inputs, outputs and potentially side effects. Most importantly, a LazyFunction supports laziness in its inputs and outputs:
A lazy-function that uses laziness may be executed more than once. The most common example is the geometry nodes switch node. Depending on a condition input, it decides which one of the other inputs is actually used. From the perspective of the switch node, its execution works as follows:
In some sense, a lazy-function can be thought of like a state machine. Every time it is executed, it advances its state until all required outputs are ready.
The lazy-function interface is designed to support composition of many such functions into a new lazy-functions, all while keeping the laziness working. For example, in geometry nodes a switch node in a node group should still be able to decide whether a node in the parent group will be executed or not. This is essential to avoid doing unnecessary work.
The lazy-function system consists of multiple core components:
Definition in file FN_lazy_function.hh.
| #define FN_LAZY_FUNCTION_DEBUG_THREADS |
Definition at line 53 of file FN_lazy_function.hh.