[Bf-blender-cvs] [c563169e321] sculpt-dev: Sculpt: revert past several commits
Joseph Eagar
noreply at git.blender.org
Thu Oct 21 02:30:11 CEST 2021
Commit: c563169e321e3c3d04c160c1d9d587387a511a0a
Author: Joseph Eagar
Date: Wed Oct 20 17:22:40 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc563169e321e3c3d04c160c1d9d587387a511a0a
Sculpt: revert past several commits
Note that I never pushed any of these to remote.
Decided to work on this in a local branch. I am
keeping the lock-free mempool code though.
===================================================================
M source/blender/blenkernel/intern/armature_deform.c
M source/blender/blenkernel/intern/colortools.c
M source/blender/blenkernel/intern/customdata.c
M source/blender/blenkernel/intern/dyntopo.c
M source/blender/blenkernel/intern/lattice_deform.c
M source/blender/blenkernel/intern/pbvh_bmesh.c
M source/blender/blenkernel/intern/pbvh_intern.h
M source/blender/blenlib/BLI_task.h
M source/blender/blenlib/CMakeLists.txt
M source/blender/blenlib/intern/task_iterator.c
M source/blender/blentranslation/msgfmt/msgfmt.c
M source/blender/bmesh/bmesh_class.h
M source/blender/bmesh/intern/bmesh_construct.c
M source/blender/bmesh/intern/bmesh_core.c
M source/blender/bmesh/intern/bmesh_interp.c
M source/blender/bmesh/intern/bmesh_iterators.c
M source/blender/bmesh/intern/bmesh_iterators.h
M source/blender/bmesh/intern/bmesh_iterators_inline.h
M source/blender/bmesh/intern/bmesh_log.c
M source/blender/bmesh/intern/bmesh_mesh.c
M source/blender/bmesh/intern/bmesh_mesh.h
M source/blender/bmesh/intern/bmesh_mesh_convert.c
M source/blender/bmesh/intern/bmesh_mesh_convert_threaded.c
M source/blender/bmesh/intern/bmesh_operators.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M source/blender/editors/sculpt_paint/sculpt_smooth.c
===================================================================
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index ad9882ecf9b..5f721b49361 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -601,11 +601,11 @@ static void armature_deform_coords_impl(const Object *ob_arm,
BLI_parallel_mempool_settings_defaults(&settings);
if (use_dverts) {
- BM_task_parallel_mempool(
+ BLI_task_parallel_mempool(
em_target->bm->vpool, &data, armature_vert_task_editmesh, &settings);
}
else {
- BM_task_parallel_mempool(
+ BLI_task_parallel_mempool(
em_target->bm->vpool, &data, armature_vert_task_editmesh_no_dvert, &settings);
}
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 32cec26974c..d481a7a9162 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -163,15 +163,6 @@ void BKE_curvemapping_copy_data_tag_ex(CurveMapping *target,
}
}
-static void *debug_dupalloc_id(const void *mem, const char *id)
-{
- int len = MEM_allocN_len(mem);
- void *cpy = MEM_mallocN(len, id);
- memcpy(cpy, mem, len);
-
- return cpy;
-}
-
void BKE_curvemapping_copy_data(CurveMapping *target, const CurveMapping *cumap)
{
int a;
@@ -186,14 +177,13 @@ void BKE_curvemapping_copy_data(CurveMapping *target, const CurveMapping *cumap)
for (a = 0; a < CM_TOT; a++) {
if (cumap->cm[a].curve) {
- target->cm[a].curve = debug_dupalloc_id(cumap->cm[a].curve, "curvemapping.curve");
+ target->cm[a].curve = MEM_dupallocN(cumap->cm[a].curve);
}
if (cumap->cm[a].table) {
- target->cm[a].table = debug_dupalloc_id(cumap->cm[a].table, "curvemapping.table");
+ target->cm[a].table = MEM_dupallocN(cumap->cm[a].table);
}
if (cumap->cm[a].premultable) {
- target->cm[a].premultable = debug_dupalloc_id(cumap->cm[a].premultable,
- "curvemapping.premultable");
+ target->cm[a].premultable = MEM_dupallocN(cumap->cm[a].premultable);
}
}
}
@@ -201,7 +191,7 @@ void BKE_curvemapping_copy_data(CurveMapping *target, const CurveMapping *cumap)
CurveMapping *BKE_curvemapping_copy(const CurveMapping *cumap)
{
if (cumap) {
- CurveMapping *cumapn = debug_dupalloc_id(cumap, "CurveMapping");
+ CurveMapping *cumapn = MEM_dupallocN(cumap);
BKE_curvemapping_copy_data(cumapn, cumap);
cumapn->flag &= ~CUMA_PART_OF_CACHE;
return cumapn;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 10dd35ce2d0..d6c41fd66bd 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -3980,12 +3980,7 @@ void CustomData_bmesh_init_pool_ex(CustomData *data,
/* If there are no layers, no pool is needed just yet */
if (data->totlayer) {
-#ifndef BM_LOCKFREE_MEMPOOL
data->pool = BLI_mempool_create_ex(data->totsize, totelem, chunksize, BLI_MEMPOOL_NOP, memtag);
-#else
- data->pool = (BLI_mempool *)BM_mempool_create(
- data->totsize, totelem, chunksize, BLI_MEMPOOL_NOP);
-#endif
}
}
@@ -4073,7 +4068,7 @@ bool CustomData_bmesh_merge(const CustomData *source,
}
if (destold.pool) {
- BM_mempool_destroy(destold.pool);
+ BLI_mempool_destroy(destold.pool);
}
if (destold.layers) {
MEM_freeN(destold.layers);
@@ -4101,7 +4096,7 @@ void CustomData_bmesh_free_block(CustomData *data, void **block)
}
if (data->totsize) {
- BM_mempool_free((BM_mempool *)data->pool, *block);
+ BLI_mempool_free(data->pool, *block);
}
*block = NULL;
@@ -4142,7 +4137,7 @@ static void CustomData_bmesh_alloc_block(CustomData *data, void **block)
}
if (data->totsize > 0) {
- *block = BM_mempool_alloc((BM_mempool *)data->pool);
+ *block = BLI_mempool_alloc(data->pool);
CustomData_bmesh_asan_poison(data, *block);
diff --git a/source/blender/blenkernel/intern/dyntopo.c b/source/blender/blenkernel/intern/dyntopo.c
index e78c86a4739..dd076f26bb9 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -190,273 +190,6 @@ void bmesh_radial_loop_append(BMEdge *e, BMLoop *l);
void bm_kill_only_edge(BMesh *bm, BMEdge *e);
void bm_kill_only_loop(BMesh *bm, BMLoop *l);
void bm_kill_only_face(BMesh *bm, BMFace *f);
-static bool bm_elem_is_free(BMElem *elem, int htype);
-
-extern char dyntopop_node_idx_layer_id[];
-extern char dyntopop_faces_areas_layer_id[];
-
-#ifdef WITH_DYNTOPO_EDGE_LOCKS
-
-char *cdlayer_lock_attr_name = "__bm_lock";
-
-ATTR_NO_OPT static int cdlayer_lock_begin(PBVH *pbvh, BMesh *bm)
-{
- int idx = CustomData_get_named_layer_index(&bm->edata, CD_PROP_INT32, cdlayer_lock_attr_name);
-
- if (idx == -1) {
- BM_data_layer_add_named(bm, &bm->edata, CD_PROP_INT32, cdlayer_lock_attr_name);
-
- idx = CustomData_get_named_layer_index(&bm->edata, CD_PROP_INT32, cdlayer_lock_attr_name);
- bm->edata.layers[idx].flag |= CD_FLAG_TEMPORARY | CD_FLAG_ELEM_NOCOPY | CD_FLAG_ELEM_NOINTERP;
-
- pbvh->cd_vert_node_offset = CustomData_get_named_layer_index(
- &pbvh->bm->vdata, CD_PROP_INT32, dyntopop_node_idx_layer_id);
- pbvh->cd_face_node_offset = CustomData_get_named_layer_index(
- &pbvh->bm->pdata, CD_PROP_INT32, dyntopop_node_idx_layer_id);
-
- pbvh->cd_vert_node_offset = bm->vdata.layers[pbvh->cd_vert_node_offset].offset;
- pbvh->cd_face_node_offset = bm->pdata.layers[pbvh->cd_face_node_offset].offset;
- }
-
- return bm->edata.layers[idx].offset;
-}
-
-ATTR_NO_OPT static bool cdlayer_elem_lock(BMElem *elem, int cd_lock, int thread_nr)
-{
- thread_nr++;
-
- if (bm_elem_is_free(elem, BM_EDGE)) {
- return false;
- }
-
- int *lock = BM_ELEM_CD_GET_VOID_P(elem, cd_lock);
- int old = *lock;
-
- if (old == thread_nr) {
- return true;
- }
-
- int i = 0;
-
- while (old > 0 || old != atomic_cas_int32(lock, old, thread_nr)) {
- if (bm_elem_is_free(elem, BM_EDGE)) {
- return false;
- }
-
- old = *lock;
-
- if (i++ > 100000) {
- return false;
- }
- }
-
- return true;
-}
-
-static void cdlayer_elem_unlock(BMElem *elem, int cd_lock, int thread_nr)
-{
- thread_nr++;
-
- int *lock = BM_ELEM_CD_GET_VOID_P(elem, cd_lock);
- // int old = *lock;
-
- *lock = 0;
-}
-
-ATTR_NO_OPT static bool cdlayer_lock_edge(BMEdge *e, int cd_lock, int thread_nr)
-{
- if (!cdlayer_elem_lock((BMElem *)e, cd_lock, thread_nr)) {
- return false;
- }
-
- BMEdge **es = NULL;
- BLI_array_staticdeclare(es, 32);
-
- for (int i = 0; i < 2; i++) {
- BMVert *v = i ? e->v2 : e->v1;
-
- BMEdge *e2 = v->e;
- do {
- BMLoop *l = e2->l;
-
- if (!l) {
- if (!cdlayer_elem_lock((BMElem *)e2, cd_lock, thread_nr)) {
- return false;
- }
-
- BLI_array_append(es, e2);
- continue;
- }
-
- do {
- BMLoop *l2 = l;
- do {
- if (BM_elem_is_free((BMElem *)l2, BM_LOOP)) {
- return false;
- }
-
- if (!cdlayer_elem_lock((BMElem *)l2->e, cd_lock, thread_nr)) {
- return false;
- }
- BLI_array_append(es, l2->e);
- } while ((l2 = l2->next) != l);
- } while ((l = l->radial_next) != e2->l);
-
- } while ((e2 = BM_DISK_EDGE_NEXT(e2, v)) != v->e);
- }
-
- BLI_array_free(es);
- return true;
-
-error:
- for (int i = 0; i < BLI_array_len(es); i++) {
- if (!es[i]) {
- continue;
- }
-
- // eliminate duplicates
- for (int j = i + 1; j < BLI_array_len(es); j++) {
- if (es[i] == es[j]) {
- es[j] = NULL;
- }
- }
-
- cdlayer_elem_unlock((BMElem *)es[i], cd_lock, thread_nr);
- }
-
- BLI_array_free(es);
- return false;
-}
-
-static void cdlayer_unlock_edge(BMEdge *e, int cd_lock, int thread_nr)
-{
- if (BM_ELEM_CD_GET_INT(e, cd_lock) == thread_nr + 1) {
- return;
- }
-
- BMEdge **es = NULL;
- BLI_array_staticdeclare(es, 32);
-
- const int tag = BM_ELEM_TAG_ALT;
-
- for (int i = 0; i < 2; i++) {
- BMVert *v = i ? e->v2 : e->v1;
-
- BMEdge *e2 = v->e;
- do {
- BMLoop *l = e2->l;
- if (!l) {
- BLI_array_append(es, e2);
- continue;
- }
-
- do {
- BMLoop *l2 = l;
- do {
- l2->e->head.hflag &= ~tag;
- } while ((l2 = l2->next) != l);
- } while ((l = l->radial_next) != e2->l);
-
- } while ((e2 = BM_DISK_EDGE_NEXT(e2, v)) != v->e);
- }
-
- for (int i = 0; i < 2; i++) {
- BMVert *v = i ? e->v2 : e->v1;
-
- BMEdge *e2 = v->e;
- do {
- BMLoop *l = e2->l;
- if (!l) {
- BLI_array_append(es, e2);
- continue;
- }
-
- do {
- BMLoop *l2 = l;
- do {
- if (!(l2->e->head.hflag & tag)) {
- l2->e->head.hflag |= tag;
- BLI_array_append(es, l2->e);
- }
- } while ((l2 = l2->next) != l);
- } while ((l = l->radial_next) != e2->l);
-
- } while ((e2 = BM_DISK_EDGE_NEXT(e2, v)) != v->e);
- }
-
- for (int i = 0; i < BLI_array_len(es); i++) {
- BMEdge *e2 = es[i];
-
- if (!bm_elem_is_free((BMElem *)e2, BM_EDGE) &&
- BM_ELEM_CD_GET_INT(e2, cd_lock) == thread_nr + 1) {
- cdlayer_elem_unlock((BMElem *)e2, cd_lock, thread_nr);
- }
- }
-
- BLI_array_free(es);
-}
-
-static void cdlayer_unlock_vert(BMVert *v, int cd_lock, int thread_nr)
-{
- BMEdge **es = NULL;
- BLI_array_staticdeclare(es, 32);
-
- if (!v->e) {
- return;
- }
- const int tag = BM_ELEM_TAG_ALT;
-
- BMEdge *e2 = v->e;
- do {
- BMLoop *l = e2->l;
- if (!l) {
- e2->head.hflag &= ~tag;
- continue;
- }
-
- do {
- BMLoop *l2 = l;
- do {
- l2->e->head.hflag &= ~tag;
-
- } while ((l2 = l2->next) != l);
- } while ((l = l->radial_next) != e2->l);
-
- } while ((e2 = BM_DISK_EDGE_NEXT(e2, v)) != v->e);
-
- e2 = v->e;
- do {
- BMLoop *l = e2->l;
- if (!l) {
- e2->head.hflag |= tag;
- BLI_array_append(es, e2);
- continue;
- }
-
- do {
- BMLoop *l2 = l;
- do {
- if (!(l2
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list