Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-09 17:27:04 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-10 18:36:12 +0300
commit6c302d6529ec5283334e5ef40d07cc46534f5020 (patch)
treef54712920f8ea8a108f456a8279433c6a1d564a3 /source/blender/blenkernel/intern/pbvh.c
parent86042b7ced948cda215f002c125c8d850887eff0 (diff)
Sculpt: use TBB instead of BLI_task for multithreading
This solves performance issues on some computers where there is significant threading overhead. Rather than doing the complicated work of optimizing our own task scheduler, use TBB which appears to work well. The downside is that we have another thread pool, but it is already there when using OpenVDB voxel remesh. For future releases we can switch to using TBB to replace our task scheduler implementation entirely, and use the same thread pool for BLI_task, Cycles, Mantaflow, etc. Differential Revision: https://developer.blender.org/D6030
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r--source/blender/blenkernel/intern/pbvh.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 4e193e35109..01612ded396 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1096,12 +1096,11 @@ static void pbvh_faces_update_normals(PBVH *bvh, PBVHNode **nodes, int totnode)
.vnors = vnors,
};
- TaskParallelSettings settings;
+ PBVHParallelSettings settings;
BKE_pbvh_parallel_range_settings(&settings, true, totnode);
- BLI_task_parallel_range(0, totnode, &data, pbvh_update_normals_accum_task_cb, &settings);
-
- BLI_task_parallel_range(0, totnode, &data, pbvh_update_normals_store_task_cb, &settings);
+ BKE_pbvh_parallel_range(0, totnode, &data, pbvh_update_normals_accum_task_cb, &settings);
+ BKE_pbvh_parallel_range(0, totnode, &data, pbvh_update_normals_store_task_cb, &settings);
MEM_freeN(vnors);
}
@@ -1151,9 +1150,9 @@ static void pbvh_update_mask_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, in
.flag = flag,
};
- TaskParallelSettings settings;
+ PBVHParallelSettings settings;
BKE_pbvh_parallel_range_settings(&settings, true, totnode);
- BLI_task_parallel_range(0, totnode, &data, pbvh_update_mask_redraw_task_cb, &settings);
+ BKE_pbvh_parallel_range(0, totnode, &data, pbvh_update_mask_redraw_task_cb, &settings);
}
static void pbvh_update_BB_redraw_task_cb(void *__restrict userdata,
@@ -1189,9 +1188,9 @@ void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag)
.flag = flag,
};
- TaskParallelSettings settings;
+ PBVHParallelSettings settings;
BKE_pbvh_parallel_range_settings(&settings, true, totnode);
- BLI_task_parallel_range(0, totnode, &data, pbvh_update_BB_redraw_task_cb, &settings);
+ BKE_pbvh_parallel_range(0, totnode, &data, pbvh_update_BB_redraw_task_cb, &settings);
}
static int pbvh_get_buffers_update_flags(PBVH *bvh, bool show_vcol)
@@ -1299,9 +1298,9 @@ static void pbvh_update_draw_buffers(
.show_vcol = show_vcol,
};
- TaskParallelSettings settings;
+ PBVHParallelSettings settings;
BKE_pbvh_parallel_range_settings(&settings, true, totnode);
- BLI_task_parallel_range(0, totnode, &data, pbvh_update_draw_buffer_cb, &settings);
+ BKE_pbvh_parallel_range(0, totnode, &data, pbvh_update_draw_buffer_cb, &settings);
}
static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
@@ -2742,13 +2741,10 @@ void pbvh_show_mask_set(PBVH *bvh, bool show_mask)
bvh->show_mask = show_mask;
}
-void BKE_pbvh_parallel_range_settings(TaskParallelSettings *settings,
+void BKE_pbvh_parallel_range_settings(PBVHParallelSettings *settings,
bool use_threading,
int totnode)
{
- const int threaded_limit = 1;
- BLI_parallel_range_settings_defaults(settings);
- settings->use_threading = use_threading && (totnode > threaded_limit);
- settings->min_iter_per_thread = 1;
- settings->scheduling_mode = TASK_SCHEDULING_DYNAMIC;
+ memset(settings, 0, sizeof(*settings));
+ settings->use_threading = use_threading && totnode > 1;
}