Cell: don't use VEC_LITERAL macro, doesn't work w/ SDK 3.0

This commit is contained in:
Brian 2008-02-04 18:02:21 -07:00
parent 93d061b217
commit 7cbe5cf212
2 changed files with 33 additions and 32 deletions

View file

@ -31,7 +31,6 @@
#define SPU_COLORPACK_H
#include <vec_literal.h>
#include <spu_intrinsics.h>
@ -39,9 +38,11 @@ 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));
out = spu_shuffle(out, out, ((vector unsigned char) {
0, 4, 8, 12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 }) );
return spu_extract(out, 0);
}
@ -50,9 +51,9 @@ static INLINE unsigned int
spu_pack_A8R8G8B8(vector float rgba)
{
vector unsigned int out = spu_convtu(rgba, 32);
out = spu_shuffle(out, out, VEC_LITERAL(vector unsigned char,
12, 0, 4, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0));
out = spu_shuffle(out, out, ((vector unsigned char) {
12, 0, 4, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0}) );
return spu_extract(out, 0);
}
@ -61,9 +62,9 @@ static INLINE unsigned int
spu_pack_B8G8R8A8(vector float rgba)
{
vector unsigned int out = spu_convtu(rgba, 32);
out = spu_shuffle(out, out, VEC_LITERAL(vector unsigned char,
8, 4, 0, 12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0));
out = spu_shuffle(out, out, ((vector unsigned char) {
8, 4, 0, 12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0}) );
return spu_extract(out, 0);
}
@ -82,11 +83,11 @@ 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));
((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);
}
@ -96,11 +97,11 @@ spu_unpack_A8R8G8B8(uint color)
{
vector unsigned int color_u4 = spu_splats(color);
color_u4 = spu_shuffle(color_u4, color_u4,
VEC_LITERAL(vector unsigned char,
5, 5, 5, 5,
10, 10, 10, 10,
15, 15, 15, 15,
0, 0, 0, 0));
((vector unsigned char) {
5, 5, 5, 5,
10, 10, 10, 10,
15, 15, 15, 15,
0, 0, 0, 0}) );
return spu_convtf(color_u4, 32);
}

View file

@ -68,9 +68,9 @@ spu_z16_test_less(vector float zvals, vector unsigned short *zbuf,
/* gather lower four ushorts */
zbuf_ui4 = spu_shuffle((vector unsigned int) *zbuf,
(vector unsigned int) *zbuf,
VEC_LITERAL(vector unsigned char,
ZERO, ZERO, 8, 9, ZERO, ZERO, 10, 11,
ZERO, ZERO, 12, 13, ZERO, ZERO, 14, 15));
((vector unsigned char) {
ZERO, ZERO, 8, 9, ZERO, ZERO, 10, 11,
ZERO, ZERO, 12, 13, ZERO, ZERO, 14, 15}));
/* mask = (zbuf_ui4 < zvals_ui4) ? ~0 : 0 */
mask = spu_cmpgt(zbuf_ui4, zvals_ui4);
/* mask &= inMask */
@ -80,18 +80,18 @@ spu_z16_test_less(vector float zvals, vector unsigned short *zbuf,
/* convert zbuffer values from uints back to ushorts, preserve lower 4 */
*zbuf = (vector unsigned short)
spu_shuffle(zbuf_ui4, (vector unsigned int) *zbuf,
VEC_LITERAL(vector unsigned char,
16, 17, 18, 19, 20, 21, 22, 23,
2, 3, 6, 7, 10, 11, 14, 15));
((vector unsigned char) {
16, 17, 18, 19, 20, 21, 22, 23,
2, 3, 6, 7, 10, 11, 14, 15}));
}
else {
/* convert zbuffer values from ushorts to uints */
/* gather upper four ushorts */
zbuf_ui4 = spu_shuffle((vector unsigned int) *zbuf,
(vector unsigned int) *zbuf,
VEC_LITERAL(vector unsigned char,
ZERO, ZERO, 0, 1, ZERO, ZERO, 2, 3,
ZERO, ZERO, 4, 5, ZERO, ZERO, 6, 7));
((vector unsigned char) {
ZERO, ZERO, 0, 1, ZERO, ZERO, 2, 3,
ZERO, ZERO, 4, 5, ZERO, ZERO, 6, 7}));
/* mask = (zbuf_ui4 < zvals_ui4) ? ~0 : 0 */
mask = spu_cmpgt(zbuf_ui4, zvals_ui4);
/* mask &= inMask */
@ -101,9 +101,9 @@ spu_z16_test_less(vector float zvals, vector unsigned short *zbuf,
/* convert zbuffer values from uints back to ushorts, preserve upper 4 */
*zbuf = (vector unsigned short)
spu_shuffle(zbuf_ui4, (vector unsigned int) *zbuf,
VEC_LITERAL(vector unsigned char,
2, 3, 6, 7, 10, 11, 14, 15,
24, 25, 26, 27, 28, 29, 30, 31));
((vector unsigned char) {
2, 3, 6, 7, 10, 11, 14, 15,
24, 25, 26, 27, 28, 29, 30, 31}));
}
return mask;
#undef ZERO