Temporary fix for crash related to VBO update on shader change

This frees the whole mesh batch cache, instead of only the required
parts, as freeing specific parts of a cache is currently causing
crashes.
This commit is contained in:
Luca Rood 2017-07-11 12:52:04 +02:00
parent 64890a62cd
commit 0a57597aff
Notes: blender-bot 2023-02-14 06:48:43 +01:00
Referenced by issue #55326, Massive slowdown when animating material in a highpoly mesh
Referenced by issue #52024, Crash : Setting Transparent Shadow on Objects Ignoring Material Nodes Crashes Blender
1 changed files with 3 additions and 8 deletions

View File

@ -1599,14 +1599,9 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
cache->is_really_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SHADING:
GWN_VERTBUF_DISCARD_SAFE(cache->shaded_triangles_data);
if (cache->shaded_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
GWN_BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
}
}
MEM_SAFE_FREE(cache->shaded_triangles);
/* TODO: This should only update UV and tangent data,
* and not free the entire cache. */
cache->is_really_dirty = true;
break;
default:
BLI_assert(0);