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>2012-04-16 10:48:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-16 10:48:57 +0400
commit0635f8101c98d74da729d464472a4d9efa09337f (patch)
tree2588585adbcd09b0e14497d12a8403488bfe2efb /source/blender/blenkernel/intern
parentfb1e60762f3a4c32b3ae57824f5bcbb984b33cbc (diff)
make scanfill threadsafe (wasnt threadsafe before BMesh merge but before the merge it didn't need to be) - now rendering uses its better if its threadsafe.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/displist.c17
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c16
-rw-r--r--source/blender/blenkernel/intern/mesh.c16
3 files changed, 26 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index cefc0fba9cd..01d5d6ef2ad 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -416,6 +416,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
{
+ ScanFillContext sf_ctx;
ScanFillVert *eve, *v1, *vlast;
ScanFillFace *efa;
DispList *dlnew=NULL, *dl;
@@ -431,7 +432,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
totvert= 0;
nextcol= 0;
- BLI_begin_edgefill();
+ BLI_begin_edgefill(&sf_ctx);
dl= dispbase->first;
while (dl) {
@@ -448,18 +449,18 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
while (a--) {
vlast= eve;
- eve= BLI_addfillvert(f1);
+ eve = BLI_addfillvert(&sf_ctx, f1);
totvert++;
if (vlast==NULL) v1= eve;
else {
- BLI_addfilledge(vlast, eve);
+ BLI_addfilledge(&sf_ctx, vlast, eve);
}
f1+=3;
}
if (eve!=NULL && v1!=NULL) {
- BLI_addfilledge(eve, v1);
+ BLI_addfilledge(&sf_ctx, eve, v1);
}
}
else if (colnr<dl->col) {
@@ -472,7 +473,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
dl= dl->next;
}
- if (totvert && (tot= BLI_edgefill(FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+ if (totvert && (tot= BLI_edgefill(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
if (tot) {
dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type= DL_INDEX3;
@@ -486,7 +487,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
/* vert data */
f1= dlnew->verts;
totvert= 0;
- eve= fillvertbase.first;
+ eve= sf_ctx.fillvertbase.first;
while (eve) {
copy_v3_v3(f1, eve->co);
f1+= 3;
@@ -499,7 +500,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
}
/* index data */
- efa= fillfacebase.first;
+ efa = sf_ctx.fillfacebase.first;
index= dlnew->index;
while (efa) {
index[0]= (intptr_t)efa->v1->tmp.l;
@@ -517,7 +518,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
BLI_addhead(to, dlnew);
}
- BLI_end_edgefill();
+ BLI_end_edgefill(&sf_ctx);
if (nextcol) {
/* stay at current char but fill polys with next material */
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 75f6abc6c74..07a43db8560 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -120,6 +120,8 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
BMLoop *l;
int i = 0, j;
+ ScanFillContext sf_ctx;
+
#if 0
/* note, we could be clever and re-use this array but would need to ensure
* its realloced at some point, for now just free it */
@@ -195,18 +197,18 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
ScanFillFace *efa;
int totfilltri;
- BLI_begin_edgefill();
+ BLI_begin_edgefill(&sf_ctx);
/*scanfill time*/
l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
for (j=0; l; l=BM_iter_step(&liter), j++) {
/*mark order*/
BM_elem_index_set(l, j); /* set_loop */
- v = BLI_addfillvert(l->v->co);
+ v = BLI_addfillvert(&sf_ctx, l->v->co);
v->tmp.p = l;
if (lastv) {
- /* e = */ BLI_addfilledge(lastv, v);
+ /* e = */ BLI_addfilledge(&sf_ctx, lastv, v);
}
lastv = v;
@@ -214,12 +216,12 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
}
/*complete the loop*/
- BLI_addfilledge(firstv, v);
+ BLI_addfilledge(&sf_ctx, firstv, v);
- totfilltri = BLI_edgefill(FALSE);
+ totfilltri = BLI_edgefill(&sf_ctx, FALSE);
BLI_array_growitems(looptris, totfilltri);
- for (efa = fillfacebase.first; efa; efa=efa->next) {
+ for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) {
BMLoop *l1= efa->v1->tmp.p;
BMLoop *l2= efa->v2->tmp.p;
BMLoop *l3= efa->v3->tmp.p;
@@ -234,7 +236,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
i += 1;
}
- BLI_end_edgefill();
+ BLI_end_edgefill(&sf_ctx);
}
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 2a22324a0ab..b7b9f6b21f4 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2354,7 +2354,6 @@ int mesh_recalcTessellation(CustomData *fdata,
* we can skip copying here */
const int do_face_nor_cpy)
{
-
/* use this to avoid locking pthread for _every_ polygon
* and calling the fill function */
@@ -2368,6 +2367,7 @@ int mesh_recalcTessellation(CustomData *fdata,
MLoop *ml, *mloop;
MFace *mface = NULL, *mf;
BLI_array_declare(mface);
+ ScanFillContext sf_ctx;
ScanFillVert *v, *lastv, *firstv;
ScanFillFace *f;
int *mface_orig_index = NULL;
@@ -2461,24 +2461,24 @@ int mesh_recalcTessellation(CustomData *fdata,
ml = mloop + mp->loopstart;
- BLI_begin_edgefill();
+ BLI_begin_edgefill(&sf_ctx);
firstv = NULL;
lastv = NULL;
for (j=0; j<mp->totloop; j++, ml++) {
- v = BLI_addfillvert(mvert[ml->v].co);
+ v = BLI_addfillvert(&sf_ctx, mvert[ml->v].co);
v->keyindex = mp->loopstart + j;
if (lastv)
- BLI_addfilledge(lastv, v);
+ BLI_addfilledge(&sf_ctx, lastv, v);
if (!firstv)
firstv = v;
lastv = v;
}
- BLI_addfilledge(lastv, firstv);
+ BLI_addfilledge(&sf_ctx, lastv, firstv);
- totfilltri = BLI_edgefill(FALSE);
+ totfilltri = BLI_edgefill(&sf_ctx, FALSE);
if (totfilltri) {
BLI_array_growitems(mface_to_poly_map, totfilltri);
BLI_array_growitems(mface, totfilltri);
@@ -2486,7 +2486,7 @@ int mesh_recalcTessellation(CustomData *fdata,
BLI_array_growitems(mface_orig_index, totfilltri);
}
- for (f = fillfacebase.first; f; f = f->next, mf++) {
+ for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
mface_to_poly_map[mface_index] = poly_index;
mf= &mface[mface_index];
@@ -2511,7 +2511,7 @@ int mesh_recalcTessellation(CustomData *fdata,
}
}
- BLI_end_edgefill();
+ BLI_end_edgefill(&sf_ctx);
}
}