diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-16 17:59:37 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-16 17:59:37 +0300 |
commit | 31d907fa0ad1afa8c8a1829e16d3af394ab9e301 (patch) | |
tree | f889d37f917b5f4daf121d7595daafccced8e514 /source/blender/editors/sculpt_paint/sculpt_undo.c | |
parent | 724809655c891b13bba49b60cbb2ddab3d54f18a (diff) |
Cleanup: BLI_task - API changes.
Based on usages so far:
- Split callback worker func in two, 'basic' and 'extended' versions. The former goes back
to the simplest verion, while the later keeps the 'userdata_chunk', and gets the thread_id too.
- Add use_threading to simple BLI_task_parallel_range(), turns out we need this pretty much systematically,
and allows to get rid of most usages of BLI_task_parallel_range_ex().
- Now BLI_task_parallel_range() expects 'basic' version of callback, while BLI_task_parallel_range_ex()
expectes 'extended' version of the callback.
All in all, this should make common usage of BLI_task_parallel_range simpler (less verbose), and add
access to advanced callback to thread id, which is mandatory in some (future) cases.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 0c16041b141..8fcac496e5e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -266,7 +266,7 @@ static int sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNode return 1; } -static void sculpt_undo_bmesh_restore_generic_task_cb(void *userdata, void *UNUSED(userdata_chunk), int n) +static void sculpt_undo_bmesh_restore_generic_task_cb(void *userdata, const int n) { PBVHNode **nodes = userdata; @@ -294,8 +294,9 @@ static void sculpt_undo_bmesh_restore_generic(bContext *C, BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); - BLI_task_parallel_range_ex(0, totnode, nodes, NULL, 0, sculpt_undo_bmesh_restore_generic_task_cb, - ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_OMP_LIMIT), false); + BLI_task_parallel_range( + 0, totnode, nodes, sculpt_undo_bmesh_restore_generic_task_cb, + ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_OMP_LIMIT)); if (nodes) MEM_freeN(nodes); |