mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
util/indicies: move common static functions to private header
less duplication is good Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
This commit is contained in:
parent
5819d259cf
commit
55042a1fb9
5 changed files with 39 additions and 82 deletions
|
|
@ -25,26 +25,6 @@
|
|||
#include "u_indices.h"
|
||||
#include "u_indices_priv.h"
|
||||
|
||||
static void translate_memcpy_ushort( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((short *)in)[start], out_nr*sizeof(short));
|
||||
}
|
||||
|
||||
static void translate_memcpy_uint( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((int *)in)[start], out_nr*sizeof(int));
|
||||
}
|
||||
|
||||
static void translate_byte_to_ushort( const void *in,
|
||||
unsigned start,
|
||||
UNUSED unsigned in_nr,
|
||||
|
|
|
|||
|
|
@ -84,26 +84,6 @@ def prolog():
|
|||
|
||||
#include "c99_compat.h"
|
||||
|
||||
static unsigned out_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return OUT_UINT;
|
||||
case 2: return OUT_USHORT;
|
||||
default: assert(0); return OUT_USHORT;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned in_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return IN_UINT;
|
||||
case 2: return IN_USHORT;
|
||||
case 1: return IN_UBYTE;
|
||||
default: assert(0); return IN_UBYTE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static u_translate_func translate[IN_COUNT][OUT_COUNT][PV_COUNT][PV_COUNT][PR_COUNT][PRIM_COUNT];
|
||||
static u_generate_func generate[OUT_COUNT][PV_COUNT][PV_COUNT][PRIM_COUNT];
|
||||
|
||||
|
|
|
|||
|
|
@ -40,4 +40,43 @@
|
|||
|
||||
#define PRIM_COUNT (PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY + 1)
|
||||
|
||||
static void translate_memcpy_uint( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((int *)in)[start], out_nr*sizeof(int));
|
||||
}
|
||||
|
||||
static void translate_memcpy_ushort( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((short *)in)[start], out_nr*sizeof(short));
|
||||
}
|
||||
|
||||
static unsigned out_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return OUT_UINT;
|
||||
case 2: return OUT_USHORT;
|
||||
default: assert(0); return OUT_USHORT;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned in_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return IN_UINT;
|
||||
case 2: return IN_USHORT;
|
||||
case 1: return IN_UBYTE;
|
||||
default: assert(0); return IN_UBYTE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,27 +69,6 @@ def prolog():
|
|||
#include "pipe/p_defines.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
|
||||
static unsigned out_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return OUT_UINT;
|
||||
case 2: return OUT_USHORT;
|
||||
default: assert(0); return OUT_USHORT;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned in_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return IN_UINT;
|
||||
case 2: return IN_USHORT;
|
||||
case 1: return IN_UBYTE;
|
||||
default: assert(0); return IN_UBYTE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static u_generate_func generate_line[OUT_COUNT][PRIM_COUNT];
|
||||
static u_translate_func translate_line[IN_COUNT][OUT_COUNT][PRIM_COUNT];
|
||||
|
||||
|
|
|
|||
|
|
@ -47,27 +47,6 @@ static void translate_ubyte_ushort( const void *in,
|
|||
out_us[i] = (ushort) in_ub[i+start];
|
||||
}
|
||||
|
||||
static void translate_memcpy_ushort( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((short *)in)[start], out_nr*sizeof(short));
|
||||
}
|
||||
|
||||
static void translate_memcpy_uint( const void *in,
|
||||
unsigned start,
|
||||
unsigned in_nr,
|
||||
unsigned out_nr,
|
||||
unsigned restart_index,
|
||||
void *out )
|
||||
{
|
||||
memcpy(out, &((int *)in)[start], out_nr*sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
static void generate_linear_ushort( unsigned start,
|
||||
unsigned nr,
|
||||
void *out )
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue