diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-02-21 18:46:25 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-02-21 18:46:25 +0300 |
commit | 13f84446731b07153ddf6a87967df7c883c18ae1 (patch) | |
tree | 10e46d91ca94d5fe025f11cf142c355a2d885d5b /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | c12313cfa88c6216695afe1e066c4f19aab15e04 (diff) |
temp-sculpt-colors: Fix GPU memory leak where vertex
colors weren't always being released following switch
to PBVH drawing
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 2cda44ada82..ddb8486e2d1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -870,6 +870,13 @@ static bool mesh_batch_cache_valid(Object *object, Mesh *me) return false; } + if (object->sculpt && object->sculpt->pbvh) { + if (cache->pbvh_is_drawing != BKE_pbvh_is_drawing(object->sculpt->pbvh)) { + printf("PBVH induced mesh cache invalidation!\n"); + return false; + } + } + if (cache->is_editmode != (me->edit_mesh != NULL)) { return false; } @@ -898,6 +905,10 @@ static void mesh_batch_cache_init(Object *object, Mesh *me) cache->is_editmode = me->edit_mesh != NULL; + if (object->sculpt && object->sculpt->pbvh) { + cache->pbvh_is_drawing = BKE_pbvh_is_drawing(object->sculpt->pbvh); + } + if (cache->is_editmode == false) { // cache->edge_len = mesh_render_edges_len_get(me); // cache->tri_len = mesh_render_looptri_len_get(me); |