spu_colorpack.h File Reference

Include dependency graph for spu_colorpack.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static unsigned int spu_pack_R8G8B8A8 (vector float rgba)
static unsigned int spu_pack_A8R8G8B8 (vector float rgba)
static unsigned int spu_pack_B8G8R8A8 (vector float rgba)
static unsigned int spu_pack_color_shuffle (vector float rgba, vector unsigned char shuffle)
static vector float spu_unpack_B8G8R8A8 (uint color)
static vector float spu_unpack_A8R8G8B8 (uint color)


Function Documentation

static unsigned int spu_pack_A8R8G8B8 ( vector float  rgba  )  [static]

Definition at line 51 of file spu_colorpack.h.

00052 {
00053   vector unsigned int out = spu_convtu(rgba, 32);
00054   out = spu_shuffle(out, out, ((vector unsigned char) {
00055                                   12, 0, 4, 8, 0, 0, 0, 0, 
00056                                   0, 0, 0, 0, 0, 0, 0, 0}) );
00057   return spu_extract(out, 0);
00058 }

static unsigned int spu_pack_B8G8R8A8 ( vector float  rgba  )  [static]

Definition at line 62 of file spu_colorpack.h.

00063 {
00064   vector unsigned int out = spu_convtu(rgba, 32);
00065   out = spu_shuffle(out, out, ((vector unsigned char) {
00066                                   8, 4, 0, 12, 0, 0, 0, 0, 
00067                                   0, 0, 0, 0, 0, 0, 0, 0}) );
00068   return spu_extract(out, 0);
00069 }

static unsigned int spu_pack_color_shuffle ( vector float  rgba,
vector unsigned char  shuffle 
) [static]

Definition at line 73 of file spu_colorpack.h.

00074 {
00075   vector unsigned int out = spu_convtu(rgba, 32);
00076   out = spu_shuffle(out, out, shuffle);
00077   return spu_extract(out, 0);
00078 }

static unsigned int spu_pack_R8G8B8A8 ( vector float  rgba  )  [static]

Definition at line 38 of file spu_colorpack.h.

00039 {
00040   vector unsigned int out = spu_convtu(rgba, 32);
00041 
00042   out = spu_shuffle(out, out, ((vector unsigned char) {
00043                                   0, 4, 8, 12, 0, 0, 0, 0, 
00044                                   0, 0, 0, 0, 0, 0, 0, 0 }) );
00045 
00046   return spu_extract(out, 0);
00047 }

static vector float spu_unpack_A8R8G8B8 ( uint  color  )  [static]

Definition at line 96 of file spu_colorpack.h.

00097 {
00098    vector unsigned int color_u4 = spu_splats(color);
00099    color_u4 = spu_shuffle(color_u4, color_u4,
00100                           ((vector unsigned char) {
00101                              5, 5, 5, 5,
00102                              10, 10, 10, 10,
00103                              15, 15, 15, 15,
00104                              0, 0, 0, 0}) );
00105 
00106    return spu_convtf(color_u4, 32);
00107 }

static vector float spu_unpack_B8G8R8A8 ( uint  color  )  [static]

Definition at line 82 of file spu_colorpack.h.

00083 {
00084    vector unsigned int color_u4 = spu_splats(color);
00085    color_u4 = spu_shuffle(color_u4, color_u4,
00086                           ((vector unsigned char) {
00087                              10, 10, 10, 10,
00088                              5, 5, 5, 5,
00089                              0, 0, 0, 0,
00090                              15, 15, 15, 15}) );
00091    return spu_convtf(color_u4, 32);
00092 }


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