diff options
author | José Fonseca <[email protected]> | 2011-03-29 15:35:30 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2011-03-30 16:05:24 +0100 |
commit | 713230ff39cd22a2082c12b937889c3ef81973ac (patch) | |
tree | 30687551f617345136f2d1b56cac35e206e865a6 /src | |
parent | 6584d0cd4fa3a3255a4c0962f31338601df705cb (diff) |
draw: Fix bug when drawing ushort indices.
When the condition
min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])
was true, we were wrongly ignoring istart and processing indices 0.
Reorder some statements to make the code easier to understand.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h index 75dba8c39a5..228da68d411 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -47,13 +47,18 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit, const ushort *draw_elts = NULL; unsigned i; + 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) return FALSE; for (i = 0; i < icount; i++) { - ELT_TYPE idx = ib[istart + i]; + ELT_TYPE idx = ib[i]; assert(idx >= min_index && idx <= max_index); } draw_elts = (const ushort *) ib; @@ -65,7 +70,7 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit, } /* this is faster only when we fetch less elements than the normal path */ - if (max_index - min_index > icount - 1) + if (fetch_count > icount) return FALSE; if (elt_bias < 0 && min_index < -elt_bias) @@ -77,13 +82,10 @@ 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++) { - ELT_TYPE idx = ib[istart + i]; + ELT_TYPE idx = ib[i]; assert(idx >= min_index && idx <= max_index); vsplit->draw_elts[i] = (ushort) idx; |