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
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-24 00:43:42 +0300
committerHans Goudey <h.goudey@me.com>2022-09-24 17:31:15 +0300
commit535f50e5a6a248b7aa74b590b9d9544721902080 (patch)
treeac0e8897fa76094862c6ae06217f68f2a4354d4b /source
parentc25df02ac3036449081701349d36d2f16b2c92f2 (diff)
Curves: Use early out when apapting domain of single value
When adapting the domain of a single value virtual array, skip allocating an array for the result and just return another single value. Among other cases, this can help when everything is selected in sculpt mode, moving domain interpolation from 5% of perf samples to 0% when sculpting.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/curves_geometry.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index 06789e34ad4..86bf3115c36 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -1558,6 +1558,11 @@ GVArray CurvesGeometry::adapt_domain(const GVArray &varray,
if (from == to) {
return varray;
}
+ if (varray.is_single()) {
+ BUFFER_FOR_CPP_TYPE_VALUE(varray.type(), value);
+ varray.get_internal_single(value);
+ return GVArray::ForSingle(varray.type(), this->attributes().domain_size(to), value);
+ }
if (from == ATTR_DOMAIN_POINT && to == ATTR_DOMAIN_CURVE) {
return adapt_curve_domain_point_to_curve(*this, varray);