summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-05-30 14:51:09 +0100
committerKeith Whitwell <[email protected]>2008-05-30 17:49:10 +0100
commit1529a2c983f70ed7ff661ae6e8995cdfbca6d9cf (patch)
treeb2013e7ad27e4216d98dfbb457a0f109b76fafef
parent63faab0150c3394bd9532e621947d2a31b9712ea (diff)
draw: trim incoming primitives
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 723077159b5..f0d7b51ad70 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -35,6 +35,10 @@
#include "draw/draw_private.h"
#include "draw/draw_pt.h"
+static unsigned trim( unsigned count, unsigned first, unsigned incr )
+{
+ return count - (count - first) % incr;
+}
@@ -54,6 +58,17 @@ draw_pt_arrays(struct draw_context *draw,
struct draw_pt_middle_end *middle = NULL;
unsigned opt = 0;
+ /* Sanitize primitive length:
+ */
+ {
+ unsigned first, incr;
+ draw_pt_split_prim(prim, &first, &incr);
+ count = trim(count, first, incr);
+ if (count < first)
+ return TRUE;
+ }
+
+
if (!draw->render) {
opt |= PT_PIPELINE;
}