Fix T70302 Crash on entering solid view after some specific steps
authorClément Foucault <foucault.clem@gmail.com>
Mon, 7 Oct 2019 17:20:52 +0000 (19:20 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Mon, 7 Oct 2019 17:22:41 +0000 (19:22 +0200)
source/blender/draw/intern/draw_cache_impl_mesh.c

index 48dd23fd5301b70a870d3178c42f51691fb05782..422271dbf62a55f015f030ddce1af1f892e49988 100644 (file)
@@ -513,6 +513,12 @@ static void mesh_batch_cache_discard_uvedit(MeshBatchCache *cache)
   cache->tot_uv_area = 0.0f;
 
   cache->batch_ready &= ~MBC_EDITUV;
+
+  /* TODO(fclem): this is overkill and
+   * we should just reset the cache->cd_used layer concerning uvs. */
+  mesh_batch_cache_discard_shaded_tri(cache);
+  GPU_BATCH_DISCARD_SAFE(cache->batch.surface);
+  cache->batch_ready &= ~(MBC_SURF_PER_MAT | MBC_SURFACE);
 }
 
 void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)