From 479d364c39e06dfcbe2e1d995bd82f748b1a172d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 May 2016 16:49:22 -0600 Subject: [PATCH] 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 --- src/gallium/auxiliary/indices/u_unfilled_indices.c | 5 +++++ 1 file changed, 5 insertions(+) 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;