Blender V4.3
FN_multi_function.hh File Reference

Go to the source code of this file.

Classes

class  blender::fn::multi_function::MultiFunction
 
struct  blender::fn::multi_function::MultiFunction::ExecutionHints
 

Namespaces

namespace  blender
 
namespace  blender::fn
 
namespace  blender::fn::multi_function
 

Detailed Description

A MultiFunction encapsulates a function that is optimized for throughput (instead of latency). The throughput is optimized by always processing many elements at once, instead of each element separately. This is ideal for functions that are evaluated often (e.g. for every particle).

By processing a lot of data at once, individual functions become easier to optimize for humans and for the compiler. Furthermore, performance profiles become easier to understand and show better where bottlenecks are.

Every multi-function has a name and an ordered list of parameters. Parameters are used for input and output. In fact, there are three kinds of parameters: inputs, outputs and mutable (which is combination of input and output).

To call a multi-function, one has to provide three things:

  • Params: This references the input and output arrays that the function works with. The arrays are not owned by Params.
  • IndexMask: An array of indices indicating which indices in the provided arrays should be touched/processed.
  • Context: Further information for the called function.

A new multi-function is generally implemented as follows:

  1. Create a new subclass of MultiFunction.
  2. Implement a constructor that initialized the signature of the function.
  3. Override the call function.

Definition in file FN_multi_function.hh.