Module: Mesa
Branch: 8.0
Commit: 29c4e92b2c5980b120023d3449419ce91b8ec9f8
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=29c4e92b2c5980b120023d3449419ce91b8ec9f8

Author: Brian Paul <[email protected]>
Date:   Thu May 24 11:09:18 2012 -0600

draw: fix primitive restart bug by using the index buffer offset

The code which scans the index buffer for restart indexes wasn't adding
the index buffer offset so we were always starting at offset=0.  The
offset is usually zero so it wasn't noticed before.

Fixes a failure in the piglit primitive-restart test when testing
vertex data + index data in a single VBO.

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit 1609efb4180659322557380550d17ed7adb8eae2)

---

 src/gallium/auxiliary/draw/draw_pt.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt.c 
b/src/gallium/auxiliary/draw/draw_pt.c
index 080e03d..c098c05 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -329,25 +329,28 @@ draw_pt_arrays_restart(struct draw_context *draw,
 
    if (draw->pt.user.elts) {
       /* indexed prims (draw_elements) */
+      const char *elts =
+         (const char *) draw->pt.user.elts + draw->pt.index_buffer.offset;
+
       cur_start = start;
       cur_count = 0;
 
       switch (draw->pt.user.eltSize) {
       case 1:
          {
-            const ubyte *elt_ub = (const ubyte *) draw->pt.user.elts;
+            const ubyte *elt_ub = (const ubyte *) elts;
             PRIM_RESTART_LOOP(elt_ub);
          }
          break;
       case 2:
          {
-            const ushort *elt_us = (const ushort *) draw->pt.user.elts;
+            const ushort *elt_us = (const ushort *) elts;
             PRIM_RESTART_LOOP(elt_us);
          }
          break;
       case 4:
          {
-            const uint *elt_ui = (const uint *) draw->pt.user.elts;
+            const uint *elt_ui = (const uint *) elts;
             PRIM_RESTART_LOOP(elt_ui);
          }
          break;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to