1 #ifndef __PIXEL_SHADER_H__
2 #define __PIXEL_SHADER_H__
16 #define PFS_OP_OUTC_REPL_ALPHA 10
18 /* "or" these with arg0 value to negate or take absolute value of an argument */
19 #define PFS_ARG_NEG (1<<5)
20 #define PFS_ARG_ABS (1<<6)
22 #define MAKE_PFS_INSTR0(op, arg0, arg1, arg2, flags) \
24 | ((arg0)<<R300_FPI0_ARG0C_SHIFT) \
25 | ((arg1)<<R300_FPI0_ARG1C_SHIFT) \
26 | ((arg2)<<R300_FPI0_ARG2C_SHIFT) \
36 #define PFS_FLAG_ALL 7
37 #define PFS_FLAG_NONE 0
39 #define EASY_PFS_INSTR0(op, arg0, arg1, arg2) \
40 MAKE_PFS_INSTR0(PFS_OP_##op, \
41 R300_FPI0_ARGC_##arg0, \
42 R300_FPI0_ARGC_##arg1, \
43 R300_FPI0_ARGC_##arg2, \
48 #define PFS_FLAG_CONST (1<<5)
50 #define MAKE_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
51 ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
52 | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
53 | ((dstc) << R300_FPI1_DSTC_SHIFT) \
54 | ((reg) << 23) | ((output)<<26))
56 #define EASY_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
57 MAKE_PFS_INSTR1(dstc, src0, src1, src2, PFS_FLAG_##reg, PFS_FLAG_##output)
61 /* you can "or" PFS_ARG_NEG with these values to negate them */
63 #define MAKE_PFS_INSTR2(op, arg0, arg1, arg2, flags) \
65 ((arg0)<<R300_FPI2_ARG0A_SHIFT) | \
66 ((arg1)<<R300_FPI2_ARG1A_SHIFT) | \
67 ((arg2)<<R300_FPI2_ARG2A_SHIFT) | \
70 #define EASY_PFS_INSTR2(op, arg0, arg1, arg2) \
71 MAKE_PFS_INSTR2(R300_FPI2_OUTA_##op, \
72 R300_FPI2_ARGA_##arg0, \
73 R300_FPI2_ARGA_##arg1, \
74 R300_FPI2_ARGA_##arg2, \
80 #define PFS_FLAG_NONE 0
81 #define PFS_FLAG_REG 1
82 #define PFS_FLAG_OUTPUT 2
83 #define PFS_FLAG_BOTH 3
85 #define MAKE_PFS_INSTR3(dstc, src0, src1, src2, flags) \
86 ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
87 | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
88 | ((dstc) << R300_FPI1_DSTC_SHIFT) \
91 #define EASY_PFS_INSTR3(dstc, src0, src1, src2, flag) \
92 MAKE_PFS_INSTR3(dstc, src0, src1, src2, PFS_FLAG_##flag)
94 /* What are 0's ORed with flags ? They are register numbers that
95 just happen to be 0 */
97 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO), \
98 EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL), \
99 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), \
100 EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) \