draw: Don't assert if indices point outside vertex buffer.
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 22 Aug 2010 01:26:09 +0000 (02:26 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 22 Aug 2010 01:26:44 +0000 (02:26 +0100)
This is valid input, and asserting here does causes the test suites that
verify this to crash.

Also, the assert was wrongly accepting the case

  max_index == vert_info->count

which, IIUC, is the first vertex outside the buffer. Assuming the
vert_info->count is precise (which often is not the case).

src/gallium/auxiliary/draw/draw_pipe.c

index b75262a3575c7388b391b5e28073f7fe93315a94..6206197dae97645ef742a5bad301e698bd49eb89 100644 (file)
@@ -238,7 +238,7 @@ void draw_pipeline_run( struct draw_context *draw,
       const unsigned count = prim_info->primitive_lengths[i];
 
 #if DEBUG
-      /* make sure none of the element indexes go outside the vertex buffer */
+      /* Warn if one of the element indexes go outside the vertex buffer */
       {
          unsigned max_index = 0x0, i;
          /* find the largest element index */
@@ -247,7 +247,12 @@ void draw_pipeline_run( struct draw_context *draw,
             if (index > max_index)
                max_index = index;
          }
-         assert(max_index <= vert_info->count);
+         if (max_index >= vert_info->count) {
+            debug_printf("%s: max_index (%u) outside vertex buffer (%u)\n",
+                         __FUNCTION__,
+                         max_index,
+                         vert_info->count);
+         }
       }
 #endif