diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-08 00:21:16 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-08 18:52:48 +0300 |
commit | 0030e4da7073d62561cca508330ab150b37ee6eb (patch) | |
tree | c1d25b9a92ed3aeb4f9c3bee03e32de7e721a7f4 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 05b0f52aa78344a4a74b816fd1d025aa344ec28c (diff) |
DRW: Make batch validation run first during iteration
This reduces the cost of querying the batches to the batch cache.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 6 |
1 files changed, 5 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 1f96a21dd94..f2b79b0d0e1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2095,12 +2095,16 @@ static void mesh_batch_cache_init(Mesh *me) drw_mesh_weight_state_clear(&cache->weight_state); } -static MeshBatchCache *mesh_batch_cache_get(Mesh *me) +void DRW_mesh_batch_cache_validate(Mesh *me) { if (!mesh_batch_cache_valid(me)) { mesh_batch_cache_clear(me); mesh_batch_cache_init(me); } +} + +static MeshBatchCache *mesh_batch_cache_get(Mesh *me) +{ return me->runtime.batch_cache; } |