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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-11-24 13:23:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-11-24 13:25:19 +0300
commitedb2e96cd52e298cd24ee6df2f9281a994492771 (patch)
tree9295576521ff60c6a3c2c57a909368b0b2cd1a39 /source/blender/blenkernel/intern/CCGSubSurf_legacy.c
parent678fe87c8524fb943f7c34617571a79e6c232ae9 (diff)
Fix T46851: Crash on multires more than million
yet another bug introduced by recent shadowing changes -- q and r CCG arrays were overwritten by the temporary evaluation because the code was changed to use global pointers instead of the local ones. Naming of the variables could be changed to be a bit more accurate.
Diffstat (limited to 'source/blender/blenkernel/intern/CCGSubSurf_legacy.c')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_legacy.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index afa44048317..e9002af19b1 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -684,10 +684,12 @@ static void ccgSubSurf__calcSubdivLevel(
#pragma omp parallel private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
{
+ float *q_thread, *r_thread;
+
#pragma omp critical
{
- q = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf q");
- r = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf r");
+ q_thread = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf q");
+ r_thread = MEM_mallocN(ss->meshIFC.vertDataSize, "CCGSubsurf r");
}
#pragma omp for schedule(static)
@@ -700,20 +702,20 @@ static void ccgSubSurf__calcSubdivLevel(
* - old interior edge points
* - new interior face midpoints
*/
- VertDataZero(q, ss);
+ VertDataZero(q_thread, ss);
for (S = 0; S < f->numVerts; S++) {
- VertDataAdd(q, FACE_getIFCo(f, nextLvl, S, 1, 1), ss);
+ VertDataAdd(q_thread, FACE_getIFCo(f, nextLvl, S, 1, 1), ss);
}
- VertDataMulN(q, 1.0f / f->numVerts, ss);
- VertDataZero(r, ss);
+ VertDataMulN(q_thread, 1.0f / f->numVerts, ss);
+ VertDataZero(r_thread, ss);
for (S = 0; S < f->numVerts; S++) {
- VertDataAdd(r, FACE_getIECo(f, curLvl, S, 1), ss);
+ VertDataAdd(r_thread, FACE_getIECo(f, curLvl, S, 1), ss);
}
- VertDataMulN(r, 1.0f / f->numVerts, ss);
+ VertDataMulN(r_thread, 1.0f / f->numVerts, ss);
VertDataMulN((float *)FACE_getCenterData(f), f->numVerts - 2.0f, ss);
- VertDataAdd((float *)FACE_getCenterData(f), q, ss);
- VertDataAdd((float *)FACE_getCenterData(f), r, ss);
+ VertDataAdd((float *)FACE_getCenterData(f), q_thread, ss);
+ VertDataAdd((float *)FACE_getCenterData(f), r_thread, ss);
VertDataMulN((float *)FACE_getCenterData(f), 1.0f / f->numVerts, ss);
for (S = 0; S < f->numVerts; S++) {
@@ -729,14 +731,14 @@ static void ccgSubSurf__calcSubdivLevel(
const float *co = FACE_getIFCo(f, curLvl, S, x, y);
float *nCo = FACE_getIFCo(f, nextLvl, S, fx, fy);
- VertDataAvg4(q,
+ VertDataAvg4(q_thread,
FACE_getIFCo(f, nextLvl, S, fx - 1, fy - 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy - 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 1),
FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 1),
ss);
- VertDataAvg4(r,
+ VertDataAvg4(r_thread,
FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 0),
FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 0),
FACE_getIFCo(f, nextLvl, S, fx + 0, fy - 1),
@@ -744,9 +746,9 @@ static void ccgSubSurf__calcSubdivLevel(
ss);
VertDataCopy(nCo, co, ss);
- VertDataSub(nCo, q, ss);
+ VertDataSub(nCo, q_thread, ss);
VertDataMulN(nCo, 0.25f, ss);
- VertDataAdd(nCo, r, ss);
+ VertDataAdd(nCo, r_thread, ss);
}
}
@@ -760,13 +762,13 @@ static void ccgSubSurf__calcSubdivLevel(
const float *co = FACE_getIECo(f, curLvl, S, x);
float *nCo = FACE_getIECo(f, nextLvl, S, fx);
- VertDataAvg4(q,
+ VertDataAvg4(q_thread,
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx - 1),
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx + 1),
FACE_getIFCo(f, nextLvl, S, fx + 1, +1),
FACE_getIFCo(f, nextLvl, S, fx - 1, +1), ss);
- VertDataAvg4(r,
+ VertDataAvg4(r_thread,
FACE_getIECo(f, nextLvl, S, fx - 1),
FACE_getIECo(f, nextLvl, S, fx + 1),
FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx),
@@ -774,17 +776,17 @@ static void ccgSubSurf__calcSubdivLevel(
ss);
VertDataCopy(nCo, co, ss);
- VertDataSub(nCo, q, ss);
+ VertDataSub(nCo, q_thread, ss);
VertDataMulN(nCo, 0.25f, ss);
- VertDataAdd(nCo, r, ss);
+ VertDataAdd(nCo, r_thread, ss);
}
}
}
#pragma omp critical
{
- MEM_freeN(q);
- MEM_freeN(r);
+ MEM_freeN(q_thread);
+ MEM_freeN(r_thread);
}
}