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 <sroland@vmware.com>
This commit is contained in:
Brian Paul 2016-05-13 16:49:22 -06:00
parent 26de558072
commit 479d364c39
1 changed files with 5 additions and 0 deletions

View File

@ -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;