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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:09:41 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:09:41 +0400
commite0368d31a5b3a593d9650de688fdaf77e6975103 (patch)
tree2beda97970dc6e435ae1af16eb008a8237c668b1 /source
parent844274c27ab557c53288ead3944c2981e700f962 (diff)
Enabled openmp multithreading for multires/subsurf again, but only
if there are >= 1 million faces estimated in the resulting mesh. (merge from render25 branch)
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c18
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.h4
-rw-r--r--source/blender/blenkernel/intern/multires.c4
3 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 8fad398f00a..bbd68fb797b 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1159,7 +1159,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
int normalDataOffset = ss->normalDataOffset;
int vertDataSize = ss->meshIFC.vertDataSize;
- //#pragma omp parallel for private(ptrIdx) schedule(static)
+ #pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
CCGFace *f = (CCGFace*) effectedF[ptrIdx];
int S, x, y;
@@ -1285,7 +1285,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
}
}
- //#pragma omp parallel for private(ptrIdx) schedule(static)
+ #pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
CCGFace *f = (CCGFace*) effectedF[ptrIdx];
int S, x, y;
@@ -1351,7 +1351,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
int vertDataSize = ss->meshIFC.vertDataSize;
void *q = ss->q, *r = ss->r;
- //#pragma omp parallel for private(ptrIdx) schedule(static)
+ #pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
CCGFace *f = (CCGFace*) effectedF[ptrIdx];
int S, x, y;
@@ -1685,17 +1685,17 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
}
}
- //#pragma omp parallel private(ptrIdx)
+ #pragma omp parallel private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
{
void *q, *r;
- //#pragma omp critical
+ #pragma omp critical
{
q = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf q");
r = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf r");
}
- //#pragma omp for schedule(static)
+ #pragma omp for schedule(static)
for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
CCGFace *f = (CCGFace*) effectedF[ptrIdx];
int S, x, y;
@@ -1779,7 +1779,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
}
}
- //#pragma omp critical
+ #pragma omp critical
{
MEM_freeN(q);
MEM_freeN(r);
@@ -1791,14 +1791,14 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
gridSize = 1 + (1<<((nextLvl)-1));
cornerIdx = gridSize-1;
- //#pragma omp parallel for private(i) schedule(static)
+ #pragma omp parallel for private(i) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
for (i=0; i<numEffectedE; i++) {
CCGEdge *e = effectedE[i];
VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl));
VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize-1), VERT_getCo(e->v1, nextLvl));
}
- //#pragma omp parallel for private(i) schedule(static)
+ #pragma omp parallel for private(i) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
for (i=0; i<numEffectedF; i++) {
CCGFace *f = effectedF[i];
int S, x;
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 12212c7a37b..34d684221b0 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -39,6 +39,10 @@ typedef enum {
/***/
+#define CCG_OMP_LIMIT 1000000
+
+/***/
+
typedef struct _CCGSubSurf CCGSubSurf;
CCGSubSurf* ccgSubSurf_new (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator);
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index d567e0f0408..aab9f2a0935 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -560,7 +560,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int
dGridSize = multires_side_tot[totlvl];
dSkip = (dGridSize-1)/(gridSize-1);
- //#pragma omp parallel for private(i) schedule(static)
+ #pragma omp parallel for private(i) if(me->totface*gridSize*gridSize*4 >= CCG_OMP_LIMIT)
for(i = 0; i < me->totface; ++i) {
const int numVerts = mface[i].v4 ? 4 : 3;
MDisps *mdisp = &mdisps[i];
@@ -568,7 +568,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int
/* when adding new faces in edit mode, need to allocate disps */
if(!mdisp->disps)
- //#pragma omp critical
+ #pragma omp critical
{
multires_reallocate_mdisps(me, mdisps, totlvl);
}