Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-04-19 19:52:38 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-04-19 19:52:38 +0300
commit3368df4ab6eab69cc7aec30fccb2ac806c45bbe4 (patch)
tree715f82a4b6909f427e283b870199ea3d7b340c35 /source/blender/draw/intern/draw_cache_impl_mesh.c
parent7e4db169f2ab8dd62281f0b42a6f7e33be5f32d6 (diff)
DRW: Expose VBO garbage collection timings
This adds user side options to tweak the behavior of the vbo garbage collection.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 41de51fde96..a433135e8b9 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2004,6 +2004,8 @@ typedef struct MeshBatchCache {
DRW_MeshCDMask cd_used, cd_needed, cd_used_over_time;
+ int lastmatch;
+
/* XXX, only keep for as long as sculpt mode uses shaded drawing. */
bool is_sculpt_points_tag;
@@ -4727,16 +4729,21 @@ static void mesh_create_uvedit_buffers(MeshRenderData *rdata,
/* Thread safety need to be assured by caller. Don't call this during drawing.
* Note: For now this only free the shading batches / vbo if any cd layers is
* not needed anymore. */
-void DRW_mesh_batch_cache_free_old(Mesh *me, int UNUSED(ctime))
+void DRW_mesh_batch_cache_free_old(Mesh *me, int ctime)
{
MeshBatchCache *cache = me->runtime.batch_cache;
if (cache == NULL)
return;
- if (mesh_cd_layers_type_equal(cache->cd_used_over_time, cache->cd_used) == false) {
+ if (mesh_cd_layers_type_equal(cache->cd_used_over_time, cache->cd_used)) {
+ cache->lastmatch = ctime;
+ }
+
+ if (ctime - cache->lastmatch > U.vbotimeout) {
mesh_batch_cache_discard_shaded_tri(cache);
}
+
mesh_cd_layers_type_clear(&cache->cd_used_over_time);
}