diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-06-06 16:46:47 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-06-06 16:46:47 +0300 |
commit | 3a20c056e89a50ee39a228f59868c26ac750fac8 (patch) | |
tree | 5d4f50538924025aa3a1e8b805a4be2477cfe6f3 | |
parent | d8ec8a0272d56e4594be0de0a0ab0c8faef7d2bc (diff) |
Fix T58920: Dyntopo sculpt and snake hook brush artifacts.
This is a mix of solutions rBe60b18d51d58 and rB52af5fa31fbc.
What happened was that when a node of the BVH gets 0 vertices, the batch is untouched and therefore still drawn.
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index e30fccbf29d..241b3bd553f 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -805,9 +805,6 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers, bool empty_mask = true; BMFace *f; - /* TODO, make mask layer optional for bmesh buffer */ - const int cd_vert_mask_offset = CustomData_get_offset(&bm->vdata, CD_PAINT_MASK); - /* Count visible triangles */ tottri = gpu_bmesh_face_visible_count(bm_faces); @@ -827,10 +824,21 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers, } if (!tottri) { + if (BLI_gset_len(bm_faces) != 0) { + /* Node is just hidden. */ + } + else { + GPU_BATCH_DISCARD_SAFE(buffers->triangles); + GPU_INDEXBUF_DISCARD_SAFE(buffers->index_buf); + GPU_VERTBUF_DISCARD_SAFE(buffers->vert_buf); + } buffers->tot_tri = 0; return; } + /* TODO, make mask layer optional for bmesh buffer */ + const int cd_vert_mask_offset = CustomData_get_offset(&bm->vdata, CD_PAINT_MASK); + /* Fill vertex buffer */ if (gpu_pbvh_vert_buf_data_set(buffers, totvert)) { int v_index = 0; |