Mesa (master): draw: Revert code reorg in previous change.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Mar 31 11:22:36 UTC 2011


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Mar 31 12:20:10 2011 +0100

draw: Revert code reorg in previous change.

Because

  fetch_count = max_index - min_index + 1

overflows for min_index = 0 and max_index = 0xffffffff.

Fixes fdo 35815.

---

 src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
index 2acaef3..10842a3 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
@@ -49,9 +49,6 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
 
    ib += istart;
 
-   fetch_start = min_index + elt_bias;
-   fetch_count = max_index - min_index + 1;
-
    /* use the ib directly */
    if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
       if (icount > vsplit->max_vertices)
@@ -70,7 +67,7 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
    }
 
    /* this is faster only when we fetch less elements than the normal path */
-   if (fetch_count > icount)
+   if (max_index - min_index > icount - 1)
       return FALSE;
 
    if (elt_bias < 0 && min_index < -elt_bias)
@@ -82,6 +79,9 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
          return FALSE;
    }
 
+   fetch_start = min_index + elt_bias;
+   fetch_count = max_index - min_index + 1;
+
    if (!draw_elts) {
       if (min_index == 0) {
          for (i = 0; i < icount; i++) {




More information about the mesa-commit mailing list