From 9d97cd2e3e993658ebe038f4652dc59c3ae56031 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 18 Mar 2015 11:46:45 +1000 Subject: u_primconvert: add primitive restart support This add primitive restart support to the prim conversion. This involves changing the API for the translate functions as we need to pass the prim restart index and the original number of indices into the translate functions. primitive restart is support for quads, quad strips and polygons. This deal with the case where the actual number of output primitives is less than the initially calculated number, by filling the rest of the output primitives with the restart index, the other option is to reduce the output prim number, but that will make the generator code a bit messier. Reviewed-by: Brian Paul Signed-off-by: Dave Airlie --- src/gallium/auxiliary/indices/u_unfilled_indices.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/gallium/auxiliary/indices/u_unfilled_indices.c') diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c index 7a74c39135e..121877a60fb 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_indices.c +++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c @@ -28,30 +28,36 @@ static void translate_ubyte_ushort( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { const ubyte *in_ub = (const ubyte *)in; ushort *out_us = (ushort *)out; unsigned i; - for (i = 0; i < nr; i++) + for (i = 0; i < out_nr; i++) out_us[i] = (ushort) in_ub[i+start]; } static void translate_memcpy_ushort( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((short *)in)[start], nr*sizeof(short)); + memcpy(out, &((short *)in)[start], out_nr*sizeof(short)); } static void translate_memcpy_uint( const void *in, unsigned start, - unsigned nr, + unsigned in_nr, + unsigned out_nr, + unsigned restart_index, void *out ) { - memcpy(out, &((int *)in)[start], nr*sizeof(int)); + memcpy(out, &((int *)in)[start], out_nr*sizeof(int)); } -- cgit v1.2.3