From c7767f1bcfd28ae3352b58a52eae2d63b4a22329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 29 Apr 2019 17:52:08 +0200 Subject: DRW: Improve edit mode selection time when using auto-smooth Unfortunately it does not concern paint mode. Related to T63946 --- source/blender/draw/intern/draw_cache_impl_mesh.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c') diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index a72c5ba7d5e..827937a6068 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2172,8 +2172,12 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode) GPU_BATCH_DISCARD_SAFE(cache->batch.edit_edges); GPU_BATCH_DISCARD_SAFE(cache->batch.edit_facedots); GPU_BATCH_DISCARD_SAFE(cache->batch.edit_mesh_analysis); - /* Paint mode selection */ - /* TODO only do that in paint mode. */ + /* Because visible UVs depends on edit mode selection, discard everything. */ + mesh_batch_cache_discard_uvedit(cache); + break; + case BKE_MESH_BATCH_DIRTY_SELECT_PAINT: + /* Paint mode selection flag is packed inside the nor attrib. + * Note that it can be slow if auto smooth is enabled. (see T63946) */ GPU_VERTBUF_DISCARD_SAFE(cache->ordered.loop_pos_nor); GPU_BATCH_DISCARD_SAFE(cache->batch.surface); GPU_BATCH_DISCARD_SAFE(cache->batch.wire_loops); @@ -2182,8 +2186,6 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode) GPU_BATCH_DISCARD_SAFE(cache->surf_per_mat[i]); } } - /* Because visible UVs depends on edit mode selection, discard everything. */ - mesh_batch_cache_discard_uvedit(cache); break; case BKE_MESH_BATCH_DIRTY_ALL: cache->is_dirty = true; -- cgit v1.2.3