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:
authorCampbell Barton <ideasman42@gmail.com>2014-06-05 02:10:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-05 02:13:55 +0400
commitdf94a773b6bc8e63dfeb4d7c09e1f8a7583c0c56 (patch)
treeed0166c91ec22b7ec2eb12df3b40f1a489c9fdb9 /source/blender/bmesh/intern/bmesh_mesh.c
parentdc2daf7a6786110a77cebc5ad8ea7a118d156d61 (diff)
BMesh: avoid using OpenMP when nothing to do
Gave slowdown drawing on high poly meshes
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 7df3f0e8367..0c50cca5de1 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1004,6 +1004,10 @@ void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
/* in debug mode double check we didn't need to recalculate */
BLI_assert(BM_mesh_elem_table_check(bm) == true);
+ if (htype_needed == 0) {
+ return;
+ }
+
if (htype_needed & BM_VERT) {
if (bm->vtable && bm->totvert <= bm->vtable_tot && bm->totvert * 2 >= bm->vtable_tot) {
/* pass (re-use the array) */
@@ -1038,7 +1042,9 @@ void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
}
}
-#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
+ /* skip if we only need to operate on one element */
+#pragma omp parallel sections if ((!ELEM3(htype_needed, BM_VERT, BM_EDGE, BM_FACE)) && \
+ (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT))
{
#pragma omp section
{