diff options
author | Rob Clark <[email protected]> | 2013-10-25 15:22:06 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2013-10-29 16:49:43 -0400 |
commit | 28f3f8d413f6bf29f051d54479d9ae90bb16a55e (patch) | |
tree | 723e5489d29c154bf2e6465d1af8701211823307 /src/gallium/auxiliary/indices/u_unfilled_indices.c | |
parent | 5127436a4a1a7fb56acbd2934318d3053f37af68 (diff) |
gallium/auxiliary/indices: add start param
Add 'start' parameter to generator/translator.
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/indices/u_unfilled_indices.c')
-rw-r--r-- | src/gallium/auxiliary/indices/u_unfilled_indices.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c index 25c61d97bdf..7a74c39135e 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_indices.c +++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c @@ -27,6 +27,7 @@ static void translate_ubyte_ushort( const void *in, + unsigned start, unsigned nr, void *out ) { @@ -34,40 +35,44 @@ static void translate_ubyte_ushort( const void *in, ushort *out_us = (ushort *)out; unsigned i; for (i = 0; i < nr; i++) - out_us[i] = (ushort) in_ub[i]; + out_us[i] = (ushort) in_ub[i+start]; } static void translate_memcpy_ushort( const void *in, + unsigned start, unsigned nr, void *out ) { - memcpy(out, in, nr*sizeof(short)); + memcpy(out, &((short *)in)[start], nr*sizeof(short)); } static void translate_memcpy_uint( const void *in, + unsigned start, unsigned nr, void *out ) { - memcpy(out, in, nr*sizeof(int)); + memcpy(out, &((int *)in)[start], nr*sizeof(int)); } -static void generate_linear_ushort( unsigned nr, +static void generate_linear_ushort( unsigned start, + unsigned nr, void *out ) { ushort *out_us = (ushort *)out; unsigned i; for (i = 0; i < nr; i++) - out_us[i] = (ushort) i; + out_us[i] = (ushort)(i + start); } -static void generate_linear_uint( unsigned nr, +static void generate_linear_uint( unsigned start, + unsigned nr, void *out ) { unsigned *out_ui = (unsigned *)out; unsigned i; for (i = 0; i < nr; i++) - out_ui[i] = i; + out_ui[i] = i + start; } |