From 65d294c38554b222d8aa70bbad39e9fc0edcd076 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 8 Jun 2023 16:26:11 -0400 Subject: [PATCH] Geometry Nodes: Use smaller grain size for sampe nearest surface node This increases the framerate in a production file from about 2.3 to 2.5 FPS, and reduces gaps in a profile where the CPU was waiting for just a few threads to finish the BVH tree lookups. If BVH lookups become faster in the future, this grain size could be increased. --- .../geometry/nodes/node_geo_sample_nearest_surface.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc index f4520a16d3a..0d59f52cadf 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc @@ -140,6 +140,13 @@ class SampleNearestSurfaceFunction : public mf::MultiFunction { const Mesh &mesh = *source_.get_mesh_for_read(); get_closest_mesh_looptris(mesh, positions, mask, triangle_index, {}, sample_position); } + + ExecutionHints get_execution_hints() const override + { + ExecutionHints hints; + hints.min_grain_size = 512; + return hints; + } }; static GField get_input_attribute_field(GeoNodeExecParams ¶ms, const eCustomDataType data_type)