Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-04-29 13:59:44 +0300
committerJacques Lucke <jacques@blender.org>2021-04-29 13:59:44 +0300
commit4e10b196ac15339cfded8d5615f04ac40c93e19b (patch)
treea2288584d4433f1a32047adb393edb51cf863165 /source/blender/functions/FN_generic_virtual_array.hh
parentf903e3a3fd003e5295f7aea35710a77b2e74f846 (diff)
Functions: make copying virtual arrays to span more efficient
Sometimes functions expect a span instead of a virtual array. If the virtual array is a span internally already, great. But if it is not (e.g. the position attribute on a mesh), the elements have to be copied over to a span. This patch makes the copying process more efficient by giving the compiler more opportunity for optimization.
Diffstat (limited to 'source/blender/functions/FN_generic_virtual_array.hh')
-rw-r--r--source/blender/functions/FN_generic_virtual_array.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh
index c1af00fd4cd..848deb6bc04 100644
--- a/source/blender/functions/FN_generic_virtual_array.hh
+++ b/source/blender/functions/FN_generic_virtual_array.hh
@@ -128,6 +128,7 @@ class GVArray {
this->get_internal_single(r_value);
}
+ void materialize_to_uninitialized(void *dst) const;
void materialize_to_uninitialized(const IndexMask mask, void *dst) const;
template<typename T> const VArray<T> *try_get_internal_varray() const
@@ -152,6 +153,8 @@ class GVArray {
virtual bool is_single_impl() const;
virtual void get_internal_single_impl(void *UNUSED(r_value)) const;
+ virtual void materialize_to_uninitialized_impl(const IndexMask mask, void *dst) const;
+
virtual const void *try_get_internal_varray_impl() const;
};
@@ -361,6 +364,11 @@ template<typename T> class GVArray_For_VArray : public GVArray {
*(T *)r_value = varray_->get_internal_single();
}
+ void materialize_to_uninitialized_impl(const IndexMask mask, void *dst) const override
+ {
+ varray_->materialize_to_uninitialized(mask, MutableSpan((T *)dst, mask.min_array_size()));
+ }
+
const void *try_get_internal_varray_impl() const override
{
return varray_;