Fix #131139: Small brush radius and alpha texture degrades performance

The call to `sculpt_apply_texture` is not thread safe and as such is a
major bottleneck in brush stroke processing. In previous versions, we
avoided calculating this if the vertex position was outside of the brush
radius.

To fix this, we add a check for the factor already being 0 and prevent
further texture calculations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131256
This commit is contained in:
Sean Kim
2024-12-03 21:52:50 +01:00
committed by Sean Kim
parent c4d5145070
commit d8bec5faee

View File

@@ -6939,6 +6939,9 @@ void calc_brush_texture_factors(const SculptSession &ss,
}
for (const int i : verts.index_range()) {
if (factors[i] == 0.0f) {
continue;
}
float texture_value;
float4 texture_rgba;
/* NOTE: This is not a thread-safe call. */
@@ -6963,6 +6966,9 @@ void calc_brush_texture_factors(const SculptSession &ss,
}
for (const int i : positions.index_range()) {
if (factors[i] == 0.0f) {
continue;
}
float texture_value;
float4 texture_rgba;
/* NOTE: This is not a thread-safe call. */