diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-22 13:56:52 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-22 14:20:41 +0400 |
commit | dfc4de036e39f74aa0a3b1e1734a02f4a9530a78 (patch) | |
tree | 2df085daa2c61acada91e542bb86deaed395cb98 /source/blender/blenlib/BLI_task.h | |
parent | 74f40a5217c9c72447a80881c192de72577e869c (diff) |
Meshdeform modifier: Use threaded evaluation
This commit switches meshdeform modifier to use threads to evaluate
the vertices positions using the central task scheduler.
SO now we've got an utility function to help splitting the for loop
into tasks using BLI_task module which is pretty straightforward to
use: it gets range (which is an integer lower and higher bounds) and
the function and userdata to be invoked for each of the iterations.
The only weak point for now is the passing the data to the callback,
this isn't so trivial to improve in pure C.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D838
Diffstat (limited to 'source/blender/blenlib/BLI_task.h')
-rw-r--r-- | source/blender/blenlib/BLI_task.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index c9cbaf997fb..8c22a25fe14 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -100,6 +100,18 @@ ThreadMutex *BLI_task_pool_user_mutex(TaskPool *pool); /* number of tasks done, for stats, don't use this to make decisions */ size_t BLI_task_pool_tasks_done(TaskPool *pool); +/* Parallel for routines */ +typedef void (*TaskParallelRangeFunc)(void *userdata, int iter); +void BLI_task_parallel_range_ex( + int start, int stop, + void *userdata, + TaskParallelRangeFunc func, + const int range_threshold); +void BLI_task_parallel_range( + int start, int stop, + void *userdata, + TaskParallelRangeFunc func); + #ifdef __cplusplus } #endif |