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:
authorJacques Lucke <mail@jlucke.com>2018-09-21 17:19:34 +0300
committerJacques Lucke <mail@jlucke.com>2018-09-21 17:20:32 +0300
commit684739c6f9ddafbbf9e7a2bb4e195f6f28fd3972 (patch)
tree894ef4836817afba69bbdf702c774982f7237f78 /source/blender
parentd2dba449fee162f8b43bfba60e688bfdc096cf64 (diff)
Fix: missing cache invalidation when the active vertex group changed
Reviewers: brecht Differential Revision: https://developer.blender.org/D3716
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 513a7372ad4..75aaac23f75 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1646,6 +1646,7 @@ typedef struct MeshBatchCache {
int vert_len;
int mat_len;
bool is_editmode;
+ int vertex_group_index;
/* XXX, only keep for as long as sculpt mode uses shaded drawing. */
bool is_sculpt_points_tag;
@@ -1721,6 +1722,7 @@ static void mesh_batch_cache_init(Mesh *me)
cache->is_maybe_dirty = false;
cache->is_dirty = false;
+ cache->vertex_group_index = -1;
}
static MeshBatchCache *mesh_batch_cache_get(Mesh *me)
@@ -1732,6 +1734,15 @@ static MeshBatchCache *mesh_batch_cache_get(Mesh *me)
return me->runtime.batch_cache;
}
+static MeshBatchCache *mesh_batch_cache_get__check_vertex_group(Mesh *me, int defgroup)
+{
+ MeshBatchCache *cache = mesh_batch_cache_get(me);
+ if (cache->vertex_group_index != defgroup) {
+ cache->is_dirty = true;
+ }
+ return mesh_batch_cache_get(me);
+}
+
static void mesh_batch_cache_discard_shaded_tri(MeshBatchCache *cache)
{
GPU_VERTBUF_DISCARD_SAFE(cache->shaded_triangles_data);
@@ -3857,7 +3868,7 @@ GPUBatch *DRW_mesh_batch_cache_get_loose_edges_with_normals(Mesh *me)
GPUBatch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int defgroup)
{
- MeshBatchCache *cache = mesh_batch_cache_get(me);
+ MeshBatchCache *cache = mesh_batch_cache_get__check_vertex_group(me, defgroup);
if (cache->triangles_with_weights == NULL) {
const bool use_hide = (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL)) != 0;
@@ -3867,6 +3878,7 @@ GPUBatch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me,
cache->triangles_with_weights = GPU_batch_create_ex(
GPU_PRIM_TRIS, mesh_create_tri_weights(rdata, use_hide, defgroup), NULL, GPU_BATCH_OWNS_VBO);
+ cache->vertex_group_index = defgroup;
GPUVertBuf *vbo_tris = use_hide ?
mesh_create_tri_pos_and_normals_visible_only(rdata) :