Mesa (master): draw: Don't assert if indices point outside vertex buffer.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Aug 22 01:27:18 UTC 2010


Module: Mesa
Branch: master
Commit: ae34a6393e6519dc32e53fa8407155e8679fc257
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae34a6393e6519dc32e53fa8407155e8679fc257

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Aug 22 02:26:09 2010 +0100

draw: Don't assert if indices point outside vertex buffer.

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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
index b75262a..6206197 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.c
+++ b/src/gallium/auxiliary/draw/draw_pipe.c
@@ -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
 




More information about the mesa-commit mailing list