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_extract.h | |
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_extract.h')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h index 46234366251..2c4e4dfe76b 100644 --- a/source/blender/draw/intern/draw_cache_extract.h +++ b/source/blender/draw/intern/draw_cache_extract.h @@ -83,8 +83,9 @@ typedef enum eMRDataType { MR_DATA_LOOPTRI = 1 << 3, /** Force loop normals calculation. */ MR_DATA_TAN_LOOP_NOR = 1 << 4, + MR_DATA_MAT_OFFSETS = 1 << 5, } eMRDataType; -ENUM_OPERATORS(eMRDataType, MR_DATA_TAN_LOOP_NOR) +ENUM_OPERATORS(eMRDataType, MR_DATA_MAT_OFFSETS) #ifdef __cplusplus extern "C" { @@ -166,6 +167,12 @@ typedef struct MeshBufferExtractionCache { int *verts; int *edges; } loose_geom; + + struct { + int *tri; + int visible_tri_len; + } mat_offsets; + } MeshBufferExtractionCache; typedef enum DRWBatchFlag { |