diff options
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.cc')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 180ab50257f..b48ee1ddc3f 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -866,7 +866,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, const bool use_thread = (mr->loop_len + mr->loop_loose_len) > CHUNK_SIZE; if (use_thread) { - uint threads_to_use = 0; + uint single_threaded_extractors_len = 0; /* First run the requested extractors that do not support asynchronous ranges. */ for (const ExtractorRunData &run_data : extractors) { @@ -879,8 +879,8 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, struct TaskNode *task_node = extract_single_threaded_task_node_create(task_graph, taskdata); BLI_task_graph_edge_create(task_node_mesh_render_data, task_node); + single_threaded_extractors_len++; } - threads_to_use++; } /* Distribute the remaining extractors into ranges per core. */ @@ -893,9 +893,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, * fill the rest of the threads for range operations. */ int num_threads = BLI_task_scheduler_num_threads(); - if (threads_to_use < num_threads) { - num_threads -= threads_to_use; - } + num_threads -= single_threaded_extractors_len % num_threads; UserDataInitTaskData *user_data_init_task_data = new UserDataInitTaskData(); struct TaskNode *task_node_user_data_init = user_data_init_task_node_create( |