BMesh: don't make threading threshold dependent on debug/release build

While it may be useful to detect threading issues for low poly meshes in debug
builds, it can also cause confusion when one breaks but not the other.

Further, having this logic for just a handlful bmesh functions while everything
else does not makes little sense.
This commit is contained in:
Brecht Van Lommel
2023-12-04 17:55:48 +01:00
committed by Brecht Van Lommel
parent 2609f16fc8
commit fc863c63e6
3 changed files with 7 additions and 11 deletions

View File

@@ -664,9 +664,5 @@ typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const BMLoop *, void *user_
#define BM_LOOP_RADIAL_MAX 10000
#define BM_NGON_MAX 100000
/* setting zero so we can catch bugs in OpenMP/BMesh */
#ifdef DEBUG
# define BM_OMP_LIMIT 0
#else
# define BM_OMP_LIMIT 10000
#endif
/* Minimum number of elements before using threading. */
#define BM_THREAD_LIMIT 10000

View File

@@ -381,7 +381,7 @@ static void bm_mesh_select_mode_flush_vert_to_edge(BMesh *bm)
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = bm->totedge >= BM_OMP_LIMIT;
settings.use_threading = bm->totedge >= BM_THREAD_LIMIT;
settings.userdata_chunk = &chunk_data;
settings.userdata_chunk_size = sizeof(chunk_data);
settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn;
@@ -397,7 +397,7 @@ static void bm_mesh_select_mode_flush_edge_to_face(BMesh *bm)
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = bm->totface >= BM_OMP_LIMIT;
settings.use_threading = bm->totface >= BM_THREAD_LIMIT;
settings.userdata_chunk = &chunk_data;
settings.userdata_chunk_size = sizeof(chunk_data);
settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn;

View File

@@ -212,7 +212,7 @@ static void bm_mesh_verts_calc_normals(BMesh *bm,
TaskParallelSettings settings;
BLI_parallel_mempool_settings_defaults(&settings);
settings.use_threading = bm->totvert >= BM_OMP_LIMIT;
settings.use_threading = bm->totvert >= BM_THREAD_LIMIT;
if (vcos == nullptr) {
BM_iter_parallel(bm, BM_VERTS_OF_MESH, bm_vert_calc_normals_cb, nullptr, &settings);
@@ -242,7 +242,7 @@ void BM_mesh_normals_update_ex(BMesh *bm, const BMeshNormalsUpdate_Params *param
/* Calculate all face normals. */
TaskParallelSettings settings;
BLI_parallel_mempool_settings_defaults(&settings);
settings.use_threading = bm->totedge >= BM_OMP_LIMIT;
settings.use_threading = bm->totedge >= BM_THREAD_LIMIT;
BM_iter_parallel(bm, BM_FACES_OF_MESH, bm_face_calc_normals_cb, nullptr, &settings);
}
@@ -1356,7 +1356,7 @@ static void bm_mesh_loops_calc_normals(BMesh *bm,
const bool do_rebuild,
const float split_angle_cos)
{
if (bm->totloop < BM_OMP_LIMIT) {
if (bm->totloop < BM_THREAD_LIMIT) {
bm_mesh_loops_calc_normals__single_threaded(bm,
vcos,
fnos,