[Mesa-dev] [PATCH 3/5] util/indices: assert that the incoming primitive is a triangle type

Brian Paul brianp at vmware.com
Thu May 26 14:06:12 UTC 2016


The unfilled index translator/generator functions should only be
called when the primitive mode is one of the triangle types.
---
 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 fe57fd7..49fff6b 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;
-- 
1.9.1



More information about the mesa-dev mailing list