[Bf-blender-cvs] [df94a77] master: BMesh: avoid using OpenMP when nothing to do
Campbell Barton
noreply at git.blender.org
Thu Jun 5 00:16:44 CEST 2014
Commit: df94a773b6bc8e63dfeb4d7c09e1f8a7583c0c56
Author: Campbell Barton
Date: Thu Jun 5 08:10:26 2014 +1000
https://developer.blender.org/rBdf94a773b6bc8e63dfeb4d7c09e1f8a7583c0c56
BMesh: avoid using OpenMP when nothing to do
Gave slowdown drawing on high poly meshes
===================================================================
M source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 7df3f0e..0c50cca 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
{
More information about the Bf-blender-cvs
mailing list