[Bf-blender-cvs] [dad4703ec57] blender2.8: Fix T55320: Sculpt Mode with dyntopo and smooth shading drawing bug.

Bastien Montagne noreply at git.blender.org
Tue Jun 26 11:43:26 CEST 2018


Commit: dad4703ec577adccd252151fc893a24e023ec587
Author: Bastien Montagne
Date:   Tue Jun 26 11:38:27 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBdad4703ec577adccd252151fc893a24e023ec587

Fix T55320: Sculpt Mode with dyntopo and smooth shading drawing bug.

We have to discard the batch in smooth case, because we are modifying
the index buffer (flat shading don't need it, only changes vertex buffer
on redraw, which is safe).

Many thanks to @fclem for his help on debuging/understanding what was
wrong here!

===================================================================

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 df8dbb03284..462785a5dcb 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -791,11 +791,14 @@ void GPU_pbvh_bmesh_buffers_update(
 	tottri = gpu_bmesh_face_visible_count(bm_faces);
 
 	if (buffers->smooth) {
+		/* Smooth needs to recreate index buffer, so we have to invalidate the batch. */
+		GWN_BATCH_DISCARD_SAFE(buffers->triangles);
 		/* Count visible vertices */
 		totvert = gpu_bmesh_vert_visible_count(bm_unique_verts, bm_other_verts);
 	}
-	else
+	else {
 		totvert = tottri * 3;
+	}
 
 	if (!tottri) {
 		buffers->tot_tri = 0;



More information about the Bf-blender-cvs mailing list