diff options
author | Iliay Katueshenock <Moder> | 2022-07-26 12:06:49 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-26 12:10:16 +0300 |
commit | c94ca54cdafdba15d5a7be55e81d6f7a0da7ed7e (patch) | |
tree | fe6644d41f65b4e1d5861c33b465b6371b49306c /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc | |
parent | 203e7ba3320e7ed978ec094efa0c1b22137fb12a (diff) |
BLI: add use_threading parameter to parallel_invoke
`parallel_invoke` allows executing functions on separate threads.
However, creating tasks in tbb has a measurable amount of overhead.
Therefore, it can be benefitial to disable parallelization when
the amount of work done per function is small.
See D15539 for some benchmark results.
Differential Revision: https://developer.blender.org/D15539
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index a46bb40a3eb..85facf1e758 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -307,6 +307,7 @@ static Mesh *create_uv_sphere_mesh(const float radius, const int segments, const MutableSpan<MPoly> polys{mesh->mpoly, mesh->totpoly}; threading::parallel_invoke( + 1024 < segments * rings, [&]() { MutableSpan vert_normals{(float3 *)BKE_mesh_vertex_normals_for_write(mesh), mesh->totvert}; calculate_sphere_vertex_data(verts, vert_normals, radius, segments, rings); |