Blender Git Loki

Git Commits -> Revision 4fe8d04

Revision 4fe8d04 by Jacques Lucke (master)
March 21, 2021, 18:33 (GMT)
Functions: refactor virtual array data structures

When a function is executed for many elements (e.g. per point) it is often the case
that some parameters are different for every element and other parameters are
the same (there are some more less common cases). To simplify writing such
functions one can use a "virtual array". This is a data structure that has a value
for every index, but might not be stored as an actual array internally. Instead, it
might be just a single value or is computed on the fly. There are various tradeoffs
involved when using this data structure which are mentioned in `BLI_virtual_array.hh`.
It is called "virtual", because it uses inheritance and virtual methods.

Furthermore, there is a new virtual vector array data structure, which is an array
of vectors. Both these types have corresponding generic variants, which can be used
when the data type is not known at compile time. This is typically the case when
building a somewhat generic execution system. The function system used these virtual
data structures before, but now they are more versatile.

I've done this refactor in preparation for the attribute processor and other features of
geometry nodes. I moved the typed virtual arrays to blenlib, so that they can be used
independent of the function system.

One open question for me is whether all the generic data structures (and `CPPType`)
should be moved to blenlib as well. They are well isolated and don't really contain
any business logic. That can be done later if necessary.

Commit Details:

Full Hash: 4fe8d0419c2f080a248f52b3924ce2a4e897e5cb
Parent Commit: 68c31c4
Lines Changed: +1655, -1422

10 Added Paths:

/source/blender/blenlib/BLI_virtual_array.hh (+211, -0) (View)
/source/blender/blenlib/BLI_virtual_vector_array.hh (+95, -0) (View)
/source/blender/blenlib/tests/BLI_virtual_array_test.cc (+31, -0) (View)
/source/blender/functions/FN_generic_span.hh (+158, -0) (View)
/source/blender/functions/FN_generic_virtual_array.hh (+275, -0) (View)
/source/blender/functions/FN_generic_virtual_vector_array.hh (+188, -0) (View)
/source/blender/functions/intern/generic_vector_array.cc (+104, -0) (View)
/source/blender/functions/intern/generic_virtual_array.cc (+107, -0) (View)
/source/blender/functions/intern/generic_virtual_vector_array.cc (+67, -0) (View)
/source/blender/functions/tests/FN_generic_span_test.cc (+53, -0) (View)

4 Deleted Paths:

/source/blender/functions/FN_array_spans.hh (+0, -206)
/source/blender/functions/FN_spans.hh (+0, -462)
/source/blender/functions/tests/FN_array_spans_test.cc (+0, -134)
/source/blender/functions/tests/FN_spans_test.cc (+0, -222)

17 Modified Paths:

/source/blender/blenkernel/BKE_attribute_access.hh (+1, -1) (Diff)
/source/blender/blenlib/CMakeLists.txt (+3, -0) (Diff)
/source/blender/functions/CMakeLists.txt (+7, -4) (Diff)
/source/blender/functions/FN_generic_vector_array.hh (+76, -119) (Diff)
/source/blender/functions/FN_multi_function_builder.hh (+37, -26) (Diff)
/source/blender/functions/FN_multi_function_params.hh (+45, -20) (Diff)
/source/blender/functions/FN_multi_function_signature.hh (+4, -4) (Diff)
/source/blender/functions/intern/multi_function_network_evaluation.cc (+109, -82) (Diff)
/source/blender/functions/tests/FN_generic_vector_array_test.cc (+25, -83) (Diff)
/source/blender/functions/tests/FN_multi_function_network_test.cc (+15, -18) (Diff)
/source/blender/functions/tests/FN_multi_function_test.cc (+30, -27) (Diff)
/source/blender/nodes/function/nodes/node_fn_object_transforms.cc (+1, -1) (Diff)
/source/blender/nodes/function/nodes/node_fn_random_float.cc (+3, -3) (Diff)
/source/blender/nodes/shader/nodes/node_shader_map_range.cc (+5, -5) (Diff)
/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc (+2, -2) (Diff)
/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.cc (+2, -2) (Diff)
/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc (+1, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021