#define SPU_COLORPACK_H
-#include <vec_literal.h>
#include <spu_intrinsics.h>
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);
}
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);
}
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);
}
{
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);
}
{
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);
}
/* 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 */
/* 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 */
/* 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