diff options
author | Luca Rood <dev@lucarood.com> | 2017-07-10 15:43:57 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-07-10 15:43:57 +0300 |
commit | 45897f12f8c35a455d5a33dbb9a8c0589d04e8b9 (patch) | |
tree | 13161449b27a4df1c0f9a71b3739123921fa8a37 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | d33cacf7e46deb12713e058fff4c1096f8113469 (diff) |
Fix T51931: VBO not updating when UVs are added to shader node tree
UVs need specific data in the VBO, which is not computed unless the
shaders assigned to the mesh actually use UVs. When adding UVs to the
shader, the VBOs were not being recomputed to include the required data.
This adds a DEG relation between the shader and the mesh, and recomputes
the required data if the shader changed.
Thanks Sergey, for all the DEG stuff...
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 495e72fc9ac..66a946ef4a1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -1598,6 +1598,16 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode) case BKE_MESH_BATCH_DIRTY_NOCHECK: 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); + break; default: BLI_assert(0); } |