diff options
author | Jacques Lucke <jacques@blender.org> | 2021-03-21 21:31:24 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-21 21:33:13 +0300 |
commit | 4fe8d0419c2f080a248f52b3924ce2a4e897e5cb (patch) | |
tree | 81aba45e26cca99578087835184ce5664362b791 /source/blender/blenlib/CMakeLists.txt | |
parent | 68c31c41e52caa1ac5b527f835b16f8e298dfd86 (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/CMakeLists.txt')
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 5a851b7b2cb..37b0f742b8b 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -296,6 +296,8 @@ set(SRC BLI_vector_set.hh BLI_vector_set_slots.hh BLI_vfontdata.h + BLI_virtual_array.hh + BLI_virtual_vector_array.hh BLI_voronoi_2d.h BLI_voxel.h BLI_winstuff.h @@ -432,6 +434,7 @@ if(WITH_GTESTS) tests/BLI_task_test.cc tests/BLI_vector_set_test.cc tests/BLI_vector_test.cc + tests/BLI_virtual_array_test.cc tests/BLI_exception_safety_test_utils.hh ) |