diff options
author | Germano Cavalcante <mano-wii> | 2021-07-20 17:43:38 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-07-21 21:09:43 +0300 |
commit | 178086d5810a0de9e1d95c7fbd6c443cd53af40d (patch) | |
tree | 690553abc005e71ebca93322c82efb42072df77d /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 785d87ee42aa1bb09c6ab3282b9fd602f9c14d62 (diff) |
Draw Cache: extract tris in parallel ranges
The `ibo.tris` extraction in multithread is currently only done if the
mesh has only 1 material.
Now we cache a map indicating the index of each polygon after sort and
thus allow the extraction of tris with materials in multithreaded.
As caching is a heavy operation and was already being performed in
multi-thread for triangle offsets, no significant improvements are
expected.
The benefit will be much greater when we can skip updating the cache
while transforming a geometry.
**Profiling:**
||master:|PATCH:
|---|---|---|
|large_mesh_editing_materials:|Average: 13.855380 FPS|Average: 15.525684 FPS
||rdata 9ms iter 36ms (frame 71ms)|rdata 9ms iter 29ms (frame 64ms)
|subdiv_mesh_final_only_materials:|Average: 28.113742 FPS|Average: 28.633599 FPS
||rdata 0ms iter 1ms (frame 36ms)|rdata 0ms iter 1ms (frame 35ms)
1.1x overall speedup
Differential Revision: https://developer.blender.org/D11445
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 8387fb2f43f..38ecdf7756b 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -856,7 +856,9 @@ static void mesh_buffer_extraction_cache_clear(MeshBufferExtractionCache *extrac extraction_cache->loose_geom.edge_len = 0; extraction_cache->loose_geom.vert_len = 0; - MEM_SAFE_FREE(extraction_cache->mat_offsets.tri); + MEM_SAFE_FREE(extraction_cache->poly_sorted.tri_first_index); + MEM_SAFE_FREE(extraction_cache->poly_sorted.mat_tri_len); + extraction_cache->poly_sorted.visible_tri_len = 0; } static void mesh_batch_cache_clear(Mesh *me) |