diff options
author | Jacques Lucke <jacques@blender.org> | 2021-05-10 11:28:24 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-05-10 11:28:24 +0300 |
commit | 0061150e4c90de474a38bd2eeeea7fe0d12de353 (patch) | |
tree | 64c8daef509e1b7801f110eaab8f61e0d4ec1887 /source/blender/functions/intern/generic_virtual_array.cc | |
parent | f2370bb22d7fd9b03a46c2df1f0eb9c2cd6676b2 (diff) |
Functions: support materialize virtual array to initialized span
Diffstat (limited to 'source/blender/functions/intern/generic_virtual_array.cc')
-rw-r--r-- | source/blender/functions/intern/generic_virtual_array.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/functions/intern/generic_virtual_array.cc b/source/blender/functions/intern/generic_virtual_array.cc index ca2bd0f806f..a835e7a54a9 100644 --- a/source/blender/functions/intern/generic_virtual_array.cc +++ b/source/blender/functions/intern/generic_virtual_array.cc @@ -53,6 +53,24 @@ class GVArray_For_ShallowCopy : public GVArray { * GVArray. */ +void GVArray::materialize(void *dst) const +{ + this->materialize(IndexMask(size_), dst); +} + +void GVArray::materialize(const IndexMask mask, void *dst) const +{ + this->materialize_impl(mask, dst); +} + +void GVArray::materialize_impl(const IndexMask mask, void *dst) const +{ + for (const int64_t i : mask) { + void *elem_dst = POINTER_OFFSET(dst, type_->size() * i); + this->get(i, elem_dst); + } +} + void GVArray::materialize_to_uninitialized(void *dst) const { this->materialize_to_uninitialized(IndexMask(size_), dst); |