correct error in recent changes for building with openmp.

rename DM_OMP_LIMIT to BKE_MESH_OMP_LIMIT and set to 0 when in debug mode, same for BM_OMP_LIMIT.
This commit is contained in:
Campbell Barton 2013-09-09 05:42:26 +00:00
parent 66efedd096
commit 00bd7da674
8 changed files with 19 additions and 9 deletions

View File

@ -97,8 +97,6 @@ struct BMEditMesh;
struct ListBase;
struct PBVH;
#define DM_OMP_LIMIT 10000 /* setting zero so we can catch bugs in OpenMP/BMesh */
/* number of sub-elements each mesh element has (for interpolation) */
#define SUB_ELEMS_VERT 0
#define SUB_ELEMS_EDGE 2

View File

@ -63,6 +63,12 @@ struct UvElement;
extern "C" {
#endif
/* setting zero so we can catch bugs in OpenMP/BMesh */
#ifdef DEBUG
# define BKE_MESH_OMP_LIMIT 0
#else
# define BKE_MESH_OMP_LIMIT 10000
#endif
/* *** mesh.c *** */

View File

@ -1685,7 +1685,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
DM_add_poly_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
#pragma omp parallel sections if (dm->numVertData + dm->numEdgeData + dm->numPolyData >= DM_OMP_LIMIT)
#pragma omp parallel sections if (dm->numVertData + dm->numEdgeData + dm->numPolyData >= BKE_MESH_OMP_LIMIT)
{
#pragma omp section
{ range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0); }

View File

@ -168,7 +168,7 @@ static void mesh_calc_normals_poly_accum(MPoly *mp, MLoop *ml,
v_curr = mvert[ml[i].v].co;
add_newell_cross_v3_v3v3(polyno, v_prev, v_curr);
/* Unrelated to normalize, calcualte edge-vector */
/* Unrelated to normalize, calculate edge-vector */
sub_v3_v3v3(edgevecbuf[i_prev], v_prev, v_curr);
normalize_v3(edgevecbuf[i_prev]);
i_prev = i;
@ -212,7 +212,7 @@ void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly
if (only_face_normals) {
BLI_assert(pnors != NULL);
#pragma omp parallel for if (numPolys > BM_OMP_LIMIT)
#pragma omp parallel for if (numPolys > BKE_MESH_OMP_LIMIT)
for (i = 0; i < numPolys; i++) {
BKE_mesh_calc_poly_normal(&mpolys[i], mloop + mpolys[i].loopstart, mverts, pnors[i]);
}

View File

@ -292,6 +292,12 @@ typedef bool (*BMElemFilterFunc)(BMElem *, void *user_data);
* but should not error on valid cases */
#define BM_LOOP_RADIAL_MAX 10000
#define BM_NGON_MAX 100000
#define BM_OMP_LIMIT 10000 /* 10000 */ /* setting zero so we can catch bugs in OpenMP/BMesh */
/* setting zero so we can catch bugs in OpenMP/BMesh */
#ifdef DEBUG
# define BM_OMP_LIMIT 0
#else
# define BM_OMP_LIMIT 10000
#endif
#endif /* __BMESH_CLASS_H__ */

View File

@ -47,7 +47,7 @@ static bool bmo_recalc_normal_edge_filter_cb(BMElem *ele, void *UNUSED(user_data
}
/**
* Given an array of faces, recalcualte their normals.
* Given an array of faces, recalculate their normals.
* this functions assumes all faces in the array are connected by edges.
*
* \param bm

View File

@ -2924,7 +2924,7 @@ static void edbm_fill_grid_prepare(BMesh *bm, int offset, int *r_span, bool span
/* calculate the span by finding the next corner in 'verts'
* we dont know what defines a corner exactly so find the 4 verts
* in the loop with the greatest angle.
* Tag them and use the first tagged vertex to calcualte the span.
* Tag them and use the first tagged vertex to calculate the span.
*
* note: we may have already checked 'edbm_fill_grid_vert_tag_angle()' on each
* vert, but advantage of de-duplicating is minimal. */

View File

@ -109,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
edgeMap = MEM_mallocN(sizeof(*edgeMap) * numEdge_src, "build modifier edgeMap");
faceMap = MEM_mallocN(sizeof(*faceMap) * numPoly_src, "build modifier faceMap");
#pragma omp parallel sections if (numVert_src + numEdge_src + numPoly_src >= DM_OMP_LIMIT)
#pragma omp parallel sections if (numVert_src + numEdge_src + numPoly_src >= BKE_MESH_OMP_LIMIT)
{
#pragma omp section
{ range_vn_i(vertMap, numVert_src, 0); }