draw: Fix an off-by-one bug in a vsplit assertion.
authorChia-I Wu <olv@lunarg.com>
Thu, 13 Jan 2011 17:50:51 +0000 (01:50 +0800)
committerChia-I Wu <olv@lunarg.com>
Thu, 13 Jan 2011 18:02:26 +0000 (02:02 +0800)
When use_spoken is true, istart (the first vertex of this segment) is
replaced by i0 (the spoken vertex of the fan).  There are still icount
vertices.

Thanks to Brian Paul for spotting this.

src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h

index 3f66f962e11e3358d0c9090d3f7ad5a9c0ac2749..75dba8c39a58dc7db6e770f91f2e9431c47ec0dc 100644 (file)
@@ -258,9 +258,10 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
    boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
    unsigned nr = 0, i;
 
-   assert(icount + !!use_spoken <= vsplit->segment_size);
+   assert(icount <= vsplit->segment_size);
 
    if (use_spoken) {
+      /* replace istart by i0 */
       vsplit->fetch_elts[nr++] = i0;
       for (i = 1 ; i < icount; i++)
          vsplit->fetch_elts[nr++] = istart + i;