summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-02-04 12:50:16 -0700
committerBen Skeggs <skeggsb@gmail.com>2008-02-15 13:50:29 +1100
commit382651a4fafbea0c24e993933cb08a7ba19abcb7 (patch)
tree4209e2b4d9077a9cc51fee120d6633736cf993bd /src/mesa
parent09edd2e29e023b326ba3f6fff671dd1db3ab1eea (diff)
Cell: added spu_unpack_color(), spu_pack_R8G8B8A8()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/cell/spu/spu_colorpack.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/pipe/cell/spu/spu_colorpack.h b/src/mesa/pipe/cell/spu/spu_colorpack.h
index 9977a6ece0..0c93c06562 100644
--- a/src/mesa/pipe/cell/spu/spu_colorpack.h
+++ b/src/mesa/pipe/cell/spu/spu_colorpack.h
@@ -36,6 +36,17 @@
static INLINE unsigned int
+spu_pack_R8G8B8A8(vector float rgba)
+{
+ vector unsigned int out = spu_convtu(rgba, 32);
+ out = spu_shuffle(out, out, VEC_LITERAL(vector unsigned char,
+ 0, 4, 8, 12, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0));
+ return spu_extract(out, 0);
+}
+
+
+static INLINE unsigned int
spu_pack_A8R8G8B8(vector float rgba)
{
vector unsigned int out = spu_convtu(rgba, 32);
@@ -66,4 +77,18 @@ spu_pack_color_shuffle(vector float rgba, vector unsigned char shuffle)
}
+static INLINE vector float
+spu_unpack_color(uint color)
+{
+ vector unsigned int color_u4 = spu_splats(color);
+ color_u4 = spu_shuffle(color_u4, color_u4,
+ VEC_LITERAL(vector unsigned char,
+ 0, 0, 0, 0,
+ 5, 5, 5, 5,
+ 10, 10, 10, 10,
+ 15, 15, 15, 15));
+ return spu_convtf(color_u4, 32);
+}
+
+
#endif /* SPU_COLORPACK_H */