GPUBuffers: Remove wrong assert
authorClément Foucault <foucault.clem@gmail.com>
Tue, 16 Apr 2019 23:38:15 +0000 (01:38 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 17 Apr 2019 12:32:18 +0000 (14:32 +0200)
The assert was not true if the pbvh node had no triangle.

Also update the comment to reflect that.

source/blender/gpu/intern/gpu_buffers.c

index 743e430..2b67887 100644 (file)
@@ -150,7 +150,7 @@ static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers, GPUPrimType prim)
   if (buffers->triangles == NULL) {
     buffers->triangles = GPU_batch_create(prim,
                                           buffers->vert_buf,
-                                          /* can be NULL */
+                                          /* can be NULL if buffer is empty */
                                           buffers->index_buf);
   }
 
@@ -160,7 +160,10 @@ static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers, GPUPrimType prim)
 
   if (buffers->lines == NULL) {
     BLI_assert(buffers->index_lines_buf != NULL);
-    buffers->lines = GPU_batch_create(GPU_PRIM_LINES, buffers->vert_buf, buffers->index_lines_buf);
+    buffers->lines = GPU_batch_create(GPU_PRIM_LINES,
+                                      buffers->vert_buf,
+                                      /* can be NULL if buffer is empty */
+                                      buffers->index_lines_buf);
   }
 
   if ((buffers->lines_fast == NULL) && buffers->index_lines_buf_fast) {