Mesa (mesa_7_7_branch): gallium/draw: apply DRAW_PIPE_FLAG_MASK to all vertex elements

Brian Paul brianp at kemper.freedesktop.org
Fri Jan 22 18:55:07 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 64871747bb7b611ffe429fbf1724bd98ee25dd84
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64871747bb7b611ffe429fbf1724bd98ee25dd84

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Jan 22 11:45:40 2010 -0700

gallium/draw: apply DRAW_PIPE_FLAG_MASK to all vertex elements

Depending on first/last provoking vertex either the first or last
element/index may have the extra DRAW_PIPE_x flags.  Mask off those
bits for all vertex elements to be safe (esp. for the quad case).
This may be overly cautious, but it's a cheap operation.

Fixes a segfault caused by large/bogus vertex indexes otherwise.

---

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

diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
index c9fd1a7..11d6485 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.c
+++ b/src/gallium/auxiliary/draw/draw_pipe.c
@@ -187,14 +187,14 @@ static void do_triangle( struct draw_context *draw,
    do_triangle( draw,                                                   \
                 elts[i0],  /* flags */                                  \
                 verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK),     \
-                verts + stride * elts[i1],                              \
-                verts + stride * elts[i2])
+                verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK),     \
+                verts + stride * (elts[i2] & ~DRAW_PIPE_FLAG_MASK) );
 
 #define LINE(flags,i0,i1)                                       \
    do_line( draw,                                               \
             elts[i0],                                           \
             verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
-            verts + stride * elts[i1])
+            verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK) );
 
 #define POINT(i0)                               \
    do_point( draw,                              \




More information about the mesa-commit mailing list