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!
This commit is contained in:
Bastien Montagne 2018-06-26 11:38:27 +02:00
parent 42fde5d32b
commit dad4703ec5
Notes: blender-bot 2023-02-14 05:47:43 +01:00
Referenced by issue #55320, Sculpt Mode - Dyntopo visual bug
1 changed files with 4 additions and 1 deletions

View File

@ -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;