diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-14 19:18:20 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-14 19:18:20 +0300 |
commit | 460fe4a10cccf697c742431de89ee2e577e11902 (patch) | |
tree | 372fb7e7fbfc7228e6f74ab7c3ad3b7b716d6c7a /source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc | |
parent | 390320a151e23cd1ab9a3d5a44abee2897c133d4 (diff) |
Curves: Improve sculpting performance by reducing allocations
The snake hook and grow/shrink brushes need some arrays for input
to the length paramterization code. These were allocated and freed
for every curve. Instead, use a local buffer for each task execution.
Differential Revision: https://developer.blender.org/D15964
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc index 0ca22004540..bc354ed66f4 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc @@ -141,11 +141,11 @@ class ExtrapolateCurvesEffect : public CurvesEffect { { MutableSpan<float3> positions_cu = curves.positions_for_write(); threading::parallel_for(curve_indices.index_range(), 256, [&](const IndexRange range) { + MoveAndResampleBuffers resample_buffer; for (const int influence_i : range) { const int curve_i = curve_indices[influence_i]; const float move_distance_cu = move_distances_cu[influence_i]; const IndexRange points = curves.points_for_curve(curve_i); - if (points.size() <= 1) { continue; } @@ -157,7 +157,7 @@ class ExtrapolateCurvesEffect : public CurvesEffect { const float3 direction = math::normalize(old_last_pos_cu - direction_reference_point); const float3 new_last_pos_cu = old_last_pos_cu + direction * move_distance_cu; - move_last_point_and_resample(positions_cu.slice(points), new_last_pos_cu); + move_last_point_and_resample(resample_buffer, positions_cu.slice(points), new_last_pos_cu); } }); } |