From 0eb9351296dbed5e7ac10ca56132d5e51e5f388d Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 10 Jun 2021 11:13:01 -0300 Subject: Refactor: use 'BLI_task_parallel_range' in Draw Cache One drawback to trying to predict the number of threads that will be used in the `task_graph` is that we are only sure of the number when the threads are running. Using `BLI_task_parallel_range` allows the driver to choose the best thread distribution through `parallel_reduce`. The benefit is most evident on hardware with fewer cores. This is the result on an 4-core laptop: ||before:|after: |---|---|---| |large_mesh_editing:|Average: 5.203638 FPS|Average: 5.398925 FPS ||rdata 15ms iter 43ms (frame 193ms)|rdata 14ms iter 36ms (frame 187ms) Differential Revision: https://developer.blender.org/D11558 --- source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc') diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc index 27929fa8ba3..70b46481b51 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc @@ -211,11 +211,11 @@ static void extract_tris_single_mat_iter_looptri_mesh(const MeshRenderData *mr, } } -static void extract_tris_single_mat_task_finish(void *_userdata_to, void *_userdata_from) +static void extract_tris_single_mat_task_reduce(void *_userdata_to, void *_userdata_from) { GPUIndexBufBuilder *elb_to = static_cast(_userdata_to); GPUIndexBufBuilder *elb_from = static_cast(_userdata_from); - GPU_indexbuf_join_copies(elb_to, elb_from); + GPU_indexbuf_join(elb_to, elb_from); } static void extract_tris_single_mat_finish(const MeshRenderData *mr, @@ -250,7 +250,7 @@ constexpr MeshExtract create_extractor_tris_single_mat() extractor.init = extract_tris_single_mat_init; extractor.iter_looptri_bm = extract_tris_single_mat_iter_looptri_bm; extractor.iter_looptri_mesh = extract_tris_single_mat_iter_looptri_mesh; - extractor.task_reduce = extract_tris_single_mat_task_finish; + extractor.task_reduce = extract_tris_single_mat_task_reduce; extractor.finish = extract_tris_single_mat_finish; extractor.data_type = MR_DATA_NONE; extractor.data_size = sizeof(GPUIndexBufBuilder); -- cgit v1.2.3