diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-28 22:26:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 16:27:37 +0300 |
commit | 8b00a73620d9635e0ceab82e227dcbd540c4b45a (patch) | |
tree | 42e88e574b738c40a82453ed3e40f90401418c8b /source/blender/editors/sculpt_paint/paint_vertex.c | |
parent | 1ca105ebdccc386aa0a49e5d323be65123881243 (diff) |
Cleanup: move sculpt parallel range threading test into function
Easier to experiment with different settings this way.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 9887f598f42..3554a6cc546 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2073,9 +2073,7 @@ static void calculate_average_weight(SculptThreadedTaskData *data, data->custom_data = accum; TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = ((data->sd->flags & SCULPT_USE_OPENMP) && - totnode > SCULPT_THREADED_LIMIT); + BKE_pbvh_parallel_range_settings(&settings, (data->sd->flags & SCULPT_USE_OPENMP), totnode); BLI_task_parallel_range(0, totnode, data, do_wpaint_brush_calc_average_weight_cb_ex, &settings); uint accum_len = 0; @@ -2121,10 +2119,9 @@ static void wpaint_paint_leaves(bContext *C, /* Use this so average can modify its weight without touching the brush. */ data.strength = BKE_brush_weight_get(scene, brush); - TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); /* NOTE: current mirroring code cannot be run in parallel */ - settings.use_threading = !(me->editflag & ME_EDIT_MIRROR_X); + TaskParallelSettings settings; + BKE_pbvh_parallel_range_settings(&settings, !(me->editflag & ME_EDIT_MIRROR_X), totnode); switch ((eBrushWeightPaintTool)brush->weightpaint_tool) { case WPAINT_TOOL_AVERAGE: @@ -3135,7 +3132,7 @@ static void calculate_average_color(SculptThreadedTaskData *data, data->custom_data = accum; TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); + BKE_pbvh_parallel_range_settings(&settings, true, totnode); BLI_task_parallel_range(0, totnode, data, do_vpaint_brush_calc_average_color_cb_ex, &settings); uint accum_len = 0; @@ -3181,7 +3178,7 @@ static void vpaint_paint_leaves(bContext *C, .me = me, }; TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); + BKE_pbvh_parallel_range_settings(&settings, true, totnode); switch ((eBrushVertexPaintTool)brush->vertexpaint_tool) { case VPAINT_TOOL_AVERAGE: calculate_average_color(&data, nodes, totnode); |