diff options
author | Jacques Lucke <jacques@blender.org> | 2021-09-14 15:52:44 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-09-14 15:52:44 +0300 |
commit | fd60f6713a9d9e6f7d706b53bf1311f2f1cd9031 (patch) | |
tree | bb762d4ce5e5ad76a52d594249e8c6ec33b08312 /source/blender/functions/FN_multi_function.hh | |
parent | 90a48fa06414ccf5fc5dd6092917413180ff30d1 (diff) |
Functions: support optional outputs in multi-function
Sometimes not all outputs of a multi-function are required by the
caller. In those cases it would be a waste of compute resources
to calculate the unused values anyway. Now, the caller of a
multi-function can specify when a specific output is not used.
The called function can check if an output is unused and may
ignore it. Multi-functions can still computed unused outputs as
before if they don't want to check if a specific output is unused.
The multi-function procedure system has been updated to support
ignored outputs in call instructions. An ignored output just has no
variable assigned to it.
The field system has been updated to generate a multi-function
procedure where unused outputs are ignored.
Diffstat (limited to 'source/blender/functions/FN_multi_function.hh')
-rw-r--r-- | source/blender/functions/FN_multi_function.hh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh index f6c4addfb52..98788025558 100644 --- a/source/blender/functions/FN_multi_function.hh +++ b/source/blender/functions/FN_multi_function.hh @@ -121,8 +121,13 @@ class MultiFunction { } }; -inline MFParamsBuilder::MFParamsBuilder(const class MultiFunction &fn, int64_t min_array_size) - : MFParamsBuilder(fn.signature(), min_array_size) +inline MFParamsBuilder::MFParamsBuilder(const MultiFunction &fn, int64_t mask_size) + : MFParamsBuilder(fn.signature(), IndexMask(mask_size)) +{ +} + +inline MFParamsBuilder::MFParamsBuilder(const MultiFunction &fn, const IndexMask *mask) + : MFParamsBuilder(fn.signature(), *mask) { } |