This commit is contained in:
RobertoFresca 2016-05-01 23:46:02 -03:00
commit 44239bc3cf
4 changed files with 57 additions and 51 deletions

View File

@ -1353,6 +1353,15 @@ static void recompute_texture_params(tmu_state *t)
t->detailbias = (INT8)(TEXDETAIL_DETAIL_BIAS(t->reg[tDetail].u) << 2) << 6;
t->detailscale = TEXDETAIL_DETAIL_SCALE(t->reg[tDetail].u);
/* ensure that the NCC tables are up to date */
if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1)
{
ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)];
t->texel[1] = t->texel[9] = n->texel;
if (n->dirty)
ncc_table_update(n);
}
/* no longer dirty */
t->regdirty = FALSE;
@ -1371,15 +1380,6 @@ static inline INT32 prepare_tmu(tmu_state *t)
if (t->regdirty)
{
recompute_texture_params(t);
/* ensure that the NCC tables are up to date */
if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1)
{
ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)];
t->texel[1] = t->texel[9] = n->texel;
if (n->dirty)
ncc_table_update(n);
}
}
/* compute (ds^2 + dt^2) in both X and Y as 28.36 numbers */
@ -1748,15 +1748,15 @@ UINT32 voodoo_device::cmdfifo_execute(voodoo_device *vd, cmdfifo_info *f)
if (command & (1 << 12))
svert.z = *(float *)src++;
if (command & (1 << 13))
svert.wb = *(float *)src++;
svert.wb = svert.w0 = svert.w1 = *(float *)src++;
/* load W0, S0, T0 values */
if (command & (1 << 14))
svert.w0 = *(float *)src++;
svert.w0 = svert.w1 = *(float *)src++;
if (command & (1 << 15))
{
svert.s0 = *(float *)src++;
svert.t0 = *(float *)src++;
svert.s0 = svert.s1 = *(float *)src++;
svert.t0 = svert.t1 = *(float *)src++;
}
/* load W1, S1, T1 values */
@ -2925,7 +2925,7 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
{
UINT16 *dest, *depth;
UINT32 destmax, depthmax;
int sr[2], sg[2], sb[2], sa[2], sw[2];
int sr[2], sg[2], sb[2], sa[2], sz[2];
int x, y, scry, mask;
int pix, destbuf;
@ -2947,7 +2947,7 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
}
/* extract default depth and alpha values */
sw[0] = sw[1] = vd->reg[zaColor].u & 0xffff;
sz[0] = sz[1] = vd->reg[zaColor].u & 0xffff;
sa[0] = sa[1] = vd->reg[zaColor].u >> 24;
/* first extract A,R,G,B from the data */
@ -3054,55 +3054,55 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
case 16*0 + 12: /* ARGB, 32-bit depth+RGB 5-6-5 */
case 16*2 + 12: /* RGBA, 32-bit depth+RGB 5-6-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_565_TO_888(data, sr[0], sg[0], sb[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*1 + 12: /* ABGR, 32-bit depth+RGB 5-6-5 */
case 16*3 + 12: /* BGRA, 32-bit depth+RGB 5-6-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_565_TO_888(data, sb[0], sg[0], sr[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*0 + 13: /* ARGB, 32-bit depth+RGB x-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_x555_TO_888(data, sr[0], sg[0], sb[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*1 + 13: /* ABGR, 32-bit depth+RGB x-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_x555_TO_888(data, sb[0], sg[0], sr[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*2 + 13: /* RGBA, 32-bit depth+RGB x-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_555x_TO_888(data, sr[0], sg[0], sb[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*3 + 13: /* BGRA, 32-bit depth+RGB x-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_555x_TO_888(data, sb[0], sg[0], sr[0]);
mask = LFB_RGB_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*0 + 14: /* ARGB, 32-bit depth+ARGB 1-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_1555_TO_8888(data, sa[0], sr[0], sg[0], sb[0]);
mask = LFB_RGB_PRESENT | LFB_ALPHA_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*1 + 14: /* ABGR, 32-bit depth+ARGB 1-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_1555_TO_8888(data, sa[0], sb[0], sg[0], sr[0]);
mask = LFB_RGB_PRESENT | LFB_ALPHA_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*2 + 14: /* RGBA, 32-bit depth+ARGB 1-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_5551_TO_8888(data, sr[0], sg[0], sb[0], sa[0]);
mask = LFB_RGB_PRESENT | LFB_ALPHA_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
case 16*3 + 14: /* BGRA, 32-bit depth+ARGB 1-5-5-5 */
sw[0] = data >> 16;
sz[0] = data >> 16;
EXTRACT_5551_TO_8888(data, sb[0], sg[0], sr[0], sa[0]);
mask = LFB_RGB_PRESENT | LFB_ALPHA_PRESENT | LFB_DEPTH_PRESENT_MSW;
break;
@ -3111,8 +3111,8 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
case 16*1 + 15: /* ARGB, 16-bit depth */
case 16*2 + 15: /* ARGB, 16-bit depth */
case 16*3 + 15: /* ARGB, 16-bit depth */
sw[0] = data & 0xffff;
sw[1] = data >> 16;
sz[0] = data & 0xffff;
sz[1] = data >> 16;
mask = LFB_DEPTH_PRESENT | (LFB_DEPTH_PRESENT << 4);
offset <<= 1;
break;
@ -3198,7 +3198,7 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
/* write to the depth buffer */
if ((mask & (LFB_DEPTH_PRESENT | LFB_DEPTH_PRESENT_MSW)) && !FBZMODE_ENABLE_ALPHA_PLANES(vd->reg[fbzMode].u))
depth[bufoffs] = sw[pix];
depth[bufoffs] = sz[pix];
}
/* track pixel writes to the frame buffer regardless of mask */
@ -3244,9 +3244,9 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
iterw = (UINT32) vd->reg[zaColor].u << 16;
} else {
// The most significant fractional bits of 16.32 W are set to z
iterw = (UINT32) sw[pix] << 16;
iterw = (UINT32) sz[pix] << 16;
}
INT32 iterz = sw[pix] << 12;
INT32 iterz = sz[pix] << 12;
/* apply clipping */
if (FBZMODE_ENABLE_CLIPPING(vd->reg[fbzMode].u))
@ -3306,7 +3306,7 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
// End PIXEL_PIPELINE_BEGIN COPY
// Depth testing value for lfb pipeline writes is directly from write data, no biasing is used
fogdepth = biasdepth = (UINT32) sw[pix];
fogdepth = biasdepth = (UINT32) sz[pix];
/* Perform depth testing */
@ -3330,10 +3330,10 @@ INT32 voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, UINT32 data, UINT32
/* wait for any outstanding work to finish */
poly_wait(vd->poly, "LFB Write");
/* pixel pipeline part 2 handles color combine, fog, alpha, and final output */
/* pixel pipeline part 2 handles color blending, fog, alpha, and final output */
PIXEL_PIPELINE_END(vd, stats, dither, dither4, dither_lookup, x, dest, depth,
vd->reg[fbzMode].u, vd->reg[fbzColorPath].u, vd->reg[alphaMode].u, vd->reg[fogMode].u,
iterz, iterw, iterargb) {};
iterz, iterw, iterargb);
nextpixel:
/* advance our pointers */
x++;
@ -5391,16 +5391,9 @@ INT32 voodoo_device::setup_and_draw_triangle(voodoo_device *vd)
float dx1, dy1, dx2, dy2;
float divisor, tdiv;
/* grab the X/Ys at least */
vd->fbi.ax = (INT16)(vd->fbi.svert[0].x * 16.0f);
vd->fbi.ay = (INT16)(vd->fbi.svert[0].y * 16.0f);
vd->fbi.bx = (INT16)(vd->fbi.svert[1].x * 16.0f);
vd->fbi.by = (INT16)(vd->fbi.svert[1].y * 16.0f);
vd->fbi.cx = (INT16)(vd->fbi.svert[2].x * 16.0f);
vd->fbi.cy = (INT16)(vd->fbi.svert[2].y * 16.0f);
/* compute the divisor */
divisor = 1.0f / ((vd->fbi.svert[0].x - vd->fbi.svert[1].x) * (vd->fbi.svert[0].y - vd->fbi.svert[2].y) -
// Just need sign for now
divisor = ((vd->fbi.svert[0].x - vd->fbi.svert[1].x) * (vd->fbi.svert[0].y - vd->fbi.svert[2].y) -
(vd->fbi.svert[0].x - vd->fbi.svert[2].x) * (vd->fbi.svert[0].y - vd->fbi.svert[1].y));
/* backface culling */
@ -5418,6 +5411,17 @@ INT32 voodoo_device::setup_and_draw_triangle(voodoo_device *vd)
return TRIANGLE_SETUP_CLOCKS;
}
// Finish the divisor
divisor = 1.0f / divisor;
/* grab the X/Ys at least */
vd->fbi.ax = (INT16)(vd->fbi.svert[0].x * 16.0f);
vd->fbi.ay = (INT16)(vd->fbi.svert[0].y * 16.0f);
vd->fbi.bx = (INT16)(vd->fbi.svert[1].x * 16.0f);
vd->fbi.by = (INT16)(vd->fbi.svert[1].y * 16.0f);
vd->fbi.cx = (INT16)(vd->fbi.svert[2].x * 16.0f);
vd->fbi.cy = (INT16)(vd->fbi.svert[2].y * 16.0f);
/* compute the dx/dy values */
dx1 = vd->fbi.svert[0].y - vd->fbi.svert[2].y;
dx2 = vd->fbi.svert[0].y - vd->fbi.svert[1].y;
@ -5898,16 +5902,16 @@ void voodoo_device::raster_fastfill(void *destbase, INT32 y, const poly_extent *
/* fill this dest buffer row */
if (FBZMODE_AUX_BUFFER_MASK(vd->reg[fbzMode].u) && vd->fbi.auxoffs != ~0)
{
UINT16 color = vd->reg[zaColor].u;
UINT64 expanded = ((UINT64)color << 48) | ((UINT64)color << 32) | (color << 16) | color;
UINT16 depth = vd->reg[zaColor].u;
UINT64 expanded = ((UINT64)depth << 48) | ((UINT64)depth << 32) | (depth << 16) | depth;
UINT16 *dest = (UINT16 *)(vd->fbi.ram + vd->fbi.auxoffs) + scry * vd->fbi.rowpixels;
for (x = startx; x < stopx && (x & 3) != 0; x++)
dest[x] = color;
dest[x] = depth;
for ( ; x < (stopx & ~3); x += 4)
*(UINT64 *)&dest[x] = expanded;
for ( ; x < stopx; x++)
dest[x] = color;
dest[x] = depth;
}
}

View File

@ -1529,10 +1529,10 @@ struct tmu_shared_state
struct setup_vertex
{
float x, y; /* X, Y coordinates */
float a, r, g, b; /* A, R, G, B values */
float z, wb; /* Z and broadcast W values */
float w0, s0, t0; /* W, S, T for TMU 0 */
float w1, s1, t1; /* W, S, T for TMU 1 */
float r, g, b, a; /* A, R, G, B values */
float s0, t0, w0; /* W, S, T for TMU 0 */
float s1, t1, w1; /* W, S, T for TMU 1 */
};

View File

@ -845,8 +845,8 @@ static MACHINE_CONFIG_START( abc1600, abc1600_state )
MCFG_CPU_PROGRAM_MAP(abc1600_mem)
MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(abc1600_state,abc1600_int_ack)
MCFG_WATCHDOG_ADD("watchdog")
MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1600)) // XTAL_64MHz/8/10/20000/8/8
//MCFG_WATCHDOG_ADD("watchdog")
//MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1600)) // XTAL_64MHz/8/10/20000/8/8
// video hardware
MCFG_ABC1600_MOVER_ADD()

View File

@ -541,6 +541,8 @@ static MACHINE_CONFIG_START( bubsympb, taito_f3_state )
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
MCFG_WATCHDOG_ADD("watchdog")
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(58.97)