summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-08-07 00:50:32 +0800
committerChia-I Wu <[email protected]>2010-08-07 02:20:06 +0800
commite34c52da87990b1ec64602a20418cdb274deefa9 (patch)
tree91a48dd713473197b5f8da0f31cc9c80bf9d844c /src/gallium/auxiliary
parent600cd858d446bc1698a9b28f714f3fd6145316fb (diff)
draw: Add an assertion to varray's version of trim().
Assert that "first" is always smaller than "count" and add reasoning. It would be better to simply fix trim(), but it is used in tight loops right now.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
index a292346be95..55e43b2a714 100644
--- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
+++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
@@ -1,6 +1,11 @@
static unsigned trim( unsigned count, unsigned first, unsigned incr )
{
- return count - (count - first) % incr;
+ /*
+ * count either has been trimmed in draw_pt_arrays or is set to
+ * (driver)_fetch_max which is hopefully always larger than first.
+ */
+ assert(count >= first);
+ return count - (count - first) % incr;
}
static void FUNC(struct draw_pt_front_end *frontend,