Previous 15994 Revisions Next

r6796 Monday 28th December, 2009 at 02:42:16 UTC by Harmony
[N64] More RDP optimizations, massive branch flattening resulting in a significant speed increase. [Harmony]
[src/mame/video]n64.c rdpacomp.c rdpacvg.c rdpblend.c rdpblend.h rdpcc.c* rdpcc.h* rdpclamp.c* rdpclamp.h* rdpfetch.c rdpfetch.h rdpfrect.c* rdpfrect.h* rdpmask.c* rdpmask.h* rdpshift.c* rdpshift.h* rdpspn16.c rdpspn16.h rdptpipe.c rdptpipe.h rdptrect.c rdptrect.h rdptri.c rdpupd16.c rdpzcomp.c* rdpzcomp.h*

src/mame/video/rdpfrect.c
r0r6796
1#if defined(MAGICDITHER)
2   static void fill_rectangle_16bit_c1_dm(RECTANGLE *rect)
3#elif defined(BAYERDITHER)
4   static void fill_rectangle_16bit_c1_db(RECTANGLE *rect)
5#else
6   static void fill_rectangle_16bit_c1_dn(RECTANGLE *rect)
7#endif
8{
9   UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
10   UINT8* hb = &hidden_bits[fb_address >> 1];
11
12   int index, i, j;
13   int x1 = rect->xh / 4;
14   int x2 = rect->xl / 4;
15   int y1 = rect->yh / 4;
16   int y2 = rect->yl / 4;
17   int clipx1, clipx2, clipy1, clipy2;
18   UINT16 fill_color1, fill_color2;
19   int fill_cvg1;
20   int fill_cvg2;
21
22   if (x2 <= x1)
23   {
24      x2=x1+1; // SCARS (E)
25   }
26   if (y2 == y1)
27   {
28      y2=y1+1; // Goldeneye
29   }
30
31
32   fill_color1 = (fill_color >> 16) & 0xffff;
33   fill_color2 = (fill_color >>  0) & 0xffff;
34   fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
35   fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
36
37   clipx1 = clip.xh / 4;
38   clipx2 = clip.xl / 4;
39   clipy1 = clip.yh / 4;
40   clipy2 = clip.yl / 4;
41
42   // clip
43   if (x1 < clipx1)
44   {
45      x1 = clipx1;
46   }
47   if (y1 < clipy1)
48   {
49      y1 = clipy1;
50   }
51   if (x2 >= clipx2)
52   {
53      x2 = clipx2-1;
54   }
55   if (y2 >= clipy2)
56   {
57      y2 = clipy2-1;
58   }
59
60   shade_color.c = 0;   // Needed by Command & Conquer menus
61
62#if defined(MAGIC_DITHER)
63   for (j = y1; j <= y2; j++)
64   {
65      COLOR c;
66      int dith = 0;
67      index = j * fb_width;
68      for (i = x1; i <= x2; i++)
69      {
70         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
71         c.c = COLOR_COMBINER1();
72         dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
73         BLENDER1_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
74      }
75   }
76#elif defined(BAYER_DITHER)
77   for (j = y1; j <= y2; j++)
78   {
79      COLOR c;
80      int dith = 0;
81      index = j * fb_width;
82      for (i = x1; i <= x2; i++)
83      {
84         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
85         c.c = COLOR_COMBINER1();
86         dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
87         BLENDER1_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
88      }
89   }
90#else
91   for (j = y1; j <= y2; j++)
92   {
93      COLOR c;
94      index = j * fb_width;
95      for (i = x1; i <= x2; i++)
96      {
97         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
98         c.c = COLOR_COMBINER1();
99         BLENDER1_16_NDITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c);
100      }
101   }
102#endif
103}
104
105#if defined(MAGICDITHER)
106   static void fill_rectangle_16bit_c2_dm(RECTANGLE *rect)
107#elif defined(BAYERDITHER)
108   static void fill_rectangle_16bit_c2_db(RECTANGLE *rect)
109#else
110   static void fill_rectangle_16bit_c2_dn(RECTANGLE *rect)
111#endif
112{
113   UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
114   UINT8* hb = &hidden_bits[fb_address >> 1];
115
116   int index, i, j;
117   int x1 = rect->xh / 4;
118   int x2 = rect->xl / 4;
119   int y1 = rect->yh / 4;
120   int y2 = rect->yl / 4;
121   int clipx1, clipx2, clipy1, clipy2;
122   UINT16 fill_color1, fill_color2;
123   int fill_cvg1;
124   int fill_cvg2;
125
126   if (x2 <= x1)
127   {
128      x2=x1+1; // SCARS (E)
129   }
130   if (y2 == y1)
131   {
132      y2=y1+1; // Goldeneye
133   }
134
135
136   fill_color1 = (fill_color >> 16) & 0xffff;
137   fill_color2 = (fill_color >>  0) & 0xffff;
138   fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
139   fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
140
141   clipx1 = clip.xh / 4;
142   clipx2 = clip.xl / 4;
143   clipy1 = clip.yh / 4;
144   clipy2 = clip.yl / 4;
145
146   // clip
147   if (x1 < clipx1)
148   {
149      x1 = clipx1;
150   }
151   if (y1 < clipy1)
152   {
153      y1 = clipy1;
154   }
155   if (x2 >= clipx2)
156   {
157      x2 = clipx2-1;
158   }
159   if (y2 >= clipy2)
160   {
161      y2 = clipy2-1;
162   }
163
164   shade_color.c = 0;   // Needed by Command & Conquer menus
165
166#if defined(MAGIC_DITHER)
167   for (j=y1; j <= y2; j++)
168   {
169      COLOR c1, c2;
170      int dith = 0;
171      index = j * fb_width;
172      for (i=x1; i <= x2; i++)
173      {
174         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
175         c1.c = COLOR_COMBINER2_C0();
176         c2.c = COLOR_COMBINER2_C1();
177         dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
178         BLENDER2_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
179      }
180   }
181#elif defined(BAYER_DITHER)
182   for (j=y1; j <= y2; j++)
183   {
184      COLOR c1, c2;
185      int dith = 0;
186      index = j * fb_width;
187      for (i=x1; i <= x2; i++)
188      {
189         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
190         c1.c = COLOR_COMBINER2_C0();
191         c2.c = COLOR_COMBINER2_C1();
192         dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
193         BLENDER2_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
194      }
195   }
196#else
197   for (j=y1; j <= y2; j++)
198   {
199      COLOR c1, c2;
200      index = j * fb_width;
201      for (i=x1; i <= x2; i++)
202      {
203         curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
204         c1.c = COLOR_COMBINER2_C0();
205         c2.c = COLOR_COMBINER2_C1();
206         BLENDER2_16_NDITH(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2);
207      }
208   }
209#endif
210}
211
212#if defined(MAGICDITHER)
213static void fill_rectangle_16bit_cc(RECTANGLE *rect)
214{
215   fatalerror("fill_rectangle_16bit: cycle type copy");
216}
217#endif
218
219#if defined(MAGICDITHER)
220static void fill_rectangle_16bit_cf(RECTANGLE *rect)
221{
222   UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
223   UINT8* hb = &hidden_bits[fb_address >> 1];
224
225   int index, i, j;
226   int x1 = rect->xh / 4;
227   int x2 = rect->xl / 4;
228   int y1 = rect->yh / 4;
229   int y2 = rect->yl / 4;
230   int clipx1, clipx2, clipy1, clipy2;
231   UINT16 fill_color1, fill_color2;
232   int fill_cvg1;
233   int fill_cvg2;
234
235   if (x2 <= x1)
236   {
237      x2=x1+1; // SCARS (E)
238   }
239   if (y2 == y1)
240   {
241      y2=y1+1; // Goldeneye
242   }
243
244
245   fill_color1 = (fill_color >> 16) & 0xffff;
246   fill_color2 = (fill_color >>  0) & 0xffff;
247   fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
248   fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
249
250   clipx1 = clip.xh / 4;
251   clipx2 = clip.xl / 4;
252   clipy1 = clip.yh / 4;
253   clipy2 = clip.yl / 4;
254
255   // clip
256   if (x1 < clipx1)
257   {
258      x1 = clipx1;
259   }
260   if (y1 < clipy1)
261   {
262      y1 = clipy1;
263   }
264   if (x2 >= clipx2)
265   {
266      x2 = clipx2-1;
267   }
268   if (y2 >= clipy2)
269   {
270      y2 = clipy2-1;
271   }
272
273   shade_color.c = 0;   // Needed by Command & Conquer menus
274
275   fill_cvg1 = (fill_color1 & 1) ? 3 : 0;
276   fill_cvg2 = (fill_color2 & 1) ? 3 : 0;
277
278   if(x1 & 1)
279   {
280      for (j=y1; j <= y2; j++)
281      {
282         index = j * fb_width;
283         for (i=x1; i <= x2; i += 2)
284         {
285            int curpixel = index + i;
286            fb[curpixel ^ WORD_ADDR_XOR] = fill_color2;
287            hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg2;
288         }
289      }
290      for (j=y1; j <= y2; j++)
291      {
292         index = j * fb_width;
293         for (i=x1+1; i <= x2; i += 2)
294         {
295            int curpixel = index + i;
296            fb[curpixel ^ WORD_ADDR_XOR] = fill_color1;
297            hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg1;
298         }
299      }
300   }
301   else
302   {
303      for (j=y1; j <= y2; j++)
304      {
305         index = j * fb_width;
306         for (i=x1; i <= x2; i += 2)
307         {
308            int curpixel = index + i;
309            fb[curpixel ^ WORD_ADDR_XOR] = fill_color1;
310            hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg1;
311         }
312      }
313      for (j=y1; j <= y2; j++)
314      {
315         index = j * fb_width;
316         for (i=x1+1; i <= x2; i += 2)
317         {
318            int curpixel = index + i;
319            fb[curpixel ^ WORD_ADDR_XOR] = fill_color2;
320            hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg2;
321         }
322      }
323   }
324}
325#endif
src/mame/video/rdpfrect.h
r0r6796
1static void fill_rectangle_16bit_c1_dm(RECTANGLE *rect);
2static void fill_rectangle_16bit_c1_db(RECTANGLE *rect);
3static void fill_rectangle_16bit_c1_dn(RECTANGLE *rect);
4static void fill_rectangle_16bit_c2_dm(RECTANGLE *rect);
5static void fill_rectangle_16bit_c2_db(RECTANGLE *rect);
6static void fill_rectangle_16bit_c2_dn(RECTANGLE *rect);
7static void fill_rectangle_16bit_cc(RECTANGLE *rect);
8static void fill_rectangle_16bit_cf(RECTANGLE *rect);
9
10static void (*rdp_fill_rectangle_16bit_func[16])(RECTANGLE *) =
11{
12   fill_rectangle_16bit_c1_dm, fill_rectangle_16bit_c1_db, fill_rectangle_16bit_c1_dn, fill_rectangle_16bit_c1_dn,
13   fill_rectangle_16bit_c2_dm, fill_rectangle_16bit_c2_db, fill_rectangle_16bit_c2_dn, fill_rectangle_16bit_c2_dn,
14   fill_rectangle_16bit_cc,    fill_rectangle_16bit_cc,    fill_rectangle_16bit_cc,    fill_rectangle_16bit_cc,
15   fill_rectangle_16bit_cf,    fill_rectangle_16bit_cf,    fill_rectangle_16bit_cf,    fill_rectangle_16bit_cf,
16};
src/mame/video/rdpfetch.c
r6795r6796
1INLINE void FETCH_TEXEL_RGBA4_TLUT_EN0(COLOR *color, int s, int t)
1INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN0(UINT32 s, UINT32 t)
22{
3   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
4   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
5   UINT16 c = tlut[(((tpal << 4) | p) ^ WORD_ADDR_XOR) << 2];
6
7   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
8   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
9   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
10   color->i.a = (c & 1) ? 0xff : 0;
3   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
4   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
5   return rgb16_to_32_lut[tlut[((cached_tpal | p) ^ WORD_ADDR_XOR) << 2]];
116}
127
13INLINE void FETCH_TEXEL_RGBA4_TLUT_EN1(COLOR *color, int s, int t)
8INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN1(UINT32 s, UINT32 t)
149{
15   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
16   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
17   UINT16 c = tlut[(((tpal << 4) | p) ^ WORD_ADDR_XOR) << 2];
18
19   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
20   color->i.a = c & 0xff;
10   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
11   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
12   return ia8_to_32_lut[tlut[((cached_tpal | p) ^ WORD_ADDR_XOR) << 2]];
2113}
2214
23INLINE void FETCH_TEXEL_RGBA4_TLUT_NEN(COLOR *color, int s, int t)
15INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_NEN(UINT32 s, UINT32 t)
2416{
25   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
26   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
17   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
18   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
2719
28   color->i.r = color->i.g = color->i.b = color->i.a = (tpal << 4) | p;
20   return (cached_tpal | p) * 0x01010101;
2921}
3022
31INLINE void FETCH_TEXEL_RGBA8_TLUT_EN0(COLOR *color, int s, int t)
23INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN0(UINT32 s, UINT32 t)
3224{
33   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
34   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
35   UINT16 c = tlut[(p ^ WORD_ADDR_XOR) << 2];
36
37   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
38   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
39   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
40   color->i.a = (c & 1) ? 0xff : 0;
25   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
26   return rgb16_to_32_lut[tlut[(TMEM[taddr ^ BYTE_ADDR_XOR] ^ WORD_ADDR_XOR) << 2]];
4127}
4228
43INLINE void FETCH_TEXEL_RGBA8_TLUT_EN1(COLOR *color, int s, int t)
29INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN1(UINT32 s, UINT32 t)
4430{
45   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
46   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
47   UINT16 c = tlut[(p ^ WORD_ADDR_XOR) << 2];
48
49   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
50   color->i.a = c & 0xff;
31   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
32   return ia8_to_32_lut[tlut[(TMEM[taddr ^ BYTE_ADDR_XOR] ^ WORD_ADDR_XOR) << 2]];
5133}
5234
53INLINE void FETCH_TEXEL_RGBA8_TLUT_NEN(COLOR *color, int s, int t)
35INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_NEN(UINT32 s, UINT32 t)
5436{
55   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
56   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
57
58   color->i.r = color->i.g = color->i.b = color->i.a = p;
37   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
38   return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
5939}
6040
61INLINE void FETCH_TEXEL_RGBA16_TLUT_EN0(COLOR *color, int s, int t)
41INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN0(UINT32 s, UINT32 t)
6242{
63   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
64   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
65
66   c = tlut[(c >> 8) << 2];
67   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
68   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
69   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
70   color->i.a = (c & 1) ? 0xff : 0;
43   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
44   return rgb16_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
7145}
7246
73INLINE void FETCH_TEXEL_RGBA16_TLUT_EN1(COLOR *color, int s, int t)
47INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN1(UINT32 s, UINT32 t)
7448{
75   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
76   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
77
78   c = tlut[(c >> 8) << 2];
79   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
80   color->i.a = c & 0xff;
49   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
50   return ia8_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
8151}
8252
83INLINE void FETCH_TEXEL_RGBA16_TLUT_NEN(COLOR *color, int s, int t)
53INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_NEN(UINT32 s, UINT32 t)
8454{
85   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
86   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
87
88   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
89   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
90   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
91   color->i.a = (c & 1) ? 0xff : 0;
55   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
56   return rgb16_to_32_lut[TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]];
9257}
9358
94INLINE void FETCH_TEXEL_RGBA32_TLUT_EN0(COLOR *color, int s, int t)
59INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN0(UINT32 s, UINT32 t)
9560{
9661   int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
97   int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
98   UINT32 c = TMEM32[taddr];
62   UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
9963
100   c = tlut[(c >> 24) << 2];
101   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
102   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
103   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
104   color->i.a = (c & 1) ? 0xff : 0;
64   return rgb16_to_32_lut[tlut[(TMEM32[taddr] >> 24) << 2]];
10565}
10666
107INLINE void FETCH_TEXEL_RGBA32_TLUT_EN1(COLOR *color, int s, int t)
67INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN1(UINT32 s, UINT32 t)
10868{
10969   int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
110   int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
111   UINT32 c = TMEM32[taddr];
70   UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
11271
113   c = tlut[(c >> 24) << 2];
114   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
115   color->i.a = c & 0xff;
72   return ia8_to_32_lut[tlut[(TMEM32[taddr] >> 24) << 2]];
11673}
11774
118INLINE void FETCH_TEXEL_RGBA32_TLUT_NEN(COLOR *color, int s, int t)
75INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_NEN(UINT32 s, UINT32 t)
11976{
12077   int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
121   int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
122   UINT32 c = TMEM32[taddr];
78   UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
12379
124   color->c = c;
80   return TMEM32[taddr];
12581}
12682
127INLINE void FETCH_TEXEL_YUV16(COLOR *color, int s, int t)
83INLINE UINT32 FETCH_TEXEL_YUV16(UINT32 s, UINT32 t)
12884{   // YUV: Bottom of the 9th, Pokemon Stadium, Ogre Battle 64
12985   INT32 newr = 0;
13086   INT32 newg = 0;
13187   INT32 newb = 0;
132   int taddr = ((tbase >> 1) + ((t) * (twidth)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
133   UINT16 c1, c2;
88   UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
89   UINT32 c1, c2;
13490   INT32 y;
13591   INT32 u, v;
13692   c1 = TMEM16[taddr ^ WORD_ADDR_XOR];
r6795r6796
157113      newg = y + ((k1 * u) >> 8) + ((k2 * v) >> 8);
158114      newb = y + ((k3 * u) >> 8);
159115   }
160   color->i.r = (newr < 0) ? 0 : ((newr > 0xff) ? 0xff : newr);
161   color->i.g = (newg < 0) ? 0 : ((newg > 0xff) ? 0xff : newg);
162   color->i.b = (newb < 0) ? 0 : ((newb > 0xff) ? 0xff : newb);
163   color->i.a = 0xff;
116   return (((newr < 0) ? 0 : ((newr > 0xff) ? 0xff : newr)) << 24) |
117          (((newg < 0) ? 0 : ((newg > 0xff) ? 0xff : newg)) << 16) |
118          (((newb < 0) ? 0 : ((newb > 0xff) ? 0xff : newb)) <<  8) |
119          0xff;
164120}
165121
166INLINE void FETCH_TEXEL_CI4_TLUT_EN0(COLOR *color, int s, int t)
122INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN0(UINT32 s, UINT32 t)
167123{
168   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
169   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
170   UINT16 c = tlut[((tpal << 4) | p) << 2];
171
172   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
173   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
174   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
175   color->i.a = (c & 1) ? 0xff : 0;
124   UINT32 b = TMEM[(((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff) ^ BYTE_ADDR_XOR];
125   return rgb16_to_32_lut[tlut[(cached_tpal | (((s) & 1) ? (b & 0xf) : (b >> 4))) << 2]];
176126}
177127
178INLINE void FETCH_TEXEL_CI4_TLUT_EN1(COLOR *color, int s, int t)
128INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN1(UINT32 s, UINT32 t)
179129{
180   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
181   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
182   UINT16 c = tlut[((tpal << 4) | p) << 2];
183
184   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
185   color->i.a = c & 0xff;
130   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
131   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
132   return ia8_to_32_lut[tlut[(cached_tpal | p) << 2]];
186133}
187134
188INLINE void FETCH_TEXEL_CI4_TLUT_NEN(COLOR *color, int s, int t)
135INLINE UINT32 FETCH_TEXEL_CI4_TLUT_NEN(UINT32 s, UINT32 t)
189136{
190   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
191   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
137   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
138   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
192139
193   color->i.r = color->i.g = color->i.b = color->i.a = (tpal << 4) | p;
140   return (cached_tpal | p) * 0x01010101;
194141}
195142
196INLINE void FETCH_TEXEL_CI8_TLUT_EN0(COLOR *color, int s, int t)
143INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN0(UINT32 s, UINT32 t)
197144{
198   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
199   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
200   UINT16 c = tlut[p << 2];
201
202   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
203   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
204   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
205   color->i.a = (c & 1) ? 0xff : 0;
145   return rgb16_to_32_lut[tlut[TMEM[(((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff) ^ BYTE_ADDR_XOR] << 2]];
206146}
207147
208INLINE void FETCH_TEXEL_CI8_TLUT_EN1(COLOR *color, int s, int t)
148INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN1(UINT32 s, UINT32 t)
209149{
210   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
211   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
212   UINT16 c = tlut[p << 2];
213
214   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
215   color->i.a = c & 0xff;
216   color->c = 0xffffffff;
150   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
151   return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
217152}
218153
219INLINE void FETCH_TEXEL_CI8_TLUT_NEN(COLOR *color, int s, int t)
154INLINE UINT32 FETCH_TEXEL_CI8_TLUT_NEN(UINT32 s, UINT32 t)
220155{
221   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
222   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
223
224   color->i.r = color->i.g = color->i.b = color->i.a = p;
156   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
157   return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
225158}
226159
227INLINE void FETCH_TEXEL_CI16_TLUT_EN0(COLOR *color, int s, int t)
160INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN0(UINT32 s, UINT32 t)
228161{   // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
229   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
230   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
231
232   c = tlut[(c >> 8) << 2];
233   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
234   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
235   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
236   color->i.a = (c & 1) ? 0xff : 0;
162   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
163   return rgb16_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
237164}
238165
239INLINE void FETCH_TEXEL_CI16_TLUT_EN1(COLOR *color, int s, int t)
166INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN1(UINT32 s, UINT32 t)
240167{   // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
241   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
242   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
243
244   // Beetle Adventure Racing, Mount Mayhem
245   c = tlut[(c >> 8) << 2];
246   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
247   color->i.a = c & 0xff;
168   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
169   return ia8_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]]; // Beetle Adventure Racing, Mount Mayhem
248170}
249171
250INLINE void FETCH_TEXEL_CI16_TLUT_NEN(COLOR *color, int s, int t)
172INLINE UINT32 FETCH_TEXEL_CI16_TLUT_NEN(UINT32 s, UINT32 t)
251173{   // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
252   int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
253   UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
254
255   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
256   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
257   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
258   color->i.a = (c & 1) ? 0xff : 0;
174   UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s))  ^ ((t & 1) ? XOR_SWAP_WORD : 0);
175   return rgb16_to_32_lut[TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]]; // PGA European Tour (U)
259176}
260177
261INLINE void FETCH_TEXEL_IA4_TLUT_EN0(COLOR *color, int s, int t)
178INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN0(UINT32 s, UINT32 t)
262179{
263   int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
264   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
265   UINT16 c = tlut[((tpal << 4) | p) << 2];
266
267   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
268   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
269   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
270   color->i.a = (c & 1) ? 0xff : 0;
180   UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
181   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
182   return rgb16_to_32_lut[tlut[(cached_tpal | p) << 2]];
271183}
272184
273INLINE void FETCH_TEXEL_IA4_TLUT_EN1(COLOR *color, int s, int t)
185INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN1(UINT32 s, UINT32 t)
274186{
275   int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
276   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
277   UINT16 c = tlut[((tpal << 4) | p) << 2];
278
279   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
280   color->i.a = c & 0xff;
187   UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
188   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
189   return ia8_to_32_lut[tlut[(cached_tpal | p) << 2]];
281190}
282191
283INLINE void FETCH_TEXEL_IA4_TLUT_NEN(COLOR *color, int s, int t)
192INLINE UINT32 FETCH_TEXEL_IA4_TLUT_NEN(UINT32 s, UINT32 t)
284193{
285   int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
286   UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
287   UINT8 i = ((p & 0xe) << 4) | ((p & 0xe) << 1) | (p & 0xe >> 2);
194   UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
195   UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
196   UINT32 i = ((p & 0xe) << 4) | ((p & 0xe) << 1) | (p & 0xe >> 2);
288197
289   color->i.r = i;
290   color->i.g = i;
291   color->i.b = i;
292   color->i.a = (p & 0x1) ? 0xff : 0;
198   return (i * 0x01010100) | ((p & 0x1) ? 0xff : 0);
293199}
294200
295INLINE void FETCH_TEXEL_IA8_TLUT_EN0(COLOR *color, int s, int t)
201INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN0(UINT32 s, UINT32 t)
296202{
297   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
298   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
299   UINT16 c = tlut[p << 2];
300
301   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
302   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
303   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
304   color->i.a = (c & 1) ? 0xff : 0;
203   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
204   return rgb16_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
305205}
306206
307INLINE void FETCH_TEXEL_IA8_TLUT_EN1(COLOR *color, int s, int t)
207INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN1(UINT32 s, UINT32 t)
308208{
309   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
310   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
311   UINT16 c = tlut[p << 2];
312
313   color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
314   color->i.a = c & 0xff;
209   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
210   return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
315211}
316212
317INLINE void FETCH_TEXEL_IA8_TLUT_NEN(COLOR *color, int s, int t)
213INLINE UINT32 FETCH_TEXEL_IA8_TLUT_NEN(UINT32 s, UINT32 t)
318214{
319   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
320   UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
321   UINT8 i = (p >> 4) | (p & 0xf0);
215   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
216   UINT32 p = TMEM[taddr ^ BYTE_ADDR_XOR];
217   UINT32 i = (p >> 4) | (p & 0xf0);
322218
323   color->i.r = i;
324   color->i.g = i;
325   color->i.b = i;
326   color->i.a = (p & 0xf) | ((p << 4) & 0xf0);
219   return (i * 0x01010100) | ((p & 0xf) | ((p << 4) & 0xf0));
327220}
328221
329INLINE void FETCH_TEXEL_IA16_TLUT_EN0(COLOR *color, int s, int t)
222INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN0(UINT32 s, UINT32 t)
330223{
331   int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
332   UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
333
334   c = tlut[(c >> 8) << 2];
335   color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
336   color->i.g = ((c >> 3) & 0xf8) | ((c >>  8) & 0x07);
337   color->i.b = ((c << 2) & 0xf8) | ((c >>  3) & 0x07);
338   color->i.a = (c & 1) ? 0xff : 0;
224   UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
225   return rgb16_to_32_lut[tlut[(TMEM16[taddr ^ WORD_ADDR_XOR] >> 8) << 2]];
339226}
340227
341INLINE void FETCH_TEXEL_IA16_TLUT_EN1(COLOR *color, int s, int t)
228INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN1(UINT32 s, UINT32 t)
342229{
343   int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
344   UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
345
346   c = tlut[(c >> 8) << 2];
347   color->i.r = c >> 8;
348   color->i.g = c >> 8;
349   color->i.b = c >> 8;
350   color->i.a = c & 0xff;
230   UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
231   return ia8_to_32_lut[tlut[(TMEM16[taddr ^ WORD_ADDR_XOR] >> 8) << 2]];
351232}
352233
353INLINE void FETCH_TEXEL_IA16_TLUT_NEN(COLOR *color, int s, int t)
234INLINE UINT32 FETCH_TEXEL_IA16_TLUT_NEN(UINT32 s, UINT32 t)
354235{
355   int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
356   UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
357   UINT8 i = (c >> 8);
236   UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
237   UINT32 c = TMEM16[taddr ^ WORD_ADDR_XOR];
358238
359   color->i.r = i;
360   color->i.g = i;
361   color->i.b = i;
362   color->i.a = c & 0xff;
239   return ((c >> 8) * 0x01010100) | (c & 0xff);
363240}
364241
365INLINE void FETCH_TEXEL_I4_TLUT_EN0(COLOR *color, int s, int t)
242INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN0(UINT32 s, UINT32 t)
366243{
367   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
368   UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
369   UINT16 k;
244   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
245   UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
370246   c |= (c << 4);
371   k = tlut[((tpal << 4) | c) << 2];
372247
373   color->i.r = ((k >> 8) & 0xf8) | (k >> 13);
374   color->i.g = ((k >> 3) & 0xf8) | ((k >>  8) & 0x07);
375   color->i.b = ((k << 2) & 0xf8) | ((k >>  3) & 0x07);
376   color->i.a = (k & 1) ? 0xff : 0;
248   return rgb16_to_32_lut[tlut[(cached_tpal | c) << 2]];
377249}
378250
379INLINE void FETCH_TEXEL_I4_TLUT_EN1(COLOR *color, int s, int t)
251INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN1(UINT32 s, UINT32 t)
380252{
381   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
382   UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
383   UINT16 k;
384
253   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
254   UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
385255   c |= (c << 4);
386   k = tlut[((tpal << 4) | c) << 2];
387   color->i.r = color->i.g = color->i.b = (k >> 8) & 0xff;
388   color->i.a = k & 0xff;
256
257   return ia8_to_32_lut[tlut[(cached_tpal | c) << 2]];
389258}
390259
391INLINE void FETCH_TEXEL_I4_TLUT_NEN(COLOR *color, int s, int t)
260INLINE UINT32 FETCH_TEXEL_I4_TLUT_NEN(UINT32 s, UINT32 t)
392261{
393   int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
394   UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
262   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
263   UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
395264   c |= (c << 4);
396265
397   color->i.r = c;
398   color->i.g = c;
399   color->i.b = c;
400   color->i.a = c;
266   return (c * 0x01010101);
401267}
402268
403INLINE void FETCH_TEXEL_I8_TLUT_EN0(COLOR *color, int s, int t)
269INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN0(UINT32 s, UINT32 t)
404270{
405   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
406   UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
407   UINT16 k = tlut[ c << 2];
408
409   color->i.r = ((k >> 8) & 0xf8) | (k >> 13);
410   color->i.g = ((k >> 3) & 0xf8) | ((k >>  8) & 0x07);
411   color->i.b = ((k << 2) & 0xf8) | ((k >>  3) & 0x07);
412   color->i.a = (k & 1) ? 0xff : 0;
271   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
272   return rgb16_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
413273}
414274
415INLINE void FETCH_TEXEL_I8_TLUT_EN1(COLOR *color, int s, int t)
275INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN1(UINT32 s, UINT32 t)
416276{
417   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
418   UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
419   UINT16 k = tlut[ c << 2];
420
421   color->i.r = color->i.g = color->i.b = (k >> 8) & 0xff;
422   color->i.a = k & 0xff;
277   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
278   return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
423279}
424280
425INLINE void FETCH_TEXEL_I8_TLUT_NEN(COLOR *color, int s, int t)
281INLINE UINT32 FETCH_TEXEL_I8_TLUT_NEN(UINT32 s, UINT32 t)
426282{
427   int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
428   UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
429
430   color->i.r = c;
431   color->i.g = c;
432   color->i.b = c;
433   color->i.a = c;
283   UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
284   return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
434285}
435286
436INLINE void FETCH_TEXEL_INVALID(COLOR *color, int s, int t)
287INLINE UINT32 FETCH_TEXEL_INVALID(UINT32 s, UINT32 t)
437288{
438   //printf("Invalid texel mode\n");
289   printf("Invalid texel mode\n");
290   return 0;
439291}
440292
441//typedef void (*rdp_fetch_texel_func)(COLOR *color, int s, int t);
293//typedef void (*rdp_fetch_texel_func)(UINT32 s, UINT32 t);
src/mame/video/rdpfetch.h
r6795r6796
1INLINE void FETCH_TEXEL_RGBA4_TLUT_EN0(COLOR *color, int s, int t);
2INLINE void FETCH_TEXEL_RGBA4_TLUT_EN1(COLOR *color, int s, int t);
3INLINE void FETCH_TEXEL_RGBA4_TLUT_NEN(COLOR *color, int s, int t);
4INLINE void FETCH_TEXEL_RGBA8_TLUT_EN0(COLOR *color, int s, int t);
5INLINE void FETCH_TEXEL_RGBA8_TLUT_EN1(COLOR *color, int s, int t);
6INLINE void FETCH_TEXEL_RGBA8_TLUT_NEN(COLOR *color, int s, int t);
7INLINE void FETCH_TEXEL_RGBA16_TLUT_EN0(COLOR *color, int s, int t);
8INLINE void FETCH_TEXEL_RGBA16_TLUT_EN1(COLOR *color, int s, int t);
9INLINE void FETCH_TEXEL_RGBA16_TLUT_NEN(COLOR *color, int s, int t);
10INLINE void FETCH_TEXEL_RGBA32_TLUT_EN0(COLOR *color, int s, int t);
11INLINE void FETCH_TEXEL_RGBA32_TLUT_EN1(COLOR *color, int s, int t);
12INLINE void FETCH_TEXEL_RGBA32_TLUT_NEN(COLOR *color, int s, int t);
13INLINE void FETCH_TEXEL_YUV16(COLOR *color, int s, int t);
14INLINE void FETCH_TEXEL_CI4_TLUT_EN0(COLOR *color, int s, int t);
15INLINE void FETCH_TEXEL_CI4_TLUT_EN1(COLOR *color, int s, int t);
16INLINE void FETCH_TEXEL_CI4_TLUT_NEN(COLOR *color, int s, int t);
17INLINE void FETCH_TEXEL_CI8_TLUT_EN0(COLOR *color, int s, int t);
18INLINE void FETCH_TEXEL_CI8_TLUT_EN1(COLOR *color, int s, int t);
19INLINE void FETCH_TEXEL_CI8_TLUT_NEN(COLOR *color, int s, int t);
20INLINE void FETCH_TEXEL_CI16_TLUT_EN0(COLOR *color, int s, int t);
21INLINE void FETCH_TEXEL_CI16_TLUT_EN1(COLOR *color, int s, int t);
22INLINE void FETCH_TEXEL_CI16_TLUT_NEN(COLOR *color, int s, int t);
23INLINE void FETCH_TEXEL_IA4_TLUT_EN0(COLOR *color, int s, int t);
24INLINE void FETCH_TEXEL_IA4_TLUT_EN1(COLOR *color, int s, int t);
25INLINE void FETCH_TEXEL_IA4_TLUT_NEN(COLOR *color, int s, int t);
26INLINE void FETCH_TEXEL_IA8_TLUT_EN0(COLOR *color, int s, int t);
27INLINE void FETCH_TEXEL_IA8_TLUT_EN1(COLOR *color, int s, int t);
28INLINE void FETCH_TEXEL_IA8_TLUT_NEN(COLOR *color, int s, int t);
29INLINE void FETCH_TEXEL_IA16_TLUT_EN0(COLOR *color, int s, int t);
30INLINE void FETCH_TEXEL_IA16_TLUT_EN1(COLOR *color, int s, int t);
31INLINE void FETCH_TEXEL_IA16_TLUT_NEN(COLOR *color, int s, int t);
32INLINE void FETCH_TEXEL_I4_TLUT_EN0(COLOR *color, int s, int t);
33INLINE void FETCH_TEXEL_I4_TLUT_EN1(COLOR *color, int s, int t);
34INLINE void FETCH_TEXEL_I4_TLUT_NEN(COLOR *color, int s, int t);
35INLINE void FETCH_TEXEL_I8_TLUT_EN0(COLOR *color, int s, int t);
36INLINE void FETCH_TEXEL_I8_TLUT_EN1(COLOR *color, int s, int t);
37INLINE void FETCH_TEXEL_I8_TLUT_NEN(COLOR *color, int s, int t);
38INLINE void FETCH_TEXEL_INVALID(COLOR *color, int s, int t);
1INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN0(UINT32 s, UINT32 t);
2INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN1(UINT32 s, UINT32 t);
3INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_NEN(UINT32 s, UINT32 t);
4INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN0(UINT32 s, UINT32 t);
5INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN1(UINT32 s, UINT32 t);
6INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_NEN(UINT32 s, UINT32 t);
7INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN0(UINT32 s, UINT32 t);
8INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN1(UINT32 s, UINT32 t);
9INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_NEN(UINT32 s, UINT32 t);
10INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN0(UINT32 s, UINT32 t);
11INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN1(UINT32 s, UINT32 t);
12INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_NEN(UINT32 s, UINT32 t);
13INLINE UINT32 FETCH_TEXEL_YUV16(UINT32 s, UINT32 t);
14INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN0(UINT32 s, UINT32 t);
15INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN1(UINT32 s, UINT32 t);
16INLINE UINT32 FETCH_TEXEL_CI4_TLUT_NEN(UINT32 s, UINT32 t);
17INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN0(UINT32 s, UINT32 t);
18INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN1(UINT32 s, UINT32 t);
19INLINE UINT32 FETCH_TEXEL_CI8_TLUT_NEN(UINT32 s, UINT32 t);
20INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN0(UINT32 s, UINT32 t);
21INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN1(UINT32 s, UINT32 t);
22INLINE UINT32 FETCH_TEXEL_CI16_TLUT_NEN(UINT32 s, UINT32 t);
23INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN0(UINT32 s, UINT32 t);
24INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN1(UINT32 s, UINT32 t);
25INLINE UINT32 FETCH_TEXEL_IA4_TLUT_NEN(UINT32 s, UINT32 t);
26INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN0(UINT32 s, UINT32 t);
27INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN1(UINT32 s, UINT32 t);
28INLINE UINT32 FETCH_TEXEL_IA8_TLUT_NEN(UINT32 s, UINT32 t);
29INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN0(UINT32 s, UINT32 t);
30INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN1(UINT32 s, UINT32 t);
31INLINE UINT32 FETCH_TEXEL_IA16_TLUT_NEN(UINT32 s, UINT32 t);
32INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN0(UINT32 s, UINT32 t);
33INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN1(UINT32 s, UINT32 t);
34INLINE UINT32 FETCH_TEXEL_I4_TLUT_NEN(UINT32 s, UINT32 t);
35INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN0(UINT32 s, UINT32 t);
36INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN1(UINT32 s, UINT32 t);
37INLINE UINT32 FETCH_TEXEL_I8_TLUT_NEN(UINT32 s, UINT32 t);
38INLINE UINT32 FETCH_TEXEL_INVALID(UINT32 s, UINT32 t);
3939
40static void (*rdp_fetch_texel_func[128])(COLOR*, int, int) =
40static UINT32 (*rdp_fetch_texel_func[128])(UINT32, UINT32) =
4141{
4242   // 4-bit accessors
4343   FETCH_TEXEL_RGBA4_TLUT_NEN, FETCH_TEXEL_RGBA4_TLUT_NEN, FETCH_TEXEL_RGBA4_TLUT_EN0, FETCH_TEXEL_RGBA4_TLUT_EN1,
src/mame/video/rdptri.c
r6795r6796
26242624   ympix = ym >> 2;
26252625   ylpix = yl >> 2;
26262626
2627   for (k = ycur; k <= ylfar; k++)
2627   if(flip)
26282628   {
2629      if (k == ym)
2629      for (k = ycur; k <= ylfar; k++)
26302630      {
2631         xleft = xl;
2632         xleft_inc = dxldy >> 2;
2633      }
2631         if (k == ym)
2632         {
2633            xleft = xl;
2634            xleft_inc = dxldy >> 2;
2635         }
26342636
2635      xstart = xleft >> 16;
2636      xend = xright >> 16;
2637      j = k >> 2;
2638      spix = k & 3;
2637         xstart = xleft >> 16;
2638         xend = xright >> 16;
2639         j = k >> 2;
2640         spix = k & 3;
26392641
2640      if (k >= 0 && k < 0x1000)
2641      {
2642         int m = 0;
2643         int n = 0;
2644         int length = 0;
2645         min = 0; max = 3;
2646         if (j == yhpix)
2642         if (k >= 0 && k < 0x1000)
26472643         {
2648            min = yh & 3;
2649         }
2650         if (j == ylpix)
2651         {
2652            max = yl & 3;
2653         }
2654         if (spix >= min && spix <= max)
2655         {
2656            if (spix == min)
2644            int m = 0;
2645            int n = 0;
2646            int length = 0;
2647            min = 0; max = 3;
2648            if (j == yhpix)
26572649            {
2658               minxmx = maxxmx = xstart;
2659               minxhx = maxxhx = xend;
2650               min = yh & 3;
26602651            }
2661            else
2652            if (j == ylpix)
26622653            {
2663               minxmx = (xstart < minxmx) ? xstart : minxmx;
2664               maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
2665               minxhx = (xend < minxhx) ? xend : minxhx;
2666               maxxhx = (xend > maxxhx) ? xend : maxxhx;
2654               max = yl & 3;
26672655            }
2668         }
2656            if (spix >= min && spix <= max)
2657            {
2658               if (spix == min)
2659               {
2660                  minxmx = maxxmx = xstart;
2661                  minxhx = maxxhx = xend;
2662               }
2663               else
2664               {
2665                  minxmx = (xstart < minxmx) ? xstart : minxmx;
2666                  maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
2667                  minxhx = (xend < minxhx) ? xend : minxhx;
2668                  maxxhx = (xend > maxxhx) ? xend : maxxhx;
2669               }
2670            }
26692671
2670         if (spix == max)
2671         {
2672            if (flip)
2672            if (spix == max)
26732673            {
26742674               span[j].lx = maxxmx;
26752675               span[j].rx = minxhx;
26762676            }
2677            else
2677
2678            length = xstart - xend;
2679
2680            if (spix == ldflag)
26782681            {
2679               span[j].lx = minxmx;
2680               span[j].rx = maxxhx;
2682               xfrac = ((xright >> 8) & 0xff);
2683               adjust_attr();
26812684            }
2685
2686            m = xend + 1;
2687
2688            if (k >= yh && length >= 0 && k <= yl)
2689            {
2690               if (xstart>=0 && xstart <1024)
2691               {
2692                  span[j].cvg[xstart] += addright(xleft);
2693               }
2694               if (xend>=0 && xend<1024)
2695               {
2696                  if (xstart != xend)
2697                  {
2698                     span[j].cvg[xend] += addleft(xright);
2699                  }
2700                  else
2701                  {
2702                     span[j].cvg[xend] -= (2 - addleft(xright));
2703                     if (span[j].cvg[xend] > 200)
2704                     {
2705                        span[j].cvg[xend] = 0;
2706                     }
2707                  }
2708               }
2709               for (n = 0; n < (length - 1); n++)
2710               {
2711                  if (m>=0 && m < 640)
2712                  {
2713                     span[j].cvg[m] += 2;
2714                  }
2715
2716                  m += m_inc;
2717               }
2718            }
26822719         }
26832720
2684         length = flip ? (xstart - xend) : (xend - xstart);
2685
2686         if (spix == ldflag)
2721         if (spix == 3)
26872722         {
2688            xfrac = ((xright >> 8) & 0xff);
2689            adjust_attr();
2723            addvalues();
26902724         }
2725         xleft += xleft_inc;
2726         xright += xright_inc;
2727      }
2728   }
2729   else
2730   {
2731      for (k = ycur; k <= ylfar; k++)
2732      {
2733         if (k == ym)
2734         {
2735            xleft = xl;
2736            xleft_inc = dxldy >> 2;
2737         }
26912738
2692         m = flip ? (xend+1) : (xend-1);
2739         xstart = xleft >> 16;
2740         xend = xright >> 16;
2741         j = k >> 2;
2742         spix = k & 3;
26932743
2694         if (k >= yh && length >= 0 && k <= yl)
2744         if (k >= 0 && k < 0x1000)
26952745         {
2696            if (xstart>=0 && xstart <1024)
2746            int m = 0;
2747            int n = 0;
2748            int length = 0;
2749            min = 0; max = 3;
2750            if (j == yhpix)
26972751            {
2698               if (!flip)
2752               min = yh & 3;
2753            }
2754            if (j == ylpix)
2755            {
2756               max = yl & 3;
2757            }
2758            if (spix >= min && spix <= max)
2759            {
2760               if (spix == min)
26992761               {
2700                  span[j].cvg[xstart] += addleft(xleft);
2762                  minxmx = maxxmx = xstart;
2763                  minxhx = maxxhx = xend;
27012764               }
27022765               else
27032766               {
2704                  span[j].cvg[xstart] += addright(xleft);
2767                  minxmx = (xstart < minxmx) ? xstart : minxmx;
2768                  maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
2769                  minxhx = (xend < minxhx) ? xend : minxhx;
2770                  maxxhx = (xend > maxxhx) ? xend : maxxhx;
27052771               }
27062772            }
2707            if (xend>=0 && xend<1024)
2773
2774            if (spix == max)
27082775            {
2709               if (xstart != xend)
2776               span[j].lx = minxmx;
2777               span[j].rx = maxxhx;
2778            }
2779
2780            length = xend - xstart;
2781
2782            if (spix == ldflag)
2783            {
2784               xfrac = ((xright >> 8) & 0xff);
2785               adjust_attr();
2786            }
2787
2788            m = xend - 1;
2789
2790            if (k >= yh && length >= 0 && k <= yl)
2791            {
2792               if (xstart>=0 && xstart <1024)
27102793               {
2711                  if (!flip)
2794                  span[j].cvg[xstart] += addleft(xleft);
2795               }
2796               if (xend>=0 && xend<1024)
2797               {
2798                  if (xstart != xend)
27122799                  {
27132800                     span[j].cvg[xend] += addright(xright);
27142801                  }
27152802                  else
27162803                  {
2717                     span[j].cvg[xend] += addleft(xright);
2804                     span[j].cvg[xend] -= (2 - addright(xright));
2805                     if (span[j].cvg[xend] > 200)
2806                     {
2807                        span[j].cvg[xend] = 0;
2808                     }
27182809                  }
27192810               }
2720               else
2811               for (n = 0; n < (length - 1); n++)
27212812               {
2722                  if (!flip)
2813                  if (m>=0 && m < 640)
27232814                  {
2724                     span[j].cvg[xend] -= (2 - addright(xright));
2815                     span[j].cvg[m] += 2;
27252816                  }
2726                  else
2727                  {
2728                     span[j].cvg[xend] -= (2 - addleft(xright));
2729                  }
2730                  if (span[j].cvg[xend] > 200)
2731                  {
2732                     span[j].cvg[xend] = 0;
2733                  }
2817
2818                  m += m_inc;
27342819               }
27352820            }
2736            for (n = 0; n < (length - 1); n++)
2737            {
2738               if (m>=0 && m < 640)
2739               {
2740                  span[j].cvg[m] += 2;
2741               }
2821         }
27422822
2743               m += m_inc;
2744            }
2823         if (spix == 3)
2824         {
2825            addvalues();
27452826         }
2827         xleft += xleft_inc;
2828         xright += xright_inc;
27462829      }
2747
2748      if (spix == 3)
2749      {
2750         addvalues();
2751      }
2752      xleft += xleft_inc;
2753      xright += xright_inc;
27542830   }
27552831
27562832   switch (fb_size) // 8bpp needs to be implemented
src/mame/video/rdptpipe.c
r6795r6796
1INLINE void TEXTURE_PIPELINE_BILINEAR_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
1#define RELATIVE(x, y)    (((((x) >> 3) - (y)) << 3) | (x & 7))
2
3INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
24{
3#define RELATIVE(x, y)    ((((x) >> 3) - (y)) << 3) | (x & 7);
45   INT32 maxs, maxt;
5   COLOR t0, t1, t2, t3;
6   int sss1, sst1, sss2, sst2;
6   COLOR t0, t1, t2, t3, TEX;
7   int sss2, sst2;
78
89   INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
910   INT32 R32, G32, B32, A32;
1011   INT32 maxs2, maxt2;
11   int upper = 0;
1212
13   t0.c = 0;
14   t1.c = 0;
15   t2.c = 0;
16   t3.c = 0;
13   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
1714
18   sss1 = SSS;
19   sst1 = SST;
20
21   texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
22
23   sss2 = sss1 + 32; sst2 = sst1 + 32;
15   sss2 = SSS + 32; sst2 = SST + 32;
2416   maxs2 = ((sss2 >> 3) >= tex_tile->sh);
2517   maxt2 = ((sst2 >> 3) >= tex_tile->th);
2618
27   sss1 = RELATIVE(sss1, tex_tile->sl);
28   sst1 = RELATIVE(sst1, tex_tile->tl);
19   SSS = RELATIVE(SSS, tex_tile->sl);
20   SST = RELATIVE(SST, tex_tile->tl);
2921   sss2 = RELATIVE(sss2, tex_tile->sl);
3022   sst2 = RELATIVE(sst2, tex_tile->tl);
3123
32   SFRAC = sss1 & 0x1f;
33   TFRAC = sst1 & 0x1f;
24   SFRAC = SSS & 0x1f;
25   TFRAC = SST & 0x1f;
3426
35   CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
27   CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
3628   CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
3729
38   MASK(&sss1, &sst1, tex_tile);
30   MASK(&SSS, &SST, tex_tile);
3931   MASK(&sss2, &sst2, tex_tile);
4032
41   upper = ((SFRAC + TFRAC) >= 0x20);
42   if (upper)
43   {
44      INVSF = 0x20 - SFRAC;
45      INVTF = 0x20 - TFRAC;
46   }
33   t1.c = FETCH_TEXEL(sss2, SST);
34   t2.c = FETCH_TEXEL(SSS, sst2);
4735
48   FETCH_TEXEL(&t1, sss2, sst1, tex_tile);
49   FETCH_TEXEL(&t2, sss1, sst2, tex_tile);
50
51   if (!upper)
36   if ((SFRAC + TFRAC) < 0x20)
5237   {
53      FETCH_TEXEL(&t0, sss1, sst1, tex_tile);
38      t0.c = FETCH_TEXEL(SSS, SST);
5439      R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
55      TEX->i.r = (R32 < 0) ? 0 : R32;
40      TEX.i.r = (R32 < 0) ? 0 : R32;
5641      G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
57      TEX->i.g = (G32 < 0) ? 0 : G32;
42      TEX.i.g = (G32 < 0) ? 0 : G32;
5843      B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
59      TEX->i.b = (B32 < 0) ? 0 : B32;
44      TEX.i.b = (B32 < 0) ? 0 : B32;
6045      A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
61      TEX->i.a = (A32 < 0) ? 0 : A32;
46      TEX.i.a = (A32 < 0) ? 0 : A32;
6247   }
6348   else
6449   {
65      FETCH_TEXEL(&t3, sss2, sst2, tex_tile);
50      INVSF = 0x20 - SFRAC;
51      INVTF = 0x20 - TFRAC;
52      t3.c = FETCH_TEXEL(sss2, sst2);
6653      R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
67      TEX->i.r = (R32 < 0) ? 0 : R32;
54      TEX.i.r = (R32 < 0) ? 0 : R32;
6855      G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
69      TEX->i.g = (G32 < 0) ? 0 : G32;
56      TEX.i.g = (G32 < 0) ? 0 : G32;
7057      B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
71      TEX->i.b = (B32 < 0) ? 0 : B32;
58      TEX.i.b = (B32 < 0) ? 0 : B32;
7259      A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
73      TEX->i.a = (A32 < 0) ? 0 : A32;
60      TEX.i.a = (A32 < 0) ? 0 : A32;
7461   }
62
63   return TEX.c;
7564}
7665
77INLINE void TEXTURE_PIPELINE_BILINEAR_MID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
66INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile)
7867{
79#define RELATIVE(x, y)    ((((x) >> 3) - (y)) << 3) | (x & 7);
8068   INT32 maxs, maxt;
81   COLOR t0, t1, t2, t3;
82   int sss1, sst1, sss2, sst2;
69   COLOR t0, t1, t2, t3, TEX;
70   int sss2, sst2;
8371
8472   INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
8573   INT32 R32, G32, B32, A32;
8674   INT32 maxs2, maxt2;
87   int upper = 0;
8875
89   t0.c = 0;
90   t1.c = 0;
91   t2.c = 0;
92   t3.c = 0;
76   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
9377
94   sss1 = SSS;
95   sst1 = SST;
96
97   texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
98
99   sss2 = sss1 + 32; sst2 = sst1 + 32;
78   sss2 = SSS + 32; sst2 = SST + 32;
10079   maxs2 = ((sss2 >> 3) >= tex_tile->sh);
10180   maxt2 = ((sst2 >> 3) >= tex_tile->th);
10281
103   sss1 = RELATIVE(sss1, tex_tile->sl);
104   sst1 = RELATIVE(sst1, tex_tile->tl);
82   SSS = RELATIVE(SSS, tex_tile->sl);
83   SST = RELATIVE(SST, tex_tile->tl);
10584   sss2 = RELATIVE(sss2, tex_tile->sl);
10685   sst2 = RELATIVE(sst2, tex_tile->tl);
10786
108   SFRAC = sss1 & 0x1f;
109   TFRAC = sst1 & 0x1f;
87   SFRAC = SSS & 0x1f;
88   TFRAC = SST & 0x1f;
11089
111   CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
90   CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
11291   CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
11392
114   MASK(&sss1, &sst1, tex_tile);
93   MASK(&SSS, &SST, tex_tile);
11594   MASK(&sss2, &sst2, tex_tile);
11695
117   upper = ((SFRAC + TFRAC) >= 0x20);
118   if (upper)
119   {
120      INVSF = 0x20 - SFRAC;
121      INVTF = 0x20 - TFRAC;
122   }
12396
124   FETCH_TEXEL(&t0, sss1, sst1, tex_tile);
125   FETCH_TEXEL(&t1, sss2, sst1, tex_tile);
126   FETCH_TEXEL(&t2, sss1, sst2, tex_tile);
127   FETCH_TEXEL(&t3, sss2, sst2, tex_tile);
97   t0.c = FETCH_TEXEL(SSS, SST);
98   t1.c = FETCH_TEXEL(sss2, SST);
99   t2.c = FETCH_TEXEL(SSS, sst2);
100   t3.c = FETCH_TEXEL(sss2, sst2);
128101
129102   if (SFRAC!= 0x10 || TFRAC != 0x10)
130103   {
131      if (upper)
104      if ((SFRAC + TFRAC) >= 0x20)
132105      {
106         INVSF = 0x20 - SFRAC;
107         INVTF = 0x20 - TFRAC;
133108         R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
134         TEX->i.r = (R32 < 0) ? 0 : R32;
109         TEX.i.r = (R32 < 0) ? 0 : R32;
135110         G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
136         TEX->i.g = (G32 < 0) ? 0 : G32;
111         TEX.i.g = (G32 < 0) ? 0 : G32;
137112         B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
138         TEX->i.b = (B32 < 0) ? 0 : B32;
113         TEX.i.b = (B32 < 0) ? 0 : B32;
139114         A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
140         TEX->i.a = (A32 < 0) ? 0 : A32;
115         TEX.i.a = (A32 < 0) ? 0 : A32;
141116      }
142117      else
143118      {
144119         R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
145         TEX->i.r = (R32 < 0) ? 0 : R32;
120         TEX.i.r = (R32 < 0) ? 0 : R32;
146121         G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
147         TEX->i.g = (G32 < 0) ? 0 : G32;
122         TEX.i.g = (G32 < 0) ? 0 : G32;
148123         B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
149         TEX->i.b = (B32 < 0) ? 0 : B32;
124         TEX.i.b = (B32 < 0) ? 0 : B32;
150125         A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
151         TEX->i.a = (A32 < 0) ? 0 : A32;
126         TEX.i.a = (A32 < 0) ? 0 : A32;
152127      }
153128   }
154129   else // Is this accurate?
155130   {
156      TEX->i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
157      TEX->i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
158      TEX->i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
159      TEX->i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
131      TEX.i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
132      TEX.i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
133      TEX.i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
134      TEX.i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
160135   }
136
137   return TEX.c;
161138}
162139
163INLINE void TEXTURE_PIPELINE_NEAREST_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
140INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
164141{
165#define RELATIVE(x, y)    ((((x) >> 3) - (y)) << 3) | (x & 7);
166142   INT32 maxs, maxt;
167   int sss1, sst1;
168143   INT32 SFRAC, TFRAC;
169144
170   sss1 = SSS;
171   sst1 = SST;
145   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
146   SSS = RELATIVE(SSS, tex_tile->sl);
147   SST = RELATIVE(SST, tex_tile->tl);
172148
173   texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
174   sss1 = RELATIVE(sss1, tex_tile->sl);
175   sst1 = RELATIVE(sst1, tex_tile->tl);
149   SSS += 0x10;
150   SST += 0x10;
176151
177   sss1 += 0x10;
178   sst1 += 0x10;
152   SFRAC = SSS & 0x1f;
153   TFRAC = SST & 0x1f;
179154
180   SFRAC = sss1 & 0x1f;
181   TFRAC = sst1 & 0x1f;
155   CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
182156
183   CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
157   MASK(&SSS, &SST, tex_tile);
184158
185   MASK(&sss1, &sst1, tex_tile);
159   /* point sample */
160   return FETCH_TEXEL(SSS, SST);
161}
186162
163#if 0
164#define RELATIVE(x, y)    (((((x) >> 3) - (y)) << 3) | (x & 7))
165
166INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
167{
168   INT32 maxs, maxt;
169   COLOR t0, t1, t2, t3, TEX;
170   int sss2, sst2;
171
172   INT32 SFRAC = 0;
173   INT32 TFRAC = 0;
174   INT32 INVSF = 0;
175   INT32 INVTF = 0;
176   INT32 R32 = 0;
177   INT32 G32 = 0;
178   INT32 B32 = 0;
179   INT32 A32 = 0;
180
181   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
182
183   SSS = RELATIVE(SSS, tex_tile->sl);
184   SST = RELATIVE(SST, tex_tile->tl);
185   sss2 = RELATIVE((SSS + 32), tex_tile->sl);
186   sst2 = RELATIVE((SST + 32), tex_tile->tl);
187
188   SFRAC = SSS & 0x1f;
189   TFRAC = SST & 0x1f;
190
191   CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
192   CLAMP_LIGHT(&sss2, &sst2, ((sss2 >> 3) >= tex_tile->sh), ((sst2 >> 3) >= tex_tile->th), tex_tile);
193
194   MASK(&SSS, &SST, tex_tile);
195   MASK(&sss2, &sst2, tex_tile);
196
197   t1.c = FETCH_TEXEL(sss2, SST);
198   t2.c = FETCH_TEXEL(SSS, sst2);
199
200   if ((SFRAC + TFRAC) >= 0x20)
201   {
202      INVSF = 0x20 - SFRAC;
203      INVTF = 0x20 - TFRAC;
204      t3.c = FETCH_TEXEL(sss2, sst2);
205      R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
206      TEX.i.r = (R32 < 0) ? 0 : R32;
207      G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
208      TEX.i.g = (G32 < 0) ? 0 : G32;
209      B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
210      TEX.i.b = (B32 < 0) ? 0 : B32;
211      A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
212      TEX.i.a = (A32 < 0) ? 0 : A32;
213   }
214   else
215   {
216      t0.c = FETCH_TEXEL(SSS, SST);
217      R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
218      TEX.i.r = (R32 < 0) ? 0 : R32;
219      G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
220      TEX.i.g = (G32 < 0) ? 0 : G32;
221      B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
222      TEX.i.b = (B32 < 0) ? 0 : B32;
223      A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
224      TEX.i.a = (A32 < 0) ? 0 : A32;
225   }
226
227   return TEX.c;
228}
229
230INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile)
231{
232   INT32 maxs, maxt;
233   COLOR t0, t1, t2, t3, TEX;
234   int sss2, sst2;
235
236   INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
237   INT32 R32, G32, B32, A32;
238   INT32 maxs2, maxt2;
239
240   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
241
242   sss2 = SSS + 32; sst2 = SST + 32;
243   maxs2 = ((sss2 >> 3) >= tex_tile->sh);
244   maxt2 = ((sst2 >> 3) >= tex_tile->th);
245
246   SSS = RELATIVE(SSS, tex_tile->sl);
247   SST = RELATIVE(SST, tex_tile->tl);
248   sss2 = RELATIVE(sss2, tex_tile->sl);
249   sst2 = RELATIVE(sst2, tex_tile->tl);
250
251   SFRAC = SSS & 0x1f;
252   TFRAC = SST & 0x1f;
253
254   CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
255   CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
256
257   MASK(&SSS, &SST, tex_tile);
258   MASK(&sss2, &sst2, tex_tile);
259
260   t0.c = FETCH_TEXEL(SSS, SST);
261   t1.c = FETCH_TEXEL(sss2, SST);
262   t2.c = FETCH_TEXEL(SSS, sst2);
263   t3.c = FETCH_TEXEL(sss2, sst2);
264
265   if(SFRAC != 0x10 || TFRAC != 0x10)
266   {
267      if (((SFRAC + TFRAC) >= 0x20))
268      {
269         INVSF = 0x20 - SFRAC;
270         INVTF = 0x20 - TFRAC;
271         R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
272         TEX.i.r = (R32 < 0) ? 0 : R32;
273         G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
274         TEX.i.g = (G32 < 0) ? 0 : G32;
275         B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
276         TEX.i.b = (B32 < 0) ? 0 : B32;
277         A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
278         TEX.i.a = (A32 < 0) ? 0 : A32;
279      }
280      else
281      {
282         R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
283         TEX.i.r = (R32 < 0) ? 0 : R32;
284         G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
285         TEX.i.g = (G32 < 0) ? 0 : G32;
286         B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
287         TEX.i.b = (B32 < 0) ? 0 : B32;
288         A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
289         TEX.i.a = (A32 < 0) ? 0 : A32;
290      }
291   }
292   else // Is this accurate?
293   {
294      TEX.i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
295      TEX.i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
296      TEX.i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
297      TEX.i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
298   }
299
300   return TEX.c;
301}
302
303INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
304{
305   INT32 maxs, maxt;
306
307   texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
308   SSS = RELATIVE(SSS, tex_tile->sl) + 0x10;
309   SST = RELATIVE(SST, tex_tile->tl) + 0x10;
310
311   CLAMP_QUICK(&SSS, &SST, maxs, maxt, tex_tile->num);
312
313   MASK(&SSS, &SST, tex_tile);
314
187315   /* point sample */
188   FETCH_TEXEL(TEX, sss1, sst1, tex_tile);
316   return FETCH_TEXEL(SSS, SST);
189317}
318#endif
src/mame/video/rdptpipe.h
r6795r6796
1INLINE void TEXTURE_PIPELINE_BILINEAR_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
2INLINE void TEXTURE_PIPELINE_BILINEAR_MID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
3INLINE void TEXTURE_PIPELINE_NEAREST_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
1INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
2INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile);
3INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
44
5static void (*rdp_texture_pipeline_func[4])(COLOR*, INT32, INT32, TILE*) =
5static UINT32 (*rdp_texture_pipeline_func[4])(INT32, INT32, TILE*) =
66{
77   TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_NMID, TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_MID,
88};
9#if 0
10INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
11INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile);
12INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
13
14static UINT32 (*rdp_texture_pipeline_func[4])(INT32, INT32, TILE*) =
15{
16   TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_NMID, TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_MID,
17};
18#endif
src/mame/video/rdpmask.c
r0r6796
1#if defined(MASK_S)
2   #if defined(MASK_T)
3      INLINE void MASK_S_T(INT32* S, INT32* T, TILE* tex_tile)
4   #else
5      INLINE void MASK_S_NT(INT32* S, INT32* T, TILE* tex_tile)
6   #endif
7#else
8   #if defined(MASK_T)
9      INLINE void MASK_NS_T(INT32* S, INT32* T, TILE* tex_tile)
10   #else
11      INLINE void MASK_NS_NT(INT32* S, INT32* T, TILE* tex_tile)
12   #endif
13#endif
14{
15#if defined(MASK_S)
16   INT32 swrap;
17#endif
18#if defined(MASK_T)
19   INT32 twrap;
20#endif
21
22#if defined(MASK_S)
23   swrap = *S >> tex_tile->mask_s;
24   swrap &= 1;
25   if (tex_tile->ms && swrap)
26   {
27      *S = (~(*S)) & maskbits_table[tex_tile->mask_s]; // Mirroring and masking
28   }
29   else
30   {
31      *S &= maskbits_table[tex_tile->mask_s]; // Masking
32   }
33#endif
34
35#if defined(MASK_T)
36   twrap = *T >> tex_tile->mask_t;
37   twrap &= 1;
38   if (tex_tile->mt && twrap)
39   {
40      *T = (~(*T)) & maskbits_table[tex_tile->mask_t]; // Mirroring and masking
41   }
42   else
43   {
44      *T &= maskbits_table[tex_tile->mask_t];
45   }
46#endif
47}
48
src/mame/video/rdpmask.h
r0r6796
1INLINE void MASK_NS_NT(INT32* S, INT32* T, TILE* tex_tile);
2INLINE void MASK_NS_T(INT32* S, INT32* T, TILE* tex_tile);
3INLINE void MASK_S_NT(INT32* S, INT32* T, TILE* tex_tile);
4INLINE void MASK_S_T(INT32* S, INT32* T, TILE* tex_tile);
5
6static void (*rdp_mask_func[8])(INT32*, INT32*, TILE*) =
7{
8   MASK_NS_NT,   MASK_NS_T,   MASK_S_NT,   MASK_S_T,
9};
src/mame/video/rdpblend.c
r6795r6796
1#if defined(RGBDITHER1)
2   #if defined(ZCOMPARE)
3      #if defined(IMGREAD)
4      INLINE int BLENDER1_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
1#if defined(ALPHACOMPARE)
2   #if defined(RGBDITHER1)
3      #if defined(ZCOMPARE)
4         #if defined(IMGREAD)
5            INLINE int BLENDER1_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
6         #else
7            INLINE int BLENDER1_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
8         #endif
59      #else
6      INLINE int BLENDER1_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
10         #if defined(IMGREAD)
11            INLINE int BLENDER1_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
12         #else
13            INLINE int BLENDER1_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
14         #endif
715      #endif
816   #else
9      #if defined(IMGREAD)
10      INLINE int BLENDER1_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
17      #if defined(ZCOMPARE)
18         #if defined(IMGREAD)
19            INLINE int BLENDER1_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
20         #else
21            INLINE int BLENDER1_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
22         #endif
1123      #else
12      INLINE int BLENDER1_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
24         #if defined(IMGREAD)
25            INLINE int BLENDER1_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
26         #else
27            INLINE int BLENDER1_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
28         #endif
1329      #endif
1430   #endif
1531#else
16   #if defined(ZCOMPARE)
17      #if defined(IMGREAD)
18      INLINE int BLENDER1_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
32   #if defined(RGBDITHER1)
33      #if defined(ZCOMPARE)
34         #if defined(IMGREAD)
35            INLINE int BLENDER1_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
36         #else
37            INLINE int BLENDER1_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
38         #endif
1939      #else
20      INLINE int BLENDER1_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
40         #if defined(IMGREAD)
41            INLINE int BLENDER1_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
42         #else
43            INLINE int BLENDER1_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
44         #endif
2145      #endif
2246   #else
23      #if defined(IMGREAD)
24      INLINE int BLENDER1_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
47      #if defined(ZCOMPARE)
48         #if defined(IMGREAD)
49            INLINE int BLENDER1_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
50         #else
51            INLINE int BLENDER1_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
52         #endif
2553      #else
26      INLINE int BLENDER1_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
54         #if defined(IMGREAD)
55            INLINE int BLENDER1_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
56         #else
57            INLINE int BLENDER1_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
58         #endif
2759      #endif
2860   #endif
2961#endif
r6795r6796
3567   UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
3668#endif
3769
70#if defined(ALPHACOMPARE)
3871   // Alpha compare
3972   if (!alpha_compare(c.i.a))
4073   {
4174      return 0;
4275   }
76#endif
4377
4478   if (!curpixel_cvg) // New coverage is zero, so abort
4579   {
r6795r6796
5791   curpixel_overlap = 0;
5892#endif
5993
60   memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13);
61   memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >>  8) & 0x07);
62   memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >>  3) & 0x07);
94   memory_color.c = rgb16_to_32_lut[mem];
6395
6496#if defined(IMGREAD)
6597   memory_color.i.a = (memory_cvg << 5) & 0xe0;
r6795r6796
6799   memory_color.i.a = 0xe0;
68100#endif
69101
102#if defined(ZCOMPARE)
70103   if (!curpixel_overlap && !other_modes.force_blend)
71104   {
72105      r = *blender1a_r[0];
r6795r6796
79112
80113      BLENDER_EQUATION0(&r, &g, &b, special_bsel);
81114   }
115#else
116   if (!other_modes.force_blend)
117   {
118      r = *blender1a_r[0];
119      g = *blender1a_g[0];
120      b = *blender1a_b[0];
121   }
122   else
123   {
124      inv_pixel_color.i.a = 0xff - *blender1b_a[0];
82125
126      BLENDER_EQUATION0(&r, &g, &b, special_bsel);
127   }
128#endif
129
83130#if !defined(RGBDITHER1)
84131   // Hack to prevent "double-dithering" artifacts
85132   if (!(((r & 0xf8)==(memory_color.i.r&0xf8) && (g & 0xf8) == (memory_color.i.g & 0xf8) &&(b&0xf8)==(memory_color.i.b&0xf8))))
r6795r6796
91138    return (FBWRITE_16(fb, hb, r, g, b));
92139}
93140
94#if defined(RGBDITHER1)
95   #if defined(ZCOMPARE)
96      #if defined(IMGREAD)
97      INLINE int BLENDER2_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
141#if defined(ALPHACOMPARE)
142   #if defined(RGBDITHER1)
143      #if defined(ZCOMPARE)
144         #if defined(IMGREAD)
145            INLINE int BLENDER2_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
146         #else
147            INLINE int BLENDER2_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
148         #endif
98149      #else
99      INLINE int BLENDER2_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
150         #if defined(IMGREAD)
151            INLINE int BLENDER2_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
152         #else
153            INLINE int BLENDER2_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
154         #endif
100155      #endif
101156   #else
102      #if defined(IMGREAD)
103      INLINE int BLENDER2_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
157      #if defined(ZCOMPARE)
158         #if defined(IMGREAD)
159            INLINE int BLENDER2_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
160         #else
161            INLINE int BLENDER2_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
162         #endif
104163      #else
105      INLINE int BLENDER2_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
164         #if defined(IMGREAD)
165            INLINE int BLENDER2_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
166         #else
167            INLINE int BLENDER2_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
168         #endif
106169      #endif
107170   #endif
108171#else
109   #if defined(ZCOMPARE)
110      #if defined(IMGREAD)
111      INLINE int BLENDER2_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
172   #if defined(RGBDITHER1)
173      #if defined(ZCOMPARE)
174         #if defined(IMGREAD)
175            INLINE int BLENDER2_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
176         #else
177            INLINE int BLENDER2_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
178         #endif
112179      #else
113      INLINE int BLENDER2_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
180         #if defined(IMGREAD)
181            INLINE int BLENDER2_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
182         #else
183            INLINE int BLENDER2_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
184         #endif
114185      #endif
115186   #else
116      #if defined(IMGREAD)
117      INLINE int BLENDER2_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
187      #if defined(ZCOMPARE)
188         #if defined(IMGREAD)
189            INLINE int BLENDER2_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
190         #else
191            INLINE int BLENDER2_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
192         #endif
118193      #else
119      INLINE int BLENDER2_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
194         #if defined(IMGREAD)
195            INLINE int BLENDER2_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
196         #else
197            INLINE int BLENDER2_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
198         #endif
120199      #endif
121200   #endif
122201#endif
r6795r6796
128207   UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
129208#endif
130209
210#if defined(ALPHACOMPARE)
131211   // Alpha compare
132212   if (!alpha_compare(c2.i.a))
133213   {
134214      return 0;
135215   }
216#endif
217
136218   if (!curpixel_cvg)
137219   {
138220      return 0;
r6795r6796
149231   curpixel_overlap = 0;
150232#endif
151233
152   memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13);
153   memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >>  8) & 0x07);
154   memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >>  3) & 0x07);
234   memory_color.c = rgb16_to_32_lut[mem];
155235
156236#if defined(IMGREAD)
157237   memory_color.i.a = (memory_cvg << 5) & 0xe0;
r6795r6796
204284
205285   return (FBWRITE_16(fb, hb, r, g, b));
206286}
287
288#if !defined(RGBDITHER1)
289#if defined(ALPHACOMPARE)
290   #if defined(ZCOMPARE)
291      #if defined(IMGREAD)
292         INLINE int BLENDER1_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
293      #else
294         INLINE int BLENDER1_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
295      #endif
296   #else
297      #if defined(IMGREAD)
298         INLINE int BLENDER1_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
299      #else
300         INLINE int BLENDER1_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
301      #endif
302   #endif
303#else
304   #if defined(ZCOMPARE)
305      #if defined(IMGREAD)
306         INLINE int BLENDER1_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
307      #else
308         INLINE int BLENDER1_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
309      #endif
310   #else
311      #if defined(IMGREAD)
312         INLINE int BLENDER1_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
313      #else
314         INLINE int BLENDER1_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
315      #endif
316   #endif
317#endif
318{
319   int r, g, b;
320   int special_bsel = 0;
321   UINT16 mem = *fb;
322#if defined(IMGREAD)
323   UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
324#endif
325
326#if defined(ALPHACOMPARE)
327   // Alpha compare
328   if (!alpha_compare(c.i.a))
329   {
330      return 0;
331   }
332#endif
333
334   if (!curpixel_cvg) // New coverage is zero, so abort
335   {
336      return 0;
337   }
338
339   if (blender2b_a[0] == &memory_color.i.a)
340   {
341      special_bsel = 1;
342   }
343
344   pixel_color.c = c.c;
345
346#if !defined(ZCOMPARE)
347   curpixel_overlap = 0;
348#endif
349
350   memory_color.c = rgb16_to_32_lut[mem];
351
352#if defined(IMGREAD)
353   memory_color.i.a = (memory_cvg << 5) & 0xe0;
354#else
355   memory_color.i.a = 0xe0;
356#endif
357
358#if defined(ZCOMPARE)
359   if (!curpixel_overlap && !other_modes.force_blend)
360   {
361      r = *blender1a_r[0];
362      g = *blender1a_g[0];
363      b = *blender1a_b[0];
364   }
365   else
366   {
367      inv_pixel_color.i.a = 0xff - *blender1b_a[0];
368
369      BLENDER_EQUATION0(&r, &g, &b, special_bsel);
370   }
371#else
372   if (!other_modes.force_blend)
373   {
374      r = *blender1a_r[0];
375      g = *blender1a_g[0];
376      b = *blender1a_b[0];
377   }
378   else
379   {
380      inv_pixel_color.i.a = 0xff - *blender1b_a[0];
381
382      BLENDER_EQUATION0(&r, &g, &b, special_bsel);
383   }
384#endif
385
386    return (FBWRITE_16(fb, hb, r, g, b));
387}
388
389#if defined(ALPHACOMPARE)
390   #if defined(ZCOMPARE)
391      #if defined(IMGREAD)
392         INLINE int BLENDER2_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
393      #else
394         INLINE int BLENDER2_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
395      #endif
396   #else
397      #if defined(IMGREAD)
398         INLINE int BLENDER2_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
399      #else
400         INLINE int BLENDER2_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
401      #endif
402   #endif
403#else
404   #if defined(ZCOMPARE)
405      #if defined(IMGREAD)
406         INLINE int BLENDER2_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
407      #else
408         INLINE int BLENDER2_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
409      #endif
410   #else
411      #if defined(IMGREAD)
412         INLINE int BLENDER2_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
413      #else
414         INLINE int BLENDER2_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
415      #endif
416   #endif
417#endif
418{
419   int r, g, b;
420   int special_bsel = 0;
421   UINT16 mem = *fb;
422#if defined(IMGREAD)
423   UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
424#endif
425
426#if defined(ALPHACOMPARE)
427   // Alpha compare
428   if (!alpha_compare(c2.i.a))
429   {
430      return 0;
431   }
432#endif
433
434   if (!curpixel_cvg)
435   {
436      return 0;
437   }
438
439   if (blender2b_a[0] == &memory_color.i.a)
440   {
441      special_bsel = 1;
442   }
443
444   pixel_color.c = c2.c;
445
446#if !defined(ZCOMPARE)
447   curpixel_overlap = 0;
448#endif
449
450   memory_color.c = rgb16_to_32_lut[mem];
451
452#if defined(IMGREAD)
453   memory_color.i.a = (memory_cvg << 5) & 0xe0;
454#else
455   memory_color.i.a = 0xe0;
456#endif
457
458   inv_pixel_color.i.a = 0xff - *blender1b_a[0];
459
460   BLENDER_EQUATION0(&r, &g, &b, special_bsel);
461
462   blended_pixel_color.i.r = r;
463   blended_pixel_color.i.g = g;
464   blended_pixel_color.i.b = b;
465   blended_pixel_color.i.a = pixel_color.i.a;
466
467   pixel_color.i.r = r;
468   pixel_color.i.g = g;
469   pixel_color.i.b = b;
470
471   inv_pixel_color.i.a = 0xff - *blender1b_a[1];
472
473   if (!curpixel_overlap && !other_modes.force_blend)
474   {
475      r = *blender1a_r[1];
476      g = *blender1a_g[1];
477      b = *blender1a_b[1];
478   }
479   else
480   {
481      if (blender2b_a[1] == &memory_color.i.a)
482      {
483         special_bsel = 1;
484      }
485      else
486      {
487         special_bsel = 0;
488      }
489
490      BLENDER_EQUATION1(&r, &g, &b, special_bsel);
491   }
492
493   return (FBWRITE_16(fb, hb, r, g, b));
494}
495#endif
src/mame/video/rdpblend.h
r6795r6796
1INLINE int BLENDER1_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
2INLINE int BLENDER1_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
3INLINE int BLENDER1_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
4INLINE int BLENDER1_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
5INLINE int BLENDER1_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
6INLINE int BLENDER1_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
7INLINE int BLENDER1_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
8INLINE int BLENDER1_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
1INLINE int BLENDER1_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
2INLINE int BLENDER1_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
3INLINE int BLENDER1_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
4INLINE int BLENDER1_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
5INLINE int BLENDER1_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
6INLINE int BLENDER1_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
7INLINE int BLENDER1_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
8INLINE int BLENDER1_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
99
10INLINE int BLENDER2_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
11INLINE int BLENDER2_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
12INLINE int BLENDER2_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
13INLINE int BLENDER2_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
14INLINE int BLENDER2_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
15INLINE int BLENDER2_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
16INLINE int BLENDER2_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
17INLINE int BLENDER2_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
10INLINE int BLENDER2_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
11INLINE int BLENDER2_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
12INLINE int BLENDER2_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
13INLINE int BLENDER2_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
14INLINE int BLENDER2_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
15INLINE int BLENDER2_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
16INLINE int BLENDER2_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
17INLINE int BLENDER2_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
1818
19static int (*rdp_blender1_16_func[8])(UINT16 *, UINT8 *, COLOR, int) =
19INLINE int BLENDER1_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
20INLINE int BLENDER1_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
21INLINE int BLENDER1_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
22INLINE int BLENDER1_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
23INLINE int BLENDER1_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
24INLINE int BLENDER1_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
25INLINE int BLENDER1_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
26INLINE int BLENDER1_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
27
28INLINE int BLENDER2_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
29INLINE int BLENDER2_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
30INLINE int BLENDER2_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
31INLINE int BLENDER2_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
32INLINE int BLENDER2_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
33INLINE int BLENDER2_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
34INLINE int BLENDER2_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
35INLINE int BLENDER2_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
36
37INLINE int BLENDER1_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
38INLINE int BLENDER1_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
39INLINE int BLENDER1_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
40INLINE int BLENDER1_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
41
42INLINE int BLENDER2_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
43INLINE int BLENDER2_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
44INLINE int BLENDER2_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
45INLINE int BLENDER2_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
46
47INLINE int BLENDER1_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
48INLINE int BLENDER1_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
49INLINE int BLENDER1_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
50INLINE int BLENDER1_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
51
52INLINE int BLENDER2_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
53INLINE int BLENDER2_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
54INLINE int BLENDER2_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
55INLINE int BLENDER2_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
56
57static int (*rdp_blender1_16_dith_func[16])(UINT16 *, UINT8 *, COLOR, int) =
2058{
21   BLENDER1_16_NIMR_NZC_NDITH,   BLENDER1_16_NIMR_ZC_NDITH,
22   BLENDER1_16_NIMR_ZC_NDITH,    BLENDER1_16_NIMR_ZC_DITH,
23   BLENDER1_16_IMR_NZC_NDITH,    BLENDER1_16_IMR_NZC_DITH,
24   BLENDER1_16_IMR_ZC_NDITH,    BLENDER1_16_IMR_ZC_DITH,
59   BLENDER1_16_NIMR_NZC_NDITH_NAC,   BLENDER1_16_NIMR_NZC_NDITH_AC,   BLENDER1_16_NIMR_NZC_DITH_NAC,   BLENDER1_16_NIMR_NZC_DITH_AC,
60   BLENDER1_16_NIMR_ZC_NDITH_NAC,    BLENDER1_16_NIMR_ZC_NDITH_AC,    BLENDER1_16_NIMR_ZC_DITH_NAC,   BLENDER1_16_NIMR_ZC_DITH_AC,
61   BLENDER1_16_IMR_NZC_NDITH_NAC,    BLENDER1_16_IMR_NZC_NDITH_AC,    BLENDER1_16_IMR_NZC_DITH_NAC,   BLENDER1_16_IMR_NZC_DITH_AC,
62   BLENDER1_16_IMR_ZC_NDITH_NAC,    BLENDER1_16_IMR_ZC_NDITH_AC,    BLENDER1_16_IMR_ZC_DITH_NAC,   BLENDER1_16_IMR_ZC_DITH_AC,
2563};
2664
27static int (*rdp_blender2_16_func[8])(UINT16 *, UINT8 *, COLOR, COLOR, int) =
65static int (*rdp_blender2_16_dith_func[16])(UINT16 *, UINT8 *, COLOR, COLOR, int) =
2866{
29   BLENDER2_16_NIMR_NZC_NDITH,   BLENDER2_16_NIMR_NZC_DITH,
30   BLENDER2_16_NIMR_ZC_NDITH,    BLENDER2_16_NIMR_ZC_DITH,
31   BLENDER2_16_IMR_NZC_NDITH,    BLENDER2_16_IMR_NZC_DITH,
32   BLENDER2_16_IMR_ZC_NDITH,    BLENDER2_16_IMR_ZC_DITH,
67   BLENDER2_16_NIMR_NZC_NDITH_NAC,   BLENDER2_16_NIMR_NZC_NDITH_AC,   BLENDER2_16_NIMR_NZC_DITH_NAC,   BLENDER2_16_NIMR_NZC_DITH_AC,
68   BLENDER2_16_NIMR_ZC_NDITH_NAC,    BLENDER2_16_NIMR_ZC_NDITH_AC,    BLENDER2_16_NIMR_ZC_DITH_NAC,   BLENDER2_16_NIMR_ZC_DITH_AC,
69   BLENDER2_16_IMR_NZC_NDITH_NAC,    BLENDER2_16_IMR_NZC_NDITH_AC,    BLENDER2_16_IMR_NZC_DITH_NAC,   BLENDER2_16_IMR_NZC_DITH_AC,
70   BLENDER2_16_IMR_ZC_NDITH_NAC,    BLENDER2_16_IMR_ZC_NDITH_AC,    BLENDER2_16_IMR_ZC_DITH_NAC,   BLENDER2_16_IMR_ZC_DITH_AC,
3371};
72
73static int (*rdp_blender1_16_ndith_func[16])(UINT16 *, UINT8 *, COLOR) =
74{
75   BLENDER1_16_NIMR_NZC_NAC_ND,   BLENDER1_16_NIMR_NZC_AC_ND,
76   BLENDER1_16_NIMR_ZC_NAC_ND,    BLENDER1_16_NIMR_ZC_AC_ND,
77   BLENDER1_16_IMR_NZC_NAC_ND,    BLENDER1_16_IMR_NZC_AC_ND,
78   BLENDER1_16_IMR_ZC_NAC_ND,       BLENDER1_16_IMR_ZC_AC_ND,
79};
80
81static int (*rdp_blender2_16_ndith_func[16])(UINT16 *, UINT8 *, COLOR, COLOR) =
82{
83   BLENDER2_16_NIMR_NZC_NAC_ND,   BLENDER2_16_NIMR_NZC_AC_ND,
84   BLENDER2_16_NIMR_ZC_NAC_ND,    BLENDER2_16_NIMR_ZC_AC_ND,
85   BLENDER2_16_IMR_NZC_NAC_ND,    BLENDER2_16_IMR_NZC_AC_ND,
86   BLENDER2_16_IMR_ZC_NAC_ND,       BLENDER2_16_IMR_ZC_AC_ND,
87};
src/mame/video/rdpzcomp.c
r0r6796
1#if defined(ZMODE0)
2   #if defined(ANTIALIAS)
3      #if defined(IMGREAD)
4         INLINE UINT32 z_compare_IMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
5      #else
6         INLINE UINT32 z_compare_NIMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
7      #endif
8   #else
9      #if defined(IMGREAD)
10         INLINE UINT32 z_compare_IMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
11      #else
12         INLINE UINT32 z_compare_NIMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
13      #endif
14   #endif
15#elif defined(ZMODE1)
16   #if defined(ANTIALIAS)
17      #if defined(IMGREAD)
18         INLINE UINT32 z_compare_IMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
19      #else
20         INLINE UINT32 z_compare_NIMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
21      #endif
22   #else
23      #if defined(IMGREAD)
24         INLINE UINT32 z_compare_IMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
25      #else
26         INLINE UINT32 z_compare_NIMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
27      #endif
28   #endif
29#elif defined(ZMODE2)
30   #if defined(ANTIALIAS)
31      #if defined(IMGREAD)
32         INLINE UINT32 z_compare_IMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
33      #else
34         INLINE UINT32 z_compare_NIMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
35      #endif
36   #else
37      #if defined(IMGREAD)
38         INLINE UINT32 z_compare_IMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
39      #else
40         INLINE UINT32 z_compare_NIMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
41      #endif
42   #endif
43#elif defined(ZMODE3)
44   #if defined(ANTIALIAS)
45      #if defined(IMGREAD)
46         INLINE UINT32 z_compare_IMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
47      #else
48         INLINE UINT32 z_compare_NIMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
49      #endif
50   #else
51      #if defined(IMGREAD)
52         INLINE UINT32 z_compare_IMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
53      #else
54         INLINE UINT32 z_compare_NIMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
55      #endif
56   #endif
57#endif
58{
59   int force_coplanar = 0;
60   UINT32 oz = z_decompress(zb);
61   UINT32 dzmem = dz_decompress(zb, zhb);
62   UINT32 dznew = 0;
63   UINT32 farther = 0;
64   UINT32 diff = 0;
65   UINT32 nearer = 0;
66   UINT32 infront = 0;
67   UINT32 max = 0;
68   int precision_factor = (oz >> 15) & 0xf;
69   int overflow = 0;
70#if defined(ZMODE1)
71   int cvgcoeff = 0;
72#endif
73   UINT32 mempixel, memory_cvg;
74
75   sz &= 0x3ffff;
76   if (dzmem == 0x8000 && precision_factor < 3)
77   {
78      force_coplanar = 1;
79   }
80   if (!precision_factor)
81   {
82      dzmem = ((dzmem << 1) > 16) ? (dzmem << 1) : 16;
83   }
84   else if (precision_factor == 1)
85   {
86      dzmem = ((dzmem << 1) > 8) ? (dzmem << 1) : 8;
87   }
88   else if (precision_factor == 2)
89   {
90      dzmem = ((dzmem << 1) > 4) ? (dzmem << 1) : 4;
91   }
92   if (dzmem == 0 && precision_factor < 3)
93   {
94      dzmem = 0xffff;
95   }
96   if (dzmem > 0x8000)
97   {
98      dzmem = 0xffff;
99   }
100   dznew =((dzmem > dzpix) ? dzmem : (UINT32)dzpix) << 3;
101   dznew &= 0x3ffff;
102
103   farther = ((sz + dznew) >= oz) ? 1 : 0;
104   diff = (sz >= dznew) ? (sz - dznew) : 0;
105   nearer = (diff <= oz) ? 1: 0;
106   infront = (sz < oz) ? 1 : 0;
107   max = (dzmem == 0x3ffff);
108
109   if (force_coplanar)
110   {
111      farther = nearer = 1;
112   }
113
114   curpixel_overlap = 0;
115
116   switch(fb_size)
117   {
118      case 1: /* Banjo Tooie */
119         memory_cvg = 0; //??
120         break;
121      case 2:
122         mempixel = *(UINT16*)fb;
123         memory_cvg = ((mempixel & 1) << 2) + (*hb & 3);
124         break;
125      case 3:
126         mempixel = *(UINT32*)fb;
127         memory_cvg = (mempixel >> 5) & 7;
128         break;
129      default:
130         fatalerror("z_compare: fb_size = %d",fb_size);
131         break;
132   }
133
134#if !defined(IMGREAD)
135   memory_cvg = 7;
136#endif
137
138   overflow = ((memory_cvg + curpixel_cvg - 1) > 7) ? 1 : 0;
139
140#if defined(ANTIALIAS)
141   curpixel_overlap = (other_modes.force_blend || (!overflow && farther));
142#else
143   curpixel_overlap = other_modes.force_blend;
144#endif
145
146#if defined(ZMODE1)
147   if (infront && farther && overflow)
148   {
149      cvgcoeff = ((dzmem >> dznew) - (sz >> dznew)) & 0xf;
150      curpixel_cvg = ((cvgcoeff * (curpixel_cvg - 1)) >> 3) & 0xf;
151   }
152#endif
153   if (curpixel_cvg > 8)
154      curpixel_cvg = 8;
155
156#if defined(ZMODE0)
157   return (max || (overflow ? infront : nearer))? 1 : 0;
158#elif defined(ZMODE1)
159   return (max || (overflow ? infront : nearer))? 1 : 0;
160#elif defined(ZMODE2)
161   return infront | max;
162#elif defined(ZMODE3)
163   return farther & nearer & !max;
164#else
165   return 0;
166#endif
167}
168
src/mame/video/rdpzcomp.h
r0r6796
1INLINE UINT32 z_compare_IMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
2INLINE UINT32 z_compare_NIMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
3INLINE UINT32 z_compare_IMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
4INLINE UINT32 z_compare_NIMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
5INLINE UINT32 z_compare_IMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
6INLINE UINT32 z_compare_NIMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
7INLINE UINT32 z_compare_IMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
8INLINE UINT32 z_compare_NIMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
9INLINE UINT32 z_compare_IMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
10INLINE UINT32 z_compare_NIMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
11INLINE UINT32 z_compare_IMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
12INLINE UINT32 z_compare_NIMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
13INLINE UINT32 z_compare_IMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
14INLINE UINT32 z_compare_NIMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
15INLINE UINT32 z_compare_IMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
16INLINE UINT32 z_compare_NIMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
17
18static UINT32 (*rdp_z_compare_func[16])(void*, UINT8*, UINT16*, UINT8*, UINT32, UINT16) =
19{
20   z_compare_IMR_AA_Z0,   z_compare_NIMR_AA_Z0,    z_compare_IMR_NAA_Z0,    z_compare_NIMR_NAA_Z0,
21   z_compare_IMR_AA_Z1,   z_compare_NIMR_AA_Z1,    z_compare_IMR_NAA_Z1,    z_compare_NIMR_NAA_Z1,
22   z_compare_IMR_AA_Z2,   z_compare_NIMR_AA_Z2,    z_compare_IMR_NAA_Z2,    z_compare_NIMR_NAA_Z2,
23   z_compare_IMR_AA_Z3,   z_compare_NIMR_AA_Z3,    z_compare_IMR_NAA_Z3,    z_compare_NIMR_NAA_Z3
24};
src/mame/video/rdpcc.c
r0r6796
1#if defined(NOISE)
2   INLINE UINT32 COLOR_COMBINER1_NOISE(void)
3#else
4   INLINE UINT32 COLOR_COMBINER1_NNOISE(void)
5#endif
6{
7   COLOR c;
8#if defined(NOISE)
9   noise_color.i.r = rdp_rand();
10   noise_color.i.g = rdp_rand();
11   noise_color.i.b = rdp_rand();
12#endif
13
14   c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]);
15   c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]);
16   c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]);
17   c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]);
18
19   //Alpha coverage combiner
20   alpha_cvg_get(&c.i.a);
21
22   return c.c;
23}
24
25#if defined(NOISE)
26   INLINE UINT32 COLOR_COMBINER2_C0_NOISE(void)
27#else
28   INLINE UINT32 COLOR_COMBINER2_C0_NNOISE(void)
29#endif
30{
31   COLOR c;
32#if defined(NOISE)
33   noise_color.i.r = rdp_rand();
34   noise_color.i.g = rdp_rand();
35   noise_color.i.b = rdp_rand();
36#endif
37
38   c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[0],*combiner_rgbsub_b_r[0],*combiner_rgbmul_r[0],*combiner_rgbadd_r[0]);
39   c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[0],*combiner_rgbsub_b_g[0],*combiner_rgbmul_g[0],*combiner_rgbadd_g[0]);
40   c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[0],*combiner_rgbsub_b_b[0],*combiner_rgbmul_b[0],*combiner_rgbadd_b[0]);
41   c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[0],*combiner_alphasub_b[0],*combiner_alphamul[0],*combiner_alphaadd[0]);
42   //COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[0],combiner_rgbsub_b_r[0],combiner_rgbmul_r[0],combiner_rgbadd_r[0]);
43   //COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[0],combiner_rgbsub_b_g[0],combiner_rgbmul_g[0],combiner_rgbadd_g[0]);
44   //COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[0],combiner_rgbsub_b_b[0],combiner_rgbmul_b[0],combiner_rgbadd_b[0]);
45   //COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[0],combiner_alphasub_b[0],combiner_alphamul[0],combiner_alphaadd[0]);
46
47   combined_color.c = c.c;
48
49   return c.c;
50}
51
52#if defined(NOISE)
53   INLINE UINT32 COLOR_COMBINER2_C1_NOISE(void)
54#else
55   INLINE UINT32 COLOR_COMBINER2_C1_NNOISE(void)
56#endif
57{
58   COLOR c;
59   c.c = texel0_color.c;
60   texel0_color.c = texel1_color.c;
61   texel1_color.c = c.c;
62
63#if defined(NOISE)
64   noise_color.i.r = rdp_rand();
65   noise_color.i.g = rdp_rand();
66   noise_color.i.b = rdp_rand();
67#endif
68
69   c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]);
70   c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]);
71   c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]);
72   c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]);
73   //COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
74   //COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
75   //COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
76   //COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
77
78   alpha_cvg_get(&c.i.a);
79
80   return c.c;
81}
src/mame/video/rdpcc.h
r0r6796
1INLINE UINT32 COLOR_COMBINER1_NNOISE(void);
2INLINE UINT32 COLOR_COMBINER2_C0_NNOISE(void);
3INLINE UINT32 COLOR_COMBINER2_C1_NNOISE(void);
4INLINE UINT32 COLOR_COMBINER1_NOISE(void);
5INLINE UINT32 COLOR_COMBINER2_C0_NOISE(void);
6INLINE UINT32 COLOR_COMBINER2_C1_NOISE(void);
src/mame/video/rdpspn16.c
r6795r6796
1#if defined(SHADE)
2   #if defined(TEXTURE)
3      #if defined(ZBUF)
4         #if defined(FLIP)
5            #if defined(ZUPDATE)
6               #if defined(ZCOMPARE)
7                  static void render_spans_16_c1_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
1#if defined(MAGICDITHER)
2   #if defined(SHADE)
3      #if defined(TEXTURE)
4         #if defined(ZBUF)
5            #if defined(FLIP)
6               #if defined(ZUPDATE)
7                  #if defined(ZCOMPARE)
8                     static void render_spans_16_c1_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
9                  #else
10                     static void render_spans_16_c1_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
11                  #endif
812               #else
9                  static void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
13                  #if defined(ZCOMPARE)
14                     static void render_spans_16_c1_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
15                  #else
16                     static void render_spans_16_c1_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
17                  #endif
1018               #endif
1119            #else
12               #if defined(ZCOMPARE)
13                  static void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile)
20               #if defined(ZUPDATE)
21                  #if defined(ZCOMPARE)
22                     static void render_spans_16_c1_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
23                  #else
24                     static void render_spans_16_c1_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
25                  #endif
1426               #else
15                  static void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile)
27                  #if defined(ZCOMPARE)
28                     static void render_spans_16_c1_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
29                  #else
30                     static void render_spans_16_c1_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
31                  #endif
1632               #endif
1733            #endif
1834         #else
19            #if defined(ZUPDATE)
20               #if defined(ZCOMPARE)
21                  static void render_spans_16_c1_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
35            #if defined(FLIP)
36               #if defined(ZUPDATE)
37                  #if defined(ZCOMPARE)
38                     static void render_spans_16_c1_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
39                  #else
40                     static void render_spans_16_c1_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
41                  #endif
2242               #else
23                  static void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
43                  #if defined(ZCOMPARE)
44                     static void render_spans_16_c1_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
45                  #else
46                     static void render_spans_16_c1_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
47                  #endif
2448               #endif
2549            #else
26               #if defined(ZCOMPARE)
27                  static void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile)
50               #if defined(ZUPDATE)
51                  #if defined(ZCOMPARE)
52                     static void render_spans_16_c1_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
53                  #else
54                     static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
55                  #endif
2856               #else
29                  static void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile)
57                  #if defined(ZCOMPARE)
58                     static void render_spans_16_c1_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
59                  #else
60                     static void render_spans_16_c1_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
61                  #endif
3062               #endif
3163            #endif
3264         #endif
3365      #else
34         #if defined(FLIP)
35            #if defined(ZUPDATE)
36               #if defined(ZCOMPARE)
37                  static void render_spans_16_c1_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
66         #if defined(ZBUF)
67            #if defined(FLIP)
68               #if defined(ZUPDATE)
69                  #if defined(ZCOMPARE)
70                     static void render_spans_16_c1_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
71                  #else
72                     static void render_spans_16_c1_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
73                  #endif
3874               #else
39                  static void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
75                  #if defined(ZCOMPARE)
76                     static void render_spans_16_c1_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
77                  #else
78                     static void render_spans_16_c1_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
79                  #endif
4080               #endif
4181            #else
42               #if defined(ZCOMPARE)
43                  static void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile)
82               #if defined(ZUPDATE)
83                  #if defined(ZCOMPARE)
84                     static void render_spans_16_c1_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
85                  #else
86                     static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
87                  #endif
4488               #else
45                  static void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile)
89                  #if defined(ZCOMPARE)
90                     static void render_spans_16_c1_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
91                  #else
92                     static void render_spans_16_c1_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
93                  #endif
4694               #endif
4795            #endif
4896         #else
49            #if defined(ZUPDATE)
50               #if defined(ZCOMPARE)
51                  static void render_spans_16_c1_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
97            #if defined(FLIP)
98               #if defined(ZUPDATE)
99                  #if defined(ZCOMPARE)
100                     static void render_spans_16_c1_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
101                  #else
102                     static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
103                  #endif
52104               #else
53                  static void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
105                  #if defined(ZCOMPARE)
106                     static void render_spans_16_c1_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
107                  #else
108                     static void render_spans_16_c1_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
109                  #endif
54110               #endif
55111            #else
56               #if defined(ZCOMPARE)
57                  static void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile)
112               #if defined(ZUPDATE)
113                  #if defined(ZCOMPARE)
114                     static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
115                  #else
116                     static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
117                  #endif
58118               #else
59                  static void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
119                  #if defined(ZCOMPARE)
120                     static void render_spans_16_c1_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
121                  #else
122                     static void render_spans_16_c1_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
123                  #endif
60124               #endif
61125            #endif
62126         #endif
63127      #endif
64128   #else
65      #if defined(ZBUF)
66         #if defined(FLIP)
67            #if defined(ZUPDATE)
68               #if defined(ZCOMPARE)
69                  static void render_spans_16_c1_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
129      #if defined(TEXTURE)
130         #if defined(ZBUF)
131            #if defined(FLIP)
132               #if defined(ZUPDATE)
133                  #if defined(ZCOMPARE)
134                     static void render_spans_16_c1_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
135                  #else
136                     static void render_spans_16_c1_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
137                  #endif
70138               #else
71                  static void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
139                  #if defined(ZCOMPARE)
140                     static void render_spans_16_c1_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
141                  #else
142                     static void render_spans_16_c1_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
143                  #endif
72144               #endif
73145            #else
74               #if defined(ZCOMPARE)
75                  static void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile)
146               #if defined(ZUPDATE)
147                  #if defined(ZCOMPARE)
148                     static void render_spans_16_c1_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
149                  #else
150                     static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
151                  #endif
76152               #else
77                  static void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile)
153                  #if defined(ZCOMPARE)
154                     static void render_spans_16_c1_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
155                  #else
156                     static void render_spans_16_c1_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
157                  #endif
78158               #endif
79159            #endif
80160         #else
81            #if defined(ZUPDATE)
82               #if defined(ZCOMPARE)
83                  static void render_spans_16_c1_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
161            #if defined(FLIP)
162               #if defined(ZUPDATE)
163                  #if defined(ZCOMPARE)
164                     static void render_spans_16_c1_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
165                  #else
166                     static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
167                  #endif
84168               #else
85                  static void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
169                  #if defined(ZCOMPARE)
170                     static void render_spans_16_c1_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
171                  #else
172                     static void render_spans_16_c1_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
173                  #endif
86174               #endif
87175            #else
88               #if defined(ZCOMPARE)
89                  static void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile)
176               #if defined(ZUPDATE)
177                  #if defined(ZCOMPARE)
178                     static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
179                  #else
180                     static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
181                  #endif
90182               #else
91                  static void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
183                  #if defined(ZCOMPARE)
184                     static void render_spans_16_c1_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
185                  #else
186                     static void render_spans_16_c1_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
187                  #endif
92188               #endif
93189            #endif
94190         #endif
95191      #else
96         #if defined(FLIP)
97            #if defined(ZUPDATE)
98               #if defined(ZCOMPARE)
99                  static void render_spans_16_c1_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
192         #if defined(ZBUF)
193            #if defined(FLIP)
194               #if defined(ZUPDATE)
195                  #if defined(ZCOMPARE)
196                     static void render_spans_16_c1_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
197                  #else
198                     static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
199                  #endif
100200               #else
101                  static void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
201                  #if defined(ZCOMPARE)
202                     static void render_spans_16_c1_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
203                  #else
204                     static void render_spans_16_c1_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
205                  #endif
102206               #endif
103207            #else
104               #if defined(ZCOMPARE)
105                  static void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile)
208               #if defined(ZUPDATE)
209                  #if defined(ZCOMPARE)
210                     static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
211                  #else
212                     static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
213                  #endif
106214               #else
107                  static void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
215                  #if defined(ZCOMPARE)
216                     static void render_spans_16_c1_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
217                  #else
218                     static void render_spans_16_c1_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
219                  #endif
108220               #endif
109221            #endif
110222         #else
111            #if defined(ZUPDATE)
112               #if defined(ZCOMPARE)
113                  static void render_spans_16_c1_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
223            #if defined(FLIP)
224               #if defined(ZUPDATE)
225                  #if defined(ZCOMPARE)
226                     static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
227                  #else
228                     static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
229                  #endif
114230               #else
115                  static void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
231                  #if defined(ZCOMPARE)
232                     static void render_spans_16_c1_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
233                  #else
234                     static void render_spans_16_c1_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
235                  #endif
116236               #endif
117237            #else
118               #if defined(ZCOMPARE)
119                  static void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
238               #if defined(ZUPDATE)
239                  #if defined(ZCOMPARE)
240                     static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
241                  #else
242                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
243                  #endif
120244               #else
121                  static void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
245                  #if defined(ZCOMPARE)
246                     static void render_spans_16_c1_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
247                  #else
248                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
249                  #endif
122250               #endif
123251            #endif
124252         #endif
125253      #endif
126254   #endif
255#elif defined(BAYERDITHER)
256   #if defined(SHADE)
257      #if defined(TEXTURE)
258         #if defined(ZBUF)
259            #if defined(FLIP)
260               #if defined(ZUPDATE)
261                  #if defined(ZCOMPARE)
262                     static void render_spans_16_c1_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
263                  #else
264                     static void render_spans_16_c1_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
265                  #endif
266               #else
267                  #if defined(ZCOMPARE)
268                     static void render_spans_16_c1_s_t_z_f_zc_db(int start, int end, TILE* tex_tile)
269                  #else
270                     static void render_spans_16_c1_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
271                  #endif
272               #endif
273            #else
274               #if defined(ZUPDATE)
275                  #if defined(ZCOMPARE)
276                     static void render_spans_16_c1_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
277                  #else
278                     static void render_spans_16_c1_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
279                  #endif
280               #else
281                  #if defined(ZCOMPARE)
282                     static void render_spans_16_c1_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
283                  #else
284                     static void render_spans_16_c1_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
285                  #endif
286               #endif
287            #endif
288         #else
289            #if defined(FLIP)
290               #if defined(ZUPDATE)
291                  #if defined(ZCOMPARE)
292                     static void render_spans_16_c1_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
293                  #else
294                     static void render_spans_16_c1_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
295                  #endif
296               #else
297                  #if defined(ZCOMPARE)
298                     static void render_spans_16_c1_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
299                  #else
300                     static void render_spans_16_c1_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
301                  #endif
302               #endif
303            #else
304               #if defined(ZUPDATE)
305                  #if defined(ZCOMPARE)
306                     static void render_spans_16_c1_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
307                  #else
308                     static void render_spans_16_c1_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
309                  #endif
310               #else
311                  #if defined(ZCOMPARE)
312                     static void render_spans_16_c1_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
313                  #else
314                     static void render_spans_16_c1_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
315                  #endif
316               #endif
317            #endif
318         #endif
319      #else
320         #if defined(ZBUF)
321            #if defined(FLIP)
322               #if defined(ZUPDATE)
323                  #if defined(ZCOMPARE)
324                     static void render_spans_16_c1_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
325                  #else
326                     static void render_spans_16_c1_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
327                  #endif
328               #else
329                  #if defined(ZCOMPARE)
330                     static void render_spans_16_c1_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
331                  #else
332                     static void render_spans_16_c1_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
333                  #endif
334               #endif
335            #else
336               #if defined(ZUPDATE)
337                  #if defined(ZCOMPARE)
338                     static void render_spans_16_c1_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
339                  #else
340                     static void render_spans_16_c1_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
341                  #endif
342               #else
343                  #if defined(ZCOMPARE)
344                     static void render_spans_16_c1_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
345                  #else
346                     static void render_spans_16_c1_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
347                  #endif
348               #endif
349            #endif
350         #else
351            #if defined(FLIP)
352               #if defined(ZUPDATE)
353                  #if defined(ZCOMPARE)
354                     static void render_spans_16_c1_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
355                  #else
356                     static void render_spans_16_c1_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
357                  #endif
358               #else
359                  #if defined(ZCOMPARE)
360                     static void render_spans_16_c1_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
361                  #else
362                     static void render_spans_16_c1_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
363                  #endif
364               #endif
365            #else
366               #if defined(ZUPDATE)
367                  #if defined(ZCOMPARE)
368                     static void render_spans_16_c1_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
369                  #else
370                     static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
371                  #endif
372               #else
373                  #if defined(ZCOMPARE)
374                     static void render_spans_16_c1_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
375                  #else
376                     static void render_spans_16_c1_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
377                  #endif
378               #endif
379            #endif
380         #endif
381      #endif
382   #else
383      #if defined(TEXTURE)
384         #if defined(ZBUF)
385            #if defined(FLIP)
386               #if defined(ZUPDATE)
387                  #if defined(ZCOMPARE)
388                     static void render_spans_16_c1_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
389                  #else
390                     static void render_spans_16_c1_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
391                  #endif
392               #else
393                  #if defined(ZCOMPARE)
394                     static void render_spans_16_c1_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile)
395                  #else
396                     static void render_spans_16_c1_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
397                  #endif
398               #endif
399            #else
400               #if defined(ZUPDATE)
401                  #if defined(ZCOMPARE)
402                     static void render_spans_16_c1_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
403                  #else
404                     static void render_spans_16_c1_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
405                  #endif
406               #else
407                  #if defined(ZCOMPARE)
408                     static void render_spans_16_c1_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
409                  #else
410                     static void render_spans_16_c1_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
411                  #endif
412               #endif
413            #endif
414         #else
415            #if defined(FLIP)
416               #if defined(ZUPDATE)
417                  #if defined(ZCOMPARE)
418                     static void render_spans_16_c1_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
419                  #else
420                     static void render_spans_16_c1_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
421                  #endif
422               #else
423                  #if defined(ZCOMPARE)
424                     static void render_spans_16_c1_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
425                  #else
426                     static void render_spans_16_c1_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
427                  #endif
428               #endif
429            #else
430               #if defined(ZUPDATE)
431                  #if defined(ZCOMPARE)
432                     static void render_spans_16_c1_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
433                  #else
434                     static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
435                  #endif
436               #else
437                  #if defined(ZCOMPARE)
438                     static void render_spans_16_c1_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
439                  #else
440                     static void render_spans_16_c1_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
441                  #endif
442               #endif
443            #endif
444         #endif
445      #else
446         #if defined(ZBUF)
447            #if defined(FLIP)
448               #if defined(ZUPDATE)
449                  #if defined(ZCOMPARE)
450                     static void render_spans_16_c1_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
451                  #else
452                     static void render_spans_16_c1_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
453                  #endif
454               #else
455                  #if defined(ZCOMPARE)
456                     static void render_spans_16_c1_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
457                  #else
458                     static void render_spans_16_c1_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
459                  #endif
460               #endif
461            #else
462               #if defined(ZUPDATE)
463                  #if defined(ZCOMPARE)
464                     static void render_spans_16_c1_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
465                  #else
466                     static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
467                  #endif
468               #else
469                  #if defined(ZCOMPARE)
470                     static void render_spans_16_c1_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
471                  #else
472                     static void render_spans_16_c1_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
473                  #endif
474               #endif
475            #endif
476         #else
477            #if defined(FLIP)
478               #if defined(ZUPDATE)
479                  #if defined(ZCOMPARE)
480                     static void render_spans_16_c1_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
481                  #else
482                     static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
483                  #endif
484               #else
485                  #if defined(ZCOMPARE)
486                     static void render_spans_16_c1_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
487                  #else
488                     static void render_spans_16_c1_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
489                  #endif
490               #endif
491            #else
492               #if defined(ZUPDATE)
493                  #if defined(ZCOMPARE)
494                     static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
495                  #else
496                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
497                  #endif
498               #else
499                  #if defined(ZCOMPARE)
500                     static void render_spans_16_c1_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
501                  #else
502                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
503                  #endif
504               #endif
505            #endif
506         #endif
507      #endif
508   #endif
127509#else
128   #if defined(TEXTURE)
129      #if defined(ZBUF)
130         #if defined(FLIP)
131            #if defined(ZUPDATE)
132               #if defined(ZCOMPARE)
133                  static void render_spans_16_c1_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
510   #if defined(SHADE)
511      #if defined(TEXTURE)
512         #if defined(ZBUF)
513            #if defined(FLIP)
514               #if defined(ZUPDATE)
515                  #if defined(ZCOMPARE)
516                     static void render_spans_16_c1_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
517                  #else
518                     static void render_spans_16_c1_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
519                  #endif
134520               #else
135                  static void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
521                  #if defined(ZCOMPARE)
522                     static void render_spans_16_c1_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
523                  #else
524                     static void render_spans_16_c1_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
525                  #endif
136526               #endif
137527            #else
138               #if defined(ZCOMPARE)
139                  static void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile)
528               #if defined(ZUPDATE)
529                  #if defined(ZCOMPARE)
530                     static void render_spans_16_c1_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
531                  #else
532                     static void render_spans_16_c1_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
533                  #endif
140534               #else
141                  static void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile)
535                  #if defined(ZCOMPARE)
536                     static void render_spans_16_c1_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
537                  #else
538                     static void render_spans_16_c1_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
539                  #endif
142540               #endif
143541            #endif
144542         #else
145            #if defined(ZUPDATE)
146               #if defined(ZCOMPARE)
147                  static void render_spans_16_c1_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
543            #if defined(FLIP)
544               #if defined(ZUPDATE)
545                  #if defined(ZCOMPARE)
546                     static void render_spans_16_c1_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
547                  #else
548                     static void render_spans_16_c1_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
549                  #endif
148550               #else
149                  static void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
551                  #if defined(ZCOMPARE)
552                     static void render_spans_16_c1_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
553                  #else
554                     static void render_spans_16_c1_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
555                  #endif
150556               #endif
151557            #else
152               #if defined(ZCOMPARE)
153                  static void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile)
558               #if defined(ZUPDATE)
559                  #if defined(ZCOMPARE)
560                     static void render_spans_16_c1_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
561                  #else
562                     static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
563                  #endif
154564               #else
155                  static void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile)
565                  #if defined(ZCOMPARE)
566                     static void render_spans_16_c1_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
567                  #else
568                     static void render_spans_16_c1_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
569                  #endif
156570               #endif
157571            #endif
158572         #endif
159573      #else
160         #if defined(FLIP)
161            #if defined(ZUPDATE)
162               #if defined(ZCOMPARE)
163                  static void render_spans_16_c1_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
574         #if defined(ZBUF)
575            #if defined(FLIP)
576               #if defined(ZUPDATE)
577                  #if defined(ZCOMPARE)
578                     static void render_spans_16_c1_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
579                  #else
580                     static void render_spans_16_c1_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
581                  #endif
164582               #else
165                  static void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
583                  #if defined(ZCOMPARE)
584                     static void render_spans_16_c1_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
585                  #else
586                     static void render_spans_16_c1_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
587                  #endif
166588               #endif
167589            #else
168               #if defined(ZCOMPARE)
169                  static void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile)
590               #if defined(ZUPDATE)
591                  #if defined(ZCOMPARE)
592                     static void render_spans_16_c1_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
593                  #else
594                     static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
595                  #endif
170596               #else
171                  static void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile)
597                  #if defined(ZCOMPARE)
598                     static void render_spans_16_c1_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
599                  #else
600                     static void render_spans_16_c1_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
601                  #endif
172602               #endif
173603            #endif
174604         #else
175            #if defined(ZUPDATE)
176               #if defined(ZCOMPARE)
177                  static void render_spans_16_c1_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
605            #if defined(FLIP)
606               #if defined(ZUPDATE)
607                  #if defined(ZCOMPARE)
608                     static void render_spans_16_c1_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
609                  #else
610                     static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
611                  #endif
178612               #else
179                  static void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
613                  #if defined(ZCOMPARE)
614                     static void render_spans_16_c1_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
615                  #else
616                     static void render_spans_16_c1_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
617                  #endif
180618               #endif
181619            #else
182               #if defined(ZCOMPARE)
183                  static void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile)
620               #if defined(ZUPDATE)
621                  #if defined(ZCOMPARE)
622                     static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
623                  #else
624                     static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
625                  #endif
184626               #else
185                  static void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
627                  #if defined(ZCOMPARE)
628                     static void render_spans_16_c1_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
629                  #else
630                     static void render_spans_16_c1_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
631                  #endif
186632               #endif
187633            #endif
188634         #endif
189635      #endif
190636   #else
191      #if defined(ZBUF)
192         #if defined(FLIP)
193            #if defined(ZUPDATE)
194               #if defined(ZCOMPARE)
195                  static void render_spans_16_c1_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
637      #if defined(TEXTURE)
638         #if defined(ZBUF)
639            #if defined(FLIP)
640               #if defined(ZUPDATE)
641                  #if defined(ZCOMPARE)
642                     static void render_spans_16_c1_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
643                  #else
644                     static void render_spans_16_c1_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
645                  #endif
196646               #else
197                  static void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
647                  #if defined(ZCOMPARE)
648                     static void render_spans_16_c1_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
649                  #else
650                     static void render_spans_16_c1_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
651                  #endif
198652               #endif
199653            #else
200               #if defined(ZCOMPARE)
201                  static void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile)
654               #if defined(ZUPDATE)
655                  #if defined(ZCOMPARE)
656                     static void render_spans_16_c1_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
657                  #else
658                     static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
659                  #endif
202660               #else
203                  static void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile)
661                  #if defined(ZCOMPARE)
662                     static void render_spans_16_c1_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
663                  #else
664                     static void render_spans_16_c1_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
665                  #endif
204666               #endif
205667            #endif
206668         #else
207            #if defined(ZUPDATE)
208               #if defined(ZCOMPARE)
209                  static void render_spans_16_c1_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
669            #if defined(FLIP)
670               #if defined(ZUPDATE)
671                  #if defined(ZCOMPARE)
672                     static void render_spans_16_c1_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
673                  #else
674                     static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
675                  #endif
210676               #else
211                  static void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
677                  #if defined(ZCOMPARE)
678                     static void render_spans_16_c1_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
679                  #else
680                     static void render_spans_16_c1_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
681                  #endif
212682               #endif
213683            #else
214               #if defined(ZCOMPARE)
215                  static void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile)
684               #if defined(ZUPDATE)
685                  #if defined(ZCOMPARE)
686                     static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
687                  #else
688                     static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
689                  #endif
216690               #else
217                  static void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
691                  #if defined(ZCOMPARE)
692                     static void render_spans_16_c1_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
693                  #else
694                     static void render_spans_16_c1_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
695                  #endif
218696               #endif
219697            #endif
220698         #endif
221699      #else
222         #if defined(FLIP)
223            #if defined(ZUPDATE)
224               #if defined(ZCOMPARE)
225                  static void render_spans_16_c1_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
700         #if defined(ZBUF)
701            #if defined(FLIP)
702               #if defined(ZUPDATE)
703                  #if defined(ZCOMPARE)
704                     static void render_spans_16_c1_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
705                  #else
706                     static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
707                  #endif
226708               #else
227                  static void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
709                  #if defined(ZCOMPARE)
710                     static void render_spans_16_c1_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
711                  #else
712                     static void render_spans_16_c1_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
713                  #endif
228714               #endif
229715            #else
230               #if defined(ZCOMPARE)
231                  static void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile)
716               #if defined(ZUPDATE)
717                  #if defined(ZCOMPARE)
718                     static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
719                  #else
720                     static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
721                  #endif
232722               #else
233                  static void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
723                  #if defined(ZCOMPARE)
724                     static void render_spans_16_c1_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
725                  #else
726                     static void render_spans_16_c1_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
727                  #endif
234728               #endif
235729            #endif
236730         #else
237            #if defined(ZUPDATE)
238               #if defined(ZCOMPARE)
239                  static void render_spans_16_c1_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
731            #if defined(FLIP)
732               #if defined(ZUPDATE)
733                  #if defined(ZCOMPARE)
734                     static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
735                  #else
736                     static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
737                  #endif
240738               #else
241                  static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
739                  #if defined(ZCOMPARE)
740                     static void render_spans_16_c1_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
741                  #else
742                     static void render_spans_16_c1_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
743                  #endif
242744               #endif
243745            #else
244               #if defined(ZCOMPARE)
245                  static void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
746               #if defined(ZUPDATE)
747                  #if defined(ZCOMPARE)
748                     static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
749                  #else
750                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
751                  #endif
246752               #else
247                  static void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
753                  #if defined(ZCOMPARE)
754                     static void render_spans_16_c1_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
755                  #else
756                     static void render_spans_16_c1_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
757                  #endif
248758               #endif
249759            #endif
250760         #endif
r6795r6796
324834   clipy2 = clip.yl / 4;
325835
326836#if defined(TEXTURE)
837   calculate_clamp_diffs(tex_tile->num);
838
327839   if (!other_modes.tex_lod_en)
328840   {
329841      tilenum = prim_tile;
r6795r6796
356868   shade_color.c = prim_color.c;
357869#endif
358870
871   CACHE_TEXTURE_PARAMS(tex_tile);
872
359873   for (i = start; i <= end; i++)
360874   {
361875      int xstart = span[i].lx;
r6795r6796
406920#if defined(ZBUF)
407921         int sz = z.w >> 13;
408922#endif
409         COLOR c1, c2;
410         c1.c = 0;
411         c2.c = 0;
923         COLOR c1;
924         //c1.c = 0;
412925
413926#if defined(ZBUF)
414927         if (other_modes.z_source_sel)
r6795r6796
449962#endif
450963
451964#if defined(SHADE)
452               if (sr > 0xff) sr = 0xff;
453               if (sg > 0xff) sg = 0xff;
454               if (sb > 0xff) sb = 0xff;
455               if (sa > 0xff) sa = 0xff;
456               if (sr < 0) sr = 0;
457               if (sg < 0) sg = 0;
458               if (sb < 0) sb = 0;
459               if (sa < 0) sa = 0;
460               shade_color.i.r = sr;
461               shade_color.i.g = sg;
462               shade_color.i.b = sb;
463               shade_color.i.a = sa;
965               if (sr > 0xff) shade_color.i.r = 0xff;
966               else if (sr < 0) shade_color.i.r = 0;
967               else shade_color.i.r = sr;
968               if (sg > 0xff) shade_color.i.g = 0xff;
969               else if (sg < 0) shade_color.i.g = 0;
970               else shade_color.i.g = sg;
971               if (sb > 0xff) shade_color.i.b = 0xff;
972               else if (sb < 0) shade_color.i.b = 0;
973               else shade_color.i.b = sb;
974               if (sa > 0xff) shade_color.i.a = 0xff;
975               else if (sa < 0) shade_color.i.a = 0;
976               else shade_color.i.a = sa;
464977#endif
465978
466979#if defined(TEXTURE)
467               TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
980               texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
468981#endif
469982
470               COLOR_COMBINER1(&c1);
983               c1.c = COLOR_COMBINER1();
471984
472985#if defined(ZCOMPARE)
473986#if !defined(ZBUF)
r6795r6796
480993               if(z_compare_result)
481994#endif
482995               {
996#if defined(ZUPDATE)
483997                  int rendered = 0;
484                  int dith = 0;
485                  if (!other_modes.rgb_dither_sel)
486                  {
487                     dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
488                  }
489                  else if (other_modes.rgb_dither_sel == 1)
490                  {
491                     dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
492                  }
998#endif
999#if defined(MAGICDITHER)
1000                  int dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
1001#elif defined(BAYERDITHER)
1002                  int dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
1003#endif
4931004
494                  rendered = BLENDER1_16(fbcur, hbcur, c1, dith);
1005#if defined(ZUPDATE)
1006#if defined(MAGICDITHER) || defined(BAYERDITHER)
1007                  rendered = BLENDER1_16_DITH(fbcur, hbcur, c1, dith);
1008#else
1009                  rendered = BLENDER1_16_NDITH(fbcur, hbcur, c1);
1010#endif
4951011
496#if defined(ZUPDATE)
4971012                  if (rendered)
4981013                  {
4991014                     z_store(zbcur, zhbcur, sz, dzpix);
5001015                  }
1016#else
1017#if defined(MAGICDITHER) || defined(BAYERDITHER)
1018                  BLENDER1_16_DITH(fbcur, hbcur, c1, dith);
1019#else
1020                  BLENDER1_16_NDITH(fbcur, hbcur, c1);
5011021#endif
1022#endif
5021023               }
5031024            }
5041025         }
r6795r6796
5271048   }
5281049}
5291050
530#if defined(SHADE)
531   #if defined(TEXTURE)
532      #if defined(ZBUF)
533         #if defined(FLIP)
534            #if defined(ZUPDATE)
535               #if defined(ZCOMPARE)
536               static void render_spans_16_c2_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
1051#if defined(MAGICDITHER)
1052   #if defined(SHADE)
1053      #if defined(TEXTURE)
1054         #if defined(ZBUF)
1055            #if defined(FLIP)
1056               #if defined(ZUPDATE)
1057                  #if defined(ZCOMPARE)
1058                  static void render_spans_16_c2_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1059                  #else
1060                  static void render_spans_16_c2_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1061                  #endif
5371062               #else
538               static void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
1063                  #if defined(ZCOMPARE)
1064                  static void render_spans_16_c2_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
1065                  #else
1066                  static void render_spans_16_c2_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
1067                  #endif
5391068               #endif
5401069            #else
541               #if defined(ZCOMPARE)
542               static void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile)
1070               #if defined(ZUPDATE)
1071                  #if defined(ZCOMPARE)
1072                  static void render_spans_16_c2_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1073                  #else
1074                  static void render_spans_16_c2_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1075                  #endif
5431076               #else
544               static void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile)
1077                  #if defined(ZCOMPARE)
1078                  static void render_spans_16_c2_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
1079                  #else
1080                  static void render_spans_16_c2_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
1081                  #endif
5451082               #endif
5461083            #endif
5471084         #else
548            #if defined(ZUPDATE)
549               #if defined(ZCOMPARE)
550               static void render_spans_16_c2_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
1085            #if defined(FLIP)
1086               #if defined(ZUPDATE)
1087                  #if defined(ZCOMPARE)
1088                  static void render_spans_16_c2_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1089                  #else
1090                  static void render_spans_16_c2_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1091                  #endif
5511092               #else
552               static void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
1093                  #if defined(ZCOMPARE)
1094                  static void render_spans_16_c2_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
1095                  #else
1096                  static void render_spans_16_c2_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
1097                  #endif
5531098               #endif
5541099            #else
555               #if defined(ZCOMPARE)
556               static void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile)
1100               #if defined(ZUPDATE)
1101                  #if defined(ZCOMPARE)
1102                  static void render_spans_16_c2_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1103                  #else
1104                  static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1105                  #endif
5571106               #else
558               static void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile)
1107                  #if defined(ZCOMPARE)
1108                  static void render_spans_16_c2_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
1109                  #else
1110                  static void render_spans_16_c2_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
1111                  #endif
5591112               #endif
5601113            #endif
5611114         #endif
5621115      #else
563         #if defined(FLIP)
564            #if defined(ZUPDATE)
565               #if defined(ZCOMPARE)
566               static void render_spans_16_c2_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
1116         #if defined(ZBUF)
1117            #if defined(FLIP)
1118               #if defined(ZUPDATE)
1119                  #if defined(ZCOMPARE)
1120                  static void render_spans_16_c2_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1121                  #else
1122                  static void render_spans_16_c2_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1123                  #endif
5671124               #else
568               static void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
1125                  #if defined(ZCOMPARE)
1126                  static void render_spans_16_c2_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
1127                  #else
1128                  static void render_spans_16_c2_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
1129                  #endif
5691130               #endif
5701131            #else
571               #if defined(ZCOMPARE)
572               static void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile)
1132               #if defined(ZUPDATE)
1133                  #if defined(ZCOMPARE)
1134                  static void render_spans_16_c2_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1135                  #else
1136                  static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1137                  #endif
5731138               #else
574               static void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile)
1139                  #if defined(ZCOMPARE)
1140                  static void render_spans_16_c2_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
1141                  #else
1142                  static void render_spans_16_c2_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
1143                  #endif
5751144               #endif
5761145            #endif
5771146         #else
578            #if defined(ZUPDATE)
579               #if defined(ZCOMPARE)
580               static void render_spans_16_c2_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
1147            #if defined(FLIP)
1148               #if defined(ZUPDATE)
1149                  #if defined(ZCOMPARE)
1150                  static void render_spans_16_c2_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1151                  #else
1152                  static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1153                  #endif
5811154               #else
582               static void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
1155                  #if defined(ZCOMPARE)
1156                  static void render_spans_16_c2_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
1157                  #else
1158                  static void render_spans_16_c2_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
1159                  #endif
5831160               #endif
5841161            #else
585               #if defined(ZCOMPARE)
586               static void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile)
1162               #if defined(ZUPDATE)
1163                  #if defined(ZCOMPARE)
1164                  static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1165                  #else
1166                  static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1167                  #endif
5871168               #else
588               static void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
1169                  #if defined(ZCOMPARE)
1170                  static void render_spans_16_c2_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
1171                  #else
1172                  static void render_spans_16_c2_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
1173                  #endif
5891174               #endif
5901175            #endif
5911176         #endif
5921177      #endif
5931178   #else
594      #if defined(ZBUF)
595         #if defined(FLIP)
596            #if defined(ZUPDATE)
597               #if defined(ZCOMPARE)
598               static void render_spans_16_c2_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
1179      #if defined(TEXTURE)
1180         #if defined(ZBUF)
1181            #if defined(FLIP)
1182               #if defined(ZUPDATE)
1183                  #if defined(ZCOMPARE)
1184                  static void render_spans_16_c2_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1185                  #else
1186                  static void render_spans_16_c2_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1187                  #endif
5991188               #else
600               static void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
1189                  #if defined(ZCOMPARE)
1190                  static void render_spans_16_c2_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
1191                  #else
1192                  static void render_spans_16_c2_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
1193                  #endif
6011194               #endif
6021195            #else
603               #if defined(ZCOMPARE)
604               static void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile)
1196               #if defined(ZUPDATE)
1197                  #if defined(ZCOMPARE)
1198                  static void render_spans_16_c2_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1199                  #else
1200                  static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1201                  #endif
6051202               #else
606               static void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile)
1203                  #if defined(ZCOMPARE)
1204                  static void render_spans_16_c2_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
1205                  #else
1206                  static void render_spans_16_c2_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
1207                  #endif
6071208               #endif
6081209            #endif
6091210         #else
610            #if defined(ZUPDATE)
611               #if defined(ZCOMPARE)
612               static void render_spans_16_c2_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
1211            #if defined(FLIP)
1212               #if defined(ZUPDATE)
1213                  #if defined(ZCOMPARE)
1214                  static void render_spans_16_c2_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1215                  #else
1216                  static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1217                  #endif
6131218               #else
614               static void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
1219                  #if defined(ZCOMPARE)
1220                  static void render_spans_16_c2_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
1221                  #else
1222                  static void render_spans_16_c2_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
1223                  #endif
6151224               #endif
6161225            #else
617               #if defined(ZCOMPARE)
618               static void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile)
1226               #if defined(ZUPDATE)
1227                  #if defined(ZCOMPARE)
1228                  static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1229                  #else
1230                  static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1231                  #endif
6191232               #else
620               static void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
1233                  #if defined(ZCOMPARE)
1234                  static void render_spans_16_c2_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
1235                  #else
1236                  static void render_spans_16_c2_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
1237                  #endif
6211238               #endif
6221239            #endif
6231240         #endif
6241241      #else
625         #if defined(FLIP)
626            #if defined(ZUPDATE)
627               #if defined(ZCOMPARE)
628               static void render_spans_16_c2_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
1242         #if defined(ZBUF)
1243            #if defined(FLIP)
1244               #if defined(ZUPDATE)
1245                  #if defined(ZCOMPARE)
1246                  static void render_spans_16_c2_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1247                  #else
1248                  static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1249                  #endif
6291250               #else
630               static void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
1251                  #if defined(ZCOMPARE)
1252                  static void render_spans_16_c2_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
1253                  #else
1254                  static void render_spans_16_c2_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
1255                  #endif
6311256               #endif
6321257            #else
633               #if defined(ZCOMPARE)
634               static void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile)
1258               #if defined(ZUPDATE)
1259                  #if defined(ZCOMPARE)
1260                  static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1261                  #else
1262                  static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1263                  #endif
6351264               #else
636               static void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
1265                  #if defined(ZCOMPARE)
1266                  static void render_spans_16_c2_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
1267                  #else
1268                  static void render_spans_16_c2_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
1269                  #endif
6371270               #endif
6381271            #endif
6391272         #else
640            #if defined(ZUPDATE)
641               #if defined(ZCOMPARE)
642               static void render_spans_16_c2_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
1273            #if defined(FLIP)
1274               #if defined(ZUPDATE)
1275                  #if defined(ZCOMPARE)
1276                  static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
1277                  #else
1278                  static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
1279                  #endif
6431280               #else
644               static void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
1281                  #if defined(ZCOMPARE)
1282                  static void render_spans_16_c2_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
1283                  #else
1284                  static void render_spans_16_c2_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
1285                  #endif
6451286               #endif
6461287            #else
647               #if defined(ZCOMPARE)
648               static void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
1288               #if defined(ZUPDATE)
1289                  #if defined(ZCOMPARE)
1290                  static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
1291                  #else
1292                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
1293                  #endif
6491294               #else
650               static void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
1295                  #if defined(ZCOMPARE)
1296                  static void render_spans_16_c2_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
1297                  #else
1298                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
1299                  #endif
6511300               #endif
6521301            #endif
6531302         #endif
6541303      #endif
6551304   #endif
1305#elif defined(BAYERDITHER)
1306   #if defined(SHADE)
1307      #if defined(TEXTURE)
1308         #if defined(ZBUF)
1309            #if defined(FLIP)
1310               #if defined(ZUPDATE)
1311                  #if defined(ZCOMPARE)
1312                  static void render_spans_16_c2_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
1313                  #else
1314                  static void render_spans_16_c2_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1315                  #endif
1316               #else
1317                  #if defined(ZCOMPARE)
1318                  static void render_spans_16_c2_s_t_z_f_zc_db(int start, int end, TILE* tex_tile)
1319                  #else
1320                  static void render_spans_16_c2_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
1321                  #endif
1322               #endif
1323            #else
1324               #if defined(ZUPDATE)
1325                  #if defined(ZCOMPARE)
1326                  static void render_spans_16_c2_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1327                  #else
1328                  static void render_spans_16_c2_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1329                  #endif
1330               #else
1331                  #if defined(ZCOMPARE)
1332                  static void render_spans_16_c2_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
1333                  #else
1334                  static void render_spans_16_c2_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
1335                  #endif
1336               #endif
1337            #endif
1338         #else
1339            #if defined(FLIP)
1340               #if defined(ZUPDATE)
1341                  #if defined(ZCOMPARE)
1342                  static void render_spans_16_c2_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
1343                  #else
1344                  static void render_spans_16_c2_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1345                  #endif
1346               #else
1347                  #if defined(ZCOMPARE)
1348                  static void render_spans_16_c2_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
1349                  #else
1350                  static void render_spans_16_c2_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
1351                  #endif
1352               #endif
1353            #else
1354               #if defined(ZUPDATE)
1355                  #if defined(ZCOMPARE)
1356                  static void render_spans_16_c2_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1357                  #else
1358                  static void render_spans_16_c2_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1359                  #endif
1360               #else
1361                  #if defined(ZCOMPARE)
1362                  static void render_spans_16_c2_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
1363                  #else
1364                  static void render_spans_16_c2_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
1365                  #endif
1366               #endif
1367            #endif
1368         #endif
1369      #else
1370         #if defined(ZBUF)
1371            #if defined(FLIP)
1372               #if defined(ZUPDATE)
1373                  #if defined(ZCOMPARE)
1374                  static void render_spans_16_c2_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
1375                  #else
1376                  static void render_spans_16_c2_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1377                  #endif
1378               #else
1379                  #if defined(ZCOMPARE)
1380                  static void render_spans_16_c2_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
1381                  #else
1382                  static void render_spans_16_c2_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
1383                  #endif
1384               #endif
1385            #else
1386               #if defined(ZUPDATE)
1387                  #if defined(ZCOMPARE)
1388                  static void render_spans_16_c2_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1389                  #else
1390                  static void render_spans_16_c2_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1391                  #endif
1392               #else
1393                  #if defined(ZCOMPARE)
1394                  static void render_spans_16_c2_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
1395                  #else
1396                  static void render_spans_16_c2_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
1397                  #endif
1398               #endif
1399            #endif
1400         #else
1401            #if defined(FLIP)
1402               #if defined(ZUPDATE)
1403                  #if defined(ZCOMPARE)
1404                  static void render_spans_16_c2_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
1405                  #else
1406                  static void render_spans_16_c2_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1407                  #endif
1408               #else
1409                  #if defined(ZCOMPARE)
1410                  static void render_spans_16_c2_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
1411                  #else
1412                  static void render_spans_16_c2_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
1413                  #endif
1414               #endif
1415            #else
1416               #if defined(ZUPDATE)
1417                  #if defined(ZCOMPARE)
1418                  static void render_spans_16_c2_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1419                  #else
1420                  static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1421                  #endif
1422               #else
1423                  #if defined(ZCOMPARE)
1424                  static void render_spans_16_c2_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
1425                  #else
1426                  static void render_spans_16_c2_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
1427                  #endif
1428               #endif
1429            #endif
1430         #endif
1431      #endif
1432   #else
1433      #if defined(TEXTURE)
1434         #if defined(ZBUF)
1435            #if defined(FLIP)
1436               #if defined(ZUPDATE)
1437                  #if defined(ZCOMPARE)
1438                  static void render_spans_16_c2_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
1439                  #else
1440                  static void render_spans_16_c2_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1441                  #endif
1442               #else
1443                  #if defined(ZCOMPARE)
1444                  static void render_spans_16_c2_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile)
1445                  #else
1446                  static void render_spans_16_c2_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
1447                  #endif
1448               #endif
1449            #else
1450               #if defined(ZUPDATE)
1451                  #if defined(ZCOMPARE)
1452                  static void render_spans_16_c2_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1453                  #else
1454                  static void render_spans_16_c2_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1455                  #endif
1456               #else
1457                  #if defined(ZCOMPARE)
1458                  static void render_spans_16_c2_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
1459                  #else
1460                  static void render_spans_16_c2_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
1461                  #endif
1462               #endif
1463            #endif
1464         #else
1465            #if defined(FLIP)
1466               #if defined(ZUPDATE)
1467                  #if defined(ZCOMPARE)
1468                  static void render_spans_16_c2_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
1469                  #else
1470                  static void render_spans_16_c2_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1471                  #endif
1472               #else
1473                  #if defined(ZCOMPARE)
1474                  static void render_spans_16_c2_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
1475                  #else
1476                  static void render_spans_16_c2_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
1477                  #endif
1478               #endif
1479            #else
1480               #if defined(ZUPDATE)
1481                  #if defined(ZCOMPARE)
1482                  static void render_spans_16_c2_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1483                  #else
1484                  static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1485                  #endif
1486               #else
1487                  #if defined(ZCOMPARE)
1488                  static void render_spans_16_c2_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
1489                  #else
1490                  static void render_spans_16_c2_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
1491                  #endif
1492               #endif
1493            #endif
1494         #endif
1495      #else
1496         #if defined(ZBUF)
1497            #if defined(FLIP)
1498               #if defined(ZUPDATE)
1499                  #if defined(ZCOMPARE)
1500                  static void render_spans_16_c2_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
1501                  #else
1502                  static void render_spans_16_c2_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1503                  #endif
1504               #else
1505                  #if defined(ZCOMPARE)
1506                  static void render_spans_16_c2_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
1507                  #else
1508                  static void render_spans_16_c2_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
1509                  #endif
1510               #endif
1511            #else
1512               #if defined(ZUPDATE)
1513                  #if defined(ZCOMPARE)
1514                  static void render_spans_16_c2_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1515                  #else
1516                  static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1517                  #endif
1518               #else
1519                  #if defined(ZCOMPARE)
1520                  static void render_spans_16_c2_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
1521                  #else
1522                  static void render_spans_16_c2_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
1523                  #endif
1524               #endif
1525            #endif
1526         #else
1527            #if defined(FLIP)
1528               #if defined(ZUPDATE)
1529                  #if defined(ZCOMPARE)
1530                  static void render_spans_16_c2_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
1531                  #else
1532                  static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
1533                  #endif
1534               #else
1535                  #if defined(ZCOMPARE)
1536                  static void render_spans_16_c2_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
1537                  #else
1538                  static void render_spans_16_c2_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
1539                  #endif
1540               #endif
1541            #else
1542               #if defined(ZUPDATE)
1543                  #if defined(ZCOMPARE)
1544                  static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
1545                  #else
1546                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
1547                  #endif
1548               #else
1549                  #if defined(ZCOMPARE)
1550                  static void render_spans_16_c2_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
1551                  #else
1552                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
1553                  #endif
1554               #endif
1555            #endif
1556         #endif
1557      #endif
1558   #endif
6561559#else
657   #if defined(TEXTURE)
658      #if defined(ZBUF)
659         #if defined(FLIP)
660            #if defined(ZUPDATE)
661               #if defined(ZCOMPARE)
662               static void render_spans_16_c2_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
1560   #if defined(SHADE)
1561      #if defined(TEXTURE)
1562         #if defined(ZBUF)
1563            #if defined(FLIP)
1564               #if defined(ZUPDATE)
1565                  #if defined(ZCOMPARE)
1566                  static void render_spans_16_c2_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1567                  #else
1568                  static void render_spans_16_c2_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1569                  #endif
6631570               #else
664               static void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
1571                  #if defined(ZCOMPARE)
1572                  static void render_spans_16_c2_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
1573                  #else
1574                  static void render_spans_16_c2_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
1575                  #endif
6651576               #endif
6661577            #else
667               #if defined(ZCOMPARE)
668               static void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile)
1578               #if defined(ZUPDATE)
1579                  #if defined(ZCOMPARE)
1580                  static void render_spans_16_c2_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1581                  #else
1582                  static void render_spans_16_c2_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1583                  #endif
6691584               #else
670               static void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile)
1585                  #if defined(ZCOMPARE)
1586                  static void render_spans_16_c2_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
1587                  #else
1588                  static void render_spans_16_c2_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
1589                  #endif
6711590               #endif
6721591            #endif
6731592         #else
674            #if defined(ZUPDATE)
675               #if defined(ZCOMPARE)
676               static void render_spans_16_c2_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
1593            #if defined(FLIP)
1594               #if defined(ZUPDATE)
1595                  #if defined(ZCOMPARE)
1596                  static void render_spans_16_c2_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1597                  #else
1598                  static void render_spans_16_c2_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1599                  #endif
6771600               #else
678               static void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
1601                  #if defined(ZCOMPARE)
1602                  static void render_spans_16_c2_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
1603                  #else
1604                  static void render_spans_16_c2_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
1605                  #endif
6791606               #endif
6801607            #else
681               #if defined(ZCOMPARE)
682               static void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile)
1608               #if defined(ZUPDATE)
1609                  #if defined(ZCOMPARE)
1610                  static void render_spans_16_c2_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1611                  #else
1612                  static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1613                  #endif
6831614               #else
684               static void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile)
1615                  #if defined(ZCOMPARE)
1616                  static void render_spans_16_c2_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
1617                  #else
1618                  static void render_spans_16_c2_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
1619                  #endif
6851620               #endif
6861621            #endif
6871622         #endif
6881623      #else
689         #if defined(FLIP)
690            #if defined(ZUPDATE)
691               #if defined(ZCOMPARE)
692               static void render_spans_16_c2_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
1624         #if defined(ZBUF)
1625            #if defined(FLIP)
1626               #if defined(ZUPDATE)
1627                  #if defined(ZCOMPARE)
1628                  static void render_spans_16_c2_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1629                  #else
1630                  static void render_spans_16_c2_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1631                  #endif
6931632               #else
694               static void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
1633                  #if defined(ZCOMPARE)
1634                  static void render_spans_16_c2_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
1635                  #else
1636                  static void render_spans_16_c2_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
1637                  #endif
6951638               #endif
6961639            #else
697               #if defined(ZCOMPARE)
698               static void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile)
1640               #if defined(ZUPDATE)
1641                  #if defined(ZCOMPARE)
1642                  static void render_spans_16_c2_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1643                  #else
1644                  static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1645                  #endif
6991646               #else
700               static void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile)
1647                  #if defined(ZCOMPARE)
1648                  static void render_spans_16_c2_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
1649                  #else
1650                  static void render_spans_16_c2_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
1651                  #endif
7011652               #endif
7021653            #endif
7031654         #else
704            #if defined(ZUPDATE)
705               #if defined(ZCOMPARE)
706               static void render_spans_16_c2_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
1655            #if defined(FLIP)
1656               #if defined(ZUPDATE)
1657                  #if defined(ZCOMPARE)
1658                  static void render_spans_16_c2_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1659                  #else
1660                  static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1661                  #endif
7071662               #else
708               static void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
1663                  #if defined(ZCOMPARE)
1664                  static void render_spans_16_c2_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
1665                  #else
1666                  static void render_spans_16_c2_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
1667                  #endif
7091668               #endif
7101669            #else
711               #if defined(ZCOMPARE)
712               static void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile)
1670               #if defined(ZUPDATE)
1671                  #if defined(ZCOMPARE)
1672                  static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1673                  #else
1674                  static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1675                  #endif
7131676               #else
714               static void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
1677                  #if defined(ZCOMPARE)
1678                  static void render_spans_16_c2_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
1679                  #else
1680                  static void render_spans_16_c2_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
1681                  #endif
7151682               #endif
7161683            #endif
7171684         #endif
7181685      #endif
7191686   #else
720      #if defined(ZBUF)
721         #if defined(FLIP)
722            #if defined(ZUPDATE)
723               #if defined(ZCOMPARE)
724               static void render_spans_16_c2_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
1687      #if defined(TEXTURE)
1688         #if defined(ZBUF)
1689            #if defined(FLIP)
1690               #if defined(ZUPDATE)
1691                  #if defined(ZCOMPARE)
1692                  static void render_spans_16_c2_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1693                  #else
1694                  static void render_spans_16_c2_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1695                  #endif
7251696               #else
726               static void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
1697                  #if defined(ZCOMPARE)
1698                  static void render_spans_16_c2_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
1699                  #else
1700                  static void render_spans_16_c2_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
1701                  #endif
7271702               #endif
7281703            #else
729               #if defined(ZCOMPARE)
730               static void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile)
1704               #if defined(ZUPDATE)
1705                  #if defined(ZCOMPARE)
1706                  static void render_spans_16_c2_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1707                  #else
1708                  static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1709                  #endif
7311710               #else
732               static void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile)
1711                  #if defined(ZCOMPARE)
1712                  static void render_spans_16_c2_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
1713                  #else
1714                  static void render_spans_16_c2_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
1715                  #endif
7331716               #endif
7341717            #endif
7351718         #else
736            #if defined(ZUPDATE)
737               #if defined(ZCOMPARE)
738               static void render_spans_16_c2_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
1719            #if defined(FLIP)
1720               #if defined(ZUPDATE)
1721                  #if defined(ZCOMPARE)
1722                  static void render_spans_16_c2_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1723                  #else
1724                  static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1725                  #endif
7391726               #else
740               static void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
1727                  #if defined(ZCOMPARE)
1728                  static void render_spans_16_c2_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
1729                  #else
1730                  static void render_spans_16_c2_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
1731                  #endif
7411732               #endif
7421733            #else
743               #if defined(ZCOMPARE)
744               static void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile)
1734               #if defined(ZUPDATE)
1735                  #if defined(ZCOMPARE)
1736                  static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1737                  #else
1738                  static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1739                  #endif
7451740               #else
746               static void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
1741                  #if defined(ZCOMPARE)
1742                  static void render_spans_16_c2_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
1743                  #else
1744                  static void render_spans_16_c2_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
1745                  #endif
7471746               #endif
7481747            #endif
7491748         #endif
7501749      #else
751         #if defined(FLIP)
752            #if defined(ZUPDATE)
753               #if defined(ZCOMPARE)
754               static void render_spans_16_c2_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
1750         #if defined(ZBUF)
1751            #if defined(FLIP)
1752               #if defined(ZUPDATE)
1753                  #if defined(ZCOMPARE)
1754                  static void render_spans_16_c2_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1755                  #else
1756                  static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1757                  #endif
7551758               #else
756               static void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
1759                  #if defined(ZCOMPARE)
1760                  static void render_spans_16_c2_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
1761                  #else
1762                  static void render_spans_16_c2_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
1763                  #endif
7571764               #endif
7581765            #else
759               #if defined(ZCOMPARE)
760               static void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile)
1766               #if defined(ZUPDATE)
1767                  #if defined(ZCOMPARE)
1768                  static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1769                  #else
1770                  static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1771                  #endif
7611772               #else
762               static void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
1773                  #if defined(ZCOMPARE)
1774                  static void render_spans_16_c2_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
1775                  #else
1776                  static void render_spans_16_c2_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
1777                  #endif
7631778               #endif
7641779            #endif
7651780         #else
766            #if defined(ZUPDATE)
767               #if defined(ZCOMPARE)
768               static void render_spans_16_c2_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
1781            #if defined(FLIP)
1782               #if defined(ZUPDATE)
1783                  #if defined(ZCOMPARE)
1784                  static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
1785                  #else
1786                  static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
1787                  #endif
7691788               #else
770               static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
1789                  #if defined(ZCOMPARE)
1790                  static void render_spans_16_c2_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
1791                  #else
1792                  static void render_spans_16_c2_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
1793                  #endif
7711794               #endif
7721795            #else
773               #if defined(ZCOMPARE)
774               static void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
1796               #if defined(ZUPDATE)
1797                  #if defined(ZCOMPARE)
1798                  static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
1799                  #else
1800                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
1801                  #endif
7751802               #else
776               static void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
1803                  #if defined(ZCOMPARE)
1804                  static void render_spans_16_c2_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
1805                  #else
1806                  static void render_spans_16_c2_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
1807                  #endif
7771808               #endif
7781809            #endif
7791810         #endif
r6795r6796
11062137                  }
11072138               }
11082139
1109               TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
1110               TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2);
2140               CACHE_TEXTURE_PARAMS(tex_tile);
2141               texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
2142
2143               CACHE_TEXTURE_PARAMS(tex_tile2);
2144               texel1_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile2);
11112145#endif
11122146
1113               COLOR_COMBINER2_C0(&c1);
1114               COLOR_COMBINER2_C1(&c2);
2147               c1.c = COLOR_COMBINER2_C0();
2148               c2.c = COLOR_COMBINER2_C1();
11152149
11162150#if defined(ZCOMPARE)
11172151#if !defined(ZBUF)
r6795r6796
11242158               if(z_compare_result)
11252159#endif
11262160               {
2161#if defined(ZUPDATE)
11272162                  int rendered = 0;
1128                  int dith = 0;
1129                  if (!other_modes.rgb_dither_sel)
1130                  {
1131                     dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
1132                  }
1133                  else if (other_modes.rgb_dither_sel == 1)
1134                  {
1135                     dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
1136                  }
2163#endif
2164#if defined(MAGICDITHER)
2165                  int dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
2166#elif defined(BAYERDITHER)
2167                  int dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
2168#endif
11372169
1138                  rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
2170#if defined(ZUPDATE)
2171#if defined(MAGICDITHER) || defined(BAYERDITHER)
2172                  rendered = BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
2173#else
2174                  rendered = BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
2175#endif
11392176
1140#if defined(ZUPDATE)
11412177                  if (rendered)
11422178                  {
11432179                     z_store(zbcur, zhbcur, sz, dzpix);
11442180                  }
2181#else
2182#if defined(MAGICDITHER) || defined(BAYERDITHER)
2183                  BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
2184#else
2185                  BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
11452186#endif
2187
2188#endif
11462189               }
11472190            }
11482191         }
src/mame/video/rdpspn16.h
r6795r6796
1INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
2INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
3INLINE void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
4INLINE void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
5INLINE void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
6INLINE void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
7INLINE void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile);
8INLINE void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile);
9INLINE void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
10INLINE void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
11INLINE void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
12INLINE void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
13INLINE void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
14INLINE void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
15INLINE void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile);
16INLINE void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile);
17INLINE void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
18INLINE void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
19INLINE void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile);
20INLINE void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile);
21INLINE void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile);
22INLINE void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile);
23INLINE void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile);
24INLINE void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile);
25INLINE void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
26INLINE void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
27INLINE void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile);
28INLINE void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile);
29INLINE void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile);
30INLINE void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile);
31INLINE void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile);
32INLINE void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile);
1static void render_spans_16_c1_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
2static void render_spans_16_c2_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
3static void render_spans_16_c1_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
4static void render_spans_16_c2_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
5static void render_spans_16_c1_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
6static void render_spans_16_c2_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
7static void render_spans_16_c1_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
8static void render_spans_16_c2_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
9static void render_spans_16_c1_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
10static void render_spans_16_c2_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
11static void render_spans_16_c1_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
12static void render_spans_16_c2_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
13static void render_spans_16_c1_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
14static void render_spans_16_c2_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
15static void render_spans_16_c1_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
16static void render_spans_16_c2_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
17static void render_spans_16_c1_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
18static void render_spans_16_c2_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
19static void render_spans_16_c1_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
20static void render_spans_16_c2_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
21static void render_spans_16_c1_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
22static void render_spans_16_c2_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
23static void render_spans_16_c1_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
24static void render_spans_16_c2_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
25static void render_spans_16_c1_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
26static void render_spans_16_c2_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
27static void render_spans_16_c1_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
28static void render_spans_16_c2_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
29static void render_spans_16_c1_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
30static void render_spans_16_c2_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
31static void render_spans_16_c1_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
32static void render_spans_16_c2_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
3333
34INLINE void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
35INLINE void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
36INLINE void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile);
37INLINE void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile);
38INLINE void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile);
39INLINE void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile);
40INLINE void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile);
41INLINE void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile);
42INLINE void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
43INLINE void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
44INLINE void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile);
45INLINE void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile);
46INLINE void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile);
47INLINE void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile);
48INLINE void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile);
49INLINE void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile);
50INLINE void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile);
51INLINE void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile);
52INLINE void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile);
53INLINE void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile);
54INLINE void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile);
55INLINE void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile);
56INLINE void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile);
57INLINE void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile);
58INLINE void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile);
59INLINE void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile);
60INLINE void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile);
61INLINE void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile);
62INLINE void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile);
63INLINE void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile);
64INLINE void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile);
65INLINE void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile);
34static void render_spans_16_c1_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
35static void render_spans_16_c2_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
36static void render_spans_16_c1_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
37static void render_spans_16_c2_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
38static void render_spans_16_c1_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
39static void render_spans_16_c2_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
40static void render_spans_16_c1_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
41static void render_spans_16_c2_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
42static void render_spans_16_c1_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
43static void render_spans_16_c2_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
44static void render_spans_16_c1_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
45static void render_spans_16_c2_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
46static void render_spans_16_c1_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
47static void render_spans_16_c2_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
48static void render_spans_16_c1_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
49static void render_spans_16_c2_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
50static void render_spans_16_c1_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
51static void render_spans_16_c2_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
52static void render_spans_16_c1_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
53static void render_spans_16_c2_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
54static void render_spans_16_c1_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
55static void render_spans_16_c2_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
56static void render_spans_16_c1_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
57static void render_spans_16_c2_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
58static void render_spans_16_c1_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
59static void render_spans_16_c2_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
60static void render_spans_16_c1_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
61static void render_spans_16_c2_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
62static void render_spans_16_c1_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
63static void render_spans_16_c2_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
64static void render_spans_16_c1_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
65static void render_spans_16_c2_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
6666
67INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
68INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
69INLINE void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
70INLINE void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
71INLINE void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
72INLINE void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
73INLINE void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
74INLINE void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
75INLINE void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
76INLINE void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
77INLINE void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
78INLINE void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
79INLINE void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
80INLINE void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
81INLINE void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
82INLINE void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
83INLINE void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
84INLINE void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
85INLINE void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
86INLINE void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
87INLINE void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
88INLINE void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
89INLINE void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
90INLINE void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
91INLINE void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
92INLINE void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
93INLINE void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
94INLINE void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
95INLINE void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
96INLINE void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
97INLINE void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
98INLINE void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
67static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
68static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
69static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
70static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
71static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
72static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
73static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
74static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
75static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
76static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
77static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
78static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
79static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
80static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
81static void render_spans_16_c1_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
82static void render_spans_16_c2_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
83static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
84static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
85static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
86static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
87static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
88static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
89static void render_spans_16_c1_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
90static void render_spans_16_c2_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
91static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
92static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
93static void render_spans_16_c1_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
94static void render_spans_16_c2_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
95static void render_spans_16_c1_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
96static void render_spans_16_c2_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
97static void render_spans_16_c1_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
98static void render_spans_16_c2_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
9999
100INLINE void render_spans_16_c1_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
101INLINE void render_spans_16_c2_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
102INLINE void render_spans_16_c1_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
103INLINE void render_spans_16_c2_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
104INLINE void render_spans_16_c1_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
105INLINE void render_spans_16_c2_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
106INLINE void render_spans_16_c1_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
107INLINE void render_spans_16_c2_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
108INLINE void render_spans_16_c1_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
109INLINE void render_spans_16_c2_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
110INLINE void render_spans_16_c1_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
111INLINE void render_spans_16_c2_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
112INLINE void render_spans_16_c1_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
113INLINE void render_spans_16_c2_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
114INLINE void render_spans_16_c1_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
115INLINE void render_spans_16_c2_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
116INLINE void render_spans_16_c1_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
117INLINE void render_spans_16_c2_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
118INLINE void render_spans_16_c1_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
119INLINE void render_spans_16_c2_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
120INLINE void render_spans_16_c1_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
121INLINE void render_spans_16_c2_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
122INLINE void render_spans_16_c1_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
123INLINE void render_spans_16_c2_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
124INLINE void render_spans_16_c1_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
125INLINE void render_spans_16_c2_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
126INLINE void render_spans_16_c1_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
127INLINE void render_spans_16_c2_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
128INLINE void render_spans_16_c1_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
129INLINE void render_spans_16_c2_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
130INLINE void render_spans_16_c1_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
131INLINE void render_spans_16_c2_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
100static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
101static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
102static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
103static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
104static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
105static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
106static void render_spans_16_c1_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
107static void render_spans_16_c2_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
108static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
109static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
110static void render_spans_16_c1_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
111static void render_spans_16_c2_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
112static void render_spans_16_c1_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
113static void render_spans_16_c2_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
114static void render_spans_16_c1_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
115static void render_spans_16_c2_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
116static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
117static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
118static void render_spans_16_c1_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
119static void render_spans_16_c2_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
120static void render_spans_16_c1_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
121static void render_spans_16_c2_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
122static void render_spans_16_c1_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
123static void render_spans_16_c2_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
124static void render_spans_16_c1_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
125static void render_spans_16_c2_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
126static void render_spans_16_c1_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
127static void render_spans_16_c2_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
128static void render_spans_16_c1_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
129static void render_spans_16_c2_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
130static void render_spans_16_c1_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
131static void render_spans_16_c2_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
132132
133static void (*rdp_render_spans_16_func[128])(int, int, TILE*) =
133static void render_spans_16_c1_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
134static void render_spans_16_c2_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
135static void render_spans_16_c1_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
136static void render_spans_16_c2_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
137static void render_spans_16_c1_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
138static void render_spans_16_c2_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
139static void render_spans_16_c1_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
140static void render_spans_16_c2_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
141static void render_spans_16_c1_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
142static void render_spans_16_c2_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
143static void render_spans_16_c1_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
144static void render_spans_16_c2_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
145static void render_spans_16_c1_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
146static void render_spans_16_c2_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
147static void render_spans_16_c1_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
148static void render_spans_16_c2_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
149static void render_spans_16_c1_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
150static void render_spans_16_c2_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
151static void render_spans_16_c1_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
152static void render_spans_16_c2_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
153static void render_spans_16_c1_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
154static void render_spans_16_c2_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
155static void render_spans_16_c1_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
156static void render_spans_16_c2_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
157static void render_spans_16_c1_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
158static void render_spans_16_c2_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
159static void render_spans_16_c1_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
160static void render_spans_16_c2_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
161static void render_spans_16_c1_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
162static void render_spans_16_c2_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
163static void render_spans_16_c1_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
164static void render_spans_16_c2_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
165
166static void render_spans_16_c1_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
167static void render_spans_16_c2_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
168static void render_spans_16_c1_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
169static void render_spans_16_c2_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
170static void render_spans_16_c1_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
171static void render_spans_16_c2_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
172static void render_spans_16_c1_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
173static void render_spans_16_c2_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
174static void render_spans_16_c1_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
175static void render_spans_16_c2_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
176static void render_spans_16_c1_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
177static void render_spans_16_c2_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
178static void render_spans_16_c1_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
179static void render_spans_16_c2_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
180static void render_spans_16_c1_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
181static void render_spans_16_c2_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
182static void render_spans_16_c1_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
183static void render_spans_16_c2_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
184static void render_spans_16_c1_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
185static void render_spans_16_c2_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
186static void render_spans_16_c1_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
187static void render_spans_16_c2_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
188static void render_spans_16_c1_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile);
189static void render_spans_16_c2_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile);
190static void render_spans_16_c1_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
191static void render_spans_16_c2_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
192static void render_spans_16_c1_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
193static void render_spans_16_c2_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
194static void render_spans_16_c1_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
195static void render_spans_16_c2_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
196static void render_spans_16_c1_s_t_z_f_zc_db(int start, int end, TILE* tex_tile);
197static void render_spans_16_c2_s_t_z_f_zc_db(int start, int end, TILE* tex_tile);
198
199static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
200static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
201static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
202static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
203static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
204static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
205static void render_spans_16_c1_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
206static void render_spans_16_c2_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
207static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
208static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
209static void render_spans_16_c1_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
210static void render_spans_16_c2_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
211static void render_spans_16_c1_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
212static void render_spans_16_c2_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
213static void render_spans_16_c1_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
214static void render_spans_16_c2_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
215static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
216static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
217static void render_spans_16_c1_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
218static void render_spans_16_c2_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
219static void render_spans_16_c1_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
220static void render_spans_16_c2_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
221static void render_spans_16_c1_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
222static void render_spans_16_c2_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
223static void render_spans_16_c1_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
224static void render_spans_16_c2_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
225static void render_spans_16_c1_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
226static void render_spans_16_c2_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
227static void render_spans_16_c1_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
228static void render_spans_16_c2_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
229static void render_spans_16_c1_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
230static void render_spans_16_c2_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
231
232static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
233static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
234static void render_spans_16_c1_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
235static void render_spans_16_c2_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
236static void render_spans_16_c1_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
237static void render_spans_16_c2_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
238static void render_spans_16_c1_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
239static void render_spans_16_c2_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
240static void render_spans_16_c1_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
241static void render_spans_16_c2_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
242static void render_spans_16_c1_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
243static void render_spans_16_c2_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
244static void render_spans_16_c1_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
245static void render_spans_16_c2_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
246static void render_spans_16_c1_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
247static void render_spans_16_c2_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
248static void render_spans_16_c1_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
249static void render_spans_16_c2_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
250static void render_spans_16_c1_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
251static void render_spans_16_c2_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
252static void render_spans_16_c1_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
253static void render_spans_16_c2_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
254static void render_spans_16_c1_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
255static void render_spans_16_c2_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
256static void render_spans_16_c1_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
257static void render_spans_16_c2_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
258static void render_spans_16_c1_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
259static void render_spans_16_c2_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
260static void render_spans_16_c1_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
261static void render_spans_16_c2_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
262static void render_spans_16_c1_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
263static void render_spans_16_c2_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
264
265static void render_spans_16_c1_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
266static void render_spans_16_c2_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
267static void render_spans_16_c1_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
268static void render_spans_16_c2_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
269static void render_spans_16_c1_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
270static void render_spans_16_c2_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
271static void render_spans_16_c1_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
272static void render_spans_16_c2_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
273static void render_spans_16_c1_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
274static void render_spans_16_c2_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
275static void render_spans_16_c1_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
276static void render_spans_16_c2_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
277static void render_spans_16_c1_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
278static void render_spans_16_c2_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
279static void render_spans_16_c1_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
280static void render_spans_16_c2_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
281static void render_spans_16_c1_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
282static void render_spans_16_c2_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
283static void render_spans_16_c1_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
284static void render_spans_16_c2_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
285static void render_spans_16_c1_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
286static void render_spans_16_c2_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
287static void render_spans_16_c1_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
288static void render_spans_16_c2_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
289static void render_spans_16_c1_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
290static void render_spans_16_c2_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
291static void render_spans_16_c1_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
292static void render_spans_16_c2_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
293static void render_spans_16_c1_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
294static void render_spans_16_c2_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
295static void render_spans_16_c1_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
296static void render_spans_16_c2_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
297
298static void render_spans_16_c1_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
299static void render_spans_16_c2_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
300static void render_spans_16_c1_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
301static void render_spans_16_c2_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
302static void render_spans_16_c1_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
303static void render_spans_16_c2_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
304static void render_spans_16_c1_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
305static void render_spans_16_c2_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
306static void render_spans_16_c1_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
307static void render_spans_16_c2_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
308static void render_spans_16_c1_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
309static void render_spans_16_c2_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
310static void render_spans_16_c1_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
311static void render_spans_16_c2_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
312static void render_spans_16_c1_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
313static void render_spans_16_c2_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
314static void render_spans_16_c1_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
315static void render_spans_16_c2_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
316static void render_spans_16_c1_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
317static void render_spans_16_c2_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
318static void render_spans_16_c1_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
319static void render_spans_16_c2_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
320static void render_spans_16_c1_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
321static void render_spans_16_c2_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
322static void render_spans_16_c1_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
323static void render_spans_16_c2_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
324static void render_spans_16_c1_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
325static void render_spans_16_c2_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
326static void render_spans_16_c1_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
327static void render_spans_16_c2_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
328static void render_spans_16_c1_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
329static void render_spans_16_c2_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
330
331static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
332static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
333static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
334static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
335static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
336static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
337static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
338static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
339static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
340static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
341static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
342static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
343static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
344static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
345static void render_spans_16_c1_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
346static void render_spans_16_c2_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
347static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
348static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
349static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
350static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
351static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
352static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
353static void render_spans_16_c1_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
354static void render_spans_16_c2_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
355static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
356static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
357static void render_spans_16_c1_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
358static void render_spans_16_c2_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
359static void render_spans_16_c1_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
360static void render_spans_16_c2_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
361static void render_spans_16_c1_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
362static void render_spans_16_c2_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
363
364static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
365static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
366static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
367static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
368static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
369static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
370static void render_spans_16_c1_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
371static void render_spans_16_c2_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
372static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
373static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
374static void render_spans_16_c1_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
375static void render_spans_16_c2_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
376static void render_spans_16_c1_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
377static void render_spans_16_c2_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
378static void render_spans_16_c1_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
379static void render_spans_16_c2_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
380static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
381static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
382static void render_spans_16_c1_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
383static void render_spans_16_c2_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
384static void render_spans_16_c1_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
385static void render_spans_16_c2_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
386static void render_spans_16_c1_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
387static void render_spans_16_c2_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
388static void render_spans_16_c1_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
389static void render_spans_16_c2_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
390static void render_spans_16_c1_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
391static void render_spans_16_c2_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
392static void render_spans_16_c1_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
393static void render_spans_16_c2_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
394static void render_spans_16_c1_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
395static void render_spans_16_c2_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
396
397static void (*rdp_render_spans_16_func[512])(int, int, TILE*) =
134398{
135   render_spans_16_c1_ns_nt_nz_nf_nzc, render_spans_16_c2_ns_nt_nz_nf_nzc,
136   render_spans_16_c1_ns_nt_z_nf_nzc,    render_spans_16_c2_ns_nt_z_nf_nzc,
137   render_spans_16_c1_ns_t_nz_nf_nzc,    render_spans_16_c2_ns_t_nz_nf_nzc,
138   render_spans_16_c1_ns_t_z_nf_nzc,    render_spans_16_c2_ns_t_z_nf_nzc,
139   render_spans_16_c1_s_nt_nz_nf_nzc,    render_spans_16_c2_s_nt_nz_nf_nzc,
140   render_spans_16_c1_s_nt_z_nf_nzc,    render_spans_16_c2_s_nt_z_nf_nzc,
141   render_spans_16_c1_s_t_nz_nf_nzc,    render_spans_16_c2_s_t_nz_nf_nzc,
142   render_spans_16_c1_s_t_z_nf_nzc,    render_spans_16_c2_s_t_z_nf_nzc,
143   render_spans_16_c1_ns_nt_nz_f_nzc,    render_spans_16_c2_ns_nt_nz_f_nzc,
144   render_spans_16_c1_ns_nt_z_f_nzc,    render_spans_16_c2_ns_nt_z_f_nzc,
145   render_spans_16_c1_ns_t_nz_f_nzc,    render_spans_16_c2_ns_t_nz_f_nzc,
146   render_spans_16_c1_ns_t_z_f_nzc,    render_spans_16_c2_ns_t_z_f_nzc,
147   render_spans_16_c1_s_nt_nz_f_nzc,    render_spans_16_c2_s_nt_nz_f_nzc,
148   render_spans_16_c1_s_nt_z_f_nzc,    render_spans_16_c2_s_nt_z_f_nzc,
149   render_spans_16_c1_s_t_nz_f_nzc,    render_spans_16_c2_s_t_nz_f_nzc,
150   render_spans_16_c1_s_t_z_f_nzc,    render_spans_16_c2_s_t_z_f_nzc,
399   render_spans_16_c1_ns_nt_nz_nf_nzc_dm,    render_spans_16_c2_ns_nt_nz_nf_nzc_dm,
400   render_spans_16_c1_ns_nt_z_nf_nzc_dm,    render_spans_16_c2_ns_nt_z_nf_nzc_dm,
401   render_spans_16_c1_ns_t_nz_nf_nzc_dm,    render_spans_16_c2_ns_t_nz_nf_nzc_dm,
402   render_spans_16_c1_ns_t_z_nf_nzc_dm,    render_spans_16_c2_ns_t_z_nf_nzc_dm,
403   render_spans_16_c1_s_nt_nz_nf_nzc_dm,    render_spans_16_c2_s_nt_nz_nf_nzc_dm,
404   render_spans_16_c1_s_nt_z_nf_nzc_dm,    render_spans_16_c2_s_nt_z_nf_nzc_dm,
405   render_spans_16_c1_s_t_nz_nf_nzc_dm,    render_spans_16_c2_s_t_nz_nf_nzc_dm,
406   render_spans_16_c1_s_t_z_nf_nzc_dm,    render_spans_16_c2_s_t_z_nf_nzc_dm,
407   render_spans_16_c1_ns_nt_nz_f_nzc_dm,    render_spans_16_c2_ns_nt_nz_f_nzc_dm,
408   render_spans_16_c1_ns_nt_z_f_nzc_dm,    render_spans_16_c2_ns_nt_z_f_nzc_dm,
409   render_spans_16_c1_ns_t_nz_f_nzc_dm,    render_spans_16_c2_ns_t_nz_f_nzc_dm,
410   render_spans_16_c1_ns_t_z_f_nzc_dm,    render_spans_16_c2_ns_t_z_f_nzc_dm,
411   render_spans_16_c1_s_nt_nz_f_nzc_dm,    render_spans_16_c2_s_nt_nz_f_nzc_dm,
412   render_spans_16_c1_s_nt_z_f_nzc_dm,    render_spans_16_c2_s_nt_z_f_nzc_dm,
413   render_spans_16_c1_s_t_nz_f_nzc_dm,    render_spans_16_c2_s_t_nz_f_nzc_dm,
414   render_spans_16_c1_s_t_z_f_nzc_dm,       render_spans_16_c2_s_t_z_f_nzc_dm,
151415
152   render_spans_16_c1_ns_nt_nz_nf_zc,   render_spans_16_c2_ns_nt_nz_nf_zc,
153   render_spans_16_c1_ns_nt_z_nf_zc,    render_spans_16_c2_ns_nt_z_nf_zc,
154   render_spans_16_c1_ns_t_nz_nf_zc,    render_spans_16_c2_ns_t_nz_nf_zc,
155   render_spans_16_c1_ns_t_z_nf_zc,    render_spans_16_c2_ns_t_z_nf_zc,
156   render_spans_16_c1_s_nt_nz_nf_zc,    render_spans_16_c2_s_nt_nz_nf_zc,
157   render_spans_16_c1_s_nt_z_nf_zc,    render_spans_16_c2_s_nt_z_nf_zc,
158   render_spans_16_c1_s_t_nz_nf_zc,    render_spans_16_c2_s_t_nz_nf_zc,
159   render_spans_16_c1_s_t_z_nf_zc,    render_spans_16_c2_s_t_z_nf_zc,
160   render_spans_16_c1_ns_nt_nz_f_zc,    render_spans_16_c2_ns_nt_nz_f_zc,
161   render_spans_16_c1_ns_nt_z_f_zc,    render_spans_16_c2_ns_nt_z_f_zc,
162   render_spans_16_c1_ns_t_nz_f_zc,    render_spans_16_c2_ns_t_nz_f_zc,
163   render_spans_16_c1_ns_t_z_f_zc,    render_spans_16_c2_ns_t_z_f_zc,
164   render_spans_16_c1_s_nt_nz_f_zc,    render_spans_16_c2_s_nt_nz_f_zc,
165   render_spans_16_c1_s_nt_z_f_zc,    render_spans_16_c2_s_nt_z_f_zc,
166   render_spans_16_c1_s_t_nz_f_zc,    render_spans_16_c2_s_t_nz_f_zc,
167   render_spans_16_c1_s_t_z_f_zc,       render_spans_16_c2_s_t_z_f_zc,
416   render_spans_16_c1_ns_nt_nz_nf_zc_dm,   render_spans_16_c2_ns_nt_nz_nf_zc_dm,
417   render_spans_16_c1_ns_nt_z_nf_zc_dm,    render_spans_16_c2_ns_nt_z_nf_zc_dm,
418   render_spans_16_c1_ns_t_nz_nf_zc_dm,    render_spans_16_c2_ns_t_nz_nf_zc_dm,
419   render_spans_16_c1_ns_t_z_nf_zc_dm,    render_spans_16_c2_ns_t_z_nf_zc_dm,
420   render_spans_16_c1_s_nt_nz_nf_zc_dm,    render_spans_16_c2_s_nt_nz_nf_zc_dm,
421   render_spans_16_c1_s_nt_z_nf_zc_dm,    render_spans_16_c2_s_nt_z_nf_zc_dm,
422   render_spans_16_c1_s_t_nz_nf_zc_dm,    render_spans_16_c2_s_t_nz_nf_zc_dm,
423   render_spans_16_c1_s_t_z_nf_zc_dm,       render_spans_16_c2_s_t_z_nf_zc_dm,
424   render_spans_16_c1_ns_nt_nz_f_zc_dm,    render_spans_16_c2_ns_nt_nz_f_zc_dm,
425   render_spans_16_c1_ns_nt_z_f_zc_dm,    render_spans_16_c2_ns_nt_z_f_zc_dm,
426   render_spans_16_c1_ns_t_nz_f_zc_dm,    render_spans_16_c2_ns_t_nz_f_zc_dm,
427   render_spans_16_c1_ns_t_z_f_zc_dm,       render_spans_16_c2_ns_t_z_f_zc_dm,
428   render_spans_16_c1_s_nt_nz_f_zc_dm,    render_spans_16_c2_s_nt_nz_f_zc_dm,
429   render_spans_16_c1_s_nt_z_f_zc_dm,       render_spans_16_c2_s_nt_z_f_zc_dm,
430   render_spans_16_c1_s_t_nz_f_zc_dm,       render_spans_16_c2_s_t_nz_f_zc_dm,
431   render_spans_16_c1_s_t_z_f_zc_dm,       render_spans_16_c2_s_t_z_f_zc_dm,
168432
169   render_spans_16_c1_ns_nt_nz_nf_nzc_zu,    render_spans_16_c2_ns_nt_nz_nf_nzc_zu,
170   render_spans_16_c1_ns_nt_z_nf_nzc_zu,    render_spans_16_c2_ns_nt_z_nf_nzc_zu,
171   render_spans_16_c1_ns_t_nz_nf_nzc_zu,    render_spans_16_c2_ns_t_nz_nf_nzc_zu,
172   render_spans_16_c1_ns_t_z_nf_nzc_zu,    render_spans_16_c2_ns_t_z_nf_nzc_zu,
173   render_spans_16_c1_s_nt_nz_nf_nzc_zu,    render_spans_16_c2_s_nt_nz_nf_nzc_zu,
174   render_spans_16_c1_s_nt_z_nf_nzc_zu,    render_spans_16_c2_s_nt_z_nf_nzc_zu,
175   render_spans_16_c1_s_t_nz_nf_nzc_zu,    render_spans_16_c2_s_t_nz_nf_nzc_zu,
176   render_spans_16_c1_s_t_z_nf_nzc_zu,    render_spans_16_c2_s_t_z_nf_nzc_zu,
177   render_spans_16_c1_ns_nt_nz_f_nzc_zu,    render_spans_16_c2_ns_nt_nz_f_nzc_zu,
178   render_spans_16_c1_ns_nt_z_f_nzc_zu,    render_spans_16_c2_ns_nt_z_f_nzc_zu,
179   render_spans_16_c1_ns_t_nz_f_nzc_zu,    render_spans_16_c2_ns_t_nz_f_nzc_zu,
180   render_spans_16_c1_ns_t_z_f_nzc_zu,    render_spans_16_c2_ns_t_z_f_nzc_zu,
181   render_spans_16_c1_s_nt_nz_f_nzc_zu,    render_spans_16_c2_s_nt_nz_f_nzc_zu,
182   render_spans_16_c1_s_nt_z_f_nzc_zu,    render_spans_16_c2_s_nt_z_f_nzc_zu,
183   render_spans_16_c1_s_t_nz_f_nzc_zu,    render_spans_16_c2_s_t_nz_f_nzc_zu,
184   render_spans_16_c1_s_t_z_f_nzc_zu,       render_spans_16_c2_s_t_z_f_nzc_zu,
433   render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm,    render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm,
434   render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm,    render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm,
435   render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm,    render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm,
436   render_spans_16_c1_ns_t_z_nf_nzc_zu_dm,    render_spans_16_c2_ns_t_z_nf_nzc_zu_dm,
437   render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm,    render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm,
438   render_spans_16_c1_s_nt_z_nf_nzc_zu_dm,    render_spans_16_c2_s_nt_z_nf_nzc_zu_dm,
439   render_spans_16_c1_s_t_nz_nf_nzc_zu_dm,    render_spans_16_c2_s_t_nz_nf_nzc_zu_dm,
440   render_spans_16_c1_s_t_z_nf_nzc_zu_dm,       render_spans_16_c2_s_t_z_nf_nzc_zu_dm,
441   render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm,    render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm,
442   render_spans_16_c1_ns_nt_z_f_nzc_zu_dm,    render_spans_16_c2_ns_nt_z_f_nzc_zu_dm,
443   render_spans_16_c1_ns_t_nz_f_nzc_zu_dm,    render_spans_16_c2_ns_t_nz_f_nzc_zu_dm,
444   render_spans_16_c1_ns_t_z_f_nzc_zu_dm,       render_spans_16_c2_ns_t_z_f_nzc_zu_dm,
445   render_spans_16_c1_s_nt_nz_f_nzc_zu_dm,    render_spans_16_c2_s_nt_nz_f_nzc_zu_dm,
446   render_spans_16_c1_s_nt_z_f_nzc_zu_dm,       render_spans_16_c2_s_nt_z_f_nzc_zu_dm,
447   render_spans_16_c1_s_t_nz_f_nzc_zu_dm,       render_spans_16_c2_s_t_nz_f_nzc_zu_dm,
448   render_spans_16_c1_s_t_z_f_nzc_zu_dm,       render_spans_16_c2_s_t_z_f_nzc_zu_dm,
185449
186   render_spans_16_c1_ns_nt_nz_nf_zc_zu,   render_spans_16_c2_ns_nt_nz_nf_zc_zu,
187   render_spans_16_c1_ns_nt_z_nf_zc_zu,    render_spans_16_c2_ns_nt_z_nf_zc_zu,
188   render_spans_16_c1_ns_t_nz_nf_zc_zu,    render_spans_16_c2_ns_t_nz_nf_zc_zu,
189   render_spans_16_c1_ns_t_z_nf_zc_zu,    render_spans_16_c2_ns_t_z_nf_zc_zu,
190   render_spans_16_c1_s_nt_nz_nf_zc_zu,    render_spans_16_c2_s_nt_nz_nf_zc_zu,
191   render_spans_16_c1_s_nt_z_nf_zc_zu,    render_spans_16_c2_s_nt_z_nf_zc_zu,
192   render_spans_16_c1_s_t_nz_nf_zc_zu,    render_spans_16_c2_s_t_nz_nf_zc_zu,
193   render_spans_16_c1_s_t_z_nf_zc_zu,       render_spans_16_c2_s_t_z_nf_zc_zu,
194   render_spans_16_c1_ns_nt_nz_f_zc_zu,    render_spans_16_c2_ns_nt_nz_f_zc_zu,
195   render_spans_16_c1_ns_nt_z_f_zc_zu,    render_spans_16_c2_ns_nt_z_f_zc_zu,
196   render_spans_16_c1_ns_t_nz_f_zc_zu,    render_spans_16_c2_ns_t_nz_f_zc_zu,
197   render_spans_16_c1_ns_t_z_f_zc_zu,       render_spans_16_c2_ns_t_z_f_zc_zu,
198   render_spans_16_c1_s_nt_nz_f_zc_zu,    render_spans_16_c2_s_nt_nz_f_zc_zu,
199   render_spans_16_c1_s_nt_z_f_zc_zu,       render_spans_16_c2_s_nt_z_f_zc_zu,
200   render_spans_16_c1_s_t_nz_f_zc_zu,       render_spans_16_c2_s_t_nz_f_zc_zu,
201   render_spans_16_c1_s_t_z_f_zc_zu,       render_spans_16_c2_s_t_z_f_zc_zu,
450   render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm,   render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm,
451   render_spans_16_c1_ns_nt_z_nf_zc_zu_dm,    render_spans_16_c2_ns_nt_z_nf_zc_zu_dm,
452   render_spans_16_c1_ns_t_nz_nf_zc_zu_dm,    render_spans_16_c2_ns_t_nz_nf_zc_zu_dm,
453   render_spans_16_c1_ns_t_z_nf_zc_zu_dm,       render_spans_16_c2_ns_t_z_nf_zc_zu_dm,
454   render_spans_16_c1_s_nt_nz_nf_zc_zu_dm,    render_spans_16_c2_s_nt_nz_nf_zc_zu_dm,
455   render_spans_16_c1_s_nt_z_nf_zc_zu_dm,       render_spans_16_c2_s_nt_z_nf_zc_zu_dm,
456   render_spans_16_c1_s_t_nz_nf_zc_zu_dm,       render_spans_16_c2_s_t_nz_nf_zc_zu_dm,
457   render_spans_16_c1_s_t_z_nf_zc_zu_dm,       render_spans_16_c2_s_t_z_nf_zc_zu_dm,
458   render_spans_16_c1_ns_nt_nz_f_zc_zu_dm,    render_spans_16_c2_ns_nt_nz_f_zc_zu_dm,
459   render_spans_16_c1_ns_nt_z_f_zc_zu_dm,       render_spans_16_c2_ns_nt_z_f_zc_zu_dm,
460   render_spans_16_c1_ns_t_nz_f_zc_zu_dm,       render_spans_16_c2_ns_t_nz_f_zc_zu_dm,
461   render_spans_16_c1_ns_t_z_f_zc_zu_dm,       render_spans_16_c2_ns_t_z_f_zc_zu_dm,
462   render_spans_16_c1_s_nt_nz_f_zc_zu_dm,       render_spans_16_c2_s_nt_nz_f_zc_zu_dm,
463   render_spans_16_c1_s_nt_z_f_zc_zu_dm,       render_spans_16_c2_s_nt_z_f_zc_zu_dm,
464   render_spans_16_c1_s_t_nz_f_zc_zu_dm,       render_spans_16_c2_s_t_nz_f_zc_zu_dm,
465   render_spans_16_c1_s_t_z_f_zc_zu_dm,       render_spans_16_c2_s_t_z_f_zc_zu_dm,
466
467   render_spans_16_c1_ns_nt_nz_nf_nzc_db, render_spans_16_c2_ns_nt_nz_nf_nzc_db,
468   render_spans_16_c1_ns_nt_z_nf_nzc_db,    render_spans_16_c2_ns_nt_z_nf_nzc_db,
469   render_spans_16_c1_ns_t_nz_nf_nzc_db,    render_spans_16_c2_ns_t_nz_nf_nzc_db,
470   render_spans_16_c1_ns_t_z_nf_nzc_db,    render_spans_16_c2_ns_t_z_nf_nzc_db,
471   render_spans_16_c1_s_nt_nz_nf_nzc_db,    render_spans_16_c2_s_nt_nz_nf_nzc_db,
472   render_spans_16_c1_s_nt_z_nf_nzc_db,    render_spans_16_c2_s_nt_z_nf_nzc_db,
473   render_spans_16_c1_s_t_nz_nf_nzc_db,    render_spans_16_c2_s_t_nz_nf_nzc_db,
474   render_spans_16_c1_s_t_z_nf_nzc_db,    render_spans_16_c2_s_t_z_nf_nzc_db,
475   render_spans_16_c1_ns_nt_nz_f_nzc_db,    render_spans_16_c2_ns_nt_nz_f_nzc_db,
476   render_spans_16_c1_ns_nt_z_f_nzc_db,    render_spans_16_c2_ns_nt_z_f_nzc_db,
477   render_spans_16_c1_ns_t_nz_f_nzc_db,    render_spans_16_c2_ns_t_nz_f_nzc_db,
478   render_spans_16_c1_ns_t_z_f_nzc_db,    render_spans_16_c2_ns_t_z_f_nzc_db,
479   render_spans_16_c1_s_nt_nz_f_nzc_db,    render_spans_16_c2_s_nt_nz_f_nzc_db,
480   render_spans_16_c1_s_nt_z_f_nzc_db,    render_spans_16_c2_s_nt_z_f_nzc_db,
481   render_spans_16_c1_s_t_nz_f_nzc_db,    render_spans_16_c2_s_t_nz_f_nzc_db,
482   render_spans_16_c1_s_t_z_f_nzc_db,    render_spans_16_c2_s_t_z_f_nzc_db,
483
484   render_spans_16_c1_ns_nt_nz_nf_zc_db,   render_spans_16_c2_ns_nt_nz_nf_zc_db,
485   render_spans_16_c1_ns_nt_z_nf_zc_db,    render_spans_16_c2_ns_nt_z_nf_zc_db,
486   render_spans_16_c1_ns_t_nz_nf_zc_db,    render_spans_16_c2_ns_t_nz_nf_zc_db,
487   render_spans_16_c1_ns_t_z_nf_zc_db,    render_spans_16_c2_ns_t_z_nf_zc_db,
488   render_spans_16_c1_s_nt_nz_nf_zc_db,    render_spans_16_c2_s_nt_nz_nf_zc_db,
489   render_spans_16_c1_s_nt_z_nf_zc_db,    render_spans_16_c2_s_nt_z_nf_zc_db,
490   render_spans_16_c1_s_t_nz_nf_zc_db,    render_spans_16_c2_s_t_nz_nf_zc_db,
491   render_spans_16_c1_s_t_z_nf_zc_db,    render_spans_16_c2_s_t_z_nf_zc_db,
492   render_spans_16_c1_ns_nt_nz_f_zc_db,    render_spans_16_c2_ns_nt_nz_f_zc_db,
493   render_spans_16_c1_ns_nt_z_f_zc_db,    render_spans_16_c2_ns_nt_z_f_zc_db,
494   render_spans_16_c1_ns_t_nz_f_zc_db,    render_spans_16_c2_ns_t_nz_f_zc_db,
495   render_spans_16_c1_ns_t_z_f_zc_db,    render_spans_16_c2_ns_t_z_f_zc_db,
496   render_spans_16_c1_s_nt_nz_f_zc_db,    render_spans_16_c2_s_nt_nz_f_zc_db,
497   render_spans_16_c1_s_nt_z_f_zc_db,    render_spans_16_c2_s_nt_z_f_zc_db,
498   render_spans_16_c1_s_t_nz_f_zc_db,    render_spans_16_c2_s_t_nz_f_zc_db,
499   render_spans_16_c1_s_t_z_f_zc_db,       render_spans_16_c2_s_t_z_f_zc_db,
500
501   render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db,    render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db,
502   render_spans_16_c1_ns_nt_z_nf_nzc_zu_db,    render_spans_16_c2_ns_nt_z_nf_nzc_zu_db,
503   render_spans_16_c1_ns_t_nz_nf_nzc_zu_db,    render_spans_16_c2_ns_t_nz_nf_nzc_zu_db,
504   render_spans_16_c1_ns_t_z_nf_nzc_zu_db,    render_spans_16_c2_ns_t_z_nf_nzc_zu_db,
505   render_spans_16_c1_s_nt_nz_nf_nzc_zu_db,    render_spans_16_c2_s_nt_nz_nf_nzc_zu_db,
506   render_spans_16_c1_s_nt_z_nf_nzc_zu_db,    render_spans_16_c2_s_nt_z_nf_nzc_zu_db,
507   render_spans_16_c1_s_t_nz_nf_nzc_zu_db,    render_spans_16_c2_s_t_nz_nf_nzc_zu_db,
508   render_spans_16_c1_s_t_z_nf_nzc_zu_db,    render_spans_16_c2_s_t_z_nf_nzc_zu_db,
509   render_spans_16_c1_ns_nt_nz_f_nzc_zu_db,    render_spans_16_c2_ns_nt_nz_f_nzc_zu_db,
510   render_spans_16_c1_ns_nt_z_f_nzc_zu_db,    render_spans_16_c2_ns_nt_z_f_nzc_zu_db,
511   render_spans_16_c1_ns_t_nz_f_nzc_zu_db,    render_spans_16_c2_ns_t_nz_f_nzc_zu_db,
512   render_spans_16_c1_ns_t_z_f_nzc_zu_db,    render_spans_16_c2_ns_t_z_f_nzc_zu_db,
513   render_spans_16_c1_s_nt_nz_f_nzc_zu_db,    render_spans_16_c2_s_nt_nz_f_nzc_zu_db,
514   render_spans_16_c1_s_nt_z_f_nzc_zu_db,    render_spans_16_c2_s_nt_z_f_nzc_zu_db,
515   render_spans_16_c1_s_t_nz_f_nzc_zu_db,    render_spans_16_c2_s_t_nz_f_nzc_zu_db,
516   render_spans_16_c1_s_t_z_f_nzc_zu_db,       render_spans_16_c2_s_t_z_f_nzc_zu_db,
517
518   render_spans_16_c1_ns_nt_nz_nf_zc_zu_db,   render_spans_16_c2_ns_nt_nz_nf_zc_zu_db,
519   render_spans_16_c1_ns_nt_z_nf_zc_zu_db,    render_spans_16_c2_ns_nt_z_nf_zc_zu_db,
520   render_spans_16_c1_ns_t_nz_nf_zc_zu_db,    render_spans_16_c2_ns_t_nz_nf_zc_zu_db,
521   render_spans_16_c1_ns_t_z_nf_zc_zu_db,    render_spans_16_c2_ns_t_z_nf_zc_zu_db,
522   render_spans_16_c1_s_nt_nz_nf_zc_zu_db,    render_spans_16_c2_s_nt_nz_nf_zc_zu_db,
523   render_spans_16_c1_s_nt_z_nf_zc_zu_db,    render_spans_16_c2_s_nt_z_nf_zc_zu_db,
524   render_spans_16_c1_s_t_nz_nf_zc_zu_db,    render_spans_16_c2_s_t_nz_nf_zc_zu_db,
525   render_spans_16_c1_s_t_z_nf_zc_zu_db,       render_spans_16_c2_s_t_z_nf_zc_zu_db,
526   render_spans_16_c1_ns_nt_nz_f_zc_zu_db,    render_spans_16_c2_ns_nt_nz_f_zc_zu_db,
527   render_spans_16_c1_ns_nt_z_f_zc_zu_db,    render_spans_16_c2_ns_nt_z_f_zc_zu_db,
528   render_spans_16_c1_ns_t_nz_f_zc_zu_db,    render_spans_16_c2_ns_t_nz_f_zc_zu_db,
529   render_spans_16_c1_ns_t_z_f_zc_zu_db,       render_spans_16_c2_ns_t_z_f_zc_zu_db,
530   render_spans_16_c1_s_nt_nz_f_zc_zu_db,    render_spans_16_c2_s_nt_nz_f_zc_zu_db,
531   render_spans_16_c1_s_nt_z_f_zc_zu_db,       render_spans_16_c2_s_nt_z_f_zc_zu_db,
532   render_spans_16_c1_s_t_nz_f_zc_zu_db,       render_spans_16_c2_s_t_nz_f_zc_zu_db,
533   render_spans_16_c1_s_t_z_f_zc_zu_db,       render_spans_16_c2_s_t_z_f_zc_zu_db,
534
535   render_spans_16_c1_ns_nt_nz_nf_nzc_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_dn,
536   render_spans_16_c1_ns_nt_z_nf_nzc_dn,    render_spans_16_c2_ns_nt_z_nf_nzc_dn,
537   render_spans_16_c1_ns_t_nz_nf_nzc_dn,    render_spans_16_c2_ns_t_nz_nf_nzc_dn,
538   render_spans_16_c1_ns_t_z_nf_nzc_dn,    render_spans_16_c2_ns_t_z_nf_nzc_dn,
539   render_spans_16_c1_s_nt_nz_nf_nzc_dn,    render_spans_16_c2_s_nt_nz_nf_nzc_dn,
540   render_spans_16_c1_s_nt_z_nf_nzc_dn,    render_spans_16_c2_s_nt_z_nf_nzc_dn,
541   render_spans_16_c1_s_t_nz_nf_nzc_dn,    render_spans_16_c2_s_t_nz_nf_nzc_dn,
542   render_spans_16_c1_s_t_z_nf_nzc_dn,    render_spans_16_c2_s_t_z_nf_nzc_dn,
543   render_spans_16_c1_ns_nt_nz_f_nzc_dn,    render_spans_16_c2_ns_nt_nz_f_nzc_dn,
544   render_spans_16_c1_ns_nt_z_f_nzc_dn,    render_spans_16_c2_ns_nt_z_f_nzc_dn,
545   render_spans_16_c1_ns_t_nz_f_nzc_dn,    render_spans_16_c2_ns_t_nz_f_nzc_dn,
546   render_spans_16_c1_ns_t_z_f_nzc_dn,    render_spans_16_c2_ns_t_z_f_nzc_dn,
547   render_spans_16_c1_s_nt_nz_f_nzc_dn,    render_spans_16_c2_s_nt_nz_f_nzc_dn,
548   render_spans_16_c1_s_nt_z_f_nzc_dn,    render_spans_16_c2_s_nt_z_f_nzc_dn,
549   render_spans_16_c1_s_t_nz_f_nzc_dn,    render_spans_16_c2_s_t_nz_f_nzc_dn,
550   render_spans_16_c1_s_t_z_f_nzc_dn,    render_spans_16_c2_s_t_z_f_nzc_dn,
551
552   render_spans_16_c1_ns_nt_nz_nf_zc_dn,   render_spans_16_c2_ns_nt_nz_nf_zc_dn,
553   render_spans_16_c1_ns_nt_z_nf_zc_dn,    render_spans_16_c2_ns_nt_z_nf_zc_dn,
554   render_spans_16_c1_ns_t_nz_nf_zc_dn,    render_spans_16_c2_ns_t_nz_nf_zc_dn,
555   render_spans_16_c1_ns_t_z_nf_zc_dn,    render_spans_16_c2_ns_t_z_nf_zc_dn,
556   render_spans_16_c1_s_nt_nz_nf_zc_dn,    render_spans_16_c2_s_nt_nz_nf_zc_dn,
557   render_spans_16_c1_s_nt_z_nf_zc_dn,    render_spans_16_c2_s_nt_z_nf_zc_dn,
558   render_spans_16_c1_s_t_nz_nf_zc_dn,    render_spans_16_c2_s_t_nz_nf_zc_dn,
559   render_spans_16_c1_s_t_z_nf_zc_dn,    render_spans_16_c2_s_t_z_nf_zc_dn,
560   render_spans_16_c1_ns_nt_nz_f_zc_dn,    render_spans_16_c2_ns_nt_nz_f_zc_dn,
561   render_spans_16_c1_ns_nt_z_f_zc_dn,    render_spans_16_c2_ns_nt_z_f_zc_dn,
562   render_spans_16_c1_ns_t_nz_f_zc_dn,    render_spans_16_c2_ns_t_nz_f_zc_dn,
563   render_spans_16_c1_ns_t_z_f_zc_dn,    render_spans_16_c2_ns_t_z_f_zc_dn,
564   render_spans_16_c1_s_nt_nz_f_zc_dn,    render_spans_16_c2_s_nt_nz_f_zc_dn,
565   render_spans_16_c1_s_nt_z_f_zc_dn,    render_spans_16_c2_s_nt_z_f_zc_dn,
566   render_spans_16_c1_s_t_nz_f_zc_dn,    render_spans_16_c2_s_t_nz_f_zc_dn,
567   render_spans_16_c1_s_t_z_f_zc_dn,       render_spans_16_c2_s_t_z_f_zc_dn,
568
569   render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn,    render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn,
570   render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn,    render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn,
571   render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn,    render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn,
572   render_spans_16_c1_ns_t_z_nf_nzc_zu_dn,    render_spans_16_c2_ns_t_z_nf_nzc_zu_dn,
573   render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn,    render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn,
574   render_spans_16_c1_s_nt_z_nf_nzc_zu_dn,    render_spans_16_c2_s_nt_z_nf_nzc_zu_dn,
575   render_spans_16_c1_s_t_nz_nf_nzc_zu_dn,    render_spans_16_c2_s_t_nz_nf_nzc_zu_dn,
576   render_spans_16_c1_s_t_z_nf_nzc_zu_dn,    render_spans_16_c2_s_t_z_nf_nzc_zu_dn,
577   render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn,    render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn,
578   render_spans_16_c1_ns_nt_z_f_nzc_zu_dn,    render_spans_16_c2_ns_nt_z_f_nzc_zu_dn,
579   render_spans_16_c1_ns_t_nz_f_nzc_zu_dn,    render_spans_16_c2_ns_t_nz_f_nzc_zu_dn,
580   render_spans_16_c1_ns_t_z_f_nzc_zu_dn,    render_spans_16_c2_ns_t_z_f_nzc_zu_dn,
581   render_spans_16_c1_s_nt_nz_f_nzc_zu_dn,    render_spans_16_c2_s_nt_nz_f_nzc_zu_dn,
582   render_spans_16_c1_s_nt_z_f_nzc_zu_dn,    render_spans_16_c2_s_nt_z_f_nzc_zu_dn,
583   render_spans_16_c1_s_t_nz_f_nzc_zu_dn,    render_spans_16_c2_s_t_nz_f_nzc_zu_dn,
584   render_spans_16_c1_s_t_z_f_nzc_zu_dn,       render_spans_16_c2_s_t_z_f_nzc_zu_dn,
585
586   render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn,   render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn,
587   render_spans_16_c1_ns_nt_z_nf_zc_zu_dn,    render_spans_16_c2_ns_nt_z_nf_zc_zu_dn,
588   render_spans_16_c1_ns_t_nz_nf_zc_zu_dn,    render_spans_16_c2_ns_t_nz_nf_zc_zu_dn,
589   render_spans_16_c1_ns_t_z_nf_zc_zu_dn,    render_spans_16_c2_ns_t_z_nf_zc_zu_dn,
590   render_spans_16_c1_s_nt_nz_nf_zc_zu_dn,    render_spans_16_c2_s_nt_nz_nf_zc_zu_dn,
591   render_spans_16_c1_s_nt_z_nf_zc_zu_dn,    render_spans_16_c2_s_nt_z_nf_zc_zu_dn,
592   render_spans_16_c1_s_t_nz_nf_zc_zu_dn,    render_spans_16_c2_s_t_nz_nf_zc_zu_dn,
593   render_spans_16_c1_s_t_z_nf_zc_zu_dn,       render_spans_16_c2_s_t_z_nf_zc_zu_dn,
594   render_spans_16_c1_ns_nt_nz_f_zc_zu_dn,    render_spans_16_c2_ns_nt_nz_f_zc_zu_dn,
595   render_spans_16_c1_ns_nt_z_f_zc_zu_dn,    render_spans_16_c2_ns_nt_z_f_zc_zu_dn,
596   render_spans_16_c1_ns_t_nz_f_zc_zu_dn,    render_spans_16_c2_ns_t_nz_f_zc_zu_dn,
597   render_spans_16_c1_ns_t_z_f_zc_zu_dn,       render_spans_16_c2_ns_t_z_f_zc_zu_dn,
598   render_spans_16_c1_s_nt_nz_f_zc_zu_dn,    render_spans_16_c2_s_nt_nz_f_zc_zu_dn,
599   render_spans_16_c1_s_nt_z_f_zc_zu_dn,       render_spans_16_c2_s_nt_z_f_zc_zu_dn,
600   render_spans_16_c1_s_t_nz_f_zc_zu_dn,       render_spans_16_c2_s_t_nz_f_zc_zu_dn,
601   render_spans_16_c1_s_t_z_f_zc_zu_dn,       render_spans_16_c2_s_t_z_f_zc_zu_dn,
602
603   render_spans_16_c1_ns_nt_nz_nf_nzc_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_dn,
604   render_spans_16_c1_ns_nt_z_nf_nzc_dn,    render_spans_16_c2_ns_nt_z_nf_nzc_dn,
605   render_spans_16_c1_ns_t_nz_nf_nzc_dn,    render_spans_16_c2_ns_t_nz_nf_nzc_dn,
606   render_spans_16_c1_ns_t_z_nf_nzc_dn,    render_spans_16_c2_ns_t_z_nf_nzc_dn,
607   render_spans_16_c1_s_nt_nz_nf_nzc_dn,    render_spans_16_c2_s_nt_nz_nf_nzc_dn,
608   render_spans_16_c1_s_nt_z_nf_nzc_dn,    render_spans_16_c2_s_nt_z_nf_nzc_dn,
609   render_spans_16_c1_s_t_nz_nf_nzc_dn,    render_spans_16_c2_s_t_nz_nf_nzc_dn,
610   render_spans_16_c1_s_t_z_nf_nzc_dn,    render_spans_16_c2_s_t_z_nf_nzc_dn,
611   render_spans_16_c1_ns_nt_nz_f_nzc_dn,    render_spans_16_c2_ns_nt_nz_f_nzc_dn,
612   render_spans_16_c1_ns_nt_z_f_nzc_dn,    render_spans_16_c2_ns_nt_z_f_nzc_dn,
613   render_spans_16_c1_ns_t_nz_f_nzc_dn,    render_spans_16_c2_ns_t_nz_f_nzc_dn,
614   render_spans_16_c1_ns_t_z_f_nzc_dn,    render_spans_16_c2_ns_t_z_f_nzc_dn,
615   render_spans_16_c1_s_nt_nz_f_nzc_dn,    render_spans_16_c2_s_nt_nz_f_nzc_dn,
616   render_spans_16_c1_s_nt_z_f_nzc_dn,    render_spans_16_c2_s_nt_z_f_nzc_dn,
617   render_spans_16_c1_s_t_nz_f_nzc_dn,    render_spans_16_c2_s_t_nz_f_nzc_dn,
618   render_spans_16_c1_s_t_z_f_nzc_dn,    render_spans_16_c2_s_t_z_f_nzc_dn,
619
620   render_spans_16_c1_ns_nt_nz_nf_zc_dn,   render_spans_16_c2_ns_nt_nz_nf_zc_dn,
621   render_spans_16_c1_ns_nt_z_nf_zc_dn,    render_spans_16_c2_ns_nt_z_nf_zc_dn,
622   render_spans_16_c1_ns_t_nz_nf_zc_dn,    render_spans_16_c2_ns_t_nz_nf_zc_dn,
623   render_spans_16_c1_ns_t_z_nf_zc_dn,    render_spans_16_c2_ns_t_z_nf_zc_dn,
624   render_spans_16_c1_s_nt_nz_nf_zc_dn,    render_spans_16_c2_s_nt_nz_nf_zc_dn,
625   render_spans_16_c1_s_nt_z_nf_zc_dn,    render_spans_16_c2_s_nt_z_nf_zc_dn,
626   render_spans_16_c1_s_t_nz_nf_zc_dn,    render_spans_16_c2_s_t_nz_nf_zc_dn,
627   render_spans_16_c1_s_t_z_nf_zc_dn,    render_spans_16_c2_s_t_z_nf_zc_dn,
628   render_spans_16_c1_ns_nt_nz_f_zc_dn,    render_spans_16_c2_ns_nt_nz_f_zc_dn,
629   render_spans_16_c1_ns_nt_z_f_zc_dn,    render_spans_16_c2_ns_nt_z_f_zc_dn,
630   render_spans_16_c1_ns_t_nz_f_zc_dn,    render_spans_16_c2_ns_t_nz_f_zc_dn,
631   render_spans_16_c1_ns_t_z_f_zc_dn,    render_spans_16_c2_ns_t_z_f_zc_dn,
632   render_spans_16_c1_s_nt_nz_f_zc_dn,    render_spans_16_c2_s_nt_nz_f_zc_dn,
633   render_spans_16_c1_s_nt_z_f_zc_dn,    render_spans_16_c2_s_nt_z_f_zc_dn,
634   render_spans_16_c1_s_t_nz_f_zc_dn,    render_spans_16_c2_s_t_nz_f_zc_dn,
635   render_spans_16_c1_s_t_z_f_zc_dn,       render_spans_16_c2_s_t_z_f_zc_dn,
636
637   render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn,    render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn,
638   render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn,    render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn,
639   render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn,    render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn,
640   render_spans_16_c1_ns_t_z_nf_nzc_zu_dn,    render_spans_16_c2_ns_t_z_nf_nzc_zu_dn,
641   render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn,    render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn,
642   render_spans_16_c1_s_nt_z_nf_nzc_zu_dn,    render_spans_16_c2_s_nt_z_nf_nzc_zu_dn,
643   render_spans_16_c1_s_t_nz_nf_nzc_zu_dn,    render_spans_16_c2_s_t_nz_nf_nzc_zu_dn,
644   render_spans_16_c1_s_t_z_nf_nzc_zu_dn,    render_spans_16_c2_s_t_z_nf_nzc_zu_dn,
645   render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn,    render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn,
646   render_spans_16_c1_ns_nt_z_f_nzc_zu_dn,    render_spans_16_c2_ns_nt_z_f_nzc_zu_dn,
647   render_spans_16_c1_ns_t_nz_f_nzc_zu_dn,    render_spans_16_c2_ns_t_nz_f_nzc_zu_dn,
648   render_spans_16_c1_ns_t_z_f_nzc_zu_dn,    render_spans_16_c2_ns_t_z_f_nzc_zu_dn,
649   render_spans_16_c1_s_nt_nz_f_nzc_zu_dn,    render_spans_16_c2_s_nt_nz_f_nzc_zu_dn,
650   render_spans_16_c1_s_nt_z_f_nzc_zu_dn,    render_spans_16_c2_s_nt_z_f_nzc_zu_dn,
651   render_spans_16_c1_s_t_nz_f_nzc_zu_dn,    render_spans_16_c2_s_t_nz_f_nzc_zu_dn,
652   render_spans_16_c1_s_t_z_f_nzc_zu_dn,       render_spans_16_c2_s_t_z_f_nzc_zu_dn,
653
654   render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn,   render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn,
655   render_spans_16_c1_ns_nt_z_nf_zc_zu_dn,    render_spans_16_c2_ns_nt_z_nf_zc_zu_dn,
656   render_spans_16_c1_ns_t_nz_nf_zc_zu_dn,    render_spans_16_c2_ns_t_nz_nf_zc_zu_dn,
657   render_spans_16_c1_ns_t_z_nf_zc_zu_dn,    render_spans_16_c2_ns_t_z_nf_zc_zu_dn,
658   render_spans_16_c1_s_nt_nz_nf_zc_zu_dn,    render_spans_16_c2_s_nt_nz_nf_zc_zu_dn,
659   render_spans_16_c1_s_nt_z_nf_zc_zu_dn,    render_spans_16_c2_s_nt_z_nf_zc_zu_dn,
660   render_spans_16_c1_s_t_nz_nf_zc_zu_dn,    render_spans_16_c2_s_t_nz_nf_zc_zu_dn,
661   render_spans_16_c1_s_t_z_nf_zc_zu_dn,       render_spans_16_c2_s_t_z_nf_zc_zu_dn,
662   render_spans_16_c1_ns_nt_nz_f_zc_zu_dn,    render_spans_16_c2_ns_nt_nz_f_zc_zu_dn,
663   render_spans_16_c1_ns_nt_z_f_zc_zu_dn,    render_spans_16_c2_ns_nt_z_f_zc_zu_dn,
664   render_spans_16_c1_ns_t_nz_f_zc_zu_dn,    render_spans_16_c2_ns_t_nz_f_zc_zu_dn,
665   render_spans_16_c1_ns_t_z_f_zc_zu_dn,       render_spans_16_c2_ns_t_z_f_zc_zu_dn,
666   render_spans_16_c1_s_nt_nz_f_zc_zu_dn,    render_spans_16_c2_s_nt_nz_f_zc_zu_dn,
667   render_spans_16_c1_s_nt_z_f_zc_zu_dn,       render_spans_16_c2_s_nt_z_f_zc_zu_dn,
668   render_spans_16_c1_s_t_nz_f_zc_zu_dn,       render_spans_16_c2_s_t_nz_f_zc_zu_dn,
669   render_spans_16_c1_s_t_z_f_zc_zu_dn,       render_spans_16_c2_s_t_z_f_zc_zu_dn,
202670};
src/mame/video/rdpacvg.c
r6795r6796
5757
5858INLINE void alpha_cvg_get_ncta_nca(UINT8 *comb_alpha)
5959{
60   UINT32 temp = *comb_alpha;
61
62   if (temp > 0xff)
63   {
64      *comb_alpha = 0xff;
65   }
66   else
67   {
68      *comb_alpha = (UINT8)temp;
69   }
60   // DO nothing
7061}
src/mame/video/rdptrect.c
r6795r6796
8282
8383   calculate_clamp_diffs(tilenum);
8484
85   set_shade_for_rects(); // Needed by Pilotwings 64
85   shade_color.c = 0;   // Needed by Pilotwings 64
8686
8787   if(rect->flip)
8888   {
r6795r6796
9494      rect->dsdx= temp;
9595   }
9696
97   t = ((int)(rect->t)) << 5;
97   CACHE_TEXTURE_PARAMS(tex_tile);
9898
99   if(y1 < clipy1)
100   {
101      rect->t += rect->dtdy * (clipy1 - y1);
102      y1 = clipy1;
103   }
104   if(y2 > clipy2)
105   {
106      y2 = clipy2;
107   }
108   if(x1 < clipx1)
109   {
110      rect->s += rect->dsdx * (clipx1 - x1);
111      x1 = clipx1;
112   }
113   if(x2 > clipx2)
114   {
115      x2 = clipx2;
116   }
117   rect->dsdx >>= 5;
118   rect->dtdy >>= 5;
119
120   t = ((int)(rect->t));
121
99122   for (j = y1; j < y2; j++)
100123   {
101      if (j >= clipy1 && j < clipy2)
102      {
103124         int fb_index = j * fb_width;
104125#if defined(MAGICDITHER) || defined(BAYERDITHER)
105126         int mline = (j & 3) << 2;
106127#endif
107         s = ((int)(rect->s)) << 5;
128         s = ((int)(rect->s));
108129
109130         for (i = x1; i < x2; i++)
110131         {
111            if (i >= clipx1 && i < clipx2)
112            {
113132               COLOR c;
114133#if defined(ZUPDATE)
115134               int rendered = 0;
116135#endif
136#if defined(MAGICDITHER) || defined(BAYERDITHER)
117137               int dith = 0;
138#endif
118139               int curpixel = fb_index + i;
119140               UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR];
120141               UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR];
r6795r6796
125146
126147               curpixel_cvg = 8;
127148
128               TEXTURE_PIPELINE(&texel0_color, s >> 5, t >> 5, tex_tile);
149               texel0_color.c = TEXTURE_PIPELINE(s, t, tex_tile);
129150
130               COLOR_COMBINER1(&c);
151               c.c = COLOR_COMBINER1();
131152
132153#if defined(MAGICDITHER)
133154               dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)];
r6795r6796
138159#if defined(ZCOMPARE)
139160               if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z))
140161               {
162#endif
163#if defined(MAGICDITHER) || defined(BAYERDITHER)
141164#if defined(ZUPDATE)
142                  rendered = BLENDER1_16(fbcur, hbcur, c, dith);
165                  rendered = BLENDER1_16_DITH(fbcur, hbcur, c, dith);
143166#else
144                  BLENDER1_16(fbcur, hbcur, c, dith);
167                  BLENDER1_16_DITH(fbcur, hbcur, c, dith);
145168#endif
146               }
147#elif defined(ZUPDATE)
148               rendered = BLENDER1_16(fbcur, hbcur, c, dith);
149169#else
150               BLENDER1_16(fbcur, hbcur, c, dith);
170#if defined(ZUPDATE)
171                  rendered = BLENDER1_16_NDITH(fbcur, hbcur, c);
172#else
173                  BLENDER1_16_NDITH(fbcur, hbcur, c);
151174#endif
175#endif
176#if defined(ZCOMPARE)
177               }
178#endif
152179
153180#if defined(ZUPDATE)
154181               if(rendered)
r6795r6796
156183                  z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z);
157184               }
158185#endif
159            }
160186
187
161188            s += (int)(rect->dsdx);
162189         }
163      }
164190      t += (int)(rect->dtdy);
165191   }
166192}
r6795r6796
264290   }
265291
266292
267   set_shade_for_rects(); // Needed by Pilotwings 64
293   shade_color.c = 0;   // Needed by Pilotwings 64
268294
269295   if(rect->flip)
270296   {
r6795r6796
304330               UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR];
305331               UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR];
306332#endif
333#if defined(MAGICDITHER) || defined(BAYERDITHER)
307334               int dith = 0;
335#endif
308336
309337               curpixel_cvg = 8;
310338
311339               ss = s >> 5;
312340               st = t >> 5;
313341
314               TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
315               TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2);
342               CACHE_TEXTURE_PARAMS(tex_tile);
343               texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
316344
317               COLOR_COMBINER2_C0(&c1);
318               COLOR_COMBINER2_C1(&c2);
345               CACHE_TEXTURE_PARAMS(tex_tile2);
346               texel1_color.c = TEXTURE_PIPELINE(ss, st, tex_tile2);
319347
348               c1.c = COLOR_COMBINER2_C0();
349               c2.c = COLOR_COMBINER2_C1();
350
320351#if defined(MAGICDITHER)
321352               dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)];
322353#elif defined(BAYERDITHER)
r6795r6796
326357#if defined(ZCOMPARE)
327358               if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z))
328359               {
360#endif
361#if defined(MAGICDITHER) || defined(BAYERDITHER)
329362#if defined(ZUPDATE)
330                  rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
363                  rendered = BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
331364#else
332                  BLENDER2_16(fbcur, hbcur, c1, c2, dith);
365                  BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
333366#endif
334               }
335367#else
336368#if defined(ZUPDATE)
337               rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
369                  rendered = BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
338370#else
339               BLENDER2_16(fbcur, hbcur, c1, c2, dith);
371                  BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
340372#endif
341373#endif
374#if defined(ZCOMPARE)
375               }
376#endif
342377
343378#if defined(ZUPDATE)
344379               if(rendered)
r6795r6796
430465
431466   calculate_clamp_diffs(tilenum);
432467
433   set_shade_for_rects(); // Needed by Pilotwings 64
468   shade_color.c = 0;   // Needed by Pilotwings 64
434469
435470   if(rect->flip)
436471   {
r6795r6796
444479
445480   t = ((int)(rect->t)) << 5;
446481
482   CACHE_TEXTURE_PARAMS(tex_tile);
483
447484   for (j = y1; j < y2; j++)
448485   {
449486      int fb_index = j * fb_width;
r6795r6796
458495               ss = s >> 5;
459496               st = t >> 5;
460497
461               TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
498               texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
462499
463500               curpixel_cvg = 8;
464501
src/mame/video/rdptrect.h
r6795r6796
4747static void texture_rectangle_16bit_cf_zc_zu_db(TEX_RECTANGLE *rect);
4848static void texture_rectangle_16bit_cf_zc_zu_dn(TEX_RECTANGLE *rect);
4949
50static void (*rdp_texture_rectangle_16bit_func[48])(TEX_RECTANGLE *) =
50static void (*rdp_texture_rectangle_16bit_func[64])(TEX_RECTANGLE *) =
5151{
52   texture_rectangle_16bit_c1_nzc_nzu_dm, texture_rectangle_16bit_c1_nzc_nzu_db, texture_rectangle_16bit_c1_nzc_nzu_dn,
53   texture_rectangle_16bit_c2_nzc_nzu_dm, texture_rectangle_16bit_c2_nzc_nzu_db, texture_rectangle_16bit_c2_nzc_nzu_dn,
54   texture_rectangle_16bit_cc_nzc_nzu_dm, texture_rectangle_16bit_cc_nzc_nzu_db, texture_rectangle_16bit_cc_nzc_nzu_dn,
55   texture_rectangle_16bit_cf_nzc_nzu_dm, texture_rectangle_16bit_cf_nzc_nzu_db, texture_rectangle_16bit_cf_nzc_nzu_dn,
56   texture_rectangle_16bit_c1_zc_nzu_dm, texture_rectangle_16bit_c1_zc_nzu_db, texture_rectangle_16bit_c1_zc_nzu_dn,
57   texture_rectangle_16bit_c2_zc_nzu_dm, texture_rectangle_16bit_c2_zc_nzu_db, texture_rectangle_16bit_c2_zc_nzu_dn,
58   texture_rectangle_16bit_cc_zc_nzu_dm, texture_rectangle_16bit_cc_zc_nzu_db, texture_rectangle_16bit_cc_zc_nzu_dn,
59   texture_rectangle_16bit_cf_zc_nzu_dm, texture_rectangle_16bit_cf_zc_nzu_db, texture_rectangle_16bit_cf_zc_nzu_dn,
60   texture_rectangle_16bit_c1_nzc_zu_dm, texture_rectangle_16bit_c1_nzc_zu_db, texture_rectangle_16bit_c1_nzc_zu_dn,
61   texture_rectangle_16bit_c2_nzc_zu_dm, texture_rectangle_16bit_c2_nzc_zu_db, texture_rectangle_16bit_c2_nzc_zu_dn,
62   texture_rectangle_16bit_cc_nzc_zu_dm, texture_rectangle_16bit_cc_nzc_zu_db, texture_rectangle_16bit_cc_nzc_zu_dn,
63   texture_rectangle_16bit_cf_nzc_zu_dm, texture_rectangle_16bit_cf_nzc_zu_db, texture_rectangle_16bit_cf_nzc_zu_dn,
64   texture_rectangle_16bit_c1_zc_zu_dm, texture_rectangle_16bit_c1_zc_zu_db, texture_rectangle_16bit_c1_zc_zu_dn,
65   texture_rectangle_16bit_c2_zc_zu_dm, texture_rectangle_16bit_c2_zc_zu_db, texture_rectangle_16bit_c2_zc_zu_dn,
66   texture_rectangle_16bit_cc_zc_zu_dm, texture_rectangle_16bit_cc_zc_zu_db, texture_rectangle_16bit_cc_zc_zu_dn,
67   texture_rectangle_16bit_cf_zc_zu_dm, texture_rectangle_16bit_cf_zc_zu_db, texture_rectangle_16bit_cf_zc_zu_dn,
52   texture_rectangle_16bit_c1_nzc_nzu_dm, texture_rectangle_16bit_c1_nzc_nzu_db, texture_rectangle_16bit_c1_nzc_nzu_dn, texture_rectangle_16bit_c1_nzc_nzu_dn,
53   texture_rectangle_16bit_c2_nzc_nzu_dm, texture_rectangle_16bit_c2_nzc_nzu_db, texture_rectangle_16bit_c2_nzc_nzu_dn, texture_rectangle_16bit_c2_nzc_nzu_dn,
54   texture_rectangle_16bit_cc_nzc_nzu_dm, texture_rectangle_16bit_cc_nzc_nzu_db, texture_rectangle_16bit_cc_nzc_nzu_dn, texture_rectangle_16bit_cc_nzc_nzu_dn,
55   texture_rectangle_16bit_cf_nzc_nzu_dm, texture_rectangle_16bit_cf_nzc_nzu_db, texture_rectangle_16bit_cf_nzc_nzu_dn, texture_rectangle_16bit_cf_nzc_nzu_dn,
56   texture_rectangle_16bit_c1_zc_nzu_dm, texture_rectangle_16bit_c1_zc_nzu_db, texture_rectangle_16bit_c1_zc_nzu_dn, texture_rectangle_16bit_c1_zc_nzu_dn,
57   texture_rectangle_16bit_c2_zc_nzu_dm, texture_rectangle_16bit_c2_zc_nzu_db, texture_rectangle_16bit_c2_zc_nzu_dn, texture_rectangle_16bit_c2_zc_nzu_dn,
58   texture_rectangle_16bit_cc_zc_nzu_dm, texture_rectangle_16bit_cc_zc_nzu_db, texture_rectangle_16bit_cc_zc_nzu_dn, texture_rectangle_16bit_cc_zc_nzu_dn,
59   texture_rectangle_16bit_cf_zc_nzu_dm, texture_rectangle_16bit_cf_zc_nzu_db, texture_rectangle_16bit_cf_zc_nzu_dn, texture_rectangle_16bit_cf_zc_nzu_dn,
60   texture_rectangle_16bit_c1_nzc_zu_dm, texture_rectangle_16bit_c1_nzc_zu_db, texture_rectangle_16bit_c1_nzc_zu_dn, texture_rectangle_16bit_c1_nzc_zu_dn,
61   texture_rectangle_16bit_c2_nzc_zu_dm, texture_rectangle_16bit_c2_nzc_zu_db, texture_rectangle_16bit_c2_nzc_zu_dn, texture_rectangle_16bit_c2_nzc_zu_dn,
62   texture_rectangle_16bit_cc_nzc_zu_dm, texture_rectangle_16bit_cc_nzc_zu_db, texture_rectangle_16bit_cc_nzc_zu_dn, texture_rectangle_16bit_cc_nzc_zu_dn,
63   texture_rectangle_16bit_cf_nzc_zu_dm, texture_rectangle_16bit_cf_nzc_zu_db, texture_rectangle_16bit_cf_nzc_zu_dn, texture_rectangle_16bit_cf_nzc_zu_dn,
64   texture_rectangle_16bit_c1_zc_zu_dm, texture_rectangle_16bit_c1_zc_zu_db, texture_rectangle_16bit_c1_zc_zu_dn, texture_rectangle_16bit_c1_zc_zu_dn,
65   texture_rectangle_16bit_c2_zc_zu_dm, texture_rectangle_16bit_c2_zc_zu_db, texture_rectangle_16bit_c2_zc_zu_dn, texture_rectangle_16bit_c2_zc_zu_dn,
66   texture_rectangle_16bit_cc_zc_zu_dm, texture_rectangle_16bit_cc_zc_zu_db, texture_rectangle_16bit_cc_zc_zu_dn, texture_rectangle_16bit_cc_zc_zu_dn,
67   texture_rectangle_16bit_cf_zc_zu_dm, texture_rectangle_16bit_cf_zc_zu_db, texture_rectangle_16bit_cf_zc_zu_dn, texture_rectangle_16bit_cf_zc_zu_dn,
6868};
6969
src/mame/video/rdpacomp.c
r6795r6796
1919
2020INLINE int alpha_compare_ac_da(UINT8 comb_alpha)
2121{
22   if (comb_alpha < (rdp_rand() & 0xff))
23   {
24      return 0;
25   }
26   return 1;
22   return comb_alpha < rdp_rand();
2723}
2824
src/mame/video/rdpshift.c
r0r6796
1#if defined(SHIFT_S)
2   #if defined(SHIFT_T)
3      static void TEXSHIFT_S_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
4   #else
5      static void TEXSHIFT_S_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
6   #endif
7#else
8   #if defined(SHIFT_T)
9      static void TEXSHIFT_NS_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
10   #else
11      static void TEXSHIFT_NS_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
12   #endif
13#endif
14{
15#if defined(SHIFT_S)
16   *S = SIGN16(*S);
17   if (tex_tile->shift_s < 11)
18   {
19      *S >>= tex_tile->shift_s;
20   }
21   else
22   {
23      *S <<= (16 - tex_tile->shift_s);
24   }
25   *S = SIGN16(*S);
26#endif
27#if defined(SHIFT_T)
28   *T = SIGN16(*T);
29   if (tex_tile->shift_t < 11)
30   {
31      *T >>= tex_tile->shift_t;
32   }
33   else
34   {
35      *T <<= (16 - tex_tile->shift_t);
36   }
37   *T = SIGN16(*T);
38#endif
39   *maxs = ((*S >> 3) >= tex_tile->sh);
40   *maxt = ((*T >> 3) >= tex_tile->th);
41}
src/mame/video/rdpshift.h
r0r6796
1static void TEXSHIFT_S_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
2static void TEXSHIFT_S_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
3static void TEXSHIFT_NS_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
4static void TEXSHIFT_NS_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
5
6static void (*rdp_shift_func[4])(INT32*, INT32*, INT32*, INT32*, TILE*) =
7{
8   TEXSHIFT_NS_NT, TEXSHIFT_NS_T, TEXSHIFT_S_NT, TEXSHIFT_S_T
9};
src/mame/video/rdpclamp.c
r0r6796
1#if defined(DOS)
2   #if defined(DOT)
3      INLINE void CLAMP_NC_DOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
4   #else
5      INLINE void CLAMP_NC_DOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
6   #endif
7#else
8   #if defined(DOT)
9      INLINE void CLAMP_NC_NDOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
10   #else
11      INLINE void CLAMP_NC_NDOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
12   #endif
13#endif
14{
15   //int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
16   //int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
17#if defined(DOS)
18   if (*S & 0x10000)
19   {
20      *S = 0;
21      *SFRAC = 0;
22   }
23   else if (maxs)
24   {
25      *S = clamp_s_diff[tex_tile->num];
26      *SFRAC = 0;
27   }
28   else
29#endif
30   {
31      *S = (SIGN17(*S) >> 5) & 0x1fff;
32   }
33
34#if defined(DOT)
35   if (*T & 0x10000)
36   {
37      *T = 0;
38      *TFRAC = 0;
39   }
40   else if (maxt)
41   {
42      *T = clamp_t_diff[tex_tile->num];
43      *TFRAC = 0;
44   }
45   else
46#endif
47   {
48      *T = (SIGN17(*T) >> 5) & 0x1fff;
49   }
50}
51
52#if defined(DOS)
53   #if defined(DOT)
54      INLINE void CLAMP_LIGHT_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
55   #else
56      INLINE void CLAMP_LIGHT_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
57   #endif
58#else
59   #if defined(DOT)
60      INLINE void CLAMP_LIGHT_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
61   #else
62      INLINE void CLAMP_LIGHT_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
63   #endif
64#endif
65{
66   //int dos = (tex_tile->cs || !tex_tile->mask_s);
67   //int dot = (tex_tile->ct || !tex_tile->mask_t);
68#if defined(DOS)
69   if (*S & 0x10000)
70   {
71      *S = 0;
72   }
73   else if (maxs)
74   {
75      *S = clamp_s_diff[tex_tile->num];
76   }
77   else
78#endif
79   {
80      *S = (SIGN17(*S) >> 5) & 0x1fff;
81   }
82
83#if defined(DOT)
84   if (*T & 0x10000)
85   {
86      *T = 0;
87   }
88   else if (maxt)
89   {
90      *T = clamp_t_diff[tex_tile->num];
91   }
92   else
93#endif
94   {
95      *T = (SIGN17(*T) >> 5) & 0x1fff;
96   }
97}
98
99#if defined(DOS)
100   #if defined(DOT)
101      INLINE void CLAMP_QUICK_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
102   #else
103      INLINE void CLAMP_QUICK_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
104   #endif
105#else
106   #if defined(DOT)
107      INLINE void CLAMP_QUICK_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
108   #else
109      INLINE void CLAMP_QUICK_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
110   #endif
111#endif
112{
113#if defined(DOS)
114   if (*S & 0x10000)
115   {
116      *S = 0;
117   }
118   else if (maxs)
119   {
120      *S = clamp_s_diff[num];
121   }
122   else
123#endif
124   {
125      *S = (SIGN17(*S) >> 5) & 0x1fff;
126   }
127
128#if defined(DOT)
129   if (*T & 0x10000)
130   {
131      *T = 0;
132   }
133   else if (maxt)
134   {
135      *T = clamp_t_diff[num];
136   }
137   else
138#endif
139   {
140      *T = (SIGN17(*T) >> 5) & 0x1fff;
141   }
142}
143
144#if defined(DOS) && defined(DOT)
145INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
146{
147   *S = (SIGN17(*S) >> 5) & 0x1fff;
148   *T = (SIGN17(*T) >> 5) & 0x1fff;
149}
150
151INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
152{
153   *S = (SIGN17(*S) >> 5) & 0x1fff;
154   *T = (SIGN17(*T) >> 5) & 0x1fff;
155}
156
157INLINE void CLAMP_QUICK_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
158{
159   *S = (SIGN17(*S) >> 5) & 0x1fff;
160   *T = (SIGN17(*T) >> 5) & 0x1fff;
161}
162#endif
src/mame/video/rdpclamp.h
r0r6796
1INLINE void CLAMP_NC_NDOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
2INLINE void CLAMP_NC_NDOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
3INLINE void CLAMP_NC_DOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
4INLINE void CLAMP_NC_DOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
5
6INLINE void CLAMP_LIGHT_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
7INLINE void CLAMP_LIGHT_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
8INLINE void CLAMP_LIGHT_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
9INLINE void CLAMP_LIGHT_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
10
11INLINE void CLAMP_QUICK_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
12INLINE void CLAMP_QUICK_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
13INLINE void CLAMP_QUICK_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
14INLINE void CLAMP_QUICK_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
15
16INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
17INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
18INLINE void CLAMP_QUICK_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
19
20static void (*rdp_clamp_func[8])(INT32*, INT32*, INT32*, INT32*, INT32, INT32, TILE*) =
21{
22   CLAMP_NC_NDOS_NDOT,      CLAMP_NC_NDOS_DOT,       CLAMP_NC_DOS_NDOT,       CLAMP_NC_DOS_DOT,
23   CLAMP_C,            CLAMP_C,            CLAMP_C,            CLAMP_C,
24};
25
26static void (*rdp_clamp_light_func[8])(INT32*, INT32*, INT32, INT32, TILE*) =
27{
28   CLAMP_LIGHT_NC_NDOS_NDOT,   CLAMP_LIGHT_NC_NDOS_DOT,    CLAMP_LIGHT_NC_DOS_NDOT,    CLAMP_LIGHT_NC_DOS_DOT,
29   CLAMP_LIGHT_C,            CLAMP_LIGHT_C,            CLAMP_LIGHT_C,            CLAMP_LIGHT_C,
30};
31
32static void (*rdp_clamp_quick_func[8])(INT32*, INT32*, INT32, INT32, int) =
33{
34   CLAMP_QUICK_NC_NDOS_NDOT,   CLAMP_QUICK_NC_NDOS_DOT,    CLAMP_QUICK_NC_DOS_NDOT,    CLAMP_QUICK_NC_DOS_DOT,
35   CLAMP_QUICK_C,            CLAMP_QUICK_C,            CLAMP_QUICK_C,            CLAMP_QUICK_C,
36};
src/mame/video/rdpupd16.c
r6795r6796
1313#endif
1414{
1515   int i, j;
16   UINT32 final = 0;
1716#if defined(DIVOT)
1817   UINT32 prev_cvg = 0, next_cvg = 0;
1918#endif
r6795r6796
6160
6261         for (i=0; i < hres; i++)
6362         {
64            int r, g, b;
63            COLOR c;
64            //int r, g, b;
6565
6666            pix = frame_buffer[pixels ^ WORD_ADDR_XOR];
6767            curpixel_cvg = ((pix & 1) << 2) | (hidden_buffer[pixels ^ BYTE_ADDR_XOR] & 3);
r6795r6796
7373               next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3);
7474            }
7575#endif
76            r = ((pix >> 8) & 0xf8) | (pix >> 13);
77            g = ((pix >> 3) & 0xf8) | ((pix >>  8) & 0x07);
78            b = ((pix << 2) & 0xf8) | ((pix >>  3) & 0x07);
76            c.c = rgb16_to_32_lut[pix];
77            //r = ((pix >> 8) & 0xf8) | (pix >> 13);
78            //g = ((pix >> 3) & 0xf8) | ((pix >>  8) & 0x07);
79            //b = ((pix << 2) & 0xf8) | ((pix >>  3) & 0x07);
7980
8081#if defined(FSAA)
81            if (/*!vibuffering &&*/ curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2))
82            {
83               video_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64_vi_width);
84            }
82            //if (/*!vibuffering &&*/ curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2))
83            //{
84               //video_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64_vi_width);
85            //}
8586#endif
8687            //else if (dither_filter && curpixel_cvg == 7 && i > 0 && j > 0 && i < (hres - 1) && j < (vres - 1))
8788            //{
r6795r6796
103104               //}
104105               //else
105106               //{
106                  divot_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR);
107                  divot_filter16(&c.i.r, &c.i.g, &c.i.b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR);
107108               //}
108109            }
109110#endif
r6795r6796
140141                */
141142            pixels++;
142143
143            final = (r << 16) | (g << 8) | b;
144            d[i] = final; // Fix me for endianness
144            d[i] = c.c >> 8;//(r << 16) | (g << 8) | b; // Fix me for endianness
145145         }
146146         pixels +=invisiblewidth;
147147      }
src/mame/video/n64.c
r6795r6796
1212
1313#define LOG_RDP_EXECUTION       0
1414
15#define STRICT_ERROR (0)
16
17#if STRICT_ERROR
18#define stricterror fatalerror
19#else
20#define stricterror(...)
21#endif
22
2315static FILE *rdp_exec;
2416
2517static UINT32 rdp_cmd_data[0x1000];
r6795r6796
7163    int dzpix;
7264} SPAN;
7365
74//UINT8 cvg_mem[8*1048576];
75
7666static SPAN span[4096];
7767
7868/*****************************************************************************/
r6795r6796
198188#define SAMPLE_TYPE_1x1         0
199189#define SAMPLE_TYPE_2x2         1
200190
191static UINT16 cc_lut1[(1<<24)];
192static UINT8 cc_lut2[(1<<24)];
193static UINT32 rgb16_to_32_lut[(1<<16)];
194static UINT32 ia8_to_32_lut[(1<<16)];
195static UINT32 tex_lerp_lut[(1<<21)];
196
201197static COMBINE_MODES combine;
202198static OTHER_MODES other_modes;
203199
r6795r6796
311307static INT32 clamp_t_diff[8];
312308static INT32 clamp_s_diff[8];
313309
314INLINE void COMBINER_EQUATION(UINT8* out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D);
310#define COMBINER_EQUATION(A, B, C, D) cc_lut2[(cc_lut1[(A << 16) | (B << 8) | C] << 8) | D]
311//#define COMBINER_EQUATION(A, B, C, D) cc_lut_base[((D) << 17) + ((C) << 9) + (A) - (B)]
312
313//INLINE void COMBINER_EQUATION(UINT8* out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D);
315314INLINE UINT32 addrightcvg(UINT32 x, UINT32 k);
316315INLINE UINT32 addleftcvg(UINT32 x, UINT32 k);
317316INLINE UINT32 z_decompress(UINT16* zb);
318317INLINE UINT16 dz_decompress(UINT16* zb, UINT8* zhb);
319318INLINE void z_build_com_table(void);
320319INLINE void z_store(UINT16* zb, UINT8* zhb, UINT32 z, UINT32 deltaz);
321INLINE UINT32 z_compare(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
322320INLINE INT32 normalize_dzpix(INT32 sum);
323321INLINE INT32 CLIP(INT32 value,INT32 min,INT32 max);
324322INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UINT8* hbuff, UINT32 hres);
325INLINE void divot_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index);
323INLINE void divot_filter16(UINT8* r, UINT8* g, UINT8* b, UINT16* fbuff, UINT32 fbuff_index);
326324INLINE void restore_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index, UINT32 hres);
327325INLINE UINT32 getlog2(UINT32 lod_clamp);
328INLINE void set_shade_for_rects(void);
329326INLINE void copy_colors(COLOR* dst, COLOR* src);
330327INLINE void BILERP_AND_WRITE(UINT32* src0, UINT32* src1, UINT32* dest);
331328INLINE void tcdiv(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst);
r6795r6796
362359
363360static void (*texture_rectangle_16bit)(TEX_RECTANGLE *rect);
364361
362#include "video/rdpfrect.h"
363
364static void (*fill_rectangle_16bit)(RECTANGLE *rect);
365
365366#include "video/rdpspn16.h"
366367
367368static void (*render_spans_16_ns_nt_nz_nf)( int start, int end, TILE* tex_tile);
r6795r6796
383384
384385#include "video/rdptpipe.h"
385386
386static void (*TEXTURE_PIPELINE)(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
387//static UINT32 (*TEXTURE_PIPELINE)(INT32 SSS, INT32 SST, TILE* tex_tile);
388static UINT32 (*TEXTURE_PIPELINE)(INT32 SSS, INT32 SST, TILE* tex_tile);
387389
388390#include "video/rdpblend.h"
389391
390static int (*BLENDER1_16)(UINT16 *fb, UINT8* hb, COLOR c, int dith);
391static int (*BLENDER2_16)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
392static int (*BLENDER1_16_NDITH)(UINT16 *fb, UINT8* hb, COLOR c);
393static int (*BLENDER2_16_NDITH)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
394static int (*BLENDER1_16_DITH)(UINT16 *fb, UINT8* hb, COLOR c, int dith);
395static int (*BLENDER2_16_DITH)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
392396
393397#include "video/rdptri.h"
394398
395INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
396INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
399#include "video/rdpclamp.h"
397400
398401static void (*CLAMP)(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
399
400INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
401INLINE void CLAMP_LIGHT_NC(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
402
403402static void (*CLAMP_LIGHT)(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
403static void (*CLAMP_QUICK)(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
404404
405405static UINT8 rdp_rand_val = 0;
406406
407407#include "video/rdpfetch.h"
408408
409// Hack, but more efficient than mame_rand
410static UINT8 rdp_rand(void)
411{
412   return (rdp_rand_val += 19);
413}
409#include "video/rdpmask.h"
414410
415INLINE void MASK(INT32* S, INT32* T, TILE* tex_tile)
416{
417   INT32 swrap, twrap;
411static void (*MASK)(INT32* S, INT32* T, TILE* tex_tile);
418412
419   if (tex_tile->mask_s) // Select clamp if mask == 0
420   {
421      swrap = *S >> (tex_tile->mask_s > 10 ? 10 : tex_tile->mask_s);
422      swrap &= 1;
423      if (tex_tile->ms && swrap)
424      {
425         *S = (~(*S)) & maskbits_table[tex_tile->mask_s]; // Mirroring and masking
426      }
427      else if (tex_tile->mask_s)
428      {
429         *S &= maskbits_table[tex_tile->mask_s]; // Masking
430      }
431   }
413#include "video/rdpcc.h"
432414
433   if (tex_tile->mask_t)
434   {
435      twrap = *T >> (tex_tile->mask_t > 10 ? 10 : tex_tile->mask_t);
436      twrap &= 1;
437      if (tex_tile->mt && twrap)
438      {
439         *T = (~(*T)) & maskbits_table[tex_tile->mask_t]; // Mirroring and masking
440      }
441      else if (tex_tile->mask_t)
442      {
443         *T &= maskbits_table[tex_tile->mask_t];
444      }
445   }
446}
415static UINT32 (*COLOR_COMBINER1)(void);
416static UINT32 (*COLOR_COMBINER2_C0)(void);
417static UINT32 (*COLOR_COMBINER2_C1)(void);
447418
448INLINE void texshift(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
449{
450   *S = SIGN16(*S);
451   *T = SIGN16(*T);
452   if (tex_tile->shift_s)
453   {
454      if (tex_tile->shift_s < 11)
455      {
456         *S >>= tex_tile->shift_s;
457      }
458      else
459      {
460         *S <<= (16 - tex_tile->shift_s);
461      }
462      *S = SIGN16(*S);
463   }
464   if (tex_tile->shift_s)
465   {
466      if (tex_tile->shift_t < 11)
467      {
468         *T >>= tex_tile->shift_t;
469      }
470       else
471       {
472         *T <<= (16 - tex_tile->shift_t);
473      }
474      *T = SIGN16(*T);
475   }
476   *maxs = ((*S >> 3) >= tex_tile->sh);
477   *maxt = ((*T >> 3) >= tex_tile->th);
478}
419#include "video/rdpshift.h"
479420
480INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
481{
482   int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
483   int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
484   int overunders = 0;
485   int overundert = 0;
486   if (*S & 0x10000 && dosfrac)
487   {
488      *S = 0;
489      overunders = 1;
490   }
491   else if (maxs && dosfrac)
492   {
493      *S = clamp_s_diff[tex_tile->num];
494      overunders = 1;
421static void (*texshift)(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
495422
496   }
497   else
498   {
499      *S = (SIGN17(*S) >> 5) & 0x1fff;
500   }
423#define CACHE_TEXTURE_PARAMS(TEX) \
424   CLAMP = rdp_clamp_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
425   CLAMP_LIGHT = rdp_clamp_light_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
426   CLAMP_QUICK = rdp_clamp_quick_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
427   MASK = rdp_mask_func[(TEX->mask_s ? 2 : 0) | (TEX->mask_t ? 1 : 0)]; \
428   texshift = rdp_shift_func[(TEX->shift_s ? 2 : 0) | (TEX->shift_t ? 1 : 0)]; \
429   cached_twidth  = TEX->line; \
430   cached_tbase   = TEX->tmem; \
431   cached_tpal    = (TEX->palette & 0xf) << 4; \
432   cached_tfetch  = TEX->fetch_index; \
433   cached_tbase_s1   = TEX->tmem >> 1; \
434   cached_twidth_s1 = TEX->line >> 1;
501435
502   if (overunders && dosfrac)
503   {
504      *SFRAC = 0;
505   }
436// Hack, but more efficient than mame_rand
437#define rdp_rand()   (rdp_rand_val += 19)
506438
507   if (*T & 0x10000 && dotfrac)
508   {
509      *T = 0;
510      overundert = 1;
511   }
512   else if (maxt && dotfrac)
513   {
514      *T = clamp_t_diff[tex_tile->num];
515      overundert = 1;
516   }
517   else
518   {
519      *T = (SIGN17(*T) >> 5) & 0x1fff;
520   }
439static int special_bsel0, special_bsel1;
521440
522   if (overundert && dotfrac)
523   {
524      *TFRAC = 0;
525   }
526}
527
528INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
529{
530   int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
531   int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
532   int overunders = 0;
533   int overundert = 0;
534
535   *S = (SIGN17(*S) >> 5) & 0x1fff;
536
537   if (overunders && dosfrac)
538   {
539      *SFRAC = 0;
540   }
541
542   *T = (SIGN17(*T) >> 5) & 0x1fff;
543
544   if (overundert && dotfrac)
545   {
546      *TFRAC = 0;
547   }
548}
549
550INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
551{
552   *S = (SIGN17(*S) >> 5) & 0x1fff;
553   *T = (SIGN17(*T) >> 5) & 0x1fff;
554}
555
556INLINE void CLAMP_LIGHT_NC(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
557{
558   int dos = (tex_tile->cs || !tex_tile->mask_s);
559   int dot = (tex_tile->ct || !tex_tile->mask_t);
560
561   if (*S & 0x10000 && dos)
562   {
563      *S = 0;
564   }
565   else if (maxs && dos)
566   {
567      *S = clamp_s_diff[tex_tile->num];
568   }
569   else
570   {
571      *S = (SIGN17(*S) >> 5) & 0x1fff;
572   }
573
574   if (*T & 0x10000 && dot)
575   {
576      *T = 0;
577   }
578   else if (maxt && dot)
579   {
580      *T = clamp_t_diff[tex_tile->num];
581   }
582   else
583   {
584      *T = (SIGN17(*T) >> 5) & 0x1fff;
585   }
586}
587
588441/*****************************************************************************/
589442
590
591
592443VIDEO_START(n64)
593444{
594   int i = 0;
445   int i = 0, j = 0;
595446   UINT8 *normpoint = memory_region(machine, "normpoint");
596447   UINT8 *normslope = memory_region(machine, "normslope");
597448
r6795r6796
607458   one_color.c = 0xffffffff;
608459   zero_color.c = 0;
609460
461   for(i = 0; i < (1 << 21); i++)
462   {
463      INT32 frac = i >> 16;
464      INT32 left = (i >> 8) & 0x000000ff;
465      INT32 right = i & 0x000000ff;
466      tex_lerp_lut[i] = (frac*(left - right))>>5;
467   }
468
469   for(i = 0; i < (1 << 24); i++)
470   {
471      UINT8 A = (i >> 16) & 0x000000ff;
472      UINT8 B = (i >> 8) & 0x000000ff;
473      UINT8 C = i & 0x000000ff;
474      cc_lut1[i] = (INT16)((((((INT32)A - (INT32)B) * (INT32)C) + 0x80) >> 8) & 0x0000ffff);
475   }
476
477   for(i = 0; i < (1 << 16); i++)
478   {
479      for(j = 0; j < (1 << 8); j++)
480      {
481         INT32 temp = (INT32)((INT16)i) + j;
482         if(temp > 255)
483         {
484            cc_lut2[(i << 8) | j] = 255;
485         }
486         else if(temp < 0)
487         {
488            cc_lut2[(i << 8) | j] = 0;
489         }
490         else
491         {
492            cc_lut2[(i << 8) | j] = (UINT8)temp;
493         }
494      }
495   }
496
497   for(i = 0; i < (1 << 16); i++)
498   {
499      UINT8 r = ((i >> 8) & 0xf8) | (i >> 13);
500      UINT8 g = ((i >> 3) & 0xf8) | ((i >>  8) & 0x07);
501      UINT8 b = ((i << 2) & 0xf8) | ((i >>  3) & 0x07);
502      UINT8 a = (i & 1) ? 0xff : 0;
503      rgb16_to_32_lut[i] = (r << 24) | (g << 16) | (b << 8) | a;
504
505      r = g = b = (i >> 8) & 0xff;
506      a = i & 0xff;
507      ia8_to_32_lut[i] = (r << 24) | (g << 16) | (b << 8) | a;
508   }
509
610510   combiner_rgbsub_a_r[0] = combiner_rgbsub_a_r[1] = &one_color.i.r;
611511   combiner_rgbsub_a_g[0] = combiner_rgbsub_a_g[1] = &one_color.i.g;
612512   combiner_rgbsub_a_b[0] = combiner_rgbsub_a_b[1] = &one_color.i.b;
r6795r6796
868768
869769/*****************************************************************************/
870770
871INLINE void SET_SUBA_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
771static void SET_SUBA_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
872772{
873773   switch (code & 0xf)
874774   {
r6795r6796
887787   }
888788}
889789
890INLINE void SET_SUBB_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
790static void SET_SUBB_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
891791{
892792   switch (code & 0xf)
893793   {
r6795r6796
906806   }
907807}
908808
909INLINE void SET_MUL_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
809static void SET_MUL_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
910810{
911811   switch (code & 0x1f)
912812   {
r6795r6796
934834   }
935835}
936836
937INLINE void SET_ADD_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
837static void SET_ADD_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
938838{
939839   switch (code & 0x7)
940840   {
r6795r6796
949849   }
950850}
951851
952INLINE void SET_SUB_ALPHA_INPUT(UINT8 **input, int code)
852static void SET_SUB_ALPHA_INPUT(UINT8 **input, int code)
953853{
954854   switch (code & 0x7)
955855   {
r6795r6796
964864   }
965865}
966866
967INLINE void SET_MUL_ALPHA_INPUT(UINT8 **input, int code)
867static void SET_MUL_ALPHA_INPUT(UINT8 **input, int code)
968868{
969869   switch (code & 0x7)
970870   {
r6795r6796
979879   }
980880}
981881
982
983
984INLINE void COLOR_COMBINER1(COLOR *c)
882static void SET_BLENDER_INPUT(int cycle, int which, UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, UINT8 **input_a, int a, int b)
985883{
986   if (combiner_rgbsub_a_r[1] == &noise_color.i.r)
987   {
988      noise_color.i.r = rdp_rand() & 0xff;
989      noise_color.i.g = rdp_rand() & 0xff;
990      noise_color.i.b = rdp_rand() & 0xff;
991   }
992
993   COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
994   COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
995   COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
996   COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
997
998   //Alpha coverage combiner
999   alpha_cvg_get(&c->i.a);
1000}
1001
1002INLINE void COLOR_COMBINER2_C0(COLOR *c)
1003{
1004   if (combiner_rgbsub_a_r[0] == &noise_color.i.r)
1005   {
1006      noise_color.i.r = rdp_rand() & 0xff;
1007      noise_color.i.g = rdp_rand() & 0xff;
1008      noise_color.i.b = rdp_rand() & 0xff;
1009   }
1010
1011   COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[0],combiner_rgbsub_b_r[0],combiner_rgbmul_r[0],combiner_rgbadd_r[0]);
1012   COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[0],combiner_rgbsub_b_g[0],combiner_rgbmul_g[0],combiner_rgbadd_g[0]);
1013   COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[0],combiner_rgbsub_b_b[0],combiner_rgbmul_b[0],combiner_rgbadd_b[0]);
1014   COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[0],combiner_alphasub_b[0],combiner_alphamul[0],combiner_alphaadd[0]);
1015
1016   combined_color.c = c->c;
1017}
1018
1019INLINE void COLOR_COMBINER2_C1(COLOR *c)
1020{
1021   c->c = texel0_color.c;
1022   texel0_color.c = texel1_color.c;
1023   texel1_color.c = c->c;
1024
1025   if (combiner_rgbsub_a_r[1] == &noise_color.i.r)
1026   {
1027      noise_color.i.r = rdp_rand() & 0xff;
1028      noise_color.i.g = rdp_rand() & 0xff;
1029      noise_color.i.b = rdp_rand() & 0xff;
1030   }
1031
1032   COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
1033   COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
1034   COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
1035   COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
1036
1037   alpha_cvg_get(&c->i.a);
1038}
1039
1040INLINE void SET_BLENDER_INPUT(int cycle, int which, UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, UINT8 **input_a, int a, int b)
1041{
1042884   switch (a & 0x3)
1043885   {
1044886      case 0:
r6795r6796
1119961
1120962/*****************************************************************************/
1121963
1122static void fill_rectangle_16bit(RECTANGLE *rect)
1123{
1124   UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
1125   UINT8* hb = &hidden_bits[fb_address >> 1];
1126
1127   int index, i, j;
1128   int x1 = rect->xh / 4;
1129   int x2 = rect->xl / 4;
1130   int y1 = rect->yh / 4;
1131   int y2 = rect->yl / 4;
1132   int clipx1, clipx2, clipy1, clipy2;
1133   UINT16 fill_color1, fill_color2;
1134   int fill_cvg1;
1135   int fill_cvg2;
1136
1137   if (x2 <= x1)
1138   {
1139      x2=x1+1; // SCARS (E)
1140   }
1141   if (y2 == y1)
1142   {
1143      y2=y1+1; // Goldeneye
1144   }
1145
1146
1147   fill_color1 = (fill_color >> 16) & 0xffff;
1148   fill_color2 = (fill_color >>  0) & 0xffff;
1149   fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
1150   fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
1151
1152   clipx1 = clip.xh / 4;
1153   clipx2 = clip.xl / 4;
1154   clipy1 = clip.yh / 4;
1155   clipy2 = clip.yl / 4;
1156
1157   // clip
1158   if (x1 < clipx1)
1159   {
1160      x1 = clipx1;
1161   }
1162   if (y1 < clipy1)
1163   {
1164      y1 = clipy1;
1165   }
1166   if (x2 >= clipx2)
1167   {
1168      x2 = clipx2-1;
1169   }
1170   if (y2 >= clipy2)
1171   {
1172      y2 = clipy2-1;
1173   }
1174
1175   set_shade_for_rects(); // Needed by Command & Conquer menus
1176
1177   if (other_modes.cycle_type == CYCLE_TYPE_FILL)
1178   {
1179      for (j=y1; j <= y2; j++)
1180      {
1181         index = j * fb_width;
1182         for (i=x1; i <= x2; i++)
1183         {
1184            int curpixel = index + i;
1185            fb[curpixel ^ WORD_ADDR_XOR] = (i & 1) ? fill_color1 : fill_color2;
1186            hb[curpixel ^ BYTE_ADDR_XOR] = (i & 1) ? ((fill_color1 & 1)? 3:0) : ((fill_color2 & 1) ? 3:0);
1187         }
1188      }
1189   }
1190   else if (other_modes.cycle_type == CYCLE_TYPE_1)
1191   {
1192      if(!other_modes.rgb_dither_sel)
1193      {
1194         for (j = y1; j <= y2; j++)
1195         {
1196            COLOR c;
1197            int dith = 0;
1198            index = j * fb_width;
1199            for (i = x1; i <= x2; i++)
1200            {
1201               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1202               COLOR_COMBINER1(&c);
1203               dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
1204               BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
1205            }
1206         }
1207      }
1208      else if (other_modes.rgb_dither_sel == 1)
1209      {
1210         for (j = y1; j <= y2; j++)
1211         {
1212            COLOR c;
1213            int dith = 0;
1214            index = j * fb_width;
1215            for (i = x1; i <= x2; i++)
1216            {
1217               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1218               COLOR_COMBINER1(&c);
1219               dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
1220               BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
1221            }
1222         }
1223      }
1224      else
1225      {
1226         for (j = y1; j <= y2; j++)
1227         {
1228            COLOR c;
1229            int dith = 0;
1230            index = j * fb_width;
1231            for (i = x1; i <= x2; i++)
1232            {
1233               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1234               COLOR_COMBINER1(&c);
1235               BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
1236            }
1237         }
1238      }
1239   }
1240   else if (other_modes.cycle_type == CYCLE_TYPE_2)
1241   {
1242      if (!other_modes.rgb_dither_sel)
1243      {
1244         for (j=y1; j <= y2; j++)
1245         {
1246            COLOR c1, c2;
1247            int dith = 0;
1248            index = j * fb_width;
1249            for (i=x1; i <= x2; i++)
1250            {
1251               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1252               COLOR_COMBINER2_C0(&c1);
1253               COLOR_COMBINER2_C1(&c2);
1254               dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
1255               BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
1256            }
1257         }
1258      }
1259      else if (other_modes.rgb_dither_sel == 1)
1260      {
1261         for (j=y1; j <= y2; j++)
1262         {
1263            COLOR c1, c2;
1264            int dith = 0;
1265            index = j * fb_width;
1266            for (i=x1; i <= x2; i++)
1267            {
1268               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1269               COLOR_COMBINER2_C0(&c1);
1270               COLOR_COMBINER2_C1(&c2);
1271               dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
1272               BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
1273            }
1274         }
1275      }
1276      else
1277      {
1278         for (j=y1; j <= y2; j++)
1279         {
1280            COLOR c1, c2;
1281            int dith = 0;
1282            index = j * fb_width;
1283            for (i=x1; i <= x2; i++)
1284            {
1285               curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
1286               COLOR_COMBINER2_C0(&c1);
1287               COLOR_COMBINER2_C1(&c2);
1288               BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR],  &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
1289            }
1290         }
1291      }
1292   }
1293   else
1294   {
1295      fatalerror("fill_rectangle_16bit: cycle type copy");
1296   }
1297}
1298
1299964#define XOR_SWAP_BYTE   4
1300965#define XOR_SWAP_WORD   2
1301966#define XOR_SWAP_DWORD   1
r6795r6796
1309974    if (s < 0) s = 0;
1310975*/
1311976
1312static INT32 tbase;
1313static INT32 twidth;
1314static INT32 tpal;
977static INT32 cached_tbase;
978static INT32 cached_twidth;
979static INT32 cached_tpal;
980static INT32 cached_tfetch;
981static INT32 cached_tbase_s1;
982static INT32 cached_twidth_s1;
1315983
1316INLINE void FETCH_TEXEL(COLOR *color, int s, int t, TILE* tex_tile)
1317{
1318   twidth  = tex_tile->line;
1319   tbase   = tex_tile->tmem;
1320   tpal    = tex_tile->palette & 0xf;
984#define FETCH_TEXEL(s, t) rdp_fetch_texel_func[cached_tfetch](s < 0 ? 0 : s, t < 0 ? 0 : t)
1321985
1322   if (t < 0) t = 0;
1323   if (s < 0) s = 0;
1324
1325   rdp_fetch_texel_func[tex_tile->fetch_index](color, s, t);
1326}
1327
1328986INLINE UINT32 z_decompress(UINT16 *zb)
1329987{
1330988   UINT32 exponent = (*zb >> 13) & 7;
r6795r6796
13821040   return (1 << dz_compressed);
13831041}
13841042
1385INLINE UINT32 z_compare(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
1386{
1387   int force_coplanar = 0;
1388   UINT32 oz = z_decompress(zb);
1389   UINT32 dzmem = dz_decompress(zb, zhb);
1390   UINT32 dznew = 0;
1391   UINT32 farther = 0;
1392   UINT32 diff = 0;
1393   UINT32 nearer = 0;
1394   UINT32 infront = 0;
1395   UINT32 max = 0;
1396   int precision_factor = (oz >> 15) & 0xf;
1397   int overflow = 0;
1398   int cvgcoeff = 0;
1399   UINT32 mempixel, memory_cvg;
1043#include "video/rdpzcomp.h"
14001044
1401   sz &= 0x3ffff;
1402   if (dzmem == 0x8000 && precision_factor < 3)
1403   {
1404      force_coplanar = 1;
1405   }
1406   if (!precision_factor)
1407   {
1408      dzmem = ((dzmem << 1) > 16) ? (dzmem << 1) : 16;
1409   }
1410   else if (precision_factor == 1)
1411   {
1412      dzmem = ((dzmem << 1) > 8) ? (dzmem << 1) : 8;
1413   }
1414   else if (precision_factor == 2)
1415   {
1416      dzmem = ((dzmem << 1) > 4) ? (dzmem << 1) : 4;
1417   }
1418   if (dzmem == 0 && precision_factor < 3)
1419   {
1420      dzmem = 0xffff;
1421   }
1422   if (dzmem > 0x8000)
1423   {
1424      dzmem = 0xffff;
1425   }
1426   dznew =((dzmem > dzpix) ? dzmem : (UINT32)dzpix) << 3;
1427   dznew &= 0x3ffff;
1045#define ZMODE0
1046   #define ANTIALIAS
1047      #define IMGREAD
1048         #include "video/rdpzcomp.c"
1049      #undef IMGREAD
1050         #include "video/rdpzcomp.c"
1051   #undef ANTIALIAS
1052      #define IMGREAD
1053         #include "video/rdpzcomp.c"
1054      #undef IMGREAD
1055         #include "video/rdpzcomp.c"
1056#undef ZMODE0
1057#define ZMODE1
1058   #define ANTIALIAS
1059      #define IMGREAD
1060         #include "video/rdpzcomp.c"
1061      #undef IMGREAD
1062         #include "video/rdpzcomp.c"
1063   #undef ANTIALIAS
1064      #define IMGREAD
1065         #include "video/rdpzcomp.c"
1066      #undef IMGREAD
1067         #include "video/rdpzcomp.c"
1068#undef ZMODE1
1069#define ZMODE2
1070   #define ANTIALIAS
1071      #define IMGREAD
1072         #include "video/rdpzcomp.c"
1073      #undef IMGREAD
1074         #include "video/rdpzcomp.c"
1075   #undef ANTIALIAS
1076      #define IMGREAD
1077         #include "video/rdpzcomp.c"
1078      #undef IMGREAD
1079         #include "video/rdpzcomp.c"
1080#undef ZMODE2
1081#define ZMODE3
1082   #define ANTIALIAS
1083      #define IMGREAD
1084         #include "video/rdpzcomp.c"
1085      #undef IMGREAD
1086         #include "video/rdpzcomp.c"
1087   #undef ANTIALIAS
1088      #define IMGREAD
1089         #include "video/rdpzcomp.c"
1090      #undef IMGREAD
1091         #include "video/rdpzcomp.c"
1092#undef ZMODE3
14281093
1429   farther = ((sz + dznew) >= oz) ? 1 : 0;
1430   diff = (sz >= dznew) ? (sz - dznew) : 0;
1431   nearer = (diff <= oz) ? 1: 0;
1432   infront = (sz < oz) ? 1 : 0;
1433   max = (dzmem == 0x3ffff);
1094static UINT32 (*z_compare)(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
14341095
1435   if (force_coplanar)
1436   {
1437      farther = nearer = 1;
1438   }
1439
1440   curpixel_overlap = 0;
1441
1442   switch(fb_size)
1443   {
1444      case 1: /* Banjo Tooie */
1445         memory_cvg = 0; //??
1446         break;
1447      case 2:
1448         mempixel = *(UINT16*)fb;
1449         memory_cvg = ((mempixel & 1) << 2) + (*hb & 3);
1450         break;
1451      case 3:
1452         mempixel = *(UINT32*)fb;
1453         memory_cvg = (mempixel >> 5) & 7;
1454         break;
1455      default:
1456         fatalerror("z_compare: fb_size = %d",fb_size);
1457         break;
1458   }
1459
1460   if (!other_modes.image_read_en)
1461   {
1462      memory_cvg = 7;
1463   }
1464
1465   overflow = ((memory_cvg + curpixel_cvg - 1) > 7) ? 1 : 0;
1466   curpixel_overlap = (other_modes.force_blend || (!overflow && other_modes.antialias_en && farther));
1467
1468   if (other_modes.z_mode == 1 && infront && farther && overflow)
1469   {
1470      cvgcoeff = ((dzmem >> dznew) - (sz >> dznew)) & 0xf;
1471      curpixel_cvg = ((cvgcoeff * (curpixel_cvg - 1)) >> 3) & 0xf;
1472   }
1473   if (curpixel_cvg > 8)
1474      curpixel_cvg = 8;
1475
1476   switch(other_modes.z_mode)
1477   {
1478      case 0: // Opaque
1479         return (max || (overflow ? infront : nearer))? 1 : 0;
1480         break;
1481      case 1: // Interpenetrating
1482         return (max || (overflow ? infront : nearer))? 1 : 0;
1483         break;
1484      case 2: // Transparent
1485         return (infront || max)? 1: 0;
1486         break;
1487      case 3: // Decal
1488         return (farther && nearer && !max) ? 1 : 0;
1489         break;
1490      default:
1491         fatalerror( "z_mode = %d", other_modes.z_mode);
1492         break;
1493   }
1494}
1495
14961096INLINE INT32 normalize_dzpix(INT32 sum)
14971097{
14981098   int count = 0;
r6795r6796
15551155   backr[0] = r;
15561156   backg[0] = g;
15571157   backb[0] = b;
1558   invr[0] = 255 - r;
1559   invg[0] = 255 - g;
1560   invb[0] = 255 - b;
1158   invr[0] = ~r;
1159   invg[0] = ~g;
1160   invb[0] = ~b;
15611161
15621162   if (centercvg == 8)
15631163   {
r6795r6796
15781178            backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
15791179            backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >>  8) & 0x07);
15801180            backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >>  3) & 0x07);
1581            invr[numoffull] = 255 - backr[numoffull];
1582            invg[numoffull] = 255 - backg[numoffull];
1583            invb[numoffull] = 255 - backb[numoffull];
1181            invr[numoffull] = ~backr[numoffull];
1182            invg[numoffull] = ~backg[numoffull];
1183            invb[numoffull] = ~backb[numoffull];
15841184         }
15851185         else
15861186         {
r6795r6796
16041204            backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
16051205            backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >>  8) & 0x07);
16061206            backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >>  3) & 0x07);
1607            invr[numoffull] = 255 - backr[numoffull];
1608            invg[numoffull] = 255 - backg[numoffull];
1609            invb[numoffull] = 255 - backb[numoffull];
1207            invr[numoffull] = ~backr[numoffull];
1208            invg[numoffull] = ~backg[numoffull];
1209            invb[numoffull] = ~backb[numoffull];
16101210         }
16111211         else
16121212         {
r6795r6796
16301230            backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
16311231            backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >>  8) & 0x07);
16321232            backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >>  3) & 0x07);
1633            invr[numoffull] = 255 - backr[numoffull];
1634            invg[numoffull] = 255 - backg[numoffull];
1635            invb[numoffull] = 255 - backb[numoffull];
1233            invr[numoffull] = ~backr[numoffull];
1234            invg[numoffull] = ~backg[numoffull];
1235            invb[numoffull] = ~backb[numoffull];
16361236         }
16371237         else
16381238         {
r6795r6796
16451245      toleft++;
16461246   }
16471247
1648   if (numoffull != 7)
1649   {
1650      fatalerror("Something went wrong in vi_filter16");
1651   }
1652
16531248   video_max(&backr[0], &max.i.r, &enb);
16541249   for(i = 1; i < 7; i++)
16551250   {
r6795r6796
17231318   i = ge_two(enb);
17241319   penumin.i.b = i ? min.i.b : penumin.i.b;
17251320
1726   penumin.i.r = 255 - penumin.i.r;
1727   penumin.i.g = 255 - penumin.i.g;
1728   penumin.i.b = 255 - penumin.i.b;
1321   penumin.i.r = ~penumin.i.r;
1322   penumin.i.g = ~penumin.i.g;
1323   penumin.i.b = ~penumin.i.b;
17291324
17301325   colr = (UINT32)penumin.i.r + (UINT32)penumax.i.r - (r << 1);
17311326   colg = (UINT32)penumin.i.g + (UINT32)penumax.i.g - (g << 1);
r6795r6796
17421337}
17431338
17441339// This needs to be fixed for endianness.
1745INLINE void divot_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index)
1340INLINE void divot_filter16(UINT8* r, UINT8* g, UINT8* b, UINT16* fbuff, UINT32 fbuff_index)
17461341{
1747   UINT32 leftr, leftg, leftb, rightr, rightg, rightb;
1342   UINT8 leftr, leftg, leftb, rightr, rightg, rightb;
17481343   UINT16 leftpix, rightpix;
17491344   UINT16* next, *prev;
17501345   UINT32 Lsw = fbuff_index & 1;
r6795r6796
20341629
20351630INLINE void video_max(UINT32* Pixels, UINT8* max, UINT32* enb)
20361631{
1632   int pos = 0;
1633   UINT32 temp = 0;
1634   if (Pixels[0] > Pixels[pos])
1635   {
1636      temp |= 1;
1637   }
1638   else if (Pixels[0] < Pixels[pos])
1639      temp |= 1;
1640
1641   if (Pixels[1] > Pixels[pos])
1642   {
1643      temp |= 2;
1644      pos = 1;
1645   }
1646   else if (Pixels[1] < Pixels[pos])
1647      temp |= 2;
1648   else
1649      pos = 1;
1650
1651   if (Pixels[2] > Pixels[pos])
1652   {
1653      temp |= 4;
1654      pos = 2;
1655   }
1656   else if (Pixels[2] < Pixels[pos])
1657      temp |= 4;
1658   else
1659      pos = 2;
1660
1661   if (Pixels[3] > Pixels[pos])
1662   {
1663      temp |= 8;
1664      pos = 3;
1665   }
1666   else if (Pixels[3] < Pixels[pos])
1667      temp |= 8;
1668   else
1669      pos = 3;
1670
1671   if (Pixels[4] > Pixels[pos])
1672   {
1673      temp |= 16;
1674      pos = 4;
1675   }
1676   else if (Pixels[4] < Pixels[pos])
1677      temp |= 16;
1678   else
1679      pos = 4;
1680
1681   if (Pixels[5] > Pixels[pos])
1682   {
1683      temp |= 32;
1684      pos = 5;
1685   }
1686   else if (Pixels[5] < Pixels[pos])
1687      temp |= 32;
1688   else
1689      pos = 5;
1690
1691   if (Pixels[6] > Pixels[pos])
1692   {
1693      temp |= 64;
1694      pos = 6;
1695   }
1696   else if (Pixels[6] < Pixels[pos])
1697      temp |= 64;
1698   else
1699      pos = 6;
1700
1701   if (Pixels[7] > Pixels[pos])
1702   {
1703      temp |= 128;
1704      pos = 7;
1705   }
1706   else if (Pixels[7] < Pixels[pos])
1707      temp |= 128;
1708   else
1709      pos = 7;
1710
1711   *enb = temp;
1712   *max = Pixels[pos];
1713}
1714/*
1715INLINE void video_max(UINT32* Pixels, UINT8* max, UINT32* enb)
1716{
20371717   int i;
20381718   int pos = 0;
20391719   *enb = 0;
r6795r6796
20551735   }
20561736   *max = Pixels[pos];
20571737}
1738*/
20581739
20591740INLINE UINT32 ge_two(UINT32 enb)
20601741{
2061   int i;
2062   int j = 0;
2063   for(i = 0; i < 7; i++)
1742   if(enb & 1)
20641743   {
2065      if (!((enb >> i) & 1))
2066      {
2067         j++;
2068      }
1744      if(enb & 2)
1745         return 1;
1746      if(enb & 4)
1747         return 1;
1748      if(enb & 8)
1749         return 1;
1750      if(enb & 16)
1751         return 1;
1752      if(enb & 32)
1753         return 1;
1754      if(enb & 64)
1755         return 1;
1756      if(enb & 128)
1757         return 1;
1758      return 0;
20691759   }
2070   return (j > 1);
1760   else if(enb & 2)
1761   {
1762      if(enb & 4)
1763         return 1;
1764      if(enb & 8)
1765         return 1;
1766      if(enb & 16)
1767         return 1;
1768      if(enb & 32)
1769         return 1;
1770      if(enb & 64)
1771         return 1;
1772      if(enb & 128)
1773         return 1;
1774      return 0;
1775   }
1776   else if(enb & 4)
1777   {
1778      if(enb & 8)
1779         return 1;
1780      if(enb & 16)
1781         return 1;
1782      if(enb & 32)
1783         return 1;
1784      if(enb & 64)
1785         return 1;
1786      if(enb & 128)
1787         return 1;
1788      return 0;
1789   }
1790   else if(enb & 8)
1791   {
1792      if(enb & 16)
1793         return 1;
1794      if(enb & 32)
1795         return 1;
1796      if(enb & 64)
1797         return 1;
1798      if(enb & 128)
1799         return 1;
1800      return 0;
1801   }
1802   else if(enb & 16)
1803   {
1804      if(enb & 32)
1805         return 1;
1806      if(enb & 64)
1807         return 1;
1808      if(enb & 128)
1809         return 1;
1810      return 0;
1811   }
1812   else if(enb & 32)
1813   {
1814      if(enb & 64)
1815         return 1;
1816      if(enb & 128)
1817         return 1;
1818      return 0;
1819   }
1820   else if(enb & 64)
1821   {
1822      if(enb & 128)
1823         return 1;
1824      return 0;
1825   }
1826   return 0;
20711827}
20721828
20731829INLINE void calculate_clamp_diffs(UINT32 prim_tile)
r6795r6796
21121868   }
21131869}
21141870
2115INLINE void set_shade_for_rects(void)
2116{
2117   shade_color.c = 0;
2118   //shade_color.i.r = 0;
2119   //shade_color.i.g = 0;
2120   //shade_color.i.b = 0;
2121   //shade_color.i.a = 0;
2122}
2123
21241871INLINE UINT32 getlog2(UINT32 lod_clamp)
21251872{
21261873   int i;
r6795r6796
21441891INLINE void copy_colors(COLOR* dst, COLOR* src)
21451892{
21461893   dst->c = src->c;
2147   //dst->i.r = src->i.r;
2148   //dst->i.g = src->i.g;
2149   //dst->i.b = src->i.b;
2150   //dst->i.a = src->i.a;
21511894}
21521895
21531896INLINE void BILERP_AND_WRITE(UINT32* src0, UINT32* src1, UINT32* dest)
r6795r6796
21671910   int shift;
21681911   int normout;
21691912   int wnorm;
2170   int temppoint, tempslope;
21711913   int tlu_rcp;
2172   int tempmask;
21731914   int shift_value;
21741915
2175   if ((sw & 0x8000) || !(sw & 0x7fff))
1916   if (!(sw & 0x7fff))
21761917   {
21771918      w_carry = 1;
21781919   }
r6795r6796
21871928
21881929   normout = ((sw << shift) & 0x3fff) >> 8;
21891930   wnorm = ((sw << shift) & 0xff) << 2;
2190   temppoint = NormPointRom[normout];
2191   tempslope = NormSlopeRom[normout];
21921931
2193   tlu_rcp = ((-(tempslope * wnorm)) >> 10);
2194   tlu_rcp = (tlu_rcp + temppoint);
1932   tlu_rcp = ((-(NormSlopeRom[normout] * wnorm)) >> 10) + NormPointRom[normout];
21951933
2196   *sss = SIGN16(ss) * tlu_rcp;
2197   *sst = SIGN16(st) * tlu_rcp;
2198   tempmask = ((1 << (shift+1)) - 1) << (29 - shift);
2199   shift_value = 13 - shift;
2200   if (shift_value < 0)
1934   if(shift == 14)
22011935   {
2202      shift_value = 0;
1936      *sss = (SIGN16(ss) * tlu_rcp) << 1;
1937      *sst = (SIGN16(st) * tlu_rcp) << 1;
22031938   }
2204   *sss >>= shift_value;
2205   *sst >>= shift_value;
2206   if (shift == 0xe)
1939   else
22071940   {
2208      *sss <<= 1;
2209      *sst <<= 1;
1941      shift_value = 13 - shift;
1942      *sss = (SIGN16(ss) * tlu_rcp) >> shift_value;
1943      *sst = (SIGN16(st) * tlu_rcp) >> shift_value;
22101944   }
22111945}
22121946
r6795r6796
22662000   }
22672001   else
22682002   {
2269      int special_bsel = 0;
2270      if (blender2b_a[0] == &memory_color.i.a)
2271      {
2272         special_bsel = 1;
2273      }
2274
22752003      inv_pixel_color.i.a = 0xff - *blender1b_a[0];
22762004
2277      BLENDER_EQUATION0(&r, &g, &b, special_bsel);
2005      BLENDER_EQUATION0(&r, &g, &b, special_bsel0);
22782006   }
22792007
22802008   return  (FBWRITE_32(fb,r,g,b));
r6795r6796
22842012{
22852013   UINT32 mem = *fb;
22862014   int r, g, b;
2287   int special_bsel = 0;
22882015
22892016   // Alpha compare
22902017   if (!alpha_compare(c2.i.a))
r6795r6796
23172044      memory_color.i.a = 0xe0;
23182045   }
23192046
2320   if (blender2b_a[0] == &memory_color.i.a)
2321   {
2322      special_bsel = 1;
2323   }
2324
23252047   inv_pixel_color.i.a = 0xff - *blender1b_a[0];
23262048
2327   BLENDER_EQUATION0(&r, &g, &b, special_bsel);
2049   BLENDER_EQUATION0(&r, &g, &b, special_bsel0);
23282050
23292051   blended_pixel_color.i.r = r;
23302052   blended_pixel_color.i.g = g;
r6795r6796
23422064   }
23432065   else
23442066   {
2345      if (blender2b_a[1] == &memory_color.i.a)
2346      {
2347         special_bsel = 1;
2348      }
2349      else
2350      {
2351         special_bsel = 0;
2352      }
2353
23542067      inv_pixel_color.i.a = 0xff - *blender1b_a[1];
23552068
2356      BLENDER_EQUATION1(&r, &g, &b, special_bsel);
2069      BLENDER_EQUATION1(&r, &g, &b, special_bsel1);
23572070   }
23582071
23592072   return  (FBWRITE_32(fb,r,g,b));
r6795r6796
23702083   int clipx1, clipx2, clipy1, clipy2;
23712084   int fill_cvg = 0;
23722085
2373   if (x2 < x1)
2374   {
2375      stricterror ("SCARS (E) case: fill_rectangle_32bit");
2376   }
2377
23782086   // TODO: clip
23792087   clipx1 = clip.xh / 4;
23802088   clipx2 = clip.xl / 4;
r6795r6796
23992107      y2 = clipy2-1;
24002108   }
24012109
2402   set_shade_for_rects();
2110   shade_color.c = 0;
24032111
24042112   fill_cvg = ((fill_color >> 5) & 7) + 1;
24052113
r6795r6796
24242132         for (i=x1; i <= x2; i++)
24252133         {
24262134            curpixel_cvg = fill_cvg;
2427            COLOR_COMBINER1(&c);
2135            c.c = COLOR_COMBINER1();
24282136            BLENDER1_32(&fb[(index + i)], c);
24292137         }
24302138      }
r6795r6796
24382146         for (i=x1; i <= x2; i++)
24392147         {
24402148            curpixel_cvg = fill_cvg;
2441            COLOR_COMBINER2_C0(&c1);
2442            COLOR_COMBINER2_C1(&c2);
2149            c1.c = COLOR_COMBINER2_C0();
2150            c2.c = COLOR_COMBINER2_C1();
24432151            BLENDER2_32(&fb[(index + i)], c1, c2);
24442152         }
24452153      }
r6795r6796
24702178   y1 = (rect->yh / 4);
24712179   y2 = (rect->yl / 4);
24722180
2473   if (x2 < x1)
2474   {
2475      stricterror( "x2 < x1: texture_rectangle_32bit" );
2476   }
2477
24782181   if (other_modes.cycle_type == CYCLE_TYPE_FILL || other_modes.cycle_type == CYCLE_TYPE_COPY)
24792182   {
24802183      rect->dsdx /= 4;
r6795r6796
25032206      }
25042207   }
25052208
2506   set_shade_for_rects(); // Needed by Pilotwings 64
2209   shade_color.c = 0;   // Needed by Pilotwings 64
25072210
25082211   t = (int)(rect->t) << 5;
25092212
25102213   if (other_modes.cycle_type == CYCLE_TYPE_1)
25112214   {
2215      CACHE_TEXTURE_PARAMS(tex_tile);
2216
25122217      for (j = y1; j < y2; j++)
25132218      {
25142219         int fb_index = j * fb_width;
r6795r6796
25232228            st = t >> 5;
25242229            if (rect->flip)
25252230            {
2526               TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
2231               texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
25272232            }
25282233            else
25292234            {
2530               TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
2235               texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
25312236            }
25322237
2533            COLOR_COMBINER1(&c);
2238            c.c = COLOR_COMBINER1();
25342239
25352240            BLENDER1_32(&fb[(fb_index + i)], c);
25362241
r6795r6796
25562261            st = t >> 5;
25572262            if (rect->flip)
25582263            {
2559               TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
2560               TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2);
2264               CACHE_TEXTURE_PARAMS(tex_tile);
2265               texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
2266
2267               CACHE_TEXTURE_PARAMS(tex_tile2);
2268               texel1_color.c = TEXTURE_PIPELINE(st, ss, tex_tile2);
25612269            }
25622270            else
25632271            {
2564               TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
2565               TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2);
2272               CACHE_TEXTURE_PARAMS(tex_tile);
2273               texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
2274
2275               CACHE_TEXTURE_PARAMS(tex_tile2);
2276               texel1_color.c = TEXTURE_PIPELINE(ss, st, tex_tile2);
25662277            }
25672278
2568            COLOR_COMBINER2_C0(&c1);
2569            COLOR_COMBINER2_C1(&c2);
2279            c1.c = COLOR_COMBINER2_C0();
2280            c2.c = COLOR_COMBINER2_C1();
25702281
25712282            BLENDER2_32(&fb[(fb_index + i)], c1, c2);
25722283
r6795r6796
25782289   }
25792290   else if (other_modes.cycle_type == CYCLE_TYPE_COPY)
25802291   {
2292      CACHE_TEXTURE_PARAMS(tex_tile);
2293
25812294      for (j = y1; j < y2; j++)
25822295      {
25832296         int fb_index = j * fb_width;
r6795r6796
25902303            st = t >> 5;
25912304            if (rect->flip)
25922305            {
2593               TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
2306               texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
25942307            }
25952308            else
25962309            {
2597               TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
2310               texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
25982311            }
25992312
26002313            fb[fb_index + i] = (texel0_color.i.r << 24) | (texel0_color.i.g << 16) | (texel0_color.i.b << 8)|1;
r6795r6796
26442357   clipy1 = clip.yh / 4;
26452358   clipy2 = clip.yl / 4;
26462359
2647
2648   if (other_modes.key_en)
2649   {
2650      stricterror( "render_spans_32: key_en" );
2651   }
2652
26532360   if (other_modes.cycle_type == CYCLE_TYPE_2 && texture)
26542361   {
26552362      if (!other_modes.tex_lod_en)
r6795r6796
26952402      shade_color.c = prim_color.c;
26962403   }
26972404
2405   CACHE_TEXTURE_PARAMS(tex_tile);
2406
26982407   for (i = start; i <= end; i++)
26992408   {
27002409      int xstart = span[i].lx;
r6795r6796
27362445         if (x >= clipx1 && x < clipx2)
27372446         {
27382447            curpixel_cvg = span[i].cvg[x];
2739            if (curpixel_cvg > 8)
2740            {
2741               stricterror("render_spans_32: curpixel_cvg = %d", curpixel_cvg);
2742            }
27432448            if (curpixel_cvg)
27442449            {
27452450               COLOR c1, c2;
r6795r6796
27842489               {
27852490                  if (other_modes.cycle_type == CYCLE_TYPE_1)
27862491                  {
2787                     TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
2492                     texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
27882493                  }
27892494                  else
27902495                  {
2791                     TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
2792                     TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2);
2496                     CACHE_TEXTURE_PARAMS(tex_tile);
2497                     texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
2498
2499                     CACHE_TEXTURE_PARAMS(tex_tile2);
2500                     texel1_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile2);
27932501                  }
27942502               }
27952503
27962504               if (other_modes.cycle_type == CYCLE_TYPE_1)
27972505               {
2798                  COLOR_COMBINER1(&c1);
2506                  c1.c = COLOR_COMBINER1();
27992507               }
28002508               else if (other_modes.cycle_type == CYCLE_TYPE_2)
28012509               {
2802                  COLOR_COMBINER2_C0(&c1);
2803                  COLOR_COMBINER2_C1(&c2);
2510                  c1.c = COLOR_COMBINER2_C0();
2511                  c2.c = COLOR_COMBINER2_C1();
28042512                 }
28052513
28062514               if ((zbuffer || other_modes.z_source_sel) && other_modes.z_compare_en)
r6795r6796
39063614   other_modes.dither_alpha_en      = (w2 & 0x02) ? 1 : 0;
39073615   other_modes.alpha_compare_en   = (w2 & 0x01) ? 1 : 0;
39083616
3909   texture_rectangle_16bit = rdp_texture_rectangle_16bit_func[((other_modes.z_update_en | other_modes.z_source_sel) << 3) | ((other_modes.z_compare_en | other_modes.z_source_sel) << 2) | other_modes.cycle_type];
3617   texture_rectangle_16bit = rdp_texture_rectangle_16bit_func[((((other_modes.z_update_en | other_modes.z_source_sel) << 3) | ((other_modes.z_compare_en | other_modes.z_source_sel) << 2) | other_modes.cycle_type) << 2) | other_modes.rgb_dither_sel];
3618   fill_rectangle_16bit = rdp_fill_rectangle_16bit_func[(other_modes.cycle_type << 2) | other_modes.rgb_dither_sel];
39103619
39113620   alpha_cvg_get = rdp_alpha_cvg_func[(other_modes.cvg_times_alpha << 1) | other_modes.alpha_cvg_select];
39123621
39133622   alpha_compare = rdp_alpha_compare_func[(other_modes.alpha_compare_en << 1) | other_modes.dither_alpha_en];
39143623
3915   render_spans_16_ns_nt_nz_nf = rdp_render_spans_16_func[0 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3916   render_spans_16_ns_nt_z_nf = rdp_render_spans_16_func[2 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3917   render_spans_16_ns_t_nz_nf = rdp_render_spans_16_func[4 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3918   render_spans_16_ns_t_z_nf = rdp_render_spans_16_func[6 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3919   render_spans_16_s_nt_nz_nf = rdp_render_spans_16_func[8 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3920   render_spans_16_s_nt_z_nf = rdp_render_spans_16_func[10 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3921   render_spans_16_s_t_nz_nf = rdp_render_spans_16_func[12 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3922   render_spans_16_s_t_z_nf = rdp_render_spans_16_func[14 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3923   render_spans_16_ns_nt_nz_f = rdp_render_spans_16_func[16 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3924   render_spans_16_ns_nt_z_f = rdp_render_spans_16_func[18 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3925   render_spans_16_ns_t_nz_f = rdp_render_spans_16_func[20 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3926   render_spans_16_ns_t_z_f = rdp_render_spans_16_func[22 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3927   render_spans_16_s_nt_nz_f = rdp_render_spans_16_func[24 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3928   render_spans_16_s_nt_z_f = rdp_render_spans_16_func[26 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3929   render_spans_16_s_t_nz_f = rdp_render_spans_16_func[28 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3930   render_spans_16_s_t_z_f = rdp_render_spans_16_func[30 + ((other_modes.cycle_type) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6))];
3624   z_compare = rdp_z_compare_func[(other_modes.z_mode << 2) | (other_modes.antialias_en << 1) | other_modes.image_read_en];
39313625
3626   render_spans_16_ns_nt_nz_nf = rdp_render_spans_16_func[0 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3627   render_spans_16_ns_nt_z_nf = rdp_render_spans_16_func[2 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3628   render_spans_16_ns_t_nz_nf = rdp_render_spans_16_func[4 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3629   render_spans_16_ns_t_z_nf = rdp_render_spans_16_func[6 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3630   render_spans_16_s_nt_nz_nf = rdp_render_spans_16_func[8 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3631   render_spans_16_s_nt_z_nf = rdp_render_spans_16_func[10 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3632   render_spans_16_s_t_nz_nf = rdp_render_spans_16_func[12 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3633   render_spans_16_s_t_z_nf = rdp_render_spans_16_func[14 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3634   render_spans_16_ns_nt_nz_f = rdp_render_spans_16_func[16 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3635   render_spans_16_ns_nt_z_f = rdp_render_spans_16_func[18 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3636   render_spans_16_ns_t_nz_f = rdp_render_spans_16_func[20 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3637   render_spans_16_ns_t_z_f = rdp_render_spans_16_func[22 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3638   render_spans_16_s_nt_nz_f = rdp_render_spans_16_func[24 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3639   render_spans_16_s_nt_z_f = rdp_render_spans_16_func[26 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3640   render_spans_16_s_t_nz_f = rdp_render_spans_16_func[28 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3641   render_spans_16_s_t_z_f = rdp_render_spans_16_func[30 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
3642
39323643   TEXTURE_PIPELINE = rdp_texture_pipeline_func[(other_modes.mid_texel << 1) | other_modes.sample_type];
39333644
3934   CLAMP = (other_modes.cycle_type == CYCLE_TYPE_COPY) ? CLAMP_C : CLAMP_NC;
3935   CLAMP_LIGHT = (other_modes.cycle_type == CYCLE_TYPE_COPY) ? CLAMP_LIGHT_C : CLAMP_LIGHT_NC;
3936
39373645   for(index = 0; index < 8; index++)
39383646   {
39393647      tile[index].fetch_index = (tile[index].size << 5) | (tile[index].format << 2) | (other_modes.en_tlut << 1) | other_modes.tlut_type;
r6795r6796
39453653   BLENDER_EQUATION0 = other_modes.force_blend ? BLENDER_EQUATION0_FORCE : BLENDER_EQUATION0_NFORCE;
39463654   BLENDER_EQUATION1 = other_modes.force_blend ? BLENDER_EQUATION1_FORCE : BLENDER_EQUATION1_NFORCE;
39473655
3948   BLENDER1_16 = rdp_blender1_16_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | (other_modes.rgb_dither_sel >> 1)];
3949   BLENDER2_16 = rdp_blender2_16_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | (other_modes.rgb_dither_sel >> 1)];
3656   BLENDER1_16_DITH = rdp_blender1_16_dith_func[(other_modes.image_read_en << 3) | (other_modes.z_compare_en << 2) | ((other_modes.rgb_dither_sel >> 1) << 1) | other_modes.alpha_compare_en];
3657   BLENDER2_16_DITH = rdp_blender2_16_dith_func[(other_modes.image_read_en << 3) | (other_modes.z_compare_en << 2) | ((other_modes.rgb_dither_sel >> 1) << 1) | other_modes.alpha_compare_en];
3658   BLENDER1_16_NDITH = rdp_blender1_16_ndith_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | other_modes.alpha_compare_en];
3659   BLENDER2_16_NDITH = rdp_blender2_16_ndith_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | other_modes.alpha_compare_en];
39503660
39513661   SET_BLENDER_INPUT(0, 0, &blender1a_r[0], &blender1a_g[0], &blender1a_b[0], &blender1b_a[0],
39523662                 other_modes.blend_m1a_0, other_modes.blend_m1b_0);
r6795r6796
39563666                 other_modes.blend_m1a_1, other_modes.blend_m1b_1);
39573667   SET_BLENDER_INPUT(1, 1, &blender2a_r[1], &blender2a_g[1], &blender2a_b[1], &blender2b_a[1],
39583668                 other_modes.blend_m2a_1, other_modes.blend_m2b_1);
3669
3670   special_bsel0 = (blender2b_a[0] == &memory_color.i.a) ? 2 : 0;
3671   special_bsel1 = (blender2b_a[1] == &memory_color.i.a) ? 2 : 0;
39593672}
39603673
39613674static RDP_COMMAND( rdp_load_tlut )
r6795r6796
40043717            }
40053718            break;
40063719        }*/
4007      default:   stricterror("RDP: load_tlut: size = %d\n", ti_size);
3720      default:   fatalerror("RDP: load_tlut: size = %d\n", ti_size);
40083721   }
4009
4010   if (TMEM[0x1000] != 25 || TMEM[0x1001] != 25)
4011   {
4012      stricterror("rdp_load_tlut: TMEM has been written out-of-bounds");
4013   }
40143722}
40153723
40163724static RDP_COMMAND( rdp_set_tile_size )
r6795r6796
40403748   tile[tilenum].sh = sh = ((w2 >> 12) & 0xfff);
40413749   dxt   = ((w2 >>  0) & 0xfff);
40423750
4043   if (sh < sl)
4044   {
4045      //fatalerror( "load_block: sh < sl" );
4046   }
4047
40483751   width = (sh - sl) + 1;
40493752
40503753   if (width > 2048) // Hack for Magical Tetris Challenge
r6795r6796
40623765
40633766   if ((ti_address & 3) && (ti_address & 0xffffff00) != 0xf8a00)
40643767   {
4065      stricterror( "load block: unaligned ti_address 0x%x",ti_address ); // Rat Attack, Frogger 2 prototype
3768      fatalerror( "load block: unaligned ti_address 0x%x",ti_address ); // Rat Attack, Frogger 2 prototype
40663769   }
40673770
40683771   src = (UINT32*)&ram16[ti_address2 >> 1];
r6795r6796
40743777      width = 0x1000 - tb*4; // Hack for Magical Tetris Challenge
40753778   }
40763779
4077   if (ti_width2 < 0)
4078   {
4079      fatalerror( "load_block: negative ti_width2" );
4080   }
4081
40823780   switch (ti_size)
40833781   {
40843782      case PIXEL_SIZE_4BIT:   ti_width2 >>= 1; break;
r6795r6796
41483846      return; // Needed by Wipeout 64
41493847   }
41503848
4151   if ((ti_format != tex_tile->format || ti_size != tex_tile->size))
4152   {
4153      fatalerror("load_tile: format conversion required!\n %d %d %d %d", ti_format, tex_tile->format, ti_size, tex_tile->size);
4154   }
4155
41563849   tex_tile->sl = ((w1 >> 12) & 0xfff);
41573850   tex_tile->tl = ((w1 >>  0) & 0xfff);
41583851   tex_tile->sh = ((w2 >> 12) & 0xfff);
r6795r6796
42973990   tex_tile->shift_s   = (w2 >>  0) & 0xf;
42983991   tex_tile->fetch_index = (tex_tile->size << 5) | (tex_tile->format << 2) | (other_modes.en_tlut << 1) | other_modes.tlut_type;
42993992
4300   // TODO: clamp & mirror parameters
3993   tex_tile->mask_s = (tex_tile->mask_s > 10) ? 10 : tex_tile->mask_s;
3994   tex_tile->mask_t = (tex_tile->mask_t > 10) ? 10 : tex_tile->mask_t;
43013995}
43023996
43033997static RDP_COMMAND( rdp_fill_rect )
r6795r6796
43954089   SET_SUB_ALPHA_INPUT(&combiner_alphasub_b[1], combine.sub_b_a1);
43964090   SET_MUL_ALPHA_INPUT(&combiner_alphamul[1], combine.mul_a1);
43974091   SET_SUB_ALPHA_INPUT(&combiner_alphaadd[1], combine.add_a1);
4092
4093   if(combiner_rgbsub_a_r[1] == &noise_color.i.r)
4094   {
4095      COLOR_COMBINER1 = COLOR_COMBINER1_NOISE;
4096      COLOR_COMBINER2_C0 = COLOR_COMBINER2_C0_NOISE;
4097      COLOR_COMBINER2_C1 = COLOR_COMBINER2_C1_NOISE;
4098   }
4099   else
4100   {
4101      COLOR_COMBINER1 = COLOR_COMBINER1_NNOISE;
4102      COLOR_COMBINER2_C0 = COLOR_COMBINER2_C0_NNOISE;
4103      COLOR_COMBINER2_C1 = COLOR_COMBINER2_C1_NNOISE;
4104   }
43984105}
43994106
44004107static RDP_COMMAND( rdp_set_texture_image )
r6795r6796
45214228   dp_start = dp_current = dp_end;
45224229}
45234230
4524INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D)
4525{
4231//INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D)
4232//{
4233   //*out = cc_lut_base[(*D << 17) + (*C << 9) + *A - *B];
4234   /* The speedy, lookup table enabled version */
4235   //*out = cc_lut2[(cc_lut1[(*A << 16) | (*B << 8) | *C] << 8) | *D];
4236
4237   /*
4238   The slow, branchy version
4239
45264240   INT32 color = (((*A-*B)* *C) + (*D << 8) + 0x80);
45274241   color >>= 8;
45284242   if (color > 255)
r6795r6796
45374251   {
45384252      *out = (UINT8)color;
45394253   }
4540}
4254   */
4255//}
45414256
45424257INLINE void BLENDER_EQUATION0_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special)
45434258{
4544   UINT8 blend1a, blend2a;
4545   UINT32 sum = 0;
4259   int blend1a = *blender1b_a[0];
4260   int blend2a = *blender2b_a[0];
45464261   INT32 tr, tg, tb;
4547   blend1a = *blender1b_a[0];
4548   blend2a = *blender2b_a[0];
45494262   if (bsel_special)
45504263   {
45514264      blend1a &= 0xe0;
45524265   }
45534266
4554   sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5;
4267   tr = (int)(*blender1a_r[0]) * blend1a + (int)(*blender2a_r[0]) * blend2a;
4268   tg = (int)(*blender1a_g[0]) * blend1a + (int)(*blender2a_g[0]) * blend2a;
4269   tb = (int)(*blender1a_b[0]) * blend1a + (int)(*blender2a_b[0]) * blend2a;
45554270
4556   tr = (((int)(*blender1a_r[0]) * (int)(blend1a))) +
4557      (((int)(*blender2a_r[0]) * (int)(blend2a)));
4558   tr += (bsel_special) ? (((int)(*blender2a_r[0])) << 5) : (((int)(*blender2a_r[0])) << 3);
4271   tr += ((int)(*blender2a_r[0])) << (3 + bsel_special);
4272   tg += ((int)(*blender2a_g[0])) << (3 + bsel_special);
4273   tb += ((int)(*blender2a_b[0])) << (3 + bsel_special);
45594274
4560   tg = (((int)(*blender1a_g[0]) * (int)(blend1a))) +
4561      (((int)(*blender2a_g[0]) * (int)(blend2a)));
4562   tg += (bsel_special) ? ((int)((*blender2a_g[0])) << 5) : (((int)(*blender2a_g[0])) << 3);
4563
4564   tb = (((int)(*blender1a_b[0]) * (int)(blend1a))) +
4565      (((int)(*blender2a_b[0]) * (int)(blend2a)));
4566   tb += (bsel_special) ? (((int)(*blender2a_b[0])) << 5) : (((int)(*blender2a_b[0])) << 3);
4567
45684275   tr >>= 8;
45694276   tg >>= 8;
45704277   tb >>= 8;
r6795r6796
47914498#undef COLOR_ON_CVG
47924499   #include "video/rdpfb.c"
47934500
4794#define IMGREAD
4795   #define ZCOMPARE
4796      #define RGBDITHER1
4797         #include "video/rdpblend.c"
4798      #undef RGBDITHER1
4799         #include "video/rdpblend.c"
4800   #undef ZCOMPARE
4801      #define RGBDITHER1
4802         #include "video/rdpblend.c"
4803      #undef RGBDITHER1
4804         #include "video/rdpblend.c"
4805#undef IMGREAD
4806   #define ZCOMPARE
4807      #define RGBDITHER1
4808         #include "video/rdpblend.c"
4809      #undef RGBDITHER1
4810         #include "video/rdpblend.c"
4811   #undef ZCOMPARE
4812      #define RGBDITHER1
4813         #include "video/rdpblend.c"
4814      #undef RGBDITHER1
4815         #include "video/rdpblend.c"
4501#define ALPHACOMPARE
4502   #define IMGREAD
4503      #define ZCOMPARE
4504         #define RGBDITHER1
4505            #include "video/rdpblend.c"
4506         #undef RGBDITHER1
4507            #include "video/rdpblend.c"
4508      #undef ZCOMPARE
4509         #define RGBDITHER1
4510            #include "video/rdpblend.c"
4511         #undef RGBDITHER1
4512            #include "video/rdpblend.c"
4513   #undef IMGREAD
4514      #define ZCOMPARE
4515         #define RGBDITHER1
4516            #include "video/rdpblend.c"
4517         #undef RGBDITHER1
4518            #include "video/rdpblend.c"
4519      #undef ZCOMPARE
4520         #define RGBDITHER1
4521            #include "video/rdpblend.c"
4522         #undef RGBDITHER1
4523            #include "video/rdpblend.c"
4524#undef ALPHACOMPARE
4525   #define IMGREAD
4526      #define ZCOMPARE
4527         #define RGBDITHER1
4528            #include "video/rdpblend.c"
4529         #undef RGBDITHER1
4530            #include "video/rdpblend.c"
4531      #undef ZCOMPARE
4532         #define RGBDITHER1
4533            #include "video/rdpblend.c"
4534         #undef RGBDITHER1
4535            #include "video/rdpblend.c"
4536   #undef IMGREAD
4537      #define ZCOMPARE
4538         #define RGBDITHER1
4539            #include "video/rdpblend.c"
4540         #undef RGBDITHER1
4541            #include "video/rdpblend.c"
4542      #undef ZCOMPARE
4543         #define RGBDITHER1
4544            #include "video/rdpblend.c"
4545         #undef RGBDITHER1
4546            #include "video/rdpblend.c"
48164547
48174548#include "video/rdpfetch.c"
48184549
r6795r6796
48534584      #undef BAYERDITHER
48544585         #include "video/rdptrect.c"
48554586
4856#define SHADE
4857   #define TEXTURE
4858      #define ZBUF
4859         #define FLIP
4860            #define ZUPDATE
4861               #define ZCOMPARE
4862                  #include "video/rdpspn16.c"
4863               #undef ZCOMPARE
4864                  #include "video/rdpspn16.c"
4865            #undef ZUPDATE
4866               #define ZCOMPARE
4867                  #include "video/rdpspn16.c"
4868               #undef ZCOMPARE
4869                  #include "video/rdpspn16.c"
4870         #undef FLIP
4871            #define ZUPDATE
4872               #define ZCOMPARE
4873                  #include "video/rdpspn16.c"
4874               #undef ZCOMPARE
4875                  #include "video/rdpspn16.c"
4876            #undef ZUPDATE
4877               #define ZCOMPARE
4878                  #include "video/rdpspn16.c"
4879               #undef ZCOMPARE
4880                  #include "video/rdpspn16.c"
4881      #undef ZBUF
4882         #define FLIP
4883            #define ZUPDATE
4884               #define ZCOMPARE
4885                  #include "video/rdpspn16.c"
4886               #undef ZCOMPARE
4887                  #include "video/rdpspn16.c"
4888            #undef ZUPDATE
4889               #define ZCOMPARE
4890                  #include "video/rdpspn16.c"
4891               #undef ZCOMPARE
4892                  #include "video/rdpspn16.c"
4893         #undef FLIP
4894            #define ZUPDATE
4895               #define ZCOMPARE
4896                  #include "video/rdpspn16.c"
4897               #undef ZCOMPARE
4898                  #include "video/rdpspn16.c"
4899            #undef ZUPDATE
4900               #define ZCOMPARE
4901                  #include "video/rdpspn16.c"
4902               #undef ZCOMPARE
4903                  #include "video/rdpspn16.c"
4904   #undef TEXTURE
4905      #define ZBUF
4906         #define FLIP
4907            #define ZUPDATE
4908               #define ZCOMPARE
4909                  #include "video/rdpspn16.c"
4910               #undef ZCOMPARE
4911                  #include "video/rdpspn16.c"
4912            #undef ZUPDATE
4913               #define ZCOMPARE
4914                  #include "video/rdpspn16.c"
4915               #undef ZCOMPARE
4916                  #include "video/rdpspn16.c"
4917         #undef FLIP
4918            #define ZUPDATE
4919               #define ZCOMPARE
4920                  #include "video/rdpspn16.c"
4921               #undef ZCOMPARE
4922                  #include "video/rdpspn16.c"
4923            #undef ZUPDATE
4924               #define ZCOMPARE
4925                  #include "video/rdpspn16.c"
4926               #undef ZCOMPARE
4927                  #include "video/rdpspn16.c"
4928      #undef ZBUF
4929         #define FLIP
4930            #define ZUPDATE
4931               #define ZCOMPARE
4932                  #include "video/rdpspn16.c"
4933               #undef ZCOMPARE
4934                  #include "video/rdpspn16.c"
4935            #undef ZUPDATE
4936               #define ZCOMPARE
4937                  #include "video/rdpspn16.c"
4938               #undef ZCOMPARE
4939                  #include "video/rdpspn16.c"
4940         #undef FLIP
4941            #define ZUPDATE
4942               #define ZCOMPARE
4943                  #include "video/rdpspn16.c"
4944               #undef ZCOMPARE
4945                  #include "video/rdpspn16.c"
4946            #undef ZUPDATE
4947               #define ZCOMPARE
4948                  #include "video/rdpspn16.c"
4949               #undef ZCOMPARE
4950                  #include "video/rdpspn16.c"
4951#undef SHADE
4952   #define TEXTURE
4953      #define ZBUF
4954         #define FLIP
4955            #define ZUPDATE
4956               #define ZCOMPARE
4957                  #include "video/rdpspn16.c"
4958               #undef ZCOMPARE
4959                  #include "video/rdpspn16.c"
4960            #undef ZUPDATE
4961               #define ZCOMPARE
4962                  #include "video/rdpspn16.c"
4963               #undef ZCOMPARE
4964                  #include "video/rdpspn16.c"
4965         #undef FLIP
4966            #define ZUPDATE
4967               #define ZCOMPARE
4968                  #include "video/rdpspn16.c"
4969               #undef ZCOMPARE
4970                  #include "video/rdpspn16.c"
4971            #undef ZUPDATE
4972               #define ZCOMPARE
4973                  #include "video/rdpspn16.c"
4974               #undef ZCOMPARE
4975                  #include "video/rdpspn16.c"
4976      #undef ZBUF
4977         #define FLIP
4978            #define ZUPDATE
4979               #define ZCOMPARE
4980                  #include "video/rdpspn16.c"
4981               #undef ZCOMPARE
4982                  #include "video/rdpspn16.c"
4983            #undef ZUPDATE
4984               #define ZCOMPARE
4985                  #include "video/rdpspn16.c"
4986               #undef ZCOMPARE
4987                  #include "video/rdpspn16.c"
4988         #undef FLIP
4989            #define ZUPDATE
4990               #define ZCOMPARE
4991                  #include "video/rdpspn16.c"
4992               #undef ZCOMPARE
4993                  #include "video/rdpspn16.c"
4994            #undef ZUPDATE
4995               #define ZCOMPARE
4996                  #include "video/rdpspn16.c"
4997               #undef ZCOMPARE
4998                  #include "video/rdpspn16.c"
4999   #undef TEXTURE
5000      #define ZBUF
5001         #define FLIP
5002            #define ZUPDATE
5003               #define ZCOMPARE
5004                  #include "video/rdpspn16.c"
5005               #undef ZCOMPARE
5006                  #include "video/rdpspn16.c"
5007            #undef ZUPDATE
5008               #define ZCOMPARE
5009                  #include "video/rdpspn16.c"
5010               #undef ZCOMPARE
5011                  #include "video/rdpspn16.c"
5012         #undef FLIP
5013            #define ZUPDATE
5014               #define ZCOMPARE
5015                  #include "video/rdpspn16.c"
5016               #undef ZCOMPARE
5017                  #include "video/rdpspn16.c"
5018            #undef ZUPDATE
5019               #define ZCOMPARE
5020                  #include "video/rdpspn16.c"
5021               #undef ZCOMPARE
5022                  #include "video/rdpspn16.c"
5023      #undef ZBUF
5024         #define FLIP
5025            #define ZUPDATE
5026               #define ZCOMPARE
5027                  #include "video/rdpspn16.c"
5028               #undef ZCOMPARE
5029                  #include "video/rdpspn16.c"
5030            #undef ZUPDATE
5031               #define ZCOMPARE
5032                  #include "video/rdpspn16.c"
5033               #undef ZCOMPARE
5034                  #include "video/rdpspn16.c"
5035         #undef FLIP
5036            #define ZUPDATE
5037               #define ZCOMPARE
5038                  #include "video/rdpspn16.c"
5039               #undef ZCOMPARE
5040                  #include "video/rdpspn16.c"
5041            #undef ZUPDATE
5042               #define ZCOMPARE
5043                  #include "video/rdpspn16.c"
5044               #undef ZCOMPARE
5045                  #include "video/rdpspn16.c"
4587#define MAGICDITHER
4588   #include "video/rdpfrect.c"
4589#undef MAGICDITHER
4590#define BAYERDITHER
4591   #include "video/rdpfrect.c"
4592#undef BAYERDITHER
4593   #include "video/rdpfrect.c"
4594
4595#define MAGICDITHER
4596   #define SHADE
4597      #define TEXTURE
4598         #define ZBUF
4599            #define FLIP
4600               #define ZUPDATE
4601                  #define ZCOMPARE
4602                     #include "video/rdpspn16.c"
4603                  #undef ZCOMPARE
4604                     #include "video/rdpspn16.c"
4605               #undef ZUPDATE
4606                  #define ZCOMPARE
4607                     #include "video/rdpspn16.c"
4608                  #undef ZCOMPARE
4609                     #include "video/rdpspn16.c"
4610            #undef FLIP
4611               #define ZUPDATE
4612                  #define ZCOMPARE
4613                     #include "video/rdpspn16.c"
4614                  #undef ZCOMPARE
4615                     #include "video/rdpspn16.c"
4616               #undef ZUPDATE
4617                  #define ZCOMPARE
4618                     #include "video/rdpspn16.c"
4619                  #undef ZCOMPARE
4620                     #include "video/rdpspn16.c"
4621         #undef ZBUF
4622            #define FLIP
4623               #define ZUPDATE
4624                  #define ZCOMPARE
4625                     #include "video/rdpspn16.c"
4626                  #undef ZCOMPARE
4627                     #include "video/rdpspn16.c"
4628               #undef ZUPDATE
4629                  #define ZCOMPARE
4630                     #include "video/rdpspn16.c"
4631                  #undef ZCOMPARE
4632                     #include "video/rdpspn16.c"
4633            #undef FLIP
4634               #define ZUPDATE
4635                  #define ZCOMPARE
4636                     #include "video/rdpspn16.c"
4637                  #undef ZCOMPARE
4638                     #include "video/rdpspn16.c"
4639               #undef ZUPDATE
4640                  #define ZCOMPARE
4641                     #include "video/rdpspn16.c"
4642                  #undef ZCOMPARE
4643                     #include "video/rdpspn16.c"
4644      #undef TEXTURE
4645         #define ZBUF
4646            #define FLIP
4647               #define ZUPDATE
4648                  #define ZCOMPARE
4649                     #include "video/rdpspn16.c"
4650                  #undef ZCOMPARE
4651                     #include "video/rdpspn16.c"
4652               #undef ZUPDATE
4653                  #define ZCOMPARE
4654                     #include "video/rdpspn16.c"
4655                  #undef ZCOMPARE
4656                     #include "video/rdpspn16.c"
4657            #undef FLIP
4658               #define ZUPDATE
4659                  #define ZCOMPARE
4660                     #include "video/rdpspn16.c"
4661                  #undef ZCOMPARE
4662                     #include "video/rdpspn16.c"
4663               #undef ZUPDATE
4664                  #define ZCOMPARE
4665                     #include "video/rdpspn16.c"
4666                  #undef ZCOMPARE
4667                     #include "video/rdpspn16.c"
4668         #undef ZBUF
4669            #define FLIP
4670               #define ZUPDATE
4671                  #define ZCOMPARE
4672                     #include "video/rdpspn16.c"
4673                  #undef ZCOMPARE
4674                     #include "video/rdpspn16.c"
4675               #undef ZUPDATE
4676                  #define ZCOMPARE
4677                     #include "video/rdpspn16.c"
4678                  #undef ZCOMPARE
4679                     #include "video/rdpspn16.c"
4680            #undef FLIP
4681               #define ZUPDATE
4682                  #define ZCOMPARE
4683                     #include "video/rdpspn16.c"
4684                  #undef ZCOMPARE
4685                     #include "video/rdpspn16.c"
4686               #undef ZUPDATE
4687                  #define ZCOMPARE
4688                     #include "video/rdpspn16.c"
4689                  #undef ZCOMPARE
4690                     #include "video/rdpspn16.c"
4691   #undef SHADE
4692      #define TEXTURE
4693         #define ZBUF
4694            #define FLIP
4695               #define ZUPDATE
4696                  #define ZCOMPARE
4697                     #include "video/rdpspn16.c"
4698                  #undef ZCOMPARE
4699                     #include "video/rdpspn16.c"
4700               #undef ZUPDATE
4701                  #define ZCOMPARE
4702                     #include "video/rdpspn16.c"
4703                  #undef ZCOMPARE
4704                     #include "video/rdpspn16.c"
4705            #undef FLIP
4706               #define ZUPDATE
4707                  #define ZCOMPARE
4708                     #include "video/rdpspn16.c"
4709                  #undef ZCOMPARE
4710                     #include "video/rdpspn16.c"
4711               #undef ZUPDATE
4712                  #define ZCOMPARE
4713                     #include "video/rdpspn16.c"
4714                  #undef ZCOMPARE
4715                     #include "video/rdpspn16.c"
4716         #undef ZBUF
4717            #define FLIP
4718               #define ZUPDATE
4719                  #define ZCOMPARE
4720                     #include "video/rdpspn16.c"
4721                  #undef ZCOMPARE
4722                     #include "video/rdpspn16.c"
4723               #undef ZUPDATE
4724                  #define ZCOMPARE
4725                     #include "video/rdpspn16.c"
4726                  #undef ZCOMPARE
4727                     #include "video/rdpspn16.c"
4728            #undef FLIP
4729               #define ZUPDATE
4730                  #define ZCOMPARE
4731                     #include "video/rdpspn16.c"
4732                  #undef ZCOMPARE
4733                     #include "video/rdpspn16.c"
4734               #undef ZUPDATE
4735                  #define ZCOMPARE
4736                     #include "video/rdpspn16.c"
4737                  #undef ZCOMPARE
4738                     #include "video/rdpspn16.c"
4739      #undef TEXTURE
4740         #define ZBUF
4741            #define FLIP
4742               #define ZUPDATE
4743                  #define ZCOMPARE
4744                     #include "video/rdpspn16.c"
4745                  #undef ZCOMPARE
4746                     #include "video/rdpspn16.c"
4747               #undef ZUPDATE
4748                  #define ZCOMPARE
4749                     #include "video/rdpspn16.c"
4750                  #undef ZCOMPARE
4751                     #include "video/rdpspn16.c"
4752            #undef FLIP
4753               #define ZUPDATE
4754                  #define ZCOMPARE
4755                     #include "video/rdpspn16.c"
4756                  #undef ZCOMPARE
4757                     #include "video/rdpspn16.c"
4758               #undef ZUPDATE
4759                  #define ZCOMPARE
4760                     #include "video/rdpspn16.c"
4761                  #undef ZCOMPARE
4762                     #include "video/rdpspn16.c"
4763         #undef ZBUF
4764            #define FLIP
4765               #define ZUPDATE
4766                  #define ZCOMPARE
4767                     #include "video/rdpspn16.c"
4768                  #undef ZCOMPARE
4769                     #include "video/rdpspn16.c"
4770               #undef ZUPDATE
4771                  #define ZCOMPARE
4772                     #include "video/rdpspn16.c"
4773                  #undef ZCOMPARE
4774                     #include "video/rdpspn16.c"
4775            #undef FLIP
4776               #define ZUPDATE
4777                  #define ZCOMPARE
4778                     #include "video/rdpspn16.c"
4779                  #undef ZCOMPARE
4780                     #include "video/rdpspn16.c"
4781               #undef ZUPDATE
4782                  #define ZCOMPARE
4783                     #include "video/rdpspn16.c"
4784                  #undef ZCOMPARE
4785                     #include "video/rdpspn16.c"
4786#undef MAGICDITHER
4787#define BAYERDITHER
4788   #define SHADE
4789      #define TEXTURE
4790         #define ZBUF
4791            #define FLIP
4792               #define ZUPDATE
4793                  #define ZCOMPARE
4794                     #include "video/rdpspn16.c"
4795                  #undef ZCOMPARE
4796                     #include "video/rdpspn16.c"
4797               #undef ZUPDATE
4798                  #define ZCOMPARE
4799                     #include "video/rdpspn16.c"
4800                  #undef ZCOMPARE
4801                     #include "video/rdpspn16.c"
4802            #undef FLIP
4803               #define ZUPDATE
4804                  #define ZCOMPARE
4805                     #include "video/rdpspn16.c"
4806                  #undef ZCOMPARE
4807                     #include "video/rdpspn16.c"
4808               #undef ZUPDATE
4809                  #define ZCOMPARE
4810                     #include "video/rdpspn16.c"
4811                  #undef ZCOMPARE
4812                     #include "video/rdpspn16.c"
4813         #undef ZBUF
4814            #define FLIP
4815               #define ZUPDATE
4816                  #define ZCOMPARE
4817                     #include "video/rdpspn16.c"
4818                  #undef ZCOMPARE
4819                     #include "video/rdpspn16.c"
4820               #undef ZUPDATE
4821                  #define ZCOMPARE
4822                     #include "video/rdpspn16.c"
4823                  #undef ZCOMPARE
4824                     #include "video/rdpspn16.c"
4825            #undef FLIP
4826               #define ZUPDATE
4827                  #define ZCOMPARE
4828                     #include "video/rdpspn16.c"
4829                  #undef ZCOMPARE
4830                     #include "video/rdpspn16.c"
4831               #undef ZUPDATE
4832                  #define ZCOMPARE
4833                     #include "video/rdpspn16.c"
4834                  #undef ZCOMPARE
4835                     #include "video/rdpspn16.c"
4836      #undef TEXTURE
4837         #define ZBUF
4838            #define FLIP
4839               #define ZUPDATE
4840                  #define ZCOMPARE
4841                     #include "video/rdpspn16.c"
4842                  #undef ZCOMPARE
4843                     #include "video/rdpspn16.c"
4844               #undef ZUPDATE
4845                  #define ZCOMPARE
4846                     #include "video/rdpspn16.c"
4847                  #undef ZCOMPARE
4848                     #include "video/rdpspn16.c"
4849            #undef FLIP
4850               #define ZUPDATE
4851                  #define ZCOMPARE
4852                     #include "video/rdpspn16.c"
4853                  #undef ZCOMPARE
4854                     #include "video/rdpspn16.c"
4855               #undef ZUPDATE
4856                  #define ZCOMPARE
4857                     #include "video/rdpspn16.c"
4858                  #undef ZCOMPARE
4859                     #include "video/rdpspn16.c"
4860         #undef ZBUF
4861            #define FLIP
4862               #define ZUPDATE
4863                  #define ZCOMPARE
4864                     #include "video/rdpspn16.c"
4865                  #undef ZCOMPARE
4866                     #include "video/rdpspn16.c"
4867               #undef ZUPDATE
4868                  #define ZCOMPARE
4869                     #include "video/rdpspn16.c"
4870                  #undef ZCOMPARE
4871                     #include "video/rdpspn16.c"
4872            #undef FLIP
4873               #define ZUPDATE
4874                  #define ZCOMPARE
4875                     #include "video/rdpspn16.c"
4876                  #undef ZCOMPARE
4877                     #include "video/rdpspn16.c"
4878               #undef ZUPDATE
4879                  #define ZCOMPARE
4880                     #include "video/rdpspn16.c"
4881                  #undef ZCOMPARE
4882                     #include "video/rdpspn16.c"
4883   #undef SHADE
4884      #define TEXTURE
4885         #define ZBUF
4886            #define FLIP
4887               #define ZUPDATE
4888                  #define ZCOMPARE
4889                     #include "video/rdpspn16.c"
4890                  #undef ZCOMPARE
4891                     #include "video/rdpspn16.c"
4892               #undef ZUPDATE
4893                  #define ZCOMPARE
4894                     #include "video/rdpspn16.c"
4895                  #undef ZCOMPARE
4896                     #include "video/rdpspn16.c"
4897            #undef FLIP
4898               #define ZUPDATE
4899                  #define ZCOMPARE
4900                     #include "video/rdpspn16.c"
4901                  #undef ZCOMPARE
4902                     #include "video/rdpspn16.c"
4903               #undef ZUPDATE
4904                  #define ZCOMPARE
4905                     #include "video/rdpspn16.c"
4906                  #undef ZCOMPARE
4907                     #include "video/rdpspn16.c"
4908         #undef ZBUF
4909            #define FLIP
4910               #define ZUPDATE
4911                  #define ZCOMPARE
4912                     #include "video/rdpspn16.c"
4913                  #undef ZCOMPARE
4914                     #include "video/rdpspn16.c"
4915               #undef ZUPDATE
4916                  #define ZCOMPARE
4917                     #include "video/rdpspn16.c"
4918                  #undef ZCOMPARE
4919                     #include "video/rdpspn16.c"
4920            #undef FLIP
4921               #define ZUPDATE
4922                  #define ZCOMPARE
4923                     #include "video/rdpspn16.c"
4924                  #undef ZCOMPARE
4925                     #include "video/rdpspn16.c"
4926               #undef ZUPDATE
4927                  #define ZCOMPARE
4928                     #include "video/rdpspn16.c"
4929                  #undef ZCOMPARE
4930                     #include "video/rdpspn16.c"
4931      #undef TEXTURE
4932         #define ZBUF
4933            #define FLIP
4934               #define ZUPDATE
4935                  #define ZCOMPARE
4936                     #include "video/rdpspn16.c"
4937                  #undef ZCOMPARE
4938                     #include "video/rdpspn16.c"
4939               #undef ZUPDATE
4940                  #define ZCOMPARE
4941                     #include "video/rdpspn16.c"
4942                  #undef ZCOMPARE
4943                     #include "video/rdpspn16.c"
4944            #undef FLIP
4945               #define ZUPDATE
4946                  #define ZCOMPARE
4947                     #include "video/rdpspn16.c"
4948                  #undef ZCOMPARE
4949                     #include "video/rdpspn16.c"
4950               #undef ZUPDATE
4951                  #define ZCOMPARE
4952                     #include "video/rdpspn16.c"
4953                  #undef ZCOMPARE
4954                     #include "video/rdpspn16.c"
4955         #undef ZBUF
4956            #define FLIP
4957               #define ZUPDATE
4958                  #define ZCOMPARE
4959                     #include "video/rdpspn16.c"
4960                  #undef ZCOMPARE
4961                     #include "video/rdpspn16.c"
4962               #undef ZUPDATE
4963                  #define ZCOMPARE
4964                     #include "video/rdpspn16.c"
4965                  #undef ZCOMPARE
4966                     #include "video/rdpspn16.c"
4967            #undef FLIP
4968               #define ZUPDATE
4969                  #define ZCOMPARE
4970                     #include "video/rdpspn16.c"
4971                  #undef ZCOMPARE
4972                     #include "video/rdpspn16.c"
4973               #undef ZUPDATE
4974                  #define ZCOMPARE
4975                     #include "video/rdpspn16.c"
4976                  #undef ZCOMPARE
4977                     #include "video/rdpspn16.c"
4978#undef BAYERDITHER
4979   #define SHADE
4980      #define TEXTURE
4981         #define ZBUF
4982            #define FLIP
4983               #define ZUPDATE
4984                  #define ZCOMPARE
4985                     #include "video/rdpspn16.c"
4986                  #undef ZCOMPARE
4987                     #include "video/rdpspn16.c"
4988               #undef ZUPDATE
4989                  #define ZCOMPARE
4990                     #include "video/rdpspn16.c"
4991                  #undef ZCOMPARE
4992                     #include "video/rdpspn16.c"
4993            #undef FLIP
4994               #define ZUPDATE
4995                  #define ZCOMPARE
4996                     #include "video/rdpspn16.c"
4997                  #undef ZCOMPARE
4998                     #include "video/rdpspn16.c"
4999               #undef ZUPDATE
5000                  #define ZCOMPARE
5001                     #include "video/rdpspn16.c"
5002                  #undef ZCOMPARE
5003                     #include "video/rdpspn16.c"
5004         #undef ZBUF
5005            #define FLIP
5006               #define ZUPDATE
5007                  #define ZCOMPARE
5008                     #include "video/rdpspn16.c"
5009                  #undef ZCOMPARE
5010                     #include "video/rdpspn16.c"
5011               #undef ZUPDATE
5012                  #define ZCOMPARE
5013                     #include "video/rdpspn16.c"
5014                  #undef ZCOMPARE
5015                     #include "video/rdpspn16.c"
5016            #undef FLIP
5017               #define ZUPDATE
5018                  #define ZCOMPARE
5019                     #include "video/rdpspn16.c"
5020                  #undef ZCOMPARE
5021                     #include "video/rdpspn16.c"
5022               #undef ZUPDATE
5023                  #define ZCOMPARE
5024                     #include "video/rdpspn16.c"
5025                  #undef ZCOMPARE
5026                     #include "video/rdpspn16.c"
5027      #undef TEXTURE
5028         #define ZBUF
5029            #define FLIP
5030               #define ZUPDATE
5031                  #define ZCOMPARE
5032                     #include "video/rdpspn16.c"
5033                  #undef ZCOMPARE
5034                     #include "video/rdpspn16.c"
5035               #undef ZUPDATE
5036                  #define ZCOMPARE
5037                     #include "video/rdpspn16.c"
5038                  #undef ZCOMPARE
5039                     #include "video/rdpspn16.c"
5040            #undef FLIP
5041               #define ZUPDATE
5042                  #define ZCOMPARE
5043                     #include "video/rdpspn16.c"
5044                  #undef ZCOMPARE
5045                     #include "video/rdpspn16.c"
5046               #undef ZUPDATE
5047                  #define ZCOMPARE
5048                     #include "video/rdpspn16.c"
5049                  #undef ZCOMPARE
5050                     #include "video/rdpspn16.c"
5051         #undef ZBUF
5052            #define FLIP
5053               #define ZUPDATE
5054                  #define ZCOMPARE
5055                     #include "video/rdpspn16.c"
5056                  #undef ZCOMPARE
5057                     #include "video/rdpspn16.c"
5058               #undef ZUPDATE
5059                  #define ZCOMPARE
5060                     #include "video/rdpspn16.c"
5061                  #undef ZCOMPARE
5062                     #include "video/rdpspn16.c"
5063            #undef FLIP
5064               #define ZUPDATE
5065                  #define ZCOMPARE
5066                     #include "video/rdpspn16.c"
5067                  #undef ZCOMPARE
5068                     #include "video/rdpspn16.c"
5069               #undef ZUPDATE
5070                  #define ZCOMPARE
5071                     #include "video/rdpspn16.c"
5072                  #undef ZCOMPARE
5073                     #include "video/rdpspn16.c"
5074   #undef SHADE
5075      #define TEXTURE
5076         #define ZBUF
5077            #define FLIP
5078               #define ZUPDATE
5079                  #define ZCOMPARE
5080                     #include "video/rdpspn16.c"
5081                  #undef ZCOMPARE
5082                     #include "video/rdpspn16.c"
5083               #undef ZUPDATE
5084                  #define ZCOMPARE
5085                     #include "video/rdpspn16.c"
5086                  #undef ZCOMPARE
5087                     #include "video/rdpspn16.c"
5088            #undef FLIP
5089               #define ZUPDATE
5090                  #define ZCOMPARE
5091                     #include "video/rdpspn16.c"
5092                  #undef ZCOMPARE
5093                     #include "video/rdpspn16.c"
5094               #undef ZUPDATE
5095                  #define ZCOMPARE
5096                     #include "video/rdpspn16.c"
5097                  #undef ZCOMPARE
5098                     #include "video/rdpspn16.c"
5099         #undef ZBUF
5100            #define FLIP
5101               #define ZUPDATE
5102                  #define ZCOMPARE
5103                     #include "video/rdpspn16.c"
5104                  #undef ZCOMPARE
5105                     #include "video/rdpspn16.c"
5106               #undef ZUPDATE
5107                  #define ZCOMPARE
5108                     #include "video/rdpspn16.c"
5109                  #undef ZCOMPARE
5110                     #include "video/rdpspn16.c"
5111            #undef FLIP
5112               #define ZUPDATE
5113                  #define ZCOMPARE
5114                     #include "video/rdpspn16.c"
5115                  #undef ZCOMPARE
5116                     #include "video/rdpspn16.c"
5117               #undef ZUPDATE
5118                  #define ZCOMPARE
5119                     #include "video/rdpspn16.c"
5120                  #undef ZCOMPARE
5121                     #include "video/rdpspn16.c"
5122      #undef TEXTURE
5123         #define ZBUF
5124            #define FLIP
5125               #define ZUPDATE
5126                  #define ZCOMPARE
5127                     #include "video/rdpspn16.c"
5128                  #undef ZCOMPARE
5129                     #include "video/rdpspn16.c"
5130               #undef ZUPDATE
5131                  #define ZCOMPARE
5132                     #include "video/rdpspn16.c"
5133                  #undef ZCOMPARE
5134                     #include "video/rdpspn16.c"
5135            #undef FLIP
5136               #define ZUPDATE
5137                  #define ZCOMPARE
5138                     #include "video/rdpspn16.c"
5139                  #undef ZCOMPARE
5140                     #include "video/rdpspn16.c"
5141               #undef ZUPDATE
5142                  #define ZCOMPARE
5143                     #include "video/rdpspn16.c"
5144                  #undef ZCOMPARE
5145                     #include "video/rdpspn16.c"
5146         #undef ZBUF
5147            #define FLIP
5148               #define ZUPDATE
5149                  #define ZCOMPARE
5150                     #include "video/rdpspn16.c"
5151                  #undef ZCOMPARE
5152                     #include "video/rdpspn16.c"
5153               #undef ZUPDATE
5154                  #define ZCOMPARE
5155                     #include "video/rdpspn16.c"
5156                  #undef ZCOMPARE
5157                     #include "video/rdpspn16.c"
5158            #undef FLIP
5159               #define ZUPDATE
5160                  #define ZCOMPARE
5161                     #include "video/rdpspn16.c"
5162                  #undef ZCOMPARE
5163                     #include "video/rdpspn16.c"
5164               #undef ZUPDATE
5165                  #define ZCOMPARE
5166                     #include "video/rdpspn16.c"
5167                  #undef ZCOMPARE
5168                     #include "video/rdpspn16.c"
5169
50465170#include "video/rdptri.c"
50475171
5172#define DOS
5173   #define DOT
5174      #include "video/rdpclamp.c"
5175   #undef DOT
5176      #include "video/rdpclamp.c"
5177#undef DOS
5178   #define DOT
5179      #include "video/rdpclamp.c"
5180   #undef DOT
5181      #include "video/rdpclamp.c"
5182
5183#define MASK_S
5184   #define MASK_T
5185      #include "video/rdpmask.c"
5186   #undef MASK_T
5187      #include "video/rdpmask.c"
5188#undef MASK_S
5189   #define MASK_T
5190      #include "video/rdpmask.c"
5191   #undef MASK_T
5192      #include "video/rdpmask.c"
5193
5194#define SHIFT_S
5195   #define SHIFT_T
5196      #include "video/rdpshift.c"
5197   #undef SHIFT_T
5198      #include "video/rdpshift.c"
5199#undef SHIFT_S
5200   #define SHIFT_T
5201      #include "video/rdpshift.c"
5202   #undef SHIFT_T
5203      #include "video/rdpshift.c"
5204
5205#define NOISE
5206   #include "video/rdpcc.c"
5207#undef NOISE
5208   #include "video/rdpcc.c"
5209

Previous 15994 Revisions Next


© 1998-2018 The MESS Team