src/mame/video/rdpspn16.c
| r6714 | r6715 | |
| 1 | | static void render_spans_16_c1(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip) |
| 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) |
| 8 | #else |
| 9 | static void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 10 | #endif |
| 11 | #else |
| 12 | #if defined(ZCOMPARE) |
| 13 | static void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile) |
| 14 | #else |
| 15 | static void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile) |
| 16 | #endif |
| 17 | #endif |
| 18 | #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) |
| 22 | #else |
| 23 | static void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 24 | #endif |
| 25 | #else |
| 26 | #if defined(ZCOMPARE) |
| 27 | static void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile) |
| 28 | #else |
| 29 | static void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 30 | #endif |
| 31 | #endif |
| 32 | #endif |
| 33 | #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) |
| 38 | #else |
| 39 | static void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 40 | #endif |
| 41 | #else |
| 42 | #if defined(ZCOMPARE) |
| 43 | static void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile) |
| 44 | #else |
| 45 | static void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 46 | #endif |
| 47 | #endif |
| 48 | #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) |
| 52 | #else |
| 53 | static void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 54 | #endif |
| 55 | #else |
| 56 | #if defined(ZCOMPARE) |
| 57 | static void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 58 | #else |
| 59 | static void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 60 | #endif |
| 61 | #endif |
| 62 | #endif |
| 63 | #endif |
| 64 | #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) |
| 70 | #else |
| 71 | static void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 72 | #endif |
| 73 | #else |
| 74 | #if defined(ZCOMPARE) |
| 75 | static void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile) |
| 76 | #else |
| 77 | static void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile) |
| 78 | #endif |
| 79 | #endif |
| 80 | #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) |
| 84 | #else |
| 85 | static void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 86 | #endif |
| 87 | #else |
| 88 | #if defined(ZCOMPARE) |
| 89 | static void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile) |
| 90 | #else |
| 91 | static void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 92 | #endif |
| 93 | #endif |
| 94 | #endif |
| 95 | #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) |
| 100 | #else |
| 101 | static void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 102 | #endif |
| 103 | #else |
| 104 | #if defined(ZCOMPARE) |
| 105 | static void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile) |
| 106 | #else |
| 107 | static void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 108 | #endif |
| 109 | #endif |
| 110 | #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) |
| 114 | #else |
| 115 | static void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 116 | #endif |
| 117 | #else |
| 118 | #if defined(ZCOMPARE) |
| 119 | static void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 120 | #else |
| 121 | static void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 122 | #endif |
| 123 | #endif |
| 124 | #endif |
| 125 | #endif |
| 126 | #endif |
| 127 | #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) |
| 134 | #else |
| 135 | static void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 136 | #endif |
| 137 | #else |
| 138 | #if defined(ZCOMPARE) |
| 139 | static void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile) |
| 140 | #else |
| 141 | static void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile) |
| 142 | #endif |
| 143 | #endif |
| 144 | #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) |
| 148 | #else |
| 149 | static void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 150 | #endif |
| 151 | #else |
| 152 | #if defined(ZCOMPARE) |
| 153 | static void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile) |
| 154 | #else |
| 155 | static void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 156 | #endif |
| 157 | #endif |
| 158 | #endif |
| 159 | #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) |
| 164 | #else |
| 165 | static void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 166 | #endif |
| 167 | #else |
| 168 | #if defined(ZCOMPARE) |
| 169 | static void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile) |
| 170 | #else |
| 171 | static void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 172 | #endif |
| 173 | #endif |
| 174 | #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) |
| 178 | #else |
| 179 | static void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 180 | #endif |
| 181 | #else |
| 182 | #if defined(ZCOMPARE) |
| 183 | static void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 184 | #else |
| 185 | static void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 186 | #endif |
| 187 | #endif |
| 188 | #endif |
| 189 | #endif |
| 190 | #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) |
| 196 | #else |
| 197 | static void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 198 | #endif |
| 199 | #else |
| 200 | #if defined(ZCOMPARE) |
| 201 | static void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile) |
| 202 | #else |
| 203 | static void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile) |
| 204 | #endif |
| 205 | #endif |
| 206 | #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) |
| 210 | #else |
| 211 | static void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 212 | #endif |
| 213 | #else |
| 214 | #if defined(ZCOMPARE) |
| 215 | static void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile) |
| 216 | #else |
| 217 | static void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 218 | #endif |
| 219 | #endif |
| 220 | #endif |
| 221 | #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) |
| 226 | #else |
| 227 | static void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 228 | #endif |
| 229 | #else |
| 230 | #if defined(ZCOMPARE) |
| 231 | static void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile) |
| 232 | #else |
| 233 | static void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 234 | #endif |
| 235 | #endif |
| 236 | #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) |
| 240 | #else |
| 241 | static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 242 | #endif |
| 243 | #else |
| 244 | #if defined(ZCOMPARE) |
| 245 | static void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 246 | #else |
| 247 | static void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 248 | #endif |
| 249 | #endif |
| 250 | #endif |
| 251 | #endif |
| 252 | #endif |
| 253 | #endif |
| 2 | 254 | { |
| 3 | 255 | UINT16 *fb = (UINT16*)&rdram[fb_address / 4]; |
| 256 | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 257 | #if defined(ZUPDATE) || defined(ZCOMPARE) |
| 4 | 258 | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 5 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 6 | 259 | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 260 | #endif |
| 7 | 261 | |
| 8 | 262 | int i, j; |
| 9 | 263 | |
| 10 | 264 | int clipx1, clipx2, clipy1, clipy2; |
| 11 | 265 | |
| 266 | #if defined(SHADE) |
| 267 | SPAN_PARAM dr = span[0].dr; |
| 268 | SPAN_PARAM dg = span[0].dg; |
| 269 | SPAN_PARAM db = span[0].db; |
| 270 | SPAN_PARAM da = span[0].da; |
| 271 | #if defined(FLIP) |
| 272 | int drinc = dr.w; |
| 273 | int dginc = dg.w; |
| 274 | int dbinc = db.w; |
| 275 | int dainc = da.w; |
| 276 | #else |
| 277 | int drinc = -dr.w; |
| 278 | int dginc = -dg.w; |
| 279 | int dbinc = -db.w; |
| 280 | int dainc = -da.w; |
| 281 | #endif |
| 282 | #endif |
| 283 | |
| 284 | #if defined(TEXTURE) |
| 12 | 285 | UINT32 prim_tile = tex_tile->num; |
| 13 | 286 | UINT32 disable_lod = 0; |
| 14 | 287 | int tilenum; |
| 15 | 288 | |
| 16 | | SPAN_PARAM dr = span[0].dr; |
| 17 | | SPAN_PARAM dg = span[0].dg; |
| 18 | | SPAN_PARAM db = span[0].db; |
| 19 | | SPAN_PARAM da = span[0].da; |
| 20 | | SPAN_PARAM dz = span[0].dz; |
| 21 | 289 | SPAN_PARAM ds = span[0].ds; |
| 22 | 290 | SPAN_PARAM dt = span[0].dt; |
| 23 | 291 | SPAN_PARAM dw = span[0].dw; |
| 292 | #if defined(FLIP) |
| 293 | int dsinc = ds.w; |
| 294 | int dtinc = dt.w; |
| 295 | int dwinc = dw.w; |
| 296 | #else |
| 297 | int dsinc = -ds.w; |
| 298 | int dtinc = -dt.w; |
| 299 | int dwinc = -dw.w; |
| 300 | #endif |
| 301 | #endif |
| 302 | |
| 303 | #if defined(ZBUF) |
| 304 | SPAN_PARAM dz = span[0].dz; |
| 24 | 305 | int dzpix = span[0].dzpix; |
| 25 | | int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; |
| 26 | | int xinc = flip ? 1 : -1; |
| 306 | #if defined(FLIP) |
| 307 | int dzinc = dz.w; |
| 308 | #else |
| 309 | int dzinc = -dz.w; |
| 310 | #endif |
| 311 | #else |
| 312 | int sz = 0, dzpix = 0; |
| 27 | 313 | |
| 28 | | calculate_clamp_diffs(tex_tile->num); |
| 314 | if (other_modes.z_source_sel) |
| 315 | { |
| 316 | sz = (((UINT32)primitive_z) << 3) & 0x3ffff; |
| 317 | dzpix = primitive_delta_z; |
| 318 | } |
| 319 | #endif |
| 29 | 320 | |
| 30 | 321 | clipx1 = clip.xh / 4; |
| 31 | 322 | clipx2 = clip.xl / 4; |
| 32 | 323 | clipy1 = clip.yh / 4; |
| 33 | 324 | clipy2 = clip.yl / 4; |
| 34 | 325 | |
| 35 | | if (texture && !other_modes.tex_lod_en) |
| 326 | #if defined(TEXTURE) |
| 327 | if (!other_modes.tex_lod_en) |
| 36 | 328 | { |
| 37 | 329 | tilenum = prim_tile; |
| 38 | 330 | tex_tile = &tile[tilenum]; |
| 39 | 331 | } |
| 40 | | |
| 41 | | if (other_modes.tex_lod_en) // Used by World Driver Championship |
| 332 | else |
| 42 | 333 | { |
| 43 | | disable_lod = 1; |
| 334 | disable_lod = 1; // Used by World Driver Championship |
| 44 | 335 | } |
| 336 | #endif |
| 45 | 337 | |
| 46 | | drinc = flip ? (dr.w) : -dr.w; |
| 47 | | dginc = flip ? (dg.w) : -dg.w; |
| 48 | | dbinc = flip ? (db.w) : -db.w; |
| 49 | | dainc = flip ? (da.w) : -da.w; |
| 50 | | dzinc = flip ? (dz.w) : -dz.w; |
| 51 | | dsinc = flip ? (ds.w) : -ds.w; |
| 52 | | dtinc = flip ? (dt.w) : -dt.w; |
| 53 | | dwinc = flip ? (dw.w) : -dw.w; |
| 54 | | |
| 55 | 338 | if (start < clipy1) |
| 56 | 339 | { |
| 57 | 340 | start = clipy1; |
| r6714 | r6715 | |
| 69 | 352 | end = clipy2 - 1; |
| 70 | 353 | } |
| 71 | 354 | |
| 72 | | set_shade_for_tris(shade); // Needed by backgrounds in Top Gear Rally 1 |
| 355 | #if !defined(SHADE) |
| 356 | shade_color.c = prim_color.c; |
| 357 | #endif |
| 73 | 358 | |
| 74 | 359 | for (i = start; i <= end; i++) |
| 75 | 360 | { |
| 76 | 361 | int xstart = span[i].lx; |
| 77 | 362 | int xend = span[i].rx; |
| 78 | | SPAN_PARAM r; |
| 79 | | SPAN_PARAM g; |
| 80 | | SPAN_PARAM b; |
| 81 | | SPAN_PARAM a; |
| 82 | | SPAN_PARAM z = span[i].z; |
| 83 | | SPAN_PARAM s = span[i].s; |
| 84 | | SPAN_PARAM t = span[i].t; |
| 85 | | SPAN_PARAM w = span[i].w; |
| 86 | 363 | |
| 87 | 364 | int x; |
| 88 | 365 | |
| 89 | 366 | int fb_index = fb_width * i; |
| 90 | 367 | int length; |
| 91 | 368 | |
| 92 | | if (shade) |
| 93 | | { |
| 94 | | r = span[i].r; |
| 95 | | g = span[i].g; |
| 96 | | b = span[i].b; |
| 97 | | a = span[i].a; |
| 98 | | } |
| 369 | #if defined(SHADE) |
| 370 | SPAN_PARAM r = span[i].r; |
| 371 | SPAN_PARAM g = span[i].g; |
| 372 | SPAN_PARAM b = span[i].b; |
| 373 | SPAN_PARAM a = span[i].a; |
| 374 | #endif |
| 375 | #if defined(TEXTURE) |
| 376 | SPAN_PARAM s = span[i].s; |
| 377 | SPAN_PARAM t = span[i].t; |
| 378 | SPAN_PARAM w = span[i].w; |
| 379 | #endif |
| 380 | #if defined(ZBUF) |
| 381 | SPAN_PARAM z = span[i].z; |
| 382 | #endif |
| 99 | 383 | |
| 100 | 384 | x = xend; |
| 101 | 385 | |
| 102 | | length = flip ? (xstart - xend) : (xend - xstart); //Moogly |
| 386 | #if defined(FLIP) |
| 387 | length = (xstart - xend); |
| 388 | #else |
| 389 | length = (xend - xstart); |
| 390 | #endif |
| 103 | 391 | |
| 104 | 392 | for (j = 0; j <= length; j++) |
| 105 | 393 | { |
| 106 | | int sr = 0, sg = 0, sb = 0, sa = 0; |
| 394 | #if defined(SHADE) |
| 395 | int sr = r.h.h; |
| 396 | int sg = g.h.h; |
| 397 | int sb = b.h.h; |
| 398 | int sa = a.h.h; |
| 399 | #endif |
| 400 | #if defined(TEXTURE) |
| 107 | 401 | int ss = s.h.h; |
| 108 | 402 | int st = t.h.h; |
| 109 | 403 | int sw = w.h.h; |
| 404 | int sss = 0, sst = 0; |
| 405 | #endif |
| 406 | #if defined(ZBUF) |
| 110 | 407 | int sz = z.w >> 13; |
| 111 | | int sss = 0, sst = 0; |
| 408 | #endif |
| 112 | 409 | COLOR c1, c2; |
| 113 | | if (shade) |
| 114 | | { |
| 115 | | sr = r.h.h; |
| 116 | | sg = g.h.h; |
| 117 | | sb = b.h.h; |
| 118 | | sa = a.h.h; |
| 119 | | } |
| 120 | 410 | c1.c = 0; |
| 121 | 411 | c2.c = 0; |
| 412 | |
| 413 | #if defined(ZBUF) |
| 122 | 414 | if (other_modes.z_source_sel) |
| 123 | 415 | { |
| 124 | 416 | sz = (((UINT32)primitive_z) << 3) & 0x3ffff; |
| 125 | 417 | dzpix = primitive_delta_z; |
| 126 | 418 | } |
| 419 | #endif |
| 127 | 420 | |
| 128 | | |
| 129 | 421 | if (x >= clipx1 && x < clipx2) |
| 130 | 422 | { |
| 423 | #if defined(ZCOMPARE) |
| 131 | 424 | int z_compare_result = 1; |
| 425 | #endif |
| 132 | 426 | |
| 133 | 427 | curpixel_cvg=span[i].cvg[x]; |
| 134 | 428 | |
| 135 | | if (curpixel_cvg > 8) |
| 136 | | { |
| 137 | | stricterror("render_spans_16: cvg of current pixel is %d", curpixel_cvg); |
| 138 | | } |
| 139 | | |
| 140 | 429 | if (curpixel_cvg) |
| 141 | 430 | { |
| 142 | 431 | int curpixel = fb_index + x; |
| 143 | 432 | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 433 | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 434 | #if defined(ZUPDATE) || defined(ZCOMPARE) |
| 144 | 435 | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 145 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 146 | 436 | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 437 | #endif |
| 147 | 438 | |
| 439 | #if defined(TEXTURE) |
| 148 | 440 | if (other_modes.persp_tex_en) |
| 149 | 441 | { |
| 150 | 442 | tcdiv(ss, st, sw, &sss, &sst); |
| r6714 | r6715 | |
| 154 | 446 | sss = ss; |
| 155 | 447 | sst = st; |
| 156 | 448 | } |
| 449 | #endif |
| 157 | 450 | |
| 158 | | if (shade) |
| 159 | | { |
| 160 | | if (sr > 0xff) sr = 0xff; |
| 161 | | if (sg > 0xff) sg = 0xff; |
| 162 | | if (sb > 0xff) sb = 0xff; |
| 163 | | if (sa > 0xff) sa = 0xff; |
| 164 | | if (sr < 0) sr = 0; |
| 165 | | if (sg < 0) sg = 0; |
| 166 | | if (sb < 0) sb = 0; |
| 167 | | if (sa < 0) sa = 0; |
| 168 | | shade_color.i.r = sr; |
| 169 | | shade_color.i.g = sg; |
| 170 | | shade_color.i.b = sb; |
| 171 | | shade_color.i.a = sa; |
| 172 | | } |
| 451 | #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; |
| 464 | #endif |
| 173 | 465 | |
| 174 | | if (texture) |
| 175 | | { |
| 176 | | TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile); |
| 177 | | } |
| 466 | #if defined(TEXTURE) |
| 467 | TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile); |
| 468 | #endif |
| 178 | 469 | |
| 179 | | c1 = COLOR_COMBINER1(machine); |
| 470 | COLOR_COMBINER1(&c1); |
| 180 | 471 | |
| 181 | | if ((zbuffer || other_modes.z_source_sel) && other_modes.z_compare_en) |
| 472 | #if defined(ZCOMPARE) |
| 473 | #if !defined(ZBUF) |
| 474 | if (other_modes.z_source_sel) |
| 475 | #endif |
| 182 | 476 | { |
| 183 | 477 | z_compare_result = z_compare(fbcur, hbcur, zbcur, zhbcur, sz, dzpix); |
| 184 | 478 | } |
| 185 | 479 | |
| 186 | 480 | if(z_compare_result) |
| 481 | #endif |
| 187 | 482 | { |
| 188 | 483 | int rendered = 0; |
| 189 | 484 | int dith = 0; |
| r6714 | r6715 | |
| 196 | 491 | dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)]; |
| 197 | 492 | } |
| 198 | 493 | |
| 199 | | rendered = BLENDER1_16(machine, fbcur, hbcur, c1, dith); |
| 494 | rendered = BLENDER1_16(fbcur, hbcur, c1, dith); |
| 200 | 495 | |
| 201 | | if (other_modes.z_update_en && rendered) |
| 496 | #if defined(ZUPDATE) |
| 497 | if (rendered) |
| 202 | 498 | { |
| 203 | 499 | z_store(zbcur, zhbcur, sz, dzpix); |
| 204 | 500 | } |
| 501 | #endif |
| 205 | 502 | } |
| 206 | 503 | } |
| 207 | 504 | } |
| 208 | 505 | |
| 209 | | if (shade) |
| 210 | | { |
| 211 | | r.w += drinc; |
| 212 | | g.w += dginc; |
| 213 | | b.w += dbinc; |
| 214 | | a.w += dainc; |
| 215 | | } |
| 216 | | z.w += dzinc; |
| 506 | #if defined(SHADE) |
| 507 | r.w += drinc; |
| 508 | g.w += dginc; |
| 509 | b.w += dbinc; |
| 510 | a.w += dainc; |
| 511 | #endif |
| 512 | #if defined(TEXTURE) |
| 217 | 513 | s.w += dsinc; |
| 218 | 514 | t.w += dtinc; |
| 219 | 515 | w.w += dwinc; |
| 516 | #endif |
| 517 | #if defined(ZBUF) |
| 518 | z.w += dzinc; |
| 519 | #endif |
| 220 | 520 | |
| 221 | | x += xinc; |
| 521 | #if defined(FLIP) |
| 522 | x++; |
| 523 | #else |
| 524 | x--; |
| 525 | #endif |
| 222 | 526 | } |
| 223 | 527 | } |
| 224 | 528 | } |
| 225 | 529 | |
| 226 | | static void render_spans_16_c2(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip) |
| 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) |
| 537 | #else |
| 538 | static void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 539 | #endif |
| 540 | #else |
| 541 | #if defined(ZCOMPARE) |
| 542 | static void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile) |
| 543 | #else |
| 544 | static void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile) |
| 545 | #endif |
| 546 | #endif |
| 547 | #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) |
| 551 | #else |
| 552 | static void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 553 | #endif |
| 554 | #else |
| 555 | #if defined(ZCOMPARE) |
| 556 | static void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile) |
| 557 | #else |
| 558 | static void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 559 | #endif |
| 560 | #endif |
| 561 | #endif |
| 562 | #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) |
| 567 | #else |
| 568 | static void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 569 | #endif |
| 570 | #else |
| 571 | #if defined(ZCOMPARE) |
| 572 | static void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile) |
| 573 | #else |
| 574 | static void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 575 | #endif |
| 576 | #endif |
| 577 | #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) |
| 581 | #else |
| 582 | static void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 583 | #endif |
| 584 | #else |
| 585 | #if defined(ZCOMPARE) |
| 586 | static void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 587 | #else |
| 588 | static void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 589 | #endif |
| 590 | #endif |
| 591 | #endif |
| 592 | #endif |
| 593 | #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) |
| 599 | #else |
| 600 | static void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 601 | #endif |
| 602 | #else |
| 603 | #if defined(ZCOMPARE) |
| 604 | static void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile) |
| 605 | #else |
| 606 | static void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile) |
| 607 | #endif |
| 608 | #endif |
| 609 | #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) |
| 613 | #else |
| 614 | static void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 615 | #endif |
| 616 | #else |
| 617 | #if defined(ZCOMPARE) |
| 618 | static void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile) |
| 619 | #else |
| 620 | static void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 621 | #endif |
| 622 | #endif |
| 623 | #endif |
| 624 | #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) |
| 629 | #else |
| 630 | static void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 631 | #endif |
| 632 | #else |
| 633 | #if defined(ZCOMPARE) |
| 634 | static void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile) |
| 635 | #else |
| 636 | static void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 637 | #endif |
| 638 | #endif |
| 639 | #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) |
| 643 | #else |
| 644 | static void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 645 | #endif |
| 646 | #else |
| 647 | #if defined(ZCOMPARE) |
| 648 | static void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 649 | #else |
| 650 | static void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 651 | #endif |
| 652 | #endif |
| 653 | #endif |
| 654 | #endif |
| 655 | #endif |
| 656 | #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) |
| 663 | #else |
| 664 | static void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 665 | #endif |
| 666 | #else |
| 667 | #if defined(ZCOMPARE) |
| 668 | static void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile) |
| 669 | #else |
| 670 | static void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile) |
| 671 | #endif |
| 672 | #endif |
| 673 | #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) |
| 677 | #else |
| 678 | static void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 679 | #endif |
| 680 | #else |
| 681 | #if defined(ZCOMPARE) |
| 682 | static void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile) |
| 683 | #else |
| 684 | static void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 685 | #endif |
| 686 | #endif |
| 687 | #endif |
| 688 | #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) |
| 693 | #else |
| 694 | static void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 695 | #endif |
| 696 | #else |
| 697 | #if defined(ZCOMPARE) |
| 698 | static void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile) |
| 699 | #else |
| 700 | static void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 701 | #endif |
| 702 | #endif |
| 703 | #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) |
| 707 | #else |
| 708 | static void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 709 | #endif |
| 710 | #else |
| 711 | #if defined(ZCOMPARE) |
| 712 | static void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 713 | #else |
| 714 | static void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 715 | #endif |
| 716 | #endif |
| 717 | #endif |
| 718 | #endif |
| 719 | #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) |
| 725 | #else |
| 726 | static void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 727 | #endif |
| 728 | #else |
| 729 | #if defined(ZCOMPARE) |
| 730 | static void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile) |
| 731 | #else |
| 732 | static void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile) |
| 733 | #endif |
| 734 | #endif |
| 735 | #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) |
| 739 | #else |
| 740 | static void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 741 | #endif |
| 742 | #else |
| 743 | #if defined(ZCOMPARE) |
| 744 | static void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile) |
| 745 | #else |
| 746 | static void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile) |
| 747 | #endif |
| 748 | #endif |
| 749 | #endif |
| 750 | #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) |
| 755 | #else |
| 756 | static void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile) |
| 757 | #endif |
| 758 | #else |
| 759 | #if defined(ZCOMPARE) |
| 760 | static void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile) |
| 761 | #else |
| 762 | static void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile) |
| 763 | #endif |
| 764 | #endif |
| 765 | #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) |
| 769 | #else |
| 770 | static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile) |
| 771 | #endif |
| 772 | #else |
| 773 | #if defined(ZCOMPARE) |
| 774 | static void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile) |
| 775 | #else |
| 776 | static void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile) |
| 777 | #endif |
| 778 | #endif |
| 779 | #endif |
| 780 | #endif |
| 781 | #endif |
| 782 | #endif |
| 227 | 783 | { |
| 228 | 784 | UINT16 *fb = (UINT16*)&rdram[fb_address / 4]; |
| 785 | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 786 | #if defined(ZUPDATE) || defined(ZCOMPARE) |
| 229 | 787 | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 230 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 231 | 788 | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 789 | #endif |
| 232 | 790 | |
| 233 | 791 | int i, j; |
| 234 | 792 | |
| 235 | 793 | int clipx1, clipx2, clipy1, clipy2; |
| 236 | 794 | |
| 795 | #if defined(SHADE) |
| 796 | SPAN_PARAM dr = span[0].dr; |
| 797 | SPAN_PARAM dg = span[0].dg; |
| 798 | SPAN_PARAM db = span[0].db; |
| 799 | SPAN_PARAM da = span[0].da; |
| 800 | #if defined(FLIP) |
| 801 | int drinc = dr.w; |
| 802 | int dginc = dg.w; |
| 803 | int dbinc = db.w; |
| 804 | int dainc = da.w; |
| 805 | #else |
| 806 | int drinc = -dr.w; |
| 807 | int dginc = -dg.w; |
| 808 | int dbinc = -db.w; |
| 809 | int dainc = -da.w; |
| 810 | #endif |
| 811 | #endif |
| 812 | |
| 813 | #if defined(TEXTURE) |
| 237 | 814 | UINT32 prim_tile = tex_tile->num; |
| 238 | 815 | UINT32 tilenum2 = 0; |
| 239 | 816 | TILE *tex_tile2 = NULL; |
| r6714 | r6715 | |
| 245 | 822 | UINT32 magnify = 0; |
| 246 | 823 | UINT32 distant = 0; |
| 247 | 824 | |
| 248 | | SPAN_PARAM dr = span[0].dr; |
| 249 | | SPAN_PARAM dg = span[0].dg; |
| 250 | | SPAN_PARAM db = span[0].db; |
| 251 | | SPAN_PARAM da = span[0].da; |
| 252 | | SPAN_PARAM dz = span[0].dz; |
| 825 | int nexts, nextt, nextsw; |
| 826 | int lodclamp = 0; |
| 827 | |
| 253 | 828 | SPAN_PARAM ds = span[0].ds; |
| 254 | 829 | SPAN_PARAM dt = span[0].dt; |
| 255 | 830 | SPAN_PARAM dw = span[0].dw; |
| 831 | #if defined(FLIP) |
| 832 | int dsinc = ds.w; |
| 833 | int dtinc = dt.w; |
| 834 | int dwinc = dw.w; |
| 835 | #else |
| 836 | int dsinc = -ds.w; |
| 837 | int dtinc = -dt.w; |
| 838 | int dwinc = -dw.w; |
| 839 | #endif |
| 840 | #endif |
| 841 | |
| 842 | #if defined(ZBUF) |
| 843 | SPAN_PARAM dz = span[0].dz; |
| 256 | 844 | int dzpix = span[0].dzpix; |
| 257 | | int drinc, dginc, dbinc, dainc, dzinc, dsinc, dtinc, dwinc; |
| 258 | | int xinc = flip ? 1 : -1; |
| 845 | #if defined(FLIP) |
| 846 | int dzinc = dz.w; |
| 847 | #else |
| 848 | int dzinc = -dz.w; |
| 849 | #endif |
| 850 | #else |
| 851 | int sz = 0, dzpix = 0; |
| 259 | 852 | |
| 260 | | int nexts, nextt, nextsw; |
| 261 | | int lodclamp = 0; |
| 853 | if (other_modes.z_source_sel) |
| 854 | { |
| 855 | sz = (((UINT32)primitive_z) << 3) & 0x3ffff; |
| 856 | dzpix = primitive_delta_z; |
| 857 | } |
| 858 | #endif |
| 262 | 859 | |
| 860 | #if defined(TEXTURE) |
| 263 | 861 | calculate_clamp_diffs(tex_tile->num); |
| 264 | 862 | |
| 265 | | clipx1 = clip.xh / 4; |
| 266 | | clipx2 = clip.xl / 4; |
| 267 | | clipy1 = clip.yh / 4; |
| 268 | | clipy2 = clip.yl / 4; |
| 269 | | |
| 270 | | if (texture && !other_modes.tex_lod_en) |
| 863 | if (!other_modes.tex_lod_en) |
| 271 | 864 | { |
| 272 | 865 | tilenum = prim_tile; |
| 273 | 866 | tex_tile = &tile[tilenum]; |
| 274 | 867 | tilenum2 = (prim_tile + 1) & 7; |
| 275 | 868 | tex_tile2 = &tile[tilenum2]; |
| 276 | 869 | } |
| 870 | #endif |
| 277 | 871 | |
| 278 | | drinc = flip ? (dr.w) : -dr.w; |
| 279 | | dginc = flip ? (dg.w) : -dg.w; |
| 280 | | dbinc = flip ? (db.w) : -db.w; |
| 281 | | dainc = flip ? (da.w) : -da.w; |
| 282 | | dzinc = flip ? (dz.w) : -dz.w; |
| 283 | | dsinc = flip ? (ds.w) : -ds.w; |
| 284 | | dtinc = flip ? (dt.w) : -dt.w; |
| 285 | | dwinc = flip ? (dw.w) : -dw.w; |
| 872 | clipx1 = clip.xh / 4; |
| 873 | clipx2 = clip.xl / 4; |
| 874 | clipy1 = clip.yh / 4; |
| 875 | clipy2 = clip.yl / 4; |
| 286 | 876 | |
| 287 | 877 | if (start < clipy1) |
| 288 | 878 | { |
| r6714 | r6715 | |
| 301 | 891 | end = clipy2 - 1; |
| 302 | 892 | } |
| 303 | 893 | |
| 304 | | set_shade_for_tris(shade); // Needed by backgrounds in Top Gear Rally 1 |
| 894 | #if !defined(SHADE) |
| 895 | shade_color.c = prim_color.c; |
| 896 | #endif |
| 305 | 897 | |
| 306 | 898 | for (i = start; i <= end; i++) |
| 307 | 899 | { |
| 308 | 900 | int xstart = span[i].lx; |
| 309 | 901 | int xend = span[i].rx; |
| 310 | | SPAN_PARAM r; |
| 311 | | SPAN_PARAM g; |
| 312 | | SPAN_PARAM b; |
| 313 | | SPAN_PARAM a; |
| 314 | | SPAN_PARAM z = span[i].z; |
| 902 | #if defined(SHADE) |
| 903 | SPAN_PARAM r = span[i].r; |
| 904 | SPAN_PARAM g = span[i].g; |
| 905 | SPAN_PARAM b = span[i].b; |
| 906 | SPAN_PARAM a = span[i].a; |
| 907 | #endif |
| 908 | #if defined(TEXTURE) |
| 315 | 909 | SPAN_PARAM s = span[i].s; |
| 316 | 910 | SPAN_PARAM t = span[i].t; |
| 317 | 911 | SPAN_PARAM w = span[i].w; |
| 912 | #endif |
| 913 | #if defined(ZBUF) |
| 914 | SPAN_PARAM z = span[i].z; |
| 915 | #endif |
| 318 | 916 | |
| 319 | 917 | int x; |
| 320 | 918 | |
| 321 | 919 | int fb_index = fb_width * i; |
| 322 | 920 | int length; |
| 323 | 921 | |
| 324 | | if (shade) |
| 325 | | { |
| 326 | | r = span[i].r; |
| 327 | | g = span[i].g; |
| 328 | | b = span[i].b; |
| 329 | | a = span[i].a; |
| 330 | | } |
| 331 | | |
| 332 | 922 | x = xend; |
| 333 | 923 | |
| 334 | | length = flip ? (xstart - xend) : (xend - xstart); //Moogly |
| 924 | #if defined(FLIP) |
| 925 | length = (xstart - xend); |
| 926 | #else |
| 927 | length = (xend - xstart); |
| 928 | #endif |
| 335 | 929 | |
| 336 | 930 | for (j = 0; j <= length; j++) |
| 337 | 931 | { |
| 338 | | int sr = 0, sg = 0, sb = 0, sa = 0; |
| 932 | #if defined(SHADE) |
| 933 | int sr = r.h.h; |
| 934 | int sg = g.h.h; |
| 935 | int sb = b.h.h; |
| 936 | int sa = a.h.h; |
| 937 | #endif |
| 938 | #if defined(TEXTURE) |
| 339 | 939 | int ss = s.h.h; |
| 340 | 940 | int st = t.h.h; |
| 341 | 941 | int sw = w.h.h; |
| 942 | int sss = 0, sst = 0; |
| 943 | #endif |
| 944 | #if defined(ZBUF) |
| 342 | 945 | int sz = z.w >> 13; |
| 343 | | int sss = 0, sst = 0; |
| 946 | #endif |
| 344 | 947 | COLOR c1, c2; |
| 345 | | if (shade) |
| 346 | | { |
| 347 | | sr = r.h.h; |
| 348 | | sg = g.h.h; |
| 349 | | sb = b.h.h; |
| 350 | | sa = a.h.h; |
| 351 | | } |
| 352 | | c1.c = 0; |
| 353 | | c2.c = 0; |
| 948 | //c1.c = 0; |
| 949 | //c2.c = 0; |
| 950 | |
| 951 | #if defined(ZBUF) |
| 354 | 952 | if (other_modes.z_source_sel) |
| 355 | 953 | { |
| 356 | 954 | sz = (((UINT32)primitive_z) << 3) & 0x3ffff; |
| 357 | 955 | dzpix = primitive_delta_z; |
| 358 | 956 | } |
| 957 | #endif |
| 359 | 958 | |
| 360 | | |
| 361 | 959 | if (x >= clipx1 && x < clipx2) |
| 362 | 960 | { |
| 961 | #if defined(ZCOMPARE) |
| 363 | 962 | int z_compare_result = 1; |
| 963 | #endif |
| 364 | 964 | |
| 365 | 965 | curpixel_cvg=span[i].cvg[x]; |
| 366 | 966 | |
| 367 | | if (curpixel_cvg > 8) |
| 368 | | { |
| 369 | | stricterror("render_spans_16: cvg of current pixel is %d", curpixel_cvg); |
| 370 | | } |
| 371 | | |
| 372 | 967 | if (curpixel_cvg) |
| 373 | 968 | { |
| 374 | 969 | int curpixel = fb_index + x; |
| 375 | 970 | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 971 | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 972 | #if defined(ZUPDATE) || defined(ZCOMPARE) |
| 376 | 973 | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 377 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 378 | 974 | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 975 | #endif |
| 379 | 976 | |
| 977 | #if defined(SHADE) |
| 978 | if (sr > 0xff) sr = 0xff; |
| 979 | if (sg > 0xff) sg = 0xff; |
| 980 | if (sb > 0xff) sb = 0xff; |
| 981 | if (sa > 0xff) sa = 0xff; |
| 982 | if (sr < 0) sr = 0; |
| 983 | if (sg < 0) sg = 0; |
| 984 | if (sb < 0) sb = 0; |
| 985 | if (sa < 0) sa = 0; |
| 986 | shade_color.i.r = sr; |
| 987 | shade_color.i.g = sg; |
| 988 | shade_color.i.b = sb; |
| 989 | shade_color.i.a = sa; |
| 990 | #endif |
| 991 | |
| 992 | #if defined(TEXTURE) |
| 380 | 993 | if (other_modes.persp_tex_en) |
| 381 | 994 | { |
| 382 | 995 | tcdiv(ss, st, sw, &sss, &sst); |
| r6714 | r6715 | |
| 493 | 1106 | } |
| 494 | 1107 | } |
| 495 | 1108 | |
| 496 | | if (shade) |
| 497 | | { |
| 498 | | if (sr > 0xff) sr = 0xff; |
| 499 | | if (sg > 0xff) sg = 0xff; |
| 500 | | if (sb > 0xff) sb = 0xff; |
| 501 | | if (sa > 0xff) sa = 0xff; |
| 502 | | if (sr < 0) sr = 0; |
| 503 | | if (sg < 0) sg = 0; |
| 504 | | if (sb < 0) sb = 0; |
| 505 | | if (sa < 0) sa = 0; |
| 506 | | shade_color.i.r = sr; |
| 507 | | shade_color.i.g = sg; |
| 508 | | shade_color.i.b = sb; |
| 509 | | shade_color.i.a = sa; |
| 510 | | } |
| 1109 | TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile); |
| 1110 | TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2); |
| 1111 | #endif |
| 511 | 1112 | |
| 512 | | if (texture) |
| 513 | | { |
| 514 | | TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile); |
| 515 | | TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2); |
| 516 | | } |
| 1113 | COLOR_COMBINER2_C0(&c1); |
| 1114 | COLOR_COMBINER2_C1(&c2); |
| 517 | 1115 | |
| 518 | | c1 = COLOR_COMBINER2_C0(machine); |
| 519 | | c2 = COLOR_COMBINER2_C1(machine); |
| 520 | | |
| 521 | | if ((zbuffer || other_modes.z_source_sel) && other_modes.z_compare_en) |
| 1116 | #if defined(ZCOMPARE) |
| 1117 | #if !defined(ZBUF) |
| 1118 | if (other_modes.z_source_sel) |
| 1119 | #endif |
| 522 | 1120 | { |
| 523 | 1121 | z_compare_result = z_compare(fbcur, hbcur, zbcur, zhbcur, sz, dzpix); |
| 524 | 1122 | } |
| 525 | 1123 | |
| 526 | 1124 | if(z_compare_result) |
| 1125 | #endif |
| 527 | 1126 | { |
| 528 | 1127 | int rendered = 0; |
| 529 | 1128 | int dith = 0; |
| r6714 | r6715 | |
| 536 | 1135 | dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)]; |
| 537 | 1136 | } |
| 538 | 1137 | |
| 539 | | rendered = BLENDER2_16(machine, fbcur, hbcur, c1, c2, dith); |
| 1138 | rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith); |
| 540 | 1139 | |
| 541 | | if (other_modes.z_update_en && rendered) |
| 1140 | #if defined(ZUPDATE) |
| 1141 | if (rendered) |
| 542 | 1142 | { |
| 543 | 1143 | z_store(zbcur, zhbcur, sz, dzpix); |
| 544 | 1144 | } |
| 1145 | #endif |
| 545 | 1146 | } |
| 546 | 1147 | } |
| 547 | 1148 | } |
| 548 | 1149 | |
| 549 | | if (shade) |
| 550 | | { |
| 551 | | r.w += drinc; |
| 552 | | g.w += dginc; |
| 553 | | b.w += dbinc; |
| 554 | | a.w += dainc; |
| 555 | | } |
| 556 | | z.w += dzinc; |
| 1150 | #if defined(SHADE) |
| 1151 | r.w += drinc; |
| 1152 | g.w += dginc; |
| 1153 | b.w += dbinc; |
| 1154 | a.w += dainc; |
| 1155 | #endif |
| 1156 | #if defined(TEXTURE) |
| 557 | 1157 | s.w += dsinc; |
| 558 | 1158 | t.w += dtinc; |
| 559 | 1159 | w.w += dwinc; |
| 1160 | #endif |
| 1161 | #if defined(ZBUF) |
| 1162 | z.w += dzinc; |
| 1163 | #endif |
| 560 | 1164 | |
| 561 | | x += xinc; |
| 1165 | #if defined(FLIP) |
| 1166 | x++; |
| 1167 | #else |
| 1168 | x--; |
| 1169 | #endif |
| 562 | 1170 | } |
| 563 | 1171 | } |
| 564 | 1172 | } |
src/mame/video/rdpspn16.h
| r6714 | r6715 | |
| 1 | | static void render_spans_16_c1(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip); |
| 2 | | static void render_spans_16_c2(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip); |
| 1 | INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 2 | INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 3 | INLINE void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 4 | INLINE void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 5 | INLINE void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 6 | INLINE void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 7 | INLINE void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 8 | INLINE void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 9 | INLINE void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 10 | INLINE void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 11 | INLINE void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 12 | INLINE void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 13 | INLINE void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 14 | INLINE void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile); |
| 15 | INLINE void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 16 | INLINE void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile); |
| 17 | INLINE void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 18 | INLINE void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 19 | INLINE void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile); |
| 20 | INLINE void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile); |
| 21 | INLINE void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 22 | INLINE void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 23 | INLINE void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile); |
| 24 | INLINE void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile); |
| 25 | INLINE void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 26 | INLINE void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 27 | INLINE void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile); |
| 28 | INLINE void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile); |
| 29 | INLINE void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 30 | INLINE void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile); |
| 31 | INLINE void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile); |
| 32 | INLINE void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile); |
| 3 | 33 | |
| 4 | | static void (*rdp_render_spans_16_func[4])(running_machine*, int, int, TILE*, int, int, int, int) = |
| 34 | INLINE void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 35 | INLINE void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 36 | INLINE void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile); |
| 37 | INLINE void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile); |
| 38 | INLINE void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 39 | INLINE void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 40 | INLINE void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile); |
| 41 | INLINE void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile); |
| 42 | INLINE void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 43 | INLINE void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 44 | INLINE void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile); |
| 45 | INLINE void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile); |
| 46 | INLINE void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 47 | INLINE void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile); |
| 48 | INLINE void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile); |
| 49 | INLINE void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile); |
| 50 | INLINE void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile); |
| 51 | INLINE void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile); |
| 52 | INLINE void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile); |
| 53 | INLINE void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile); |
| 54 | INLINE void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile); |
| 55 | INLINE void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile); |
| 56 | INLINE void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile); |
| 57 | INLINE void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile); |
| 58 | INLINE void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile); |
| 59 | INLINE void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile); |
| 60 | INLINE void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile); |
| 61 | INLINE void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile); |
| 62 | INLINE void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile); |
| 63 | INLINE void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile); |
| 64 | INLINE void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile); |
| 65 | INLINE void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile); |
| 66 | |
| 67 | INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 68 | INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 69 | INLINE void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 70 | INLINE void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 71 | INLINE void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 72 | INLINE void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 73 | INLINE void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 74 | INLINE void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 75 | INLINE void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 76 | INLINE void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 77 | INLINE void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 78 | INLINE void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 79 | INLINE void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 80 | INLINE void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 81 | INLINE void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 82 | INLINE void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile); |
| 83 | INLINE void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 84 | INLINE void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 85 | INLINE void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 86 | INLINE void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 87 | INLINE void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 88 | INLINE void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 89 | INLINE void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 90 | INLINE void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 91 | INLINE void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 92 | INLINE void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 93 | INLINE void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 94 | INLINE void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 95 | INLINE void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 96 | INLINE void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 97 | INLINE void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 98 | INLINE void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile); |
| 99 | |
| 100 | INLINE void render_spans_16_c1_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 101 | INLINE void render_spans_16_c2_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 102 | INLINE void render_spans_16_c1_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 103 | INLINE void render_spans_16_c2_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 104 | INLINE void render_spans_16_c1_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 105 | INLINE void render_spans_16_c2_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 106 | INLINE void render_spans_16_c1_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 107 | INLINE void render_spans_16_c2_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 108 | INLINE void render_spans_16_c1_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 109 | INLINE void render_spans_16_c2_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 110 | INLINE void render_spans_16_c1_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 111 | INLINE void render_spans_16_c2_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 112 | INLINE void render_spans_16_c1_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 113 | INLINE void render_spans_16_c2_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 114 | INLINE void render_spans_16_c1_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 115 | INLINE void render_spans_16_c2_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile); |
| 116 | INLINE void render_spans_16_c1_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 117 | INLINE void render_spans_16_c2_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 118 | INLINE void render_spans_16_c1_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 119 | INLINE void render_spans_16_c2_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 120 | INLINE void render_spans_16_c1_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 121 | INLINE void render_spans_16_c2_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 122 | INLINE void render_spans_16_c1_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 123 | INLINE void render_spans_16_c2_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 124 | INLINE void render_spans_16_c1_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 125 | INLINE void render_spans_16_c2_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 126 | INLINE void render_spans_16_c1_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 127 | INLINE void render_spans_16_c2_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 128 | INLINE void render_spans_16_c1_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 129 | INLINE void render_spans_16_c2_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile); |
| 130 | INLINE void render_spans_16_c1_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 131 | INLINE void render_spans_16_c2_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile); |
| 132 | |
| 133 | static void (*rdp_render_spans_16_func[128])(int, int, TILE*) = |
| 5 | 134 | { |
| 6 | | render_spans_16_c1, render_spans_16_c2, render_spans_16_c1, render_spans_16_c1 |
| 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, |
| 151 | |
| 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, |
| 168 | |
| 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, |
| 185 | |
| 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, |
| 7 | 202 | }; |
src/mame/video/rdptrect.c
| r6714 | r6715 | |
| 1 | | static void texture_rectangle_16bit_c1_nzc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 1 | #if defined(ZCOMPARE) |
| 2 | #if defined(ZUPDATE) |
| 3 | #if defined(MAGICDITHER) |
| 4 | static void texture_rectangle_16bit_c1_zc_zu_dm(TEX_RECTANGLE *rect) |
| 5 | #elif defined(BAYERDITHER) |
| 6 | static void texture_rectangle_16bit_c1_zc_zu_db(TEX_RECTANGLE *rect) |
| 7 | #else |
| 8 | static void texture_rectangle_16bit_c1_zc_zu_dn(TEX_RECTANGLE *rect) |
| 9 | #endif |
| 10 | #else |
| 11 | #if defined(MAGICDITHER) |
| 12 | static void texture_rectangle_16bit_c1_zc_nzu_dm(TEX_RECTANGLE *rect) |
| 13 | #elif defined(BAYERDITHER) |
| 14 | static void texture_rectangle_16bit_c1_zc_nzu_db(TEX_RECTANGLE *rect) |
| 15 | #else |
| 16 | static void texture_rectangle_16bit_c1_zc_nzu_dn(TEX_RECTANGLE *rect) |
| 17 | #endif |
| 18 | #endif |
| 19 | #else |
| 20 | #if defined(ZUPDATE) |
| 21 | #if defined(MAGICDITHER) |
| 22 | static void texture_rectangle_16bit_c1_nzc_zu_dm(TEX_RECTANGLE *rect) |
| 23 | #elif defined(BAYERDITHER) |
| 24 | static void texture_rectangle_16bit_c1_nzc_zu_db(TEX_RECTANGLE *rect) |
| 25 | #else |
| 26 | static void texture_rectangle_16bit_c1_nzc_zu_dn(TEX_RECTANGLE *rect) |
| 27 | #endif |
| 28 | #else |
| 29 | #if defined(MAGICDITHER) |
| 30 | static void texture_rectangle_16bit_c1_nzc_nzu_dm(TEX_RECTANGLE *rect) |
| 31 | #elif defined(BAYERDITHER) |
| 32 | static void texture_rectangle_16bit_c1_nzc_nzu_db(TEX_RECTANGLE *rect) |
| 33 | #else |
| 34 | static void texture_rectangle_16bit_c1_nzc_nzu_dn(TEX_RECTANGLE *rect) |
| 35 | #endif |
| 36 | #endif |
| 37 | #endif |
| 2 | 38 | { |
| 3 | 39 | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 4 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 5 | 40 | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 6 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 7 | | |
| 8 | | int i, j; |
| 9 | | int x1, x2, y1, y2; |
| 10 | | int s, t; |
| 11 | | int ss, st; |
| 12 | | |
| 13 | | int clipx1, clipx2, clipy1, clipy2; |
| 14 | | |
| 15 | | UINT32 tilenum = rect->tilenum; |
| 16 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 17 | | |
| 18 | | x1 = (rect->xh / 4); |
| 19 | | x2 = (rect->xl / 4); |
| 20 | | y1 = (rect->yh / 4); |
| 21 | | y2 = (rect->yl / 4); |
| 22 | | |
| 23 | | if (x2<=x1) |
| 24 | | { |
| 25 | | x2 = x1 + 1; |
| 26 | | } |
| 27 | | if (y1==y2) |
| 28 | | { |
| 29 | | y2 = y1 + 1; // Needed by Goldeneye |
| 30 | | } |
| 31 | | |
| 32 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 33 | | { |
| 34 | | x2++; |
| 35 | | } |
| 36 | | if ((rect->yl & 3) == 3) |
| 37 | | { |
| 38 | | y2++; |
| 39 | | } |
| 40 | | |
| 41 | | clipx1 = clip.xh / 4; |
| 42 | | clipx2 = clip.xl / 4; |
| 43 | | clipy1 = clip.yh / 4; |
| 44 | | clipy2 = clip.yl / 4; |
| 45 | | |
| 46 | | calculate_clamp_diffs(tilenum); |
| 47 | | |
| 48 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 49 | | |
| 50 | | t = ((int)(rect->t)) << 5; |
| 51 | | |
| 52 | | for (j = y1; j < y2; j++) |
| 53 | | { |
| 54 | | int fb_index = j * fb_width; |
| 55 | | if (j >= clipy1 && j < clipy2) |
| 56 | | { |
| 57 | | s = ((int)(rect->s)) << 5; |
| 58 | | |
| 59 | | for (i = x1; i < x2; i++) |
| 60 | | { |
| 61 | | if (i >= clipx1 && i < clipx2) |
| 62 | | { |
| 63 | | COLOR c; |
| 64 | | int rendered = 0; |
| 65 | | int dith = 0; |
| 66 | | int curpixel = fb_index + i; |
| 67 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 68 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 69 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 70 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 71 | | |
| 72 | | curpixel_cvg = 8; |
| 73 | | |
| 74 | | ss = s >> 5; |
| 75 | | st = t >> 5; |
| 76 | | if (rect->flip) |
| 77 | | { |
| 78 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 79 | | } |
| 80 | | else |
| 81 | | { |
| 82 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 83 | | } |
| 84 | | |
| 85 | | c = COLOR_COMBINER1(machine); |
| 86 | | |
| 87 | | if (!other_modes.rgb_dither_sel) |
| 88 | | { |
| 89 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 90 | | } |
| 91 | | else if (other_modes.rgb_dither_sel == 1) |
| 92 | | { |
| 93 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 94 | | } |
| 95 | | |
| 96 | | |
| 97 | | rendered = BLENDER1_16(machine, fbcur, hbcur, c, dith); |
| 98 | | |
| 99 | | if (other_modes.z_update_en && other_modes.z_source_sel && rendered) |
| 100 | | { |
| 101 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 102 | | } |
| 103 | | } |
| 104 | | |
| 105 | | s += (int)(rect->dsdx); |
| 106 | | } |
| 107 | | } |
| 108 | | t += (int)(rect->dtdy); |
| 109 | | } |
| 110 | | } |
| 111 | | |
| 112 | | static void texture_rectangle_16bit_c2_nzc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 113 | | { |
| 114 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 41 | #if (defined(ZCOMPARE) || defined(ZUPDATE)) |
| 115 | 42 | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 116 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 117 | 43 | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 44 | #endif |
| 118 | 45 | |
| 119 | 46 | int i, j; |
| 120 | 47 | int x1, x2, y1, y2; |
| 121 | 48 | int s, t; |
| 122 | | int ss, st; |
| 123 | 49 | |
| 124 | 50 | int clipx1, clipx2, clipy1, clipy2; |
| 125 | 51 | |
| 126 | 52 | UINT32 tilenum = rect->tilenum; |
| 127 | | UINT32 tilenum2 = 0; |
| 128 | 53 | TILE *tex_tile = &tile[rect->tilenum]; |
| 129 | | TILE *tex_tile2 = NULL; |
| 130 | 54 | |
| 131 | 55 | x1 = (rect->xh / 4); |
| 132 | 56 | x2 = (rect->xl / 4); |
| r6714 | r6715 | |
| 158 | 82 | |
| 159 | 83 | calculate_clamp_diffs(tilenum); |
| 160 | 84 | |
| 161 | | if (!other_modes.tex_lod_en) |
| 162 | | { |
| 163 | | tilenum2 = (tilenum + 1) & 7; |
| 164 | | tex_tile2 = &tile[tilenum2]; |
| 165 | | } |
| 166 | | else |
| 167 | | { |
| 168 | | tilenum2 = (tilenum + 1) & 7; |
| 169 | | tex_tile2 = &tile[tilenum2]; |
| 170 | | } |
| 171 | | |
| 172 | | |
| 173 | 85 | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 174 | 86 | |
| 175 | | t = ((int)(rect->t)) << 5; |
| 176 | | |
| 177 | | for (j = y1; j < y2; j++) |
| 87 | if(rect->flip) |
| 178 | 88 | { |
| 179 | | int fb_index = j * fb_width; |
| 180 | | |
| 181 | | if (j >= clipy1 && j < clipy2) |
| 182 | | { |
| 183 | | s = (int)(rect->s) << 5; |
| 184 | | |
| 185 | | for (i = x1; i < x2; i++) |
| 186 | | { |
| 187 | | if (i >= clipx1 && i < clipx2) |
| 188 | | { |
| 189 | | COLOR c1, c2; |
| 190 | | int rendered=0; |
| 191 | | int curpixel = fb_index + i; |
| 192 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 193 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 194 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 195 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 196 | | int dith = 0; |
| 197 | | |
| 198 | | curpixel_cvg = 8; |
| 199 | | |
| 200 | | ss = s >> 5; |
| 201 | | st = t >> 5; |
| 202 | | |
| 203 | | if (rect->flip) |
| 204 | | { |
| 205 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 206 | | TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2); |
| 207 | | } |
| 208 | | else |
| 209 | | { |
| 210 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 211 | | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 212 | | } |
| 213 | | c1 = COLOR_COMBINER2_C0(machine); |
| 214 | | c2 = COLOR_COMBINER2_C1(machine); |
| 215 | | |
| 216 | | if (!other_modes.rgb_dither_sel) |
| 217 | | { |
| 218 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 219 | | } |
| 220 | | else if (other_modes.rgb_dither_sel == 1) |
| 221 | | { |
| 222 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 223 | | } |
| 224 | | |
| 225 | | rendered = BLENDER2_16(machine, fbcur, hbcur, c1, c2, dith); |
| 226 | | |
| 227 | | if (other_modes.z_update_en && other_modes.z_source_sel && rendered) |
| 228 | | { |
| 229 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 230 | | } |
| 231 | | } |
| 232 | | |
| 233 | | s += (rect->dsdx); |
| 234 | | } |
| 235 | | } |
| 236 | | t += (rect->dtdy); |
| 89 | int temp = rect->t; |
| 90 | rect->t = rect->s; |
| 91 | rect->s = temp; |
| 92 | temp = rect->dtdy; |
| 93 | rect->dtdy = rect->dsdx; |
| 94 | rect->dsdx= temp; |
| 237 | 95 | } |
| 238 | | } |
| 239 | 96 | |
| 240 | | static void texture_rectangle_16bit_cc_nzc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 241 | | { |
| 242 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 243 | | |
| 244 | | int i, j; |
| 245 | | int x1, x2, y1, y2; |
| 246 | | int s, t; |
| 247 | | int ss, st; |
| 248 | | |
| 249 | | int clipx1, clipx2, clipy1, clipy2; |
| 250 | | |
| 251 | | UINT32 tilenum = rect->tilenum; |
| 252 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 253 | | |
| 254 | | x1 = (rect->xh / 4); |
| 255 | | x2 = (rect->xl / 4); |
| 256 | | y1 = (rect->yh / 4); |
| 257 | | y2 = (rect->yl / 4); |
| 258 | | |
| 259 | | if (x2<=x1) |
| 260 | | { |
| 261 | | x2 = x1 + 1; |
| 262 | | } |
| 263 | | if (y1==y2) |
| 264 | | { |
| 265 | | y2 = y1 + 1; // Needed by Goldeneye |
| 266 | | } |
| 267 | | |
| 268 | | rect->dsdx /= 4; |
| 269 | | x2 += 1; |
| 270 | | y2 += 1; |
| 271 | | |
| 272 | | clipx1 = clip.xh / 4; |
| 273 | | clipx2 = clip.xl / 4; |
| 274 | | clipy1 = clip.yh / 4; |
| 275 | | clipy2 = clip.yl / 4; |
| 276 | | |
| 277 | | calculate_clamp_diffs(tilenum); |
| 278 | | |
| 279 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 280 | | |
| 281 | 97 | t = ((int)(rect->t)) << 5; |
| 282 | 98 | |
| 283 | 99 | for (j = y1; j < y2; j++) |
| 284 | 100 | { |
| 285 | | int fb_index = j * fb_width; |
| 286 | 101 | if (j >= clipy1 && j < clipy2) |
| 287 | 102 | { |
| 288 | | s = (int)(rect->s) << 5; |
| 289 | | |
| 290 | | for (i = x1; i < x2; i++) |
| 291 | | { |
| 292 | | if (i >= clipx1 && i < clipx2) |
| 293 | | { |
| 294 | | ss = s >> 5; |
| 295 | | st = t >> 5; |
| 296 | | |
| 297 | | if (rect->flip) |
| 298 | | { |
| 299 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 300 | | } |
| 301 | | else |
| 302 | | { |
| 303 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 304 | | } |
| 305 | | |
| 306 | | curpixel_cvg = 8; |
| 307 | | |
| 308 | | if ((texel0_color.i.a != 0)||(!other_modes.alpha_compare_en)) |
| 309 | | { |
| 310 | | fb[(fb_index + i) ^ WORD_ADDR_XOR] = ((texel0_color.i.r >> 3) << 11) | ((texel0_color.i.g >> 3) << 6) | ((texel0_color.i.b >> 3) << 1)|1; |
| 311 | | } |
| 312 | | } |
| 313 | | s += rect->dsdx; |
| 314 | | } |
| 315 | | } |
| 316 | | t += rect->dtdy; |
| 317 | | } |
| 318 | | } |
| 319 | | |
| 320 | | static void texture_rectangle_16bit_cf_nzc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 321 | | { |
| 322 | | fatalerror("texture_rectangle with FILL cycle type is not supported\n"); |
| 323 | | } |
| 324 | | |
| 325 | | static void texture_rectangle_16bit_c1_zc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 326 | | { |
| 327 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 328 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 329 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 330 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 331 | | |
| 332 | | int i, j; |
| 333 | | int x1, x2, y1, y2; |
| 334 | | int s, t; |
| 335 | | int ss, st; |
| 336 | | |
| 337 | | int clipx1, clipx2, clipy1, clipy2; |
| 338 | | |
| 339 | | UINT32 tilenum = rect->tilenum; |
| 340 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 341 | | |
| 342 | | x1 = (rect->xh / 4); |
| 343 | | x2 = (rect->xl / 4); |
| 344 | | y1 = (rect->yh / 4); |
| 345 | | y2 = (rect->yl / 4); |
| 346 | | |
| 347 | | if (x2<=x1) |
| 348 | | { |
| 349 | | x2 = x1 + 1; |
| 350 | | } |
| 351 | | if (y1==y2) |
| 352 | | { |
| 353 | | y2 = y1 + 1; // Needed by Goldeneye |
| 354 | | } |
| 355 | | |
| 356 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 357 | | { |
| 358 | | x2++; |
| 359 | | } |
| 360 | | if ((rect->yl & 3) == 3) |
| 361 | | { |
| 362 | | y2++; |
| 363 | | } |
| 364 | | |
| 365 | | clipx1 = clip.xh / 4; |
| 366 | | clipx2 = clip.xl / 4; |
| 367 | | clipy1 = clip.yh / 4; |
| 368 | | clipy2 = clip.yl / 4; |
| 369 | | |
| 370 | | calculate_clamp_diffs(tilenum); |
| 371 | | |
| 372 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 373 | | |
| 374 | | t = ((int)(rect->t)) << 5; |
| 375 | | |
| 376 | | for (j = y1; j < y2; j++) |
| 377 | | { |
| 378 | | int fb_index = j * fb_width; |
| 379 | | if (j >= clipy1 && j < clipy2) |
| 380 | | { |
| 103 | int fb_index = j * fb_width; |
| 104 | #if defined(MAGICDITHER) || defined(BAYERDITHER) |
| 105 | int mline = (j & 3) << 2; |
| 106 | #endif |
| 381 | 107 | s = ((int)(rect->s)) << 5; |
| 382 | 108 | |
| 383 | 109 | for (i = x1; i < x2; i++) |
| r6714 | r6715 | |
| 385 | 111 | if (i >= clipx1 && i < clipx2) |
| 386 | 112 | { |
| 387 | 113 | COLOR c; |
| 114 | #if defined(ZUPDATE) |
| 388 | 115 | int rendered = 0; |
| 116 | #endif |
| 389 | 117 | int dith = 0; |
| 390 | 118 | int curpixel = fb_index + i; |
| 391 | 119 | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 392 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 393 | 120 | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 121 | #if (defined(ZCOMPARE) || defined(ZUPDATE)) |
| 122 | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 394 | 123 | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 124 | #endif |
| 395 | 125 | |
| 396 | 126 | curpixel_cvg = 8; |
| 397 | 127 | |
| 398 | | ss = s >> 5; |
| 399 | | st = t >> 5; |
| 400 | | if (rect->flip) |
| 401 | | { |
| 402 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 403 | | } |
| 404 | | else |
| 405 | | { |
| 406 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 407 | | } |
| 128 | TEXTURE_PIPELINE(&texel0_color, s >> 5, t >> 5, tex_tile); |
| 408 | 129 | |
| 409 | | c = COLOR_COMBINER1(machine); |
| 130 | COLOR_COMBINER1(&c); |
| 410 | 131 | |
| 411 | | if (!other_modes.rgb_dither_sel) |
| 412 | | { |
| 413 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 414 | | } |
| 415 | | else if (other_modes.rgb_dither_sel == 1) |
| 416 | | { |
| 417 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 418 | | } |
| 132 | #if defined(MAGICDITHER) |
| 133 | dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 134 | #elif defined(BAYERDITHER) |
| 135 | dith = bayer_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 136 | #endif |
| 419 | 137 | |
| 138 | #if defined(ZCOMPARE) |
| 420 | 139 | if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z)) |
| 421 | 140 | { |
| 422 | | rendered = BLENDER1_16(machine, fbcur, hbcur, c, dith); |
| 141 | #if defined(ZUPDATE) |
| 142 | rendered = BLENDER1_16(fbcur, hbcur, c, dith); |
| 143 | #else |
| 144 | BLENDER1_16(fbcur, hbcur, c, dith); |
| 145 | #endif |
| 423 | 146 | } |
| 147 | #elif defined(ZUPDATE) |
| 148 | rendered = BLENDER1_16(fbcur, hbcur, c, dith); |
| 149 | #else |
| 150 | BLENDER1_16(fbcur, hbcur, c, dith); |
| 151 | #endif |
| 424 | 152 | |
| 425 | | if (other_modes.z_update_en && other_modes.z_source_sel && rendered) |
| 153 | #if defined(ZUPDATE) |
| 154 | if(rendered) |
| 426 | 155 | { |
| 427 | 156 | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 428 | 157 | } |
| 158 | #endif |
| 429 | 159 | } |
| 430 | 160 | |
| 431 | 161 | s += (int)(rect->dsdx); |
| r6714 | r6715 | |
| 435 | 165 | } |
| 436 | 166 | } |
| 437 | 167 | |
| 438 | | static void texture_rectangle_16bit_c2_zc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 168 | #if defined(ZCOMPARE) |
| 169 | #if defined(ZUPDATE) |
| 170 | #if defined(MAGICDITHER) |
| 171 | static void texture_rectangle_16bit_c2_zc_zu_dm(TEX_RECTANGLE *rect) |
| 172 | #elif defined(BAYERDITHER) |
| 173 | static void texture_rectangle_16bit_c2_zc_zu_db(TEX_RECTANGLE *rect) |
| 174 | #else |
| 175 | static void texture_rectangle_16bit_c2_zc_zu_dn(TEX_RECTANGLE *rect) |
| 176 | #endif |
| 177 | #else |
| 178 | #if defined(MAGICDITHER) |
| 179 | static void texture_rectangle_16bit_c2_zc_nzu_dm(TEX_RECTANGLE *rect) |
| 180 | #elif defined(BAYERDITHER) |
| 181 | static void texture_rectangle_16bit_c2_zc_nzu_db(TEX_RECTANGLE *rect) |
| 182 | #else |
| 183 | static void texture_rectangle_16bit_c2_zc_nzu_dn(TEX_RECTANGLE *rect) |
| 184 | #endif |
| 185 | #endif |
| 186 | #else |
| 187 | #if defined(ZUPDATE) |
| 188 | #if defined(MAGICDITHER) |
| 189 | static void texture_rectangle_16bit_c2_nzc_zu_dm(TEX_RECTANGLE *rect) |
| 190 | #elif defined(BAYERDITHER) |
| 191 | static void texture_rectangle_16bit_c2_nzc_zu_db(TEX_RECTANGLE *rect) |
| 192 | #else |
| 193 | static void texture_rectangle_16bit_c2_nzc_zu_dn(TEX_RECTANGLE *rect) |
| 194 | #endif |
| 195 | #else |
| 196 | #if defined(MAGICDITHER) |
| 197 | static void texture_rectangle_16bit_c2_nzc_nzu_dm(TEX_RECTANGLE *rect) |
| 198 | #elif defined(BAYERDITHER) |
| 199 | static void texture_rectangle_16bit_c2_nzc_nzu_db(TEX_RECTANGLE *rect) |
| 200 | #else |
| 201 | static void texture_rectangle_16bit_c2_nzc_nzu_dn(TEX_RECTANGLE *rect) |
| 202 | #endif |
| 203 | #endif |
| 204 | #endif |
| 439 | 205 | { |
| 440 | 206 | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 441 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 442 | 207 | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 208 | #if (defined(ZCOMPARE) || defined(ZUPDATE)) |
| 209 | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 443 | 210 | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 211 | #endif |
| 444 | 212 | |
| 445 | 213 | int i, j; |
| 446 | 214 | int x1, x2, y1, y2; |
| r6714 | r6715 | |
| 498 | 266 | |
| 499 | 267 | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 500 | 268 | |
| 269 | if(rect->flip) |
| 270 | { |
| 271 | int temp = rect->t; |
| 272 | rect->t = rect->s; |
| 273 | rect->s = temp; |
| 274 | temp = rect->dtdy; |
| 275 | rect->dtdy = rect->dsdx; |
| 276 | rect->dsdx= temp; |
| 277 | } |
| 278 | |
| 501 | 279 | t = ((int)(rect->t)) << 5; |
| 502 | 280 | |
| 503 | 281 | for (j = y1; j < y2; j++) |
| 504 | 282 | { |
| 505 | | int fb_index = j * fb_width; |
| 506 | 283 | |
| 507 | 284 | if (j >= clipy1 && j < clipy2) |
| 508 | 285 | { |
| 286 | int fb_index = j * fb_width; |
| 287 | #if defined(MAGICDITHER) || defined(BAYERDITHER) |
| 288 | int mline = (j & 3) << 2; |
| 289 | #endif |
| 509 | 290 | s = (int)(rect->s) << 5; |
| 510 | 291 | |
| 511 | 292 | for (i = x1; i < x2; i++) |
| r6714 | r6715 | |
| 513 | 294 | if (i >= clipx1 && i < clipx2) |
| 514 | 295 | { |
| 515 | 296 | COLOR c1, c2; |
| 297 | #if defined(ZUPDATE) |
| 516 | 298 | int rendered=0; |
| 299 | #endif |
| 517 | 300 | int curpixel = fb_index + i; |
| 518 | 301 | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 519 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 520 | 302 | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 303 | #if (defined(ZCOMPARE) || defined(ZUPDATE)) |
| 304 | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 521 | 305 | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 306 | #endif |
| 522 | 307 | int dith = 0; |
| 523 | 308 | |
| 524 | 309 | curpixel_cvg = 8; |
| r6714 | r6715 | |
| 526 | 311 | ss = s >> 5; |
| 527 | 312 | st = t >> 5; |
| 528 | 313 | |
| 529 | | if (rect->flip) |
| 530 | | { |
| 531 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 532 | | TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2); |
| 533 | | } |
| 534 | | else |
| 535 | | { |
| 536 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 537 | | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 538 | | } |
| 539 | | c1 = COLOR_COMBINER2_C0(machine); |
| 540 | | c2 = COLOR_COMBINER2_C1(machine); |
| 314 | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 315 | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 541 | 316 | |
| 542 | | if (!other_modes.rgb_dither_sel) |
| 543 | | { |
| 544 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 545 | | } |
| 546 | | else if (other_modes.rgb_dither_sel == 1) |
| 547 | | { |
| 548 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 549 | | } |
| 317 | COLOR_COMBINER2_C0(&c1); |
| 318 | COLOR_COMBINER2_C1(&c2); |
| 550 | 319 | |
| 551 | | if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z)) |
| 552 | | { |
| 553 | | rendered = BLENDER2_16(machine, fbcur, hbcur, c1, c2, dith); |
| 554 | | } |
| 320 | #if defined(MAGICDITHER) |
| 321 | dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 322 | #elif defined(BAYERDITHER) |
| 323 | dith = bayer_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 324 | #endif |
| 555 | 325 | |
| 556 | | if (other_modes.z_update_en && other_modes.z_source_sel && rendered) |
| 326 | #if defined(ZCOMPARE) |
| 327 | if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z)) |
| 557 | 328 | { |
| 558 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 329 | #if defined(ZUPDATE) |
| 330 | rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith); |
| 331 | #else |
| 332 | BLENDER2_16(fbcur, hbcur, c1, c2, dith); |
| 333 | #endif |
| 559 | 334 | } |
| 560 | | } |
| 335 | #else |
| 336 | #if defined(ZUPDATE) |
| 337 | rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith); |
| 338 | #else |
| 339 | BLENDER2_16(fbcur, hbcur, c1, c2, dith); |
| 340 | #endif |
| 341 | #endif |
| 561 | 342 | |
| 562 | | s += (rect->dsdx); |
| 563 | | } |
| 564 | | } |
| 565 | | t += (rect->dtdy); |
| 566 | | } |
| 567 | | } |
| 568 | | |
| 569 | | static void texture_rectangle_16bit_cc_zc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 570 | | { |
| 571 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 572 | | |
| 573 | | int i, j; |
| 574 | | int x1, x2, y1, y2; |
| 575 | | int s, t; |
| 576 | | int ss, st; |
| 577 | | |
| 578 | | int clipx1, clipx2, clipy1, clipy2; |
| 579 | | |
| 580 | | UINT32 tilenum = rect->tilenum; |
| 581 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 582 | | |
| 583 | | x1 = (rect->xh / 4); |
| 584 | | x2 = (rect->xl / 4); |
| 585 | | y1 = (rect->yh / 4); |
| 586 | | y2 = (rect->yl / 4); |
| 587 | | |
| 588 | | if (x2<=x1) |
| 589 | | { |
| 590 | | x2 = x1 + 1; |
| 591 | | } |
| 592 | | if (y1==y2) |
| 593 | | { |
| 594 | | y2 = y1 + 1; // Needed by Goldeneye |
| 595 | | } |
| 596 | | |
| 597 | | rect->dsdx /= 4; |
| 598 | | x2 += 1; |
| 599 | | y2 += 1; |
| 600 | | |
| 601 | | clipx1 = clip.xh / 4; |
| 602 | | clipx2 = clip.xl / 4; |
| 603 | | clipy1 = clip.yh / 4; |
| 604 | | clipy2 = clip.yl / 4; |
| 605 | | |
| 606 | | calculate_clamp_diffs(tilenum); |
| 607 | | |
| 608 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 609 | | |
| 610 | | t = ((int)(rect->t)) << 5; |
| 611 | | |
| 612 | | for (j = y1; j < y2; j++) |
| 613 | | { |
| 614 | | int fb_index = j * fb_width; |
| 615 | | if (j >= clipy1 && j < clipy2) |
| 616 | | { |
| 617 | | s = (int)(rect->s) << 5; |
| 618 | | |
| 619 | | for (i = x1; i < x2; i++) |
| 620 | | { |
| 621 | | if (i >= clipx1 && i < clipx2) |
| 622 | | { |
| 623 | | ss = s >> 5; |
| 624 | | st = t >> 5; |
| 625 | | |
| 626 | | if (rect->flip) |
| 343 | #if defined(ZUPDATE) |
| 344 | if(rendered) |
| 627 | 345 | { |
| 628 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 629 | | } |
| 630 | | else |
| 631 | | { |
| 632 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 633 | | } |
| 634 | | |
| 635 | | curpixel_cvg = 8; |
| 636 | | |
| 637 | | if ((texel0_color.i.a != 0)||(!other_modes.alpha_compare_en)) |
| 638 | | { |
| 639 | | fb[(fb_index + i) ^ WORD_ADDR_XOR] = ((texel0_color.i.r >> 3) << 11) | ((texel0_color.i.g >> 3) << 6) | ((texel0_color.i.b >> 3) << 1)|1; |
| 640 | | } |
| 641 | | } |
| 642 | | s += rect->dsdx; |
| 643 | | } |
| 644 | | } |
| 645 | | t += rect->dtdy; |
| 646 | | } |
| 647 | | } |
| 648 | | |
| 649 | | static void texture_rectangle_16bit_cf_zc_nzu(running_machine *machine, TEX_RECTANGLE *rect) |
| 650 | | { |
| 651 | | fatalerror("texture_rectangle with FILL cycle type is not supported\n"); |
| 652 | | } |
| 653 | | |
| 654 | | static void texture_rectangle_16bit_c1_nzc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 655 | | { |
| 656 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 657 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 658 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 659 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 660 | | |
| 661 | | int i, j; |
| 662 | | int x1, x2, y1, y2; |
| 663 | | int s, t; |
| 664 | | int ss, st; |
| 665 | | |
| 666 | | int clipx1, clipx2, clipy1, clipy2; |
| 667 | | |
| 668 | | UINT32 tilenum = rect->tilenum; |
| 669 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 670 | | |
| 671 | | x1 = (rect->xh / 4); |
| 672 | | x2 = (rect->xl / 4); |
| 673 | | y1 = (rect->yh / 4); |
| 674 | | y2 = (rect->yl / 4); |
| 675 | | |
| 676 | | if (x2<=x1) |
| 677 | | { |
| 678 | | x2 = x1 + 1; |
| 679 | | } |
| 680 | | if (y1==y2) |
| 681 | | { |
| 682 | | y2 = y1 + 1; // Needed by Goldeneye |
| 683 | | } |
| 684 | | |
| 685 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 686 | | { |
| 687 | | x2++; |
| 688 | | } |
| 689 | | if ((rect->yl & 3) == 3) |
| 690 | | { |
| 691 | | y2++; |
| 692 | | } |
| 693 | | |
| 694 | | clipx1 = clip.xh / 4; |
| 695 | | clipx2 = clip.xl / 4; |
| 696 | | clipy1 = clip.yh / 4; |
| 697 | | clipy2 = clip.yl / 4; |
| 698 | | |
| 699 | | calculate_clamp_diffs(tilenum); |
| 700 | | |
| 701 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 702 | | |
| 703 | | t = ((int)(rect->t)) << 5; |
| 704 | | |
| 705 | | for (j = y1; j < y2; j++) |
| 706 | | { |
| 707 | | int fb_index = j * fb_width; |
| 708 | | if (j >= clipy1 && j < clipy2) |
| 709 | | { |
| 710 | | s = ((int)(rect->s)) << 5; |
| 711 | | |
| 712 | | for (i = x1; i < x2; i++) |
| 713 | | { |
| 714 | | if (i >= clipx1 && i < clipx2) |
| 715 | | { |
| 716 | | COLOR c; |
| 717 | | int dith = 0; |
| 718 | | int curpixel = fb_index + i; |
| 719 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 720 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 721 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 722 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 723 | | |
| 724 | | curpixel_cvg = 8; |
| 725 | | |
| 726 | | ss = s >> 5; |
| 727 | | st = t >> 5; |
| 728 | | if (rect->flip) |
| 729 | | { |
| 730 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 731 | | } |
| 732 | | else |
| 733 | | { |
| 734 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 735 | | } |
| 736 | | |
| 737 | | c = COLOR_COMBINER1(machine); |
| 738 | | |
| 739 | | if (!other_modes.rgb_dither_sel) |
| 740 | | { |
| 741 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 742 | | } |
| 743 | | else if (other_modes.rgb_dither_sel == 1) |
| 744 | | { |
| 745 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 746 | | } |
| 747 | | |
| 748 | | if (BLENDER1_16(machine, fbcur, hbcur, c, dith)) |
| 749 | | { |
| 750 | 346 | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 751 | 347 | } |
| 348 | #endif |
| 752 | 349 | } |
| 753 | 350 | |
| 754 | | s += (int)(rect->dsdx); |
| 755 | | } |
| 756 | | } |
| 757 | | t += (int)(rect->dtdy); |
| 758 | | } |
| 759 | | } |
| 760 | | |
| 761 | | static void texture_rectangle_16bit_c2_nzc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 762 | | { |
| 763 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 764 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 765 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 766 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 767 | | |
| 768 | | int i, j; |
| 769 | | int x1, x2, y1, y2; |
| 770 | | int s, t; |
| 771 | | int ss, st; |
| 772 | | |
| 773 | | int clipx1, clipx2, clipy1, clipy2; |
| 774 | | |
| 775 | | UINT32 tilenum = rect->tilenum; |
| 776 | | UINT32 tilenum2 = 0; |
| 777 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 778 | | TILE *tex_tile2 = NULL; |
| 779 | | |
| 780 | | x1 = (rect->xh / 4); |
| 781 | | x2 = (rect->xl / 4); |
| 782 | | y1 = (rect->yh / 4); |
| 783 | | y2 = (rect->yl / 4); |
| 784 | | |
| 785 | | if (x2<=x1) |
| 786 | | { |
| 787 | | x2 = x1 + 1; |
| 788 | | } |
| 789 | | if (y1==y2) |
| 790 | | { |
| 791 | | y2 = y1 + 1; // Needed by Goldeneye |
| 792 | | } |
| 793 | | |
| 794 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 795 | | { |
| 796 | | x2++; |
| 797 | | } |
| 798 | | if ((rect->yl & 3) == 3) |
| 799 | | { |
| 800 | | y2++; |
| 801 | | } |
| 802 | | |
| 803 | | clipx1 = clip.xh / 4; |
| 804 | | clipx2 = clip.xl / 4; |
| 805 | | clipy1 = clip.yh / 4; |
| 806 | | clipy2 = clip.yl / 4; |
| 807 | | |
| 808 | | calculate_clamp_diffs(tilenum); |
| 809 | | |
| 810 | | if (!other_modes.tex_lod_en) |
| 811 | | { |
| 812 | | tilenum2 = (tilenum + 1) & 7; |
| 813 | | tex_tile2 = &tile[tilenum2]; |
| 814 | | } |
| 815 | | else |
| 816 | | { |
| 817 | | tilenum2 = (tilenum + 1) & 7; |
| 818 | | tex_tile2 = &tile[tilenum2]; |
| 819 | | } |
| 820 | | |
| 821 | | |
| 822 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 823 | | |
| 824 | | t = ((int)(rect->t)) << 5; |
| 825 | | |
| 826 | | for (j = y1; j < y2; j++) |
| 827 | | { |
| 828 | | int fb_index = j * fb_width; |
| 829 | | |
| 830 | | if (j >= clipy1 && j < clipy2) |
| 831 | | { |
| 832 | | s = (int)(rect->s) << 5; |
| 833 | | |
| 834 | | for (i = x1; i < x2; i++) |
| 835 | | { |
| 836 | | if (i >= clipx1 && i < clipx2) |
| 837 | | { |
| 838 | | COLOR c1, c2; |
| 839 | | int curpixel = fb_index + i; |
| 840 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 841 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 842 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 843 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 844 | | int dith = 0; |
| 845 | | |
| 846 | | curpixel_cvg = 8; |
| 847 | | |
| 848 | | ss = s >> 5; |
| 849 | | st = t >> 5; |
| 850 | | |
| 851 | | if (rect->flip) |
| 852 | | { |
| 853 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 854 | | TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2); |
| 855 | | } |
| 856 | | else |
| 857 | | { |
| 858 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 859 | | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 860 | | } |
| 861 | | c1 = COLOR_COMBINER2_C0(machine); |
| 862 | | c2 = COLOR_COMBINER2_C1(machine); |
| 863 | | |
| 864 | | if (!other_modes.rgb_dither_sel) |
| 865 | | { |
| 866 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 867 | | } |
| 868 | | else if (other_modes.rgb_dither_sel == 1) |
| 869 | | { |
| 870 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 871 | | } |
| 872 | | |
| 873 | | if (BLENDER2_16(machine, fbcur, hbcur, c1, c2, dith)) |
| 874 | | { |
| 875 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 876 | | } |
| 877 | | } |
| 878 | | |
| 879 | 351 | s += (rect->dsdx); |
| 880 | 352 | } |
| 881 | 353 | } |
| r6714 | r6715 | |
| 883 | 355 | } |
| 884 | 356 | } |
| 885 | 357 | |
| 886 | | static void texture_rectangle_16bit_cc_nzc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 358 | #if defined(ZCOMPARE) |
| 359 | #if defined(ZUPDATE) |
| 360 | #if defined(MAGICDITHER) |
| 361 | static void texture_rectangle_16bit_cc_zc_zu_dm(TEX_RECTANGLE *rect) |
| 362 | #elif defined(BAYERDITHER) |
| 363 | static void texture_rectangle_16bit_cc_zc_zu_db(TEX_RECTANGLE *rect) |
| 364 | #else |
| 365 | static void texture_rectangle_16bit_cc_zc_zu_dn(TEX_RECTANGLE *rect) |
| 366 | #endif |
| 367 | #else |
| 368 | #if defined(MAGICDITHER) |
| 369 | static void texture_rectangle_16bit_cc_zc_nzu_dm(TEX_RECTANGLE *rect) |
| 370 | #elif defined(BAYERDITHER) |
| 371 | static void texture_rectangle_16bit_cc_zc_nzu_db(TEX_RECTANGLE *rect) |
| 372 | #else |
| 373 | static void texture_rectangle_16bit_cc_zc_nzu_dn(TEX_RECTANGLE *rect) |
| 374 | #endif |
| 375 | #endif |
| 376 | #else |
| 377 | #if defined(ZUPDATE) |
| 378 | #if defined(MAGICDITHER) |
| 379 | static void texture_rectangle_16bit_cc_nzc_zu_dm(TEX_RECTANGLE *rect) |
| 380 | #elif defined(BAYERDITHER) |
| 381 | static void texture_rectangle_16bit_cc_nzc_zu_db(TEX_RECTANGLE *rect) |
| 382 | #else |
| 383 | static void texture_rectangle_16bit_cc_nzc_zu_dn(TEX_RECTANGLE *rect) |
| 384 | #endif |
| 385 | #else |
| 386 | #if defined(MAGICDITHER) |
| 387 | static void texture_rectangle_16bit_cc_nzc_nzu_dm(TEX_RECTANGLE *rect) |
| 388 | #elif defined(BAYERDITHER) |
| 389 | static void texture_rectangle_16bit_cc_nzc_nzu_db(TEX_RECTANGLE *rect) |
| 390 | #else |
| 391 | static void texture_rectangle_16bit_cc_nzc_nzu_dn(TEX_RECTANGLE *rect) |
| 392 | #endif |
| 393 | #endif |
| 394 | #endif |
| 887 | 395 | { |
| 888 | 396 | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 889 | 397 | |
| r6714 | r6715 | |
| 924 | 432 | |
| 925 | 433 | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 926 | 434 | |
| 927 | | t = ((int)(rect->t)) << 5; |
| 928 | | |
| 929 | | for (j = y1; j < y2; j++) |
| 435 | if(rect->flip) |
| 930 | 436 | { |
| 931 | | int fb_index = j * fb_width; |
| 932 | | if (j >= clipy1 && j < clipy2) |
| 933 | | { |
| 934 | | s = (int)(rect->s) << 5; |
| 935 | | |
| 936 | | for (i = x1; i < x2; i++) |
| 937 | | { |
| 938 | | if (i >= clipx1 && i < clipx2) |
| 939 | | { |
| 940 | | ss = s >> 5; |
| 941 | | st = t >> 5; |
| 942 | | |
| 943 | | if (rect->flip) |
| 944 | | { |
| 945 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 946 | | } |
| 947 | | else |
| 948 | | { |
| 949 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 950 | | } |
| 951 | | |
| 952 | | curpixel_cvg = 8; |
| 953 | | |
| 954 | | if ((texel0_color.i.a != 0)||(!other_modes.alpha_compare_en)) |
| 955 | | { |
| 956 | | fb[(fb_index + i) ^ WORD_ADDR_XOR] = ((texel0_color.i.r >> 3) << 11) | ((texel0_color.i.g >> 3) << 6) | ((texel0_color.i.b >> 3) << 1)|1; |
| 957 | | } |
| 958 | | } |
| 959 | | s += rect->dsdx; |
| 960 | | } |
| 961 | | } |
| 962 | | t += rect->dtdy; |
| 437 | int temp = rect->t; |
| 438 | rect->t = rect->s; |
| 439 | rect->s = temp; |
| 440 | temp = rect->dtdy; |
| 441 | rect->dtdy = rect->dsdx; |
| 442 | rect->dsdx= temp; |
| 963 | 443 | } |
| 964 | | } |
| 965 | 444 | |
| 966 | | static void texture_rectangle_16bit_cf_nzc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 967 | | { |
| 968 | | fatalerror("texture_rectangle with FILL cycle type is not supported\n"); |
| 969 | | } |
| 970 | | |
| 971 | | static void texture_rectangle_16bit_c1_zc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 972 | | { |
| 973 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 974 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 975 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 976 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 977 | | |
| 978 | | int i, j; |
| 979 | | int x1, x2, y1, y2; |
| 980 | | int s, t; |
| 981 | | int ss, st; |
| 982 | | |
| 983 | | int clipx1, clipx2, clipy1, clipy2; |
| 984 | | |
| 985 | | UINT32 tilenum = rect->tilenum; |
| 986 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 987 | | |
| 988 | | x1 = (rect->xh / 4); |
| 989 | | x2 = (rect->xl / 4); |
| 990 | | y1 = (rect->yh / 4); |
| 991 | | y2 = (rect->yl / 4); |
| 992 | | |
| 993 | | if (x2<=x1) |
| 994 | | { |
| 995 | | x2 = x1 + 1; |
| 996 | | } |
| 997 | | if (y1==y2) |
| 998 | | { |
| 999 | | y2 = y1 + 1; // Needed by Goldeneye |
| 1000 | | } |
| 1001 | | |
| 1002 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 1003 | | { |
| 1004 | | x2++; |
| 1005 | | } |
| 1006 | | if ((rect->yl & 3) == 3) |
| 1007 | | { |
| 1008 | | y2++; |
| 1009 | | } |
| 1010 | | |
| 1011 | | clipx1 = clip.xh / 4; |
| 1012 | | clipx2 = clip.xl / 4; |
| 1013 | | clipy1 = clip.yh / 4; |
| 1014 | | clipy2 = clip.yl / 4; |
| 1015 | | |
| 1016 | | calculate_clamp_diffs(tilenum); |
| 1017 | | |
| 1018 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 1019 | | |
| 1020 | 445 | t = ((int)(rect->t)) << 5; |
| 1021 | 446 | |
| 1022 | 447 | for (j = y1; j < y2; j++) |
| r6714 | r6715 | |
| 1024 | 449 | int fb_index = j * fb_width; |
| 1025 | 450 | if (j >= clipy1 && j < clipy2) |
| 1026 | 451 | { |
| 1027 | | s = ((int)(rect->s)) << 5; |
| 1028 | | |
| 1029 | | for (i = x1; i < x2; i++) |
| 1030 | | { |
| 1031 | | if (i >= clipx1 && i < clipx2) |
| 1032 | | { |
| 1033 | | COLOR c; |
| 1034 | | int dith = 0; |
| 1035 | | int curpixel = fb_index + i; |
| 1036 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 1037 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 1038 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 1039 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 1040 | | |
| 1041 | | curpixel_cvg = 8; |
| 1042 | | |
| 1043 | | ss = s >> 5; |
| 1044 | | st = t >> 5; |
| 1045 | | if (rect->flip) |
| 1046 | | { |
| 1047 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 1048 | | } |
| 1049 | | else |
| 1050 | | { |
| 1051 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 1052 | | } |
| 1053 | | |
| 1054 | | c = COLOR_COMBINER1(machine); |
| 1055 | | |
| 1056 | | if (!other_modes.rgb_dither_sel) |
| 1057 | | { |
| 1058 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1059 | | } |
| 1060 | | else if (other_modes.rgb_dither_sel == 1) |
| 1061 | | { |
| 1062 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1063 | | } |
| 1064 | | |
| 1065 | | if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z)) |
| 1066 | | { |
| 1067 | | if(BLENDER1_16(machine, fbcur, hbcur, c, dith)) |
| 1068 | | { |
| 1069 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 1070 | | } |
| 1071 | | } |
| 1072 | | |
| 1073 | | } |
| 1074 | | |
| 1075 | | s += (int)(rect->dsdx); |
| 1076 | | } |
| 1077 | | } |
| 1078 | | t += (int)(rect->dtdy); |
| 1079 | | } |
| 1080 | | } |
| 1081 | | |
| 1082 | | static void texture_rectangle_16bit_c2_zc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 1083 | | { |
| 1084 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 1085 | | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| 1086 | | UINT8 *hb = &hidden_bits[fb_address >> 1]; |
| 1087 | | UINT8 *zhb = &hidden_bits[zb_address >> 1]; |
| 1088 | | |
| 1089 | | int i, j; |
| 1090 | | int x1, x2, y1, y2; |
| 1091 | | int s, t; |
| 1092 | | int ss, st; |
| 1093 | | |
| 1094 | | int clipx1, clipx2, clipy1, clipy2; |
| 1095 | | |
| 1096 | | UINT32 tilenum = rect->tilenum; |
| 1097 | | UINT32 tilenum2 = 0; |
| 1098 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 1099 | | TILE *tex_tile2 = NULL; |
| 1100 | | |
| 1101 | | x1 = (rect->xh / 4); |
| 1102 | | x2 = (rect->xl / 4); |
| 1103 | | y1 = (rect->yh / 4); |
| 1104 | | y2 = (rect->yl / 4); |
| 1105 | | |
| 1106 | | if (x2<=x1) |
| 1107 | | { |
| 1108 | | x2 = x1 + 1; |
| 1109 | | } |
| 1110 | | if (y1==y2) |
| 1111 | | { |
| 1112 | | y2 = y1 + 1; // Needed by Goldeneye |
| 1113 | | } |
| 1114 | | |
| 1115 | | if ((rect->xl & 3) == 3) // Needed by Mega Man 64 |
| 1116 | | { |
| 1117 | | x2++; |
| 1118 | | } |
| 1119 | | if ((rect->yl & 3) == 3) |
| 1120 | | { |
| 1121 | | y2++; |
| 1122 | | } |
| 1123 | | |
| 1124 | | clipx1 = clip.xh / 4; |
| 1125 | | clipx2 = clip.xl / 4; |
| 1126 | | clipy1 = clip.yh / 4; |
| 1127 | | clipy2 = clip.yl / 4; |
| 1128 | | |
| 1129 | | calculate_clamp_diffs(tilenum); |
| 1130 | | |
| 1131 | | if (!other_modes.tex_lod_en) |
| 1132 | | { |
| 1133 | | tilenum2 = (tilenum + 1) & 7; |
| 1134 | | tex_tile2 = &tile[tilenum2]; |
| 1135 | | } |
| 1136 | | else |
| 1137 | | { |
| 1138 | | tilenum2 = (tilenum + 1) & 7; |
| 1139 | | tex_tile2 = &tile[tilenum2]; |
| 1140 | | } |
| 1141 | | |
| 1142 | | |
| 1143 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 1144 | | |
| 1145 | | t = ((int)(rect->t)) << 5; |
| 1146 | | |
| 1147 | | for (j = y1; j < y2; j++) |
| 1148 | | { |
| 1149 | | int fb_index = j * fb_width; |
| 1150 | | |
| 1151 | | if (j >= clipy1 && j < clipy2) |
| 1152 | | { |
| 1153 | 452 | s = (int)(rect->s) << 5; |
| 1154 | 453 | |
| 1155 | 454 | for (i = x1; i < x2; i++) |
| 1156 | 455 | { |
| 1157 | 456 | if (i >= clipx1 && i < clipx2) |
| 1158 | 457 | { |
| 1159 | | COLOR c1, c2; |
| 1160 | | int curpixel = fb_index + i; |
| 1161 | | UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR]; |
| 1162 | | UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR]; |
| 1163 | | UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR]; |
| 1164 | | UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR]; |
| 1165 | | int dith = 0; |
| 1166 | | |
| 1167 | | curpixel_cvg = 8; |
| 1168 | | |
| 1169 | 458 | ss = s >> 5; |
| 1170 | 459 | st = t >> 5; |
| 1171 | 460 | |
| 1172 | | if (rect->flip) |
| 1173 | | { |
| 1174 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 1175 | | TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2); |
| 1176 | | } |
| 1177 | | else |
| 1178 | | { |
| 1179 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 1180 | | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 1181 | | } |
| 1182 | | c1 = COLOR_COMBINER2_C0(machine); |
| 1183 | | c2 = COLOR_COMBINER2_C1(machine); |
| 461 | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 1184 | 462 | |
| 1185 | | if (!other_modes.rgb_dither_sel) |
| 1186 | | { |
| 1187 | | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1188 | | } |
| 1189 | | else if (other_modes.rgb_dither_sel == 1) |
| 1190 | | { |
| 1191 | | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1192 | | } |
| 1193 | | |
| 1194 | | if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z)) |
| 1195 | | { |
| 1196 | | if (BLENDER2_16(machine, fbcur, hbcur, c1, c2, dith)) |
| 1197 | | { |
| 1198 | | z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z); |
| 1199 | | } |
| 1200 | | } |
| 1201 | | |
| 1202 | | } |
| 1203 | | |
| 1204 | | s += (rect->dsdx); |
| 1205 | | } |
| 1206 | | } |
| 1207 | | t += (rect->dtdy); |
| 1208 | | } |
| 1209 | | } |
| 1210 | | |
| 1211 | | static void texture_rectangle_16bit_cc_zc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 1212 | | { |
| 1213 | | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 1214 | | |
| 1215 | | int i, j; |
| 1216 | | int x1, x2, y1, y2; |
| 1217 | | int s, t; |
| 1218 | | int ss, st; |
| 1219 | | |
| 1220 | | int clipx1, clipx2, clipy1, clipy2; |
| 1221 | | |
| 1222 | | UINT32 tilenum = rect->tilenum; |
| 1223 | | TILE *tex_tile = &tile[rect->tilenum]; |
| 1224 | | |
| 1225 | | x1 = (rect->xh / 4); |
| 1226 | | x2 = (rect->xl / 4); |
| 1227 | | y1 = (rect->yh / 4); |
| 1228 | | y2 = (rect->yl / 4); |
| 1229 | | |
| 1230 | | if (x2<=x1) |
| 1231 | | { |
| 1232 | | x2 = x1 + 1; |
| 1233 | | } |
| 1234 | | if (y1==y2) |
| 1235 | | { |
| 1236 | | y2 = y1 + 1; // Needed by Goldeneye |
| 1237 | | } |
| 1238 | | |
| 1239 | | rect->dsdx /= 4; |
| 1240 | | x2 += 1; |
| 1241 | | y2 += 1; |
| 1242 | | |
| 1243 | | clipx1 = clip.xh / 4; |
| 1244 | | clipx2 = clip.xl / 4; |
| 1245 | | clipy1 = clip.yh / 4; |
| 1246 | | clipy2 = clip.yl / 4; |
| 1247 | | |
| 1248 | | calculate_clamp_diffs(tilenum); |
| 1249 | | |
| 1250 | | set_shade_for_rects(); // Needed by Pilotwings 64 |
| 1251 | | |
| 1252 | | t = ((int)(rect->t)) << 5; |
| 1253 | | |
| 1254 | | |
| 1255 | | for (j = y1; j < y2; j++) |
| 1256 | | { |
| 1257 | | int fb_index = j * fb_width; |
| 1258 | | if (j >= clipy1 && j < clipy2) |
| 1259 | | { |
| 1260 | | s = (int)(rect->s) << 5; |
| 1261 | | |
| 1262 | | for (i = x1; i < x2; i++) |
| 1263 | | { |
| 1264 | | if (i >= clipx1 && i < clipx2) |
| 1265 | | { |
| 1266 | | ss = s >> 5; |
| 1267 | | st = t >> 5; |
| 1268 | | |
| 1269 | | if (rect->flip) |
| 1270 | | { |
| 1271 | | TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile); |
| 1272 | | } |
| 1273 | | else |
| 1274 | | { |
| 1275 | | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 1276 | | } |
| 1277 | | |
| 1278 | 463 | curpixel_cvg = 8; |
| 1279 | 464 | |
| 1280 | 465 | if ((texel0_color.i.a != 0)||(!other_modes.alpha_compare_en)) |
| r6714 | r6715 | |
| 1289 | 474 | } |
| 1290 | 475 | } |
| 1291 | 476 | |
| 1292 | | static void texture_rectangle_16bit_cf_zc_zu(running_machine *machine, TEX_RECTANGLE *rect) |
| 477 | #if defined(ZCOMPARE) |
| 478 | #if defined(ZUPDATE) |
| 479 | #if defined(MAGICDITHER) |
| 480 | static void texture_rectangle_16bit_cf_zc_zu_dm(TEX_RECTANGLE *rect) |
| 481 | #elif defined(BAYERDITHER) |
| 482 | static void texture_rectangle_16bit_cf_zc_zu_db(TEX_RECTANGLE *rect) |
| 483 | #else |
| 484 | static void texture_rectangle_16bit_cf_zc_zu_dn(TEX_RECTANGLE *rect) |
| 485 | #endif |
| 486 | #else |
| 487 | #if defined(MAGICDITHER) |
| 488 | static void texture_rectangle_16bit_cf_zc_nzu_dm(TEX_RECTANGLE *rect) |
| 489 | #elif defined(BAYERDITHER) |
| 490 | static void texture_rectangle_16bit_cf_zc_nzu_db(TEX_RECTANGLE *rect) |
| 491 | #else |
| 492 | static void texture_rectangle_16bit_cf_zc_nzu_dn(TEX_RECTANGLE *rect) |
| 493 | #endif |
| 494 | #endif |
| 495 | #else |
| 496 | #if defined(ZUPDATE) |
| 497 | #if defined(MAGICDITHER) |
| 498 | static void texture_rectangle_16bit_cf_nzc_zu_dm(TEX_RECTANGLE *rect) |
| 499 | #elif defined(BAYERDITHER) |
| 500 | static void texture_rectangle_16bit_cf_nzc_zu_db(TEX_RECTANGLE *rect) |
| 501 | #else |
| 502 | static void texture_rectangle_16bit_cf_nzc_zu_dn(TEX_RECTANGLE *rect) |
| 503 | #endif |
| 504 | #else |
| 505 | #if defined(MAGICDITHER) |
| 506 | static void texture_rectangle_16bit_cf_nzc_nzu_dm(TEX_RECTANGLE *rect) |
| 507 | #elif defined(BAYERDITHER) |
| 508 | static void texture_rectangle_16bit_cf_nzc_nzu_db(TEX_RECTANGLE *rect) |
| 509 | #else |
| 510 | static void texture_rectangle_16bit_cf_nzc_nzu_dn(TEX_RECTANGLE *rect) |
| 511 | #endif |
| 512 | #endif |
| 513 | #endif |
| 1293 | 514 | { |
| 1294 | 515 | fatalerror("texture_rectangle with FILL cycle type is not supported\n"); |
| 1295 | 516 | } |
| 1296 | | |
src/mame/video/rdpfb.c
| r6714 | r6715 | |
| 1 | | INLINE UINT32 FBWRITE_16_RDEN_CVGD0(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 1 | #if defined(COLOR_ON_CVG) |
| 2 | INLINE UINT32 FBWRITE_16_RDEN_CVGD0_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 3 | #else |
| 4 | INLINE UINT32 FBWRITE_16_RDEN_CVGD0_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 5 | #endif |
| 2 | 6 | { |
| 3 | 7 | #undef CVG_DRAW |
| 4 | 8 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 24 | 28 | curpixel_overlap = 0; |
| 25 | 29 | } |
| 26 | 30 | |
| 27 | | if (curpixel_cvg > 8) |
| 28 | | { |
| 29 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 30 | | } |
| 31 | | |
| 32 | 31 | newcvg = curpixel_cvg + memory_cvg; |
| 33 | 32 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 34 | 33 | |
| r6714 | r6715 | |
| 37 | 36 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 38 | 37 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 39 | 38 | |
| 40 | | if (!curpixel_cvg) |
| 41 | | { |
| 42 | | fatalerror("cvg underflow"); |
| 43 | | } |
| 44 | | |
| 45 | 39 | curpixel_cvg--; |
| 46 | 40 | newcvg--; |
| 47 | 41 | memory_cvg--; |
| 48 | 42 | clampcvg--; |
| 49 | 43 | |
| 50 | | if (other_modes.color_on_cvg && !wrapflag) |
| 44 | #if defined(COLOR_ON_CVG) |
| 45 | if (!wrapflag) |
| 51 | 46 | { |
| 52 | 47 | *fb &= 0xfffe; |
| 53 | 48 | *fb |= ((newcvg >> 2) & 1); |
| 54 | 49 | *hb = (newcvg & 3); |
| 55 | 50 | return 0; |
| 56 | 51 | } |
| 52 | #endif |
| 57 | 53 | |
| 58 | 54 | if (!other_modes.force_blend && !curpixel_overlap) |
| 59 | 55 | { |
| r6714 | r6715 | |
| 68 | 64 | return 1; |
| 69 | 65 | } |
| 70 | 66 | |
| 71 | | INLINE UINT32 FBWRITE_16_RDEN_CVGD1(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 67 | #if defined(COLOR_ON_CVG) |
| 68 | INLINE UINT32 FBWRITE_16_RDEN_CVGD1_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 69 | #else |
| 70 | INLINE UINT32 FBWRITE_16_RDEN_CVGD1_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 71 | #endif |
| 72 | 72 | { |
| 73 | 73 | #undef CVG_DRAW |
| 74 | 74 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 94 | 94 | curpixel_overlap = 0; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | | if (curpixel_cvg > 8) |
| 98 | | { |
| 99 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 100 | | } |
| 101 | | |
| 102 | 97 | newcvg = curpixel_cvg + memory_cvg; |
| 103 | 98 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 104 | 99 | |
| r6714 | r6715 | |
| 107 | 102 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 108 | 103 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 109 | 104 | |
| 110 | | if (!curpixel_cvg) |
| 111 | | { |
| 112 | | fatalerror("cvg underflow"); |
| 113 | | } |
| 114 | | |
| 115 | 105 | curpixel_cvg--; |
| 116 | 106 | newcvg--; |
| 117 | 107 | memory_cvg--; |
| 118 | 108 | clampcvg--; |
| 119 | 109 | |
| 120 | | if (other_modes.color_on_cvg && !wrapflag) |
| 110 | #if defined(COLOR_ON_CVG) |
| 111 | if (!wrapflag) |
| 121 | 112 | { |
| 122 | 113 | *fb &= 0xfffe; |
| 123 | 114 | *fb |= ((newcvg >> 2) & 1); |
| 124 | 115 | *hb = (newcvg & 3); |
| 125 | 116 | return 0; |
| 126 | 117 | } |
| 118 | #endif |
| 127 | 119 | |
| 128 | 120 | *fb = finalcolor|((newcvg >> 2) & 1); |
| 129 | 121 | *hb = (newcvg & 3); |
| 130 | 122 | return 1; |
| 131 | 123 | } |
| 132 | 124 | |
| 133 | | INLINE UINT32 FBWRITE_16_RDEN_CVGD2(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 125 | #if defined(COLOR_ON_CVG) |
| 126 | INLINE UINT32 FBWRITE_16_RDEN_CVGD2_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 127 | #else |
| 128 | INLINE UINT32 FBWRITE_16_RDEN_CVGD2_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 129 | #endif |
| 134 | 130 | { |
| 135 | 131 | #undef CVG_DRAW |
| 136 | 132 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 156 | 152 | curpixel_overlap = 0; |
| 157 | 153 | } |
| 158 | 154 | |
| 159 | | if (curpixel_cvg > 8) |
| 160 | | { |
| 161 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 162 | | } |
| 163 | | |
| 164 | 155 | newcvg = curpixel_cvg + memory_cvg; |
| 165 | 156 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 166 | 157 | |
| r6714 | r6715 | |
| 169 | 160 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 170 | 161 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 171 | 162 | |
| 172 | | if (!curpixel_cvg) |
| 173 | | { |
| 174 | | fatalerror("cvg underflow"); |
| 175 | | } |
| 176 | | |
| 177 | 163 | curpixel_cvg--; |
| 178 | 164 | newcvg--; |
| 179 | 165 | memory_cvg--; |
| 180 | 166 | clampcvg--; |
| 181 | 167 | |
| 182 | | if (other_modes.color_on_cvg && !wrapflag) |
| 168 | #if defined(COLOR_ON_CVG) |
| 169 | if (!wrapflag) |
| 183 | 170 | { |
| 184 | 171 | *fb &= 0xfffe; |
| 185 | 172 | *fb |= ((newcvg >> 2) & 1); |
| 186 | 173 | *hb = (newcvg & 3); |
| 187 | 174 | return 0; |
| 188 | 175 | } |
| 176 | #endif |
| 189 | 177 | |
| 190 | 178 | *fb = finalcolor|1; |
| 191 | 179 | *hb = 3; |
| 192 | 180 | return 1; |
| 193 | 181 | } |
| 194 | 182 | |
| 195 | | INLINE UINT32 FBWRITE_16_RDEN_CVGD3(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 183 | #if defined(COLOR_ON_CVG) |
| 184 | INLINE UINT32 FBWRITE_16_RDEN_CVGD3_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 185 | #else |
| 186 | INLINE UINT32 FBWRITE_16_RDEN_CVGD3_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 187 | #endif |
| 196 | 188 | { |
| 197 | 189 | #undef CVG_DRAW |
| 198 | 190 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 218 | 210 | curpixel_overlap = 0; |
| 219 | 211 | } |
| 220 | 212 | |
| 221 | | if (curpixel_cvg > 8) |
| 222 | | { |
| 223 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 224 | | } |
| 225 | | |
| 226 | 213 | newcvg = curpixel_cvg + memory_cvg; |
| 227 | 214 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 228 | 215 | |
| r6714 | r6715 | |
| 231 | 218 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 232 | 219 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 233 | 220 | |
| 234 | | if (!curpixel_cvg) |
| 235 | | { |
| 236 | | fatalerror("cvg underflow"); |
| 237 | | } |
| 238 | | |
| 239 | 221 | curpixel_cvg--; |
| 240 | 222 | newcvg--; |
| 241 | 223 | memory_cvg--; |
| 242 | 224 | clampcvg--; |
| 243 | 225 | |
| 244 | | if (other_modes.color_on_cvg && !wrapflag) |
| 226 | #if defined(COLOR_ON_CVG) |
| 227 | if (!wrapflag) |
| 245 | 228 | { |
| 246 | 229 | *fb &= 0xfffe; |
| 247 | 230 | *fb |= ((newcvg >> 2) & 1); |
| 248 | 231 | *hb = (newcvg & 3); |
| 249 | 232 | return 0; |
| 250 | 233 | } |
| 234 | #endif |
| 251 | 235 | |
| 252 | 236 | *fb = finalcolor|((memory_cvg >> 2) & 1); |
| 253 | 237 | *hb = (memory_cvg & 3); |
| 254 | 238 | return 1; |
| 255 | 239 | } |
| 256 | 240 | |
| 257 | | INLINE UINT32 FBWRITE_16_RDNEN_CVGD0(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 241 | #if defined(COLOR_ON_CVG) |
| 242 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD0_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 243 | #else |
| 244 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD0_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 245 | #endif |
| 258 | 246 | { |
| 259 | 247 | #undef CVG_DRAW |
| 260 | 248 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 279 | 267 | curpixel_overlap = 0; |
| 280 | 268 | } |
| 281 | 269 | |
| 282 | | if (curpixel_cvg > 8) |
| 283 | | { |
| 284 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 285 | | } |
| 286 | | |
| 287 | 270 | newcvg = curpixel_cvg + 8; |
| 288 | 271 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 289 | 272 | |
| r6714 | r6715 | |
| 292 | 275 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 293 | 276 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 294 | 277 | |
| 295 | | if (!curpixel_cvg) |
| 296 | | { |
| 297 | | fatalerror("cvg underflow"); |
| 298 | | } |
| 299 | | |
| 300 | 278 | curpixel_cvg--; |
| 301 | 279 | newcvg--; |
| 302 | 280 | clampcvg--; |
| 303 | 281 | |
| 304 | | if (other_modes.color_on_cvg && !wrapflag) |
| 282 | #if defined(COLOR_ON_CVG) |
| 283 | if (!wrapflag) |
| 305 | 284 | { |
| 306 | 285 | *fb &= 0xfffe; |
| 307 | 286 | *fb |= ((newcvg >> 2) & 1); |
| 308 | 287 | *hb = (newcvg & 3); |
| 309 | 288 | return 0; |
| 310 | 289 | } |
| 290 | #endif |
| 311 | 291 | |
| 312 | 292 | if (!other_modes.force_blend && !curpixel_overlap) |
| 313 | 293 | { |
| r6714 | r6715 | |
| 322 | 302 | return 1; |
| 323 | 303 | } |
| 324 | 304 | |
| 325 | | INLINE UINT32 FBWRITE_16_RDNEN_CVGD1(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 305 | #if defined(COLOR_ON_CVG) |
| 306 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD1_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 307 | #else |
| 308 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD1_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 309 | #endif |
| 326 | 310 | { |
| 327 | 311 | #undef CVG_DRAW |
| 328 | 312 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 347 | 331 | curpixel_overlap = 0; |
| 348 | 332 | } |
| 349 | 333 | |
| 350 | | if (curpixel_cvg > 8) |
| 351 | | { |
| 352 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 353 | | } |
| 354 | | |
| 355 | 334 | newcvg = curpixel_cvg + 8; |
| 356 | 335 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 357 | 336 | |
| r6714 | r6715 | |
| 360 | 339 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 361 | 340 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 362 | 341 | |
| 363 | | if (!curpixel_cvg) |
| 364 | | { |
| 365 | | fatalerror("cvg underflow"); |
| 366 | | } |
| 367 | | |
| 368 | 342 | curpixel_cvg--; |
| 369 | 343 | newcvg--; |
| 370 | 344 | clampcvg--; |
| 371 | 345 | |
| 372 | | if (other_modes.color_on_cvg && !wrapflag) |
| 346 | #if defined(COLOR_ON_CVG) |
| 347 | if (!wrapflag) |
| 373 | 348 | { |
| 374 | 349 | *fb &= 0xfffe; |
| 375 | 350 | *fb |= ((newcvg >> 2) & 1); |
| 376 | 351 | *hb = (newcvg & 3); |
| 377 | 352 | return 0; |
| 378 | 353 | } |
| 354 | #endif |
| 379 | 355 | |
| 380 | 356 | *fb = finalcolor|1; |
| 381 | 357 | *hb = 3; |
| 382 | 358 | return 1; |
| 383 | 359 | } |
| 384 | 360 | |
| 385 | | INLINE UINT32 FBWRITE_16_RDNEN_CVGD2(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 361 | #if defined(COLOR_ON_CVG) |
| 362 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD2_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 363 | #else |
| 364 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD2_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 365 | #endif |
| 386 | 366 | { |
| 387 | 367 | #undef CVG_DRAW |
| 388 | 368 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 407 | 387 | curpixel_overlap = 0; |
| 408 | 388 | } |
| 409 | 389 | |
| 410 | | if (curpixel_cvg > 8) |
| 411 | | { |
| 412 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 413 | | } |
| 414 | | |
| 415 | 390 | newcvg = curpixel_cvg + 8; |
| 416 | 391 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 417 | 392 | |
| r6714 | r6715 | |
| 420 | 395 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 421 | 396 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 422 | 397 | |
| 423 | | if (!curpixel_cvg) |
| 424 | | { |
| 425 | | fatalerror("cvg underflow"); |
| 426 | | } |
| 427 | | |
| 428 | 398 | curpixel_cvg--; |
| 429 | 399 | newcvg--; |
| 430 | 400 | clampcvg--; |
| 431 | 401 | |
| 432 | | if (other_modes.color_on_cvg && !wrapflag) |
| 402 | #if defined(COLOR_ON_CVG) |
| 403 | if (!wrapflag) |
| 433 | 404 | { |
| 434 | 405 | *fb &= 0xfffe; |
| 435 | 406 | *fb |= ((newcvg >> 2) & 1); |
| 436 | 407 | *hb = (newcvg & 3); |
| 437 | 408 | return 0; |
| 438 | 409 | } |
| 410 | #endif |
| 439 | 411 | |
| 440 | 412 | *fb = finalcolor|1; |
| 441 | 413 | *hb = 3; |
| 442 | 414 | return 1; |
| 443 | 415 | } |
| 444 | 416 | |
| 445 | | INLINE UINT32 FBWRITE_16_RDNEN_CVGD3(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 417 | #if defined(COLOR_ON_CVG) |
| 418 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD3_COC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 419 | #else |
| 420 | INLINE UINT32 FBWRITE_16_RDNEN_CVGD3_NCOC(UINT16 *fb, UINT8* hb, UINT32 r, UINT32 g, UINT32 b) |
| 421 | #endif |
| 446 | 422 | { |
| 447 | 423 | #undef CVG_DRAW |
| 448 | 424 | UINT16 finalcolor; |
| r6714 | r6715 | |
| 467 | 443 | curpixel_overlap = 0; |
| 468 | 444 | } |
| 469 | 445 | |
| 470 | | if (curpixel_cvg > 8) |
| 471 | | { |
| 472 | | fatalerror("FBWRITE_16: curpixel_cvg %d", curpixel_cvg); |
| 473 | | } |
| 474 | | |
| 475 | 446 | newcvg = curpixel_cvg + 8; |
| 476 | 447 | wrapflag = (newcvg > 8) ? 1 : 0; |
| 477 | 448 | |
| r6714 | r6715 | |
| 480 | 451 | clampcvg = (newcvg > 8) ? 8 : newcvg; |
| 481 | 452 | newcvg = (wrapflag)? (newcvg - 8) : newcvg; |
| 482 | 453 | |
| 483 | | if (!curpixel_cvg) |
| 484 | | { |
| 485 | | fatalerror("cvg underflow"); |
| 486 | | } |
| 487 | | |
| 488 | 454 | curpixel_cvg--; |
| 489 | 455 | newcvg--; |
| 490 | 456 | clampcvg--; |
| 491 | 457 | |
| 492 | | if (other_modes.color_on_cvg && !wrapflag) |
| 458 | #if defined(COLOR_ON_CVG) |
| 459 | if (!wrapflag) |
| 493 | 460 | { |
| 494 | 461 | *fb &= 0xfffe; |
| 495 | 462 | *fb |= ((newcvg >> 2) & 1); |
| 496 | 463 | *hb = (newcvg & 3); |
| 497 | 464 | return 0; |
| 498 | 465 | } |
| 466 | #endif |
| 499 | 467 | |
| 500 | 468 | *fb = finalcolor|1; |
| 501 | 469 | *hb = 4; |
| 502 | 470 | return 1; |
| 503 | 471 | } |
| 504 | 472 | |
| 505 | | INLINE UINT32 FBWRITE_32_RDEN_CVGD0(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 473 | #if defined(COLOR_ON_CVG) |
| 474 | INLINE UINT32 FBWRITE_32_RDEN_CVGD0_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 475 | #else |
| 476 | INLINE UINT32 FBWRITE_32_RDEN_CVGD0_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 477 | #endif |
| 506 | 478 | { |
| 507 | 479 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 508 | 480 | UINT32 memory_cvg = ((*fb >>5) & 7) + 1; |
| r6714 | r6715 | |
| 520 | 492 | memory_cvg--; |
| 521 | 493 | clampcvg--; |
| 522 | 494 | |
| 523 | | if (other_modes.color_on_cvg && !wrapflag) |
| 495 | #if defined(COLOR_ON_CVG) |
| 496 | if (!wrapflag) |
| 524 | 497 | { |
| 525 | 498 | *fb &= 0xffffff00; |
| 526 | 499 | *fb |= ((newcvg << 5) & 0xff); |
| 527 | 500 | return 0; |
| 528 | 501 | } |
| 502 | #endif |
| 529 | 503 | |
| 530 | 504 | if (!other_modes.force_blend && !curpixel_overlap) |
| 531 | 505 | { |
| r6714 | r6715 | |
| 538 | 512 | return 1; |
| 539 | 513 | } |
| 540 | 514 | |
| 541 | | INLINE UINT32 FBWRITE_32_RDEN_CVGD1(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 515 | #if defined(COLOR_ON_CVG) |
| 516 | INLINE UINT32 FBWRITE_32_RDEN_CVGD1_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 517 | #else |
| 518 | INLINE UINT32 FBWRITE_32_RDEN_CVGD1_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 519 | #endif |
| 542 | 520 | { |
| 543 | 521 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 544 | 522 | UINT32 memory_cvg = ((*fb >>5) & 7) + 1; |
| r6714 | r6715 | |
| 556 | 534 | memory_cvg--; |
| 557 | 535 | clampcvg--; |
| 558 | 536 | |
| 559 | | if (other_modes.color_on_cvg && !wrapflag) |
| 537 | #if defined(COLOR_ON_CVG) |
| 538 | if (!wrapflag) |
| 560 | 539 | { |
| 561 | 540 | *fb &= 0xffffff00; |
| 562 | 541 | *fb |= ((newcvg << 5) & 0xff); |
| 563 | 542 | return 0; |
| 564 | 543 | } |
| 544 | #endif |
| 565 | 545 | |
| 566 | 546 | *fb = finalcolor | (newcvg << 5); |
| 567 | 547 | return 1; |
| 568 | 548 | } |
| 569 | 549 | |
| 570 | | INLINE UINT32 FBWRITE_32_RDEN_CVGD2(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 550 | #if defined(COLOR_ON_CVG) |
| 551 | INLINE UINT32 FBWRITE_32_RDEN_CVGD2_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 552 | #else |
| 553 | INLINE UINT32 FBWRITE_32_RDEN_CVGD2_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 554 | #endif |
| 571 | 555 | { |
| 572 | 556 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 573 | 557 | UINT32 memory_cvg = ((*fb >>5) & 7) + 1; |
| r6714 | r6715 | |
| 585 | 569 | memory_cvg--; |
| 586 | 570 | clampcvg--; |
| 587 | 571 | |
| 588 | | if (other_modes.color_on_cvg && !wrapflag) |
| 572 | #if defined(COLOR_ON_CVG) |
| 573 | if (!wrapflag) |
| 589 | 574 | { |
| 590 | 575 | *fb &= 0xffffff00; |
| 591 | 576 | *fb |= ((newcvg << 5) & 0xff); |
| 592 | 577 | return 0; |
| 593 | 578 | } |
| 579 | #endif |
| 594 | 580 | |
| 595 | 581 | *fb = finalcolor | 0xE0; |
| 596 | 582 | return 1; |
| 597 | 583 | } |
| 598 | 584 | |
| 599 | | INLINE UINT32 FBWRITE_32_RDEN_CVGD3(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 585 | #if defined(COLOR_ON_CVG) |
| 586 | INLINE UINT32 FBWRITE_32_RDEN_CVGD3_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 587 | #else |
| 588 | INLINE UINT32 FBWRITE_32_RDEN_CVGD3_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 589 | #endif |
| 600 | 590 | { |
| 601 | 591 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 602 | 592 | UINT32 memory_alphachannel = *fb & 0xff; |
| r6714 | r6715 | |
| 615 | 605 | memory_cvg--; |
| 616 | 606 | clampcvg--; |
| 617 | 607 | |
| 618 | | if (other_modes.color_on_cvg && !wrapflag) |
| 608 | #if defined(COLOR_ON_CVG) |
| 609 | if (!wrapflag) |
| 619 | 610 | { |
| 620 | 611 | *fb &= 0xffffff00; |
| 621 | 612 | *fb |= ((newcvg << 5) & 0xff); |
| 622 | 613 | return 0; |
| 623 | 614 | } |
| 615 | #endif |
| 624 | 616 | |
| 625 | 617 | *fb = finalcolor | memory_alphachannel; |
| 626 | 618 | return 1; |
| 627 | 619 | } |
| 628 | 620 | |
| 629 | | INLINE UINT32 FBWRITE_32_RDNEN_CVGD0(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 621 | #if defined(COLOR_ON_CVG) |
| 622 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD0_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 623 | #else |
| 624 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD0_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 625 | #endif |
| 630 | 626 | { |
| 631 | 627 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 632 | 628 | UINT32 newcvg; |
| r6714 | r6715 | |
| 642 | 638 | newcvg--; |
| 643 | 639 | clampcvg--; |
| 644 | 640 | |
| 645 | | if (other_modes.color_on_cvg && !wrapflag) |
| 641 | #if defined(COLOR_ON_CVG) |
| 642 | if (!wrapflag) |
| 646 | 643 | { |
| 647 | 644 | *fb &= 0xffffff00; |
| 648 | 645 | *fb |= ((newcvg << 5) & 0xff); |
| 649 | 646 | return 0; |
| 650 | 647 | } |
| 648 | #endif |
| 651 | 649 | |
| 652 | 650 | if (!other_modes.force_blend && !curpixel_overlap) |
| 653 | 651 | { |
| r6714 | r6715 | |
| 660 | 658 | return 1; |
| 661 | 659 | } |
| 662 | 660 | |
| 663 | | INLINE UINT32 FBWRITE_32_RDNEN_CVGD1(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 661 | #if defined(COLOR_ON_CVG) |
| 662 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD1_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 663 | #else |
| 664 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD1_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 665 | #endif |
| 664 | 666 | { |
| 665 | 667 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 666 | 668 | UINT32 newcvg; |
| r6714 | r6715 | |
| 676 | 678 | newcvg--; |
| 677 | 679 | clampcvg--; |
| 678 | 680 | |
| 679 | | if (other_modes.color_on_cvg && !wrapflag) |
| 681 | #if defined(COLOR_ON_CVG) |
| 682 | if (!wrapflag) |
| 680 | 683 | { |
| 681 | 684 | *fb &= 0xffffff00; |
| 682 | 685 | *fb |= ((newcvg << 5) & 0xff); |
| 683 | 686 | return 0; |
| 684 | 687 | } |
| 688 | #endif |
| 685 | 689 | |
| 686 | 690 | *fb = finalcolor | (newcvg << 5); |
| 687 | 691 | return 1; |
| 688 | 692 | } |
| 689 | 693 | |
| 690 | | INLINE UINT32 FBWRITE_32_RDNEN_CVGD2(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 694 | #if defined(COLOR_ON_CVG) |
| 695 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD2_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 696 | #else |
| 697 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD2_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 698 | #endif |
| 691 | 699 | { |
| 692 | 700 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 693 | 701 | UINT32 newcvg; |
| r6714 | r6715 | |
| 703 | 711 | newcvg--; |
| 704 | 712 | clampcvg--; |
| 705 | 713 | |
| 706 | | if (other_modes.color_on_cvg && !wrapflag) |
| 714 | #if defined(COLOR_ON_CVG) |
| 715 | if (!wrapflag) |
| 707 | 716 | { |
| 708 | 717 | *fb &= 0xffffff00; |
| 709 | 718 | *fb |= ((newcvg << 5) & 0xff); |
| 710 | 719 | return 0; |
| 711 | 720 | } |
| 721 | #endif |
| 712 | 722 | |
| 713 | 723 | *fb = finalcolor | 0xE0; |
| 714 | 724 | return 1; |
| 715 | 725 | } |
| 716 | 726 | |
| 717 | | INLINE UINT32 FBWRITE_32_RDNEN_CVGD3(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 727 | #if defined(COLOR_ON_CVG) |
| 728 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD3_COC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 729 | #else |
| 730 | INLINE UINT32 FBWRITE_32_RDNEN_CVGD3_NCOC(UINT32 *fb, UINT32 r, UINT32 g, UINT32 b) |
| 731 | #endif |
| 718 | 732 | { |
| 719 | 733 | UINT32 finalcolor=(r << 24) | (g << 16) | (b << 8); |
| 720 | 734 | UINT32 memory_alphachannel = *fb & 0xff; |
| r6714 | r6715 | |
| 731 | 745 | newcvg--; |
| 732 | 746 | clampcvg--; |
| 733 | 747 | |
| 734 | | if (other_modes.color_on_cvg && !wrapflag) |
| 748 | #if defined(COLOR_ON_CVG) |
| 749 | if (!wrapflag) |
| 735 | 750 | { |
| 736 | 751 | *fb &= 0xffffff00; |
| 737 | 752 | *fb |= ((newcvg << 5) & 0xff); |
| 738 | 753 | return 0; |
| 739 | 754 | } |
| 755 | #endif |
| 740 | 756 | |
| 741 | 757 | *fb = finalcolor | memory_alphachannel; |
| 742 | 758 | return 1; |
src/mame/video/n64.c
| r6714 | r6715 | |
| 306 | 306 | static UINT16 z_com_table[0x40000]; // Pre-calculated table of compressed z values |
| 307 | 307 | static UINT32 max_level = 0; |
| 308 | 308 | static UINT32 min_level = 0; |
| 309 | | static COLOR ViBuffer[640][480]; // Used by divot filter |
| 309 | //static COLOR ViBuffer[640][480]; // Used by divot filter |
| 310 | 310 | static INT32 maskbits_table[16]; // Pre-calculated |
| 311 | 311 | static INT32 clamp_t_diff[8]; |
| 312 | 312 | static INT32 clamp_s_diff[8]; |
| 313 | 313 | |
| 314 | | INLINE UINT8 COMBINER_EQUATION(UINT8 A, UINT8 B, UINT8 C, UINT8 D); |
| 314 | INLINE void COMBINER_EQUATION(UINT8* out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D); |
| 315 | 315 | INLINE UINT32 addrightcvg(UINT32 x, UINT32 k); |
| 316 | 316 | INLINE UINT32 addleftcvg(UINT32 x, UINT32 k); |
| 317 | 317 | INLINE UINT32 z_decompress(UINT16* zb); |
| r6714 | r6715 | |
| 321 | 321 | INLINE UINT32 z_compare(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix); |
| 322 | 322 | INLINE INT32 normalize_dzpix(INT32 sum); |
| 323 | 323 | INLINE INT32 CLIP(INT32 value,INT32 min,INT32 max); |
| 324 | | INLINE COLOR video_filter16(UINT16* vbuff, UINT8* hbuff, UINT32 hres); |
| 324 | INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UINT8* hbuff, UINT32 hres); |
| 325 | 325 | INLINE void divot_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index); |
| 326 | 326 | INLINE void restore_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index, UINT32 hres); |
| 327 | 327 | INLINE UINT32 getlog2(UINT32 lod_clamp); |
| 328 | 328 | INLINE void set_shade_for_rects(void); |
| 329 | | INLINE void set_shade_for_tris(UINT32 shade); |
| 330 | 329 | INLINE void copy_colors(COLOR* dst, COLOR* src); |
| 331 | 330 | INLINE void BILERP_AND_WRITE(UINT32* src0, UINT32* src1, UINT32* dest); |
| 332 | 331 | INLINE void tcdiv(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst); |
| r6714 | r6715 | |
| 338 | 337 | INLINE void calculate_clamp_diffs(UINT32 prim_tile); |
| 339 | 338 | INLINE void rgb_dither(INT32* r, INT32* g, INT32* b, int dith); |
| 340 | 339 | |
| 341 | | INLINE void BLENDER_EQUATION_FORCE(INT32* r, INT32* g, INT32* b, int cycle, int bsel_special); |
| 342 | | INLINE void BLENDER_EQUATION_NFORCE(INT32* r, INT32* g, INT32* b, int cycle, int bsel_special); |
| 340 | INLINE void BLENDER_EQUATION0_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 341 | INLINE void BLENDER_EQUATION0_NFORCE(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 342 | INLINE void BLENDER_EQUATION1_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 343 | INLINE void BLENDER_EQUATION1_NFORCE(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 343 | 344 | |
| 344 | | static void (*BLENDER_EQUATION)(INT32* r, INT32* g, INT32* b, int cycle, int bsel_special); |
| 345 | static void (*BLENDER_EQUATION0)(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 346 | static void (*BLENDER_EQUATION1)(INT32* r, INT32* g, INT32* b, int bsel_special); |
| 345 | 347 | |
| 346 | 348 | #include "video/rdpfb.h" |
| 347 | 349 | |
| r6714 | r6715 | |
| 350 | 352 | |
| 351 | 353 | #include "video/rdpacvg.h" |
| 352 | 354 | |
| 353 | | static UINT8 (*alpha_cvg_get)(UINT8 comb_alpha); |
| 355 | static void (*alpha_cvg_get)(UINT8 *comb_alpha); |
| 354 | 356 | |
| 355 | 357 | #include "video/rdpacomp.h" |
| 356 | 358 | |
| 357 | | static int (*alpha_compare)(running_machine *machine, UINT8 comb_alpha); |
| 359 | static int (*alpha_compare)(UINT8 comb_alpha); |
| 358 | 360 | |
| 359 | 361 | #include "video/rdptrect.h" |
| 360 | 362 | |
| 361 | | static void (*texture_rectangle_16bit)(running_machine *machine, TEX_RECTANGLE *rect); |
| 363 | static void (*texture_rectangle_16bit)(TEX_RECTANGLE *rect); |
| 362 | 364 | |
| 363 | 365 | #include "video/rdpspn16.h" |
| 364 | 366 | |
| 365 | | static void (*render_spans_16)(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip); |
| 367 | static void (*render_spans_16_ns_nt_nz_nf)( int start, int end, TILE* tex_tile); |
| 368 | static void (*render_spans_16_ns_nt_z_nf)(int start, int end, TILE* tex_tile); |
| 369 | static void (*render_spans_16_ns_t_nz_nf)(int start, int end, TILE* tex_tile); |
| 370 | static void (*render_spans_16_ns_t_z_nf)(int start, int end, TILE* tex_tile); |
| 371 | static void (*render_spans_16_s_nt_nz_nf)(int start, int end, TILE* tex_tile); |
| 372 | static void (*render_spans_16_s_nt_z_nf)(int start, int end, TILE* tex_tile); |
| 373 | static void (*render_spans_16_s_t_nz_nf)(int start, int end, TILE* tex_tile); |
| 374 | static void (*render_spans_16_s_t_z_nf)(int start, int end, TILE* tex_tile); |
| 375 | static void (*render_spans_16_ns_nt_nz_f)(int start, int end, TILE* tex_tile); |
| 376 | static void (*render_spans_16_ns_nt_z_f)(int start, int end, TILE* tex_tile); |
| 377 | static void (*render_spans_16_ns_t_nz_f)(int start, int end, TILE* tex_tile); |
| 378 | static void (*render_spans_16_ns_t_z_f)(int start, int end, TILE* tex_tile); |
| 379 | static void (*render_spans_16_s_nt_nz_f)(int start, int end, TILE* tex_tile); |
| 380 | static void (*render_spans_16_s_nt_z_f)(int start, int end, TILE* tex_tile); |
| 381 | static void (*render_spans_16_s_t_nz_f)(int start, int end, TILE* tex_tile); |
| 382 | static void (*render_spans_16_s_t_z_f)(int start, int end, TILE* tex_tile); |
| 366 | 383 | |
| 367 | 384 | #include "video/rdptpipe.h" |
| 368 | 385 | |
| 369 | 386 | static void (*TEXTURE_PIPELINE)(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile); |
| 370 | 387 | |
| 388 | #include "video/rdpblend.h" |
| 389 | |
| 390 | static int (*BLENDER1_16)(UINT16 *fb, UINT8* hb, COLOR c, int dith); |
| 391 | static int (*BLENDER2_16)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith); |
| 392 | |
| 393 | #include "video/rdptri.h" |
| 394 | |
| 395 | INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 396 | INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 397 | |
| 398 | static void (*CLAMP)(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 399 | |
| 400 | INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 401 | INLINE void CLAMP_LIGHT_NC(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 402 | |
| 403 | static void (*CLAMP_LIGHT)(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile); |
| 404 | |
| 405 | static UINT8 rdp_rand_val = 0; |
| 406 | |
| 407 | #include "video/rdpfetch.h" |
| 408 | |
| 409 | // Hack, but more efficient than mame_rand |
| 410 | static UINT8 rdp_rand(void) |
| 411 | { |
| 412 | return (rdp_rand_val += 19); |
| 413 | } |
| 414 | |
| 371 | 415 | INLINE void MASK(INT32* S, INT32* T, TILE* tex_tile) |
| 372 | 416 | { |
| 373 | 417 | INT32 swrap, twrap; |
| r6714 | r6715 | |
| 433 | 477 | *maxt = ((*T >> 3) >= tex_tile->th); |
| 434 | 478 | } |
| 435 | 479 | |
| 436 | | INLINE void CLAMP(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile) |
| 480 | INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile) |
| 437 | 481 | { |
| 438 | | int notcopy = (other_modes.cycle_type != CYCLE_TYPE_COPY); |
| 439 | 482 | int dosfrac = (tex_tile->cs || !tex_tile->mask_s); |
| 440 | | int dos = dosfrac && notcopy; |
| 441 | 483 | int dotfrac = (tex_tile->ct || !tex_tile->mask_t); |
| 442 | | int dot = dotfrac && notcopy; |
| 443 | 484 | int overunders = 0; |
| 444 | 485 | int overundert = 0; |
| 445 | | if (*S & 0x10000 && dos) |
| 486 | if (*S & 0x10000 && dosfrac) |
| 446 | 487 | { |
| 447 | 488 | *S = 0; |
| 448 | 489 | overunders = 1; |
| 449 | 490 | } |
| 450 | | else if (maxs && dos) |
| 491 | else if (maxs && dosfrac) |
| 451 | 492 | { |
| 452 | 493 | *S = clamp_s_diff[tex_tile->num]; |
| 453 | 494 | overunders = 1; |
| r6714 | r6715 | |
| 457 | 498 | { |
| 458 | 499 | *S = (SIGN17(*S) >> 5) & 0x1fff; |
| 459 | 500 | } |
| 501 | |
| 460 | 502 | if (overunders && dosfrac) |
| 461 | 503 | { |
| 462 | 504 | *SFRAC = 0; |
| 463 | 505 | } |
| 464 | 506 | |
| 465 | | if (*T & 0x10000 && dot) |
| 507 | if (*T & 0x10000 && dotfrac) |
| 466 | 508 | { |
| 467 | 509 | *T = 0; |
| 468 | 510 | overundert = 1; |
| 469 | 511 | } |
| 470 | | else if (maxt && dot) |
| 512 | else if (maxt && dotfrac) |
| 471 | 513 | { |
| 472 | 514 | *T = clamp_t_diff[tex_tile->num]; |
| 473 | 515 | overundert = 1; |
| r6714 | r6715 | |
| 476 | 518 | { |
| 477 | 519 | *T = (SIGN17(*T) >> 5) & 0x1fff; |
| 478 | 520 | } |
| 521 | |
| 479 | 522 | if (overundert && dotfrac) |
| 480 | 523 | { |
| 481 | 524 | *TFRAC = 0; |
| 482 | 525 | } |
| 483 | 526 | } |
| 484 | 527 | |
| 485 | | INLINE void CLAMP_LIGHT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile) |
| 528 | INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile) |
| 486 | 529 | { |
| 487 | | int notcopy = (other_modes.cycle_type != CYCLE_TYPE_COPY); |
| 488 | | int dos = (tex_tile->cs || !tex_tile->mask_s) && notcopy; |
| 489 | | int dot = (tex_tile->ct || !tex_tile->mask_t) && notcopy; |
| 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; |
| 490 | 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 | |
| 550 | INLINE 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 | |
| 556 | INLINE 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 | |
| 491 | 561 | if (*S & 0x10000 && dos) |
| 492 | 562 | { |
| 493 | 563 | *S = 0; |
| r6714 | r6715 | |
| 598 | 668 | } |
| 599 | 669 | } |
| 600 | 670 | |
| 601 | | VIDEO_UPDATE(n64) |
| 671 | #define FSAA |
| 672 | #define DIVOT |
| 673 | #include "rdpupd16.c" |
| 674 | #undef DIVOT |
| 675 | #include "rdpupd16.c" |
| 676 | #undef FSAA |
| 677 | #define DIVOT |
| 678 | #include "rdpupd16.c" |
| 679 | #undef DIVOT |
| 680 | #include "rdpupd16.c" |
| 681 | |
| 682 | static void video_update_n64_32(bitmap_t *bitmap) |
| 602 | 683 | { |
| 603 | 684 | int i, j; |
| 604 | | UINT32 final = 0; |
| 605 | | UINT32 prev_cvg = 0, next_cvg = 0; |
| 606 | | int height = fb_height; |
| 607 | | int dither_filter = (n64_vi_control >> 16) & 1; |
| 608 | | int fsaa = (((n64_vi_control >> 8) & 3) < 2); |
| 609 | | int divot = (n64_vi_control >> 4) & 1; |
| 610 | 685 | int gamma = (n64_vi_control >> 3) & 1; |
| 611 | 686 | int gamma_dither = (n64_vi_control >> 2) & 1; |
| 612 | | int vibuffering = ((n64_vi_control & 2) && fsaa && divot); |
| 687 | //int vibuffering = ((n64_vi_control & 2) && fsaa && divot); |
| 613 | 688 | |
| 614 | 689 | UINT32 *frame_buffer32; |
| 615 | 690 | UINT16 *frame_buffer; |
| 616 | 691 | UINT32 hb; |
| 617 | 692 | UINT8* hidden_buffer; |
| 618 | | COLOR newc; |
| 619 | 693 | |
| 620 | | UINT32 pixels = 0; |
| 621 | | UINT16 pix = 0; |
| 622 | 694 | int r, g, b; |
| 623 | 695 | int dith = 0; |
| 624 | 696 | |
| r6714 | r6715 | |
| 633 | 705 | |
| 634 | 706 | if (vdiff <= 0 || hdiff <= 0) |
| 635 | 707 | { |
| 636 | | return 0; |
| 708 | |
| 709 | return; |
| 637 | 710 | } |
| 638 | 711 | |
| 639 | 712 | frame_buffer = (UINT16*)&rdram[(n64_vi_origin & 0xffffff) >> 2]; |
| 640 | 713 | hb = ((n64_vi_origin & 0xffffff) >> 2) >> 1; |
| 641 | 714 | hidden_buffer = &hidden_bits[hb]; |
| 642 | 715 | |
| 643 | | vibuffering = 0; // Disabled for now |
| 644 | | |
| 645 | | |
| 646 | 716 | if (hres > 640) // Needed by Top Gear Overdrive (E) |
| 647 | 717 | { |
| 648 | 718 | invisiblewidth += (hres - 640); |
| 649 | 719 | hres = 640; |
| 650 | 720 | } |
| 651 | 721 | |
| 722 | frame_buffer32 = (UINT32*)&rdram[(n64_vi_origin & 0xffffff) >> 2]; |
| 723 | if (frame_buffer32) |
| 724 | { |
| 725 | for (j=0; j < vres; j++) |
| 726 | { |
| 727 | UINT32 *d = BITMAP_ADDR32(bitmap, j, 0); |
| 728 | for (i=0; i < hres; i++) |
| 729 | { |
| 730 | UINT32 pix = *frame_buffer32++; |
| 731 | if (gamma || gamma_dither) |
| 732 | { |
| 733 | r = (pix >> 24) & 0xff; |
| 734 | g = (pix >> 16) & 0xff; |
| 735 | b = (pix >> 8) & 0xff; |
| 736 | if (gamma_dither) |
| 737 | { |
| 738 | dith = rdp_rand() & 0x3f; |
| 739 | } |
| 740 | if (gamma) |
| 741 | { |
| 742 | if (gamma_dither) |
| 743 | { |
| 744 | r = gamma_dither_table[(r << 6)| dith]; |
| 745 | g = gamma_dither_table[(g << 6)| dith]; |
| 746 | b = gamma_dither_table[(b << 6)| dith]; |
| 747 | } |
| 748 | else |
| 749 | { |
| 750 | r = gamma_table[r]; |
| 751 | g = gamma_table[g]; |
| 752 | b = gamma_table[b]; |
| 753 | } |
| 754 | } |
| 755 | else if (gamma_dither) |
| 756 | { |
| 757 | if (r < 255) |
| 758 | r += (dith & 1); |
| 759 | if (g < 255) |
| 760 | g += (dith & 1); |
| 761 | if (b < 255) |
| 762 | b += (dith & 1); |
| 763 | } |
| 764 | pix = (r << 24) | (g << 16) | (b << 8); |
| 765 | } |
| 766 | |
| 767 | |
| 768 | d[i] = (pix >> 8); |
| 769 | } |
| 770 | frame_buffer32 += invisiblewidth; |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | VIDEO_UPDATE(n64) |
| 776 | { |
| 777 | int i, j; |
| 778 | int fsaa = (((n64_vi_control >> 8) & 3) < 2); |
| 779 | int divot = (n64_vi_control >> 4) & 1; |
| 780 | int height = fb_height; |
| 781 | //int vibuffering = ((n64_vi_control & 2) && fsaa && divot); |
| 782 | |
| 783 | //vibuffering = 0; // Disabled for now |
| 784 | |
| 785 | /* |
| 652 | 786 | if (vibuffering && ((n64_vi_control & 3) == 2)) |
| 653 | 787 | { |
| 654 | 788 | if (frame_buffer) |
| r6714 | r6715 | |
| 678 | 812 | } |
| 679 | 813 | } |
| 680 | 814 | } |
| 815 | */ |
| 681 | 816 | |
| 682 | 817 | if (n64_vi_blank) |
| 683 | 818 | { |
| r6714 | r6715 | |
| 701 | 836 | |
| 702 | 837 | case 2: // RGBA5551 |
| 703 | 838 | { |
| 704 | | pixels = 0; |
| 705 | | |
| 706 | | if (frame_buffer) |
| 839 | if(divot && fsaa) |
| 707 | 840 | { |
| 708 | | for (j=0; j < vres; j++) |
| 709 | | { |
| 710 | | UINT32 *d = BITMAP_ADDR32(bitmap, j, 0); |
| 711 | | |
| 712 | | for (i=0; i < hres; i++) |
| 713 | | { |
| 714 | | int r, g, b; |
| 715 | | |
| 716 | | pix = frame_buffer[pixels ^ WORD_ADDR_XOR]; |
| 717 | | curpixel_cvg = ((pix & 1) << 2) | (hidden_buffer[pixels ^ BYTE_ADDR_XOR] & 3); |
| 718 | | |
| 719 | | if (i > 0 && i < (hres - 1) && divot) |
| 720 | | { |
| 721 | | prev_cvg = ((frame_buffer[(pixels - 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels - 1)^BYTE_ADDR_XOR] & 3); |
| 722 | | next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3); |
| 723 | | } |
| 724 | | r = ((pix >> 8) & 0xf8) | (pix >> 13); |
| 725 | | g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07); |
| 726 | | b = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07); |
| 727 | | |
| 728 | | if (!vibuffering && curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2) && fsaa) |
| 729 | | { |
| 730 | | newc = video_filter16(&frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64_vi_width); |
| 731 | | r = newc.i.r; g = newc.i.g; b = newc.i.b; |
| 732 | | } |
| 733 | | else if (dither_filter && curpixel_cvg == 7 && i > 0 && j > 0 && i < (hres - 1) && j < (vres - 1)) |
| 734 | | { |
| 735 | | if (vibuffering) |
| 736 | | { |
| 737 | | restore_filter16_buffer(&r, &g, &b, &ViBuffer[i][j], n64_vi_width); |
| 738 | | } |
| 739 | | else |
| 740 | | { |
| 741 | | //restore_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR, n64_vi_width); |
| 742 | | } |
| 743 | | } |
| 744 | | if (i > 0 && i < (hres - 1) && divot && (curpixel_cvg != 7 || prev_cvg != 7 || next_cvg != 7)) |
| 745 | | { |
| 746 | | if (vibuffering) |
| 747 | | { |
| 748 | | divot_filter16_buffer(&r, &g, &b, &ViBuffer[i][j]); |
| 749 | | } |
| 750 | | else |
| 751 | | { |
| 752 | | divot_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR); |
| 753 | | } |
| 754 | | } |
| 755 | | |
| 756 | | /* |
| 757 | | if (gamma_dither) |
| 758 | | { |
| 759 | | dith = mame_rand(screen->machine) & 0x3f; |
| 760 | | } |
| 761 | | if (gamma) |
| 762 | | { |
| 763 | | if (gamma_dither) |
| 764 | | { |
| 765 | | r = gamma_dither_table[(r << 6)|dith]; |
| 766 | | g = gamma_dither_table[(g << 6)|dith]; |
| 767 | | b = gamma_dither_table[(b << 6)|dith]; |
| 768 | | } |
| 769 | | else |
| 770 | | { |
| 771 | | r = gamma_table[r]; |
| 772 | | g = gamma_table[g]; |
| 773 | | b = gamma_table[b]; |
| 774 | | } |
| 775 | | } |
| 776 | | else if (gamma_dither) |
| 777 | | { |
| 778 | | if (r < 255) |
| 779 | | r += (dith & 1); |
| 780 | | if (g < 255) |
| 781 | | g += (dith & 1); |
| 782 | | if (b < 255) |
| 783 | | b += (dith & 1); |
| 784 | | } |
| 785 | | */ |
| 786 | | pixels++; |
| 787 | | |
| 788 | | final = (r << 16) | (g << 8) | b; |
| 789 | | d[i] = final; // Fix me for endianness |
| 790 | | } |
| 791 | | pixels +=invisiblewidth; |
| 792 | | } |
| 841 | video_update_n64_16_fsaa_divot(bitmap); |
| 793 | 842 | } |
| 843 | else if(divot) |
| 844 | { |
| 845 | video_update_n64_16_nofsaa_divot(bitmap); |
| 846 | } |
| 847 | else if(fsaa) |
| 848 | { |
| 849 | video_update_n64_16_fsaa_nodivot(bitmap); |
| 850 | } |
| 851 | else |
| 852 | { |
| 853 | video_update_n64_16_nofsaa_nodivot(bitmap); |
| 854 | } |
| 794 | 855 | break; |
| 795 | 856 | } |
| 796 | 857 | |
| 797 | 858 | case 3: // RGBA8888 |
| 798 | 859 | { |
| 799 | | frame_buffer32 = (UINT32*)&rdram[(n64_vi_origin & 0xffffff) >> 2]; |
| 800 | | if (frame_buffer32) |
| 801 | | { |
| 802 | | for (j=0; j < vres; j++) |
| 803 | | { |
| 804 | | UINT32 *d = BITMAP_ADDR32(bitmap, j, 0); |
| 805 | | for (i=0; i < hres; i++) |
| 806 | | { |
| 807 | | UINT32 pix = *frame_buffer32++; |
| 808 | | if (gamma || gamma_dither) |
| 809 | | { |
| 810 | | r = (pix >> 24) & 0xff; |
| 811 | | g = (pix >> 16) & 0xff; |
| 812 | | b = (pix >> 8) & 0xff; |
| 813 | | if (gamma_dither) |
| 814 | | { |
| 815 | | dith = mame_rand(screen->machine) & 0x3f; |
| 816 | | } |
| 817 | | if (gamma) |
| 818 | | { |
| 819 | | if (gamma_dither) |
| 820 | | { |
| 821 | | r = gamma_dither_table[(r << 6)| dith]; |
| 822 | | g = gamma_dither_table[(g << 6)| dith]; |
| 823 | | b = gamma_dither_table[(b << 6)| dith]; |
| 824 | | } |
| 825 | | else |
| 826 | | { |
| 827 | | r = gamma_table[r]; |
| 828 | | g = gamma_table[g]; |
| 829 | | b = gamma_table[b]; |
| 830 | | } |
| 831 | | } |
| 832 | | else if (gamma_dither) |
| 833 | | { |
| 834 | | if (r < 255) |
| 835 | | r += (dith & 1); |
| 836 | | if (g < 255) |
| 837 | | g += (dith & 1); |
| 838 | | if (b < 255) |
| 839 | | b += (dith & 1); |
| 840 | | } |
| 841 | | pix = (r << 24) | (g << 16) | (b << 8); |
| 842 | | } |
| 843 | | |
| 844 | | |
| 845 | | d[i] = (pix >> 8); |
| 846 | | } |
| 847 | | frame_buffer32 += invisiblewidth; |
| 848 | | } |
| 849 | | } |
| 860 | video_update_n64_32(bitmap); |
| 850 | 861 | break; |
| 851 | 862 | } |
| 852 | 863 | |
| r6714 | r6715 | |
| 970 | 981 | |
| 971 | 982 | |
| 972 | 983 | |
| 973 | | INLINE COLOR COLOR_COMBINER1(running_machine *machine) |
| 984 | INLINE void COLOR_COMBINER1(COLOR *c) |
| 974 | 985 | { |
| 975 | | COLOR c; |
| 976 | | |
| 977 | 986 | if (combiner_rgbsub_a_r[1] == &noise_color.i.r) |
| 978 | 987 | { |
| 979 | | noise_color.i.r = mame_rand(machine) & 0xff; |
| 980 | | noise_color.i.g = mame_rand(machine) & 0xff; |
| 981 | | noise_color.i.b = mame_rand(machine) & 0xff; |
| 988 | noise_color.i.r = rdp_rand() & 0xff; |
| 989 | noise_color.i.g = rdp_rand() & 0xff; |
| 990 | noise_color.i.b = rdp_rand() & 0xff; |
| 982 | 991 | } |
| 983 | 992 | |
| 984 | | c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]); |
| 985 | | c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]); |
| 986 | | c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]); |
| 987 | | c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]); |
| 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]); |
| 988 | 997 | |
| 989 | 998 | //Alpha coverage combiner |
| 990 | | c.i.a = alpha_cvg_get(c.i.a); |
| 991 | | |
| 992 | | return c; |
| 999 | alpha_cvg_get(&c->i.a); |
| 993 | 1000 | } |
| 994 | 1001 | |
| 995 | | INLINE COLOR COLOR_COMBINER2_C0(running_machine *machine) |
| 1002 | INLINE void COLOR_COMBINER2_C0(COLOR *c) |
| 996 | 1003 | { |
| 997 | | COLOR c; |
| 998 | | |
| 999 | 1004 | if (combiner_rgbsub_a_r[0] == &noise_color.i.r) |
| 1000 | 1005 | { |
| 1001 | | noise_color.i.r = mame_rand(machine) & 0xff; |
| 1002 | | noise_color.i.g = mame_rand(machine) & 0xff; |
| 1003 | | noise_color.i.b = mame_rand(machine) & 0xff; |
| 1006 | noise_color.i.r = rdp_rand() & 0xff; |
| 1007 | noise_color.i.g = rdp_rand() & 0xff; |
| 1008 | noise_color.i.b = rdp_rand() & 0xff; |
| 1004 | 1009 | } |
| 1005 | 1010 | |
| 1006 | | c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[0],*combiner_rgbsub_b_r[0],*combiner_rgbmul_r[0],*combiner_rgbadd_r[0]); |
| 1007 | | c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[0],*combiner_rgbsub_b_g[0],*combiner_rgbmul_g[0],*combiner_rgbadd_g[0]); |
| 1008 | | c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[0],*combiner_rgbsub_b_b[0],*combiner_rgbmul_b[0],*combiner_rgbadd_b[0]); |
| 1009 | | c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[0],*combiner_alphasub_b[0],*combiner_alphamul[0],*combiner_alphaadd[0]); |
| 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]); |
| 1010 | 1015 | |
| 1011 | | combined_color.c = c.c; |
| 1012 | | |
| 1013 | | return c; |
| 1016 | combined_color.c = c->c; |
| 1014 | 1017 | } |
| 1015 | 1018 | |
| 1016 | | INLINE COLOR COLOR_COMBINER2_C1(running_machine *machine) |
| 1019 | INLINE void COLOR_COMBINER2_C1(COLOR *c) |
| 1017 | 1020 | { |
| 1018 | | COLOR c; |
| 1019 | | |
| 1020 | | c.c = texel0_color.c; |
| 1021 | c->c = texel0_color.c; |
| 1021 | 1022 | texel0_color.c = texel1_color.c; |
| 1022 | | texel1_color.c = c.c; |
| 1023 | texel1_color.c = c->c; |
| 1023 | 1024 | |
| 1024 | 1025 | if (combiner_rgbsub_a_r[1] == &noise_color.i.r) |
| 1025 | 1026 | { |
| 1026 | | noise_color.i.r = mame_rand(machine) & 0xff; |
| 1027 | | noise_color.i.g = mame_rand(machine) & 0xff; |
| 1028 | | noise_color.i.b = mame_rand(machine) & 0xff; |
| 1027 | noise_color.i.r = rdp_rand() & 0xff; |
| 1028 | noise_color.i.g = rdp_rand() & 0xff; |
| 1029 | noise_color.i.b = rdp_rand() & 0xff; |
| 1029 | 1030 | } |
| 1030 | 1031 | |
| 1031 | | c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]); |
| 1032 | | c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]); |
| 1033 | | c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]); |
| 1034 | | c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]); |
| 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]); |
| 1035 | 1036 | |
| 1036 | | c.i.a = alpha_cvg_get(c.i.a); |
| 1037 | | |
| 1038 | | return c; |
| 1037 | alpha_cvg_get(&c->i.a); |
| 1039 | 1038 | } |
| 1040 | 1039 | |
| 1041 | 1040 | INLINE void SET_BLENDER_INPUT(int cycle, int which, UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, UINT8 **input_a, int a, int b) |
| r6714 | r6715 | |
| 1118 | 1117 | 7, 1, 6, 0 |
| 1119 | 1118 | }; |
| 1120 | 1119 | |
| 1121 | | INLINE int BLENDER1_16(running_machine *machine, UINT16 *fb, UINT8* hb, COLOR c, int dith) |
| 1122 | | { |
| 1123 | | int r, g, b; |
| 1124 | | int special_bsel = 0; |
| 1125 | | UINT16 mem = *fb; |
| 1126 | | UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3); |
| 1127 | | |
| 1128 | | // Alpha compare |
| 1129 | | if (!alpha_compare(machine, c.i.a)) |
| 1130 | | { |
| 1131 | | return 0; |
| 1132 | | } |
| 1133 | | if (!curpixel_cvg) // New coverage is zero, so abort |
| 1134 | | { |
| 1135 | | return 0; |
| 1136 | | } |
| 1137 | | |
| 1138 | | if (blender2b_a[0] == &memory_color.i.a) |
| 1139 | | { |
| 1140 | | special_bsel = 1; |
| 1141 | | } |
| 1142 | | |
| 1143 | | pixel_color.c = c.c; |
| 1144 | | //copy_colors(&pixel_color,&c); |
| 1145 | | |
| 1146 | | if (!other_modes.z_compare_en) |
| 1147 | | { |
| 1148 | | curpixel_overlap = 0; |
| 1149 | | } |
| 1150 | | |
| 1151 | | memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13); |
| 1152 | | memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >> 8) & 0x07); |
| 1153 | | memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >> 3) & 0x07); |
| 1154 | | |
| 1155 | | if (other_modes.image_read_en) |
| 1156 | | { |
| 1157 | | memory_color.i.a = (memory_cvg << 5) & 0xe0; |
| 1158 | | } |
| 1159 | | else |
| 1160 | | { |
| 1161 | | memory_color.i.a = 0xe0; |
| 1162 | | } |
| 1163 | | |
| 1164 | | if (!curpixel_overlap && !other_modes.force_blend) |
| 1165 | | { |
| 1166 | | r = *blender1a_r[0]; |
| 1167 | | g = *blender1a_g[0]; |
| 1168 | | b = *blender1a_b[0]; |
| 1169 | | } |
| 1170 | | else |
| 1171 | | { |
| 1172 | | inv_pixel_color.i.a = 0xff - *blender1b_a[0]; |
| 1173 | | |
| 1174 | | BLENDER_EQUATION(&r, &g, &b, 0, special_bsel); |
| 1175 | | } |
| 1176 | | |
| 1177 | | if (other_modes.rgb_dither_sel < 2) |
| 1178 | | { |
| 1179 | | // Hack to prevent "double-dithering" artifacts |
| 1180 | | int dithhack = ((r & 0xf8)==(memory_color.i.r&0xf8) && (g & 0xf8) == (memory_color.i.g & 0xf8) &&(b&0xf8)==(memory_color.i.b&0xf8)); |
| 1181 | | if (!dithhack) |
| 1182 | | { |
| 1183 | | rgb_dither(&r, &g, &b, dith); |
| 1184 | | } |
| 1185 | | } |
| 1186 | | |
| 1187 | | return (FBWRITE_16(fb, hb, r, g, b)); |
| 1188 | | } |
| 1189 | | |
| 1190 | | INLINE int BLENDER2_16(running_machine *machine, UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith) |
| 1191 | | { |
| 1192 | | int r, g, b; |
| 1193 | | int special_bsel = 0; |
| 1194 | | UINT16 mem = *fb; |
| 1195 | | UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3); |
| 1196 | | |
| 1197 | | // Alpha compare |
| 1198 | | if (!alpha_compare(machine, c2.i.a)) |
| 1199 | | { |
| 1200 | | return 0; |
| 1201 | | } |
| 1202 | | if (!curpixel_cvg) |
| 1203 | | { |
| 1204 | | return 0; |
| 1205 | | } |
| 1206 | | |
| 1207 | | if (blender2b_a[0] == &memory_color.i.a) |
| 1208 | | { |
| 1209 | | special_bsel = 1; |
| 1210 | | } |
| 1211 | | |
| 1212 | | pixel_color.c = c2.c; |
| 1213 | | //copy_colors(&pixel_color, &c2); |
| 1214 | | if (!other_modes.z_compare_en) |
| 1215 | | { |
| 1216 | | curpixel_overlap = 0; |
| 1217 | | } |
| 1218 | | |
| 1219 | | memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13); |
| 1220 | | memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >> 8) & 0x07); |
| 1221 | | memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >> 3) & 0x07); |
| 1222 | | |
| 1223 | | if (other_modes.image_read_en) |
| 1224 | | { |
| 1225 | | memory_color.i.a = (memory_cvg << 5) & 0xe0; |
| 1226 | | } |
| 1227 | | else |
| 1228 | | { |
| 1229 | | memory_color.i.a = 0xe0; |
| 1230 | | } |
| 1231 | | |
| 1232 | | inv_pixel_color.i.a = 0xff - *blender1b_a[0]; |
| 1233 | | |
| 1234 | | BLENDER_EQUATION(&r, &g, &b, 0, special_bsel); |
| 1235 | | |
| 1236 | | blended_pixel_color.i.r = r; |
| 1237 | | blended_pixel_color.i.g = g; |
| 1238 | | blended_pixel_color.i.b = b; |
| 1239 | | blended_pixel_color.i.a = pixel_color.i.a; |
| 1240 | | |
| 1241 | | pixel_color.i.r = r; |
| 1242 | | pixel_color.i.g = g; |
| 1243 | | pixel_color.i.b = b; |
| 1244 | | |
| 1245 | | inv_pixel_color.i.a = 0xff - *blender1b_a[1]; |
| 1246 | | |
| 1247 | | if (!curpixel_overlap && !other_modes.force_blend) |
| 1248 | | { |
| 1249 | | r = *blender1a_r[1]; |
| 1250 | | g = *blender1a_g[1]; |
| 1251 | | b = *blender1a_b[1]; |
| 1252 | | } |
| 1253 | | else |
| 1254 | | { |
| 1255 | | if (blender2b_a[1] == &memory_color.i.a) |
| 1256 | | { |
| 1257 | | special_bsel = 1; |
| 1258 | | } |
| 1259 | | else |
| 1260 | | { |
| 1261 | | special_bsel = 0; |
| 1262 | | } |
| 1263 | | |
| 1264 | | BLENDER_EQUATION(&r, &g, &b, 1, special_bsel); |
| 1265 | | } |
| 1266 | | |
| 1267 | | if (other_modes.rgb_dither_sel < 2) |
| 1268 | | { |
| 1269 | | // Hack to prevent "double-dithering" artifacts |
| 1270 | | int dithhack = ((r & 0xf8)==(memory_color.i.r&0xf8) && (g & 0xf8) == (memory_color.i.g & 0xf8) &&(b&0xf8)==(memory_color.i.b&0xf8)); |
| 1271 | | if (!dithhack) |
| 1272 | | { |
| 1273 | | rgb_dither(&r, &g, &b, dith); |
| 1274 | | } |
| 1275 | | } |
| 1276 | | |
| 1277 | | return (FBWRITE_16(fb, hb, r, g, b)); |
| 1278 | | } |
| 1279 | | |
| 1280 | 1120 | /*****************************************************************************/ |
| 1281 | 1121 | |
| 1282 | | |
| 1283 | | static void fill_rectangle_16bit(running_machine *machine, RECTANGLE *rect) |
| 1122 | static void fill_rectangle_16bit(RECTANGLE *rect) |
| 1284 | 1123 | { |
| 1285 | 1124 | UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)]; |
| 1286 | 1125 | UINT8* hb = &hidden_bits[fb_address >> 1]; |
| r6714 | r6715 | |
| 1360 | 1199 | for (i = x1; i <= x2; i++) |
| 1361 | 1200 | { |
| 1362 | 1201 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1363 | | c = COLOR_COMBINER1(machine); |
| 1202 | COLOR_COMBINER1(&c); |
| 1364 | 1203 | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1365 | | BLENDER1_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1204 | BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1366 | 1205 | } |
| 1367 | 1206 | } |
| 1368 | 1207 | } |
| r6714 | r6715 | |
| 1376 | 1215 | for (i = x1; i <= x2; i++) |
| 1377 | 1216 | { |
| 1378 | 1217 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1379 | | c = COLOR_COMBINER1(machine); |
| 1218 | COLOR_COMBINER1(&c); |
| 1380 | 1219 | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1381 | | BLENDER1_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1220 | BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1382 | 1221 | } |
| 1383 | 1222 | } |
| 1384 | 1223 | } |
| r6714 | r6715 | |
| 1392 | 1231 | for (i = x1; i <= x2; i++) |
| 1393 | 1232 | { |
| 1394 | 1233 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1395 | | c = COLOR_COMBINER1(machine); |
| 1396 | | BLENDER1_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1234 | COLOR_COMBINER1(&c); |
| 1235 | BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith); |
| 1397 | 1236 | } |
| 1398 | 1237 | } |
| 1399 | 1238 | } |
| r6714 | r6715 | |
| 1410 | 1249 | for (i=x1; i <= x2; i++) |
| 1411 | 1250 | { |
| 1412 | 1251 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1413 | | c1 = COLOR_COMBINER2_C0(machine); |
| 1414 | | c2 = COLOR_COMBINER2_C1(machine); |
| 1252 | COLOR_COMBINER2_C0(&c1); |
| 1253 | COLOR_COMBINER2_C1(&c2); |
| 1415 | 1254 | dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1416 | | BLENDER2_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith); |
| 1255 | BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith); |
| 1417 | 1256 | } |
| 1418 | 1257 | } |
| 1419 | 1258 | } |
| r6714 | r6715 | |
| 1427 | 1266 | for (i=x1; i <= x2; i++) |
| 1428 | 1267 | { |
| 1429 | 1268 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1430 | | c1 = COLOR_COMBINER2_C0(machine); |
| 1431 | | c2 = COLOR_COMBINER2_C1(machine); |
| 1269 | COLOR_COMBINER2_C0(&c1); |
| 1270 | COLOR_COMBINER2_C1(&c2); |
| 1432 | 1271 | dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)]; |
| 1433 | | BLENDER2_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith); |
| 1272 | BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith); |
| 1434 | 1273 | } |
| 1435 | 1274 | } |
| 1436 | 1275 | } |
| r6714 | r6715 | |
| 1444 | 1283 | for (i=x1; i <= x2; i++) |
| 1445 | 1284 | { |
| 1446 | 1285 | curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2; |
| 1447 | | c1 = COLOR_COMBINER2_C0(machine); |
| 1448 | | c2 = COLOR_COMBINER2_C1(machine); |
| 1449 | | BLENDER2_16(machine, &fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith); |
| 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); |
| 1450 | 1289 | } |
| 1451 | 1290 | } |
| 1452 | 1291 | } |
| r6714 | r6715 | |
| 1474 | 1313 | static INT32 twidth; |
| 1475 | 1314 | static INT32 tpal; |
| 1476 | 1315 | |
| 1477 | | #include "video/rdpfetch.c" |
| 1478 | | |
| 1479 | 1316 | INLINE void FETCH_TEXEL(COLOR *color, int s, int t, TILE* tex_tile) |
| 1480 | 1317 | { |
| 1481 | 1318 | twidth = tex_tile->line; |
| r6714 | r6715 | |
| 1488 | 1325 | rdp_fetch_texel_func[tex_tile->fetch_index](color, s, t); |
| 1489 | 1326 | } |
| 1490 | 1327 | |
| 1491 | | #include "video/rdptpipe.c" |
| 1492 | | |
| 1493 | 1328 | INLINE UINT32 z_decompress(UINT16 *zb) |
| 1494 | 1329 | { |
| 1495 | 1330 | UINT32 exponent = (*zb >> 13) & 7; |
| r6714 | r6715 | |
| 1695 | 1530 | } |
| 1696 | 1531 | } |
| 1697 | 1532 | |
| 1698 | | INLINE COLOR video_filter16(UINT16* vbuff, UINT8* hbuff, UINT32 hres) |
| 1533 | INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UINT8* hbuff, UINT32 hres) |
| 1699 | 1534 | { |
| 1700 | | COLOR filtered, penumax, penumin, max, min; |
| 1535 | COLOR penumax, penumin, max, min; |
| 1701 | 1536 | UINT16 pix = *vbuff; |
| 1702 | 1537 | UINT32 centercvg = (*hbuff & 3) + ((pix & 1) << 2) + 1; |
| 1703 | 1538 | UINT32 numoffull = 1; |
| r6714 | r6715 | |
| 1715 | 1550 | UINT32 enb; |
| 1716 | 1551 | int i = 0; |
| 1717 | 1552 | |
| 1718 | | filtered.c = 0; |
| 1719 | | //filtered.i.r = filtered.i.g = filtered.i.b = filtered.i.a = 0; |
| 1553 | *out_r = *out_g = *out_b = 0; |
| 1720 | 1554 | |
| 1721 | 1555 | backr[0] = r; |
| 1722 | 1556 | backg[0] = g; |
| r6714 | r6715 | |
| 1727 | 1561 | |
| 1728 | 1562 | if (centercvg == 8) |
| 1729 | 1563 | { |
| 1730 | | filtered.i.r = r; filtered.i.g = g; filtered.i.b = b; |
| 1731 | | return filtered; |
| 1564 | *out_r = r; |
| 1565 | *out_g = g; |
| 1566 | *out_b = b; |
| 1567 | return; |
| 1732 | 1568 | } |
| 1733 | 1569 | |
| 1734 | 1570 | for(i = 0; i < 5; i++) |
| r6714 | r6715 | |
| 1898 | 1734 | colr = (((colr * coeff) + 4) >> 3) + r; |
| 1899 | 1735 | colg = (((colg * coeff) + 4) >> 3) + g; |
| 1900 | 1736 | colb = (((colb * coeff) + 4) >> 3) + b; |
| 1901 | | colr &= 0xff; |
| 1902 | | colg &= 0xff; |
| 1903 | | colb &= 0xff; |
| 1904 | 1737 | |
| 1905 | | filtered.i.r = colr; |
| 1906 | | filtered.i.g = colg; |
| 1907 | | filtered.i.b = colb; |
| 1908 | | return filtered; |
| 1738 | *out_r = colr & 0xff; |
| 1739 | *out_g = colg & 0xff; |
| 1740 | *out_b = colb & 0xff; |
| 1741 | return; |
| 1909 | 1742 | } |
| 1910 | 1743 | |
| 1911 | 1744 | // This needs to be fixed for endianness. |
| r6714 | r6715 | |
| 2288 | 2121 | //shade_color.i.a = 0; |
| 2289 | 2122 | } |
| 2290 | 2123 | |
| 2291 | | INLINE void set_shade_for_tris(UINT32 shade) |
| 2292 | | { |
| 2293 | | if (!shade) // Hack, needed for Top Gear Rally 2 sky |
| 2294 | | { |
| 2295 | | shade_color.c = prim_color.c; |
| 2296 | | //shade_color.i.r = prim_color.i.r; |
| 2297 | | //shade_color.i.g = prim_color.i.g; |
| 2298 | | //shade_color.i.b = prim_color.i.b;; |
| 2299 | | //shade_color.i.a = prim_color.i.a; |
| 2300 | | } |
| 2301 | | } |
| 2302 | | |
| 2303 | 2124 | INLINE UINT32 getlog2(UINT32 lod_clamp) |
| 2304 | 2125 | { |
| 2305 | 2126 | int i; |
| r6714 | r6715 | |
| 2399 | 2220 | } |
| 2400 | 2221 | #endif |
| 2401 | 2222 | |
| 2402 | | #include "rdptrect.c" |
| 2403 | | |
| 2404 | 2223 | /*****************************************************************************/ |
| 2405 | 2224 | |
| 2406 | | INLINE int BLENDER1_32(running_machine *machine, UINT32 *fb, COLOR c) |
| 2225 | INLINE int BLENDER1_32(UINT32 *fb, COLOR c) |
| 2407 | 2226 | { |
| 2408 | 2227 | UINT32 mem = *fb; |
| 2409 | 2228 | int r, g, b; |
| 2410 | 2229 | |
| 2411 | 2230 | // Alpha compare |
| 2412 | | if (!alpha_compare(machine, c.i.a)) |
| 2231 | if (!alpha_compare(c.i.a)) |
| 2413 | 2232 | { |
| 2414 | 2233 | return 0; |
| 2415 | 2234 | } |
| r6714 | r6715 | |
| 2455 | 2274 | |
| 2456 | 2275 | inv_pixel_color.i.a = 0xff - *blender1b_a[0]; |
| 2457 | 2276 | |
| 2458 | | BLENDER_EQUATION(&r, &g, &b, 0, special_bsel); |
| 2277 | BLENDER_EQUATION0(&r, &g, &b, special_bsel); |
| 2459 | 2278 | } |
| 2460 | 2279 | |
| 2461 | 2280 | return (FBWRITE_32(fb,r,g,b)); |
| 2462 | 2281 | } |
| 2463 | 2282 | |
| 2464 | | INLINE int BLENDER2_32(running_machine *machine, UINT32 *fb, COLOR c1, COLOR c2) |
| 2283 | INLINE int BLENDER2_32(UINT32 *fb, COLOR c1, COLOR c2) |
| 2465 | 2284 | { |
| 2466 | 2285 | UINT32 mem = *fb; |
| 2467 | 2286 | int r, g, b; |
| 2468 | 2287 | int special_bsel = 0; |
| 2469 | 2288 | |
| 2470 | 2289 | // Alpha compare |
| 2471 | | if (!alpha_compare(machine, c2.i.a)) |
| 2290 | if (!alpha_compare(c2.i.a)) |
| 2472 | 2291 | { |
| 2473 | 2292 | return 0; |
| 2474 | 2293 | } |
| r6714 | r6715 | |
| 2505 | 2324 | |
| 2506 | 2325 | inv_pixel_color.i.a = 0xff - *blender1b_a[0]; |
| 2507 | 2326 | |
| 2508 | | BLENDER_EQUATION(&r, &g, &b, 0, special_bsel); |
| 2327 | BLENDER_EQUATION0(&r, &g, &b, special_bsel); |
| 2509 | 2328 | |
| 2510 | 2329 | blended_pixel_color.i.r = r; |
| 2511 | 2330 | blended_pixel_color.i.g = g; |
| r6714 | r6715 | |
| 2534 | 2353 | |
| 2535 | 2354 | inv_pixel_color.i.a = 0xff - *blender1b_a[1]; |
| 2536 | 2355 | |
| 2537 | | BLENDER_EQUATION(&r, &g, &b, 1, special_bsel); |
| 2356 | BLENDER_EQUATION1(&r, &g, &b, special_bsel); |
| 2538 | 2357 | } |
| 2539 | 2358 | |
| 2540 | 2359 | return (FBWRITE_32(fb,r,g,b)); |
| 2541 | 2360 | } |
| 2542 | 2361 | |
| 2543 | | static void fill_rectangle_32bit(running_machine *machine, RECTANGLE *rect) |
| 2362 | static void fill_rectangle_32bit(RECTANGLE *rect) |
| 2544 | 2363 | { |
| 2545 | 2364 | UINT32 *fb = (UINT32*)&rdram[(fb_address / 4)]; |
| 2546 | 2365 | int index, i, j; |
| r6714 | r6715 | |
| 2605 | 2424 | for (i=x1; i <= x2; i++) |
| 2606 | 2425 | { |
| 2607 | 2426 | curpixel_cvg = fill_cvg; |
| 2608 | | c = COLOR_COMBINER1(machine); |
| 2609 | | BLENDER1_32(machine, &fb[(index + i)], c); |
| 2427 | COLOR_COMBINER1(&c); |
| 2428 | BLENDER1_32(&fb[(index + i)], c); |
| 2610 | 2429 | } |
| 2611 | 2430 | } |
| 2612 | 2431 | } |
| r6714 | r6715 | |
| 2619 | 2438 | for (i=x1; i <= x2; i++) |
| 2620 | 2439 | { |
| 2621 | 2440 | curpixel_cvg = fill_cvg; |
| 2622 | | c1 = COLOR_COMBINER2_C0(machine); |
| 2623 | | c2 = COLOR_COMBINER2_C1(machine); |
| 2624 | | BLENDER2_32(machine, &fb[(index + i)], c1, c2); |
| 2441 | COLOR_COMBINER2_C0(&c1); |
| 2442 | COLOR_COMBINER2_C1(&c2); |
| 2443 | BLENDER2_32(&fb[(index + i)], c1, c2); |
| 2625 | 2444 | } |
| 2626 | 2445 | } |
| 2627 | 2446 | } |
| r6714 | r6715 | |
| 2631 | 2450 | } |
| 2632 | 2451 | } |
| 2633 | 2452 | |
| 2634 | | INLINE void texture_rectangle_32bit(running_machine *machine, TEX_RECTANGLE *rect) |
| 2453 | INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect) |
| 2635 | 2454 | { // TODO: Z-compare and Z-update |
| 2636 | 2455 | UINT32 *fb = (UINT32*)&rdram[(fb_address / 4)]; |
| 2637 | 2456 | int i, j; |
| r6714 | r6715 | |
| 2711 | 2530 | TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile); |
| 2712 | 2531 | } |
| 2713 | 2532 | |
| 2714 | | c = COLOR_COMBINER1(machine); |
| 2533 | COLOR_COMBINER1(&c); |
| 2715 | 2534 | |
| 2716 | | BLENDER1_32(machine, &fb[(fb_index + i)], c); |
| 2535 | BLENDER1_32(&fb[(fb_index + i)], c); |
| 2717 | 2536 | |
| 2718 | 2537 | s += rect->dsdx; |
| 2719 | 2538 | } |
| r6714 | r6715 | |
| 2746 | 2565 | TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2); |
| 2747 | 2566 | } |
| 2748 | 2567 | |
| 2749 | | c1 = COLOR_COMBINER2_C0(machine); |
| 2750 | | c2 = COLOR_COMBINER2_C1(machine); |
| 2568 | COLOR_COMBINER2_C0(&c1); |
| 2569 | COLOR_COMBINER2_C1(&c2); |
| 2751 | 2570 | |
| 2752 | | BLENDER2_32(machine, &fb[(fb_index + i)], c1, c2); |
| 2571 | BLENDER2_32(&fb[(fb_index + i)], c1, c2); |
| 2753 | 2572 | |
| 2754 | 2573 | s += rect->dsdx; |
| 2755 | 2574 | } |
| r6714 | r6715 | |
| 2793 | 2612 | } |
| 2794 | 2613 | |
| 2795 | 2614 | |
| 2796 | | static void render_spans_32(running_machine *machine, int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip) |
| 2615 | static void render_spans_32(int start, int end, TILE* tex_tile, int shade, int texture, int zbuffer, int flip) |
| 2797 | 2616 | { |
| 2798 | 2617 | UINT32 *fb = (UINT32*)&rdram[fb_address / 4]; |
| 2799 | 2618 | UINT16 *zb = (UINT16*)&rdram[zb_address / 4]; |
| r6714 | r6715 | |
| 2871 | 2690 | dtinc = flip ? (dt.w) : -dt.w; |
| 2872 | 2691 | dwinc = flip ? (dw.w) : -dw.w; |
| 2873 | 2692 | |
| 2874 | | set_shade_for_tris(shade); |
| 2693 | if(!shade) |
| 2694 | { |
| 2695 | shade_color.c = prim_color.c; |
| 2696 | } |
| 2875 | 2697 | |
| 2876 | 2698 | for (i = start; i <= end; i++) |
| 2877 | 2699 | { |
| r6714 | r6715 | |
| 2973 | 2795 | |
| 2974 | 2796 | if (other_modes.cycle_type == CYCLE_TYPE_1) |
| 2975 | 2797 | { |
| 2976 | | c1 = COLOR_COMBINER1(machine); |
| 2798 | COLOR_COMBINER1(&c1); |
| 2977 | 2799 | } |
| 2978 | 2800 | else if (other_modes.cycle_type == CYCLE_TYPE_2) |
| 2979 | 2801 | { |
| 2980 | | c1 = COLOR_COMBINER2_C0(machine); |
| 2981 | | c2 = COLOR_COMBINER2_C1(machine); |
| 2802 | COLOR_COMBINER2_C0(&c1); |
| 2803 | COLOR_COMBINER2_C1(&c2); |
| 2982 | 2804 | } |
| 2983 | 2805 | |
| 2984 | 2806 | if ((zbuffer || other_modes.z_source_sel) && other_modes.z_compare_en) |
| r6714 | r6715 | |
| 2992 | 2814 | |
| 2993 | 2815 | if (other_modes.cycle_type == CYCLE_TYPE_1) |
| 2994 | 2816 | { |
| 2995 | | rendered = BLENDER1_32(machine, fbcur, c1); |
| 2817 | rendered = BLENDER1_32(fbcur, c1); |
| 2996 | 2818 | } |
| 2997 | 2819 | else |
| 2998 | 2820 | { |
| 2999 | | rendered = BLENDER2_32(machine, fbcur, c1, c2); |
| 2821 | rendered = BLENDER2_32(fbcur, c1, c2); |
| 3000 | 2822 | } |
| 3001 | 2823 | |
| 3002 | 2824 | if (other_modes.z_update_en && rendered) |
| r6714 | r6715 | |
| 3023 | 2845 | |
| 3024 | 2846 | /*****************************************************************************/ |
| 3025 | 2847 | |
| 3026 | | #include "rdpspn16.c" |
| 3027 | | |
| 3028 | | //#include "rdptri.c" |
| 3029 | | |
| 3030 | | static void triangle(running_machine *machine, UINT32 w1, UINT32 w2, int shade, int texture, int zbuffer) |
| 2848 | /* |
| 2849 | static void triangle(UINT32 w1, UINT32 w2, int shade, int texture, int zbuffer) |
| 3031 | 2850 | { |
| 3032 | 2851 | int j; |
| 3033 | 2852 | int xleft, xright, xleft_inc, xright_inc; |
| r6714 | r6715 | |
| 3473 | 3292 | |
| 3474 | 3293 | switch (fb_size) // 8bpp needs to be implemented |
| 3475 | 3294 | { |
| 3476 | | case PIXEL_SIZE_16BIT: render_spans_16(machine, yh>>2, yl>>2, &tile[tilenum], shade, texture, zbuffer, flip); break; |
| 3477 | | case PIXEL_SIZE_32BIT: render_spans_32(machine, yh>>2, yl>>2, &tile[tilenum], shade, texture, zbuffer, flip); break; |
| 3295 | case PIXEL_SIZE_16BIT: render_spans_16(yh>>2, yl>>2, &tile[tilenum], shade, texture, zbuffer, flip); break; |
| 3296 | case PIXEL_SIZE_32BIT: render_spans_32(yh>>2, yl>>2, &tile[tilenum], shade, texture, zbuffer, flip); break; |
| 3478 | 3297 | default: break; // V-Rally2 does this, fb_size=0 |
| 3479 | 3298 | } |
| 3480 | 3299 | } |
| 3300 | */ |
| 3481 | 3301 | |
| 3482 | 3302 | /*****************************************************************************/ |
| 3483 | 3303 | |
| r6714 | r6715 | |
| 3892 | 3712 | |
| 3893 | 3713 | static RDP_COMMAND( rdp_tri_noshade ) |
| 3894 | 3714 | { |
| 3895 | | triangle(machine, w1, w2, 0, 0, 0); |
| 3715 | triangle_ns_nt_nz(w1, w2); |
| 3896 | 3716 | } |
| 3897 | 3717 | |
| 3898 | 3718 | static RDP_COMMAND( rdp_tri_noshade_z ) |
| 3899 | 3719 | { |
| 3900 | | triangle(machine, w1, w2, 0, 0, 1); |
| 3720 | triangle_ns_nt_z(w1, w2); |
| 3901 | 3721 | } |
| 3902 | 3722 | |
| 3903 | 3723 | static RDP_COMMAND( rdp_tri_tex ) |
| 3904 | 3724 | { |
| 3905 | | triangle(machine, w1, w2, 0, 1, 0); |
| 3725 | triangle_ns_t_nz(w1, w2); |
| 3906 | 3726 | } |
| 3907 | 3727 | |
| 3908 | 3728 | static RDP_COMMAND( rdp_tri_tex_z ) |
| 3909 | 3729 | { |
| 3910 | | triangle(machine, w1, w2, 0, 1, 1); |
| 3730 | triangle_ns_t_z(w1, w2); |
| 3911 | 3731 | } |
| 3912 | 3732 | |
| 3913 | 3733 | static RDP_COMMAND( rdp_tri_shade ) |
| 3914 | 3734 | { |
| 3915 | | triangle(machine, w1, w2, 1, 0, 0); |
| 3735 | triangle_s_nt_nz(w1, w2); |
| 3916 | 3736 | } |
| 3917 | 3737 | |
| 3918 | 3738 | static RDP_COMMAND( rdp_tri_shade_z ) |
| 3919 | 3739 | { |
| 3920 | | triangle(machine, w1, w2, 1, 0, 1); |
| 3740 | triangle_s_nt_z(w1, w2); |
| 3921 | 3741 | } |
| 3922 | 3742 | |
| 3923 | 3743 | static RDP_COMMAND( rdp_tri_texshade ) |
| 3924 | 3744 | { |
| 3925 | | triangle(machine, w1, w2, 1, 1, 0); |
| 3745 | triangle_s_t_nz(w1, w2); |
| 3926 | 3746 | } |
| 3927 | 3747 | |
| 3928 | 3748 | static RDP_COMMAND( rdp_tri_texshade_z ) |
| 3929 | 3749 | { |
| 3930 | | triangle(machine, w1, w2, 1, 1, 1); |
| 3750 | triangle_s_t_z(w1, w2); |
| 3931 | 3751 | } |
| 3932 | 3752 | |
| 3933 | 3753 | static RDP_COMMAND( rdp_tex_rect ) |
| r6714 | r6715 | |
| 3951 | 3771 | |
| 3952 | 3772 | switch (fb_size) |
| 3953 | 3773 | { |
| 3954 | | case PIXEL_SIZE_16BIT: texture_rectangle_16bit(machine, &rect); break; |
| 3955 | | case PIXEL_SIZE_32BIT: texture_rectangle_32bit(machine, &rect); break; |
| 3774 | case PIXEL_SIZE_16BIT: texture_rectangle_16bit(&rect); break; |
| 3775 | case PIXEL_SIZE_32BIT: texture_rectangle_32bit(&rect); break; |
| 3956 | 3776 | } |
| 3957 | 3777 | } |
| 3958 | 3778 | |
| r6714 | r6715 | |
| 3977 | 3797 | |
| 3978 | 3798 | switch (fb_size) |
| 3979 | 3799 | { |
| 3980 | | case PIXEL_SIZE_16BIT: texture_rectangle_16bit(machine, &rect); break; |
| 3981 | | case PIXEL_SIZE_32BIT: texture_rectangle_32bit(machine, &rect); break; |
| 3800 | case PIXEL_SIZE_16BIT: texture_rectangle_16bit(&rect); break; |
| 3801 | case PIXEL_SIZE_32BIT: texture_rectangle_32bit(&rect); break; |
| 3982 | 3802 | } |
| 3983 | 3803 | } |
| 3984 | 3804 | |
| r6714 | r6715 | |
| 4092 | 3912 | |
| 4093 | 3913 | alpha_compare = rdp_alpha_compare_func[(other_modes.alpha_compare_en << 1) | other_modes.dither_alpha_en]; |
| 4094 | 3914 | |
| 4095 | | render_spans_16 = rdp_render_spans_16_func[(other_modes.cycle_type)]; |
| 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))]; |
| 4096 | 3931 | |
| 4097 | 3932 | TEXTURE_PIPELINE = rdp_texture_pipeline_func[(other_modes.mid_texel << 1) | other_modes.sample_type]; |
| 4098 | 3933 | |
| 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 | |
| 4099 | 3937 | for(index = 0; index < 8; index++) |
| 4100 | 3938 | { |
| 4101 | 3939 | tile[index].fetch_index = (tile[index].size << 5) | (tile[index].format << 2) | (other_modes.en_tlut << 1) | other_modes.tlut_type; |
| 4102 | 3940 | } |
| 4103 | 3941 | |
| 4104 | | FBWRITE_16 = rdp_fbwrite_16_func[(other_modes.image_read_en << 2) | other_modes.cvg_dest]; |
| 4105 | | FBWRITE_32 = rdp_fbwrite_32_func[(other_modes.image_read_en << 2) | other_modes.cvg_dest]; |
| 3942 | FBWRITE_16 = rdp_fbwrite_16_func[(other_modes.color_on_cvg << 3) | (other_modes.image_read_en << 2) | other_modes.cvg_dest]; |
| 3943 | FBWRITE_32 = rdp_fbwrite_32_func[(other_modes.color_on_cvg << 3) | (other_modes.image_read_en << 2) | other_modes.cvg_dest]; |
| 4106 | 3944 | |
| 4107 | | BLENDER_EQUATION = other_modes.force_blend ? BLENDER_EQUATION_FORCE : BLENDER_EQUATION_NFORCE; |
| 3945 | BLENDER_EQUATION0 = other_modes.force_blend ? BLENDER_EQUATION0_FORCE : BLENDER_EQUATION0_NFORCE; |
| 3946 | BLENDER_EQUATION1 = other_modes.force_blend ? BLENDER_EQUATION1_FORCE : BLENDER_EQUATION1_NFORCE; |
| 4108 | 3947 | |
| 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)]; |
| 3950 | |
| 4109 | 3951 | SET_BLENDER_INPUT(0, 0, &blender1a_r[0], &blender1a_g[0], &blender1a_b[0], &blender1b_a[0], |
| 4110 | 3952 | other_modes.blend_m1a_0, other_modes.blend_m1b_0); |
| 4111 | 3953 | SET_BLENDER_INPUT(0, 1, &blender2a_r[0], &blender2a_g[0], &blender2a_b[0], &blender2b_a[0], |
| r6714 | r6715 | |
| 4468 | 4310 | |
| 4469 | 4311 | switch (fb_size) |
| 4470 | 4312 | { |
| 4471 | | case PIXEL_SIZE_16BIT: fill_rectangle_16bit(machine, &rect); break; |
| 4472 | | case PIXEL_SIZE_32BIT: fill_rectangle_32bit(machine, &rect); break; |
| 4313 | case PIXEL_SIZE_16BIT: fill_rectangle_16bit(&rect); break; |
| 4314 | case PIXEL_SIZE_32BIT: fill_rectangle_32bit(&rect); break; |
| 4473 | 4315 | } |
| 4474 | 4316 | } |
| 4475 | 4317 | |
| r6714 | r6715 | |
| 4679 | 4521 | dp_start = dp_current = dp_end; |
| 4680 | 4522 | } |
| 4681 | 4523 | |
| 4682 | | #include "rdpacomp.c" |
| 4683 | | #include "rdpacvg.c" |
| 4684 | | |
| 4685 | | INLINE UINT8 COMBINER_EQUATION(UINT8 A, UINT8 B, UINT8 C, UINT8 D) |
| 4524 | INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D) |
| 4686 | 4525 | { |
| 4687 | | INT32 color = (((A-B)* C) + (D << 8) + 0x80); |
| 4526 | INT32 color = (((*A-*B)* *C) + (*D << 8) + 0x80); |
| 4688 | 4527 | color >>= 8; |
| 4689 | 4528 | if (color > 255) |
| 4690 | 4529 | { |
| 4691 | | return 255; |
| 4530 | *out = 255; |
| 4692 | 4531 | } |
| 4693 | | if (color < 0) |
| 4532 | else if (color < 0) |
| 4694 | 4533 | { |
| 4695 | | return 0; |
| 4534 | *out = 0; |
| 4696 | 4535 | } |
| 4697 | | return (UINT8)color; |
| 4536 | else |
| 4537 | { |
| 4538 | *out = (UINT8)color; |
| 4539 | } |
| 4698 | 4540 | } |
| 4699 | 4541 | |
| 4700 | | INLINE void BLENDER_EQUATION_FORCE(INT32* r, INT32* g, INT32* b, int cycle, int bsel_special) |
| 4542 | INLINE void BLENDER_EQUATION0_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special) |
| 4701 | 4543 | { |
| 4702 | 4544 | UINT8 blend1a, blend2a; |
| 4703 | 4545 | UINT32 sum = 0; |
| 4704 | | blend1a = *blender1b_a[cycle]; |
| 4705 | | blend2a = *blender2b_a[cycle]; |
| 4546 | INT32 tr, tg, tb; |
| 4547 | blend1a = *blender1b_a[0]; |
| 4548 | blend2a = *blender2b_a[0]; |
| 4706 | 4549 | if (bsel_special) |
| 4707 | 4550 | { |
| 4708 | 4551 | blend1a &= 0xe0; |
| r6714 | r6715 | |
| 4710 | 4553 | |
| 4711 | 4554 | sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5; |
| 4712 | 4555 | |
| 4713 | | *r = (((int)(*blender1a_r[cycle]) * (int)(blend1a))) + |
| 4714 | | (((int)(*blender2a_r[cycle]) * (int)(blend2a))); |
| 4715 | | *r += (bsel_special) ? (((int)(*blender2a_r[cycle])) << 5) : (((int)(*blender2a_r[cycle])) << 3); |
| 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); |
| 4716 | 4559 | |
| 4717 | | *g = (((int)(*blender1a_g[cycle]) * (int)(blend1a))) + |
| 4718 | | (((int)(*blender2a_g[cycle]) * (int)(blend2a))); |
| 4719 | | *g += (bsel_special) ? ((int)((*blender2a_g[cycle])) << 5) : (((int)(*blender2a_g[cycle])) << 3); |
| 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); |
| 4720 | 4563 | |
| 4721 | | *b = (((int)(*blender1a_b[cycle]) * (int)(blend1a))) + |
| 4722 | | (((int)(*blender2a_b[cycle]) * (int)(blend2a))); |
| 4723 | | *b += (bsel_special) ? (((int)(*blender2a_b[cycle])) << 5) : (((int)(*blender2a_b[cycle])) << 3); |
| 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); |
| 4724 | 4567 | |
| 4725 | | *r >>= 8; |
| 4726 | | *g >>= 8; |
| 4727 | | *b >>= 8; |
| 4568 | tr >>= 8; |
| 4569 | tg >>= 8; |
| 4570 | tb >>= 8; |
| 4728 | 4571 | |
| 4729 | | |
| 4730 | | if (*r > 255) *r = 255; |
| 4731 | | if (*g > 255) *g = 255; |
| 4732 | | if (*b > 255) *b = 255; |
| 4572 | if (tr > 255) *r = 255; else *r = tr; |
| 4573 | if (tg > 255) *g = 255; else *g = tg; |
| 4574 | if (tb > 255) *b = 255; else *b = tb; |
| 4733 | 4575 | } |
| 4734 | 4576 | |
| 4735 | | INLINE void BLENDER_EQUATION_NFORCE(INT32* r, INT32* g, INT32* b, int cycle, int bsel_special) |
| 4577 | INLINE void BLENDER_EQUATION0_NFORCE(INT32* r, INT32* g, INT32* b, int bsel_special) |
| 4736 | 4578 | { |
| 4737 | 4579 | UINT8 blend1a, blend2a; |
| 4738 | 4580 | UINT32 sum = 0; |
| 4739 | | blend1a = *blender1b_a[cycle]; |
| 4740 | | blend2a = *blender2b_a[cycle]; |
| 4581 | INT32 tr, tg, tb; |
| 4582 | blend1a = *blender1b_a[0]; |
| 4583 | blend2a = *blender2b_a[0]; |
| 4741 | 4584 | if (bsel_special) |
| 4742 | 4585 | { |
| 4743 | 4586 | blend1a &= 0xe0; |
| r6714 | r6715 | |
| 4745 | 4588 | |
| 4746 | 4589 | sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5; |
| 4747 | 4590 | |
| 4748 | | *r = (((int)(*blender1a_r[cycle]) * (int)(blend1a))) + |
| 4749 | | (((int)(*blender2a_r[cycle]) * (int)(blend2a))); |
| 4750 | | *r += (bsel_special) ? (((int)(*blender2a_r[cycle])) << 5) : (((int)(*blender2a_r[cycle])) << 3); |
| 4591 | tr = (((int)(*blender1a_r[0]) * (int)(blend1a))) + |
| 4592 | (((int)(*blender2a_r[0]) * (int)(blend2a))); |
| 4593 | tr += (bsel_special) ? (((int)(*blender2a_r[0])) << 5) : (((int)(*blender2a_r[0])) << 3); |
| 4751 | 4594 | |
| 4752 | | *g = (((int)(*blender1a_g[cycle]) * (int)(blend1a))) + |
| 4753 | | (((int)(*blender2a_g[cycle]) * (int)(blend2a))); |
| 4754 | | *g += (bsel_special) ? ((int)((*blender2a_g[cycle])) << 5) : (((int)(*blender2a_g[cycle])) << 3); |
| 4595 | tg = (((int)(*blender1a_g[0]) * (int)(blend1a))) + |
| 4596 | (((int)(*blender2a_g[0]) * (int)(blend2a))); |
| 4597 | tg += (bsel_special) ? ((int)((*blender2a_g[0])) << 5) : (((int)(*blender2a_g[0])) << 3); |
| 4755 | 4598 | |
| 4756 | | *b = (((int)(*blender1a_b[cycle]) * (int)(blend1a))) + |
| 4757 | | (((int)(*blender2a_b[cycle]) * (int)(blend2a))); |
| 4758 | | *b += (bsel_special) ? (((int)(*blender2a_b[cycle])) << 5) : (((int)(*blender2a_b[cycle])) << 3); |
| 4599 | tb = (((int)(*blender1a_b[0]) * (int)(blend1a))) + |
| 4600 | (((int)(*blender2a_b[0]) * (int)(blend2a))); |
| 4601 | tb += (bsel_special) ? (((int)(*blender2a_b[0])) << 5) : (((int)(*blender2a_b[0])) << 3); |
| 4759 | 4602 | |
| 4760 | 4603 | if (sum) |
| 4761 | 4604 | { |
| 4762 | | *r /= sum; |
| 4763 | | *g /= sum; |
| 4764 | | *b /= sum; |
| 4605 | tr /= sum; |
| 4606 | tg /= sum; |
| 4607 | tb /= sum; |
| 4765 | 4608 | } |
| 4766 | 4609 | else |
| 4767 | 4610 | { |
| 4768 | 4611 | *r = *g = *b = 0xff; |
| 4612 | return; |
| 4769 | 4613 | } |
| 4770 | 4614 | |
| 4771 | 4615 | |
| 4772 | | if (*r > 255) *r = 255; |
| 4773 | | if (*g > 255) *g = 255; |
| 4774 | | if (*b > 255) *b = 255; |
| 4616 | if (tr > 255) *r = 255; else *r = tr; |
| 4617 | if (tg > 255) *g = 255; else *g = tg; |
| 4618 | if (tb > 255) *b = 255; else *b = tb; |
| 4775 | 4619 | } |
| 4776 | 4620 | |
| 4621 | INLINE void BLENDER_EQUATION1_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special) |
| 4622 | { |
| 4623 | UINT8 blend1a, blend2a; |
| 4624 | UINT32 sum = 0; |
| 4625 | INT32 tr, tg, tb; |
| 4626 | blend1a = *blender1b_a[1]; |
| 4627 | blend2a = *blender2b_a[1]; |
| 4628 | if (bsel_special) |
| 4629 | { |
| 4630 | blend1a &= 0xe0; |
| 4631 | } |
| 4632 | |
| 4633 | sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5; |
| 4634 | |
| 4635 | tr = (((int)(*blender1a_r[1]) * (int)(blend1a))) + |
| 4636 | (((int)(*blender2a_r[1]) * (int)(blend2a))); |
| 4637 | tr += (bsel_special) ? (((int)(*blender2a_r[1])) << 5) : (((int)(*blender2a_r[1])) << 3); |
| 4638 | |
| 4639 | tg = (((int)(*blender1a_g[1]) * (int)(blend1a))) + |
| 4640 | (((int)(*blender2a_g[1]) * (int)(blend2a))); |
| 4641 | tg += (bsel_special) ? ((int)((*blender2a_g[1])) << 5) : (((int)(*blender2a_g[1])) << 3); |
| 4642 | |
| 4643 | tb = (((int)(*blender1a_b[1]) * (int)(blend1a))) + |
| 4644 | (((int)(*blender2a_b[1]) * (int)(blend2a))); |
| 4645 | tb += (bsel_special) ? (((int)(*blender2a_b[1])) << 5) : (((int)(*blender2a_b[1])) << 3); |
| 4646 | |
| 4647 | tr >>= 8; |
| 4648 | tg >>= 8; |
| 4649 | tb >>= 8; |
| 4650 | |
| 4651 | if (tr > 255) *r = 255; else *r = tr; |
| 4652 | if (tg > 255) *g = 255; else *g = tg; |
| 4653 | if (tb > 255) *b = 255; else *b = tb; |
| 4654 | } |
| 4655 | |
| 4656 | INLINE void BLENDER_EQUATION1_NFORCE(INT32* r, INT32* g, INT32* b, int bsel_special) |
| 4657 | { |
| 4658 | UINT8 blend1a, blend2a; |
| 4659 | UINT32 sum = 0; |
| 4660 | INT32 tr, tg, tb; |
| 4661 | blend1a = *blender1b_a[1]; |
| 4662 | blend2a = *blender2b_a[1]; |
| 4663 | if (bsel_special) |
| 4664 | { |
| 4665 | blend1a &= 0xe0; |
| 4666 | } |
| 4667 | |
| 4668 | sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5; |
| 4669 | |
| 4670 | tr = (((int)(*blender1a_r[1]) * (int)(blend1a))) + |
| 4671 | (((int)(*blender2a_r[1]) * (int)(blend2a))); |
| 4672 | tr += (bsel_special) ? (((int)(*blender2a_r[1])) << 5) : (((int)(*blender2a_r[1])) << 3); |
| 4673 | |
| 4674 | tg = (((int)(*blender1a_g[1]) * (int)(blend1a))) + |
| 4675 | (((int)(*blender2a_g[1]) * (int)(blend2a))); |
| 4676 | tg += (bsel_special) ? ((int)((*blender2a_g[1])) << 5) : (((int)(*blender2a_g[1])) << 3); |
| 4677 | |
| 4678 | tb = (((int)(*blender1a_b[1]) * (int)(blend1a))) + |
| 4679 | (((int)(*blender2a_b[1]) * (int)(blend2a))); |
| 4680 | tb += (bsel_special) ? (((int)(*blender2a_b[1])) << 5) : (((int)(*blender2a_b[1])) << 3); |
| 4681 | |
| 4682 | if (sum) |
| 4683 | { |
| 4684 | tr /= sum; |
| 4685 | tg /= sum; |
| 4686 | tb /= sum; |
| 4687 | } |
| 4688 | else |
| 4689 | { |
| 4690 | *r = *g = *b = 0xff; |
| 4691 | return; |
| 4692 | } |
| 4693 | |
| 4694 | if (tr > 255) *r = 255; else *r = tr; |
| 4695 | if (tg > 255) *g = 255; else *g = tg; |
| 4696 | if (tb > 255) *b = 255; else *b = tb; |
| 4697 | } |
| 4698 | |
| 4777 | 4699 | INLINE UINT32 addrightcvg(UINT32 x, UINT32 k) |
| 4778 | 4700 | { |
| 4779 | 4701 | //#undef FULL_SUBPIXELS |
| r6714 | r6715 | |
| 4860 | 4782 | } |
| 4861 | 4783 | } |
| 4862 | 4784 | |
| 4863 | | #include "video/rdpfb.c" |
| 4785 | #include "video/rdpacomp.c" |
| 4786 | |
| 4787 | #include "video/rdpacvg.c" |
| 4788 | |
| 4789 | #define COLOR_ON_CVG |
| 4790 | #include "video/rdpfb.c" |
| 4791 | #undef COLOR_ON_CVG |
| 4792 | #include "video/rdpfb.c" |
| 4793 | |
| 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" |
| 4816 | |
| 4817 | #include "video/rdpfetch.c" |
| 4818 | |
| 4819 | #include "video/rdptpipe.c" |
| 4820 | |
| 4821 | #define ZCOMPARE |
| 4822 | #define ZUPDATE |
| 4823 | #define MAGICDITHER |
| 4824 | #include "video/rdptrect.c" |
| 4825 | #undef MAGICDITHER |
| 4826 | #define BAYERDITHER |
| 4827 | #include "video/rdptrect.c" |
| 4828 | #undef BAYERDITHER |
| 4829 | #include "video/rdptrect.c" |
| 4830 | #undef ZUPDATE |
| 4831 | #define MAGICDITHER |
| 4832 | #include "video/rdptrect.c" |
| 4833 | #undef MAGICDITHER |
| 4834 | #define BAYERDITHER |
| 4835 | #include "video/rdptrect.c" |
| 4836 | #undef BAYERDITHER |
| 4837 | #include "video/rdptrect.c" |
| 4838 | #undef ZCOMPARE |
| 4839 | #define ZUPDATE |
| 4840 | #define MAGICDITHER |
| 4841 | #include "video/rdptrect.c" |
| 4842 | #undef MAGICDITHER |
| 4843 | #define BAYERDITHER |
| 4844 | #include "video/rdptrect.c" |
| 4845 | #undef BAYERDITHER |
| 4846 | #include "video/rdptrect.c" |
| 4847 | #undef ZUPDATE |
| 4848 | #define MAGICDITHER |
| 4849 | #include "video/rdptrect.c" |
| 4850 | #undef MAGICDITHER |
| 4851 | #define BAYERDITHER |
| 4852 | #include "video/rdptrect.c" |
| 4853 | #undef BAYERDITHER |
| 4854 | #include "video/rdptrect.c" |
| 4855 | |
| 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" |
| 5046 | #include "video/rdptri.c" |
| 5047 | |