diff options
author | Jeroen Bakker <jbakker> | 2021-06-18 17:09:35 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-18 17:10:28 +0300 |
commit | e0f2f07d1e8bff3410edddc235b9c4d61f62c18f (patch) | |
tree | a8a20a0f983235bbed0ec570a7751490177bf221 /source/blender/draw/intern/draw_cache_extract_mesh.cc | |
parent | 6d73d98fb62df19c03fb665cd37ff214458d7a70 (diff) |
DrawManager: Multithreaded counting of material buckets.
When having multiple materials in a mesh the triangles are sorted based
on material index. This sorting is done single threaded, but needs two
loops over the data. One to count the bucket size and the second one to
add the triangles to the right position in the buckets.
This patch will do the counting in a multithreaded approach that would
speed up the cache creation. It has been measured that this part is the
most blocking part of the cache creation.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D11615
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.cc')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 4abe74bc190..e577069f000 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -50,8 +50,6 @@ # include "PIL_time_utildefines.h" #endif -#define MIM_RANGE_LEN 1024 - namespace blender::draw { /* ---------------------------------------------------------------------- */ @@ -448,7 +446,7 @@ static void extract_task_range_run(void *__restrict taskdata) settings.userdata_chunk = userdata_chunk; settings.userdata_chunk_size = userdata_chunk_size; settings.func_reduce = extract_task_reduce; - settings.min_iter_per_thread = MIM_RANGE_LEN; + settings.min_iter_per_thread = MIN_RANGE_LEN; extract_init(data->mr, data->cache, *data->extractors, data->mbc, userdata_chunk); @@ -711,7 +709,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, task_graph, mr, extraction_cache, iter_type, data_flag); /* Simple heuristic. */ - const bool use_thread = (mr->loop_len + mr->loop_loose_len) > MIM_RANGE_LEN; + const bool use_thread = (mr->loop_len + mr->loop_loose_len) > MIN_RANGE_LEN; if (use_thread) { /* First run the requested extractors that do not support asynchronous ranges. */ |