diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-11 17:06:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-11 17:06:56 +0300 |
commit | 38d480fb54dbac5bb87b002e4ee22c1d3df89f90 (patch) | |
tree | eaaa6b96d06c1b5225fc7418bf422e7366a12d82 /source | |
parent | 374c4f168d6278c100cb88d192d1eec6e243247b (diff) |
Subsurf: Allow partial threading over geometry arrays
This helps avoiding threading overhead when having lots of system threads..
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf_legacy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c index d567b50af56..2b331eae950 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c @@ -34,6 +34,9 @@ #define FACE_calcIFNo(f, lvl, S, x, y, no) _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize) +/* TODO(sergey): This actually depends on subsurf level as well. */ +#define CCG_TASK_LIMIT 16 + /* TODO(sergey): Deduplicate the following functions/ */ static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSize) { @@ -340,7 +343,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedF, &data, ccgSubSurf__calcVertNormals_faces_accumulate_cb, @@ -374,7 +377,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedE * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedE, &data, ccgSubSurf__calcVertNormals_edges_accumulate_cb, @@ -384,7 +387,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedF, &data, ccgSubSurf__calcVertNormals_faces_finalize_cb, @@ -683,7 +686,7 @@ static void ccgSubSurf__calcSubdivLevel( { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedF, &data, ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb, @@ -966,7 +969,7 @@ static void ccgSubSurf__calcSubdivLevel( { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedF, &data, ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb, @@ -986,7 +989,7 @@ static void ccgSubSurf__calcSubdivLevel( { ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT); + settings.min_iter_per_thread = CCG_TASK_LIMIT; BLI_task_parallel_range(0, numEffectedF, &data, ccgSubSurf__calcSubdivLevel_verts_copydata_cb, |