src/mame/video/n64.c
| r6383 | r6384 | |
| 3 | 3 | |
| 4 | 4 | Initial version by Ville Linde |
| 5 | 5 | Many improvements by Harmony |
| 6 | | Many improvements by angrylion, Gonetz, Orkin |
| 6 | Many improvements by angrylion, Ziggy, Gonetz, Orkin |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <math.h> |
| r6383 | r6384 | |
| 12 | 12 | |
| 13 | 13 | #define LOG_RDP_EXECUTION 0 |
| 14 | 14 | |
| 15 | #define STRICT_ERROR (0) |
| 16 | |
| 17 | #if STRICT_ERROR |
| 18 | #define stricterror fatalerror |
| 19 | #else |
| 20 | #define stricterror(...) |
| 21 | #endif |
| 22 | |
| 15 | 23 | static FILE *rdp_exec; |
| 16 | 24 | |
| 17 | 25 | static UINT32 rdp_cmd_data[0x1000]; |
| r6383 | r6384 | |
| 3232 | 3240 | |
| 3233 | 3241 | if (x2 < x1) |
| 3234 | 3242 | { |
| 3235 | | fatalerror(" SCARS (E) case: fill_rectangle_32bit"); |
| 3243 | stricterror ("SCARS (E) case: fill_rectangle_32bit"); |
| 3236 | 3244 | } |
| 3237 | 3245 | |
| 3238 | 3246 | // TODO: clip |
| r6383 | r6384 | |
| 3330 | 3338 | |
| 3331 | 3339 | if (x2 < x1) |
| 3332 | 3340 | { |
| 3333 | | fatalerror( "x2 < x1: texture_rectangle_32bit" ); |
| 3341 | stricterror( "x2 < x1: texture_rectangle_32bit" ); |
| 3334 | 3342 | } |
| 3335 | 3343 | |
| 3336 | 3344 | if (other_modes.cycle_type == CYCLE_TYPE_FILL || other_modes.cycle_type == CYCLE_TYPE_COPY) |
| r6383 | r6384 | |
| 3501 | 3509 | |
| 3502 | 3510 | if (other_modes.key_en) |
| 3503 | 3511 | { |
| 3504 | | fatalerror( "render_spans_32: key_en" ); |
| 3512 | stricterror( "render_spans_32: key_en" ); |
| 3505 | 3513 | } |
| 3506 | 3514 | |
| 3507 | 3515 | if (other_modes.cycle_type == CYCLE_TYPE_2 && texture) |
| r6383 | r6384 | |
| 3587 | 3595 | curpixel_cvg = span[i].cvg[x]; |
| 3588 | 3596 | if (curpixel_cvg > 8) |
| 3589 | 3597 | { |
| 3590 | | fatalerror("render_spans_32: curpixel_cvg = %d", curpixel_cvg); |
| 3598 | stricterror("render_spans_32: curpixel_cvg = %d", curpixel_cvg); |
| 3591 | 3599 | } |
| 3592 | 3600 | if (curpixel_cvg) |
| 3593 | 3601 | { |
| r6383 | r6384 | |
| 3840 | 3848 | |
| 3841 | 3849 | if (curpixel_cvg > 8) |
| 3842 | 3850 | { |
| 3843 | | fatalerror("render_spans_16: cvg of current pixel is %d", curpixel_cvg); |
| 3851 | stricterror("render_spans_16: cvg of current pixel is %d", curpixel_cvg); |
| 3844 | 3852 | } |
| 3845 | 3853 | |
| 3846 | 3854 | if (curpixel_cvg) |
| r6383 | r6384 | |
| 5124 | 5132 | static RDP_COMMAND( rdp_load_tlut ) |
| 5125 | 5133 | { |
| 5126 | 5134 | int i; |
| 5127 | | UINT16 sl, sh; |
| 5135 | int tl, th, sl, sh; |
| 5136 | int tilenum = (w2 >> 24) & 7; |
| 5128 | 5137 | |
| 5129 | | sl = ((w1 >> 12) & 0xfff) / 4; |
| 5130 | | sh = ((w2 >> 12) & 0xfff) / 4; |
| 5138 | sl = tile[tilenum].sl = ((w1 >> 12) & 0xfff); |
| 5139 | tl = tile[tilenum].tl = w1 & 0xfff; |
| 5140 | sh = tile[tilenum].sh = ((w2 >> 12) & 0xfff); |
| 5141 | th = tile[tilenum].th = w2 & 0xfff; |
| 5131 | 5142 | |
| 5132 | 5143 | switch (ti_format) |
| 5133 | 5144 | { |
| r6383 | r6384 | |
| 5137 | 5148 | { |
| 5138 | 5149 | case PIXEL_SIZE_16BIT: |
| 5139 | 5150 | { |
| 5140 | | UINT16 *src = (UINT16*)&rdram[ti_address / 4]; |
| 5151 | UINT16 *src = (UINT16*)&rdram[(ti_address + (tl >> 2) * (ti_width << 1) + (sl >> 1)) >> 2]; |
| 5141 | 5152 | |
| 5142 | | for (i=sl; i <= sh; i++) |
| 5153 | for (i = (sl >> 2); i <= (sh >> 2); i++) |
| 5143 | 5154 | { |
| 5144 | 5155 | tlut[i] = src[i]; |
| 5145 | 5156 | } |
| r6383 | r6384 | |
| 5152 | 5163 | |
| 5153 | 5164 | default: fatalerror("RDP: load_tlut: format = %d\n", ti_format); |
| 5154 | 5165 | } |
| 5155 | | |
| 5156 | 5166 | } |
| 5157 | 5167 | |
| 5158 | 5168 | static RDP_COMMAND( rdp_set_tile_size ) |