From 0030e4da7073d62561cca508330ab150b37ee6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 7 May 2019 23:21:16 +0200 Subject: DRW: Make batch validation run first during iteration This reduces the cost of querying the batches to the batch cache. --- source/blender/draw/intern/draw_cache_impl_lattice.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/draw/intern/draw_cache_impl_lattice.c') diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c index b5223bc047c..8b3864684b5 100644 --- a/source/blender/draw/intern/draw_cache_impl_lattice.c +++ b/source/blender/draw/intern/draw_cache_impl_lattice.c @@ -340,12 +340,16 @@ static void lattice_batch_cache_init(Lattice *lt) cache->is_dirty = false; } -static LatticeBatchCache *lattice_batch_cache_get(Lattice *lt) +void DRW_lattice_batch_cache_validate(Lattice *lt) { if (!lattice_batch_cache_valid(lt)) { lattice_batch_cache_clear(lt); lattice_batch_cache_init(lt); } +} + +static LatticeBatchCache *lattice_batch_cache_get(Lattice *lt) +{ return lt->batch_cache; } -- cgit v1.2.3