diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-04-19 03:22:22 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-04-19 16:19:43 +0300 |
commit | 223f7e79f9fa221f60841afcff9a9ed8a97d9306 (patch) | |
tree | c39a9af28d6f8ad4cc386972e2f67677224d6b7a /source/blender/draw/intern/draw_cache.c | |
parent | 973e64cf9cb23b91e329ebac9a0f4c69647edf20 (diff) |
DRW: Add batch garbage collection
This is only working for shading batches for the moment and only if some Custom data layer are not needed anymore.
The collection rate is hardcoded at 60 sec but could be exposed to the user.
This system can be extended and discard most unused batches in the future.
This commit is in prevision of removing BKE_MESH_BATCH_DIRTY_SHADING when changing shader parameters.
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 6b6a79bfb60..8a13d8be622 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -4031,4 +4031,25 @@ void drw_batch_cache_generate_requested(Object *ob) } } +void DRW_batch_cache_free_old(Object *ob, int ctime) +{ + struct Mesh *mesh_eval = ob->runtime.mesh_eval; + + switch (ob->type) { + case OB_MESH: + DRW_mesh_batch_cache_free_old((Mesh *)ob->data, ctime); + break; + case OB_CURVE: + case OB_FONT: + case OB_SURF: + if (mesh_eval) { + DRW_mesh_batch_cache_free_old(mesh_eval, ctime); + } + break; + /* TODO all cases */ + default: + break; + } +} + /** \} */ |