[Bf-blender-cvs] [dc1418e5d91] master: Sculpt: Fix T101674: Passing null to GPU_batch_elembuf_set

Joseph Eagar noreply at git.blender.org
Mon Oct 10 23:08:46 CEST 2022


Commit: dc1418e5d91edba691b43eb7efd5d0ec9d5c1b10
Author: Joseph Eagar
Date:   Mon Oct 10 14:08:02 2022 -0700
Branches: master
https://developer.blender.org/rBdc1418e5d91edba691b43eb7efd5d0ec9d5c1b10

Sculpt: Fix T101674: Passing null to GPU_batch_elembuf_set

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

M	source/blender/draw/intern/draw_pbvh.cc

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

diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc
index cab260f87ac..880a5a445f4 100644
--- a/source/blender/draw/intern/draw_pbvh.cc
+++ b/source/blender/draw/intern/draw_pbvh.cc
@@ -1158,8 +1158,17 @@ struct PBVHBatches {
     }
 
     for (PBVHBatch &batch : batches.values()) {
-      GPU_batch_elembuf_set(batch.tris, tri_index, false);
-      GPU_batch_elembuf_set(batch.lines, lines_index, false);
+      if (tri_index) {
+        GPU_batch_elembuf_set(batch.tris, tri_index, false);
+      }
+      else {
+        /* Still flag the batch as dirty even if we're using the default index layout. */
+        batch.tris->flag |= GPU_BATCH_DIRTY;
+      }
+
+      if (lines_index) {
+        GPU_batch_elembuf_set(batch.lines, lines_index, false);
+      }
     }
   }



More information about the Bf-blender-cvs mailing list