[Bf-blender-cvs] [c7767f1bcfd] master: DRW: Improve edit mode selection time when using auto-smooth
Clément Foucault
noreply at git.blender.org
Mon Apr 29 18:51:18 CEST 2019
Commit: c7767f1bcfd28ae3352b58a52eae2d63b4a22329
Author: Clément Foucault
Date: Mon Apr 29 17:52:08 2019 +0200
Branches: master
https://developer.blender.org/rBc7767f1bcfd28ae3352b58a52eae2d63b4a22329
DRW: Improve edit mode selection time when using auto-smooth
Unfortunately it does not concern paint mode.
Related to T63946
===================================================================
M source/blender/blenkernel/BKE_mesh.h
M source/blender/draw/intern/draw_cache_impl_mesh.c
M source/blender/editors/mesh/editface.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 5b50ead689a..ecee00b1b3f 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -673,6 +673,7 @@ enum {
BKE_MESH_BATCH_DIRTY_ALL = 0,
BKE_MESH_BATCH_DIRTY_MAYBE_ALL,
BKE_MESH_BATCH_DIRTY_SELECT,
+ BKE_MESH_BATCH_DIRTY_SELECT_PAINT,
BKE_MESH_BATCH_DIRTY_SHADING,
BKE_MESH_BATCH_DIRTY_SCULPT_COORDS,
BKE_MESH_BATCH_DIRTY_UVEDIT_ALL,
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;
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 28b697531ab..990250792a1 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -121,7 +121,7 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag)
BKE_mesh_batch_cache_dirty_tag(me_eval, BKE_MESH_BATCH_DIRTY_ALL);
}
else {
- BKE_mesh_batch_cache_dirty_tag(me_eval, BKE_MESH_BATCH_DIRTY_SELECT);
+ BKE_mesh_batch_cache_dirty_tag(me_eval, BKE_MESH_BATCH_DIRTY_SELECT_PAINT);
}
DEG_id_tag_update(ob->data, ID_RECALC_SELECT);
More information about the Bf-blender-cvs
mailing list