[Bf-blender-cvs] [535f50e5a6a] master: Curves: Use early out when apapting domain of single value
Hans Goudey
noreply at git.blender.org
Sat Sep 24 16:31:33 CEST 2022
Commit: 535f50e5a6a248b7aa74b590b9d9544721902080
Author: Hans Goudey
Date: Fri Sep 23 16:43:42 2022 -0500
Branches: master
https://developer.blender.org/rB535f50e5a6a248b7aa74b590b9d9544721902080
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.
===================================================================
M source/blender/blenkernel/intern/curves_geometry.cc
===================================================================
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);
More information about the Bf-blender-cvs
mailing list