mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 14:28:05 +02:00
Cell: added spu_unpack_color(), spu_pack_R8G8B8A8()
This commit is contained in:
parent
09edd2e29e
commit
382651a4fa
1 changed files with 25 additions and 0 deletions
|
|
@ -35,6 +35,17 @@
|
|||
#include <spu_intrinsics.h>
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue