translate_generic.c File Reference

Include dependency graph for translate_generic.c:

Go to the source code of this file.

Data Structures

struct  translate_generic

Defines

#define DRAW_DBG   0
#define ATTRIB(NAME, SZ, TYPE, FROM, TO)
 Fetch a float[4] vertex attribute from memory, doing format/type conversion as needed.
#define FROM_64_FLOAT(i)   ((float) ((double *) ptr)[i])
#define FROM_32_FLOAT(i)   (((float *) ptr)[i])
#define FROM_8_USCALED(i)   ((float) ((unsigned char *) ptr)[i])
#define FROM_16_USCALED(i)   ((float) ((unsigned short *) ptr)[i])
#define FROM_32_USCALED(i)   ((float) ((unsigned int *) ptr)[i])
#define FROM_8_SSCALED(i)   ((float) ((char *) ptr)[i])
#define FROM_16_SSCALED(i)   ((float) ((short *) ptr)[i])
#define FROM_32_SSCALED(i)   ((float) ((int *) ptr)[i])
#define FROM_8_UNORM(i)   ((float) ((unsigned char *) ptr)[i] / 255.0f)
#define FROM_16_UNORM(i)   ((float) ((unsigned short *) ptr)[i] / 65535.0f)
#define FROM_32_UNORM(i)   ((float) ((unsigned int *) ptr)[i] / 4294967295.0f)
#define FROM_8_SNORM(i)   ((float) ((char *) ptr)[i] / 127.0f)
#define FROM_16_SNORM(i)   ((float) ((short *) ptr)[i] / 32767.0f)
#define FROM_32_SNORM(i)   ((float) ((int *) ptr)[i] / 2147483647.0f)
#define FROM_32_FIXED(i)   (((int *) ptr)[i] / 65536.0f)
#define TO_64_FLOAT(x)   ((double) x)
#define TO_32_FLOAT(x)   (x)
#define TO_8_USCALED(x)   ((unsigned char) x)
#define TO_16_USCALED(x)   ((unsigned short) x)
#define TO_32_USCALED(x)   ((unsigned int) x)
#define TO_8_SSCALED(x)   ((char) x)
#define TO_16_SSCALED(x)   ((short) x)
#define TO_32_SSCALED(x)   ((int) x)
#define TO_8_UNORM(x)   ((unsigned char) (x * 255.0f))
#define TO_16_UNORM(x)   ((unsigned short) (x * 65535.0f))
#define TO_32_UNORM(x)   ((unsigned int) (x * 4294967295.0f))
#define TO_8_SNORM(x)   ((char) (x * 127.0f))
#define TO_16_SNORM(x)   ((short) (x * 32767.0f))
#define TO_32_SNORM(x)   ((int) (x * 2147483647.0f))
#define TO_32_FIXED(x)   ((int) (x * 65536.0f))

Typedefs

typedef void(* fetch_func )(const void *ptr, float *attrib)
typedef void(* emit_func )(const float *attrib, void *ptr)

Functions

static struct translate_generictranslate_generic (struct translate *translate)
static void fetch_R64G64B64A64_FLOAT (const void *ptr, float *attrib)
static void emit_R64G64B64A64_FLOAT (const float *attrib, void *ptr)
static void fetch_R64G64B64_FLOAT (const void *ptr, float *attrib)
static void emit_R64G64B64_FLOAT (const float *attrib, void *ptr)
static void fetch_R64G64_FLOAT (const void *ptr, float *attrib)
static void emit_R64G64_FLOAT (const float *attrib, void *ptr)
static void fetch_R64_FLOAT (const void *ptr, float *attrib)
static void emit_R64_FLOAT (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_FLOAT (const void *ptr, float *attrib)
static void emit_R32G32B32A32_FLOAT (const float *attrib, void *ptr)
static void fetch_R32G32B32_FLOAT (const void *ptr, float *attrib)
static void emit_R32G32B32_FLOAT (const float *attrib, void *ptr)
static void fetch_R32G32_FLOAT (const void *ptr, float *attrib)
static void emit_R32G32_FLOAT (const float *attrib, void *ptr)
static void fetch_R32_FLOAT (const void *ptr, float *attrib)
static void emit_R32_FLOAT (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_USCALED (const void *ptr, float *attrib)
static void emit_R32G32B32A32_USCALED (const float *attrib, void *ptr)
static void fetch_R32G32B32_USCALED (const void *ptr, float *attrib)
static void emit_R32G32B32_USCALED (const float *attrib, void *ptr)
static void fetch_R32G32_USCALED (const void *ptr, float *attrib)
static void emit_R32G32_USCALED (const float *attrib, void *ptr)
static void fetch_R32_USCALED (const void *ptr, float *attrib)
static void emit_R32_USCALED (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_SSCALED (const void *ptr, float *attrib)
static void emit_R32G32B32A32_SSCALED (const float *attrib, void *ptr)
static void fetch_R32G32B32_SSCALED (const void *ptr, float *attrib)
static void emit_R32G32B32_SSCALED (const float *attrib, void *ptr)
static void fetch_R32G32_SSCALED (const void *ptr, float *attrib)
static void emit_R32G32_SSCALED (const float *attrib, void *ptr)
static void fetch_R32_SSCALED (const void *ptr, float *attrib)
static void emit_R32_SSCALED (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_UNORM (const void *ptr, float *attrib)
static void emit_R32G32B32A32_UNORM (const float *attrib, void *ptr)
static void fetch_R32G32B32_UNORM (const void *ptr, float *attrib)
static void emit_R32G32B32_UNORM (const float *attrib, void *ptr)
static void fetch_R32G32_UNORM (const void *ptr, float *attrib)
static void emit_R32G32_UNORM (const float *attrib, void *ptr)
static void fetch_R32_UNORM (const void *ptr, float *attrib)
static void emit_R32_UNORM (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_SNORM (const void *ptr, float *attrib)
static void emit_R32G32B32A32_SNORM (const float *attrib, void *ptr)
static void fetch_R32G32B32_SNORM (const void *ptr, float *attrib)
static void emit_R32G32B32_SNORM (const float *attrib, void *ptr)
static void fetch_R32G32_SNORM (const void *ptr, float *attrib)
static void emit_R32G32_SNORM (const float *attrib, void *ptr)
static void fetch_R32_SNORM (const void *ptr, float *attrib)
static void emit_R32_SNORM (const float *attrib, void *ptr)
static void fetch_R16G16B16A16_USCALED (const void *ptr, float *attrib)
static void emit_R16G16B16A16_USCALED (const float *attrib, void *ptr)
static void fetch_R16G16B16_USCALED (const void *ptr, float *attrib)
static void emit_R16G16B16_USCALED (const float *attrib, void *ptr)
static void fetch_R16G16_USCALED (const void *ptr, float *attrib)
static void emit_R16G16_USCALED (const float *attrib, void *ptr)
static void fetch_R16_USCALED (const void *ptr, float *attrib)
static void emit_R16_USCALED (const float *attrib, void *ptr)
static void fetch_R16G16B16A16_SSCALED (const void *ptr, float *attrib)
static void emit_R16G16B16A16_SSCALED (const float *attrib, void *ptr)
static void fetch_R16G16B16_SSCALED (const void *ptr, float *attrib)
static void emit_R16G16B16_SSCALED (const float *attrib, void *ptr)
static void fetch_R16G16_SSCALED (const void *ptr, float *attrib)
static void emit_R16G16_SSCALED (const float *attrib, void *ptr)
static void fetch_R16_SSCALED (const void *ptr, float *attrib)
static void emit_R16_SSCALED (const float *attrib, void *ptr)
static void fetch_R16G16B16A16_UNORM (const void *ptr, float *attrib)
static void emit_R16G16B16A16_UNORM (const float *attrib, void *ptr)
static void fetch_R16G16B16_UNORM (const void *ptr, float *attrib)
static void emit_R16G16B16_UNORM (const float *attrib, void *ptr)
static void fetch_R16G16_UNORM (const void *ptr, float *attrib)
static void emit_R16G16_UNORM (const float *attrib, void *ptr)
static void fetch_R16_UNORM (const void *ptr, float *attrib)
static void emit_R16_UNORM (const float *attrib, void *ptr)
static void fetch_R16G16B16A16_SNORM (const void *ptr, float *attrib)
static void emit_R16G16B16A16_SNORM (const float *attrib, void *ptr)
static void fetch_R16G16B16_SNORM (const void *ptr, float *attrib)
static void emit_R16G16B16_SNORM (const float *attrib, void *ptr)
static void fetch_R16G16_SNORM (const void *ptr, float *attrib)
static void emit_R16G16_SNORM (const float *attrib, void *ptr)
static void fetch_R16_SNORM (const void *ptr, float *attrib)
static void emit_R16_SNORM (const float *attrib, void *ptr)
static void fetch_R8G8B8A8_USCALED (const void *ptr, float *attrib)
static void emit_R8G8B8A8_USCALED (const float *attrib, void *ptr)
static void fetch_R8G8B8_USCALED (const void *ptr, float *attrib)
static void emit_R8G8B8_USCALED (const float *attrib, void *ptr)
static void fetch_R8G8_USCALED (const void *ptr, float *attrib)
static void emit_R8G8_USCALED (const float *attrib, void *ptr)
static void fetch_R8_USCALED (const void *ptr, float *attrib)
static void emit_R8_USCALED (const float *attrib, void *ptr)
static void fetch_R8G8B8A8_SSCALED (const void *ptr, float *attrib)
static void emit_R8G8B8A8_SSCALED (const float *attrib, void *ptr)
static void fetch_R8G8B8_SSCALED (const void *ptr, float *attrib)
static void emit_R8G8B8_SSCALED (const float *attrib, void *ptr)
static void fetch_R8G8_SSCALED (const void *ptr, float *attrib)
static void emit_R8G8_SSCALED (const float *attrib, void *ptr)
static void fetch_R8_SSCALED (const void *ptr, float *attrib)
static void emit_R8_SSCALED (const float *attrib, void *ptr)
static void fetch_R8G8B8A8_UNORM (const void *ptr, float *attrib)
static void emit_R8G8B8A8_UNORM (const float *attrib, void *ptr)
static void fetch_R8G8B8_UNORM (const void *ptr, float *attrib)
static void emit_R8G8B8_UNORM (const float *attrib, void *ptr)
static void fetch_R8G8_UNORM (const void *ptr, float *attrib)
static void emit_R8G8_UNORM (const float *attrib, void *ptr)
static void fetch_R8_UNORM (const void *ptr, float *attrib)
static void emit_R8_UNORM (const float *attrib, void *ptr)
static void fetch_R8G8B8A8_SNORM (const void *ptr, float *attrib)
static void emit_R8G8B8A8_SNORM (const float *attrib, void *ptr)
static void fetch_R8G8B8_SNORM (const void *ptr, float *attrib)
static void emit_R8G8B8_SNORM (const float *attrib, void *ptr)
static void fetch_R8G8_SNORM (const void *ptr, float *attrib)
static void emit_R8G8_SNORM (const float *attrib, void *ptr)
static void fetch_R8_SNORM (const void *ptr, float *attrib)
static void emit_R8_SNORM (const float *attrib, void *ptr)
static void fetch_A8R8G8B8_UNORM (const void *ptr, float *attrib)
static void emit_A8R8G8B8_UNORM (const float *attrib, void *ptr)
static void fetch_R32G32B32A32_FIXED (const void *ptr, float *attrib)
static void emit_R32G32B32A32_FIXED (const float *attrib, void *ptr)
static void fetch_R32G32B32_FIXED (const void *ptr, float *attrib)
static void emit_R32G32B32_FIXED (const float *attrib, void *ptr)
static void fetch_R32G32_FIXED (const void *ptr, float *attrib)
static void emit_R32G32_FIXED (const float *attrib, void *ptr)
static void fetch_R32_FIXED (const void *ptr, float *attrib)
static void emit_R32_FIXED (const float *attrib, void *ptr)
static void fetch_B8G8R8A8_UNORM (const void *ptr, float *attrib)
static void emit_B8G8R8A8_UNORM (const float *attrib, void *ptr)
static void fetch_NULL (const void *ptr, float *attrib)
static void emit_NULL (const float *attrib, void *ptr)
static fetch_func get_fetch_func (enum pipe_format format)
static emit_func get_emit_func (enum pipe_format format)
static void PIPE_CDECL generic_run_elts (struct translate *translate, const unsigned *elts, unsigned count, void *output_buffer)
 Fetch vertex attributes for 'count' vertices.
static void PIPE_CDECL generic_run (struct translate *translate, unsigned start, unsigned count, void *output_buffer)
static void generic_set_buffer (struct translate *translate, unsigned buf, const void *ptr, unsigned stride)
static void generic_release (struct translate *translate)
struct translatetranslate_generic_create (const struct translate_key *key)


Define Documentation

#define ATTRIB ( NAME,
SZ,
TYPE,
FROM,
TO   ) 

Value:

static void                                             \
fetch_##NAME(const void *ptr, float *attrib)            \
{                                                       \
   const float defaults[4] = { 0.0f,0.0f,0.0f,1.0f };   \
   unsigned i;                                          \
                                                        \
   for (i = 0; i < SZ; i++) {                           \
      attrib[i] = FROM(i);                              \
   }                                                    \
                                                        \
   for (; i < 4; i++) {                                 \
      attrib[i] = defaults[i];                          \
   }                                                    \
}                                                       \
                                                        \
static void                                             \
emit_##NAME(const float *attrib, void *ptr)             \
{  \
   unsigned i;                                          \
   TYPE *out = (TYPE *)ptr;                             \
                                                        \
   for (i = 0; i < SZ; i++) {                           \
      out[i] = TO(attrib[i]);                           \
   }                                                    \
}
Fetch a float[4] vertex attribute from memory, doing format/type conversion as needed.

This is probably needed/dupliocated elsewhere, eg format conversion, texture sampling etc.

Definition at line 77 of file translate_generic.c.

#define DRAW_DBG   0

Definition at line 38 of file translate_generic.c.

#define FROM_16_SNORM (  )     ((float) ((short *) ptr)[i] / 32767.0f)

Definition at line 121 of file translate_generic.c.

#define FROM_16_SSCALED (  )     ((float) ((short *) ptr)[i])

Definition at line 113 of file translate_generic.c.

#define FROM_16_UNORM (  )     ((float) ((unsigned short *) ptr)[i] / 65535.0f)

Definition at line 117 of file translate_generic.c.

#define FROM_16_USCALED (  )     ((float) ((unsigned short *) ptr)[i])

Definition at line 109 of file translate_generic.c.

#define FROM_32_FIXED (  )     (((int *) ptr)[i] / 65536.0f)

Definition at line 124 of file translate_generic.c.

#define FROM_32_FLOAT (  )     (((float *) ptr)[i])

Definition at line 106 of file translate_generic.c.

#define FROM_32_SNORM (  )     ((float) ((int *) ptr)[i] / 2147483647.0f)

Definition at line 122 of file translate_generic.c.

#define FROM_32_SSCALED (  )     ((float) ((int *) ptr)[i])

Definition at line 114 of file translate_generic.c.

#define FROM_32_UNORM (  )     ((float) ((unsigned int *) ptr)[i] / 4294967295.0f)

Definition at line 118 of file translate_generic.c.

#define FROM_32_USCALED (  )     ((float) ((unsigned int *) ptr)[i])

Definition at line 110 of file translate_generic.c.

#define FROM_64_FLOAT (  )     ((float) ((double *) ptr)[i])

Definition at line 105 of file translate_generic.c.

#define FROM_8_SNORM (  )     ((float) ((char *) ptr)[i] / 127.0f)

Definition at line 120 of file translate_generic.c.

#define FROM_8_SSCALED (  )     ((float) ((char *) ptr)[i])

Definition at line 112 of file translate_generic.c.

#define FROM_8_UNORM (  )     ((float) ((unsigned char *) ptr)[i] / 255.0f)

Definition at line 116 of file translate_generic.c.

#define FROM_8_USCALED (  )     ((float) ((unsigned char *) ptr)[i])

Definition at line 108 of file translate_generic.c.

#define TO_16_SNORM (  )     ((short) (x * 32767.0f))

Definition at line 142 of file translate_generic.c.

#define TO_16_SSCALED (  )     ((short) x)

Definition at line 134 of file translate_generic.c.

#define TO_16_UNORM (  )     ((unsigned short) (x * 65535.0f))

Definition at line 138 of file translate_generic.c.

#define TO_16_USCALED (  )     ((unsigned short) x)

Definition at line 130 of file translate_generic.c.

#define TO_32_FIXED (  )     ((int) (x * 65536.0f))

Definition at line 145 of file translate_generic.c.

#define TO_32_FLOAT (  )     (x)

Definition at line 127 of file translate_generic.c.

#define TO_32_SNORM (  )     ((int) (x * 2147483647.0f))

Definition at line 143 of file translate_generic.c.

#define TO_32_SSCALED (  )     ((int) x)

Definition at line 135 of file translate_generic.c.

#define TO_32_UNORM (  )     ((unsigned int) (x * 4294967295.0f))

Definition at line 139 of file translate_generic.c.

#define TO_32_USCALED (  )     ((unsigned int) x)

Definition at line 131 of file translate_generic.c.

#define TO_64_FLOAT (  )     ((double) x)

Definition at line 126 of file translate_generic.c.

#define TO_8_SNORM (  )     ((char) (x * 127.0f))

Definition at line 141 of file translate_generic.c.

#define TO_8_SSCALED (  )     ((char) x)

Definition at line 133 of file translate_generic.c.

#define TO_8_UNORM (  )     ((unsigned char) (x * 255.0f))

Definition at line 137 of file translate_generic.c.

#define TO_8_USCALED (  )     ((unsigned char) x)

Definition at line 129 of file translate_generic.c.


Typedef Documentation

typedef void(* emit_func)(const float *attrib, void *ptr)

Definition at line 41 of file translate_generic.c.

typedef void(* fetch_func)(const void *ptr, float *attrib)

Definition at line 40 of file translate_generic.c.


Function Documentation

static void emit_A8R8G8B8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 219 of file translate_generic.c.

00231 {

static void emit_B8G8R8A8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 239 of file translate_generic.c.

References TO_8_UNORM.

00240 {
00241    ubyte *out = (ubyte *)ptr;
00242    out[2] = TO_8_UNORM(attrib[0]);
00243    out[1] = TO_8_UNORM(attrib[1]);
00244    out[0] = TO_8_UNORM(attrib[2]);
00245    out[3] = TO_8_UNORM(attrib[3]);
00246 }

static void emit_NULL ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 258 of file translate_generic.c.

00259 {
00260    /* do nothing is the only sensible option */
00261 }

static void emit_R16_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 197 of file translate_generic.c.

00231 {

static void emit_R16_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 187 of file translate_generic.c.

00231 {

static void emit_R16_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 192 of file translate_generic.c.

00231 {

static void emit_R16_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 182 of file translate_generic.c.

00231 {

static void emit_R16G16_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 196 of file translate_generic.c.

00231 {

static void emit_R16G16_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 186 of file translate_generic.c.

00231 {

static void emit_R16G16_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 191 of file translate_generic.c.

00231 {

static void emit_R16G16_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 181 of file translate_generic.c.

00231 {

static void emit_R16G16B16_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 195 of file translate_generic.c.

00231 {

static void emit_R16G16B16_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 185 of file translate_generic.c.

00231 {

static void emit_R16G16B16_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 190 of file translate_generic.c.

00231 {

static void emit_R16G16B16_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 180 of file translate_generic.c.

00231 {

static void emit_R16G16B16A16_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 194 of file translate_generic.c.

00231 {

static void emit_R16G16B16A16_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 184 of file translate_generic.c.

00231 {

static void emit_R16G16B16A16_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 189 of file translate_generic.c.

00231 {

static void emit_R16G16B16A16_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 179 of file translate_generic.c.

00231 {

static void emit_R32_FIXED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 225 of file translate_generic.c.

00231 {

static void emit_R32_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 157 of file translate_generic.c.

00231 {

static void emit_R32_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 177 of file translate_generic.c.

00231 {

static void emit_R32_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 167 of file translate_generic.c.

00231 {

static void emit_R32_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 172 of file translate_generic.c.

00231 {

static void emit_R32_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 162 of file translate_generic.c.

00231 {

static void emit_R32G32_FIXED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 224 of file translate_generic.c.

00231 {

static void emit_R32G32_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 156 of file translate_generic.c.

00231 {

static void emit_R32G32_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 176 of file translate_generic.c.

00231 {

static void emit_R32G32_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 166 of file translate_generic.c.

00231 {

static void emit_R32G32_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 171 of file translate_generic.c.

00231 {

static void emit_R32G32_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 161 of file translate_generic.c.

00231 {

static void emit_R32G32B32_FIXED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 223 of file translate_generic.c.

00231 {

static void emit_R32G32B32_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 155 of file translate_generic.c.

00231 {

static void emit_R32G32B32_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 175 of file translate_generic.c.

00231 {

static void emit_R32G32B32_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 165 of file translate_generic.c.

00231 {

static void emit_R32G32B32_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 170 of file translate_generic.c.

00231 {

static void emit_R32G32B32_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 160 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_FIXED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 222 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 154 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 174 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 164 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 169 of file translate_generic.c.

00231 {

static void emit_R32G32B32A32_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 159 of file translate_generic.c.

00231 {

static void emit_R64_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 152 of file translate_generic.c.

00231 {

static void emit_R64G64_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 151 of file translate_generic.c.

00231 {

static void emit_R64G64B64_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 150 of file translate_generic.c.

00231 {

static void emit_R64G64B64A64_FLOAT ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 149 of file translate_generic.c.

00231 {

static void emit_R8_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 217 of file translate_generic.c.

00231 {

static void emit_R8_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 207 of file translate_generic.c.

00231 {

static void emit_R8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 212 of file translate_generic.c.

00231 {

static void emit_R8_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 202 of file translate_generic.c.

00231 {

static void emit_R8G8_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 216 of file translate_generic.c.

00231 {

static void emit_R8G8_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 206 of file translate_generic.c.

00231 {

static void emit_R8G8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 211 of file translate_generic.c.

00231 {

static void emit_R8G8_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 201 of file translate_generic.c.

00231 {

static void emit_R8G8B8_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 215 of file translate_generic.c.

00231 {

static void emit_R8G8B8_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 205 of file translate_generic.c.

00231 {

static void emit_R8G8B8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 210 of file translate_generic.c.

00231 {

static void emit_R8G8B8_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 200 of file translate_generic.c.

00231 {

static void emit_R8G8B8A8_SNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 214 of file translate_generic.c.

00231 {

static void emit_R8G8B8A8_SSCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 204 of file translate_generic.c.

00231 {

static void emit_R8G8B8A8_UNORM ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 209 of file translate_generic.c.

00231 {

static void emit_R8G8B8A8_USCALED ( const float *  attrib,
void *  ptr 
) [static]

Definition at line 199 of file translate_generic.c.

00231 {

static void fetch_A8R8G8B8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 219 of file translate_generic.c.

00231 {

static void fetch_B8G8R8A8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 230 of file translate_generic.c.

References FROM_8_UNORM.

00231 {
00232    attrib[2] = FROM_8_UNORM(0);
00233    attrib[1] = FROM_8_UNORM(1);
00234    attrib[0] = FROM_8_UNORM(2);
00235    attrib[3] = FROM_8_UNORM(3);
00236 }

static void fetch_NULL ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 249 of file translate_generic.c.

00250 {
00251    attrib[0] = 0;
00252    attrib[1] = 0;
00253    attrib[2] = 0;
00254    attrib[3] = 1;
00255 }

static void fetch_R16_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 197 of file translate_generic.c.

00231 {

static void fetch_R16_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 187 of file translate_generic.c.

00231 {

static void fetch_R16_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 192 of file translate_generic.c.

00231 {

static void fetch_R16_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 182 of file translate_generic.c.

00231 {

static void fetch_R16G16_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 196 of file translate_generic.c.

00231 {

static void fetch_R16G16_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 186 of file translate_generic.c.

00231 {

static void fetch_R16G16_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 191 of file translate_generic.c.

00231 {

static void fetch_R16G16_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 181 of file translate_generic.c.

00231 {

static void fetch_R16G16B16_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 195 of file translate_generic.c.

00231 {

static void fetch_R16G16B16_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 185 of file translate_generic.c.

00231 {

static void fetch_R16G16B16_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 190 of file translate_generic.c.

00231 {

static void fetch_R16G16B16_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 180 of file translate_generic.c.

00231 {

static void fetch_R16G16B16A16_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 194 of file translate_generic.c.

00231 {

static void fetch_R16G16B16A16_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 184 of file translate_generic.c.

00231 {

static void fetch_R16G16B16A16_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 189 of file translate_generic.c.

00231 {

static void fetch_R16G16B16A16_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 179 of file translate_generic.c.

00231 {

static void fetch_R32_FIXED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 225 of file translate_generic.c.

00231 {

static void fetch_R32_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 157 of file translate_generic.c.

00231 {

static void fetch_R32_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 177 of file translate_generic.c.

00231 {

static void fetch_R32_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 167 of file translate_generic.c.

00231 {

static void fetch_R32_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 172 of file translate_generic.c.

00231 {

static void fetch_R32_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 162 of file translate_generic.c.

00231 {

static void fetch_R32G32_FIXED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 224 of file translate_generic.c.

00231 {

static void fetch_R32G32_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 156 of file translate_generic.c.

00231 {

static void fetch_R32G32_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 176 of file translate_generic.c.

00231 {

static void fetch_R32G32_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 166 of file translate_generic.c.

00231 {

static void fetch_R32G32_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 171 of file translate_generic.c.

00231 {

static void fetch_R32G32_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 161 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_FIXED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 223 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 155 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 175 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 165 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 170 of file translate_generic.c.

00231 {

static void fetch_R32G32B32_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 160 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_FIXED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 222 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 154 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 174 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 164 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 169 of file translate_generic.c.

00231 {

static void fetch_R32G32B32A32_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 159 of file translate_generic.c.

00231 {

static void fetch_R64_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 152 of file translate_generic.c.

00231 {

static void fetch_R64G64_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 151 of file translate_generic.c.

00231 {

static void fetch_R64G64B64_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 150 of file translate_generic.c.

00231 {

static void fetch_R64G64B64A64_FLOAT ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 149 of file translate_generic.c.

00231 {

static void fetch_R8_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 217 of file translate_generic.c.

00231 {

static void fetch_R8_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 207 of file translate_generic.c.

00231 {

static void fetch_R8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 212 of file translate_generic.c.

00231 {

static void fetch_R8_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 202 of file translate_generic.c.

00231 {

static void fetch_R8G8_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 216 of file translate_generic.c.

00231 {

static void fetch_R8G8_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 206 of file translate_generic.c.

00231 {

static void fetch_R8G8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 211 of file translate_generic.c.

00231 {

static void fetch_R8G8_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 201 of file translate_generic.c.

00231 {

static void fetch_R8G8B8_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 215 of file translate_generic.c.

00231 {

static void fetch_R8G8B8_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 205 of file translate_generic.c.

00231 {

static void fetch_R8G8B8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 210 of file translate_generic.c.

00231 {

static void fetch_R8G8B8_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 200 of file translate_generic.c.

00231 {

static void fetch_R8G8B8A8_SNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 214 of file translate_generic.c.

00231 {

static void fetch_R8G8B8A8_SSCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 204 of file translate_generic.c.

00231 {

static void fetch_R8G8B8A8_UNORM ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 209 of file translate_generic.c.

00231 {

static void fetch_R8G8B8A8_USCALED ( const void *  ptr,
float *  attrib 
) [static]

Definition at line 199 of file translate_generic.c.

00231 {

static void generic_release ( struct translate translate  )  [static]

Definition at line 664 of file translate_generic.c.

References FREE.

00665 {
00666    /* Refcount?
00667     */
00668    FREE(translate);
00669 }

static void PIPE_CDECL generic_run ( struct translate translate,
unsigned  start,
unsigned  count,
void *  output_buffer 
) [static]

Definition at line 607 of file translate_generic.c.

References translate_generic::attrib, debug_printf(), translate_generic::emit, translate_generic::fetch, translate_generic::input_ptr, translate_generic::input_stride, translate::key, translate_generic::nr_attrib, translate_generic::output_offset, translate_key::output_stride, translate_generic::translate, and translate_generic().

00611 {
00612    struct translate_generic *tg = translate_generic(translate);
00613    char *vert = output_buffer;
00614    unsigned nr_attrs = tg->nr_attrib;
00615    unsigned attr;
00616    unsigned i;
00617 
00618    /* loop over vertex attributes (vertex shader inputs)
00619     */
00620    for (i = 0; i < count; i++) {
00621       unsigned elt = start + i;
00622 
00623       for (attr = 0; attr < nr_attrs; attr++) {
00624          float data[4];
00625 
00626          const char *src = (tg->attrib[attr].input_ptr + 
00627                             tg->attrib[attr].input_stride * elt);
00628 
00629          char *dst = (vert + 
00630                       tg->attrib[attr].output_offset);
00631 
00632          tg->attrib[attr].fetch( src, data );
00633 
00634          if (0) debug_printf("vert %d attr %d: %f %f %f %f\n",
00635                              i, attr, data[0], data[1], data[2], data[3]);
00636 
00637          tg->attrib[attr].emit( data, dst );
00638       }
00639       
00640       vert += tg->translate.key.output_stride;
00641    }
00642 }

static void PIPE_CDECL generic_run_elts ( struct translate translate,
const unsigned *  elts,
unsigned  count,
void *  output_buffer 
) [static]

Fetch vertex attributes for 'count' vertices.

Definition at line 568 of file translate_generic.c.

References translate_generic::attrib, debug_printf(), translate_generic::emit, translate_generic::fetch, translate_generic::input_ptr, translate_generic::input_stride, translate::key, translate_generic::nr_attrib, translate_generic::output_offset, translate_key::output_stride, translate_generic::translate, and translate_generic().

00572 {
00573    struct translate_generic *tg = translate_generic(translate);
00574    char *vert = output_buffer;
00575    unsigned nr_attrs = tg->nr_attrib;
00576    unsigned attr;
00577    unsigned i;
00578 
00579    /* loop over vertex attributes (vertex shader inputs)
00580     */
00581    for (i = 0; i < count; i++) {
00582       unsigned elt = *elts++;
00583 
00584       for (attr = 0; attr < nr_attrs; attr++) {
00585          float data[4];
00586 
00587          const char *src = (tg->attrib[attr].input_ptr + 
00588                             tg->attrib[attr].input_stride * elt);
00589 
00590          char *dst = (vert + 
00591                       tg->attrib[attr].output_offset);
00592 
00593          tg->attrib[attr].fetch( src, data );
00594 
00595          if (0) debug_printf("vert %d/%d attr %d: %f %f %f %f\n",
00596                              i, elt, attr, data[0], data[1], data[2], data[3]);
00597 
00598          tg->attrib[attr].emit( data, dst );
00599       }
00600       
00601       vert += tg->translate.key.output_stride;
00602    }
00603 }

static void generic_set_buffer ( struct translate translate,
unsigned  buf,
const void *  ptr,
unsigned  stride 
) [static]

Definition at line 646 of file translate_generic.c.

References translate_generic::attrib, translate_generic::buffer, translate_generic::input_offset, translate_generic::input_ptr, translate_generic::input_stride, translate_generic::nr_attrib, and translate_generic().

00650 {
00651    struct translate_generic *tg = translate_generic(translate);
00652    unsigned i;
00653 
00654    for (i = 0; i < tg->nr_attrib; i++) {
00655       if (tg->attrib[i].buffer == buf) {
00656          tg->attrib[i].input_ptr = ((char *)ptr +
00657                                     tg->attrib[i].input_offset);
00658          tg->attrib[i].input_stride = stride;
00659       }
00660    }
00661 }

static emit_func get_emit_func ( enum pipe_format  format  )  [static]

Definition at line 416 of file translate_generic.c.

References assert, emit_A8R8G8B8_UNORM(), emit_B8G8R8A8_UNORM(), emit_NULL(), emit_R16_SNORM(), emit_R16_SSCALED(), emit_R16_UNORM(), emit_R16_USCALED(), emit_R16G16_SNORM(), emit_R16G16_SSCALED(), emit_R16G16_UNORM(), emit_R16G16_USCALED(), emit_R16G16B16_SNORM(), emit_R16G16B16_SSCALED(), emit_R16G16B16_UNORM(), emit_R16G16B16_USCALED(), emit_R16G16B16A16_SNORM(), emit_R16G16B16A16_SSCALED(), emit_R16G16B16A16_UNORM(), emit_R16G16B16A16_USCALED(), emit_R32_FIXED(), emit_R32_FLOAT(), emit_R32_SNORM(), emit_R32_SSCALED(), emit_R32_UNORM(), emit_R32_USCALED(), emit_R32G32_FIXED(), emit_R32G32_FLOAT(), emit_R32G32_SNORM(), emit_R32G32_SSCALED(), emit_R32G32_UNORM(), emit_R32G32_USCALED(), emit_R32G32B32_FIXED(), emit_R32G32B32_FLOAT(), emit_R32G32B32_SNORM(), emit_R32G32B32_SSCALED(), emit_R32G32B32_UNORM(), emit_R32G32B32_USCALED(), emit_R32G32B32A32_FIXED(), emit_R32G32B32A32_FLOAT(), emit_R32G32B32A32_SNORM(), emit_R32G32B32A32_SSCALED(), emit_R32G32B32A32_UNORM(), emit_R32G32B32A32_USCALED(), emit_R64_FLOAT(), emit_R64G64_FLOAT(), emit_R64G64B64_FLOAT(), emit_R64G64B64A64_FLOAT(), emit_R8_SNORM(), emit_R8_SSCALED(), emit_R8_UNORM(), emit_R8_USCALED(), emit_R8G8_SNORM(), emit_R8G8_SSCALED(), emit_R8G8_UNORM(), emit_R8G8_USCALED(), emit_R8G8B8_SNORM(), emit_R8G8B8_SSCALED(), emit_R8G8B8_UNORM(), emit_R8G8B8_USCALED(), emit_R8G8B8A8_SNORM(), emit_R8G8B8A8_SSCALED(), emit_R8G8B8A8_UNORM(), emit_R8G8B8A8_USCALED(), PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_FORMAT_R16_SNORM, PIPE_FORMAT_R16_SSCALED, PIPE_FORMAT_R16_UNORM, PIPE_FORMAT_R16_USCALED, PIPE_FORMAT_R16G16_SNORM, PIPE_FORMAT_R16G16_SSCALED, PIPE_FORMAT_R16G16_UNORM, PIPE_FORMAT_R16G16_USCALED, PIPE_FORMAT_R16G16B16_SNORM, PIPE_FORMAT_R16G16B16_SSCALED, PIPE_FORMAT_R16G16B16_UNORM, PIPE_FORMAT_R16G16B16_USCALED, PIPE_FORMAT_R16G16B16A16_SNORM, PIPE_FORMAT_R16G16B16A16_SSCALED, PIPE_FORMAT_R16G16B16A16_UNORM, PIPE_FORMAT_R16G16B16A16_USCALED, PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32_SNORM, PIPE_FORMAT_R32_SSCALED, PIPE_FORMAT_R32_UNORM, PIPE_FORMAT_R32_USCALED, PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32_SNORM, PIPE_FORMAT_R32G32_SSCALED, PIPE_FORMAT_R32G32_UNORM, PIPE_FORMAT_R32G32_USCALED, PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32_SNORM, PIPE_FORMAT_R32G32B32_SSCALED, PIPE_FORMAT_R32G32B32_UNORM, PIPE_FORMAT_R32G32B32_USCALED, PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_SNORM, PIPE_FORMAT_R32G32B32A32_SSCALED, PIPE_FORMAT_R32G32B32A32_UNORM, PIPE_FORMAT_R32G32B32A32_USCALED, PIPE_FORMAT_R64_FLOAT, PIPE_FORMAT_R64G64_FLOAT, PIPE_FORMAT_R64G64B64_FLOAT, PIPE_FORMAT_R64G64B64A64_FLOAT, PIPE_FORMAT_R8_SNORM, PIPE_FORMAT_R8_SSCALED, PIPE_FORMAT_R8_UNORM, PIPE_FORMAT_R8_USCALED, PIPE_FORMAT_R8G8_SNORM, PIPE_FORMAT_R8G8_SSCALED, PIPE_FORMAT_R8G8_UNORM, PIPE_FORMAT_R8G8_USCALED, PIPE_FORMAT_R8G8B8_SNORM, PIPE_FORMAT_R8G8B8_SSCALED, PIPE_FORMAT_R8G8B8_UNORM, PIPE_FORMAT_R8G8B8_USCALED, PIPE_FORMAT_R8G8B8A8_SNORM, PIPE_FORMAT_R8G8B8A8_SSCALED, PIPE_FORMAT_R8G8B8A8_UNORM, and PIPE_FORMAT_R8G8B8A8_USCALED.

00417 {
00418    /* silence warnings */
00419    (void) emit_R32G32B32A32_FIXED;
00420    (void) emit_R32G32B32_FIXED;
00421    (void) emit_R32G32_FIXED;
00422    (void) emit_R32_FIXED;
00423 
00424    switch (format) {
00425    case PIPE_FORMAT_R64_FLOAT:
00426       return &emit_R64_FLOAT;
00427    case PIPE_FORMAT_R64G64_FLOAT:
00428       return &emit_R64G64_FLOAT;
00429    case PIPE_FORMAT_R64G64B64_FLOAT:
00430       return &emit_R64G64B64_FLOAT;
00431    case PIPE_FORMAT_R64G64B64A64_FLOAT:
00432       return &emit_R64G64B64A64_FLOAT;
00433 
00434    case PIPE_FORMAT_R32_FLOAT:
00435       return &emit_R32_FLOAT;
00436    case PIPE_FORMAT_R32G32_FLOAT:
00437       return &emit_R32G32_FLOAT;
00438    case PIPE_FORMAT_R32G32B32_FLOAT:
00439       return &emit_R32G32B32_FLOAT;
00440    case PIPE_FORMAT_R32G32B32A32_FLOAT:
00441       return &emit_R32G32B32A32_FLOAT;
00442 
00443    case PIPE_FORMAT_R32_UNORM:
00444       return &emit_R32_UNORM;
00445    case PIPE_FORMAT_R32G32_UNORM:
00446       return &emit_R32G32_UNORM;
00447    case PIPE_FORMAT_R32G32B32_UNORM:
00448       return &emit_R32G32B32_UNORM;
00449    case PIPE_FORMAT_R32G32B32A32_UNORM:
00450       return &emit_R32G32B32A32_UNORM;
00451 
00452    case PIPE_FORMAT_R32_USCALED:
00453       return &emit_R32_USCALED;
00454    case PIPE_FORMAT_R32G32_USCALED:
00455       return &emit_R32G32_USCALED;
00456    case PIPE_FORMAT_R32G32B32_USCALED:
00457       return &emit_R32G32B32_USCALED;
00458    case PIPE_FORMAT_R32G32B32A32_USCALED:
00459       return &emit_R32G32B32A32_USCALED;
00460 
00461    case PIPE_FORMAT_R32_SNORM:
00462       return &emit_R32_SNORM;
00463    case PIPE_FORMAT_R32G32_SNORM:
00464       return &emit_R32G32_SNORM;
00465    case PIPE_FORMAT_R32G32B32_SNORM:
00466       return &emit_R32G32B32_SNORM;
00467    case PIPE_FORMAT_R32G32B32A32_SNORM:
00468       return &emit_R32G32B32A32_SNORM;
00469 
00470    case PIPE_FORMAT_R32_SSCALED:
00471       return &emit_R32_SSCALED;
00472    case PIPE_FORMAT_R32G32_SSCALED:
00473       return &emit_R32G32_SSCALED;
00474    case PIPE_FORMAT_R32G32B32_SSCALED:
00475       return &emit_R32G32B32_SSCALED;
00476    case PIPE_FORMAT_R32G32B32A32_SSCALED:
00477       return &emit_R32G32B32A32_SSCALED;
00478 
00479    case PIPE_FORMAT_R16_UNORM:
00480       return &emit_R16_UNORM;
00481    case PIPE_FORMAT_R16G16_UNORM:
00482       return &emit_R16G16_UNORM;
00483    case PIPE_FORMAT_R16G16B16_UNORM:
00484       return &emit_R16G16B16_UNORM;
00485    case PIPE_FORMAT_R16G16B16A16_UNORM:
00486       return &emit_R16G16B16A16_UNORM;
00487 
00488    case PIPE_FORMAT_R16_USCALED:
00489       return &emit_R16_USCALED;
00490    case PIPE_FORMAT_R16G16_USCALED:
00491       return &emit_R16G16_USCALED;
00492    case PIPE_FORMAT_R16G16B16_USCALED:
00493       return &emit_R16G16B16_USCALED;
00494    case PIPE_FORMAT_R16G16B16A16_USCALED:
00495       return &emit_R16G16B16A16_USCALED;
00496 
00497    case PIPE_FORMAT_R16_SNORM:
00498       return &emit_R16_SNORM;
00499    case PIPE_FORMAT_R16G16_SNORM:
00500       return &emit_R16G16_SNORM;
00501    case PIPE_FORMAT_R16G16B16_SNORM:
00502       return &emit_R16G16B16_SNORM;
00503    case PIPE_FORMAT_R16G16B16A16_SNORM:
00504       return &emit_R16G16B16A16_SNORM;
00505 
00506    case PIPE_FORMAT_R16_SSCALED:
00507       return &emit_R16_SSCALED;
00508    case PIPE_FORMAT_R16G16_SSCALED:
00509       return &emit_R16G16_SSCALED;
00510    case PIPE_FORMAT_R16G16B16_SSCALED:
00511       return &emit_R16G16B16_SSCALED;
00512    case PIPE_FORMAT_R16G16B16A16_SSCALED:
00513       return &emit_R16G16B16A16_SSCALED;
00514 
00515    case PIPE_FORMAT_R8_UNORM:
00516       return &emit_R8_UNORM;
00517    case PIPE_FORMAT_R8G8_UNORM:
00518       return &emit_R8G8_UNORM;
00519    case PIPE_FORMAT_R8G8B8_UNORM:
00520       return &emit_R8G8B8_UNORM;
00521    case PIPE_FORMAT_R8G8B8A8_UNORM:
00522       return &emit_R8G8B8A8_UNORM;
00523 
00524    case PIPE_FORMAT_R8_USCALED:
00525       return &emit_R8_USCALED;
00526    case PIPE_FORMAT_R8G8_USCALED:
00527       return &emit_R8G8_USCALED;
00528    case PIPE_FORMAT_R8G8B8_USCALED:
00529       return &emit_R8G8B8_USCALED;
00530    case PIPE_FORMAT_R8G8B8A8_USCALED:
00531       return &emit_R8G8B8A8_USCALED;
00532 
00533    case PIPE_FORMAT_R8_SNORM:
00534       return &emit_R8_SNORM;
00535    case PIPE_FORMAT_R8G8_SNORM:
00536       return &emit_R8G8_SNORM;
00537    case PIPE_FORMAT_R8G8B8_SNORM:
00538       return &emit_R8G8B8_SNORM;
00539    case PIPE_FORMAT_R8G8B8A8_SNORM:
00540       return &emit_R8G8B8A8_SNORM;
00541 
00542    case PIPE_FORMAT_R8_SSCALED:
00543       return &emit_R8_SSCALED;
00544    case PIPE_FORMAT_R8G8_SSCALED:
00545       return &emit_R8G8_SSCALED;
00546    case PIPE_FORMAT_R8G8B8_SSCALED:
00547       return &emit_R8G8B8_SSCALED;
00548    case PIPE_FORMAT_R8G8B8A8_SSCALED:
00549       return &emit_R8G8B8A8_SSCALED;
00550 
00551    case PIPE_FORMAT_A8R8G8B8_UNORM:
00552       return &emit_A8R8G8B8_UNORM;
00553 
00554    case PIPE_FORMAT_B8G8R8A8_UNORM:
00555       return &emit_B8G8R8A8_UNORM;
00556 
00557    default:
00558       assert(0); 
00559       return &emit_NULL;
00560    }
00561 }

static fetch_func get_fetch_func ( enum pipe_format  format  )  [static]

Definition at line 263 of file translate_generic.c.

References assert, fetch_A8R8G8B8_UNORM(), fetch_B8G8R8A8_UNORM(), fetch_NULL(), fetch_R16_SNORM(), fetch_R16_SSCALED(), fetch_R16_UNORM(), fetch_R16_USCALED(), fetch_R16G16_SNORM(), fetch_R16G16_SSCALED(), fetch_R16G16_UNORM(), fetch_R16G16_USCALED(), fetch_R16G16B16_SNORM(), fetch_R16G16B16_SSCALED(), fetch_R16G16B16_UNORM(), fetch_R16G16B16_USCALED(), fetch_R16G16B16A16_SNORM(), fetch_R16G16B16A16_SSCALED(), fetch_R16G16B16A16_UNORM(), fetch_R16G16B16A16_USCALED(), fetch_R32_FIXED(), fetch_R32_FLOAT(), fetch_R32_SNORM(), fetch_R32_SSCALED(), fetch_R32_UNORM(), fetch_R32_USCALED(), fetch_R32G32_FIXED(), fetch_R32G32_FLOAT(), fetch_R32G32_SNORM(), fetch_R32G32_SSCALED(), fetch_R32G32_UNORM(), fetch_R32G32_USCALED(), fetch_R32G32B32_FIXED(), fetch_R32G32B32_FLOAT(), fetch_R32G32B32_SNORM(), fetch_R32G32B32_SSCALED(), fetch_R32G32B32_UNORM(), fetch_R32G32B32_USCALED(), fetch_R32G32B32A32_FIXED(), fetch_R32G32B32A32_FLOAT(), fetch_R32G32B32A32_SNORM(), fetch_R32G32B32A32_SSCALED(), fetch_R32G32B32A32_UNORM(), fetch_R32G32B32A32_USCALED(), fetch_R64_FLOAT(), fetch_R64G64_FLOAT(), fetch_R64G64B64_FLOAT(), fetch_R64G64B64A64_FLOAT(), fetch_R8_SNORM(), fetch_R8_SSCALED(), fetch_R8_UNORM(), fetch_R8_USCALED(), fetch_R8G8_SNORM(), fetch_R8G8_SSCALED(), fetch_R8G8_UNORM(), fetch_R8G8_USCALED(), fetch_R8G8B8_SNORM(), fetch_R8G8B8_SSCALED(), fetch_R8G8B8_UNORM(), fetch_R8G8B8_USCALED(), fetch_R8G8B8A8_SNORM(), fetch_R8G8B8A8_SSCALED(), fetch_R8G8B8A8_UNORM(), fetch_R8G8B8A8_USCALED(), PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_FORMAT_R16_SNORM, PIPE_FORMAT_R16_SSCALED, PIPE_FORMAT_R16_UNORM, PIPE_FORMAT_R16_USCALED, PIPE_FORMAT_R16G16_SNORM, PIPE_FORMAT_R16G16_SSCALED, PIPE_FORMAT_R16G16_UNORM, PIPE_FORMAT_R16G16_USCALED, PIPE_FORMAT_R16G16B16_SNORM, PIPE_FORMAT_R16G16B16_SSCALED, PIPE_FORMAT_R16G16B16_UNORM, PIPE_FORMAT_R16G16B16_USCALED, PIPE_FORMAT_R16G16B16A16_SNORM, PIPE_FORMAT_R16G16B16A16_SSCALED, PIPE_FORMAT_R16G16B16A16_UNORM, PIPE_FORMAT_R16G16B16A16_USCALED, PIPE_FORMAT_R32_FIXED, PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32_SNORM, PIPE_FORMAT_R32_SSCALED, PIPE_FORMAT_R32_UNORM, PIPE_FORMAT_R32_USCALED, PIPE_FORMAT_R32G32_FIXED, PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32_SNORM, PIPE_FORMAT_R32G32_SSCALED, PIPE_FORMAT_R32G32_UNORM, PIPE_FORMAT_R32G32_USCALED, PIPE_FORMAT_R32G32B32_FIXED, PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32_SNORM, PIPE_FORMAT_R32G32B32_SSCALED, PIPE_FORMAT_R32G32B32_UNORM, PIPE_FORMAT_R32G32B32_USCALED, PIPE_FORMAT_R32G32B32A32_FIXED, PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_R32G32B32A32_SNORM, PIPE_FORMAT_R32G32B32A32_SSCALED, PIPE_FORMAT_R32G32B32A32_UNORM, PIPE_FORMAT_R32G32B32A32_USCALED, PIPE_FORMAT_R64_FLOAT, PIPE_FORMAT_R64G64_FLOAT, PIPE_FORMAT_R64G64B64_FLOAT, PIPE_FORMAT_R64G64B64A64_FLOAT, PIPE_FORMAT_R8_SNORM, PIPE_FORMAT_R8_SSCALED, PIPE_FORMAT_R8_UNORM, PIPE_FORMAT_R8_USCALED, PIPE_FORMAT_R8G8_SNORM, PIPE_FORMAT_R8G8_SSCALED, PIPE_FORMAT_R8G8_UNORM, PIPE_FORMAT_R8G8_USCALED, PIPE_FORMAT_R8G8B8_SNORM, PIPE_FORMAT_R8G8B8_SSCALED, PIPE_FORMAT_R8G8B8_UNORM, PIPE_FORMAT_R8G8B8_USCALED, PIPE_FORMAT_R8G8B8A8_SNORM, PIPE_FORMAT_R8G8B8A8_SSCALED, PIPE_FORMAT_R8G8B8A8_UNORM, and PIPE_FORMAT_R8G8B8A8_USCALED.

00264 {
00265    switch (format) {
00266    case PIPE_FORMAT_R64_FLOAT:
00267       return &fetch_R64_FLOAT;
00268    case PIPE_FORMAT_R64G64_FLOAT:
00269       return &fetch_R64G64_FLOAT;
00270    case PIPE_FORMAT_R64G64B64_FLOAT:
00271       return &fetch_R64G64B64_FLOAT;
00272    case PIPE_FORMAT_R64G64B64A64_FLOAT:
00273       return &fetch_R64G64B64A64_FLOAT;
00274 
00275    case PIPE_FORMAT_R32_FLOAT:
00276       return &fetch_R32_FLOAT;
00277    case PIPE_FORMAT_R32G32_FLOAT:
00278       return &fetch_R32G32_FLOAT;
00279    case PIPE_FORMAT_R32G32B32_FLOAT:
00280       return &fetch_R32G32B32_FLOAT;
00281    case PIPE_FORMAT_R32G32B32A32_FLOAT:
00282       return &fetch_R32G32B32A32_FLOAT;
00283 
00284    case PIPE_FORMAT_R32_UNORM:
00285       return &fetch_R32_UNORM;
00286    case PIPE_FORMAT_R32G32_UNORM:
00287       return &fetch_R32G32_UNORM;
00288    case PIPE_FORMAT_R32G32B32_UNORM:
00289       return &fetch_R32G32B32_UNORM;
00290    case PIPE_FORMAT_R32G32B32A32_UNORM:
00291       return &fetch_R32G32B32A32_UNORM;
00292 
00293    case PIPE_FORMAT_R32_USCALED:
00294       return &fetch_R32_USCALED;
00295    case PIPE_FORMAT_R32G32_USCALED:
00296       return &fetch_R32G32_USCALED;
00297    case PIPE_FORMAT_R32G32B32_USCALED:
00298       return &fetch_R32G32B32_USCALED;
00299    case PIPE_FORMAT_R32G32B32A32_USCALED:
00300       return &fetch_R32G32B32A32_USCALED;
00301 
00302    case PIPE_FORMAT_R32_SNORM:
00303       return &fetch_R32_SNORM;
00304    case PIPE_FORMAT_R32G32_SNORM:
00305       return &fetch_R32G32_SNORM;
00306    case PIPE_FORMAT_R32G32B32_SNORM:
00307       return &fetch_R32G32B32_SNORM;
00308    case PIPE_FORMAT_R32G32B32A32_SNORM:
00309       return &fetch_R32G32B32A32_SNORM;
00310 
00311    case PIPE_FORMAT_R32_SSCALED:
00312       return &fetch_R32_SSCALED;
00313    case PIPE_FORMAT_R32G32_SSCALED:
00314       return &fetch_R32G32_SSCALED;
00315    case PIPE_FORMAT_R32G32B32_SSCALED:
00316       return &fetch_R32G32B32_SSCALED;
00317    case PIPE_FORMAT_R32G32B32A32_SSCALED:
00318       return &fetch_R32G32B32A32_SSCALED;
00319 
00320    case PIPE_FORMAT_R16_UNORM:
00321       return &fetch_R16_UNORM;
00322    case PIPE_FORMAT_R16G16_UNORM:
00323       return &fetch_R16G16_UNORM;
00324    case PIPE_FORMAT_R16G16B16_UNORM:
00325       return &fetch_R16G16B16_UNORM;
00326    case PIPE_FORMAT_R16G16B16A16_UNORM:
00327       return &fetch_R16G16B16A16_UNORM;
00328 
00329    case PIPE_FORMAT_R16_USCALED:
00330       return &fetch_R16_USCALED;
00331    case PIPE_FORMAT_R16G16_USCALED:
00332       return &fetch_R16G16_USCALED;
00333    case PIPE_FORMAT_R16G16B16_USCALED:
00334       return &fetch_R16G16B16_USCALED;
00335    case PIPE_FORMAT_R16G16B16A16_USCALED:
00336       return &fetch_R16G16B16A16_USCALED;
00337 
00338    case PIPE_FORMAT_R16_SNORM:
00339       return &fetch_R16_SNORM;
00340    case PIPE_FORMAT_R16G16_SNORM:
00341       return &fetch_R16G16_SNORM;
00342    case PIPE_FORMAT_R16G16B16_SNORM:
00343       return &fetch_R16G16B16_SNORM;
00344    case PIPE_FORMAT_R16G16B16A16_SNORM:
00345       return &fetch_R16G16B16A16_SNORM;
00346 
00347    case PIPE_FORMAT_R16_SSCALED:
00348       return &fetch_R16_SSCALED;
00349    case PIPE_FORMAT_R16G16_SSCALED:
00350       return &fetch_R16G16_SSCALED;
00351    case PIPE_FORMAT_R16G16B16_SSCALED:
00352       return &fetch_R16G16B16_SSCALED;
00353    case PIPE_FORMAT_R16G16B16A16_SSCALED:
00354       return &fetch_R16G16B16A16_SSCALED;
00355 
00356    case PIPE_FORMAT_R8_UNORM:
00357       return &fetch_R8_UNORM;
00358    case PIPE_FORMAT_R8G8_UNORM:
00359       return &fetch_R8G8_UNORM;
00360    case PIPE_FORMAT_R8G8B8_UNORM:
00361       return &fetch_R8G8B8_UNORM;
00362    case PIPE_FORMAT_R8G8B8A8_UNORM:
00363       return &fetch_R8G8B8A8_UNORM;
00364 
00365    case PIPE_FORMAT_R8_USCALED:
00366       return &fetch_R8_USCALED;
00367    case PIPE_FORMAT_R8G8_USCALED:
00368       return &fetch_R8G8_USCALED;
00369    case PIPE_FORMAT_R8G8B8_USCALED:
00370       return &fetch_R8G8B8_USCALED;
00371    case PIPE_FORMAT_R8G8B8A8_USCALED:
00372       return &fetch_R8G8B8A8_USCALED;
00373 
00374    case PIPE_FORMAT_R8_SNORM:
00375       return &fetch_R8_SNORM;
00376    case PIPE_FORMAT_R8G8_SNORM:
00377       return &fetch_R8G8_SNORM;
00378    case PIPE_FORMAT_R8G8B8_SNORM:
00379       return &fetch_R8G8B8_SNORM;
00380    case PIPE_FORMAT_R8G8B8A8_SNORM:
00381       return &fetch_R8G8B8A8_SNORM;
00382 
00383    case PIPE_FORMAT_R8_SSCALED:
00384       return &fetch_R8_SSCALED;
00385    case PIPE_FORMAT_R8G8_SSCALED:
00386       return &fetch_R8G8_SSCALED;
00387    case PIPE_FORMAT_R8G8B8_SSCALED:
00388       return &fetch_R8G8B8_SSCALED;
00389    case PIPE_FORMAT_R8G8B8A8_SSCALED:
00390       return &fetch_R8G8B8A8_SSCALED;
00391 
00392    case PIPE_FORMAT_A8R8G8B8_UNORM:
00393       return &fetch_A8R8G8B8_UNORM;
00394 
00395    case PIPE_FORMAT_B8G8R8A8_UNORM:
00396       return &fetch_B8G8R8A8_UNORM;
00397 
00398    case PIPE_FORMAT_R32_FIXED:
00399       return &fetch_R32_FIXED;
00400    case PIPE_FORMAT_R32G32_FIXED:
00401       return &fetch_R32G32_FIXED;
00402    case PIPE_FORMAT_R32G32B32_FIXED:
00403       return &fetch_R32G32B32_FIXED;
00404    case PIPE_FORMAT_R32G32B32A32_FIXED:
00405       return &fetch_R32G32B32A32_FIXED;
00406 
00407    default:
00408       assert(0); 
00409       return &fetch_NULL;
00410    }
00411 }

static struct translate_generic* translate_generic ( struct translate translate  )  [static, read]

Definition at line 65 of file translate_generic.c.

00066 {
00067    return (struct translate_generic *)translate;
00068 }

struct translate* translate_generic_create ( const struct translate_key key  )  [read]

Definition at line 671 of file translate_generic.c.

References translate_generic::attrib, translate_generic::buffer, CALLOC_STRUCT, translate_key::element, translate_generic::emit, translate_generic::fetch, generic_release(), generic_run(), generic_run_elts(), generic_set_buffer(), get_emit_func(), get_fetch_func(), translate_element::input_buffer, translate_element::input_format, translate_element::input_offset, translate_generic::input_offset, translate::key, translate_generic::nr_attrib, translate_key::nr_elements, translate_element::output_format, translate_element::output_offset, translate_generic::output_offset, translate::release, translate::set_buffer, and translate_generic::translate.

00672 {
00673    struct translate_generic *tg = CALLOC_STRUCT(translate_generic);
00674    unsigned i;
00675 
00676    if (tg == NULL)
00677       return NULL;
00678 
00679    tg->translate.key = *key;
00680    tg->translate.release = generic_release;
00681    tg->translate.set_buffer = generic_set_buffer;
00682    tg->translate.run_elts = generic_run_elts;
00683    tg->translate.run = generic_run;
00684 
00685    for (i = 0; i < key->nr_elements; i++) {
00686 
00687       tg->attrib[i].fetch = get_fetch_func(key->element[i].input_format);
00688       tg->attrib[i].buffer = key->element[i].input_buffer;
00689       tg->attrib[i].input_offset = key->element[i].input_offset;
00690 
00691       tg->attrib[i].emit = get_emit_func(key->element[i].output_format);
00692       tg->attrib[i].output_offset = key->element[i].output_offset;
00693 
00694    }
00695 
00696    tg->nr_attrib = key->nr_elements;
00697 
00698 
00699    return &tg->translate;
00700 }


Generated on Tue Sep 29 06:25:27 2009 for Gallium3D by  doxygen 1.5.4