12#ifndef LIBDRAGON_RDPQ_MACROS_H
13#define LIBDRAGON_RDPQ_MACROS_H
27#define cast64(x) (uint64_t)(x)
28#define castcc(x) (rdpq_combiner_t)(x)
29#define castbl(x) (rdpq_blender_t)(x)
39#define _RDPQ_COMB1_RGB_SUBA_TEX0 cast64(1)
40#define _RDPQ_COMB1_RGB_SUBA_PRIM cast64(3)
41#define _RDPQ_COMB1_RGB_SUBA_SHADE cast64(4)
42#define _RDPQ_COMB1_RGB_SUBA_ENV cast64(5)
43#define _RDPQ_COMB1_RGB_SUBA_ONE cast64(6)
44#define _RDPQ_COMB1_RGB_SUBA_1 cast64(6)
45#define _RDPQ_COMB1_RGB_SUBA_NOISE cast64(7)
46#define _RDPQ_COMB1_RGB_SUBA_ZERO cast64(8)
47#define _RDPQ_COMB1_RGB_SUBA_0 cast64(8)
49#define _RDPQ_COMB2A_RGB_SUBA_TEX0 cast64(1)
50#define _RDPQ_COMB2A_RGB_SUBA_TEX1 cast64(2)
51#define _RDPQ_COMB2A_RGB_SUBA_PRIM cast64(3)
52#define _RDPQ_COMB2A_RGB_SUBA_SHADE cast64(4)
53#define _RDPQ_COMB2A_RGB_SUBA_ENV cast64(5)
54#define _RDPQ_COMB2A_RGB_SUBA_ONE cast64(6)
55#define _RDPQ_COMB2A_RGB_SUBA_1 cast64(6)
56#define _RDPQ_COMB2A_RGB_SUBA_NOISE cast64(7)
57#define _RDPQ_COMB2A_RGB_SUBA_ZERO cast64(8)
58#define _RDPQ_COMB2A_RGB_SUBA_0 cast64(8)
60#define _RDPQ_COMB2B_RGB_SUBA_COMBINED cast64(0)
61#define _RDPQ_COMB2B_RGB_SUBA_TEX1 cast64(1)
62#define _RDPQ_COMB2B_RGB_SUBA_TEX0_BUG cast64(2)
63#define _RDPQ_COMB2B_RGB_SUBA_PRIM cast64(3)
64#define _RDPQ_COMB2B_RGB_SUBA_SHADE cast64(4)
65#define _RDPQ_COMB2B_RGB_SUBA_ENV cast64(5)
66#define _RDPQ_COMB2B_RGB_SUBA_ONE cast64(6)
67#define _RDPQ_COMB2B_RGB_SUBA_1 cast64(6)
68#define _RDPQ_COMB2B_RGB_SUBA_NOISE cast64(7)
69#define _RDPQ_COMB2B_RGB_SUBA_ZERO cast64(8)
70#define _RDPQ_COMB2B_RGB_SUBA_0 cast64(8)
72#define _RDPQ_COMB1_RGB_SUBB_TEX0 cast64(1)
73#define _RDPQ_COMB1_RGB_SUBB_PRIM cast64(3)
74#define _RDPQ_COMB1_RGB_SUBB_SHADE cast64(4)
75#define _RDPQ_COMB1_RGB_SUBB_ENV cast64(5)
76#define _RDPQ_COMB1_RGB_SUBB_KEYCENTER cast64(6)
77#define _RDPQ_COMB1_RGB_SUBB_K4 cast64(7)
78#define _RDPQ_COMB1_RGB_SUBB_ZERO cast64(8)
79#define _RDPQ_COMB1_RGB_SUBB_0 cast64(8)
81#define _RDPQ_COMB2A_RGB_SUBB_TEX0 cast64(1)
82#define _RDPQ_COMB2A_RGB_SUBB_TEX1 cast64(2)
83#define _RDPQ_COMB2A_RGB_SUBB_PRIM cast64(3)
84#define _RDPQ_COMB2A_RGB_SUBB_SHADE cast64(4)
85#define _RDPQ_COMB2A_RGB_SUBB_ENV cast64(5)
86#define _RDPQ_COMB2A_RGB_SUBB_KEYCENTER cast64(6)
87#define _RDPQ_COMB2A_RGB_SUBB_K4 cast64(7)
88#define _RDPQ_COMB2A_RGB_SUBB_ZERO cast64(8)
89#define _RDPQ_COMB2A_RGB_SUBB_0 cast64(8)
91#define _RDPQ_COMB2B_RGB_SUBB_COMBINED cast64(0)
92#define _RDPQ_COMB2B_RGB_SUBB_TEX1 cast64(1)
93#define _RDPQ_COMB2B_RGB_SUBA_TEX0_BUG cast64(2)
94#define _RDPQ_COMB2B_RGB_SUBB_PRIM cast64(3)
95#define _RDPQ_COMB2B_RGB_SUBB_SHADE cast64(4)
96#define _RDPQ_COMB2B_RGB_SUBB_ENV cast64(5)
97#define _RDPQ_COMB2B_RGB_SUBB_KEYCENTER cast64(6)
98#define _RDPQ_COMB2B_RGB_SUBB_K4 cast64(7)
99#define _RDPQ_COMB2B_RGB_SUBB_ZERO cast64(8)
100#define _RDPQ_COMB2B_RGB_SUBB_0 cast64(8)
102#define _RDPQ_COMB1_RGB_MUL_TEX0 cast64(1)
103#define _RDPQ_COMB1_RGB_MUL_PRIM cast64(3)
104#define _RDPQ_COMB1_RGB_MUL_SHADE cast64(4)
105#define _RDPQ_COMB1_RGB_MUL_ENV cast64(5)
106#define _RDPQ_COMB1_RGB_MUL_KEYSCALE cast64(6)
107#define _RDPQ_COMB1_RGB_MUL_TEX0_ALPHA cast64(8)
108#define _RDPQ_COMB1_RGB_MUL_PRIM_ALPHA cast64(10)
109#define _RDPQ_COMB1_RGB_MUL_SHADE_ALPHA cast64(11)
110#define _RDPQ_COMB1_RGB_MUL_ENV_ALPHA cast64(12)
111#define _RDPQ_COMB1_RGB_MUL_LOD_FRAC cast64(13)
112#define _RDPQ_COMB1_RGB_MUL_PRIM_LOD_FRAC cast64(14)
113#define _RDPQ_COMB1_RGB_MUL_K5 cast64(15)
114#define _RDPQ_COMB1_RGB_MUL_ZERO cast64(16)
115#define _RDPQ_COMB1_RGB_MUL_0 cast64(16)
117#define _RDPQ_COMB2A_RGB_MUL_TEX0 cast64(1)
118#define _RDPQ_COMB2A_RGB_MUL_TEX1 cast64(2)
119#define _RDPQ_COMB2A_RGB_MUL_PRIM cast64(3)
120#define _RDPQ_COMB2A_RGB_MUL_SHADE cast64(4)
121#define _RDPQ_COMB2A_RGB_MUL_ENV cast64(5)
122#define _RDPQ_COMB2A_RGB_MUL_KEYSCALE cast64(6)
123#define _RDPQ_COMB2A_RGB_MUL_TEX0_ALPHA cast64(8)
124#define _RDPQ_COMB2A_RGB_MUL_TEX1_ALPHA cast64(9)
125#define _RDPQ_COMB2A_RGB_MUL_PRIM_ALPHA cast64(10)
126#define _RDPQ_COMB2A_RGB_MUL_SHADE_ALPHA cast64(11)
127#define _RDPQ_COMB2A_RGB_MUL_ENV_ALPHA cast64(12)
128#define _RDPQ_COMB2A_RGB_MUL_LOD_FRAC cast64(13)
129#define _RDPQ_COMB2A_RGB_MUL_PRIM_LOD_FRAC cast64(14)
130#define _RDPQ_COMB2A_RGB_MUL_K5 cast64(15)
131#define _RDPQ_COMB2A_RGB_MUL_ZERO cast64(16)
132#define _RDPQ_COMB2A_RGB_MUL_0 cast64(16)
134#define _RDPQ_COMB2B_RGB_MUL_COMBINED cast64(0)
135#define _RDPQ_COMB2B_RGB_MUL_TEX1 cast64(1)
136#define _RDPQ_COMB2B_RGB_MUL_TEX0_BUG cast64(2)
137#define _RDPQ_COMB2B_RGB_MUL_PRIM cast64(3)
138#define _RDPQ_COMB2B_RGB_MUL_SHADE cast64(4)
139#define _RDPQ_COMB2B_RGB_MUL_ENV cast64(5)
140#define _RDPQ_COMB2B_RGB_MUL_KEYSCALE cast64(6)
141#define _RDPQ_COMB2B_RGB_MUL_COMBINED_ALPHA cast64(7)
142#define _RDPQ_COMB2B_RGB_MUL_TEX1_ALPHA cast64(8)
143#define _RDPQ_COMB2B_RGB_MUL_PRIM_ALPHA cast64(10)
144#define _RDPQ_COMB2B_RGB_MUL_SHADE_ALPHA cast64(11)
145#define _RDPQ_COMB2B_RGB_MUL_ENV_ALPHA cast64(12)
146#define _RDPQ_COMB2B_RGB_MUL_LOD_FRAC cast64(13)
147#define _RDPQ_COMB2B_RGB_MUL_PRIM_LOD_FRAC cast64(14)
148#define _RDPQ_COMB2B_RGB_MUL_K5 cast64(15)
149#define _RDPQ_COMB2B_RGB_MUL_ZERO cast64(16)
150#define _RDPQ_COMB2B_RGB_MUL_0 cast64(16)
152#define _RDPQ_COMB1_RGB_ADD_TEX0 cast64(1)
153#define _RDPQ_COMB1_RGB_ADD_PRIM cast64(3)
154#define _RDPQ_COMB1_RGB_ADD_SHADE cast64(4)
155#define _RDPQ_COMB1_RGB_ADD_ENV cast64(5)
156#define _RDPQ_COMB1_RGB_ADD_ONE cast64(6)
157#define _RDPQ_COMB1_RGB_ADD_1 cast64(6)
158#define _RDPQ_COMB1_RGB_ADD_ZERO cast64(7)
159#define _RDPQ_COMB1_RGB_ADD_0 cast64(7)
161#define _RDPQ_COMB2A_RGB_ADD_TEX0 cast64(1)
162#define _RDPQ_COMB2A_RGB_ADD_TEX1 cast64(2)
163#define _RDPQ_COMB2A_RGB_ADD_PRIM cast64(3)
164#define _RDPQ_COMB2A_RGB_ADD_SHADE cast64(4)
165#define _RDPQ_COMB2A_RGB_ADD_ENV cast64(5)
166#define _RDPQ_COMB2A_RGB_ADD_ONE cast64(6)
167#define _RDPQ_COMB2A_RGB_ADD_1 cast64(6)
168#define _RDPQ_COMB2A_RGB_ADD_ZERO cast64(7)
169#define _RDPQ_COMB2A_RGB_ADD_0 cast64(7)
171#define _RDPQ_COMB2B_RGB_ADD_COMBINED cast64(0)
172#define _RDPQ_COMB2B_RGB_ADD_TEX1 cast64(1)
173#define _RDPQ_COMB2B_RGB_ADD_TEX0_BUG cast64(2)
174#define _RDPQ_COMB2B_RGB_ADD_PRIM cast64(3)
175#define _RDPQ_COMB2B_RGB_ADD_SHADE cast64(4)
176#define _RDPQ_COMB2B_RGB_ADD_ENV cast64(5)
177#define _RDPQ_COMB2B_RGB_ADD_ONE cast64(6)
178#define _RDPQ_COMB2B_RGB_ADD_1 cast64(6)
179#define _RDPQ_COMB2B_RGB_ADD_ZERO cast64(7)
180#define _RDPQ_COMB2B_RGB_ADD_0 cast64(7)
182#define _RDPQ_COMB1_ALPHA_ADDSUB_TEX0 cast64(1)
183#define _RDPQ_COMB1_ALPHA_ADDSUB_PRIM cast64(3)
184#define _RDPQ_COMB1_ALPHA_ADDSUB_SHADE cast64(4)
185#define _RDPQ_COMB1_ALPHA_ADDSUB_ENV cast64(5)
186#define _RDPQ_COMB1_ALPHA_ADDSUB_ONE cast64(6)
187#define _RDPQ_COMB1_ALPHA_ADDSUB_1 cast64(6)
188#define _RDPQ_COMB1_ALPHA_ADDSUB_ZERO cast64(7)
189#define _RDPQ_COMB1_ALPHA_ADDSUB_0 cast64(7)
191#define _RDPQ_COMB2A_ALPHA_ADDSUB_TEX0 cast64(1)
192#define _RDPQ_COMB2A_ALPHA_ADDSUB_TEX1 cast64(2)
193#define _RDPQ_COMB2A_ALPHA_ADDSUB_PRIM cast64(3)
194#define _RDPQ_COMB2A_ALPHA_ADDSUB_SHADE cast64(4)
195#define _RDPQ_COMB2A_ALPHA_ADDSUB_ENV cast64(5)
196#define _RDPQ_COMB2A_ALPHA_ADDSUB_ONE cast64(6)
197#define _RDPQ_COMB2A_ALPHA_ADDSUB_1 cast64(6)
198#define _RDPQ_COMB2A_ALPHA_ADDSUB_ZERO cast64(7)
199#define _RDPQ_COMB2A_ALPHA_ADDSUB_0 cast64(7)
201#define _RDPQ_COMB2B_ALPHA_ADDSUB_COMBINED cast64(0)
202#define _RDPQ_COMB2B_ALPHA_ADDSUB_TEX1 cast64(1)
203#define _RDPQ_COMB2B_ALPHA_ADDSUB_PRIM cast64(3)
204#define _RDPQ_COMB2B_ALPHA_ADDSUB_SHADE cast64(4)
205#define _RDPQ_COMB2B_ALPHA_ADDSUB_ENV cast64(5)
206#define _RDPQ_COMB2B_ALPHA_ADDSUB_ONE cast64(6)
207#define _RDPQ_COMB2B_ALPHA_ADDSUB_1 cast64(6)
208#define _RDPQ_COMB2B_ALPHA_ADDSUB_ZERO cast64(7)
209#define _RDPQ_COMB2B_ALPHA_ADDSUB_0 cast64(7)
211#define _RDPQ_COMB1_ALPHA_MUL_LOD_FRAC cast64(0)
212#define _RDPQ_COMB1_ALPHA_MUL_TEX0 cast64(1)
213#define _RDPQ_COMB1_ALPHA_MUL_PRIM cast64(3)
214#define _RDPQ_COMB1_ALPHA_MUL_SHADE cast64(4)
215#define _RDPQ_COMB1_ALPHA_MUL_ENV cast64(5)
216#define _RDPQ_COMB1_ALPHA_MUL_PRIM_LOD_FRAC cast64(6)
217#define _RDPQ_COMB1_ALPHA_MUL_ZERO cast64(7)
218#define _RDPQ_COMB1_ALPHA_MUL_0 cast64(7)
220#define _RDPQ_COMB2A_ALPHA_MUL_LOD_FRAC cast64(0)
221#define _RDPQ_COMB2A_ALPHA_MUL_TEX0 cast64(1)
222#define _RDPQ_COMB2A_ALPHA_MUL_TEX1 cast64(2)
223#define _RDPQ_COMB2A_ALPHA_MUL_PRIM cast64(3)
224#define _RDPQ_COMB2A_ALPHA_MUL_SHADE cast64(4)
225#define _RDPQ_COMB2A_ALPHA_MUL_ENV cast64(5)
226#define _RDPQ_COMB2A_ALPHA_MUL_PRIM_LOD_FRAC cast64(6)
227#define _RDPQ_COMB2A_ALPHA_MUL_ZERO cast64(7)
228#define _RDPQ_COMB2A_ALPHA_MUL_0 cast64(7)
230#define _RDPQ_COMB2B_ALPHA_MUL_LOD_FRAC cast64(0)
231#define _RDPQ_COMB2B_ALPHA_MUL_TEX1 cast64(1)
232#define _RDPQ_COMB2B_ALPHA_MUL_PRIM cast64(3)
233#define _RDPQ_COMB2B_ALPHA_MUL_SHADE cast64(4)
234#define _RDPQ_COMB2B_ALPHA_MUL_ENV cast64(5)
235#define _RDPQ_COMB2B_ALPHA_MUL_PRIM_LOD_FRAC cast64(6)
236#define _RDPQ_COMB2B_ALPHA_MUL_ZERO cast64(7)
237#define _RDPQ_COMB2B_ALPHA_MUL_0 cast64(7)
239#define __rdpq_1cyc_comb_rgb(suba, subb, mul, add) \
240 (((_RDPQ_COMB1_RGB_SUBA_ ## suba)<<52) | ((_RDPQ_COMB1_RGB_SUBB_ ## subb)<<28) | ((_RDPQ_COMB1_RGB_MUL_ ## mul)<<47) | ((_RDPQ_COMB1_RGB_ADD_ ## add)<<15) | \
241 ((_RDPQ_COMB1_RGB_SUBA_ ## suba)<<37) | ((_RDPQ_COMB1_RGB_SUBB_ ## subb)<<24) | ((_RDPQ_COMB1_RGB_MUL_ ## mul)<<32) | ((_RDPQ_COMB1_RGB_ADD_ ## add)<<6))
242#define __rdpq_1cyc_comb_alpha(suba, subb, mul, add) \
243 (((_RDPQ_COMB1_ALPHA_ADDSUB_ ## suba)<<44) | ((_RDPQ_COMB1_ALPHA_ADDSUB_ ## subb)<<12) | ((_RDPQ_COMB1_ALPHA_MUL_ ## mul)<<41) | ((_RDPQ_COMB1_ALPHA_ADDSUB_ ## add)<<9) | \
244 ((_RDPQ_COMB1_ALPHA_ADDSUB_ ## suba)<<21) | ((_RDPQ_COMB1_ALPHA_ADDSUB_ ## subb)<<3) | ((_RDPQ_COMB1_ALPHA_MUL_ ## mul)<<18) | ((_RDPQ_COMB1_ALPHA_ADDSUB_ ## add)<<0))
246#define __rdpq_2cyc_comb2a_rgb(suba, subb, mul, add) \
247 (((_RDPQ_COMB2A_RGB_SUBA_ ## suba)<<52) | ((_RDPQ_COMB2A_RGB_SUBB_ ## subb)<<28) | ((_RDPQ_COMB2A_RGB_MUL_ ## mul)<<47) | ((_RDPQ_COMB2A_RGB_ADD_ ## add)<<15))
248#define __rdpq_2cyc_comb2a_alpha(suba, subb, mul, add) \
249 (((_RDPQ_COMB2A_ALPHA_ADDSUB_ ## suba)<<44) | ((_RDPQ_COMB2A_ALPHA_ADDSUB_ ## subb)<<12) | ((_RDPQ_COMB2A_ALPHA_MUL_ ## mul)<<41) | ((_RDPQ_COMB2A_ALPHA_ADDSUB_ ## add)<<9))
250#define __rdpq_2cyc_comb2b_rgb(suba, subb, mul, add) \
251 (((_RDPQ_COMB2B_RGB_SUBA_ ## suba)<<37) | ((_RDPQ_COMB2B_RGB_SUBB_ ## subb)<<24) | ((_RDPQ_COMB2B_RGB_MUL_ ## mul)<<32) | ((_RDPQ_COMB2B_RGB_ADD_ ## add)<<6))
252#define __rdpq_2cyc_comb2b_alpha(suba, subb, mul, add) \
253 (((_RDPQ_COMB2B_ALPHA_ADDSUB_ ## suba)<<21) | ((_RDPQ_COMB2B_ALPHA_ADDSUB_ ## subb)<<3) | ((_RDPQ_COMB2B_ALPHA_MUL_ ## mul)<<18) | ((_RDPQ_COMB2B_ALPHA_ADDSUB_ ## add)<<0))
257#define RDPQ_COMB0_MASK ((cast64(0xF)<<52)|(cast64(0x1F)<<47)|(cast64(0x7)<<44)|(cast64(0x7)<<41)|(cast64(0xF)<<28)|(cast64(0x7)<<15)|(cast64(0x7)<<12)|(cast64(0x7)<<9))
259#define RDPQ_COMB1_MASK (~RDPQ_COMB0_MASK & cast64(0x00FFFFFFFFFFFFFF))
272#define RDPQ_COMBINER_2PASS (cast64(1)<<63)
431#define RDPQ_COMBINER1(rgb, alpha) \
432 castcc(__rdpq_1cyc_comb_rgb rgb | __rdpq_1cyc_comb_alpha alpha)
453#define RDPQ_COMBINER2(rgb0, alpha0, rgb1, alpha1) \
454 castcc(__rdpq_2cyc_comb2a_rgb rgb0 | __rdpq_2cyc_comb2a_alpha alpha0 | \
455 __rdpq_2cyc_comb2b_rgb rgb1 | __rdpq_2cyc_comb2b_alpha alpha1 | \
470#define RDPQ_COMBINER_FLAT RDPQ_COMBINER1((0,0,0,PRIM), (0,0,0,PRIM))
477#define RDPQ_COMBINER_SHADE RDPQ_COMBINER1((0,0,0,SHADE), (0,0,0,SHADE))
484#define RDPQ_COMBINER_TEX RDPQ_COMBINER1((0,0,0,TEX0), (0,0,0,TEX0))
492#define RDPQ_COMBINER_TEX_FLAT RDPQ_COMBINER1((TEX0,0,PRIM,0), (TEX0,0,PRIM,0))
501#define RDPQ_COMBINER_TEX_SHADE RDPQ_COMBINER1((TEX0,0,SHADE,0), (TEX0,0,SHADE,0))
516#define SOMX_NUMLODS_MASK ((cast64(7))<<59)
517#define SOMX_NUMLODS_SHIFT 59
519#define SOM_ATOMIC_PRIM ((cast64(1))<<55)
521#define SOM_CYCLE_1 ((cast64(0))<<52)
522#define SOM_CYCLE_2 ((cast64(1))<<52)
523#define SOM_CYCLE_COPY ((cast64(2))<<52)
524#define SOM_CYCLE_FILL ((cast64(3))<<52)
525#define SOM_CYCLE_MASK ((cast64(3))<<52)
526#define SOM_CYCLE_SHIFT 52
528#define SOM_TEXTURE_PERSP (cast64(1)<<51)
529#define SOM_TEXTURE_DETAIL (cast64(1)<<50)
530#define SOM_TEXTURE_SHARPEN (cast64(1)<<49)
531#define SOM_TEXTURE_LOD (cast64(1)<<48)
532#define SOM_TEXTURE_LOD_SHIFT 48
534#define SOM_TLUT_NONE (cast64(0)<<46)
535#define SOM_TLUT_RGBA16 (cast64(2)<<46)
536#define SOM_TLUT_IA16 (cast64(3)<<46)
537#define SOM_TLUT_MASK (cast64(3)<<46)
538#define SOM_TLUT_SHIFT 46
540#define SOM_SAMPLE_POINT (cast64(0)<<44)
541#define SOM_SAMPLE_BILINEAR (cast64(2)<<44)
542#define SOM_SAMPLE_MEDIAN (cast64(3)<<44)
543#define SOM_SAMPLE_MASK (cast64(3)<<44)
544#define SOM_SAMPLE_SHIFT 44
546#define SOM_TF0_RGB (cast64(1)<<43)
547#define SOM_TF0_YUV (cast64(0)<<43)
548#define SOM_TF1_RGB (cast64(2)<<41)
549#define SOM_TF1_YUV (cast64(0)<<41)
550#define SOM_TF1_YUVTEX0 (cast64(1)<<41)
551#define SOM_TF_MASK (cast64(7)<<41)
552#define SOM_TF_SHIFT 41
554#define SOM_RGBDITHER_SQUARE ((cast64(0))<<38)
555#define SOM_RGBDITHER_BAYER ((cast64(1))<<38)
556#define SOM_RGBDITHER_NOISE ((cast64(2))<<38)
557#define SOM_RGBDITHER_NONE ((cast64(3))<<38)
558#define SOM_RGBDITHER_MASK ((cast64(3))<<38)
559#define SOM_RGBDITHER_SHIFT 38
561#define SOM_ALPHADITHER_SAME ((cast64(0))<<36)
562#define SOM_ALPHADITHER_INVERT ((cast64(1))<<36)
563#define SOM_ALPHADITHER_NOISE ((cast64(2))<<36)
564#define SOM_ALPHADITHER_NONE ((cast64(3))<<36)
565#define SOM_ALPHADITHER_MASK ((cast64(3))<<36)
566#define SOM_ALPHADITHER_SHIFT 36
568#define SOMX_FOG ((cast64(1))<<32)
569#define SOMX_UPDATE_FREEZE ((cast64(1))<<33)
570#define SOMX_AA_REDUCED ((cast64(1))<<34)
571#define SOMX_LOD_INTERPOLATE ((cast64(1))<<35)
573#define SOM_BLEND0_MASK (cast64(0xCCCC0000) | SOM_BLENDING | SOM_READ_ENABLE | SOMX_BLEND_2PASS)
574#define SOM_BLEND1_MASK (cast64(0x33330000) | SOM_BLENDING | SOM_READ_ENABLE | SOMX_BLEND_2PASS)
575#define SOM_BLEND_MASK (SOM_BLEND0_MASK | SOM_BLEND1_MASK)
577#define SOMX_BLEND_2PASS ((cast64(1))<<15)
579#define SOM_BLENDING ((cast64(1))<<14)
581#define SOM_BLALPHA_CC ((cast64(0))<<12)
582#define SOM_BLALPHA_CVG ((cast64(2))<<12)
583#define SOM_BLALPHA_CVG_TIMES_CC ((cast64(3))<<12)
584#define SOM_BLALPHA_MASK ((cast64(3))<<12)
585#define SOM_BLALPHA_SHIFT 12
587#define SOM_ZMODE_OPAQUE ((cast64(0))<<10)
588#define SOM_ZMODE_INTERPENETRATING ((cast64(1))<<10)
589#define SOM_ZMODE_TRANSPARENT ((cast64(2))<<10)
590#define SOM_ZMODE_DECAL ((cast64(3))<<10)
591#define SOM_ZMODE_MASK ((cast64(3))<<10)
592#define SOM_ZMODE_SHIFT 10
594#define SOM_Z_WRITE ((cast64(1))<<5)
595#define SOM_Z_WRITE_SHIFT 5
597#define SOM_Z_COMPARE ((cast64(1))<<4)
598#define SOM_Z_COMPARE_SHIFT 4
600#define SOM_ZSOURCE_PIXEL ((cast64(0))<<2)
601#define SOM_ZSOURCE_PRIM ((cast64(1))<<2)
602#define SOM_ZSOURCE_MASK ((cast64(1))<<2)
603#define SOM_ZSOURCE_SHIFT 2
605#define SOM_ALPHACOMPARE_NONE ((cast64(0))<<0)
606#define SOM_ALPHACOMPARE_THRESHOLD ((cast64(1))<<0)
607#define SOM_ALPHACOMPARE_NOISE ((cast64(3))<<0)
608#define SOM_ALPHACOMPARE_MASK ((cast64(3))<<0)
609#define SOM_ALPHACOMPARE_SHIFT 0
611#define SOM_READ_ENABLE ((cast64(1)) << 6)
612#define SOM_AA_ENABLE ((cast64(1)) << 3)
614#define SOM_COVERAGE_DEST_CLAMP ((cast64(0)) << 8)
615#define SOM_COVERAGE_DEST_WRAP ((cast64(1)) << 8)
616#define SOM_COVERAGE_DEST_ZAP ((cast64(2)) << 8)
617#define SOM_COVERAGE_DEST_SAVE ((cast64(3)) << 8)
618#define SOM_COVERAGE_DEST_MASK ((cast64(3)) << 8)
619#define SOM_COVERAGE_DEST_SHIFT 8
621#define SOM_COLOR_ON_CVG_OVERFLOW ((cast64(1)) << 7)
626#define _RDPQ_SOM_BLEND1_A_IN_RGB cast64(0)
627#define _RDPQ_SOM_BLEND1_A_MEMORY_RGB cast64(1)
628#define _RDPQ_SOM_BLEND1_A_BLEND_RGB cast64(2)
629#define _RDPQ_SOM_BLEND1_A_FOG_RGB cast64(3)
631#define _RDPQ_SOM_BLEND1_B1_IN_ALPHA cast64(0)
632#define _RDPQ_SOM_BLEND1_B1_FOG_ALPHA cast64(1)
633#define _RDPQ_SOM_BLEND1_B1_SHADE_ALPHA cast64(2)
634#define _RDPQ_SOM_BLEND1_B1_ZERO cast64(3)
635#define _RDPQ_SOM_BLEND1_B1_0 cast64(3)
637#define _RDPQ_SOM_BLEND1_B2_INV_MUX_ALPHA cast64(0)
638#define _RDPQ_SOM_BLEND1_B2_MEMORY_CVG cast64(1)
639#define _RDPQ_SOM_BLEND1_B2_ONE cast64(2)
640#define _RDPQ_SOM_BLEND1_B2_1 cast64(2)
641#define _RDPQ_SOM_BLEND1_B2_ZERO cast64(3)
642#define _RDPQ_SOM_BLEND1_B2_0 cast64(3)
644#define _RDPQ_SOM_BLEND2A_A_IN_RGB cast64(0)
645#define _RDPQ_SOM_BLEND2A_A_BLEND_RGB cast64(2)
646#define _RDPQ_SOM_BLEND2A_A_FOG_RGB cast64(3)
648#define _RDPQ_SOM_BLEND2A_B1_IN_ALPHA cast64(0)
649#define _RDPQ_SOM_BLEND2A_B1_FOG_ALPHA cast64(1)
650#define _RDPQ_SOM_BLEND2A_B1_SHADE_ALPHA cast64(2)
651#define _RDPQ_SOM_BLEND2A_B1_ZERO cast64(3)
652#define _RDPQ_SOM_BLEND2A_B1_0 cast64(3)
654#define _RDPQ_SOM_BLEND2A_B2_INV_MUX_ALPHA cast64(0)
656#define _RDPQ_SOM_BLEND2B_A_CYCLE1_RGB cast64(0)
657#define _RDPQ_SOM_BLEND2B_A_MEMORY_RGB cast64(1)
658#define _RDPQ_SOM_BLEND2B_A_BLEND_RGB cast64(2)
659#define _RDPQ_SOM_BLEND2B_A_FOG_RGB cast64(3)
661#define _RDPQ_SOM_BLEND2B_B1_IN_ALPHA cast64(0)
662#define _RDPQ_SOM_BLEND2B_B1_FOG_ALPHA cast64(1)
663#define _RDPQ_SOM_BLEND2B_B1_SHADE_ALPHA cast64(2)
664#define _RDPQ_SOM_BLEND2B_B1_ZERO cast64(3)
665#define _RDPQ_SOM_BLEND2B_B1_0 cast64(3)
667#define _RDPQ_SOM_BLEND2B_B2_INV_MUX_ALPHA cast64(0)
668#define _RDPQ_SOM_BLEND2B_B2_MEMORY_CVG cast64(1)
669#define _RDPQ_SOM_BLEND2B_B2_ONE cast64(2)
670#define _RDPQ_SOM_BLEND2B_B2_1 cast64(2)
671#define _RDPQ_SOM_BLEND2B_B2_ZERO cast64(3)
672#define _RDPQ_SOM_BLEND2B_B2_0 cast64(3)
674#define _RDPQ_SOM_BLEND_EXTRA_A_IN_RGB cast64(0)
675#define _RDPQ_SOM_BLEND_EXTRA_A_CYCLE1_RGB cast64(0)
676#define _RDPQ_SOM_BLEND_EXTRA_A_MEMORY_RGB (SOM_READ_ENABLE)
677#define _RDPQ_SOM_BLEND_EXTRA_A_BLEND_RGB cast64(0)
678#define _RDPQ_SOM_BLEND_EXTRA_A_FOG_RGB cast64(0)
680#define _RDPQ_SOM_BLEND_EXTRA_B1_IN_ALPHA cast64(0)
681#define _RDPQ_SOM_BLEND_EXTRA_B1_FOG_ALPHA cast64(0)
682#define _RDPQ_SOM_BLEND_EXTRA_B1_SHADE_ALPHA cast64(0)
683#define _RDPQ_SOM_BLEND_EXTRA_B1_ZERO cast64(0)
684#define _RDPQ_SOM_BLEND_EXTRA_B1_0 cast64(0)
686#define _RDPQ_SOM_BLEND_EXTRA_B2_INV_MUX_ALPHA cast64(0)
687#define _RDPQ_SOM_BLEND_EXTRA_B2_MEMORY_CVG (SOM_READ_ENABLE)
688#define _RDPQ_SOM_BLEND_EXTRA_B2_ONE cast64(0)
689#define _RDPQ_SOM_BLEND_EXTRA_B2_1 cast64(0)
690#define _RDPQ_SOM_BLEND_EXTRA_B2_ZERO cast64(0)
691#define _RDPQ_SOM_BLEND_EXTRA_B2_0 cast64(0)
693#define __rdpq_blend(cyc, a1, b1, a2, b2, sa1, sb1, sa2, sb2) (\
694 ((_RDPQ_SOM_BLEND ## cyc ## _A_ ## a1) << sa1) | \
695 ((_RDPQ_SOM_BLEND ## cyc ## _B1_ ## b1) << sb1) | \
696 ((_RDPQ_SOM_BLEND ## cyc ## _A_ ## a2) << sa2) | \
697 ((_RDPQ_SOM_BLEND ## cyc ## _B2_ ## b2) << sb2) | \
698 (_RDPQ_SOM_BLEND_EXTRA_A_ ## a1) | \
699 (_RDPQ_SOM_BLEND_EXTRA_B1_ ## b1) | \
700 (_RDPQ_SOM_BLEND_EXTRA_A_ ## a2) | \
701 (_RDPQ_SOM_BLEND_EXTRA_B2_ ## b2) \
704#define __rdpq_blend_1cyc_0(a1, b1, a2, b2) __rdpq_blend(1, a1, b1, a2, b2, 30, 26, 22, 18)
705#define __rdpq_blend_1cyc_1(a1, b1, a2, b2) __rdpq_blend(1, a1, b1, a2, b2, 28, 24, 20, 16)
706#define __rdpq_blend_2cyc_0(a1, b1, a2, b2) __rdpq_blend(2A, a1, b1, a2, b2, 30, 26, 22, 18)
707#define __rdpq_blend_2cyc_1(a1, b1, a2, b2) __rdpq_blend(2B, a1, b1, a2, b2, 28, 24, 20, 16)
828#define RDPQ_BLENDER(bl) castbl(__rdpq_blend_1cyc_0 bl | __rdpq_blend_1cyc_1 bl)
862#define RDPQ_BLENDER2(bl0, bl1) castbl(__rdpq_blend_2cyc_0 bl0 | __rdpq_blend_2cyc_1 bl1 | SOMX_BLEND_2PASS)
869#define ZBUF_MAX 0xFFFC
874extern uint16_t __rdpq_zfp14(
float f);
887#define ZBUF_VAL(f) (__rdpq_zfp14(f) << 2)
uint64_t rdpq_combiner_t
A combiner formula, created by RDPQ_COMBINER1 or RDPQ_COMBINER2.
Definition rdpq_macros.h:18
uint32_t rdpq_blender_t
A blender formula, created by RDPQ_BLENDER or RDPQ_BLENDER2.
Definition rdpq_macros.h:20