summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes12
-rw-r--r--src/mame/video/n64.c2102
-rw-r--r--src/mame/video/rdpacomp.c6
-rw-r--r--src/mame/video/rdpacvg.c11
-rw-r--r--src/mame/video/rdpblend.c361
-rw-r--r--src/mame/video/rdpblend.h110
-rw-r--r--src/mame/video/rdpcc.c81
-rw-r--r--src/mame/video/rdpcc.h6
-rw-r--r--src/mame/video/rdpclamp.c162
-rw-r--r--src/mame/video/rdpclamp.h36
-rw-r--r--src/mame/video/rdpfetch.c416
-rw-r--r--src/mame/video/rdpfetch.h118
-rw-r--r--src/mame/video/rdpfrect.c325
-rw-r--r--src/mame/video/rdpfrect.h16
-rw-r--r--src/mame/video/rdpmask.c48
-rw-r--r--src/mame/video/rdpmask.h9
-rw-r--r--src/mame/video/rdpshift.c41
-rw-r--r--src/mame/video/rdpshift.h9
-rw-r--r--src/mame/video/rdpspn16.c1765
-rw-r--r--src/mame/video/rdpspn16.h868
-rw-r--r--src/mame/video/rdptpipe.c329
-rw-r--r--src/mame/video/rdptpipe.h18
-rw-r--r--src/mame/video/rdptrect.c145
-rw-r--r--src/mame/video/rdptrect.h34
-rw-r--r--src/mame/video/rdptri.c236
-rw-r--r--src/mame/video/rdpupd16.c24
-rw-r--r--src/mame/video/rdpzcomp.c168
-rw-r--r--src/mame/video/rdpzcomp.h24
28 files changed, 5260 insertions, 2220 deletions
diff --git a/.gitattributes b/.gitattributes
index 485306d05cc..481bc20fd73 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3564,10 +3564,20 @@ src/mame/video/rdpacvg.c svneol=native#text/plain
src/mame/video/rdpacvg.h svneol=native#text/plain
src/mame/video/rdpblend.c svneol=native#text/plain
src/mame/video/rdpblend.h svneol=native#text/plain
+src/mame/video/rdpcc.c svneol=native#text/plain
+src/mame/video/rdpcc.h svneol=native#text/plain
+src/mame/video/rdpclamp.c svneol=native#text/plain
+src/mame/video/rdpclamp.h svneol=native#text/plain
src/mame/video/rdpfb.c svneol=native#text/plain
src/mame/video/rdpfb.h svneol=native#text/plain
src/mame/video/rdpfetch.c svneol=native#text/plain
src/mame/video/rdpfetch.h svneol=native#text/plain
+src/mame/video/rdpfrect.c svneol=native#text/plain
+src/mame/video/rdpfrect.h svneol=native#text/plain
+src/mame/video/rdpmask.c svneol=native#text/plain
+src/mame/video/rdpmask.h svneol=native#text/plain
+src/mame/video/rdpshift.c svneol=native#text/plain
+src/mame/video/rdpshift.h svneol=native#text/plain
src/mame/video/rdpspn16.c svneol=native#text/plain
src/mame/video/rdpspn16.h svneol=native#text/plain
src/mame/video/rdptpipe.c svneol=native#text/plain
@@ -3578,6 +3588,8 @@ src/mame/video/rdptri.c svneol=native#text/plain
src/mame/video/rdptri.h svneol=native#text/plain
src/mame/video/rdpupd16.c svneol=native#text/plain
src/mame/video/rdpupd16.h svneol=native#text/plain
+src/mame/video/rdpzcomp.c svneol=native#text/plain
+src/mame/video/rdpzcomp.h svneol=native#text/plain
src/mame/video/realbrk.c svneol=native#text/plain
src/mame/video/redalert.c svneol=native#text/plain
src/mame/video/redclash.c svneol=native#text/plain
diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c
index 5928a3058c3..5b37dd49dce 100644
--- a/src/mame/video/n64.c
+++ b/src/mame/video/n64.c
@@ -10,15 +10,7 @@
#include "driver.h"
#include "includes/n64.h"
-#define LOG_RDP_EXECUTION 0
-
-#define STRICT_ERROR (0)
-
-#if STRICT_ERROR
-#define stricterror fatalerror
-#else
-#define stricterror(...)
-#endif
+#define LOG_RDP_EXECUTION 0
static FILE *rdp_exec;
@@ -71,8 +63,6 @@ typedef struct
int dzpix;
} SPAN;
-//UINT8 cvg_mem[8*1048576];
-
static SPAN span[4096];
/*****************************************************************************/
@@ -198,6 +188,12 @@ typedef struct
#define SAMPLE_TYPE_1x1 0
#define SAMPLE_TYPE_2x2 1
+static UINT16 cc_lut1[(1<<24)];
+static UINT8 cc_lut2[(1<<24)];
+static UINT32 rgb16_to_32_lut[(1<<16)];
+static UINT32 ia8_to_32_lut[(1<<16)];
+static UINT32 tex_lerp_lut[(1<<21)];
+
static COMBINE_MODES combine;
static OTHER_MODES other_modes;
@@ -311,21 +307,22 @@ static INT32 maskbits_table[16]; // Pre-calculated
static INT32 clamp_t_diff[8];
static INT32 clamp_s_diff[8];
-INLINE void COMBINER_EQUATION(UINT8* out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D);
+#define COMBINER_EQUATION(A, B, C, D) cc_lut2[(cc_lut1[(A << 16) | (B << 8) | C] << 8) | D]
+//#define COMBINER_EQUATION(A, B, C, D) cc_lut_base[((D) << 17) + ((C) << 9) + (A) - (B)]
+
+//INLINE void COMBINER_EQUATION(UINT8* out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D);
INLINE UINT32 addrightcvg(UINT32 x, UINT32 k);
INLINE UINT32 addleftcvg(UINT32 x, UINT32 k);
INLINE UINT32 z_decompress(UINT16* zb);
INLINE UINT16 dz_decompress(UINT16* zb, UINT8* zhb);
INLINE void z_build_com_table(void);
INLINE void z_store(UINT16* zb, UINT8* zhb, UINT32 z, UINT32 deltaz);
-INLINE UINT32 z_compare(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
INLINE INT32 normalize_dzpix(INT32 sum);
INLINE INT32 CLIP(INT32 value,INT32 min,INT32 max);
INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UINT8* hbuff, UINT32 hres);
-INLINE void divot_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index);
+INLINE void divot_filter16(UINT8* r, UINT8* g, UINT8* b, UINT16* fbuff, UINT32 fbuff_index);
INLINE void restore_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index, UINT32 hres);
INLINE UINT32 getlog2(UINT32 lod_clamp);
-INLINE void set_shade_for_rects(void);
INLINE void copy_colors(COLOR* dst, COLOR* src);
INLINE void BILERP_AND_WRITE(UINT32* src0, UINT32* src1, UINT32* dest);
INLINE void tcdiv(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst);
@@ -362,6 +359,10 @@ static int (*alpha_compare)(UINT8 comb_alpha);
static void (*texture_rectangle_16bit)(TEX_RECTANGLE *rect);
+#include "video/rdpfrect.h"
+
+static void (*fill_rectangle_16bit)(RECTANGLE *rect);
+
#include "video/rdpspn16.h"
static void (*render_spans_16_ns_nt_nz_nf)( int start, int end, TILE* tex_tile);
@@ -383,215 +384,65 @@ static void (*render_spans_16_s_t_z_f)(int start, int end, TILE* tex_tile);
#include "video/rdptpipe.h"
-static void (*TEXTURE_PIPELINE)(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
+//static UINT32 (*TEXTURE_PIPELINE)(INT32 SSS, INT32 SST, TILE* tex_tile);
+static UINT32 (*TEXTURE_PIPELINE)(INT32 SSS, INT32 SST, TILE* tex_tile);
#include "video/rdpblend.h"
-static int (*BLENDER1_16)(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-static int (*BLENDER2_16)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+static int (*BLENDER1_16_NDITH)(UINT16 *fb, UINT8* hb, COLOR c);
+static int (*BLENDER2_16_NDITH)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+static int (*BLENDER1_16_DITH)(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+static int (*BLENDER2_16_DITH)(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
#include "video/rdptri.h"
-INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
-INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+#include "video/rdpclamp.h"
static void (*CLAMP)(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
-
-INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
-INLINE void CLAMP_LIGHT_NC(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
-
static void (*CLAMP_LIGHT)(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+static void (*CLAMP_QUICK)(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
static UINT8 rdp_rand_val = 0;
#include "video/rdpfetch.h"
-// Hack, but more efficient than mame_rand
-static UINT8 rdp_rand(void)
-{
- return (rdp_rand_val += 19);
-}
-
-INLINE void MASK(INT32* S, INT32* T, TILE* tex_tile)
-{
- INT32 swrap, twrap;
+#include "video/rdpmask.h"
- if (tex_tile->mask_s) // Select clamp if mask == 0
- {
- swrap = *S >> (tex_tile->mask_s > 10 ? 10 : tex_tile->mask_s);
- swrap &= 1;
- if (tex_tile->ms && swrap)
- {
- *S = (~(*S)) & maskbits_table[tex_tile->mask_s]; // Mirroring and masking
- }
- else if (tex_tile->mask_s)
- {
- *S &= maskbits_table[tex_tile->mask_s]; // Masking
- }
- }
+static void (*MASK)(INT32* S, INT32* T, TILE* tex_tile);
- if (tex_tile->mask_t)
- {
- twrap = *T >> (tex_tile->mask_t > 10 ? 10 : tex_tile->mask_t);
- twrap &= 1;
- if (tex_tile->mt && twrap)
- {
- *T = (~(*T)) & maskbits_table[tex_tile->mask_t]; // Mirroring and masking
- }
- else if (tex_tile->mask_t)
- {
- *T &= maskbits_table[tex_tile->mask_t];
- }
- }
-}
+#include "video/rdpcc.h"
-INLINE void texshift(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
-{
- *S = SIGN16(*S);
- *T = SIGN16(*T);
- if (tex_tile->shift_s)
- {
- if (tex_tile->shift_s < 11)
- {
- *S >>= tex_tile->shift_s;
- }
- else
- {
- *S <<= (16 - tex_tile->shift_s);
- }
- *S = SIGN16(*S);
- }
- if (tex_tile->shift_s)
- {
- if (tex_tile->shift_t < 11)
- {
- *T >>= tex_tile->shift_t;
- }
- else
- {
- *T <<= (16 - tex_tile->shift_t);
- }
- *T = SIGN16(*T);
- }
- *maxs = ((*S >> 3) >= tex_tile->sh);
- *maxt = ((*T >> 3) >= tex_tile->th);
-}
+static UINT32 (*COLOR_COMBINER1)(void);
+static UINT32 (*COLOR_COMBINER2_C0)(void);
+static UINT32 (*COLOR_COMBINER2_C1)(void);
-INLINE void CLAMP_NC(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
-{
- int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
- int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
- int overunders = 0;
- int overundert = 0;
- if (*S & 0x10000 && dosfrac)
- {
- *S = 0;
- overunders = 1;
- }
- else if (maxs && dosfrac)
- {
- *S = clamp_s_diff[tex_tile->num];
- overunders = 1;
+#include "video/rdpshift.h"
- }
- else
- {
- *S = (SIGN17(*S) >> 5) & 0x1fff;
- }
+static void (*texshift)(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
- if (overunders && dosfrac)
- {
- *SFRAC = 0;
- }
+#define CACHE_TEXTURE_PARAMS(TEX) \
+ CLAMP = rdp_clamp_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
+ CLAMP_LIGHT = rdp_clamp_light_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
+ CLAMP_QUICK = rdp_clamp_quick_func[((other_modes.cycle_type == CYCLE_TYPE_COPY) ? 4 : 0) | ((TEX->cs || !TEX->mask_s) ? 2 : 0) | ((TEX->ct || !TEX->mask_t) ? 1 : 0)]; \
+ MASK = rdp_mask_func[(TEX->mask_s ? 2 : 0) | (TEX->mask_t ? 1 : 0)]; \
+ texshift = rdp_shift_func[(TEX->shift_s ? 2 : 0) | (TEX->shift_t ? 1 : 0)]; \
+ cached_twidth = TEX->line; \
+ cached_tbase = TEX->tmem; \
+ cached_tpal = (TEX->palette & 0xf) << 4; \
+ cached_tfetch = TEX->fetch_index; \
+ cached_tbase_s1 = TEX->tmem >> 1; \
+ cached_twidth_s1 = TEX->line >> 1;
- if (*T & 0x10000 && dotfrac)
- {
- *T = 0;
- overundert = 1;
- }
- else if (maxt && dotfrac)
- {
- *T = clamp_t_diff[tex_tile->num];
- overundert = 1;
- }
- else
- {
- *T = (SIGN17(*T) >> 5) & 0x1fff;
- }
-
- if (overundert && dotfrac)
- {
- *TFRAC = 0;
- }
-}
-
-INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
-{
- int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
- int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
- int overunders = 0;
- int overundert = 0;
-
- *S = (SIGN17(*S) >> 5) & 0x1fff;
-
- if (overunders && dosfrac)
- {
- *SFRAC = 0;
- }
-
- *T = (SIGN17(*T) >> 5) & 0x1fff;
-
- if (overundert && dotfrac)
- {
- *TFRAC = 0;
- }
-}
-
-INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
-{
- *S = (SIGN17(*S) >> 5) & 0x1fff;
- *T = (SIGN17(*T) >> 5) & 0x1fff;
-}
+// Hack, but more efficient than mame_rand
+#define rdp_rand() (rdp_rand_val += 19)
-INLINE void CLAMP_LIGHT_NC(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
-{
- int dos = (tex_tile->cs || !tex_tile->mask_s);
- int dot = (tex_tile->ct || !tex_tile->mask_t);
-
- if (*S & 0x10000 && dos)
- {
- *S = 0;
- }
- else if (maxs && dos)
- {
- *S = clamp_s_diff[tex_tile->num];
- }
- else
- {
- *S = (SIGN17(*S) >> 5) & 0x1fff;
- }
-
- if (*T & 0x10000 && dot)
- {
- *T = 0;
- }
- else if (maxt && dot)
- {
- *T = clamp_t_diff[tex_tile->num];
- }
- else
- {
- *T = (SIGN17(*T) >> 5) & 0x1fff;
- }
-}
+static int special_bsel0, special_bsel1;
/*****************************************************************************/
-
-
VIDEO_START(n64)
{
- int i = 0;
+ int i = 0, j = 0;
UINT8 *normpoint = memory_region(machine, "normpoint");
UINT8 *normslope = memory_region(machine, "normslope");
@@ -607,6 +458,55 @@ VIDEO_START(n64)
one_color.c = 0xffffffff;
zero_color.c = 0;
+ for(i = 0; i < (1 << 21); i++)
+ {
+ INT32 frac = i >> 16;
+ INT32 left = (i >> 8) & 0x000000ff;
+ INT32 right = i & 0x000000ff;
+ tex_lerp_lut[i] = (frac*(left - right))>>5;
+ }
+
+ for(i = 0; i < (1 << 24); i++)
+ {
+ UINT8 A = (i >> 16) & 0x000000ff;
+ UINT8 B = (i >> 8) & 0x000000ff;
+ UINT8 C = i & 0x000000ff;
+ cc_lut1[i] = (INT16)((((((INT32)A - (INT32)B) * (INT32)C) + 0x80) >> 8) & 0x0000ffff);
+ }
+
+ for(i = 0; i < (1 << 16); i++)
+ {
+ for(j = 0; j < (1 << 8); j++)
+ {
+ INT32 temp = (INT32)((INT16)i) + j;
+ if(temp > 255)
+ {
+ cc_lut2[(i << 8) | j] = 255;
+ }
+ else if(temp < 0)
+ {
+ cc_lut2[(i << 8) | j] = 0;
+ }
+ else
+ {
+ cc_lut2[(i << 8) | j] = (UINT8)temp;
+ }
+ }
+ }
+
+ for(i = 0; i < (1 << 16); i++)
+ {
+ UINT8 r = ((i >> 8) & 0xf8) | (i >> 13);
+ UINT8 g = ((i >> 3) & 0xf8) | ((i >> 8) & 0x07);
+ UINT8 b = ((i << 2) & 0xf8) | ((i >> 3) & 0x07);
+ UINT8 a = (i & 1) ? 0xff : 0;
+ rgb16_to_32_lut[i] = (r << 24) | (g << 16) | (b << 8) | a;
+
+ r = g = b = (i >> 8) & 0xff;
+ a = i & 0xff;
+ ia8_to_32_lut[i] = (r << 24) | (g << 16) | (b << 8) | a;
+ }
+
combiner_rgbsub_a_r[0] = combiner_rgbsub_a_r[1] = &one_color.i.r;
combiner_rgbsub_a_g[0] = combiner_rgbsub_a_g[1] = &one_color.i.g;
combiner_rgbsub_a_b[0] = combiner_rgbsub_a_b[1] = &one_color.i.b;
@@ -649,7 +549,7 @@ VIDEO_START(n64)
for (i = 0; i < 0x4000; i++)
{
- gamma_dither_table[i] = sqrt((double)i);
+ gamma_dither_table[i] = sqrt(i);
gamma_dither_table[i] <<= 1;
}
@@ -868,7 +768,7 @@ VIDEO_UPDATE(n64)
/*****************************************************************************/
-INLINE void SET_SUBA_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
+static void SET_SUBA_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
{
switch (code & 0xf)
{
@@ -887,7 +787,7 @@ INLINE void SET_SUBA_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b
}
}
-INLINE void SET_SUBB_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
+static void SET_SUBB_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
{
switch (code & 0xf)
{
@@ -906,7 +806,7 @@ INLINE void SET_SUBB_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b
}
}
-INLINE void SET_MUL_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
+static void SET_MUL_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
{
switch (code & 0x1f)
{
@@ -934,7 +834,7 @@ INLINE void SET_MUL_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b,
}
}
-INLINE void SET_ADD_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
+static void SET_ADD_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, int code)
{
switch (code & 0x7)
{
@@ -949,7 +849,7 @@ INLINE void SET_ADD_RGB_INPUT(UINT8 **input_r, UINT8 **input_g, UINT8 **input_b,
}
}
-INLINE void SET_SUB_ALPHA_INPUT(UINT8 **input, int code)
+static void SET_SUB_ALPHA_INPUT(UINT8 **input, int code)
{
switch (code & 0x7)
{
@@ -964,7 +864,7 @@ INLINE void SET_SUB_ALPHA_INPUT(UINT8 **input, int code)
}
}
-INLINE void SET_MUL_ALPHA_INPUT(UINT8 **input, int code)
+static void SET_MUL_ALPHA_INPUT(UINT8 **input, int code)
{
switch (code & 0x7)
{
@@ -979,65 +879,7 @@ INLINE void SET_MUL_ALPHA_INPUT(UINT8 **input, int code)
}
}
-
-
-INLINE void COLOR_COMBINER1(COLOR *c)
-{
- if (combiner_rgbsub_a_r[1] == &noise_color.i.r)
- {
- noise_color.i.r = rdp_rand() & 0xff;
- noise_color.i.g = rdp_rand() & 0xff;
- noise_color.i.b = rdp_rand() & 0xff;
- }
-
- COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
- COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
- COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
- COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
-
- //Alpha coverage combiner
- alpha_cvg_get(&c->i.a);
-}
-
-INLINE void COLOR_COMBINER2_C0(COLOR *c)
-{
- if (combiner_rgbsub_a_r[0] == &noise_color.i.r)
- {
- noise_color.i.r = rdp_rand() & 0xff;
- noise_color.i.g = rdp_rand() & 0xff;
- noise_color.i.b = rdp_rand() & 0xff;
- }
-
- COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[0],combiner_rgbsub_b_r[0],combiner_rgbmul_r[0],combiner_rgbadd_r[0]);
- COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[0],combiner_rgbsub_b_g[0],combiner_rgbmul_g[0],combiner_rgbadd_g[0]);
- COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[0],combiner_rgbsub_b_b[0],combiner_rgbmul_b[0],combiner_rgbadd_b[0]);
- COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[0],combiner_alphasub_b[0],combiner_alphamul[0],combiner_alphaadd[0]);
-
- combined_color.c = c->c;
-}
-
-INLINE void COLOR_COMBINER2_C1(COLOR *c)
-{
- c->c = texel0_color.c;
- texel0_color.c = texel1_color.c;
- texel1_color.c = c->c;
-
- if (combiner_rgbsub_a_r[1] == &noise_color.i.r)
- {
- noise_color.i.r = rdp_rand() & 0xff;
- noise_color.i.g = rdp_rand() & 0xff;
- noise_color.i.b = rdp_rand() & 0xff;
- }
-
- COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
- COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
- COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
- COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
-
- alpha_cvg_get(&c->i.a);
-}
-
-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)
+static void SET_BLENDER_INPUT(int cycle, int which, UINT8 **input_r, UINT8 **input_g, UINT8 **input_b, UINT8 **input_a, int a, int b)
{
switch (a & 0x3)
{
@@ -1119,183 +961,6 @@ static const UINT8 magic_matrix[16] =
/*****************************************************************************/
-static void fill_rectangle_16bit(RECTANGLE *rect)
-{
- UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
- UINT8* hb = &hidden_bits[fb_address >> 1];
-
- int index, i, j;
- int x1 = rect->xh / 4;
- int x2 = rect->xl / 4;
- int y1 = rect->yh / 4;
- int y2 = rect->yl / 4;
- int clipx1, clipx2, clipy1, clipy2;
- UINT16 fill_color1, fill_color2;
- int fill_cvg1;
- int fill_cvg2;
-
- if (x2 <= x1)
- {
- x2=x1+1; // SCARS (E)
- }
- if (y2 == y1)
- {
- y2=y1+1; // Goldeneye
- }
-
-
- fill_color1 = (fill_color >> 16) & 0xffff;
- fill_color2 = (fill_color >> 0) & 0xffff;
- fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
- fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
-
- clipx1 = clip.xh / 4;
- clipx2 = clip.xl / 4;
- clipy1 = clip.yh / 4;
- clipy2 = clip.yl / 4;
-
- // clip
- if (x1 < clipx1)
- {
- x1 = clipx1;
- }
- if (y1 < clipy1)
- {
- y1 = clipy1;
- }
- if (x2 >= clipx2)
- {
- x2 = clipx2-1;
- }
- if (y2 >= clipy2)
- {
- y2 = clipy2-1;
- }
-
- set_shade_for_rects(); // Needed by Command & Conquer menus
-
- if (other_modes.cycle_type == CYCLE_TYPE_FILL)
- {
- for (j=y1; j <= y2; j++)
- {
- index = j * fb_width;
- for (i=x1; i <= x2; i++)
- {
- int curpixel = index + i;
- fb[curpixel ^ WORD_ADDR_XOR] = (i & 1) ? fill_color1 : fill_color2;
- hb[curpixel ^ BYTE_ADDR_XOR] = (i & 1) ? ((fill_color1 & 1)? 3:0) : ((fill_color2 & 1) ? 3:0);
- }
- }
- }
- else if (other_modes.cycle_type == CYCLE_TYPE_1)
- {
- if(!other_modes.rgb_dither_sel)
- {
- for (j = y1; j <= y2; j++)
- {
- COLOR c;
- int dith = 0;
- index = j * fb_width;
- for (i = x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER1(&c);
- dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
- BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
- }
- }
- }
- else if (other_modes.rgb_dither_sel == 1)
- {
- for (j = y1; j <= y2; j++)
- {
- COLOR c;
- int dith = 0;
- index = j * fb_width;
- for (i = x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER1(&c);
- dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
- BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
- }
- }
- }
- else
- {
- for (j = y1; j <= y2; j++)
- {
- COLOR c;
- int dith = 0;
- index = j * fb_width;
- for (i = x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER1(&c);
- BLENDER1_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
- }
- }
- }
- }
- else if (other_modes.cycle_type == CYCLE_TYPE_2)
- {
- if (!other_modes.rgb_dither_sel)
- {
- for (j=y1; j <= y2; j++)
- {
- COLOR c1, c2;
- int dith = 0;
- index = j * fb_width;
- for (i=x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
- dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
- BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
- }
- }
- }
- else if (other_modes.rgb_dither_sel == 1)
- {
- for (j=y1; j <= y2; j++)
- {
- COLOR c1, c2;
- int dith = 0;
- index = j * fb_width;
- for (i=x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
- dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
- BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
- }
- }
- }
- else
- {
- for (j=y1; j <= y2; j++)
- {
- COLOR c1, c2;
- int dith = 0;
- index = j * fb_width;
- for (i=x1; i <= x2; i++)
- {
- curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
- BLENDER2_16(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
- }
- }
- }
- }
- else
- {
- fatalerror("fill_rectangle_16bit: cycle type copy");
- }
-}
-
#define XOR_SWAP_BYTE 4
#define XOR_SWAP_WORD 2
#define XOR_SWAP_DWORD 1
@@ -1309,21 +974,14 @@ static void fill_rectangle_16bit(RECTANGLE *rect)
if (s < 0) s = 0;
*/
-static INT32 tbase;
-static INT32 twidth;
-static INT32 tpal;
-
-INLINE void FETCH_TEXEL(COLOR *color, int s, int t, TILE* tex_tile)
-{
- twidth = tex_tile->line;
- tbase = tex_tile->tmem;
- tpal = tex_tile->palette & 0xf;
-
- if (t < 0) t = 0;
- if (s < 0) s = 0;
+static INT32 cached_tbase;
+static INT32 cached_twidth;
+static INT32 cached_tpal;
+static INT32 cached_tfetch;
+static INT32 cached_tbase_s1;
+static INT32 cached_twidth_s1;
- rdp_fetch_texel_func[tex_tile->fetch_index](color, s, t);
-}
+#define FETCH_TEXEL(s, t) rdp_fetch_texel_func[cached_tfetch](s < 0 ? 0 : s, t < 0 ? 0 : t)
INLINE UINT32 z_decompress(UINT16 *zb)
{
@@ -1382,116 +1040,58 @@ INLINE UINT16 dz_decompress(UINT16* zb, UINT8* zhb)
return (1 << dz_compressed);
}
-INLINE UINT32 z_compare(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
-{
- int force_coplanar = 0;
- UINT32 oz = z_decompress(zb);
- UINT32 dzmem = dz_decompress(zb, zhb);
- UINT32 dznew = 0;
- UINT32 farther = 0;
- UINT32 diff = 0;
- UINT32 nearer = 0;
- UINT32 infront = 0;
- UINT32 max = 0;
- int precision_factor = (oz >> 15) & 0xf;
- int overflow = 0;
- int cvgcoeff = 0;
- UINT32 mempixel, memory_cvg;
-
- sz &= 0x3ffff;
- if (dzmem == 0x8000 && precision_factor < 3)
- {
- force_coplanar = 1;
- }
- if (!precision_factor)
- {
- dzmem = ((dzmem << 1) > 16) ? (dzmem << 1) : 16;
- }
- else if (precision_factor == 1)
- {
- dzmem = ((dzmem << 1) > 8) ? (dzmem << 1) : 8;
- }
- else if (precision_factor == 2)
- {
- dzmem = ((dzmem << 1) > 4) ? (dzmem << 1) : 4;
- }
- if (dzmem == 0 && precision_factor < 3)
- {
- dzmem = 0xffff;
- }
- if (dzmem > 0x8000)
- {
- dzmem = 0xffff;
- }
- dznew =((dzmem > dzpix) ? dzmem : (UINT32)dzpix) << 3;
- dznew &= 0x3ffff;
-
- farther = ((sz + dznew) >= oz) ? 1 : 0;
- diff = (sz >= dznew) ? (sz - dznew) : 0;
- nearer = (diff <= oz) ? 1: 0;
- infront = (sz < oz) ? 1 : 0;
- max = (dzmem == 0x3ffff);
-
- if (force_coplanar)
- {
- farther = nearer = 1;
- }
-
- curpixel_overlap = 0;
-
- switch(fb_size)
- {
- case 1: /* Banjo Tooie */
- memory_cvg = 0; //??
- break;
- case 2:
- mempixel = *(UINT16*)fb;
- memory_cvg = ((mempixel & 1) << 2) + (*hb & 3);
- break;
- case 3:
- mempixel = *(UINT32*)fb;
- memory_cvg = (mempixel >> 5) & 7;
- break;
- default:
- fatalerror("z_compare: fb_size = %d",fb_size);
- break;
- }
-
- if (!other_modes.image_read_en)
- {
- memory_cvg = 7;
- }
-
- overflow = ((memory_cvg + curpixel_cvg - 1) > 7) ? 1 : 0;
- curpixel_overlap = (other_modes.force_blend || (!overflow && other_modes.antialias_en && farther));
-
- if (other_modes.z_mode == 1 && infront && farther && overflow)
- {
- cvgcoeff = ((dzmem >> dznew) - (sz >> dznew)) & 0xf;
- curpixel_cvg = ((cvgcoeff * (curpixel_cvg - 1)) >> 3) & 0xf;
- }
- if (curpixel_cvg > 8)
- curpixel_cvg = 8;
-
- switch(other_modes.z_mode)
- {
- case 0: // Opaque
- return (max || (overflow ? infront : nearer))? 1 : 0;
- break;
- case 1: // Interpenetrating
- return (max || (overflow ? infront : nearer))? 1 : 0;
- break;
- case 2: // Transparent
- return (infront || max)? 1: 0;
- break;
- case 3: // Decal
- return (farther && nearer && !max) ? 1 : 0;
- break;
- default:
- fatalerror( "z_mode = %d", other_modes.z_mode);
- break;
- }
-}
+#include "video/rdpzcomp.h"
+
+#define ZMODE0
+ #define ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+#undef ZMODE0
+#define ZMODE1
+ #define ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+#undef ZMODE1
+#define ZMODE2
+ #define ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+#undef ZMODE2
+#define ZMODE3
+ #define ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef ANTIALIAS
+ #define IMGREAD
+ #include "video/rdpzcomp.c"
+ #undef IMGREAD
+ #include "video/rdpzcomp.c"
+#undef ZMODE3
+
+static UINT32 (*z_compare)(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
INLINE INT32 normalize_dzpix(INT32 sum)
{
@@ -1555,9 +1155,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
backr[0] = r;
backg[0] = g;
backb[0] = b;
- invr[0] = 255 - r;
- invg[0] = 255 - g;
- invb[0] = 255 - b;
+ invr[0] = ~r;
+ invg[0] = ~g;
+ invb[0] = ~b;
if (centercvg == 8)
{
@@ -1578,9 +1178,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07);
- invr[numoffull] = 255 - backr[numoffull];
- invg[numoffull] = 255 - backg[numoffull];
- invb[numoffull] = 255 - backb[numoffull];
+ invr[numoffull] = ~backr[numoffull];
+ invg[numoffull] = ~backg[numoffull];
+ invb[numoffull] = ~backb[numoffull];
}
else
{
@@ -1604,9 +1204,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07);
- invr[numoffull] = 255 - backr[numoffull];
- invg[numoffull] = 255 - backg[numoffull];
- invb[numoffull] = 255 - backb[numoffull];
+ invr[numoffull] = ~backr[numoffull];
+ invg[numoffull] = ~backg[numoffull];
+ invb[numoffull] = ~backb[numoffull];
}
else
{
@@ -1630,9 +1230,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
backr[numoffull] = ((pix >> 8) & 0xf8) | (pix >> 13);
backg[numoffull] = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
backb[numoffull] = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07);
- invr[numoffull] = 255 - backr[numoffull];
- invg[numoffull] = 255 - backg[numoffull];
- invb[numoffull] = 255 - backb[numoffull];
+ invr[numoffull] = ~backr[numoffull];
+ invg[numoffull] = ~backg[numoffull];
+ invb[numoffull] = ~backb[numoffull];
}
else
{
@@ -1645,11 +1245,6 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
toleft++;
}
- if (numoffull != 7)
- {
- fatalerror("Something went wrong in vi_filter16");
- }
-
video_max(&backr[0], &max.i.r, &enb);
for(i = 1; i < 7; i++)
{
@@ -1723,9 +1318,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
i = ge_two(enb);
penumin.i.b = i ? min.i.b : penumin.i.b;
- penumin.i.r = 255 - penumin.i.r;
- penumin.i.g = 255 - penumin.i.g;
- penumin.i.b = 255 - penumin.i.b;
+ penumin.i.r = ~penumin.i.r;
+ penumin.i.g = ~penumin.i.g;
+ penumin.i.b = ~penumin.i.b;
colr = (UINT32)penumin.i.r + (UINT32)penumax.i.r - (r << 1);
colg = (UINT32)penumin.i.g + (UINT32)penumax.i.g - (g << 1);
@@ -1742,9 +1337,9 @@ INLINE void video_filter16(int *out_r, int *out_g, int *out_b, UINT16* vbuff, UI
}
// This needs to be fixed for endianness.
-INLINE void divot_filter16(INT32* r, INT32* g, INT32* b, UINT16* fbuff, UINT32 fbuff_index)
+INLINE void divot_filter16(UINT8* r, UINT8* g, UINT8* b, UINT16* fbuff, UINT32 fbuff_index)
{
- UINT32 leftr, leftg, leftb, rightr, rightg, rightb;
+ UINT8 leftr, leftg, leftb, rightr, rightg, rightb;
UINT16 leftpix, rightpix;
UINT16* next, *prev;
UINT32 Lsw = fbuff_index & 1;
@@ -2034,6 +1629,91 @@ INLINE void restore_two(COLOR* filtered, COLOR* neighbour)
INLINE void video_max(UINT32* Pixels, UINT8* max, UINT32* enb)
{
+ int pos = 0;
+ UINT32 temp = 0;
+ if (Pixels[0] > Pixels[pos])
+ {
+ temp |= 1;
+ }
+ else if (Pixels[0] < Pixels[pos])
+ temp |= 1;
+
+ if (Pixels[1] > Pixels[pos])
+ {
+ temp |= 2;
+ pos = 1;
+ }
+ else if (Pixels[1] < Pixels[pos])
+ temp |= 2;
+ else
+ pos = 1;
+
+ if (Pixels[2] > Pixels[pos])
+ {
+ temp |= 4;
+ pos = 2;
+ }
+ else if (Pixels[2] < Pixels[pos])
+ temp |= 4;
+ else
+ pos = 2;
+
+ if (Pixels[3] > Pixels[pos])
+ {
+ temp |= 8;
+ pos = 3;
+ }
+ else if (Pixels[3] < Pixels[pos])
+ temp |= 8;
+ else
+ pos = 3;
+
+ if (Pixels[4] > Pixels[pos])
+ {
+ temp |= 16;
+ pos = 4;
+ }
+ else if (Pixels[4] < Pixels[pos])
+ temp |= 16;
+ else
+ pos = 4;
+
+ if (Pixels[5] > Pixels[pos])
+ {
+ temp |= 32;
+ pos = 5;
+ }
+ else if (Pixels[5] < Pixels[pos])
+ temp |= 32;
+ else
+ pos = 5;
+
+ if (Pixels[6] > Pixels[pos])
+ {
+ temp |= 64;
+ pos = 6;
+ }
+ else if (Pixels[6] < Pixels[pos])
+ temp |= 64;
+ else
+ pos = 6;
+
+ if (Pixels[7] > Pixels[pos])
+ {
+ temp |= 128;
+ pos = 7;
+ }
+ else if (Pixels[7] < Pixels[pos])
+ temp |= 128;
+ else
+ pos = 7;
+
+ *enb = temp;
+ *max = Pixels[pos];
+}
+/*
+INLINE void video_max(UINT32* Pixels, UINT8* max, UINT32* enb)
+{
int i;
int pos = 0;
*enb = 0;
@@ -2055,19 +1735,95 @@ INLINE void video_max(UINT32* Pixels, UINT8* max, UINT32* enb)
}
*max = Pixels[pos];
}
+*/
INLINE UINT32 ge_two(UINT32 enb)
{
- int i;
- int j = 0;
- for(i = 0; i < 7; i++)
+ if(enb & 1)
{
- if (!((enb >> i) & 1))
- {
- j++;
- }
+ if(enb & 2)
+ return 1;
+ if(enb & 4)
+ return 1;
+ if(enb & 8)
+ return 1;
+ if(enb & 16)
+ return 1;
+ if(enb & 32)
+ return 1;
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
}
- return (j > 1);
+ else if(enb & 2)
+ {
+ if(enb & 4)
+ return 1;
+ if(enb & 8)
+ return 1;
+ if(enb & 16)
+ return 1;
+ if(enb & 32)
+ return 1;
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ else if(enb & 4)
+ {
+ if(enb & 8)
+ return 1;
+ if(enb & 16)
+ return 1;
+ if(enb & 32)
+ return 1;
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ else if(enb & 8)
+ {
+ if(enb & 16)
+ return 1;
+ if(enb & 32)
+ return 1;
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ else if(enb & 16)
+ {
+ if(enb & 32)
+ return 1;
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ else if(enb & 32)
+ {
+ if(enb & 64)
+ return 1;
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ else if(enb & 64)
+ {
+ if(enb & 128)
+ return 1;
+ return 0;
+ }
+ return 0;
}
INLINE void calculate_clamp_diffs(UINT32 prim_tile)
@@ -2112,15 +1868,6 @@ INLINE void rgb_dither(INT32* r, INT32* g, INT32* b, int dith)
}
}
-INLINE void set_shade_for_rects(void)
-{
- shade_color.c = 0;
- //shade_color.i.r = 0;
- //shade_color.i.g = 0;
- //shade_color.i.b = 0;
- //shade_color.i.a = 0;
-}
-
INLINE UINT32 getlog2(UINT32 lod_clamp)
{
int i;
@@ -2144,10 +1891,6 @@ INLINE UINT32 getlog2(UINT32 lod_clamp)
INLINE void copy_colors(COLOR* dst, COLOR* src)
{
dst->c = src->c;
- //dst->i.r = src->i.r;
- //dst->i.g = src->i.g;
- //dst->i.b = src->i.b;
- //dst->i.a = src->i.a;
}
INLINE void BILERP_AND_WRITE(UINT32* src0, UINT32* src1, UINT32* dest)
@@ -2167,12 +1910,10 @@ INLINE void tcdiv(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst)
int shift;
int normout;
int wnorm;
- int temppoint, tempslope;
int tlu_rcp;
- int tempmask;
int shift_value;
- if ((sw & 0x8000) || !(sw & 0x7fff))
+ if (!(sw & 0x7fff))
{
w_carry = 1;
}
@@ -2187,26 +1928,19 @@ INLINE void tcdiv(INT32 ss, INT32 st, INT32 sw, INT32* sss, INT32* sst)
normout = ((sw << shift) & 0x3fff) >> 8;
wnorm = ((sw << shift) & 0xff) << 2;
- temppoint = NormPointRom[normout];
- tempslope = NormSlopeRom[normout];
- tlu_rcp = ((-(tempslope * wnorm)) >> 10);
- tlu_rcp = (tlu_rcp + temppoint);
+ tlu_rcp = ((-(NormSlopeRom[normout] * wnorm)) >> 10) + NormPointRom[normout];
- *sss = SIGN16(ss) * tlu_rcp;
- *sst = SIGN16(st) * tlu_rcp;
- tempmask = ((1 << (shift+1)) - 1) << (29 - shift);
- shift_value = 13 - shift;
- if (shift_value < 0)
+ if(shift == 14)
{
- shift_value = 0;
+ *sss = (SIGN16(ss) * tlu_rcp) << 1;
+ *sst = (SIGN16(st) * tlu_rcp) << 1;
}
- *sss >>= shift_value;
- *sst >>= shift_value;
- if (shift == 0xe)
+ else
{
- *sss <<= 1;
- *sst <<= 1;
+ shift_value = 13 - shift;
+ *sss = (SIGN16(ss) * tlu_rcp) >> shift_value;
+ *sst = (SIGN16(st) * tlu_rcp) >> shift_value;
}
}
@@ -2266,15 +2000,9 @@ INLINE int BLENDER1_32(UINT32 *fb, COLOR c)
}
else
{
- int special_bsel = 0;
- if (blender2b_a[0] == &memory_color.i.a)
- {
- special_bsel = 1;
- }
-
inv_pixel_color.i.a = 0xff - *blender1b_a[0];
- BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel0);
}
return (FBWRITE_32(fb,r,g,b));
@@ -2284,7 +2012,6 @@ INLINE int BLENDER2_32(UINT32 *fb, COLOR c1, COLOR c2)
{
UINT32 mem = *fb;
int r, g, b;
- int special_bsel = 0;
// Alpha compare
if (!alpha_compare(c2.i.a))
@@ -2317,14 +2044,9 @@ INLINE int BLENDER2_32(UINT32 *fb, COLOR c1, COLOR c2)
memory_color.i.a = 0xe0;
}
- if (blender2b_a[0] == &memory_color.i.a)
- {
- special_bsel = 1;
- }
-
inv_pixel_color.i.a = 0xff - *blender1b_a[0];
- BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel0);
blended_pixel_color.i.r = r;
blended_pixel_color.i.g = g;
@@ -2342,18 +2064,9 @@ INLINE int BLENDER2_32(UINT32 *fb, COLOR c1, COLOR c2)
}
else
{
- if (blender2b_a[1] == &memory_color.i.a)
- {
- special_bsel = 1;
- }
- else
- {
- special_bsel = 0;
- }
-
inv_pixel_color.i.a = 0xff - *blender1b_a[1];
- BLENDER_EQUATION1(&r, &g, &b, special_bsel);
+ BLENDER_EQUATION1(&r, &g, &b, special_bsel1);
}
return (FBWRITE_32(fb,r,g,b));
@@ -2370,11 +2083,6 @@ static void fill_rectangle_32bit(RECTANGLE *rect)
int clipx1, clipx2, clipy1, clipy2;
int fill_cvg = 0;
- if (x2 < x1)
- {
- stricterror ("SCARS (E) case: fill_rectangle_32bit");
- }
-
// TODO: clip
clipx1 = clip.xh / 4;
clipx2 = clip.xl / 4;
@@ -2399,7 +2107,7 @@ static void fill_rectangle_32bit(RECTANGLE *rect)
y2 = clipy2-1;
}
- set_shade_for_rects();
+ shade_color.c = 0;
fill_cvg = ((fill_color >> 5) & 7) + 1;
@@ -2424,7 +2132,7 @@ static void fill_rectangle_32bit(RECTANGLE *rect)
for (i=x1; i <= x2; i++)
{
curpixel_cvg = fill_cvg;
- COLOR_COMBINER1(&c);
+ c.c = COLOR_COMBINER1();
BLENDER1_32(&fb[(index + i)], c);
}
}
@@ -2438,8 +2146,8 @@ static void fill_rectangle_32bit(RECTANGLE *rect)
for (i=x1; i <= x2; i++)
{
curpixel_cvg = fill_cvg;
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
BLENDER2_32(&fb[(index + i)], c1, c2);
}
}
@@ -2470,11 +2178,6 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
y1 = (rect->yh / 4);
y2 = (rect->yl / 4);
- if (x2 < x1)
- {
- stricterror( "x2 < x1: texture_rectangle_32bit" );
- }
-
if (other_modes.cycle_type == CYCLE_TYPE_FILL || other_modes.cycle_type == CYCLE_TYPE_COPY)
{
rect->dsdx /= 4;
@@ -2503,12 +2206,14 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
}
}
- set_shade_for_rects(); // Needed by Pilotwings 64
+ shade_color.c = 0; // Needed by Pilotwings 64
t = (int)(rect->t) << 5;
if (other_modes.cycle_type == CYCLE_TYPE_1)
{
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
for (j = y1; j < y2; j++)
{
int fb_index = j * fb_width;
@@ -2523,14 +2228,14 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
st = t >> 5;
if (rect->flip)
{
- TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
}
else
{
- TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
}
- COLOR_COMBINER1(&c);
+ c.c = COLOR_COMBINER1();
BLENDER1_32(&fb[(fb_index + i)], c);
@@ -2556,17 +2261,23 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
st = t >> 5;
if (rect->flip)
{
- TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
- TEXTURE_PIPELINE(&texel1_color, st, ss, tex_tile2);
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(st, ss, tex_tile2);
}
else
{
- TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
- TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2);
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(ss, st, tex_tile2);
}
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
BLENDER2_32(&fb[(fb_index + i)], c1, c2);
@@ -2578,6 +2289,8 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
}
else if (other_modes.cycle_type == CYCLE_TYPE_COPY)
{
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
for (j = y1; j < y2; j++)
{
int fb_index = j * fb_width;
@@ -2590,11 +2303,11 @@ INLINE void texture_rectangle_32bit(TEX_RECTANGLE *rect)
st = t >> 5;
if (rect->flip)
{
- TEXTURE_PIPELINE(&texel0_color, st, ss, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
}
else
{
- TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
}
fb[fb_index + i] = (texel0_color.i.r << 24) | (texel0_color.i.g << 16) | (texel0_color.i.b << 8)|1;
@@ -2644,12 +2357,6 @@ static void render_spans_32(int start, int end, TILE* tex_tile, int shade, int t
clipy1 = clip.yh / 4;
clipy2 = clip.yl / 4;
-
- if (other_modes.key_en)
- {
- stricterror( "render_spans_32: key_en" );
- }
-
if (other_modes.cycle_type == CYCLE_TYPE_2 && texture)
{
if (!other_modes.tex_lod_en)
@@ -2695,6 +2402,8 @@ static void render_spans_32(int start, int end, TILE* tex_tile, int shade, int t
shade_color.c = prim_color.c;
}
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
for (i = start; i <= end; i++)
{
int xstart = span[i].lx;
@@ -2736,10 +2445,6 @@ static void render_spans_32(int start, int end, TILE* tex_tile, int shade, int t
if (x >= clipx1 && x < clipx2)
{
curpixel_cvg = span[i].cvg[x];
- if (curpixel_cvg > 8)
- {
- stricterror("render_spans_32: curpixel_cvg = %d", curpixel_cvg);
- }
if (curpixel_cvg)
{
COLOR c1, c2;
@@ -2784,24 +2489,27 @@ static void render_spans_32(int start, int end, TILE* tex_tile, int shade, int t
{
if (other_modes.cycle_type == CYCLE_TYPE_1)
{
- TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
}
else
{
- TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
- TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2);
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile2);
}
}
if (other_modes.cycle_type == CYCLE_TYPE_1)
{
- COLOR_COMBINER1(&c1);
+ c1.c = COLOR_COMBINER1();
}
else if (other_modes.cycle_type == CYCLE_TYPE_2)
{
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
- }
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
+ }
if ((zbuffer || other_modes.z_source_sel) && other_modes.z_compare_en)
{
@@ -3870,7 +3578,7 @@ static RDP_COMMAND( rdp_set_other_modes )
int index;
other_modes.cycle_type = (w1 >> 20) & 0x3;
- other_modes.persp_tex_en = (w1 & 0x80000) ? 1 : 0;
+ other_modes.persp_tex_en = (w1 & 0x80000) ? 1 : 0;
other_modes.detail_tex_en = (w1 & 0x40000) ? 1 : 0;
other_modes.sharpen_tex_en = (w1 & 0x20000) ? 1 : 0;
other_modes.tex_lod_en = (w1 & 0x10000) ? 1 : 0;
@@ -3906,34 +3614,34 @@ static RDP_COMMAND( rdp_set_other_modes )
other_modes.dither_alpha_en = (w2 & 0x02) ? 1 : 0;
other_modes.alpha_compare_en = (w2 & 0x01) ? 1 : 0;
- texture_rectangle_16bit = rdp_texture_rectangle_16bit_func[((other_modes.z_update_en | other_modes.z_source_sel) << 3) | ((other_modes.z_compare_en | other_modes.z_source_sel) << 2) | other_modes.cycle_type];
+ texture_rectangle_16bit = rdp_texture_rectangle_16bit_func[((((other_modes.z_update_en | other_modes.z_source_sel) << 3) | ((other_modes.z_compare_en | other_modes.z_source_sel) << 2) | other_modes.cycle_type) << 2) | other_modes.rgb_dither_sel];
+ fill_rectangle_16bit = rdp_fill_rectangle_16bit_func[(other_modes.cycle_type << 2) | other_modes.rgb_dither_sel];
alpha_cvg_get = rdp_alpha_cvg_func[(other_modes.cvg_times_alpha << 1) | other_modes.alpha_cvg_select];
alpha_compare = rdp_alpha_compare_func[(other_modes.alpha_compare_en << 1) | other_modes.dither_alpha_en];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
- 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))];
+ z_compare = rdp_z_compare_func[(other_modes.z_mode << 2) | (other_modes.antialias_en << 1) | other_modes.image_read_en];
+
+ render_spans_16_ns_nt_nz_nf = rdp_render_spans_16_func[0 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_nt_z_nf = rdp_render_spans_16_func[2 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_t_nz_nf = rdp_render_spans_16_func[4 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_t_z_nf = rdp_render_spans_16_func[6 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_nt_nz_nf = rdp_render_spans_16_func[8 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_nt_z_nf = rdp_render_spans_16_func[10 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_t_nz_nf = rdp_render_spans_16_func[12 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_t_z_nf = rdp_render_spans_16_func[14 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_nt_nz_f = rdp_render_spans_16_func[16 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_nt_z_f = rdp_render_spans_16_func[18 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_t_nz_f = rdp_render_spans_16_func[20 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_ns_t_z_f = rdp_render_spans_16_func[22 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_nt_nz_f = rdp_render_spans_16_func[24 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_nt_z_f = rdp_render_spans_16_func[26 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_t_nz_f = rdp_render_spans_16_func[28 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
+ render_spans_16_s_t_z_f = rdp_render_spans_16_func[30 + ((other_modes.cycle_type & 1) | (other_modes.z_compare_en << 5) | (other_modes.z_update_en << 6) | (other_modes.rgb_dither_sel << 7))];
TEXTURE_PIPELINE = rdp_texture_pipeline_func[(other_modes.mid_texel << 1) | other_modes.sample_type];
- CLAMP = (other_modes.cycle_type == CYCLE_TYPE_COPY) ? CLAMP_C : CLAMP_NC;
- CLAMP_LIGHT = (other_modes.cycle_type == CYCLE_TYPE_COPY) ? CLAMP_LIGHT_C : CLAMP_LIGHT_NC;
-
for(index = 0; index < 8; index++)
{
tile[index].fetch_index = (tile[index].size << 5) | (tile[index].format << 2) | (other_modes.en_tlut << 1) | other_modes.tlut_type;
@@ -3945,8 +3653,10 @@ static RDP_COMMAND( rdp_set_other_modes )
BLENDER_EQUATION0 = other_modes.force_blend ? BLENDER_EQUATION0_FORCE : BLENDER_EQUATION0_NFORCE;
BLENDER_EQUATION1 = other_modes.force_blend ? BLENDER_EQUATION1_FORCE : BLENDER_EQUATION1_NFORCE;
- BLENDER1_16 = rdp_blender1_16_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | (other_modes.rgb_dither_sel >> 1)];
- BLENDER2_16 = rdp_blender2_16_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | (other_modes.rgb_dither_sel >> 1)];
+ BLENDER1_16_DITH = rdp_blender1_16_dith_func[(other_modes.image_read_en << 3) | (other_modes.z_compare_en << 2) | ((other_modes.rgb_dither_sel >> 1) << 1) | other_modes.alpha_compare_en];
+ BLENDER2_16_DITH = rdp_blender2_16_dith_func[(other_modes.image_read_en << 3) | (other_modes.z_compare_en << 2) | ((other_modes.rgb_dither_sel >> 1) << 1) | other_modes.alpha_compare_en];
+ BLENDER1_16_NDITH = rdp_blender1_16_ndith_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | other_modes.alpha_compare_en];
+ BLENDER2_16_NDITH = rdp_blender2_16_ndith_func[(other_modes.image_read_en << 2) | (other_modes.z_compare_en << 1) | other_modes.alpha_compare_en];
SET_BLENDER_INPUT(0, 0, &blender1a_r[0], &blender1a_g[0], &blender1a_b[0], &blender1b_a[0],
other_modes.blend_m1a_0, other_modes.blend_m1b_0);
@@ -3956,6 +3666,9 @@ static RDP_COMMAND( rdp_set_other_modes )
other_modes.blend_m1a_1, other_modes.blend_m1b_1);
SET_BLENDER_INPUT(1, 1, &blender2a_r[1], &blender2a_g[1], &blender2a_b[1], &blender2b_a[1],
other_modes.blend_m2a_1, other_modes.blend_m2b_1);
+
+ special_bsel0 = (blender2b_a[0] == &memory_color.i.a) ? 2 : 0;
+ special_bsel1 = (blender2b_a[1] == &memory_color.i.a) ? 2 : 0;
}
static RDP_COMMAND( rdp_load_tlut )
@@ -4004,12 +3717,7 @@ static RDP_COMMAND( rdp_load_tlut )
}
break;
}*/
- default: stricterror("RDP: load_tlut: size = %d\n", ti_size);
- }
-
- if (TMEM[0x1000] != 25 || TMEM[0x1001] != 25)
- {
- stricterror("rdp_load_tlut: TMEM has been written out-of-bounds");
+ default: fatalerror("RDP: load_tlut: size = %d\n", ti_size);
}
}
@@ -4040,11 +3748,6 @@ static RDP_COMMAND( rdp_load_block )
tile[tilenum].sh = sh = ((w2 >> 12) & 0xfff);
dxt = ((w2 >> 0) & 0xfff);
- if (sh < sl)
- {
- //fatalerror( "load_block: sh < sl" );
- }
-
width = (sh - sl) + 1;
if (width > 2048) // Hack for Magical Tetris Challenge
@@ -4062,7 +3765,7 @@ static RDP_COMMAND( rdp_load_block )
if ((ti_address & 3) && (ti_address & 0xffffff00) != 0xf8a00)
{
- stricterror( "load block: unaligned ti_address 0x%x",ti_address ); // Rat Attack, Frogger 2 prototype
+ fatalerror( "load block: unaligned ti_address 0x%x",ti_address ); // Rat Attack, Frogger 2 prototype
}
src = (UINT32*)&ram16[ti_address2 >> 1];
@@ -4074,11 +3777,6 @@ static RDP_COMMAND( rdp_load_block )
width = 0x1000 - tb*4; // Hack for Magical Tetris Challenge
}
- if (ti_width2 < 0)
- {
- fatalerror( "load_block: negative ti_width2" );
- }
-
switch (ti_size)
{
case PIXEL_SIZE_4BIT: ti_width2 >>= 1; break;
@@ -4148,11 +3846,6 @@ static RDP_COMMAND( rdp_load_tile )
return; // Needed by Wipeout 64
}
- if ((ti_format != tex_tile->format || ti_size != tex_tile->size))
- {
- fatalerror("load_tile: format conversion required!\n %d %d %d %d", ti_format, tex_tile->format, ti_size, tex_tile->size);
- }
-
tex_tile->sl = ((w1 >> 12) & 0xfff);
tex_tile->tl = ((w1 >> 0) & 0xfff);
tex_tile->sh = ((w2 >> 12) & 0xfff);
@@ -4297,7 +3990,8 @@ static RDP_COMMAND( rdp_set_tile )
tex_tile->shift_s = (w2 >> 0) & 0xf;
tex_tile->fetch_index = (tex_tile->size << 5) | (tex_tile->format << 2) | (other_modes.en_tlut << 1) | other_modes.tlut_type;
- // TODO: clamp & mirror parameters
+ tex_tile->mask_s = (tex_tile->mask_s > 10) ? 10 : tex_tile->mask_s;
+ tex_tile->mask_t = (tex_tile->mask_t > 10) ? 10 : tex_tile->mask_t;
}
static RDP_COMMAND( rdp_fill_rect )
@@ -4395,6 +4089,19 @@ static RDP_COMMAND( rdp_set_combine )
SET_SUB_ALPHA_INPUT(&combiner_alphasub_b[1], combine.sub_b_a1);
SET_MUL_ALPHA_INPUT(&combiner_alphamul[1], combine.mul_a1);
SET_SUB_ALPHA_INPUT(&combiner_alphaadd[1], combine.add_a1);
+
+ if(combiner_rgbsub_a_r[1] == &noise_color.i.r)
+ {
+ COLOR_COMBINER1 = COLOR_COMBINER1_NOISE;
+ COLOR_COMBINER2_C0 = COLOR_COMBINER2_C0_NOISE;
+ COLOR_COMBINER2_C1 = COLOR_COMBINER2_C1_NOISE;
+ }
+ else
+ {
+ COLOR_COMBINER1 = COLOR_COMBINER1_NNOISE;
+ COLOR_COMBINER2_C0 = COLOR_COMBINER2_C0_NNOISE;
+ COLOR_COMBINER2_C1 = COLOR_COMBINER2_C1_NNOISE;
+ }
}
static RDP_COMMAND( rdp_set_texture_image )
@@ -4412,7 +4119,7 @@ static RDP_COMMAND( rdp_set_mask_image )
static RDP_COMMAND( rdp_set_color_image )
{
- fb_format = (w1 >> 21) & 0x7;
+ fb_format = (w1 >> 21) & 0x7;
fb_size = (w1 >> 19) & 0x3;
fb_width = (w1 & 0x3ff) + 1;
fb_address = w2 & 0x01ffffff;
@@ -4521,8 +4228,15 @@ void rdp_process_list(running_machine *machine)
dp_start = dp_current = dp_end;
}
-INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D)
-{
+//INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D)
+//{
+ //*out = cc_lut_base[(*D << 17) + (*C << 9) + *A - *B];
+ /* The speedy, lookup table enabled version */
+ //*out = cc_lut2[(cc_lut1[(*A << 16) | (*B << 8) | *C] << 8) | *D];
+
+ /*
+ The slow, branchy version
+
INT32 color = (((*A-*B)* *C) + (*D << 8) + 0x80);
color >>= 8;
if (color > 255)
@@ -4537,33 +4251,26 @@ INLINE void COMBINER_EQUATION(UINT8 *out, UINT8 *A, UINT8 *B, UINT8 *C, UINT8 *D
{
*out = (UINT8)color;
}
-}
+ */
+//}
INLINE void BLENDER_EQUATION0_FORCE(INT32* r, INT32* g, INT32* b, int bsel_special)
{
- UINT8 blend1a, blend2a;
- UINT32 sum = 0;
+ int blend1a = *blender1b_a[0];
+ int blend2a = *blender2b_a[0];
INT32 tr, tg, tb;
- blend1a = *blender1b_a[0];
- blend2a = *blender2b_a[0];
if (bsel_special)
{
blend1a &= 0xe0;
}
- sum = (((blend1a >> 5) + (blend2a >> 5) + 1) & 0xf) << 5;
-
- tr = (((int)(*blender1a_r[0]) * (int)(blend1a))) +
- (((int)(*blender2a_r[0]) * (int)(blend2a)));
- tr += (bsel_special) ? (((int)(*blender2a_r[0])) << 5) : (((int)(*blender2a_r[0])) << 3);
-
- tg = (((int)(*blender1a_g[0]) * (int)(blend1a))) +
- (((int)(*blender2a_g[0]) * (int)(blend2a)));
- tg += (bsel_special) ? ((int)((*blender2a_g[0])) << 5) : (((int)(*blender2a_g[0])) << 3);
+ tr = (int)(*blender1a_r[0]) * blend1a + (int)(*blender2a_r[0]) * blend2a;
+ tg = (int)(*blender1a_g[0]) * blend1a + (int)(*blender2a_g[0]) * blend2a;
+ tb = (int)(*blender1a_b[0]) * blend1a + (int)(*blender2a_b[0]) * blend2a;
- tb = (((int)(*blender1a_b[0]) * (int)(blend1a))) +
- (((int)(*blender2a_b[0]) * (int)(blend2a)));
- tb += (bsel_special) ? (((int)(*blender2a_b[0])) << 5) : (((int)(*blender2a_b[0])) << 3);
+ tr += ((int)(*blender2a_r[0])) << (3 + bsel_special);
+ tg += ((int)(*blender2a_g[0])) << (3 + bsel_special);
+ tb += ((int)(*blender2a_b[0])) << (3 + bsel_special);
tr >>= 8;
tg >>= 8;
@@ -4791,28 +4498,52 @@ INLINE UINT32 addleftcvg(UINT32 x, UINT32 k)
#undef COLOR_ON_CVG
#include "video/rdpfb.c"
-#define IMGREAD
- #define ZCOMPARE
- #define RGBDITHER1
- #include "video/rdpblend.c"
- #undef RGBDITHER1
- #include "video/rdpblend.c"
- #undef ZCOMPARE
- #define RGBDITHER1
- #include "video/rdpblend.c"
- #undef RGBDITHER1
- #include "video/rdpblend.c"
-#undef IMGREAD
- #define ZCOMPARE
- #define RGBDITHER1
- #include "video/rdpblend.c"
- #undef RGBDITHER1
- #include "video/rdpblend.c"
- #undef ZCOMPARE
- #define RGBDITHER1
- #include "video/rdpblend.c"
- #undef RGBDITHER1
- #include "video/rdpblend.c"
+#define ALPHACOMPARE
+ #define IMGREAD
+ #define ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef IMGREAD
+ #define ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+#undef ALPHACOMPARE
+ #define IMGREAD
+ #define ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef IMGREAD
+ #define ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef ZCOMPARE
+ #define RGBDITHER1
+ #include "video/rdpblend.c"
+ #undef RGBDITHER1
+ #include "video/rdpblend.c"
#include "video/rdpfetch.c"
@@ -4853,195 +4584,626 @@ INLINE UINT32 addleftcvg(UINT32 x, UINT32 k)
#undef BAYERDITHER
#include "video/rdptrect.c"
-#define SHADE
- #define TEXTURE
- #define ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef TEXTURE
- #define ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
-#undef SHADE
- #define TEXTURE
- #define ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef TEXTURE
- #define ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZBUF
- #define FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef FLIP
- #define ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZUPDATE
- #define ZCOMPARE
- #include "video/rdpspn16.c"
- #undef ZCOMPARE
- #include "video/rdpspn16.c"
+#define MAGICDITHER
+ #include "video/rdpfrect.c"
+#undef MAGICDITHER
+#define BAYERDITHER
+ #include "video/rdpfrect.c"
+#undef BAYERDITHER
+ #include "video/rdpfrect.c"
+
+#define MAGICDITHER
+ #define SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+#undef MAGICDITHER
+#define BAYERDITHER
+ #define SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+#undef BAYERDITHER
+ #define SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef SHADE
+ #define TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef TEXTURE
+ #define ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZBUF
+ #define FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef FLIP
+ #define ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZUPDATE
+ #define ZCOMPARE
+ #include "video/rdpspn16.c"
+ #undef ZCOMPARE
+ #include "video/rdpspn16.c"
+
#include "video/rdptri.c"
+#define DOS
+ #define DOT
+ #include "video/rdpclamp.c"
+ #undef DOT
+ #include "video/rdpclamp.c"
+#undef DOS
+ #define DOT
+ #include "video/rdpclamp.c"
+ #undef DOT
+ #include "video/rdpclamp.c"
+
+#define MASK_S
+ #define MASK_T
+ #include "video/rdpmask.c"
+ #undef MASK_T
+ #include "video/rdpmask.c"
+#undef MASK_S
+ #define MASK_T
+ #include "video/rdpmask.c"
+ #undef MASK_T
+ #include "video/rdpmask.c"
+
+#define SHIFT_S
+ #define SHIFT_T
+ #include "video/rdpshift.c"
+ #undef SHIFT_T
+ #include "video/rdpshift.c"
+#undef SHIFT_S
+ #define SHIFT_T
+ #include "video/rdpshift.c"
+ #undef SHIFT_T
+ #include "video/rdpshift.c"
+
+#define NOISE
+ #include "video/rdpcc.c"
+#undef NOISE
+ #include "video/rdpcc.c"
+
diff --git a/src/mame/video/rdpacomp.c b/src/mame/video/rdpacomp.c
index ce796080a17..fb7629f5f56 100644
--- a/src/mame/video/rdpacomp.c
+++ b/src/mame/video/rdpacomp.c
@@ -19,10 +19,6 @@ INLINE int alpha_compare_ac_nda(UINT8 comb_alpha)
INLINE int alpha_compare_ac_da(UINT8 comb_alpha)
{
- if (comb_alpha < (rdp_rand() & 0xff))
- {
- return 0;
- }
- return 1;
+ return comb_alpha < rdp_rand();
}
diff --git a/src/mame/video/rdpacvg.c b/src/mame/video/rdpacvg.c
index 81a4120bcfb..77f4a7b8ab5 100644
--- a/src/mame/video/rdpacvg.c
+++ b/src/mame/video/rdpacvg.c
@@ -57,14 +57,5 @@ INLINE void alpha_cvg_get_cta_nca(UINT8 *comb_alpha)
INLINE void alpha_cvg_get_ncta_nca(UINT8 *comb_alpha)
{
- UINT32 temp = *comb_alpha;
-
- if (temp > 0xff)
- {
- *comb_alpha = 0xff;
- }
- else
- {
- *comb_alpha = (UINT8)temp;
- }
+ // DO nothing
}
diff --git a/src/mame/video/rdpblend.c b/src/mame/video/rdpblend.c
index 15ab5cc01b1..eb331ca681e 100644
--- a/src/mame/video/rdpblend.c
+++ b/src/mame/video/rdpblend.c
@@ -1,29 +1,61 @@
-#if defined(RGBDITHER1)
- #if defined(ZCOMPARE)
- #if defined(IMGREAD)
- INLINE int BLENDER1_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+#if defined(ALPHACOMPARE)
+ #if defined(RGBDITHER1)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#else
- INLINE int BLENDER1_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#endif
#else
- #if defined(IMGREAD)
- INLINE int BLENDER1_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#else
- INLINE int BLENDER1_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#endif
#endif
#else
- #if defined(ZCOMPARE)
- #if defined(IMGREAD)
- INLINE int BLENDER1_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(RGBDITHER1)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#else
- INLINE int BLENDER1_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#endif
#else
- #if defined(IMGREAD)
- INLINE int BLENDER1_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#else
- INLINE int BLENDER1_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith)
+ #endif
#endif
#endif
#endif
@@ -35,11 +67,13 @@
UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
#endif
+#if defined(ALPHACOMPARE)
// Alpha compare
if (!alpha_compare(c.i.a))
{
return 0;
}
+#endif
if (!curpixel_cvg) // New coverage is zero, so abort
{
@@ -57,9 +91,7 @@
curpixel_overlap = 0;
#endif
- memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13);
- memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >> 8) & 0x07);
- memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >> 3) & 0x07);
+ memory_color.c = rgb16_to_32_lut[mem];
#if defined(IMGREAD)
memory_color.i.a = (memory_cvg << 5) & 0xe0;
@@ -67,6 +99,7 @@
memory_color.i.a = 0xe0;
#endif
+#if defined(ZCOMPARE)
if (!curpixel_overlap && !other_modes.force_blend)
{
r = *blender1a_r[0];
@@ -79,6 +112,20 @@
BLENDER_EQUATION0(&r, &g, &b, special_bsel);
}
+#else
+ if (!other_modes.force_blend)
+ {
+ r = *blender1a_r[0];
+ g = *blender1a_g[0];
+ b = *blender1a_b[0];
+ }
+ else
+ {
+ inv_pixel_color.i.a = 0xff - *blender1b_a[0];
+
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+ }
+#endif
#if !defined(RGBDITHER1)
// Hack to prevent "double-dithering" artifacts
@@ -91,32 +138,64 @@
return (FBWRITE_16(fb, hb, r, g, b));
}
-#if defined(RGBDITHER1)
- #if defined(ZCOMPARE)
- #if defined(IMGREAD)
- INLINE int BLENDER2_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+#if defined(ALPHACOMPARE)
+ #if defined(RGBDITHER1)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#else
- INLINE int BLENDER2_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#endif
#else
- #if defined(IMGREAD)
- INLINE int BLENDER2_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#else
- INLINE int BLENDER2_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#endif
#endif
#else
- #if defined(ZCOMPARE)
- #if defined(IMGREAD)
- INLINE int BLENDER2_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(RGBDITHER1)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#else
- INLINE int BLENDER2_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#endif
#else
- #if defined(IMGREAD)
- INLINE int BLENDER2_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#else
- INLINE int BLENDER2_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith)
+ #endif
#endif
#endif
#endif
@@ -128,11 +207,14 @@
UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
#endif
+#if defined(ALPHACOMPARE)
// Alpha compare
if (!alpha_compare(c2.i.a))
{
return 0;
}
+#endif
+
if (!curpixel_cvg)
{
return 0;
@@ -149,9 +231,7 @@
curpixel_overlap = 0;
#endif
- memory_color.i.r = ((mem >> 8) & 0xf8) | (mem >> 13);
- memory_color.i.g = ((mem >> 3) & 0xf8) | ((mem >> 8) & 0x07);
- memory_color.i.b = ((mem << 2) & 0xf8) | ((mem >> 3) & 0x07);
+ memory_color.c = rgb16_to_32_lut[mem];
#if defined(IMGREAD)
memory_color.i.a = (memory_cvg << 5) & 0xe0;
@@ -204,3 +284,212 @@
return (FBWRITE_16(fb, hb, r, g, b));
}
+
+#if !defined(RGBDITHER1)
+#if defined(ALPHACOMPARE)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #endif
+ #endif
+#else
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #else
+ INLINE int BLENDER1_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE int BLENDER1_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #else
+ INLINE int BLENDER1_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c)
+ #endif
+ #endif
+#endif
+{
+ int r, g, b;
+ int special_bsel = 0;
+ UINT16 mem = *fb;
+#if defined(IMGREAD)
+ UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
+#endif
+
+#if defined(ALPHACOMPARE)
+ // Alpha compare
+ if (!alpha_compare(c.i.a))
+ {
+ return 0;
+ }
+#endif
+
+ if (!curpixel_cvg) // New coverage is zero, so abort
+ {
+ return 0;
+ }
+
+ if (blender2b_a[0] == &memory_color.i.a)
+ {
+ special_bsel = 1;
+ }
+
+ pixel_color.c = c.c;
+
+#if !defined(ZCOMPARE)
+ curpixel_overlap = 0;
+#endif
+
+ memory_color.c = rgb16_to_32_lut[mem];
+
+#if defined(IMGREAD)
+ memory_color.i.a = (memory_cvg << 5) & 0xe0;
+#else
+ memory_color.i.a = 0xe0;
+#endif
+
+#if defined(ZCOMPARE)
+ if (!curpixel_overlap && !other_modes.force_blend)
+ {
+ r = *blender1a_r[0];
+ g = *blender1a_g[0];
+ b = *blender1a_b[0];
+ }
+ else
+ {
+ inv_pixel_color.i.a = 0xff - *blender1b_a[0];
+
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+ }
+#else
+ if (!other_modes.force_blend)
+ {
+ r = *blender1a_r[0];
+ g = *blender1a_g[0];
+ b = *blender1a_b[0];
+ }
+ else
+ {
+ inv_pixel_color.i.a = 0xff - *blender1b_a[0];
+
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+ }
+#endif
+
+ return (FBWRITE_16(fb, hb, r, g, b));
+}
+
+#if defined(ALPHACOMPARE)
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #endif
+ #endif
+#else
+ #if defined(ZCOMPARE)
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #else
+ INLINE int BLENDER2_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE int BLENDER2_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #else
+ INLINE int BLENDER2_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2)
+ #endif
+ #endif
+#endif
+{
+ int r, g, b;
+ int special_bsel = 0;
+ UINT16 mem = *fb;
+#if defined(IMGREAD)
+ UINT32 memory_cvg = ((mem & 1) << 2) + (*hb & 3);
+#endif
+
+#if defined(ALPHACOMPARE)
+ // Alpha compare
+ if (!alpha_compare(c2.i.a))
+ {
+ return 0;
+ }
+#endif
+
+ if (!curpixel_cvg)
+ {
+ return 0;
+ }
+
+ if (blender2b_a[0] == &memory_color.i.a)
+ {
+ special_bsel = 1;
+ }
+
+ pixel_color.c = c2.c;
+
+#if !defined(ZCOMPARE)
+ curpixel_overlap = 0;
+#endif
+
+ memory_color.c = rgb16_to_32_lut[mem];
+
+#if defined(IMGREAD)
+ memory_color.i.a = (memory_cvg << 5) & 0xe0;
+#else
+ memory_color.i.a = 0xe0;
+#endif
+
+ inv_pixel_color.i.a = 0xff - *blender1b_a[0];
+
+ BLENDER_EQUATION0(&r, &g, &b, special_bsel);
+
+ blended_pixel_color.i.r = r;
+ blended_pixel_color.i.g = g;
+ blended_pixel_color.i.b = b;
+ blended_pixel_color.i.a = pixel_color.i.a;
+
+ pixel_color.i.r = r;
+ pixel_color.i.g = g;
+ pixel_color.i.b = b;
+
+ inv_pixel_color.i.a = 0xff - *blender1b_a[1];
+
+ if (!curpixel_overlap && !other_modes.force_blend)
+ {
+ r = *blender1a_r[1];
+ g = *blender1a_g[1];
+ b = *blender1a_b[1];
+ }
+ else
+ {
+ if (blender2b_a[1] == &memory_color.i.a)
+ {
+ special_bsel = 1;
+ }
+ else
+ {
+ special_bsel = 0;
+ }
+
+ BLENDER_EQUATION1(&r, &g, &b, special_bsel);
+ }
+
+ return (FBWRITE_16(fb, hb, r, g, b));
+}
+#endif
diff --git a/src/mame/video/rdpblend.h b/src/mame/video/rdpblend.h
index 945506b06ea..298f8e7d347 100644
--- a/src/mame/video/rdpblend.h
+++ b/src/mame/video/rdpblend.h
@@ -1,33 +1,87 @@
-INLINE int BLENDER1_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-INLINE int BLENDER1_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c, int dith);
-
-INLINE int BLENDER2_16_IMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_IMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_IMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_IMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_NIMR_ZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_NIMR_ZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_NIMR_NZC_DITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-INLINE int BLENDER2_16_NIMR_NZC_NDITH(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
-
-static int (*rdp_blender1_16_func[8])(UINT16 *, UINT8 *, COLOR, int) =
+INLINE int BLENDER1_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+
+INLINE int BLENDER2_16_IMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_ZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_ZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_NZC_DITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_NZC_NDITH_NAC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+
+INLINE int BLENDER1_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+INLINE int BLENDER1_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c, int dith);
+
+INLINE int BLENDER2_16_IMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_IMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_ZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_ZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_NZC_DITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+INLINE int BLENDER2_16_NIMR_NZC_NDITH_AC(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2, int dith);
+
+INLINE int BLENDER1_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+
+INLINE int BLENDER2_16_IMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_IMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_NIMR_ZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_NIMR_NZC_NAC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+
+INLINE int BLENDER1_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+INLINE int BLENDER1_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c);
+
+INLINE int BLENDER2_16_IMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_IMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_NIMR_ZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+INLINE int BLENDER2_16_NIMR_NZC_AC_ND(UINT16 *fb, UINT8* hb, COLOR c1, COLOR c2);
+
+static int (*rdp_blender1_16_dith_func[16])(UINT16 *, UINT8 *, COLOR, int) =
+{
+ BLENDER1_16_NIMR_NZC_NDITH_NAC, BLENDER1_16_NIMR_NZC_NDITH_AC, BLENDER1_16_NIMR_NZC_DITH_NAC, BLENDER1_16_NIMR_NZC_DITH_AC,
+ BLENDER1_16_NIMR_ZC_NDITH_NAC, BLENDER1_16_NIMR_ZC_NDITH_AC, BLENDER1_16_NIMR_ZC_DITH_NAC, BLENDER1_16_NIMR_ZC_DITH_AC,
+ BLENDER1_16_IMR_NZC_NDITH_NAC, BLENDER1_16_IMR_NZC_NDITH_AC, BLENDER1_16_IMR_NZC_DITH_NAC, BLENDER1_16_IMR_NZC_DITH_AC,
+ BLENDER1_16_IMR_ZC_NDITH_NAC, BLENDER1_16_IMR_ZC_NDITH_AC, BLENDER1_16_IMR_ZC_DITH_NAC, BLENDER1_16_IMR_ZC_DITH_AC,
+};
+
+static int (*rdp_blender2_16_dith_func[16])(UINT16 *, UINT8 *, COLOR, COLOR, int) =
+{
+ BLENDER2_16_NIMR_NZC_NDITH_NAC, BLENDER2_16_NIMR_NZC_NDITH_AC, BLENDER2_16_NIMR_NZC_DITH_NAC, BLENDER2_16_NIMR_NZC_DITH_AC,
+ BLENDER2_16_NIMR_ZC_NDITH_NAC, BLENDER2_16_NIMR_ZC_NDITH_AC, BLENDER2_16_NIMR_ZC_DITH_NAC, BLENDER2_16_NIMR_ZC_DITH_AC,
+ BLENDER2_16_IMR_NZC_NDITH_NAC, BLENDER2_16_IMR_NZC_NDITH_AC, BLENDER2_16_IMR_NZC_DITH_NAC, BLENDER2_16_IMR_NZC_DITH_AC,
+ BLENDER2_16_IMR_ZC_NDITH_NAC, BLENDER2_16_IMR_ZC_NDITH_AC, BLENDER2_16_IMR_ZC_DITH_NAC, BLENDER2_16_IMR_ZC_DITH_AC,
+};
+
+static int (*rdp_blender1_16_ndith_func[16])(UINT16 *, UINT8 *, COLOR) =
{
- BLENDER1_16_NIMR_NZC_NDITH, BLENDER1_16_NIMR_ZC_NDITH,
- BLENDER1_16_NIMR_ZC_NDITH, BLENDER1_16_NIMR_ZC_DITH,
- BLENDER1_16_IMR_NZC_NDITH, BLENDER1_16_IMR_NZC_DITH,
- BLENDER1_16_IMR_ZC_NDITH, BLENDER1_16_IMR_ZC_DITH,
+ BLENDER1_16_NIMR_NZC_NAC_ND, BLENDER1_16_NIMR_NZC_AC_ND,
+ BLENDER1_16_NIMR_ZC_NAC_ND, BLENDER1_16_NIMR_ZC_AC_ND,
+ BLENDER1_16_IMR_NZC_NAC_ND, BLENDER1_16_IMR_NZC_AC_ND,
+ BLENDER1_16_IMR_ZC_NAC_ND, BLENDER1_16_IMR_ZC_AC_ND,
};
-static int (*rdp_blender2_16_func[8])(UINT16 *, UINT8 *, COLOR, COLOR, int) =
+static int (*rdp_blender2_16_ndith_func[16])(UINT16 *, UINT8 *, COLOR, COLOR) =
{
- BLENDER2_16_NIMR_NZC_NDITH, BLENDER2_16_NIMR_NZC_DITH,
- BLENDER2_16_NIMR_ZC_NDITH, BLENDER2_16_NIMR_ZC_DITH,
- BLENDER2_16_IMR_NZC_NDITH, BLENDER2_16_IMR_NZC_DITH,
- BLENDER2_16_IMR_ZC_NDITH, BLENDER2_16_IMR_ZC_DITH,
+ BLENDER2_16_NIMR_NZC_NAC_ND, BLENDER2_16_NIMR_NZC_AC_ND,
+ BLENDER2_16_NIMR_ZC_NAC_ND, BLENDER2_16_NIMR_ZC_AC_ND,
+ BLENDER2_16_IMR_NZC_NAC_ND, BLENDER2_16_IMR_NZC_AC_ND,
+ BLENDER2_16_IMR_ZC_NAC_ND, BLENDER2_16_IMR_ZC_AC_ND,
};
diff --git a/src/mame/video/rdpcc.c b/src/mame/video/rdpcc.c
new file mode 100644
index 00000000000..48e67f93565
--- /dev/null
+++ b/src/mame/video/rdpcc.c
@@ -0,0 +1,81 @@
+#if defined(NOISE)
+ INLINE UINT32 COLOR_COMBINER1_NOISE(void)
+#else
+ INLINE UINT32 COLOR_COMBINER1_NNOISE(void)
+#endif
+{
+ COLOR c;
+#if defined(NOISE)
+ noise_color.i.r = rdp_rand();
+ noise_color.i.g = rdp_rand();
+ noise_color.i.b = rdp_rand();
+#endif
+
+ c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]);
+ c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]);
+ c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]);
+ c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]);
+
+ //Alpha coverage combiner
+ alpha_cvg_get(&c.i.a);
+
+ return c.c;
+}
+
+#if defined(NOISE)
+ INLINE UINT32 COLOR_COMBINER2_C0_NOISE(void)
+#else
+ INLINE UINT32 COLOR_COMBINER2_C0_NNOISE(void)
+#endif
+{
+ COLOR c;
+#if defined(NOISE)
+ noise_color.i.r = rdp_rand();
+ noise_color.i.g = rdp_rand();
+ noise_color.i.b = rdp_rand();
+#endif
+
+ c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[0],*combiner_rgbsub_b_r[0],*combiner_rgbmul_r[0],*combiner_rgbadd_r[0]);
+ c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[0],*combiner_rgbsub_b_g[0],*combiner_rgbmul_g[0],*combiner_rgbadd_g[0]);
+ c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[0],*combiner_rgbsub_b_b[0],*combiner_rgbmul_b[0],*combiner_rgbadd_b[0]);
+ c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[0],*combiner_alphasub_b[0],*combiner_alphamul[0],*combiner_alphaadd[0]);
+ //COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[0],combiner_rgbsub_b_r[0],combiner_rgbmul_r[0],combiner_rgbadd_r[0]);
+ //COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[0],combiner_rgbsub_b_g[0],combiner_rgbmul_g[0],combiner_rgbadd_g[0]);
+ //COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[0],combiner_rgbsub_b_b[0],combiner_rgbmul_b[0],combiner_rgbadd_b[0]);
+ //COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[0],combiner_alphasub_b[0],combiner_alphamul[0],combiner_alphaadd[0]);
+
+ combined_color.c = c.c;
+
+ return c.c;
+}
+
+#if defined(NOISE)
+ INLINE UINT32 COLOR_COMBINER2_C1_NOISE(void)
+#else
+ INLINE UINT32 COLOR_COMBINER2_C1_NNOISE(void)
+#endif
+{
+ COLOR c;
+ c.c = texel0_color.c;
+ texel0_color.c = texel1_color.c;
+ texel1_color.c = c.c;
+
+#if defined(NOISE)
+ noise_color.i.r = rdp_rand();
+ noise_color.i.g = rdp_rand();
+ noise_color.i.b = rdp_rand();
+#endif
+
+ c.i.r = COMBINER_EQUATION(*combiner_rgbsub_a_r[1],*combiner_rgbsub_b_r[1],*combiner_rgbmul_r[1],*combiner_rgbadd_r[1]);
+ c.i.g = COMBINER_EQUATION(*combiner_rgbsub_a_g[1],*combiner_rgbsub_b_g[1],*combiner_rgbmul_g[1],*combiner_rgbadd_g[1]);
+ c.i.b = COMBINER_EQUATION(*combiner_rgbsub_a_b[1],*combiner_rgbsub_b_b[1],*combiner_rgbmul_b[1],*combiner_rgbadd_b[1]);
+ c.i.a = COMBINER_EQUATION(*combiner_alphasub_a[1],*combiner_alphasub_b[1],*combiner_alphamul[1],*combiner_alphaadd[1]);
+ //COMBINER_EQUATION(&c->i.r, combiner_rgbsub_a_r[1],combiner_rgbsub_b_r[1],combiner_rgbmul_r[1],combiner_rgbadd_r[1]);
+ //COMBINER_EQUATION(&c->i.g, combiner_rgbsub_a_g[1],combiner_rgbsub_b_g[1],combiner_rgbmul_g[1],combiner_rgbadd_g[1]);
+ //COMBINER_EQUATION(&c->i.b, combiner_rgbsub_a_b[1],combiner_rgbsub_b_b[1],combiner_rgbmul_b[1],combiner_rgbadd_b[1]);
+ //COMBINER_EQUATION(&c->i.a, combiner_alphasub_a[1],combiner_alphasub_b[1],combiner_alphamul[1],combiner_alphaadd[1]);
+
+ alpha_cvg_get(&c.i.a);
+
+ return c.c;
+}
diff --git a/src/mame/video/rdpcc.h b/src/mame/video/rdpcc.h
new file mode 100644
index 00000000000..7c8600136e2
--- /dev/null
+++ b/src/mame/video/rdpcc.h
@@ -0,0 +1,6 @@
+INLINE UINT32 COLOR_COMBINER1_NNOISE(void);
+INLINE UINT32 COLOR_COMBINER2_C0_NNOISE(void);
+INLINE UINT32 COLOR_COMBINER2_C1_NNOISE(void);
+INLINE UINT32 COLOR_COMBINER1_NOISE(void);
+INLINE UINT32 COLOR_COMBINER2_C0_NOISE(void);
+INLINE UINT32 COLOR_COMBINER2_C1_NOISE(void);
diff --git a/src/mame/video/rdpclamp.c b/src/mame/video/rdpclamp.c
new file mode 100644
index 00000000000..5f9e87a21b4
--- /dev/null
+++ b/src/mame/video/rdpclamp.c
@@ -0,0 +1,162 @@
+#if defined(DOS)
+ #if defined(DOT)
+ INLINE void CLAMP_NC_DOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #else
+ INLINE void CLAMP_NC_DOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #endif
+#else
+ #if defined(DOT)
+ INLINE void CLAMP_NC_NDOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #else
+ INLINE void CLAMP_NC_NDOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #endif
+#endif
+{
+ //int dosfrac = (tex_tile->cs || !tex_tile->mask_s);
+ //int dotfrac = (tex_tile->ct || !tex_tile->mask_t);
+#if defined(DOS)
+ if (*S & 0x10000)
+ {
+ *S = 0;
+ *SFRAC = 0;
+ }
+ else if (maxs)
+ {
+ *S = clamp_s_diff[tex_tile->num];
+ *SFRAC = 0;
+ }
+ else
+#endif
+ {
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ }
+
+#if defined(DOT)
+ if (*T & 0x10000)
+ {
+ *T = 0;
+ *TFRAC = 0;
+ }
+ else if (maxt)
+ {
+ *T = clamp_t_diff[tex_tile->num];
+ *TFRAC = 0;
+ }
+ else
+#endif
+ {
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+ }
+}
+
+#if defined(DOS)
+ #if defined(DOT)
+ INLINE void CLAMP_LIGHT_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #else
+ INLINE void CLAMP_LIGHT_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #endif
+#else
+ #if defined(DOT)
+ INLINE void CLAMP_LIGHT_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #else
+ INLINE void CLAMP_LIGHT_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
+ #endif
+#endif
+{
+ //int dos = (tex_tile->cs || !tex_tile->mask_s);
+ //int dot = (tex_tile->ct || !tex_tile->mask_t);
+#if defined(DOS)
+ if (*S & 0x10000)
+ {
+ *S = 0;
+ }
+ else if (maxs)
+ {
+ *S = clamp_s_diff[tex_tile->num];
+ }
+ else
+#endif
+ {
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ }
+
+#if defined(DOT)
+ if (*T & 0x10000)
+ {
+ *T = 0;
+ }
+ else if (maxt)
+ {
+ *T = clamp_t_diff[tex_tile->num];
+ }
+ else
+#endif
+ {
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+ }
+}
+
+#if defined(DOS)
+ #if defined(DOT)
+ INLINE void CLAMP_QUICK_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
+ #else
+ INLINE void CLAMP_QUICK_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
+ #endif
+#else
+ #if defined(DOT)
+ INLINE void CLAMP_QUICK_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
+ #else
+ INLINE void CLAMP_QUICK_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
+ #endif
+#endif
+{
+#if defined(DOS)
+ if (*S & 0x10000)
+ {
+ *S = 0;
+ }
+ else if (maxs)
+ {
+ *S = clamp_s_diff[num];
+ }
+ else
+#endif
+ {
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ }
+
+#if defined(DOT)
+ if (*T & 0x10000)
+ {
+ *T = 0;
+ }
+ else if (maxt)
+ {
+ *T = clamp_t_diff[num];
+ }
+ else
+#endif
+ {
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+ }
+}
+
+#if defined(DOS) && defined(DOT)
+INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile)
+{
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+}
+
+INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile)
+{
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+}
+
+INLINE void CLAMP_QUICK_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num)
+{
+ *S = (SIGN17(*S) >> 5) & 0x1fff;
+ *T = (SIGN17(*T) >> 5) & 0x1fff;
+}
+#endif
diff --git a/src/mame/video/rdpclamp.h b/src/mame/video/rdpclamp.h
new file mode 100644
index 00000000000..77339731fa4
--- /dev/null
+++ b/src/mame/video/rdpclamp.h
@@ -0,0 +1,36 @@
+INLINE void CLAMP_NC_NDOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_NC_NDOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_NC_DOS_NDOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_NC_DOS_DOT(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+
+INLINE void CLAMP_LIGHT_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_LIGHT_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_LIGHT_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_LIGHT_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+
+INLINE void CLAMP_QUICK_NC_NDOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
+INLINE void CLAMP_QUICK_NC_NDOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
+INLINE void CLAMP_QUICK_NC_DOS_NDOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
+INLINE void CLAMP_QUICK_NC_DOS_DOT(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
+
+INLINE void CLAMP_C(INT32* S, INT32* T, INT32* SFRAC, INT32* TFRAC, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_LIGHT_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, TILE* tex_tile);
+INLINE void CLAMP_QUICK_C(INT32* S, INT32* T, INT32 maxs, INT32 maxt, int num);
+
+static void (*rdp_clamp_func[8])(INT32*, INT32*, INT32*, INT32*, INT32, INT32, TILE*) =
+{
+ CLAMP_NC_NDOS_NDOT, CLAMP_NC_NDOS_DOT, CLAMP_NC_DOS_NDOT, CLAMP_NC_DOS_DOT,
+ CLAMP_C, CLAMP_C, CLAMP_C, CLAMP_C,
+};
+
+static void (*rdp_clamp_light_func[8])(INT32*, INT32*, INT32, INT32, TILE*) =
+{
+ CLAMP_LIGHT_NC_NDOS_NDOT, CLAMP_LIGHT_NC_NDOS_DOT, CLAMP_LIGHT_NC_DOS_NDOT, CLAMP_LIGHT_NC_DOS_DOT,
+ CLAMP_LIGHT_C, CLAMP_LIGHT_C, CLAMP_LIGHT_C, CLAMP_LIGHT_C,
+};
+
+static void (*rdp_clamp_quick_func[8])(INT32*, INT32*, INT32, INT32, int) =
+{
+ CLAMP_QUICK_NC_NDOS_NDOT, CLAMP_QUICK_NC_NDOS_DOT, CLAMP_QUICK_NC_DOS_NDOT, CLAMP_QUICK_NC_DOS_DOT,
+ CLAMP_QUICK_C, CLAMP_QUICK_C, CLAMP_QUICK_C, CLAMP_QUICK_C,
+};
diff --git a/src/mame/video/rdpfetch.c b/src/mame/video/rdpfetch.c
index de22d99740e..00b0c32dd09 100644
--- a/src/mame/video/rdpfetch.c
+++ b/src/mame/video/rdpfetch.c
@@ -1,136 +1,92 @@
-INLINE void FETCH_TEXEL_RGBA4_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[(((tpal << 4) | p) ^ WORD_ADDR_XOR) << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ return rgb16_to_32_lut[tlut[((cached_tpal | p) ^ WORD_ADDR_XOR) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA4_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[(((tpal << 4) | p) ^ WORD_ADDR_XOR) << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ return ia8_to_32_lut[tlut[((cached_tpal | p) ^ WORD_ADDR_XOR) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA4_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- color->i.r = color->i.g = color->i.b = color->i.a = (tpal << 4) | p;
+ return (cached_tpal | p) * 0x01010101;
}
-INLINE void FETCH_TEXEL_RGBA8_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[(p ^ WORD_ADDR_XOR) << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ return rgb16_to_32_lut[tlut[(TMEM[taddr ^ BYTE_ADDR_XOR] ^ WORD_ADDR_XOR) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA8_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[(p ^ WORD_ADDR_XOR) << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ return ia8_to_32_lut[tlut[(TMEM[taddr ^ BYTE_ADDR_XOR] ^ WORD_ADDR_XOR) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA8_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
-
- color->i.r = color->i.g = color->i.b = color->i.a = p;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
}
-INLINE void FETCH_TEXEL_RGBA16_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- c = tlut[(c >> 8) << 2];
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return rgb16_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA16_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- c = tlut[(c >> 8) << 2];
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return ia8_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA16_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return rgb16_to_32_lut[TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]];
}
-INLINE void FETCH_TEXEL_RGBA32_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN0(UINT32 s, UINT32 t)
{
int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
- int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- UINT32 c = TMEM32[taddr];
+ UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- c = tlut[(c >> 24) << 2];
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ return rgb16_to_32_lut[tlut[(TMEM32[taddr] >> 24) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA32_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN1(UINT32 s, UINT32 t)
{
int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
- int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- UINT32 c = TMEM32[taddr];
+ UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- c = tlut[(c >> 24) << 2];
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ return ia8_to_32_lut[tlut[(TMEM32[taddr] >> 24) << 2]];
}
-INLINE void FETCH_TEXEL_RGBA32_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_NEN(UINT32 s, UINT32 t)
{
int xorval = (fb_size == PIXEL_SIZE_16BIT) ? XOR_SWAP_WORD : XOR_SWAP_DWORD; // Conker's Bad Fur Day, Jet Force Gemini, Super Smash Bros., Mickey's Speedway USA, Ogre Battle, Wave Race, Gex 3, South Park Rally
- int taddr = (((tbase >> 2) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- UINT32 c = TMEM32[taddr];
+ UINT32 taddr = (((cached_tbase >> 2) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? xorval : 0)) & 0x3ff;
- color->c = c;
+ return TMEM32[taddr];
}
-INLINE void FETCH_TEXEL_YUV16(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_YUV16(UINT32 s, UINT32 t)
{ // YUV: Bottom of the 9th, Pokemon Stadium, Ogre Battle 64
INT32 newr = 0;
INT32 newg = 0;
INT32 newb = 0;
- int taddr = ((tbase >> 1) + ((t) * (twidth)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c1, c2;
+ UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ UINT32 c1, c2;
INT32 y;
INT32 u, v;
c1 = TMEM16[taddr ^ WORD_ADDR_XOR];
@@ -157,285 +113,181 @@ INLINE void FETCH_TEXEL_YUV16(COLOR *color, int s, int t)
newg = y + ((k1 * u) >> 8) + ((k2 * v) >> 8);
newb = y + ((k3 * u) >> 8);
}
- color->i.r = (newr < 0) ? 0 : ((newr > 0xff) ? 0xff : newr);
- color->i.g = (newg < 0) ? 0 : ((newg > 0xff) ? 0xff : newg);
- color->i.b = (newb < 0) ? 0 : ((newb > 0xff) ? 0xff : newb);
- color->i.a = 0xff;
+ return (((newr < 0) ? 0 : ((newr > 0xff) ? 0xff : newr)) << 24) |
+ (((newg < 0) ? 0 : ((newg > 0xff) ? 0xff : newg)) << 16) |
+ (((newb < 0) ? 0 : ((newb > 0xff) ? 0xff : newb)) << 8) |
+ 0xff;
}
-INLINE void FETCH_TEXEL_CI4_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[((tpal << 4) | p) << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 b = TMEM[(((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff) ^ BYTE_ADDR_XOR];
+ return rgb16_to_32_lut[tlut[(cached_tpal | (((s) & 1) ? (b & 0xf) : (b >> 4))) << 2]];
}
-INLINE void FETCH_TEXEL_CI4_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[((tpal << 4) | p) << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ return ia8_to_32_lut[tlut[(cached_tpal | p) << 2]];
}
-INLINE void FETCH_TEXEL_CI4_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- color->i.r = color->i.g = color->i.b = color->i.a = (tpal << 4) | p;
+ return (cached_tpal | p) * 0x01010101;
}
-INLINE void FETCH_TEXEL_CI8_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[p << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ return rgb16_to_32_lut[tlut[TMEM[(((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff) ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_CI8_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[p << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
- color->c = 0xffffffff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_CI8_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
-
- color->i.r = color->i.g = color->i.b = color->i.a = p;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0x7ff;
+ return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
}
-INLINE void FETCH_TEXEL_CI16_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN0(UINT32 s, UINT32 t)
{ // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- c = tlut[(c >> 8) << 2];
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return rgb16_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]];
}
-INLINE void FETCH_TEXEL_CI16_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN1(UINT32 s, UINT32 t)
{ // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- // Beetle Adventure Racing, Mount Mayhem
- c = tlut[(c >> 8) << 2];
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return ia8_to_32_lut[tlut[(TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR] >> 8) << 2]]; // Beetle Adventure Racing, Mount Mayhem
}
-INLINE void FETCH_TEXEL_CI16_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_NEN(UINT32 s, UINT32 t)
{ // 16-bit CI is a "valid" mode; some games use it, it behaves the same as 16-bit RGBA
- int taddr = ((tbase>>1) + ((t) * (twidth>>1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]; // PGA European Tour (U)
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase_s1) + ((t) * (cached_twidth_s1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return rgb16_to_32_lut[TMEM16[(taddr & 0x7ff) ^ WORD_ADDR_XOR]]; // PGA European Tour (U)
}
-INLINE void FETCH_TEXEL_IA4_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[((tpal << 4) | p) << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ return rgb16_to_32_lut[tlut[(cached_tpal | p) << 2]];
}
-INLINE void FETCH_TEXEL_IA4_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 c = tlut[((tpal << 4) | p) << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ return ia8_to_32_lut[tlut[(cached_tpal | p) << 2]];
}
-INLINE void FETCH_TEXEL_IA4_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = (tbase + ((t) * twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
- UINT8 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT8 i = ((p & 0xe) << 4) | ((p & 0xe) << 1) | (p & 0xe >> 2);
+ UINT32 taddr = (cached_tbase + ((t) * cached_twidth) + (s >> 1)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0);
+ UINT32 p = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ UINT32 i = ((p & 0xe) << 4) | ((p & 0xe) << 1) | (p & 0xe >> 2);
- color->i.r = i;
- color->i.g = i;
- color->i.b = i;
- color->i.a = (p & 0x1) ? 0xff : 0;
+ return (i * 0x01010100) | ((p & 0x1) ? 0xff : 0);
}
-INLINE void FETCH_TEXEL_IA8_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[p << 2];
-
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ return rgb16_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_IA8_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 c = tlut[p << 2];
-
- color->i.r = color->i.g = color->i.b = (c >> 8) & 0xff;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_IA8_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 p = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT8 i = (p >> 4) | (p & 0xf0);
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ UINT32 p = TMEM[taddr ^ BYTE_ADDR_XOR];
+ UINT32 i = (p >> 4) | (p & 0xf0);
- color->i.r = i;
- color->i.g = i;
- color->i.b = i;
- color->i.a = (p & 0xf) | ((p << 4) & 0xf0);
+ return (i * 0x01010100) | ((p & 0xf) | ((p << 4) & 0xf0));
}
-INLINE void FETCH_TEXEL_IA16_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
-
- c = tlut[(c >> 8) << 2];
- color->i.r = ((c >> 8) & 0xf8) | (c >> 13);
- color->i.g = ((c >> 3) & 0xf8) | ((c >> 8) & 0x07);
- color->i.b = ((c << 2) & 0xf8) | ((c >> 3) & 0x07);
- color->i.a = (c & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return rgb16_to_32_lut[tlut[(TMEM16[taddr ^ WORD_ADDR_XOR] >> 8) << 2]];
}
-INLINE void FETCH_TEXEL_IA16_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
-
- c = tlut[(c >> 8) << 2];
- color->i.r = c >> 8;
- color->i.g = c >> 8;
- color->i.b = c >> 8;
- color->i.a = c & 0xff;
+ UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ return ia8_to_32_lut[tlut[(TMEM16[taddr ^ WORD_ADDR_XOR] >> 8) << 2]];
}
-INLINE void FETCH_TEXEL_IA16_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase >> 1) + ((t) * (twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
- UINT16 c = TMEM16[taddr ^ WORD_ADDR_XOR];
- UINT8 i = (c >> 8);
+ UINT32 taddr = ((cached_tbase >> 1) + ((t) * (cached_twidth >> 1)) + (s)) ^ ((t & 1) ? XOR_SWAP_WORD : 0);
+ UINT32 c = TMEM16[taddr ^ WORD_ADDR_XOR];
- color->i.r = i;
- color->i.g = i;
- color->i.b = i;
- color->i.a = c & 0xff;
+ return ((c >> 8) * 0x01010100) | (c & 0xff);
}
-INLINE void FETCH_TEXEL_I4_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 k;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
c |= (c << 4);
- k = tlut[((tpal << 4) | c) << 2];
- color->i.r = ((k >> 8) & 0xf8) | (k >> 13);
- color->i.g = ((k >> 3) & 0xf8) | ((k >> 8) & 0x07);
- color->i.b = ((k << 2) & 0xf8) | ((k >> 3) & 0x07);
- color->i.a = (k & 1) ? 0xff : 0;
+ return rgb16_to_32_lut[tlut[(cached_tpal | c) << 2]];
}
-INLINE void FETCH_TEXEL_I4_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
- UINT16 k;
-
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
c |= (c << 4);
- k = tlut[((tpal << 4) | c) << 2];
- color->i.r = color->i.g = color->i.b = (k >> 8) & 0xff;
- color->i.a = k & 0xff;
+
+ return ia8_to_32_lut[tlut[(cached_tpal | c) << 2]];
}
-INLINE void FETCH_TEXEL_I4_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s) / 2)) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ UINT32 c = ((s) & 1) ? (TMEM[taddr ^ BYTE_ADDR_XOR] & 0xf) : (TMEM[taddr ^ BYTE_ADDR_XOR] >> 4);
c |= (c << 4);
- color->i.r = c;
- color->i.g = c;
- color->i.b = c;
- color->i.a = c;
+ return (c * 0x01010101);
}
-INLINE void FETCH_TEXEL_I8_TLUT_EN0(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN0(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 k = tlut[ c << 2];
-
- color->i.r = ((k >> 8) & 0xf8) | (k >> 13);
- color->i.g = ((k >> 3) & 0xf8) | ((k >> 8) & 0x07);
- color->i.b = ((k << 2) & 0xf8) | ((k >> 3) & 0x07);
- color->i.a = (k & 1) ? 0xff : 0;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ return rgb16_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_I8_TLUT_EN1(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN1(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
- UINT16 k = tlut[ c << 2];
-
- color->i.r = color->i.g = color->i.b = (k >> 8) & 0xff;
- color->i.a = k & 0xff;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ return ia8_to_32_lut[tlut[TMEM[taddr ^ BYTE_ADDR_XOR] << 2]];
}
-INLINE void FETCH_TEXEL_I8_TLUT_NEN(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_NEN(UINT32 s, UINT32 t)
{
- int taddr = ((tbase + ((t) * twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
- UINT8 c = TMEM[taddr ^ BYTE_ADDR_XOR];
-
- color->i.r = c;
- color->i.g = c;
- color->i.b = c;
- color->i.a = c;
+ UINT32 taddr = ((cached_tbase + ((t) * cached_twidth) + ((s))) ^ ((t & 1) ? XOR_SWAP_BYTE : 0)) & 0xfff;
+ return TMEM[taddr ^ BYTE_ADDR_XOR] * 0x01010101;
}
-INLINE void FETCH_TEXEL_INVALID(COLOR *color, int s, int t)
+INLINE UINT32 FETCH_TEXEL_INVALID(UINT32 s, UINT32 t)
{
- //printf("Invalid texel mode\n");
+ printf("Invalid texel mode\n");
+ return 0;
}
-//typedef void (*rdp_fetch_texel_func)(COLOR *color, int s, int t);
+//typedef void (*rdp_fetch_texel_func)(UINT32 s, UINT32 t);
diff --git a/src/mame/video/rdpfetch.h b/src/mame/video/rdpfetch.h
index 453e66f875b..60f3a756a8f 100644
--- a/src/mame/video/rdpfetch.h
+++ b/src/mame/video/rdpfetch.h
@@ -1,81 +1,81 @@
-INLINE void FETCH_TEXEL_RGBA4_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA4_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA4_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA8_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA8_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA8_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA16_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA16_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA16_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA32_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA32_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_RGBA32_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_YUV16(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI4_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI4_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI4_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI8_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI8_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI8_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI16_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI16_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_CI16_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA4_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA4_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA4_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA8_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA8_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA8_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA16_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA16_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_IA16_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I4_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I4_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I4_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I8_TLUT_EN0(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I8_TLUT_EN1(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_I8_TLUT_NEN(COLOR *color, int s, int t);
-INLINE void FETCH_TEXEL_INVALID(COLOR *color, int s, int t);
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA4_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA8_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA16_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_RGBA32_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_YUV16(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI4_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI8_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_CI16_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA4_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA8_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_IA16_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I4_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN0(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_EN1(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_I8_TLUT_NEN(UINT32 s, UINT32 t);
+INLINE UINT32 FETCH_TEXEL_INVALID(UINT32 s, UINT32 t);
-static void (*rdp_fetch_texel_func[128])(COLOR*, int, int) =
+static UINT32 (*rdp_fetch_texel_func[128])(UINT32, UINT32) =
{
// 4-bit accessors
FETCH_TEXEL_RGBA4_TLUT_NEN, FETCH_TEXEL_RGBA4_TLUT_NEN, FETCH_TEXEL_RGBA4_TLUT_EN0, FETCH_TEXEL_RGBA4_TLUT_EN1,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_CI4_TLUT_NEN, FETCH_TEXEL_CI4_TLUT_NEN, FETCH_TEXEL_CI4_TLUT_EN0, FETCH_TEXEL_CI4_TLUT_EN1,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_CI4_TLUT_NEN, FETCH_TEXEL_CI4_TLUT_NEN, FETCH_TEXEL_CI4_TLUT_EN0, FETCH_TEXEL_CI4_TLUT_EN1,
FETCH_TEXEL_IA4_TLUT_NEN, FETCH_TEXEL_IA4_TLUT_NEN, FETCH_TEXEL_IA4_TLUT_EN0, FETCH_TEXEL_IA4_TLUT_EN1,
FETCH_TEXEL_I4_TLUT_NEN, FETCH_TEXEL_I4_TLUT_NEN, FETCH_TEXEL_I4_TLUT_EN0, FETCH_TEXEL_I4_TLUT_EN1,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
// 8-bit accessors
FETCH_TEXEL_RGBA8_TLUT_NEN, FETCH_TEXEL_RGBA8_TLUT_NEN, FETCH_TEXEL_RGBA8_TLUT_EN0, FETCH_TEXEL_RGBA8_TLUT_EN1,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_CI8_TLUT_NEN, FETCH_TEXEL_CI8_TLUT_NEN, FETCH_TEXEL_CI8_TLUT_EN0, FETCH_TEXEL_CI8_TLUT_EN1,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_CI8_TLUT_NEN, FETCH_TEXEL_CI8_TLUT_NEN, FETCH_TEXEL_CI8_TLUT_EN0, FETCH_TEXEL_CI8_TLUT_EN1,
FETCH_TEXEL_IA8_TLUT_NEN, FETCH_TEXEL_IA8_TLUT_NEN, FETCH_TEXEL_IA8_TLUT_EN0, FETCH_TEXEL_IA8_TLUT_EN1,
FETCH_TEXEL_I8_TLUT_NEN, FETCH_TEXEL_I8_TLUT_NEN, FETCH_TEXEL_I8_TLUT_EN0, FETCH_TEXEL_I8_TLUT_EN1,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
// 16-bit accessors
FETCH_TEXEL_RGBA16_TLUT_NEN,FETCH_TEXEL_RGBA16_TLUT_NEN,FETCH_TEXEL_RGBA16_TLUT_EN0,FETCH_TEXEL_RGBA16_TLUT_EN1,
- FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16,
- FETCH_TEXEL_CI16_TLUT_NEN, FETCH_TEXEL_CI16_TLUT_NEN, FETCH_TEXEL_CI16_TLUT_EN0, FETCH_TEXEL_CI16_TLUT_EN1,
+ FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16, FETCH_TEXEL_YUV16,
+ FETCH_TEXEL_CI16_TLUT_NEN, FETCH_TEXEL_CI16_TLUT_NEN, FETCH_TEXEL_CI16_TLUT_EN0, FETCH_TEXEL_CI16_TLUT_EN1,
FETCH_TEXEL_IA16_TLUT_NEN, FETCH_TEXEL_IA16_TLUT_NEN, FETCH_TEXEL_IA16_TLUT_EN0, FETCH_TEXEL_IA16_TLUT_EN1,
FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
// 32-bit accessors
FETCH_TEXEL_RGBA32_TLUT_NEN,FETCH_TEXEL_RGBA32_TLUT_NEN,FETCH_TEXEL_RGBA32_TLUT_EN0,FETCH_TEXEL_RGBA32_TLUT_EN1,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
- FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
+ FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID, FETCH_TEXEL_INVALID,
};
diff --git a/src/mame/video/rdpfrect.c b/src/mame/video/rdpfrect.c
new file mode 100644
index 00000000000..317517301aa
--- /dev/null
+++ b/src/mame/video/rdpfrect.c
@@ -0,0 +1,325 @@
+#if defined(MAGICDITHER)
+ static void fill_rectangle_16bit_c1_dm(RECTANGLE *rect)
+#elif defined(BAYERDITHER)
+ static void fill_rectangle_16bit_c1_db(RECTANGLE *rect)
+#else
+ static void fill_rectangle_16bit_c1_dn(RECTANGLE *rect)
+#endif
+{
+ UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
+ UINT8* hb = &hidden_bits[fb_address >> 1];
+
+ int index, i, j;
+ int x1 = rect->xh / 4;
+ int x2 = rect->xl / 4;
+ int y1 = rect->yh / 4;
+ int y2 = rect->yl / 4;
+ int clipx1, clipx2, clipy1, clipy2;
+ UINT16 fill_color1, fill_color2;
+ int fill_cvg1;
+ int fill_cvg2;
+
+ if (x2 <= x1)
+ {
+ x2=x1+1; // SCARS (E)
+ }
+ if (y2 == y1)
+ {
+ y2=y1+1; // Goldeneye
+ }
+
+
+ fill_color1 = (fill_color >> 16) & 0xffff;
+ fill_color2 = (fill_color >> 0) & 0xffff;
+ fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
+ fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
+
+ clipx1 = clip.xh / 4;
+ clipx2 = clip.xl / 4;
+ clipy1 = clip.yh / 4;
+ clipy2 = clip.yl / 4;
+
+ // clip
+ if (x1 < clipx1)
+ {
+ x1 = clipx1;
+ }
+ if (y1 < clipy1)
+ {
+ y1 = clipy1;
+ }
+ if (x2 >= clipx2)
+ {
+ x2 = clipx2-1;
+ }
+ if (y2 >= clipy2)
+ {
+ y2 = clipy2-1;
+ }
+
+ shade_color.c = 0; // Needed by Command & Conquer menus
+
+#if defined(MAGIC_DITHER)
+ for (j = y1; j <= y2; j++)
+ {
+ COLOR c;
+ int dith = 0;
+ index = j * fb_width;
+ for (i = x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c.c = COLOR_COMBINER1();
+ dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
+ BLENDER1_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
+ }
+ }
+#elif defined(BAYER_DITHER)
+ for (j = y1; j <= y2; j++)
+ {
+ COLOR c;
+ int dith = 0;
+ index = j * fb_width;
+ for (i = x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c.c = COLOR_COMBINER1();
+ dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
+ BLENDER1_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c, dith);
+ }
+ }
+#else
+ for (j = y1; j <= y2; j++)
+ {
+ COLOR c;
+ index = j * fb_width;
+ for (i = x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c.c = COLOR_COMBINER1();
+ BLENDER1_16_NDITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c);
+ }
+ }
+#endif
+}
+
+#if defined(MAGICDITHER)
+ static void fill_rectangle_16bit_c2_dm(RECTANGLE *rect)
+#elif defined(BAYERDITHER)
+ static void fill_rectangle_16bit_c2_db(RECTANGLE *rect)
+#else
+ static void fill_rectangle_16bit_c2_dn(RECTANGLE *rect)
+#endif
+{
+ UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
+ UINT8* hb = &hidden_bits[fb_address >> 1];
+
+ int index, i, j;
+ int x1 = rect->xh / 4;
+ int x2 = rect->xl / 4;
+ int y1 = rect->yh / 4;
+ int y2 = rect->yl / 4;
+ int clipx1, clipx2, clipy1, clipy2;
+ UINT16 fill_color1, fill_color2;
+ int fill_cvg1;
+ int fill_cvg2;
+
+ if (x2 <= x1)
+ {
+ x2=x1+1; // SCARS (E)
+ }
+ if (y2 == y1)
+ {
+ y2=y1+1; // Goldeneye
+ }
+
+
+ fill_color1 = (fill_color >> 16) & 0xffff;
+ fill_color2 = (fill_color >> 0) & 0xffff;
+ fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
+ fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
+
+ clipx1 = clip.xh / 4;
+ clipx2 = clip.xl / 4;
+ clipy1 = clip.yh / 4;
+ clipy2 = clip.yl / 4;
+
+ // clip
+ if (x1 < clipx1)
+ {
+ x1 = clipx1;
+ }
+ if (y1 < clipy1)
+ {
+ y1 = clipy1;
+ }
+ if (x2 >= clipx2)
+ {
+ x2 = clipx2-1;
+ }
+ if (y2 >= clipy2)
+ {
+ y2 = clipy2-1;
+ }
+
+ shade_color.c = 0; // Needed by Command & Conquer menus
+
+#if defined(MAGIC_DITHER)
+ for (j=y1; j <= y2; j++)
+ {
+ COLOR c1, c2;
+ int dith = 0;
+ index = j * fb_width;
+ for (i=x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
+ dith = magic_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
+ BLENDER2_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
+ }
+ }
+#elif defined(BAYER_DITHER)
+ for (j=y1; j <= y2; j++)
+ {
+ COLOR c1, c2;
+ int dith = 0;
+ index = j * fb_width;
+ for (i=x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
+ dith = bayer_matrix[(((j) & 3) << 2) + ((i ^ WORD_ADDR_XOR) & 3)];
+ BLENDER2_16_DITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2, dith);
+ }
+ }
+#else
+ for (j=y1; j <= y2; j++)
+ {
+ COLOR c1, c2;
+ index = j * fb_width;
+ for (i=x1; i <= x2; i++)
+ {
+ curpixel_cvg = (i & 1) ? fill_cvg1 : fill_cvg2;
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
+ BLENDER2_16_NDITH(&fb[(index + i) ^ WORD_ADDR_XOR], &hb[(index + i) ^ BYTE_ADDR_XOR], c1, c2);
+ }
+ }
+#endif
+}
+
+#if defined(MAGICDITHER)
+static void fill_rectangle_16bit_cc(RECTANGLE *rect)
+{
+ fatalerror("fill_rectangle_16bit: cycle type copy");
+}
+#endif
+
+#if defined(MAGICDITHER)
+static void fill_rectangle_16bit_cf(RECTANGLE *rect)
+{
+ UINT16 *fb = (UINT16*)&rdram[(fb_address / 4)];
+ UINT8* hb = &hidden_bits[fb_address >> 1];
+
+ int index, i, j;
+ int x1 = rect->xh / 4;
+ int x2 = rect->xl / 4;
+ int y1 = rect->yh / 4;
+ int y2 = rect->yl / 4;
+ int clipx1, clipx2, clipy1, clipy2;
+ UINT16 fill_color1, fill_color2;
+ int fill_cvg1;
+ int fill_cvg2;
+
+ if (x2 <= x1)
+ {
+ x2=x1+1; // SCARS (E)
+ }
+ if (y2 == y1)
+ {
+ y2=y1+1; // Goldeneye
+ }
+
+
+ fill_color1 = (fill_color >> 16) & 0xffff;
+ fill_color2 = (fill_color >> 0) & 0xffff;
+ fill_cvg1 = (fill_color1 & 1) ? 8 : 1;
+ fill_cvg2 = (fill_color2 & 1) ? 8 : 1;
+
+ clipx1 = clip.xh / 4;
+ clipx2 = clip.xl / 4;
+ clipy1 = clip.yh / 4;
+ clipy2 = clip.yl / 4;
+
+ // clip
+ if (x1 < clipx1)
+ {
+ x1 = clipx1;
+ }
+ if (y1 < clipy1)
+ {
+ y1 = clipy1;
+ }
+ if (x2 >= clipx2)
+ {
+ x2 = clipx2-1;
+ }
+ if (y2 >= clipy2)
+ {
+ y2 = clipy2-1;
+ }
+
+ shade_color.c = 0; // Needed by Command & Conquer menus
+
+ fill_cvg1 = (fill_color1 & 1) ? 3 : 0;
+ fill_cvg2 = (fill_color2 & 1) ? 3 : 0;
+
+ if(x1 & 1)
+ {
+ for (j=y1; j <= y2; j++)
+ {
+ index = j * fb_width;
+ for (i=x1; i <= x2; i += 2)
+ {
+ int curpixel = index + i;
+ fb[curpixel ^ WORD_ADDR_XOR] = fill_color2;
+ hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg2;
+ }
+ }
+ for (j=y1; j <= y2; j++)
+ {
+ index = j * fb_width;
+ for (i=x1+1; i <= x2; i += 2)
+ {
+ int curpixel = index + i;
+ fb[curpixel ^ WORD_ADDR_XOR] = fill_color1;
+ hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg1;
+ }
+ }
+ }
+ else
+ {
+ for (j=y1; j <= y2; j++)
+ {
+ index = j * fb_width;
+ for (i=x1; i <= x2; i += 2)
+ {
+ int curpixel = index + i;
+ fb[curpixel ^ WORD_ADDR_XOR] = fill_color1;
+ hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg1;
+ }
+ }
+ for (j=y1; j <= y2; j++)
+ {
+ index = j * fb_width;
+ for (i=x1+1; i <= x2; i += 2)
+ {
+ int curpixel = index + i;
+ fb[curpixel ^ WORD_ADDR_XOR] = fill_color2;
+ hb[curpixel ^ BYTE_ADDR_XOR] = fill_cvg2;
+ }
+ }
+ }
+}
+#endif
diff --git a/src/mame/video/rdpfrect.h b/src/mame/video/rdpfrect.h
new file mode 100644
index 00000000000..469edb9f81c
--- /dev/null
+++ b/src/mame/video/rdpfrect.h
@@ -0,0 +1,16 @@
+static void fill_rectangle_16bit_c1_dm(RECTANGLE *rect);
+static void fill_rectangle_16bit_c1_db(RECTANGLE *rect);
+static void fill_rectangle_16bit_c1_dn(RECTANGLE *rect);
+static void fill_rectangle_16bit_c2_dm(RECTANGLE *rect);
+static void fill_rectangle_16bit_c2_db(RECTANGLE *rect);
+static void fill_rectangle_16bit_c2_dn(RECTANGLE *rect);
+static void fill_rectangle_16bit_cc(RECTANGLE *rect);
+static void fill_rectangle_16bit_cf(RECTANGLE *rect);
+
+static void (*rdp_fill_rectangle_16bit_func[16])(RECTANGLE *) =
+{
+ fill_rectangle_16bit_c1_dm, fill_rectangle_16bit_c1_db, fill_rectangle_16bit_c1_dn, fill_rectangle_16bit_c1_dn,
+ fill_rectangle_16bit_c2_dm, fill_rectangle_16bit_c2_db, fill_rectangle_16bit_c2_dn, fill_rectangle_16bit_c2_dn,
+ fill_rectangle_16bit_cc, fill_rectangle_16bit_cc, fill_rectangle_16bit_cc, fill_rectangle_16bit_cc,
+ fill_rectangle_16bit_cf, fill_rectangle_16bit_cf, fill_rectangle_16bit_cf, fill_rectangle_16bit_cf,
+};
diff --git a/src/mame/video/rdpmask.c b/src/mame/video/rdpmask.c
new file mode 100644
index 00000000000..4794a36e56f
--- /dev/null
+++ b/src/mame/video/rdpmask.c
@@ -0,0 +1,48 @@
+#if defined(MASK_S)
+ #if defined(MASK_T)
+ INLINE void MASK_S_T(INT32* S, INT32* T, TILE* tex_tile)
+ #else
+ INLINE void MASK_S_NT(INT32* S, INT32* T, TILE* tex_tile)
+ #endif
+#else
+ #if defined(MASK_T)
+ INLINE void MASK_NS_T(INT32* S, INT32* T, TILE* tex_tile)
+ #else
+ INLINE void MASK_NS_NT(INT32* S, INT32* T, TILE* tex_tile)
+ #endif
+#endif
+{
+#if defined(MASK_S)
+ INT32 swrap;
+#endif
+#if defined(MASK_T)
+ INT32 twrap;
+#endif
+
+#if defined(MASK_S)
+ swrap = *S >> tex_tile->mask_s;
+ swrap &= 1;
+ if (tex_tile->ms && swrap)
+ {
+ *S = (~(*S)) & maskbits_table[tex_tile->mask_s]; // Mirroring and masking
+ }
+ else
+ {
+ *S &= maskbits_table[tex_tile->mask_s]; // Masking
+ }
+#endif
+
+#if defined(MASK_T)
+ twrap = *T >> tex_tile->mask_t;
+ twrap &= 1;
+ if (tex_tile->mt && twrap)
+ {
+ *T = (~(*T)) & maskbits_table[tex_tile->mask_t]; // Mirroring and masking
+ }
+ else
+ {
+ *T &= maskbits_table[tex_tile->mask_t];
+ }
+#endif
+}
+
diff --git a/src/mame/video/rdpmask.h b/src/mame/video/rdpmask.h
new file mode 100644
index 00000000000..dbbb7d5ceee
--- /dev/null
+++ b/src/mame/video/rdpmask.h
@@ -0,0 +1,9 @@
+INLINE void MASK_NS_NT(INT32* S, INT32* T, TILE* tex_tile);
+INLINE void MASK_NS_T(INT32* S, INT32* T, TILE* tex_tile);
+INLINE void MASK_S_NT(INT32* S, INT32* T, TILE* tex_tile);
+INLINE void MASK_S_T(INT32* S, INT32* T, TILE* tex_tile);
+
+static void (*rdp_mask_func[8])(INT32*, INT32*, TILE*) =
+{
+ MASK_NS_NT, MASK_NS_T, MASK_S_NT, MASK_S_T,
+};
diff --git a/src/mame/video/rdpshift.c b/src/mame/video/rdpshift.c
new file mode 100644
index 00000000000..3851c16f190
--- /dev/null
+++ b/src/mame/video/rdpshift.c
@@ -0,0 +1,41 @@
+#if defined(SHIFT_S)
+ #if defined(SHIFT_T)
+ static void TEXSHIFT_S_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
+ #else
+ static void TEXSHIFT_S_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
+ #endif
+#else
+ #if defined(SHIFT_T)
+ static void TEXSHIFT_NS_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
+ #else
+ static void TEXSHIFT_NS_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile)
+ #endif
+#endif
+{
+#if defined(SHIFT_S)
+ *S = SIGN16(*S);
+ if (tex_tile->shift_s < 11)
+ {
+ *S >>= tex_tile->shift_s;
+ }
+ else
+ {
+ *S <<= (16 - tex_tile->shift_s);
+ }
+ *S = SIGN16(*S);
+#endif
+#if defined(SHIFT_T)
+ *T = SIGN16(*T);
+ if (tex_tile->shift_t < 11)
+ {
+ *T >>= tex_tile->shift_t;
+ }
+ else
+ {
+ *T <<= (16 - tex_tile->shift_t);
+ }
+ *T = SIGN16(*T);
+#endif
+ *maxs = ((*S >> 3) >= tex_tile->sh);
+ *maxt = ((*T >> 3) >= tex_tile->th);
+}
diff --git a/src/mame/video/rdpshift.h b/src/mame/video/rdpshift.h
new file mode 100644
index 00000000000..daee1d47d5b
--- /dev/null
+++ b/src/mame/video/rdpshift.h
@@ -0,0 +1,9 @@
+static void TEXSHIFT_S_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
+static void TEXSHIFT_S_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
+static void TEXSHIFT_NS_T(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
+static void TEXSHIFT_NS_NT(INT32* S, INT32* T, INT32* maxs, INT32* maxt, TILE* tex_tile);
+
+static void (*rdp_shift_func[4])(INT32*, INT32*, INT32*, INT32*, TILE*) =
+{
+ TEXSHIFT_NS_NT, TEXSHIFT_NS_T, TEXSHIFT_S_NT, TEXSHIFT_S_T
+};
diff --git a/src/mame/video/rdpspn16.c b/src/mame/video/rdpspn16.c
index f2b7a7aaa43..492cbe0bc30 100644
--- a/src/mame/video/rdpspn16.c
+++ b/src/mame/video/rdpspn16.c
@@ -1,250 +1,760 @@
-#if defined(SHADE)
- #if defined(TEXTURE)
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+#if defined(MAGICDITHER)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#else
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+#elif defined(BAYERDITHER)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#endif
#else
- #if defined(TEXTURE)
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#else
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c1_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c1_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
@@ -324,6 +834,8 @@
clipy2 = clip.yl / 4;
#if defined(TEXTURE)
+ calculate_clamp_diffs(tex_tile->num);
+
if (!other_modes.tex_lod_en)
{
tilenum = prim_tile;
@@ -356,6 +868,8 @@
shade_color.c = prim_color.c;
#endif
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
for (i = start; i <= end; i++)
{
int xstart = span[i].lx;
@@ -406,9 +920,8 @@
#if defined(ZBUF)
int sz = z.w >> 13;
#endif
- COLOR c1, c2;
- c1.c = 0;
- c2.c = 0;
+ COLOR c1;
+ //c1.c = 0;
#if defined(ZBUF)
if (other_modes.z_source_sel)
@@ -449,25 +962,25 @@
#endif
#if defined(SHADE)
- if (sr > 0xff) sr = 0xff;
- if (sg > 0xff) sg = 0xff;
- if (sb > 0xff) sb = 0xff;
- if (sa > 0xff) sa = 0xff;
- if (sr < 0) sr = 0;
- if (sg < 0) sg = 0;
- if (sb < 0) sb = 0;
- if (sa < 0) sa = 0;
- shade_color.i.r = sr;
- shade_color.i.g = sg;
- shade_color.i.b = sb;
- shade_color.i.a = sa;
+ if (sr > 0xff) shade_color.i.r = 0xff;
+ else if (sr < 0) shade_color.i.r = 0;
+ else shade_color.i.r = sr;
+ if (sg > 0xff) shade_color.i.g = 0xff;
+ else if (sg < 0) shade_color.i.g = 0;
+ else shade_color.i.g = sg;
+ if (sb > 0xff) shade_color.i.b = 0xff;
+ else if (sb < 0) shade_color.i.b = 0;
+ else shade_color.i.b = sb;
+ if (sa > 0xff) shade_color.i.a = 0xff;
+ else if (sa < 0) shade_color.i.a = 0;
+ else shade_color.i.a = sa;
#endif
#if defined(TEXTURE)
- TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
#endif
- COLOR_COMBINER1(&c1);
+ c1.c = COLOR_COMBINER1();
#if defined(ZCOMPARE)
#if !defined(ZBUF)
@@ -480,24 +993,32 @@
if(z_compare_result)
#endif
{
+#if defined(ZUPDATE)
int rendered = 0;
- int dith = 0;
- if (!other_modes.rgb_dither_sel)
- {
- dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
- }
- else if (other_modes.rgb_dither_sel == 1)
- {
- dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
- }
-
- rendered = BLENDER1_16(fbcur, hbcur, c1, dith);
+#endif
+#if defined(MAGICDITHER)
+ int dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
+#elif defined(BAYERDITHER)
+ int dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
+#endif
#if defined(ZUPDATE)
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
+ rendered = BLENDER1_16_DITH(fbcur, hbcur, c1, dith);
+#else
+ rendered = BLENDER1_16_NDITH(fbcur, hbcur, c1);
+#endif
+
if (rendered)
{
z_store(zbcur, zhbcur, sz, dzpix);
}
+#else
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
+ BLENDER1_16_DITH(fbcur, hbcur, c1, dith);
+#else
+ BLENDER1_16_NDITH(fbcur, hbcur, c1);
+#endif
#endif
}
}
@@ -527,253 +1048,763 @@
}
}
-#if defined(SHADE)
- #if defined(TEXTURE)
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+#if defined(MAGICDITHER)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#else
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+#elif defined(BAYERDITHER)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #endif
+ #else
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
+ #endif
+ #else
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#endif
#else
- #if defined(TEXTURE)
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(SHADE)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#endif
#else
- #if defined(ZBUF)
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(TEXTURE)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
#else
- #if defined(FLIP)
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(ZBUF)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#else
- #if defined(ZUPDATE)
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile)
+ #if defined(FLIP)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#else
- #if defined(ZCOMPARE)
- static void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile)
- #else
- static void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile)
+ #if defined(ZUPDATE)
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile)
+ #endif
+ #else
+ #if defined(ZCOMPARE)
+ static void render_spans_16_c2_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile)
+ #else
+ static void render_spans_16_c2_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile)
+ #endif
#endif
#endif
#endif
@@ -1106,12 +2137,15 @@
}
}
- TEXTURE_PIPELINE(&texel0_color, sss, sst, tex_tile);
- TEXTURE_PIPELINE(&texel1_color, sss, sst, tex_tile2);
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(sss, sst, tex_tile2);
#endif
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
#if defined(ZCOMPARE)
#if !defined(ZBUF)
@@ -1124,24 +2158,33 @@
if(z_compare_result)
#endif
{
+#if defined(ZUPDATE)
int rendered = 0;
- int dith = 0;
- if (!other_modes.rgb_dither_sel)
- {
- dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
- }
- else if (other_modes.rgb_dither_sel == 1)
- {
- dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
- }
-
- rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
+#endif
+#if defined(MAGICDITHER)
+ int dith = magic_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
+#elif defined(BAYERDITHER)
+ int dith = bayer_matrix[(((i) & 3) << 2) + ((x ^ WORD_ADDR_XOR) & 3)];
+#endif
#if defined(ZUPDATE)
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
+ rendered = BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
+#else
+ rendered = BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
+#endif
+
if (rendered)
{
z_store(zbcur, zhbcur, sz, dzpix);
}
+#else
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
+ BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
+#else
+ BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
+#endif
+
#endif
}
}
diff --git a/src/mame/video/rdpspn16.h b/src/mame/video/rdpspn16.h
index 88b4358aef6..239bf0eabe9 100644
--- a/src/mame/video/rdpspn16.h
+++ b/src/mame/video/rdpspn16.h
@@ -1,202 +1,670 @@
-INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_nf_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_f_nzc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_f_nzc(int start, int end, TILE* tex_tile);
-
-INLINE void render_spans_16_c1_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_nf_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_f_zc(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_f_zc(int start, int end, TILE* tex_tile);
-
-INLINE void render_spans_16_c1_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_nf_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_f_nzc_zu(int start, int end, TILE* tex_tile);
-
-INLINE void render_spans_16_c1_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_nf_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_ns_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_nt_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_nz_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c1_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
-INLINE void render_spans_16_c2_s_t_z_f_zc_zu(int start, int end, TILE* tex_tile);
-
-static void (*rdp_render_spans_16_func[128])(int, int, TILE*) =
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_dm(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_dm(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_zu_dm(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_zu_dm(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_db(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_db(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_zu_db(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_zu_db(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_dn(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_dn(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_nzc_zu_dn(int start, int end, TILE* tex_tile);
+
+static void render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_nf_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_ns_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_nt_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_nz_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c1_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+static void render_spans_16_c2_s_t_z_f_zc_zu_dn(int start, int end, TILE* tex_tile);
+
+static void (*rdp_render_spans_16_func[512])(int, int, TILE*) =
{
- render_spans_16_c1_ns_nt_nz_nf_nzc, render_spans_16_c2_ns_nt_nz_nf_nzc,
- render_spans_16_c1_ns_nt_z_nf_nzc, render_spans_16_c2_ns_nt_z_nf_nzc,
- render_spans_16_c1_ns_t_nz_nf_nzc, render_spans_16_c2_ns_t_nz_nf_nzc,
- render_spans_16_c1_ns_t_z_nf_nzc, render_spans_16_c2_ns_t_z_nf_nzc,
- render_spans_16_c1_s_nt_nz_nf_nzc, render_spans_16_c2_s_nt_nz_nf_nzc,
- render_spans_16_c1_s_nt_z_nf_nzc, render_spans_16_c2_s_nt_z_nf_nzc,
- render_spans_16_c1_s_t_nz_nf_nzc, render_spans_16_c2_s_t_nz_nf_nzc,
- render_spans_16_c1_s_t_z_nf_nzc, render_spans_16_c2_s_t_z_nf_nzc,
- render_spans_16_c1_ns_nt_nz_f_nzc, render_spans_16_c2_ns_nt_nz_f_nzc,
- render_spans_16_c1_ns_nt_z_f_nzc, render_spans_16_c2_ns_nt_z_f_nzc,
- render_spans_16_c1_ns_t_nz_f_nzc, render_spans_16_c2_ns_t_nz_f_nzc,
- render_spans_16_c1_ns_t_z_f_nzc, render_spans_16_c2_ns_t_z_f_nzc,
- render_spans_16_c1_s_nt_nz_f_nzc, render_spans_16_c2_s_nt_nz_f_nzc,
- render_spans_16_c1_s_nt_z_f_nzc, render_spans_16_c2_s_nt_z_f_nzc,
- render_spans_16_c1_s_t_nz_f_nzc, render_spans_16_c2_s_t_nz_f_nzc,
- render_spans_16_c1_s_t_z_f_nzc, render_spans_16_c2_s_t_z_f_nzc,
-
- render_spans_16_c1_ns_nt_nz_nf_zc, render_spans_16_c2_ns_nt_nz_nf_zc,
- render_spans_16_c1_ns_nt_z_nf_zc, render_spans_16_c2_ns_nt_z_nf_zc,
- render_spans_16_c1_ns_t_nz_nf_zc, render_spans_16_c2_ns_t_nz_nf_zc,
- render_spans_16_c1_ns_t_z_nf_zc, render_spans_16_c2_ns_t_z_nf_zc,
- render_spans_16_c1_s_nt_nz_nf_zc, render_spans_16_c2_s_nt_nz_nf_zc,
- render_spans_16_c1_s_nt_z_nf_zc, render_spans_16_c2_s_nt_z_nf_zc,
- render_spans_16_c1_s_t_nz_nf_zc, render_spans_16_c2_s_t_nz_nf_zc,
- render_spans_16_c1_s_t_z_nf_zc, render_spans_16_c2_s_t_z_nf_zc,
- render_spans_16_c1_ns_nt_nz_f_zc, render_spans_16_c2_ns_nt_nz_f_zc,
- render_spans_16_c1_ns_nt_z_f_zc, render_spans_16_c2_ns_nt_z_f_zc,
- render_spans_16_c1_ns_t_nz_f_zc, render_spans_16_c2_ns_t_nz_f_zc,
- render_spans_16_c1_ns_t_z_f_zc, render_spans_16_c2_ns_t_z_f_zc,
- render_spans_16_c1_s_nt_nz_f_zc, render_spans_16_c2_s_nt_nz_f_zc,
- render_spans_16_c1_s_nt_z_f_zc, render_spans_16_c2_s_nt_z_f_zc,
- render_spans_16_c1_s_t_nz_f_zc, render_spans_16_c2_s_t_nz_f_zc,
- render_spans_16_c1_s_t_z_f_zc, render_spans_16_c2_s_t_z_f_zc,
-
- render_spans_16_c1_ns_nt_nz_nf_nzc_zu, render_spans_16_c2_ns_nt_nz_nf_nzc_zu,
- render_spans_16_c1_ns_nt_z_nf_nzc_zu, render_spans_16_c2_ns_nt_z_nf_nzc_zu,
- render_spans_16_c1_ns_t_nz_nf_nzc_zu, render_spans_16_c2_ns_t_nz_nf_nzc_zu,
- render_spans_16_c1_ns_t_z_nf_nzc_zu, render_spans_16_c2_ns_t_z_nf_nzc_zu,
- render_spans_16_c1_s_nt_nz_nf_nzc_zu, render_spans_16_c2_s_nt_nz_nf_nzc_zu,
- render_spans_16_c1_s_nt_z_nf_nzc_zu, render_spans_16_c2_s_nt_z_nf_nzc_zu,
- render_spans_16_c1_s_t_nz_nf_nzc_zu, render_spans_16_c2_s_t_nz_nf_nzc_zu,
- render_spans_16_c1_s_t_z_nf_nzc_zu, render_spans_16_c2_s_t_z_nf_nzc_zu,
- render_spans_16_c1_ns_nt_nz_f_nzc_zu, render_spans_16_c2_ns_nt_nz_f_nzc_zu,
- render_spans_16_c1_ns_nt_z_f_nzc_zu, render_spans_16_c2_ns_nt_z_f_nzc_zu,
- render_spans_16_c1_ns_t_nz_f_nzc_zu, render_spans_16_c2_ns_t_nz_f_nzc_zu,
- render_spans_16_c1_ns_t_z_f_nzc_zu, render_spans_16_c2_ns_t_z_f_nzc_zu,
- render_spans_16_c1_s_nt_nz_f_nzc_zu, render_spans_16_c2_s_nt_nz_f_nzc_zu,
- render_spans_16_c1_s_nt_z_f_nzc_zu, render_spans_16_c2_s_nt_z_f_nzc_zu,
- render_spans_16_c1_s_t_nz_f_nzc_zu, render_spans_16_c2_s_t_nz_f_nzc_zu,
- render_spans_16_c1_s_t_z_f_nzc_zu, render_spans_16_c2_s_t_z_f_nzc_zu,
-
- render_spans_16_c1_ns_nt_nz_nf_zc_zu, render_spans_16_c2_ns_nt_nz_nf_zc_zu,
- render_spans_16_c1_ns_nt_z_nf_zc_zu, render_spans_16_c2_ns_nt_z_nf_zc_zu,
- render_spans_16_c1_ns_t_nz_nf_zc_zu, render_spans_16_c2_ns_t_nz_nf_zc_zu,
- render_spans_16_c1_ns_t_z_nf_zc_zu, render_spans_16_c2_ns_t_z_nf_zc_zu,
- render_spans_16_c1_s_nt_nz_nf_zc_zu, render_spans_16_c2_s_nt_nz_nf_zc_zu,
- render_spans_16_c1_s_nt_z_nf_zc_zu, render_spans_16_c2_s_nt_z_nf_zc_zu,
- render_spans_16_c1_s_t_nz_nf_zc_zu, render_spans_16_c2_s_t_nz_nf_zc_zu,
- render_spans_16_c1_s_t_z_nf_zc_zu, render_spans_16_c2_s_t_z_nf_zc_zu,
- render_spans_16_c1_ns_nt_nz_f_zc_zu, render_spans_16_c2_ns_nt_nz_f_zc_zu,
- render_spans_16_c1_ns_nt_z_f_zc_zu, render_spans_16_c2_ns_nt_z_f_zc_zu,
- render_spans_16_c1_ns_t_nz_f_zc_zu, render_spans_16_c2_ns_t_nz_f_zc_zu,
- render_spans_16_c1_ns_t_z_f_zc_zu, render_spans_16_c2_ns_t_z_f_zc_zu,
- render_spans_16_c1_s_nt_nz_f_zc_zu, render_spans_16_c2_s_nt_nz_f_zc_zu,
- render_spans_16_c1_s_nt_z_f_zc_zu, render_spans_16_c2_s_nt_z_f_zc_zu,
- render_spans_16_c1_s_t_nz_f_zc_zu, render_spans_16_c2_s_t_nz_f_zc_zu,
- render_spans_16_c1_s_t_z_f_zc_zu, render_spans_16_c2_s_t_z_f_zc_zu,
+ render_spans_16_c1_ns_nt_nz_nf_nzc_dm, render_spans_16_c2_ns_nt_nz_nf_nzc_dm,
+ render_spans_16_c1_ns_nt_z_nf_nzc_dm, render_spans_16_c2_ns_nt_z_nf_nzc_dm,
+ render_spans_16_c1_ns_t_nz_nf_nzc_dm, render_spans_16_c2_ns_t_nz_nf_nzc_dm,
+ render_spans_16_c1_ns_t_z_nf_nzc_dm, render_spans_16_c2_ns_t_z_nf_nzc_dm,
+ render_spans_16_c1_s_nt_nz_nf_nzc_dm, render_spans_16_c2_s_nt_nz_nf_nzc_dm,
+ render_spans_16_c1_s_nt_z_nf_nzc_dm, render_spans_16_c2_s_nt_z_nf_nzc_dm,
+ render_spans_16_c1_s_t_nz_nf_nzc_dm, render_spans_16_c2_s_t_nz_nf_nzc_dm,
+ render_spans_16_c1_s_t_z_nf_nzc_dm, render_spans_16_c2_s_t_z_nf_nzc_dm,
+ render_spans_16_c1_ns_nt_nz_f_nzc_dm, render_spans_16_c2_ns_nt_nz_f_nzc_dm,
+ render_spans_16_c1_ns_nt_z_f_nzc_dm, render_spans_16_c2_ns_nt_z_f_nzc_dm,
+ render_spans_16_c1_ns_t_nz_f_nzc_dm, render_spans_16_c2_ns_t_nz_f_nzc_dm,
+ render_spans_16_c1_ns_t_z_f_nzc_dm, render_spans_16_c2_ns_t_z_f_nzc_dm,
+ render_spans_16_c1_s_nt_nz_f_nzc_dm, render_spans_16_c2_s_nt_nz_f_nzc_dm,
+ render_spans_16_c1_s_nt_z_f_nzc_dm, render_spans_16_c2_s_nt_z_f_nzc_dm,
+ render_spans_16_c1_s_t_nz_f_nzc_dm, render_spans_16_c2_s_t_nz_f_nzc_dm,
+ render_spans_16_c1_s_t_z_f_nzc_dm, render_spans_16_c2_s_t_z_f_nzc_dm,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_dm, render_spans_16_c2_ns_nt_nz_nf_zc_dm,
+ render_spans_16_c1_ns_nt_z_nf_zc_dm, render_spans_16_c2_ns_nt_z_nf_zc_dm,
+ render_spans_16_c1_ns_t_nz_nf_zc_dm, render_spans_16_c2_ns_t_nz_nf_zc_dm,
+ render_spans_16_c1_ns_t_z_nf_zc_dm, render_spans_16_c2_ns_t_z_nf_zc_dm,
+ render_spans_16_c1_s_nt_nz_nf_zc_dm, render_spans_16_c2_s_nt_nz_nf_zc_dm,
+ render_spans_16_c1_s_nt_z_nf_zc_dm, render_spans_16_c2_s_nt_z_nf_zc_dm,
+ render_spans_16_c1_s_t_nz_nf_zc_dm, render_spans_16_c2_s_t_nz_nf_zc_dm,
+ render_spans_16_c1_s_t_z_nf_zc_dm, render_spans_16_c2_s_t_z_nf_zc_dm,
+ render_spans_16_c1_ns_nt_nz_f_zc_dm, render_spans_16_c2_ns_nt_nz_f_zc_dm,
+ render_spans_16_c1_ns_nt_z_f_zc_dm, render_spans_16_c2_ns_nt_z_f_zc_dm,
+ render_spans_16_c1_ns_t_nz_f_zc_dm, render_spans_16_c2_ns_t_nz_f_zc_dm,
+ render_spans_16_c1_ns_t_z_f_zc_dm, render_spans_16_c2_ns_t_z_f_zc_dm,
+ render_spans_16_c1_s_nt_nz_f_zc_dm, render_spans_16_c2_s_nt_nz_f_zc_dm,
+ render_spans_16_c1_s_nt_z_f_zc_dm, render_spans_16_c2_s_nt_z_f_zc_dm,
+ render_spans_16_c1_s_t_nz_f_zc_dm, render_spans_16_c2_s_t_nz_f_zc_dm,
+ render_spans_16_c1_s_t_z_f_zc_dm, render_spans_16_c2_s_t_z_f_zc_dm,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dm, render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dm,
+ render_spans_16_c1_ns_nt_z_nf_nzc_zu_dm, render_spans_16_c2_ns_nt_z_nf_nzc_zu_dm,
+ render_spans_16_c1_ns_t_nz_nf_nzc_zu_dm, render_spans_16_c2_ns_t_nz_nf_nzc_zu_dm,
+ render_spans_16_c1_ns_t_z_nf_nzc_zu_dm, render_spans_16_c2_ns_t_z_nf_nzc_zu_dm,
+ render_spans_16_c1_s_nt_nz_nf_nzc_zu_dm, render_spans_16_c2_s_nt_nz_nf_nzc_zu_dm,
+ render_spans_16_c1_s_nt_z_nf_nzc_zu_dm, render_spans_16_c2_s_nt_z_nf_nzc_zu_dm,
+ render_spans_16_c1_s_t_nz_nf_nzc_zu_dm, render_spans_16_c2_s_t_nz_nf_nzc_zu_dm,
+ render_spans_16_c1_s_t_z_nf_nzc_zu_dm, render_spans_16_c2_s_t_z_nf_nzc_zu_dm,
+ render_spans_16_c1_ns_nt_nz_f_nzc_zu_dm, render_spans_16_c2_ns_nt_nz_f_nzc_zu_dm,
+ render_spans_16_c1_ns_nt_z_f_nzc_zu_dm, render_spans_16_c2_ns_nt_z_f_nzc_zu_dm,
+ render_spans_16_c1_ns_t_nz_f_nzc_zu_dm, render_spans_16_c2_ns_t_nz_f_nzc_zu_dm,
+ render_spans_16_c1_ns_t_z_f_nzc_zu_dm, render_spans_16_c2_ns_t_z_f_nzc_zu_dm,
+ render_spans_16_c1_s_nt_nz_f_nzc_zu_dm, render_spans_16_c2_s_nt_nz_f_nzc_zu_dm,
+ render_spans_16_c1_s_nt_z_f_nzc_zu_dm, render_spans_16_c2_s_nt_z_f_nzc_zu_dm,
+ render_spans_16_c1_s_t_nz_f_nzc_zu_dm, render_spans_16_c2_s_t_nz_f_nzc_zu_dm,
+ render_spans_16_c1_s_t_z_f_nzc_zu_dm, render_spans_16_c2_s_t_z_f_nzc_zu_dm,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_zu_dm, render_spans_16_c2_ns_nt_nz_nf_zc_zu_dm,
+ render_spans_16_c1_ns_nt_z_nf_zc_zu_dm, render_spans_16_c2_ns_nt_z_nf_zc_zu_dm,
+ render_spans_16_c1_ns_t_nz_nf_zc_zu_dm, render_spans_16_c2_ns_t_nz_nf_zc_zu_dm,
+ render_spans_16_c1_ns_t_z_nf_zc_zu_dm, render_spans_16_c2_ns_t_z_nf_zc_zu_dm,
+ render_spans_16_c1_s_nt_nz_nf_zc_zu_dm, render_spans_16_c2_s_nt_nz_nf_zc_zu_dm,
+ render_spans_16_c1_s_nt_z_nf_zc_zu_dm, render_spans_16_c2_s_nt_z_nf_zc_zu_dm,
+ render_spans_16_c1_s_t_nz_nf_zc_zu_dm, render_spans_16_c2_s_t_nz_nf_zc_zu_dm,
+ render_spans_16_c1_s_t_z_nf_zc_zu_dm, render_spans_16_c2_s_t_z_nf_zc_zu_dm,
+ render_spans_16_c1_ns_nt_nz_f_zc_zu_dm, render_spans_16_c2_ns_nt_nz_f_zc_zu_dm,
+ render_spans_16_c1_ns_nt_z_f_zc_zu_dm, render_spans_16_c2_ns_nt_z_f_zc_zu_dm,
+ render_spans_16_c1_ns_t_nz_f_zc_zu_dm, render_spans_16_c2_ns_t_nz_f_zc_zu_dm,
+ render_spans_16_c1_ns_t_z_f_zc_zu_dm, render_spans_16_c2_ns_t_z_f_zc_zu_dm,
+ render_spans_16_c1_s_nt_nz_f_zc_zu_dm, render_spans_16_c2_s_nt_nz_f_zc_zu_dm,
+ render_spans_16_c1_s_nt_z_f_zc_zu_dm, render_spans_16_c2_s_nt_z_f_zc_zu_dm,
+ render_spans_16_c1_s_t_nz_f_zc_zu_dm, render_spans_16_c2_s_t_nz_f_zc_zu_dm,
+ render_spans_16_c1_s_t_z_f_zc_zu_dm, render_spans_16_c2_s_t_z_f_zc_zu_dm,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_db, render_spans_16_c2_ns_nt_nz_nf_nzc_db,
+ render_spans_16_c1_ns_nt_z_nf_nzc_db, render_spans_16_c2_ns_nt_z_nf_nzc_db,
+ render_spans_16_c1_ns_t_nz_nf_nzc_db, render_spans_16_c2_ns_t_nz_nf_nzc_db,
+ render_spans_16_c1_ns_t_z_nf_nzc_db, render_spans_16_c2_ns_t_z_nf_nzc_db,
+ render_spans_16_c1_s_nt_nz_nf_nzc_db, render_spans_16_c2_s_nt_nz_nf_nzc_db,
+ render_spans_16_c1_s_nt_z_nf_nzc_db, render_spans_16_c2_s_nt_z_nf_nzc_db,
+ render_spans_16_c1_s_t_nz_nf_nzc_db, render_spans_16_c2_s_t_nz_nf_nzc_db,
+ render_spans_16_c1_s_t_z_nf_nzc_db, render_spans_16_c2_s_t_z_nf_nzc_db,
+ render_spans_16_c1_ns_nt_nz_f_nzc_db, render_spans_16_c2_ns_nt_nz_f_nzc_db,
+ render_spans_16_c1_ns_nt_z_f_nzc_db, render_spans_16_c2_ns_nt_z_f_nzc_db,
+ render_spans_16_c1_ns_t_nz_f_nzc_db, render_spans_16_c2_ns_t_nz_f_nzc_db,
+ render_spans_16_c1_ns_t_z_f_nzc_db, render_spans_16_c2_ns_t_z_f_nzc_db,
+ render_spans_16_c1_s_nt_nz_f_nzc_db, render_spans_16_c2_s_nt_nz_f_nzc_db,
+ render_spans_16_c1_s_nt_z_f_nzc_db, render_spans_16_c2_s_nt_z_f_nzc_db,
+ render_spans_16_c1_s_t_nz_f_nzc_db, render_spans_16_c2_s_t_nz_f_nzc_db,
+ render_spans_16_c1_s_t_z_f_nzc_db, render_spans_16_c2_s_t_z_f_nzc_db,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_db, render_spans_16_c2_ns_nt_nz_nf_zc_db,
+ render_spans_16_c1_ns_nt_z_nf_zc_db, render_spans_16_c2_ns_nt_z_nf_zc_db,
+ render_spans_16_c1_ns_t_nz_nf_zc_db, render_spans_16_c2_ns_t_nz_nf_zc_db,
+ render_spans_16_c1_ns_t_z_nf_zc_db, render_spans_16_c2_ns_t_z_nf_zc_db,
+ render_spans_16_c1_s_nt_nz_nf_zc_db, render_spans_16_c2_s_nt_nz_nf_zc_db,
+ render_spans_16_c1_s_nt_z_nf_zc_db, render_spans_16_c2_s_nt_z_nf_zc_db,
+ render_spans_16_c1_s_t_nz_nf_zc_db, render_spans_16_c2_s_t_nz_nf_zc_db,
+ render_spans_16_c1_s_t_z_nf_zc_db, render_spans_16_c2_s_t_z_nf_zc_db,
+ render_spans_16_c1_ns_nt_nz_f_zc_db, render_spans_16_c2_ns_nt_nz_f_zc_db,
+ render_spans_16_c1_ns_nt_z_f_zc_db, render_spans_16_c2_ns_nt_z_f_zc_db,
+ render_spans_16_c1_ns_t_nz_f_zc_db, render_spans_16_c2_ns_t_nz_f_zc_db,
+ render_spans_16_c1_ns_t_z_f_zc_db, render_spans_16_c2_ns_t_z_f_zc_db,
+ render_spans_16_c1_s_nt_nz_f_zc_db, render_spans_16_c2_s_nt_nz_f_zc_db,
+ render_spans_16_c1_s_nt_z_f_zc_db, render_spans_16_c2_s_nt_z_f_zc_db,
+ render_spans_16_c1_s_t_nz_f_zc_db, render_spans_16_c2_s_t_nz_f_zc_db,
+ render_spans_16_c1_s_t_z_f_zc_db, render_spans_16_c2_s_t_z_f_zc_db,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_zu_db, render_spans_16_c2_ns_nt_nz_nf_nzc_zu_db,
+ render_spans_16_c1_ns_nt_z_nf_nzc_zu_db, render_spans_16_c2_ns_nt_z_nf_nzc_zu_db,
+ render_spans_16_c1_ns_t_nz_nf_nzc_zu_db, render_spans_16_c2_ns_t_nz_nf_nzc_zu_db,
+ render_spans_16_c1_ns_t_z_nf_nzc_zu_db, render_spans_16_c2_ns_t_z_nf_nzc_zu_db,
+ render_spans_16_c1_s_nt_nz_nf_nzc_zu_db, render_spans_16_c2_s_nt_nz_nf_nzc_zu_db,
+ render_spans_16_c1_s_nt_z_nf_nzc_zu_db, render_spans_16_c2_s_nt_z_nf_nzc_zu_db,
+ render_spans_16_c1_s_t_nz_nf_nzc_zu_db, render_spans_16_c2_s_t_nz_nf_nzc_zu_db,
+ render_spans_16_c1_s_t_z_nf_nzc_zu_db, render_spans_16_c2_s_t_z_nf_nzc_zu_db,
+ render_spans_16_c1_ns_nt_nz_f_nzc_zu_db, render_spans_16_c2_ns_nt_nz_f_nzc_zu_db,
+ render_spans_16_c1_ns_nt_z_f_nzc_zu_db, render_spans_16_c2_ns_nt_z_f_nzc_zu_db,
+ render_spans_16_c1_ns_t_nz_f_nzc_zu_db, render_spans_16_c2_ns_t_nz_f_nzc_zu_db,
+ render_spans_16_c1_ns_t_z_f_nzc_zu_db, render_spans_16_c2_ns_t_z_f_nzc_zu_db,
+ render_spans_16_c1_s_nt_nz_f_nzc_zu_db, render_spans_16_c2_s_nt_nz_f_nzc_zu_db,
+ render_spans_16_c1_s_nt_z_f_nzc_zu_db, render_spans_16_c2_s_nt_z_f_nzc_zu_db,
+ render_spans_16_c1_s_t_nz_f_nzc_zu_db, render_spans_16_c2_s_t_nz_f_nzc_zu_db,
+ render_spans_16_c1_s_t_z_f_nzc_zu_db, render_spans_16_c2_s_t_z_f_nzc_zu_db,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_zu_db, render_spans_16_c2_ns_nt_nz_nf_zc_zu_db,
+ render_spans_16_c1_ns_nt_z_nf_zc_zu_db, render_spans_16_c2_ns_nt_z_nf_zc_zu_db,
+ render_spans_16_c1_ns_t_nz_nf_zc_zu_db, render_spans_16_c2_ns_t_nz_nf_zc_zu_db,
+ render_spans_16_c1_ns_t_z_nf_zc_zu_db, render_spans_16_c2_ns_t_z_nf_zc_zu_db,
+ render_spans_16_c1_s_nt_nz_nf_zc_zu_db, render_spans_16_c2_s_nt_nz_nf_zc_zu_db,
+ render_spans_16_c1_s_nt_z_nf_zc_zu_db, render_spans_16_c2_s_nt_z_nf_zc_zu_db,
+ render_spans_16_c1_s_t_nz_nf_zc_zu_db, render_spans_16_c2_s_t_nz_nf_zc_zu_db,
+ render_spans_16_c1_s_t_z_nf_zc_zu_db, render_spans_16_c2_s_t_z_nf_zc_zu_db,
+ render_spans_16_c1_ns_nt_nz_f_zc_zu_db, render_spans_16_c2_ns_nt_nz_f_zc_zu_db,
+ render_spans_16_c1_ns_nt_z_f_zc_zu_db, render_spans_16_c2_ns_nt_z_f_zc_zu_db,
+ render_spans_16_c1_ns_t_nz_f_zc_zu_db, render_spans_16_c2_ns_t_nz_f_zc_zu_db,
+ render_spans_16_c1_ns_t_z_f_zc_zu_db, render_spans_16_c2_ns_t_z_f_zc_zu_db,
+ render_spans_16_c1_s_nt_nz_f_zc_zu_db, render_spans_16_c2_s_nt_nz_f_zc_zu_db,
+ render_spans_16_c1_s_nt_z_f_zc_zu_db, render_spans_16_c2_s_nt_z_f_zc_zu_db,
+ render_spans_16_c1_s_t_nz_f_zc_zu_db, render_spans_16_c2_s_t_nz_f_zc_zu_db,
+ render_spans_16_c1_s_t_z_f_zc_zu_db, render_spans_16_c2_s_t_z_f_zc_zu_db,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_dn,
+ render_spans_16_c1_ns_nt_z_nf_nzc_dn, render_spans_16_c2_ns_nt_z_nf_nzc_dn,
+ render_spans_16_c1_ns_t_nz_nf_nzc_dn, render_spans_16_c2_ns_t_nz_nf_nzc_dn,
+ render_spans_16_c1_ns_t_z_nf_nzc_dn, render_spans_16_c2_ns_t_z_nf_nzc_dn,
+ render_spans_16_c1_s_nt_nz_nf_nzc_dn, render_spans_16_c2_s_nt_nz_nf_nzc_dn,
+ render_spans_16_c1_s_nt_z_nf_nzc_dn, render_spans_16_c2_s_nt_z_nf_nzc_dn,
+ render_spans_16_c1_s_t_nz_nf_nzc_dn, render_spans_16_c2_s_t_nz_nf_nzc_dn,
+ render_spans_16_c1_s_t_z_nf_nzc_dn, render_spans_16_c2_s_t_z_nf_nzc_dn,
+ render_spans_16_c1_ns_nt_nz_f_nzc_dn, render_spans_16_c2_ns_nt_nz_f_nzc_dn,
+ render_spans_16_c1_ns_nt_z_f_nzc_dn, render_spans_16_c2_ns_nt_z_f_nzc_dn,
+ render_spans_16_c1_ns_t_nz_f_nzc_dn, render_spans_16_c2_ns_t_nz_f_nzc_dn,
+ render_spans_16_c1_ns_t_z_f_nzc_dn, render_spans_16_c2_ns_t_z_f_nzc_dn,
+ render_spans_16_c1_s_nt_nz_f_nzc_dn, render_spans_16_c2_s_nt_nz_f_nzc_dn,
+ render_spans_16_c1_s_nt_z_f_nzc_dn, render_spans_16_c2_s_nt_z_f_nzc_dn,
+ render_spans_16_c1_s_t_nz_f_nzc_dn, render_spans_16_c2_s_t_nz_f_nzc_dn,
+ render_spans_16_c1_s_t_z_f_nzc_dn, render_spans_16_c2_s_t_z_f_nzc_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_dn, render_spans_16_c2_ns_nt_nz_nf_zc_dn,
+ render_spans_16_c1_ns_nt_z_nf_zc_dn, render_spans_16_c2_ns_nt_z_nf_zc_dn,
+ render_spans_16_c1_ns_t_nz_nf_zc_dn, render_spans_16_c2_ns_t_nz_nf_zc_dn,
+ render_spans_16_c1_ns_t_z_nf_zc_dn, render_spans_16_c2_ns_t_z_nf_zc_dn,
+ render_spans_16_c1_s_nt_nz_nf_zc_dn, render_spans_16_c2_s_nt_nz_nf_zc_dn,
+ render_spans_16_c1_s_nt_z_nf_zc_dn, render_spans_16_c2_s_nt_z_nf_zc_dn,
+ render_spans_16_c1_s_t_nz_nf_zc_dn, render_spans_16_c2_s_t_nz_nf_zc_dn,
+ render_spans_16_c1_s_t_z_nf_zc_dn, render_spans_16_c2_s_t_z_nf_zc_dn,
+ render_spans_16_c1_ns_nt_nz_f_zc_dn, render_spans_16_c2_ns_nt_nz_f_zc_dn,
+ render_spans_16_c1_ns_nt_z_f_zc_dn, render_spans_16_c2_ns_nt_z_f_zc_dn,
+ render_spans_16_c1_ns_t_nz_f_zc_dn, render_spans_16_c2_ns_t_nz_f_zc_dn,
+ render_spans_16_c1_ns_t_z_f_zc_dn, render_spans_16_c2_ns_t_z_f_zc_dn,
+ render_spans_16_c1_s_nt_nz_f_zc_dn, render_spans_16_c2_s_nt_nz_f_zc_dn,
+ render_spans_16_c1_s_nt_z_f_zc_dn, render_spans_16_c2_s_nt_z_f_zc_dn,
+ render_spans_16_c1_s_t_nz_f_zc_dn, render_spans_16_c2_s_t_nz_f_zc_dn,
+ render_spans_16_c1_s_t_z_f_zc_dn, render_spans_16_c2_s_t_z_f_zc_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn, render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn, render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_t_z_nf_nzc_zu_dn, render_spans_16_c2_ns_t_z_nf_nzc_zu_dn,
+ render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn, render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_s_nt_z_nf_nzc_zu_dn, render_spans_16_c2_s_nt_z_nf_nzc_zu_dn,
+ render_spans_16_c1_s_t_nz_nf_nzc_zu_dn, render_spans_16_c2_s_t_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_s_t_z_nf_nzc_zu_dn, render_spans_16_c2_s_t_z_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn, render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_z_f_nzc_zu_dn, render_spans_16_c2_ns_nt_z_f_nzc_zu_dn,
+ render_spans_16_c1_ns_t_nz_f_nzc_zu_dn, render_spans_16_c2_ns_t_nz_f_nzc_zu_dn,
+ render_spans_16_c1_ns_t_z_f_nzc_zu_dn, render_spans_16_c2_ns_t_z_f_nzc_zu_dn,
+ render_spans_16_c1_s_nt_nz_f_nzc_zu_dn, render_spans_16_c2_s_nt_nz_f_nzc_zu_dn,
+ render_spans_16_c1_s_nt_z_f_nzc_zu_dn, render_spans_16_c2_s_nt_z_f_nzc_zu_dn,
+ render_spans_16_c1_s_t_nz_f_nzc_zu_dn, render_spans_16_c2_s_t_nz_f_nzc_zu_dn,
+ render_spans_16_c1_s_t_z_f_nzc_zu_dn, render_spans_16_c2_s_t_z_f_nzc_zu_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn, render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn,
+ render_spans_16_c1_ns_nt_z_nf_zc_zu_dn, render_spans_16_c2_ns_nt_z_nf_zc_zu_dn,
+ render_spans_16_c1_ns_t_nz_nf_zc_zu_dn, render_spans_16_c2_ns_t_nz_nf_zc_zu_dn,
+ render_spans_16_c1_ns_t_z_nf_zc_zu_dn, render_spans_16_c2_ns_t_z_nf_zc_zu_dn,
+ render_spans_16_c1_s_nt_nz_nf_zc_zu_dn, render_spans_16_c2_s_nt_nz_nf_zc_zu_dn,
+ render_spans_16_c1_s_nt_z_nf_zc_zu_dn, render_spans_16_c2_s_nt_z_nf_zc_zu_dn,
+ render_spans_16_c1_s_t_nz_nf_zc_zu_dn, render_spans_16_c2_s_t_nz_nf_zc_zu_dn,
+ render_spans_16_c1_s_t_z_nf_zc_zu_dn, render_spans_16_c2_s_t_z_nf_zc_zu_dn,
+ render_spans_16_c1_ns_nt_nz_f_zc_zu_dn, render_spans_16_c2_ns_nt_nz_f_zc_zu_dn,
+ render_spans_16_c1_ns_nt_z_f_zc_zu_dn, render_spans_16_c2_ns_nt_z_f_zc_zu_dn,
+ render_spans_16_c1_ns_t_nz_f_zc_zu_dn, render_spans_16_c2_ns_t_nz_f_zc_zu_dn,
+ render_spans_16_c1_ns_t_z_f_zc_zu_dn, render_spans_16_c2_ns_t_z_f_zc_zu_dn,
+ render_spans_16_c1_s_nt_nz_f_zc_zu_dn, render_spans_16_c2_s_nt_nz_f_zc_zu_dn,
+ render_spans_16_c1_s_nt_z_f_zc_zu_dn, render_spans_16_c2_s_nt_z_f_zc_zu_dn,
+ render_spans_16_c1_s_t_nz_f_zc_zu_dn, render_spans_16_c2_s_t_nz_f_zc_zu_dn,
+ render_spans_16_c1_s_t_z_f_zc_zu_dn, render_spans_16_c2_s_t_z_f_zc_zu_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_dn,
+ render_spans_16_c1_ns_nt_z_nf_nzc_dn, render_spans_16_c2_ns_nt_z_nf_nzc_dn,
+ render_spans_16_c1_ns_t_nz_nf_nzc_dn, render_spans_16_c2_ns_t_nz_nf_nzc_dn,
+ render_spans_16_c1_ns_t_z_nf_nzc_dn, render_spans_16_c2_ns_t_z_nf_nzc_dn,
+ render_spans_16_c1_s_nt_nz_nf_nzc_dn, render_spans_16_c2_s_nt_nz_nf_nzc_dn,
+ render_spans_16_c1_s_nt_z_nf_nzc_dn, render_spans_16_c2_s_nt_z_nf_nzc_dn,
+ render_spans_16_c1_s_t_nz_nf_nzc_dn, render_spans_16_c2_s_t_nz_nf_nzc_dn,
+ render_spans_16_c1_s_t_z_nf_nzc_dn, render_spans_16_c2_s_t_z_nf_nzc_dn,
+ render_spans_16_c1_ns_nt_nz_f_nzc_dn, render_spans_16_c2_ns_nt_nz_f_nzc_dn,
+ render_spans_16_c1_ns_nt_z_f_nzc_dn, render_spans_16_c2_ns_nt_z_f_nzc_dn,
+ render_spans_16_c1_ns_t_nz_f_nzc_dn, render_spans_16_c2_ns_t_nz_f_nzc_dn,
+ render_spans_16_c1_ns_t_z_f_nzc_dn, render_spans_16_c2_ns_t_z_f_nzc_dn,
+ render_spans_16_c1_s_nt_nz_f_nzc_dn, render_spans_16_c2_s_nt_nz_f_nzc_dn,
+ render_spans_16_c1_s_nt_z_f_nzc_dn, render_spans_16_c2_s_nt_z_f_nzc_dn,
+ render_spans_16_c1_s_t_nz_f_nzc_dn, render_spans_16_c2_s_t_nz_f_nzc_dn,
+ render_spans_16_c1_s_t_z_f_nzc_dn, render_spans_16_c2_s_t_z_f_nzc_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_dn, render_spans_16_c2_ns_nt_nz_nf_zc_dn,
+ render_spans_16_c1_ns_nt_z_nf_zc_dn, render_spans_16_c2_ns_nt_z_nf_zc_dn,
+ render_spans_16_c1_ns_t_nz_nf_zc_dn, render_spans_16_c2_ns_t_nz_nf_zc_dn,
+ render_spans_16_c1_ns_t_z_nf_zc_dn, render_spans_16_c2_ns_t_z_nf_zc_dn,
+ render_spans_16_c1_s_nt_nz_nf_zc_dn, render_spans_16_c2_s_nt_nz_nf_zc_dn,
+ render_spans_16_c1_s_nt_z_nf_zc_dn, render_spans_16_c2_s_nt_z_nf_zc_dn,
+ render_spans_16_c1_s_t_nz_nf_zc_dn, render_spans_16_c2_s_t_nz_nf_zc_dn,
+ render_spans_16_c1_s_t_z_nf_zc_dn, render_spans_16_c2_s_t_z_nf_zc_dn,
+ render_spans_16_c1_ns_nt_nz_f_zc_dn, render_spans_16_c2_ns_nt_nz_f_zc_dn,
+ render_spans_16_c1_ns_nt_z_f_zc_dn, render_spans_16_c2_ns_nt_z_f_zc_dn,
+ render_spans_16_c1_ns_t_nz_f_zc_dn, render_spans_16_c2_ns_t_nz_f_zc_dn,
+ render_spans_16_c1_ns_t_z_f_zc_dn, render_spans_16_c2_ns_t_z_f_zc_dn,
+ render_spans_16_c1_s_nt_nz_f_zc_dn, render_spans_16_c2_s_nt_nz_f_zc_dn,
+ render_spans_16_c1_s_nt_z_f_zc_dn, render_spans_16_c2_s_nt_z_f_zc_dn,
+ render_spans_16_c1_s_t_nz_f_zc_dn, render_spans_16_c2_s_t_nz_f_zc_dn,
+ render_spans_16_c1_s_t_z_f_zc_dn, render_spans_16_c2_s_t_z_f_zc_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_nzc_zu_dn, render_spans_16_c2_ns_nt_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_z_nf_nzc_zu_dn, render_spans_16_c2_ns_nt_z_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_t_nz_nf_nzc_zu_dn, render_spans_16_c2_ns_t_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_t_z_nf_nzc_zu_dn, render_spans_16_c2_ns_t_z_nf_nzc_zu_dn,
+ render_spans_16_c1_s_nt_nz_nf_nzc_zu_dn, render_spans_16_c2_s_nt_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_s_nt_z_nf_nzc_zu_dn, render_spans_16_c2_s_nt_z_nf_nzc_zu_dn,
+ render_spans_16_c1_s_t_nz_nf_nzc_zu_dn, render_spans_16_c2_s_t_nz_nf_nzc_zu_dn,
+ render_spans_16_c1_s_t_z_nf_nzc_zu_dn, render_spans_16_c2_s_t_z_nf_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_nz_f_nzc_zu_dn, render_spans_16_c2_ns_nt_nz_f_nzc_zu_dn,
+ render_spans_16_c1_ns_nt_z_f_nzc_zu_dn, render_spans_16_c2_ns_nt_z_f_nzc_zu_dn,
+ render_spans_16_c1_ns_t_nz_f_nzc_zu_dn, render_spans_16_c2_ns_t_nz_f_nzc_zu_dn,
+ render_spans_16_c1_ns_t_z_f_nzc_zu_dn, render_spans_16_c2_ns_t_z_f_nzc_zu_dn,
+ render_spans_16_c1_s_nt_nz_f_nzc_zu_dn, render_spans_16_c2_s_nt_nz_f_nzc_zu_dn,
+ render_spans_16_c1_s_nt_z_f_nzc_zu_dn, render_spans_16_c2_s_nt_z_f_nzc_zu_dn,
+ render_spans_16_c1_s_t_nz_f_nzc_zu_dn, render_spans_16_c2_s_t_nz_f_nzc_zu_dn,
+ render_spans_16_c1_s_t_z_f_nzc_zu_dn, render_spans_16_c2_s_t_z_f_nzc_zu_dn,
+
+ render_spans_16_c1_ns_nt_nz_nf_zc_zu_dn, render_spans_16_c2_ns_nt_nz_nf_zc_zu_dn,
+ render_spans_16_c1_ns_nt_z_nf_zc_zu_dn, render_spans_16_c2_ns_nt_z_nf_zc_zu_dn,
+ render_spans_16_c1_ns_t_nz_nf_zc_zu_dn, render_spans_16_c2_ns_t_nz_nf_zc_zu_dn,
+ render_spans_16_c1_ns_t_z_nf_zc_zu_dn, render_spans_16_c2_ns_t_z_nf_zc_zu_dn,
+ render_spans_16_c1_s_nt_nz_nf_zc_zu_dn, render_spans_16_c2_s_nt_nz_nf_zc_zu_dn,
+ render_spans_16_c1_s_nt_z_nf_zc_zu_dn, render_spans_16_c2_s_nt_z_nf_zc_zu_dn,
+ render_spans_16_c1_s_t_nz_nf_zc_zu_dn, render_spans_16_c2_s_t_nz_nf_zc_zu_dn,
+ render_spans_16_c1_s_t_z_nf_zc_zu_dn, render_spans_16_c2_s_t_z_nf_zc_zu_dn,
+ render_spans_16_c1_ns_nt_nz_f_zc_zu_dn, render_spans_16_c2_ns_nt_nz_f_zc_zu_dn,
+ render_spans_16_c1_ns_nt_z_f_zc_zu_dn, render_spans_16_c2_ns_nt_z_f_zc_zu_dn,
+ render_spans_16_c1_ns_t_nz_f_zc_zu_dn, render_spans_16_c2_ns_t_nz_f_zc_zu_dn,
+ render_spans_16_c1_ns_t_z_f_zc_zu_dn, render_spans_16_c2_ns_t_z_f_zc_zu_dn,
+ render_spans_16_c1_s_nt_nz_f_zc_zu_dn, render_spans_16_c2_s_nt_nz_f_zc_zu_dn,
+ render_spans_16_c1_s_nt_z_f_zc_zu_dn, render_spans_16_c2_s_nt_z_f_zc_zu_dn,
+ render_spans_16_c1_s_t_nz_f_zc_zu_dn, render_spans_16_c2_s_t_nz_f_zc_zu_dn,
+ render_spans_16_c1_s_t_z_f_zc_zu_dn, render_spans_16_c2_s_t_z_f_zc_zu_dn,
};
diff --git a/src/mame/video/rdptpipe.c b/src/mame/video/rdptpipe.c
index 164fa7b7a3d..f4b357ca47f 100644
--- a/src/mame/video/rdptpipe.c
+++ b/src/mame/video/rdptpipe.c
@@ -1,189 +1,318 @@
-INLINE void TEXTURE_PIPELINE_BILINEAR_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
+#define RELATIVE(x, y) (((((x) >> 3) - (y)) << 3) | (x & 7))
+
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
{
-#define RELATIVE(x, y) ((((x) >> 3) - (y)) << 3) | (x & 7);
INT32 maxs, maxt;
- COLOR t0, t1, t2, t3;
- int sss1, sst1, sss2, sst2;
+ COLOR t0, t1, t2, t3, TEX;
+ int sss2, sst2;
INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
INT32 R32, G32, B32, A32;
INT32 maxs2, maxt2;
- int upper = 0;
-
- t0.c = 0;
- t1.c = 0;
- t2.c = 0;
- t3.c = 0;
- sss1 = SSS;
- sst1 = SST;
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
- texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
-
- sss2 = sss1 + 32; sst2 = sst1 + 32;
+ sss2 = SSS + 32; sst2 = SST + 32;
maxs2 = ((sss2 >> 3) >= tex_tile->sh);
maxt2 = ((sst2 >> 3) >= tex_tile->th);
- sss1 = RELATIVE(sss1, tex_tile->sl);
- sst1 = RELATIVE(sst1, tex_tile->tl);
+ SSS = RELATIVE(SSS, tex_tile->sl);
+ SST = RELATIVE(SST, tex_tile->tl);
sss2 = RELATIVE(sss2, tex_tile->sl);
sst2 = RELATIVE(sst2, tex_tile->tl);
- SFRAC = sss1 & 0x1f;
- TFRAC = sst1 & 0x1f;
+ SFRAC = SSS & 0x1f;
+ TFRAC = SST & 0x1f;
- CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+ CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
- MASK(&sss1, &sst1, tex_tile);
+ MASK(&SSS, &SST, tex_tile);
MASK(&sss2, &sst2, tex_tile);
- upper = ((SFRAC + TFRAC) >= 0x20);
- if (upper)
- {
- INVSF = 0x20 - SFRAC;
- INVTF = 0x20 - TFRAC;
- }
+ t1.c = FETCH_TEXEL(sss2, SST);
+ t2.c = FETCH_TEXEL(SSS, sst2);
- FETCH_TEXEL(&t1, sss2, sst1, tex_tile);
- FETCH_TEXEL(&t2, sss1, sst2, tex_tile);
-
- if (!upper)
+ if ((SFRAC + TFRAC) < 0x20)
{
- FETCH_TEXEL(&t0, sss1, sst1, tex_tile);
+ t0.c = FETCH_TEXEL(SSS, SST);
R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
- TEX->i.r = (R32 < 0) ? 0 : R32;
+ TEX.i.r = (R32 < 0) ? 0 : R32;
G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
- TEX->i.g = (G32 < 0) ? 0 : G32;
+ TEX.i.g = (G32 < 0) ? 0 : G32;
B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
- TEX->i.b = (B32 < 0) ? 0 : B32;
+ TEX.i.b = (B32 < 0) ? 0 : B32;
A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
- TEX->i.a = (A32 < 0) ? 0 : A32;
+ TEX.i.a = (A32 < 0) ? 0 : A32;
}
else
{
- FETCH_TEXEL(&t3, sss2, sst2, tex_tile);
+ INVSF = 0x20 - SFRAC;
+ INVTF = 0x20 - TFRAC;
+ t3.c = FETCH_TEXEL(sss2, sst2);
R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
- TEX->i.r = (R32 < 0) ? 0 : R32;
+ TEX.i.r = (R32 < 0) ? 0 : R32;
G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
- TEX->i.g = (G32 < 0) ? 0 : G32;
+ TEX.i.g = (G32 < 0) ? 0 : G32;
B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
- TEX->i.b = (B32 < 0) ? 0 : B32;
+ TEX.i.b = (B32 < 0) ? 0 : B32;
A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
- TEX->i.a = (A32 < 0) ? 0 : A32;
+ TEX.i.a = (A32 < 0) ? 0 : A32;
}
+
+ return TEX.c;
}
-INLINE void TEXTURE_PIPELINE_BILINEAR_MID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile)
{
-#define RELATIVE(x, y) ((((x) >> 3) - (y)) << 3) | (x & 7);
INT32 maxs, maxt;
- COLOR t0, t1, t2, t3;
- int sss1, sst1, sss2, sst2;
+ COLOR t0, t1, t2, t3, TEX;
+ int sss2, sst2;
INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
INT32 R32, G32, B32, A32;
INT32 maxs2, maxt2;
- int upper = 0;
-
- t0.c = 0;
- t1.c = 0;
- t2.c = 0;
- t3.c = 0;
-
- sss1 = SSS;
- sst1 = SST;
- texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
- sss2 = sss1 + 32; sst2 = sst1 + 32;
+ sss2 = SSS + 32; sst2 = SST + 32;
maxs2 = ((sss2 >> 3) >= tex_tile->sh);
maxt2 = ((sst2 >> 3) >= tex_tile->th);
- sss1 = RELATIVE(sss1, tex_tile->sl);
- sst1 = RELATIVE(sst1, tex_tile->tl);
+ SSS = RELATIVE(SSS, tex_tile->sl);
+ SST = RELATIVE(SST, tex_tile->tl);
sss2 = RELATIVE(sss2, tex_tile->sl);
sst2 = RELATIVE(sst2, tex_tile->tl);
- SFRAC = sss1 & 0x1f;
- TFRAC = sst1 & 0x1f;
+ SFRAC = SSS & 0x1f;
+ TFRAC = SST & 0x1f;
- CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+ CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
- MASK(&sss1, &sst1, tex_tile);
+ MASK(&SSS, &SST, tex_tile);
MASK(&sss2, &sst2, tex_tile);
- upper = ((SFRAC + TFRAC) >= 0x20);
- if (upper)
- {
- INVSF = 0x20 - SFRAC;
- INVTF = 0x20 - TFRAC;
- }
- FETCH_TEXEL(&t0, sss1, sst1, tex_tile);
- FETCH_TEXEL(&t1, sss2, sst1, tex_tile);
- FETCH_TEXEL(&t2, sss1, sst2, tex_tile);
- FETCH_TEXEL(&t3, sss2, sst2, tex_tile);
+ t0.c = FETCH_TEXEL(SSS, SST);
+ t1.c = FETCH_TEXEL(sss2, SST);
+ t2.c = FETCH_TEXEL(SSS, sst2);
+ t3.c = FETCH_TEXEL(sss2, sst2);
if (SFRAC!= 0x10 || TFRAC != 0x10)
{
- if (upper)
+ if ((SFRAC + TFRAC) >= 0x20)
{
+ INVSF = 0x20 - SFRAC;
+ INVTF = 0x20 - TFRAC;
R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
- TEX->i.r = (R32 < 0) ? 0 : R32;
+ TEX.i.r = (R32 < 0) ? 0 : R32;
G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
- TEX->i.g = (G32 < 0) ? 0 : G32;
+ TEX.i.g = (G32 < 0) ? 0 : G32;
B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
- TEX->i.b = (B32 < 0) ? 0 : B32;
+ TEX.i.b = (B32 < 0) ? 0 : B32;
A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
- TEX->i.a = (A32 < 0) ? 0 : A32;
+ TEX.i.a = (A32 < 0) ? 0 : A32;
}
else
{
R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
- TEX->i.r = (R32 < 0) ? 0 : R32;
+ TEX.i.r = (R32 < 0) ? 0 : R32;
G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
- TEX->i.g = (G32 < 0) ? 0 : G32;
+ TEX.i.g = (G32 < 0) ? 0 : G32;
B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
- TEX->i.b = (B32 < 0) ? 0 : B32;
+ TEX.i.b = (B32 < 0) ? 0 : B32;
A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
- TEX->i.a = (A32 < 0) ? 0 : A32;
+ TEX.i.a = (A32 < 0) ? 0 : A32;
}
}
else // Is this accurate?
{
- TEX->i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
- TEX->i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
- TEX->i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
- TEX->i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
+ TEX.i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
+ TEX.i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
+ TEX.i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
+ TEX.i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
}
+
+ return TEX.c;
}
-INLINE void TEXTURE_PIPELINE_NEAREST_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile)
+INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
{
-#define RELATIVE(x, y) ((((x) >> 3) - (y)) << 3) | (x & 7);
INT32 maxs, maxt;
- int sss1, sst1;
INT32 SFRAC, TFRAC;
- sss1 = SSS;
- sst1 = SST;
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
+ SSS = RELATIVE(SSS, tex_tile->sl);
+ SST = RELATIVE(SST, tex_tile->tl);
+
+ SSS += 0x10;
+ SST += 0x10;
+
+ SFRAC = SSS & 0x1f;
+ TFRAC = SST & 0x1f;
+
+ CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+
+ MASK(&SSS, &SST, tex_tile);
+
+ /* point sample */
+ return FETCH_TEXEL(SSS, SST);
+}
- texshift(&sss1, &sst1, &maxs, &maxt, tex_tile);
- sss1 = RELATIVE(sss1, tex_tile->sl);
- sst1 = RELATIVE(sst1, tex_tile->tl);
+#if 0
+#define RELATIVE(x, y) (((((x) >> 3) - (y)) << 3) | (x & 7))
- sss1 += 0x10;
- sst1 += 0x10;
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
+{
+ INT32 maxs, maxt;
+ COLOR t0, t1, t2, t3, TEX;
+ int sss2, sst2;
+
+ INT32 SFRAC = 0;
+ INT32 TFRAC = 0;
+ INT32 INVSF = 0;
+ INT32 INVTF = 0;
+ INT32 R32 = 0;
+ INT32 G32 = 0;
+ INT32 B32 = 0;
+ INT32 A32 = 0;
+
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
+
+ SSS = RELATIVE(SSS, tex_tile->sl);
+ SST = RELATIVE(SST, tex_tile->tl);
+ sss2 = RELATIVE((SSS + 32), tex_tile->sl);
+ sst2 = RELATIVE((SST + 32), tex_tile->tl);
+
+ SFRAC = SSS & 0x1f;
+ TFRAC = SST & 0x1f;
+
+ CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+ CLAMP_LIGHT(&sss2, &sst2, ((sss2 >> 3) >= tex_tile->sh), ((sst2 >> 3) >= tex_tile->th), tex_tile);
+
+ MASK(&SSS, &SST, tex_tile);
+ MASK(&sss2, &sst2, tex_tile);
+
+ t1.c = FETCH_TEXEL(sss2, SST);
+ t2.c = FETCH_TEXEL(SSS, sst2);
+
+ if ((SFRAC + TFRAC) >= 0x20)
+ {
+ INVSF = 0x20 - SFRAC;
+ INVTF = 0x20 - TFRAC;
+ t3.c = FETCH_TEXEL(sss2, sst2);
+ R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
+ TEX.i.r = (R32 < 0) ? 0 : R32;
+ G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
+ TEX.i.g = (G32 < 0) ? 0 : G32;
+ B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
+ TEX.i.b = (B32 < 0) ? 0 : B32;
+ A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
+ TEX.i.a = (A32 < 0) ? 0 : A32;
+ }
+ else
+ {
+ t0.c = FETCH_TEXEL(SSS, SST);
+ R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
+ TEX.i.r = (R32 < 0) ? 0 : R32;
+ G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
+ TEX.i.g = (G32 < 0) ? 0 : G32;
+ B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
+ TEX.i.b = (B32 < 0) ? 0 : B32;
+ A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
+ TEX.i.a = (A32 < 0) ? 0 : A32;
+ }
+
+ return TEX.c;
+}
+
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile)
+{
+ INT32 maxs, maxt;
+ COLOR t0, t1, t2, t3, TEX;
+ int sss2, sst2;
+
+ INT32 SFRAC = 0, TFRAC = 0, INVSF = 0, INVTF = 0;
+ INT32 R32, G32, B32, A32;
+ INT32 maxs2, maxt2;
+
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
+
+ sss2 = SSS + 32; sst2 = SST + 32;
+ maxs2 = ((sss2 >> 3) >= tex_tile->sh);
+ maxt2 = ((sst2 >> 3) >= tex_tile->th);
+
+ SSS = RELATIVE(SSS, tex_tile->sl);
+ SST = RELATIVE(SST, tex_tile->tl);
+ sss2 = RELATIVE(sss2, tex_tile->sl);
+ sst2 = RELATIVE(sst2, tex_tile->tl);
+
+ SFRAC = SSS & 0x1f;
+ TFRAC = SST & 0x1f;
+
+ CLAMP(&SSS, &SST, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+ CLAMP_LIGHT(&sss2, &sst2, maxs2, maxt2, tex_tile);
+
+ MASK(&SSS, &SST, tex_tile);
+ MASK(&sss2, &sst2, tex_tile);
+
+ t0.c = FETCH_TEXEL(SSS, SST);
+ t1.c = FETCH_TEXEL(sss2, SST);
+ t2.c = FETCH_TEXEL(SSS, sst2);
+ t3.c = FETCH_TEXEL(sss2, sst2);
+
+ if(SFRAC != 0x10 || TFRAC != 0x10)
+ {
+ if (((SFRAC + TFRAC) >= 0x20))
+ {
+ INVSF = 0x20 - SFRAC;
+ INVTF = 0x20 - TFRAC;
+ R32 = t3.i.r + ((INVSF*(t2.i.r - t3.i.r))>>5) + ((INVTF*(t1.i.r - t3.i.r))>>5);
+ TEX.i.r = (R32 < 0) ? 0 : R32;
+ G32 = t3.i.g + ((INVSF*(t2.i.g - t3.i.g))>>5) + ((INVTF*(t1.i.g - t3.i.g))>>5);
+ TEX.i.g = (G32 < 0) ? 0 : G32;
+ B32 = t3.i.b + ((INVSF*(t2.i.b - t3.i.b))>>5) + ((INVTF*(t1.i.b - t3.i.b))>>5);
+ TEX.i.b = (B32 < 0) ? 0 : B32;
+ A32 = t3.i.a + ((INVSF*(t2.i.a - t3.i.a))>>5) + ((INVTF*(t1.i.a - t3.i.a))>>5);
+ TEX.i.a = (A32 < 0) ? 0 : A32;
+ }
+ else
+ {
+ R32 = t0.i.r + ((SFRAC*(t1.i.r - t0.i.r))>>5) + ((TFRAC*(t2.i.r - t0.i.r))>>5);
+ TEX.i.r = (R32 < 0) ? 0 : R32;
+ G32 = t0.i.g + ((SFRAC*(t1.i.g - t0.i.g))>>5) + ((TFRAC*(t2.i.g - t0.i.g))>>5);
+ TEX.i.g = (G32 < 0) ? 0 : G32;
+ B32 = t0.i.b + ((SFRAC*(t1.i.b - t0.i.b))>>5) + ((TFRAC*(t2.i.b - t0.i.b))>>5);
+ TEX.i.b = (B32 < 0) ? 0 : B32;
+ A32 = t0.i.a + ((SFRAC*(t1.i.a - t0.i.a))>>5) + ((TFRAC*(t2.i.a - t0.i.a))>>5);
+ TEX.i.a = (A32 < 0) ? 0 : A32;
+ }
+ }
+ else // Is this accurate?
+ {
+ TEX.i.r = (t0.i.r + t1.i.r + t2.i.r + t3.i.r) >> 2;
+ TEX.i.g = (t0.i.g + t1.i.g + t2.i.g + t3.i.g) >> 2;
+ TEX.i.b = (t0.i.b + t1.i.b + t2.i.b + t3.i.b) >> 2;
+ TEX.i.a = (t0.i.a + t1.i.a + t2.i.a + t3.i.a) >> 2;
+ }
+
+ return TEX.c;
+}
+
+INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile)
+{
+ INT32 maxs, maxt;
- SFRAC = sss1 & 0x1f;
- TFRAC = sst1 & 0x1f;
+ texshift(&SSS, &SST, &maxs, &maxt, tex_tile);
+ SSS = RELATIVE(SSS, tex_tile->sl) + 0x10;
+ SST = RELATIVE(SST, tex_tile->tl) + 0x10;
- CLAMP(&sss1, &sst1, &SFRAC, &TFRAC, maxs, maxt, tex_tile);
+ CLAMP_QUICK(&SSS, &SST, maxs, maxt, tex_tile->num);
- MASK(&sss1, &sst1, tex_tile);
+ MASK(&SSS, &SST, tex_tile);
/* point sample */
- FETCH_TEXEL(TEX, sss1, sst1, tex_tile);
+ return FETCH_TEXEL(SSS, SST);
}
+#endif
diff --git a/src/mame/video/rdptpipe.h b/src/mame/video/rdptpipe.h
index ff6bb77afe0..a38df5eaef4 100644
--- a/src/mame/video/rdptpipe.h
+++ b/src/mame/video/rdptpipe.h
@@ -1,8 +1,18 @@
-INLINE void TEXTURE_PIPELINE_BILINEAR_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
-INLINE void TEXTURE_PIPELINE_BILINEAR_MID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
-INLINE void TEXTURE_PIPELINE_NEAREST_NMID(COLOR* TEX, INT32 SSS, INT32 SST, TILE* tex_tile);
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile);
+INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
-static void (*rdp_texture_pipeline_func[4])(COLOR*, INT32, INT32, TILE*) =
+static UINT32 (*rdp_texture_pipeline_func[4])(INT32, INT32, TILE*) =
{
TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_NMID, TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_MID,
};
+#if 0
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
+INLINE UINT32 TEXTURE_PIPELINE_BILINEAR_MID(INT32 SSS, INT32 SST, TILE* tex_tile);
+INLINE UINT32 TEXTURE_PIPELINE_NEAREST_NMID(INT32 SSS, INT32 SST, TILE* tex_tile);
+
+static UINT32 (*rdp_texture_pipeline_func[4])(INT32, INT32, TILE*) =
+{
+ TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_NMID, TEXTURE_PIPELINE_NEAREST_NMID, TEXTURE_PIPELINE_BILINEAR_MID,
+};
+#endif
diff --git a/src/mame/video/rdptrect.c b/src/mame/video/rdptrect.c
index 5b07e9c8975..4f5695164c9 100644
--- a/src/mame/video/rdptrect.c
+++ b/src/mame/video/rdptrect.c
@@ -82,39 +82,50 @@
calculate_clamp_diffs(tilenum);
- set_shade_for_rects(); // Needed by Pilotwings 64
+ shade_color.c = 0; // Needed by Pilotwings 64
- if(rect->flip)
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
+ if(y1 < clipy1)
+ {
+ rect->t += rect->dtdy * (clipy1 - y1);
+ y1 = clipy1;
+ }
+ if(y2 > clipy2)
+ {
+ y2 = clipy2;
+ }
+ if(x1 < clipx1)
+ {
+ rect->s += rect->dsdx * (clipx1 - x1);
+ x1 = clipx1;
+ }
+ if(x2 > clipx2)
{
- int temp = rect->t;
- rect->t = rect->s;
- rect->s = temp;
- temp = rect->dtdy;
- rect->dtdy = rect->dsdx;
- rect->dsdx= temp;
+ x2 = clipx2;
}
+ rect->dsdx >>= 5;
+ rect->dtdy >>= 5;
- t = ((int)(rect->t)) << 5;
+ t = ((int)(rect->t));
for (j = y1; j < y2; j++)
{
- if (j >= clipy1 && j < clipy2)
- {
int fb_index = j * fb_width;
#if defined(MAGICDITHER) || defined(BAYERDITHER)
int mline = (j & 3) << 2;
#endif
- s = ((int)(rect->s)) << 5;
+ s = ((int)(rect->s));
for (i = x1; i < x2; i++)
{
- if (i >= clipx1 && i < clipx2)
- {
COLOR c;
#if defined(ZUPDATE)
int rendered = 0;
#endif
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
int dith = 0;
+#endif
int curpixel = fb_index + i;
UINT16* fbcur = &fb[curpixel ^ WORD_ADDR_XOR];
UINT8* hbcur = &hb[curpixel ^ BYTE_ADDR_XOR];
@@ -125,9 +136,16 @@
curpixel_cvg = 8;
- TEXTURE_PIPELINE(&texel0_color, s >> 5, t >> 5, tex_tile);
+ if(rect->flip)
+ {
+ texel0_color.c = TEXTURE_PIPELINE(t, s, tex_tile);
+ }
+ else
+ {
+ texel0_color.c = TEXTURE_PIPELINE(s, t, tex_tile);
+ }
- COLOR_COMBINER1(&c);
+ c.c = COLOR_COMBINER1();
#if defined(MAGICDITHER)
dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)];
@@ -138,16 +156,22 @@
#if defined(ZCOMPARE)
if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z))
{
+#endif
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
#if defined(ZUPDATE)
- rendered = BLENDER1_16(fbcur, hbcur, c, dith);
+ rendered = BLENDER1_16_DITH(fbcur, hbcur, c, dith);
#else
- BLENDER1_16(fbcur, hbcur, c, dith);
+ BLENDER1_16_DITH(fbcur, hbcur, c, dith);
#endif
- }
-#elif defined(ZUPDATE)
- rendered = BLENDER1_16(fbcur, hbcur, c, dith);
#else
- BLENDER1_16(fbcur, hbcur, c, dith);
+#if defined(ZUPDATE)
+ rendered = BLENDER1_16_NDITH(fbcur, hbcur, c);
+#else
+ BLENDER1_16_NDITH(fbcur, hbcur, c);
+#endif
+#endif
+#if defined(ZCOMPARE)
+ }
#endif
#if defined(ZUPDATE)
@@ -156,11 +180,10 @@
z_store(zbcur, zhbcur, ((UINT32)primitive_z) << 3,primitive_delta_z);
}
#endif
- }
+
s += (int)(rect->dsdx);
}
- }
t += (int)(rect->dtdy);
}
}
@@ -264,17 +287,7 @@
}
- set_shade_for_rects(); // Needed by Pilotwings 64
-
- if(rect->flip)
- {
- int temp = rect->t;
- rect->t = rect->s;
- rect->s = temp;
- temp = rect->dtdy;
- rect->dtdy = rect->dsdx;
- rect->dsdx= temp;
- }
+ shade_color.c = 0; // Needed by Pilotwings 64
t = ((int)(rect->t)) << 5;
@@ -304,18 +317,35 @@
UINT16* zbcur = &zb[curpixel ^ WORD_ADDR_XOR];
UINT8* zhbcur = &zhb[curpixel ^ BYTE_ADDR_XOR];
#endif
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
int dith = 0;
+#endif
curpixel_cvg = 8;
ss = s >> 5;
st = t >> 5;
- TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
- TEXTURE_PIPELINE(&texel1_color, ss, st, tex_tile2);
+ if(rect->flip)
+ {
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(st, ss, tex_tile2);
+ }
+ else
+ {
+ CACHE_TEXTURE_PARAMS(tex_tile);
+ texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
+
+ CACHE_TEXTURE_PARAMS(tex_tile2);
+ texel1_color.c = TEXTURE_PIPELINE(ss, st, tex_tile2);
+ }
+
- COLOR_COMBINER2_C0(&c1);
- COLOR_COMBINER2_C1(&c2);
+ c1.c = COLOR_COMBINER2_C0();
+ c2.c = COLOR_COMBINER2_C1();
#if defined(MAGICDITHER)
dith = magic_matrix[mline + ((i ^ WORD_ADDR_XOR) & 3)];
@@ -326,19 +356,23 @@
#if defined(ZCOMPARE)
if (z_compare(fbcur, hbcur, zbcur, zhbcur, ((UINT32)primitive_z)<<3,primitive_delta_z))
{
+#endif
+#if defined(MAGICDITHER) || defined(BAYERDITHER)
#if defined(ZUPDATE)
- rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
+ rendered = BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
#else
- BLENDER2_16(fbcur, hbcur, c1, c2, dith);
+ BLENDER2_16_DITH(fbcur, hbcur, c1, c2, dith);
#endif
- }
#else
#if defined(ZUPDATE)
- rendered = BLENDER2_16(fbcur, hbcur, c1, c2, dith);
+ rendered = BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
#else
- BLENDER2_16(fbcur, hbcur, c1, c2, dith);
+ BLENDER2_16_NDITH(fbcur, hbcur, c1, c2);
#endif
#endif
+#if defined(ZCOMPARE)
+ }
+#endif
#if defined(ZUPDATE)
if(rendered)
@@ -430,20 +464,12 @@
calculate_clamp_diffs(tilenum);
- set_shade_for_rects(); // Needed by Pilotwings 64
-
- if(rect->flip)
- {
- int temp = rect->t;
- rect->t = rect->s;
- rect->s = temp;
- temp = rect->dtdy;
- rect->dtdy = rect->dsdx;
- rect->dsdx= temp;
- }
+ shade_color.c = 0; // Needed by Pilotwings 64
t = ((int)(rect->t)) << 5;
+ CACHE_TEXTURE_PARAMS(tex_tile);
+
for (j = y1; j < y2; j++)
{
int fb_index = j * fb_width;
@@ -458,7 +484,14 @@
ss = s >> 5;
st = t >> 5;
- TEXTURE_PIPELINE(&texel0_color, ss, st, tex_tile);
+ if(rect->flip)
+ {
+ texel0_color.c = TEXTURE_PIPELINE(st, ss, tex_tile);
+ }
+ else
+ {
+ texel0_color.c = TEXTURE_PIPELINE(ss, st, tex_tile);
+ }
curpixel_cvg = 8;
diff --git a/src/mame/video/rdptrect.h b/src/mame/video/rdptrect.h
index 107aba805e7..135926871b9 100644
--- a/src/mame/video/rdptrect.h
+++ b/src/mame/video/rdptrect.h
@@ -47,23 +47,23 @@ static void texture_rectangle_16bit_cf_zc_zu_dm(TEX_RECTANGLE *rect);
static void texture_rectangle_16bit_cf_zc_zu_db(TEX_RECTANGLE *rect);
static void texture_rectangle_16bit_cf_zc_zu_dn(TEX_RECTANGLE *rect);
-static void (*rdp_texture_rectangle_16bit_func[48])(TEX_RECTANGLE *) =
+static void (*rdp_texture_rectangle_16bit_func[64])(TEX_RECTANGLE *) =
{
- texture_rectangle_16bit_c1_nzc_nzu_dm, texture_rectangle_16bit_c1_nzc_nzu_db, texture_rectangle_16bit_c1_nzc_nzu_dn,
- texture_rectangle_16bit_c2_nzc_nzu_dm, texture_rectangle_16bit_c2_nzc_nzu_db, texture_rectangle_16bit_c2_nzc_nzu_dn,
- texture_rectangle_16bit_cc_nzc_nzu_dm, texture_rectangle_16bit_cc_nzc_nzu_db, texture_rectangle_16bit_cc_nzc_nzu_dn,
- texture_rectangle_16bit_cf_nzc_nzu_dm, texture_rectangle_16bit_cf_nzc_nzu_db, texture_rectangle_16bit_cf_nzc_nzu_dn,
- texture_rectangle_16bit_c1_zc_nzu_dm, texture_rectangle_16bit_c1_zc_nzu_db, texture_rectangle_16bit_c1_zc_nzu_dn,
- texture_rectangle_16bit_c2_zc_nzu_dm, texture_rectangle_16bit_c2_zc_nzu_db, texture_rectangle_16bit_c2_zc_nzu_dn,
- texture_rectangle_16bit_cc_zc_nzu_dm, texture_rectangle_16bit_cc_zc_nzu_db, texture_rectangle_16bit_cc_zc_nzu_dn,
- texture_rectangle_16bit_cf_zc_nzu_dm, texture_rectangle_16bit_cf_zc_nzu_db, texture_rectangle_16bit_cf_zc_nzu_dn,
- texture_rectangle_16bit_c1_nzc_zu_dm, texture_rectangle_16bit_c1_nzc_zu_db, texture_rectangle_16bit_c1_nzc_zu_dn,
- texture_rectangle_16bit_c2_nzc_zu_dm, texture_rectangle_16bit_c2_nzc_zu_db, texture_rectangle_16bit_c2_nzc_zu_dn,
- texture_rectangle_16bit_cc_nzc_zu_dm, texture_rectangle_16bit_cc_nzc_zu_db, texture_rectangle_16bit_cc_nzc_zu_dn,
- texture_rectangle_16bit_cf_nzc_zu_dm, texture_rectangle_16bit_cf_nzc_zu_db, texture_rectangle_16bit_cf_nzc_zu_dn,
- texture_rectangle_16bit_c1_zc_zu_dm, texture_rectangle_16bit_c1_zc_zu_db, texture_rectangle_16bit_c1_zc_zu_dn,
- texture_rectangle_16bit_c2_zc_zu_dm, texture_rectangle_16bit_c2_zc_zu_db, texture_rectangle_16bit_c2_zc_zu_dn,
- texture_rectangle_16bit_cc_zc_zu_dm, texture_rectangle_16bit_cc_zc_zu_db, texture_rectangle_16bit_cc_zc_zu_dn,
- texture_rectangle_16bit_cf_zc_zu_dm, texture_rectangle_16bit_cf_zc_zu_db, texture_rectangle_16bit_cf_zc_zu_dn,
+ texture_rectangle_16bit_c1_nzc_nzu_dm, texture_rectangle_16bit_c1_nzc_nzu_db, texture_rectangle_16bit_c1_nzc_nzu_dn, texture_rectangle_16bit_c1_nzc_nzu_dn,
+ texture_rectangle_16bit_c2_nzc_nzu_dm, texture_rectangle_16bit_c2_nzc_nzu_db, texture_rectangle_16bit_c2_nzc_nzu_dn, texture_rectangle_16bit_c2_nzc_nzu_dn,
+ texture_rectangle_16bit_cc_nzc_nzu_dm, texture_rectangle_16bit_cc_nzc_nzu_db, texture_rectangle_16bit_cc_nzc_nzu_dn, texture_rectangle_16bit_cc_nzc_nzu_dn,
+ texture_rectangle_16bit_cf_nzc_nzu_dm, texture_rectangle_16bit_cf_nzc_nzu_db, texture_rectangle_16bit_cf_nzc_nzu_dn, texture_rectangle_16bit_cf_nzc_nzu_dn,
+ texture_rectangle_16bit_c1_zc_nzu_dm, texture_rectangle_16bit_c1_zc_nzu_db, texture_rectangle_16bit_c1_zc_nzu_dn, texture_rectangle_16bit_c1_zc_nzu_dn,
+ texture_rectangle_16bit_c2_zc_nzu_dm, texture_rectangle_16bit_c2_zc_nzu_db, texture_rectangle_16bit_c2_zc_nzu_dn, texture_rectangle_16bit_c2_zc_nzu_dn,
+ texture_rectangle_16bit_cc_zc_nzu_dm, texture_rectangle_16bit_cc_zc_nzu_db, texture_rectangle_16bit_cc_zc_nzu_dn, texture_rectangle_16bit_cc_zc_nzu_dn,
+ texture_rectangle_16bit_cf_zc_nzu_dm, texture_rectangle_16bit_cf_zc_nzu_db, texture_rectangle_16bit_cf_zc_nzu_dn, texture_rectangle_16bit_cf_zc_nzu_dn,
+ texture_rectangle_16bit_c1_nzc_zu_dm, texture_rectangle_16bit_c1_nzc_zu_db, texture_rectangle_16bit_c1_nzc_zu_dn, texture_rectangle_16bit_c1_nzc_zu_dn,
+ texture_rectangle_16bit_c2_nzc_zu_dm, texture_rectangle_16bit_c2_nzc_zu_db, texture_rectangle_16bit_c2_nzc_zu_dn, texture_rectangle_16bit_c2_nzc_zu_dn,
+ texture_rectangle_16bit_cc_nzc_zu_dm, texture_rectangle_16bit_cc_nzc_zu_db, texture_rectangle_16bit_cc_nzc_zu_dn, texture_rectangle_16bit_cc_nzc_zu_dn,
+ texture_rectangle_16bit_cf_nzc_zu_dm, texture_rectangle_16bit_cf_nzc_zu_db, texture_rectangle_16bit_cf_nzc_zu_dn, texture_rectangle_16bit_cf_nzc_zu_dn,
+ texture_rectangle_16bit_c1_zc_zu_dm, texture_rectangle_16bit_c1_zc_zu_db, texture_rectangle_16bit_c1_zc_zu_dn, texture_rectangle_16bit_c1_zc_zu_dn,
+ texture_rectangle_16bit_c2_zc_zu_dm, texture_rectangle_16bit_c2_zc_zu_db, texture_rectangle_16bit_c2_zc_zu_dn, texture_rectangle_16bit_c2_zc_zu_dn,
+ texture_rectangle_16bit_cc_zc_zu_dm, texture_rectangle_16bit_cc_zc_zu_db, texture_rectangle_16bit_cc_zc_zu_dn, texture_rectangle_16bit_cc_zc_zu_dn,
+ texture_rectangle_16bit_cf_zc_zu_dm, texture_rectangle_16bit_cf_zc_zu_db, texture_rectangle_16bit_cf_zc_zu_dn, texture_rectangle_16bit_cf_zc_zu_dn,
};
diff --git a/src/mame/video/rdptri.c b/src/mame/video/rdptri.c
index a002c45cda7..73a8f6959a3 100644
--- a/src/mame/video/rdptri.c
+++ b/src/mame/video/rdptri.c
@@ -2624,133 +2624,209 @@ static void triangle_s_t_z(UINT32 w1, UINT32 w2)
ympix = ym >> 2;
ylpix = yl >> 2;
- for (k = ycur; k <= ylfar; k++)
+ if(flip)
{
- if (k == ym)
- {
- xleft = xl;
- xleft_inc = dxldy >> 2;
- }
-
- xstart = xleft >> 16;
- xend = xright >> 16;
- j = k >> 2;
- spix = k & 3;
-
- if (k >= 0 && k < 0x1000)
+ for (k = ycur; k <= ylfar; k++)
{
- int m = 0;
- int n = 0;
- int length = 0;
- min = 0; max = 3;
- if (j == yhpix)
+ if (k == ym)
{
- min = yh & 3;
- }
- if (j == ylpix)
- {
- max = yl & 3;
+ xleft = xl;
+ xleft_inc = dxldy >> 2;
}
- if (spix >= min && spix <= max)
+
+ xstart = xleft >> 16;
+ xend = xright >> 16;
+ j = k >> 2;
+ spix = k & 3;
+
+ if (k >= 0 && k < 0x1000)
{
- if (spix == min)
+ int m = 0;
+ int n = 0;
+ int length = 0;
+ min = 0; max = 3;
+ if (j == yhpix)
{
- minxmx = maxxmx = xstart;
- minxhx = maxxhx = xend;
+ min = yh & 3;
}
- else
+ if (j == ylpix)
{
- minxmx = (xstart < minxmx) ? xstart : minxmx;
- maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
- minxhx = (xend < minxhx) ? xend : minxhx;
- maxxhx = (xend > maxxhx) ? xend : maxxhx;
+ max = yl & 3;
+ }
+ if (spix >= min && spix <= max)
+ {
+ if (spix == min)
+ {
+ minxmx = maxxmx = xstart;
+ minxhx = maxxhx = xend;
+ }
+ else
+ {
+ minxmx = (xstart < minxmx) ? xstart : minxmx;
+ maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
+ minxhx = (xend < minxhx) ? xend : minxhx;
+ maxxhx = (xend > maxxhx) ? xend : maxxhx;
+ }
}
- }
- if (spix == max)
- {
- if (flip)
+ if (spix == max)
{
span[j].lx = maxxmx;
span[j].rx = minxhx;
}
- else
+
+ length = xstart - xend;
+
+ if (spix == ldflag)
{
- span[j].lx = minxmx;
- span[j].rx = maxxhx;
+ xfrac = ((xright >> 8) & 0xff);
+ adjust_attr();
}
- }
- length = flip ? (xstart - xend) : (xend - xstart);
+ m = xend + 1;
- if (spix == ldflag)
+ if (k >= yh && length >= 0 && k <= yl)
+ {
+ if (xstart>=0 && xstart <1024)
+ {
+ span[j].cvg[xstart] += addright(xleft);
+ }
+ if (xend>=0 && xend<1024)
+ {
+ if (xstart != xend)
+ {
+ span[j].cvg[xend] += addleft(xright);
+ }
+ else
+ {
+ span[j].cvg[xend] -= (2 - addleft(xright));
+ if (span[j].cvg[xend] > 200)
+ {
+ span[j].cvg[xend] = 0;
+ }
+ }
+ }
+ for (n = 0; n < (length - 1); n++)
+ {
+ if (m>=0 && m < 640)
+ {
+ span[j].cvg[m] += 2;
+ }
+
+ m += m_inc;
+ }
+ }
+ }
+
+ if (spix == 3)
{
- xfrac = ((xright >> 8) & 0xff);
- adjust_attr();
+ addvalues();
+ }
+ xleft += xleft_inc;
+ xright += xright_inc;
+ }
+ }
+ else
+ {
+ for (k = ycur; k <= ylfar; k++)
+ {
+ if (k == ym)
+ {
+ xleft = xl;
+ xleft_inc = dxldy >> 2;
}
- m = flip ? (xend+1) : (xend-1);
+ xstart = xleft >> 16;
+ xend = xright >> 16;
+ j = k >> 2;
+ spix = k & 3;
- if (k >= yh && length >= 0 && k <= yl)
+ if (k >= 0 && k < 0x1000)
{
- if (xstart>=0 && xstart <1024)
+ int m = 0;
+ int n = 0;
+ int length = 0;
+ min = 0; max = 3;
+ if (j == yhpix)
{
- if (!flip)
+ min = yh & 3;
+ }
+ if (j == ylpix)
+ {
+ max = yl & 3;
+ }
+ if (spix >= min && spix <= max)
+ {
+ if (spix == min)
{
- span[j].cvg[xstart] += addleft(xleft);
+ minxmx = maxxmx = xstart;
+ minxhx = maxxhx = xend;
}
else
{
- span[j].cvg[xstart] += addright(xleft);
+ minxmx = (xstart < minxmx) ? xstart : minxmx;
+ maxxmx = (xstart > maxxmx) ? xstart : maxxmx;
+ minxhx = (xend < minxhx) ? xend : minxhx;
+ maxxhx = (xend > maxxhx) ? xend : maxxhx;
}
}
- if (xend>=0 && xend<1024)
+
+ if (spix == max)
{
- if (xstart != xend)
+ span[j].lx = minxmx;
+ span[j].rx = maxxhx;
+ }
+
+ length = xend - xstart;
+
+ if (spix == ldflag)
+ {
+ xfrac = ((xright >> 8) & 0xff);
+ adjust_attr();
+ }
+
+ m = xend - 1;
+
+ if (k >= yh && length >= 0 && k <= yl)
+ {
+ if (xstart>=0 && xstart <1024)
{
- if (!flip)
+ span[j].cvg[xstart] += addleft(xleft);
+ }
+ if (xend>=0 && xend<1024)
+ {
+ if (xstart != xend)
{
span[j].cvg[xend] += addright(xright);
}
else
{
- span[j].cvg[xend] += addleft(xright);
+ span[j].cvg[xend] -= (2 - addright(xright));
+ if (span[j].cvg[xend] > 200)
+ {
+ span[j].cvg[xend] = 0;
+ }
}
}
- else
+ for (n = 0; n < (length - 1); n++)
{
- if (!flip)
- {
- span[j].cvg[xend] -= (2 - addright(xright));
- }
- else
+ if (m>=0 && m < 640)
{
- span[j].cvg[xend] -= (2 - addleft(xright));
+ span[j].cvg[m] += 2;
}
- if (span[j].cvg[xend] > 200)
- {
- span[j].cvg[xend] = 0;
- }
- }
- }
- for (n = 0; n < (length - 1); n++)
- {
- if (m>=0 && m < 640)
- {
- span[j].cvg[m] += 2;
- }
- m += m_inc;
+ m += m_inc;
+ }
}
}
- }
- if (spix == 3)
- {
- addvalues();
+ if (spix == 3)
+ {
+ addvalues();
+ }
+ xleft += xleft_inc;
+ xright += xright_inc;
}
- xleft += xleft_inc;
- xright += xright_inc;
}
switch (fb_size) // 8bpp needs to be implemented
diff --git a/src/mame/video/rdpupd16.c b/src/mame/video/rdpupd16.c
index 8e0214de200..bef006337ca 100644
--- a/src/mame/video/rdpupd16.c
+++ b/src/mame/video/rdpupd16.c
@@ -13,7 +13,6 @@
#endif
{
int i, j;
- UINT32 final = 0;
#if defined(DIVOT)
UINT32 prev_cvg = 0, next_cvg = 0;
#endif
@@ -61,7 +60,8 @@
for (i=0; i < hres; i++)
{
- int r, g, b;
+ COLOR c;
+ //int r, g, b;
pix = frame_buffer[pixels ^ WORD_ADDR_XOR];
curpixel_cvg = ((pix & 1) << 2) | (hidden_buffer[pixels ^ BYTE_ADDR_XOR] & 3);
@@ -73,15 +73,16 @@
next_cvg = ((frame_buffer[(pixels + 1)^WORD_ADDR_XOR] & 1) << 2) | (hidden_buffer[(pixels + 1)^BYTE_ADDR_XOR] & 3);
}
#endif
- r = ((pix >> 8) & 0xf8) | (pix >> 13);
- g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
- b = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07);
+ c.c = rgb16_to_32_lut[pix];
+ //r = ((pix >> 8) & 0xf8) | (pix >> 13);
+ //g = ((pix >> 3) & 0xf8) | ((pix >> 8) & 0x07);
+ //b = ((pix << 2) & 0xf8) | ((pix >> 3) & 0x07);
#if defined(FSAA)
- if (/*!vibuffering &&*/ curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2))
- {
- video_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64_vi_width);
- }
+ //if (/*!vibuffering &&*/ curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2))
+ //{
+ //video_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR],&hidden_buffer[pixels ^ BYTE_ADDR_XOR], n64_vi_width);
+ //}
#endif
//else if (dither_filter && curpixel_cvg == 7 && i > 0 && j > 0 && i < (hres - 1) && j < (vres - 1))
//{
@@ -103,7 +104,7 @@
//}
//else
//{
- divot_filter16(&r, &g, &b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR);
+ divot_filter16(&c.i.r, &c.i.g, &c.i.b, &frame_buffer[pixels ^ WORD_ADDR_XOR], pixels ^ WORD_ADDR_XOR);
//}
}
#endif
@@ -140,8 +141,7 @@
*/
pixels++;
- final = (r << 16) | (g << 8) | b;
- d[i] = final; // Fix me for endianness
+ d[i] = c.c >> 8;//(r << 16) | (g << 8) | b; // Fix me for endianness
}
pixels +=invisiblewidth;
}
diff --git a/src/mame/video/rdpzcomp.c b/src/mame/video/rdpzcomp.c
new file mode 100644
index 00000000000..d8f1f6db535
--- /dev/null
+++ b/src/mame/video/rdpzcomp.c
@@ -0,0 +1,168 @@
+#if defined(ZMODE0)
+ #if defined(ANTIALIAS)
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #endif
+#elif defined(ZMODE1)
+ #if defined(ANTIALIAS)
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #endif
+#elif defined(ZMODE2)
+ #if defined(ANTIALIAS)
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #endif
+#elif defined(ZMODE3)
+ #if defined(ANTIALIAS)
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #else
+ #if defined(IMGREAD)
+ INLINE UINT32 z_compare_IMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #else
+ INLINE UINT32 z_compare_NIMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix)
+ #endif
+ #endif
+#endif
+{
+ int force_coplanar = 0;
+ UINT32 oz = z_decompress(zb);
+ UINT32 dzmem = dz_decompress(zb, zhb);
+ UINT32 dznew = 0;
+ UINT32 farther = 0;
+ UINT32 diff = 0;
+ UINT32 nearer = 0;
+ UINT32 infront = 0;
+ UINT32 max = 0;
+ int precision_factor = (oz >> 15) & 0xf;
+ int overflow = 0;
+#if defined(ZMODE1)
+ int cvgcoeff = 0;
+#endif
+ UINT32 mempixel, memory_cvg;
+
+ sz &= 0x3ffff;
+ if (dzmem == 0x8000 && precision_factor < 3)
+ {
+ force_coplanar = 1;
+ }
+ if (!precision_factor)
+ {
+ dzmem = ((dzmem << 1) > 16) ? (dzmem << 1) : 16;
+ }
+ else if (precision_factor == 1)
+ {
+ dzmem = ((dzmem << 1) > 8) ? (dzmem << 1) : 8;
+ }
+ else if (precision_factor == 2)
+ {
+ dzmem = ((dzmem << 1) > 4) ? (dzmem << 1) : 4;
+ }
+ if (dzmem == 0 && precision_factor < 3)
+ {
+ dzmem = 0xffff;
+ }
+ if (dzmem > 0x8000)
+ {
+ dzmem = 0xffff;
+ }
+ dznew =((dzmem > dzpix) ? dzmem : (UINT32)dzpix) << 3;
+ dznew &= 0x3ffff;
+
+ farther = ((sz + dznew) >= oz) ? 1 : 0;
+ diff = (sz >= dznew) ? (sz - dznew) : 0;
+ nearer = (diff <= oz) ? 1: 0;
+ infront = (sz < oz) ? 1 : 0;
+ max = (dzmem == 0x3ffff);
+
+ if (force_coplanar)
+ {
+ farther = nearer = 1;
+ }
+
+ curpixel_overlap = 0;
+
+ switch(fb_size)
+ {
+ case 1: /* Banjo Tooie */
+ memory_cvg = 0; //??
+ break;
+ case 2:
+ mempixel = *(UINT16*)fb;
+ memory_cvg = ((mempixel & 1) << 2) + (*hb & 3);
+ break;
+ case 3:
+ mempixel = *(UINT32*)fb;
+ memory_cvg = (mempixel >> 5) & 7;
+ break;
+ default:
+ fatalerror("z_compare: fb_size = %d",fb_size);
+ break;
+ }
+
+#if !defined(IMGREAD)
+ memory_cvg = 7;
+#endif
+
+ overflow = ((memory_cvg + curpixel_cvg - 1) > 7) ? 1 : 0;
+
+#if defined(ANTIALIAS)
+ curpixel_overlap = (other_modes.force_blend || (!overflow && farther));
+#else
+ curpixel_overlap = other_modes.force_blend;
+#endif
+
+#if defined(ZMODE1)
+ if (infront && farther && overflow)
+ {
+ cvgcoeff = ((dzmem >> dznew) - (sz >> dznew)) & 0xf;
+ curpixel_cvg = ((cvgcoeff * (curpixel_cvg - 1)) >> 3) & 0xf;
+ }
+#endif
+ if (curpixel_cvg > 8)
+ curpixel_cvg = 8;
+
+#if defined(ZMODE0)
+ return (max || (overflow ? infront : nearer))? 1 : 0;
+#elif defined(ZMODE1)
+ return (max || (overflow ? infront : nearer))? 1 : 0;
+#elif defined(ZMODE2)
+ return infront | max;
+#elif defined(ZMODE3)
+ return farther & nearer & !max;
+#else
+ return 0;
+#endif
+}
+
diff --git a/src/mame/video/rdpzcomp.h b/src/mame/video/rdpzcomp.h
new file mode 100644
index 00000000000..2ed3d314170
--- /dev/null
+++ b/src/mame/video/rdpzcomp.h
@@ -0,0 +1,24 @@
+INLINE UINT32 z_compare_IMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_AA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_NAA_Z0(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_AA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_NAA_Z1(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_AA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_NAA_Z2(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_AA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_IMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+INLINE UINT32 z_compare_NIMR_NAA_Z3(void* fb, UINT8* hb, UINT16* zb, UINT8* zhb, UINT32 sz, UINT16 dzpix);
+
+static UINT32 (*rdp_z_compare_func[16])(void*, UINT8*, UINT16*, UINT8*, UINT32, UINT16) =
+{
+ z_compare_IMR_AA_Z0, z_compare_NIMR_AA_Z0, z_compare_IMR_NAA_Z0, z_compare_NIMR_NAA_Z0,
+ z_compare_IMR_AA_Z1, z_compare_NIMR_AA_Z1, z_compare_IMR_NAA_Z1, z_compare_NIMR_NAA_Z1,
+ z_compare_IMR_AA_Z2, z_compare_NIMR_AA_Z2, z_compare_IMR_NAA_Z2, z_compare_NIMR_NAA_Z2,
+ z_compare_IMR_AA_Z3, z_compare_NIMR_AA_Z3, z_compare_IMR_NAA_Z3, z_compare_NIMR_NAA_Z3
+};