EditUV: Only clear data VBO when selection changes
authorClément Foucault <foucault.clem@gmail.com>
Fri, 11 Jan 2019 18:07:33 +0000 (19:07 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Fri, 11 Jan 2019 19:09:42 +0000 (20:09 +0100)
This is a small optimisation that make UV selection faster.

source/blender/draw/intern/draw_cache_impl_mesh.c

index 5ed1bcb..e29d87f 100644 (file)
@@ -2319,8 +2319,14 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
                        mesh_batch_cache_discard_uvedit(cache);
                        break;
                case BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT:
-                       /* For now same as above. */
-                       mesh_batch_cache_discard_uvedit(cache);
+                       GPU_VERTBUF_DISCARD_SAFE(cache->edituv.loop_data);
+                       GPU_VERTBUF_DISCARD_SAFE(cache->edituv.facedots_data);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_area);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces_strech_angle);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_faces);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_edges);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_verts);
+                       GPU_BATCH_DISCARD_SAFE(cache->batch.edituv_facedots);
                        break;
                default:
                        BLI_assert(0);