summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-05-13 16:49:22 -0600
committerBrian Paul <[email protected]>2016-05-26 17:44:17 -0600
commit479d364c39e06dfcbe2e1d995bd82f748b1a172d (patch)
treedbe0a061c59cfbf8136224bae72af5d1faab71c3
parent26de558072509ca9a6d399d6c597f1da30e28ab6 (diff)
util/indices: assert that the incoming primitive is a triangle type
The unfilled index translator/generator functions should only be called when the primitive mode is one of the triangle types. Reviewed-by: Roland Scheidegger <[email protected]>
-rw-r--r--src/gallium/auxiliary/indices/u_unfilled_indices.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c
index fe57fd704a9..49fff6b8a9c 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_indices.c
+++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c
@@ -24,6 +24,7 @@
#include "u_indices.h"
#include "u_indices_priv.h"
+#include "util/u_prim.h"
static void translate_ubyte_ushort( const void *in,
@@ -123,6 +124,8 @@ u_unfilled_translator(unsigned prim,
unsigned in_idx;
unsigned out_idx;
+ assert(u_reduced_prim(prim) == PIPE_PRIM_TRIANGLES);
+
u_unfilled_init();
in_idx = in_size_idx(in_index_size);
@@ -180,6 +183,8 @@ u_unfilled_generator(unsigned prim,
{
unsigned out_idx;
+ assert(u_reduced_prim(prim) == PIPE_PRIM_TRIANGLES);
+
u_unfilled_init();
*out_index_size = ((start + nr) > 0xfffe) ? 4 : 2;