diff options
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 33f8ec38a54..0c002ff09f2 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -544,8 +544,8 @@ static void drw_mesh_weight_state_extract(Object *ob, /* Extract complete vertex weight group selection state and mode flags. */ memset(wstate, 0, sizeof(*wstate)); - wstate->defgroup_active = ob->actdef - 1; - wstate->defgroup_len = BLI_listbase_count(&ob->defbase); + wstate->defgroup_active = me->vertex_group_active_index - 1; + wstate->defgroup_len = BLI_listbase_count(&me->vertex_group_names); wstate->alert_mode = ts->weightuser; @@ -821,6 +821,17 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, eMeshBatchDirtyMode mode) mesh_batch_cache_discard_shaded_tri(cache); mesh_batch_cache_discard_uvedit(cache); break; + case BKE_MESH_BATCH_DIRTY_DEFORM: + FOREACH_MESH_BUFFER_CACHE (cache, mbufcache) { + GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.pos_nor); + GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.lnor); + GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.fdots_pos); + GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.fdots_nor); + GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.tris); + } + batch_map = MDEPS_CREATE_MAP(vbo.pos_nor, vbo.lnor, vbo.fdots_pos, vbo.fdots_nor, ibo.tris); + mesh_batch_cache_discard_batch(cache, batch_map); + break; case BKE_MESH_BATCH_DIRTY_UVEDIT_ALL: mesh_batch_cache_discard_uvedit(cache); break; @@ -1052,7 +1063,7 @@ GPUBatch *DRW_mesh_batch_cache_get_surface_sculpt(Mesh *me) return cache->batch.surface; } -int DRW_mesh_material_count_get(Mesh *me) +int DRW_mesh_material_count_get(const Mesh *me) { return mesh_render_mat_len_get(me); } @@ -1278,7 +1289,7 @@ GPUBatch *DRW_mesh_batch_cache_get_surface_edges(Mesh *me) * \{ */ /* Thread safety need to be assured by caller. Don't call this during drawing. - * Note: For now this only free the shading batches / vbo if any cd layers is + * NOTE: For now this only free the shading batches / vbo if any cd layers is * not needed anymore. */ void DRW_mesh_batch_cache_free_old(Mesh *me, int ctime) { @@ -1305,7 +1316,7 @@ static void drw_mesh_batch_cache_check_available(struct TaskGraph *task_graph, M { MeshBatchCache *cache = mesh_batch_cache_get(me); /* Make sure all requested batches have been setup. */ - /* Note: The next line creates a different scheduling than during release builds what can lead to + /* NOTE: The next line creates a different scheduling than during release builds what can lead to * some issues (See T77867 where we needed to disable this function in order to debug what was * happening in release builds). */ BLI_task_graph_work_and_wait(task_graph); |