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:
authorHans Goudey <h.goudey@me.com>2022-06-23 19:50:53 +0300
committerHans Goudey <h.goudey@me.com>2022-06-23 19:51:33 +0300
commit3e5a4d14124029dd3ccb111de2db299bb405d668 (patch)
treea9f0af8c3ca47b00037e4d7a8bd5f989d70be088 /source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
parent633c2f07da2926e42f5bb5d43d16dd23767c498c (diff)
Geometry Nodes: Optimize selection for virtual array input
This makes calculation of selected indices slightly faster when the input is a virtual array (the direct output of various nodes like Face Area, etc). The utility can be helpful for other areas that need to find selected indices besides field evaluation. With the face area node used as a selection with 4 million faces, the speedup is 3.51 ms to 3.39 ms, just a slight speedup. Differential Revision: https://developer.blender.org/D15127
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
index bd015784ad7..0fb4ded3b2a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
@@ -177,10 +177,8 @@ static IndexMask get_selected_indices(const Mesh &mesh,
ATTR_DOMAIN_FACE,
domain);
- return index_mask_ops::find_indices_based_on_predicate(
- IndexMask(component.attribute_domain_num(domain)), 4096, indices, [&](const int i) {
- return selection[i];
- });
+ return index_mask_ops::find_indices_from_virtual_array(
+ IndexMask(component.attribute_domain_num(domain)), selection, 4096, indices);
}
if (mesh.editflag & ME_EDIT_PAINT_VERT_SEL) {
const VArray<bool> selection = component.attribute_try_adapt_domain(
@@ -188,10 +186,8 @@ static IndexMask get_selected_indices(const Mesh &mesh,
ATTR_DOMAIN_POINT,
domain);
- return index_mask_ops::find_indices_based_on_predicate(
- IndexMask(component.attribute_domain_num(domain)), 4096, indices, [&](const int i) {
- return selection[i];
- });
+ return index_mask_ops::find_indices_from_virtual_array(
+ IndexMask(component.attribute_domain_num(domain)), selection, 4096, indices);
}
return IndexMask(component.attribute_domain_num(domain));
}