diff options
author | Jeroen Bakker <jbakker> | 2021-06-15 16:31:17 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-15 16:31:34 +0300 |
commit | 174ed69c1ba8cb8ca7ac39d41922bc203f78326f (patch) | |
tree | 547312bc79a8ce1e415f09f6d4966594e223a483 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 7c8b9c7a9aceed5186657fb0ac11cb844f16fec6 (diff) |
DrawManager: Cache material offsets.
When using multiple materials in a single mesh the most time is spend in
counting the offsets of each material for the sorting.
This patch moves the counting of the offsets to render mesh data and
caches it as long as the geometry doesn't change.
This patch doesn't include multithreading of this code.
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D11612
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 38f3f4b433a..e4c682e1765 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -725,6 +725,8 @@ static void mesh_buffer_extraction_cache_clear(MeshBufferExtractionCache *extrac MEM_SAFE_FREE(extraction_cache->loose_geom.edges); extraction_cache->loose_geom.edge_len = 0; extraction_cache->loose_geom.vert_len = 0; + + MEM_SAFE_FREE(extraction_cache->mat_offsets.tri); } static void mesh_batch_cache_clear(Mesh *me) |