[Bf-blender-cvs] [3a20c056e89] master: Fix T58920: Dyntopo sculpt and snake hook brush artifacts.
mano-wii
noreply at git.blender.org
Thu Jun 6 15:47:17 CEST 2019
Commit: 3a20c056e89a50ee39a228f59868c26ac750fac8
Author: mano-wii
Date: Thu Jun 6 10:46:47 2019 -0300
Branches: master
https://developer.blender.org/rB3a20c056e89a50ee39a228f59868c26ac750fac8
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.
===================================================================
M source/blender/gpu/intern/gpu_buffers.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list