PlayStation GPU splits 4 point polygons into triangles. [smf]

This commit is contained in:
smf- 2011-05-26 16:44:25 +00:00
parent 535ec3dd99
commit 79bc475089

View File

@ -66,19 +66,15 @@ cxd8654q_device::cxd8654q_device(const machine_config &mconfig, const char *tag,
{
}
static const UINT16 m_p_n_nextpointlist4[] = { 1, 3, 0, 2 };
static const UINT16 m_p_n_prevpointlist4[] = { 2, 0, 3, 1 };
static const UINT16 m_p_n_nextpointlist3[] = { 1, 2, 0 };
static const UINT16 m_p_n_prevpointlist3[] = { 2, 0, 1 };
static const UINT16 p_n_rightpointlist[] = { 1, 2, 0 };
static const UINT16 p_n_leftpointlist[] = { 2, 0, 1 };
#define SINT11( x ) ( ( (INT32)( x ) << 21 ) >> 21 )
#define ADJUST_COORD( a ) \
a.w.l = COORD_X( a ) + n_drawoffset_x; \
a.w.h = COORD_Y( a ) + n_drawoffset_y;
#define COORD_X( a ) ( (INT16)a.w.l )
#define COORD_Y( a ) ( (INT16)a.w.h )
#define COORD_X( a ) ( a.sw.l )
#define COORD_Y( a ) ( a.sw.h )
#define COORD_DX( a ) ( n_drawoffset_x + a.sw.l )
#define COORD_DY( a ) ( n_drawoffset_y + a.sw.h )
#define SIZE_W( a ) ( a.w.l )
#define SIZE_H( a ) ( a.w.h )
#define BGR_C( a ) ( a.b.h3 )
@ -1273,7 +1269,7 @@ void psxgpu_device::decode_tpage( UINT32 tpage )
} \
}
void psxgpu_device::FlatPolygon( int n_points )
void psxgpu_device::FlatPolygon( int n_startpoint )
{
INT16 n_y;
INT16 n_x;
@ -1297,23 +1293,20 @@ void psxgpu_device::FlatPolygon( int n_points )
UINT8 n_cmd;
INT32 n_distance;
UINT16 n_point;
UINT16 n_rightpoint;
UINT16 n_leftpoint;
const UINT16 *p_n_rightpointlist;
const UINT16 *p_n_leftpointlist;
UINT16 *p_vram;
struct FLATVERTEX *vertex = &m_packet.FlatPolygon.vertex[ n_startpoint ];
#if defined( MAME_DEBUG )
if( m_debug.n_skip == 1 )
{
return;
}
for( n_point = 0; n_point < n_points; n_point++ )
for( n_point = 0; n_point < 3; n_point++ )
{
DebugMesh( COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
}
DebugMeshEnd();
#endif
@ -1329,28 +1322,12 @@ void psxgpu_device::FlatPolygon( int n_points )
n_g.w.h = BGR_G( m_packet.FlatPolygon.n_bgr ); n_g.w.l = 0;
n_b.w.h = BGR_B( m_packet.FlatPolygon.n_bgr ); n_b.w.l = 0;
if( n_points == 4 )
{
p_n_rightpointlist = m_p_n_nextpointlist4;
p_n_leftpointlist = m_p_n_prevpointlist4;
}
else
{
p_n_rightpointlist = m_p_n_nextpointlist3;
p_n_leftpointlist = m_p_n_prevpointlist3;
}
for( n_point = 0; n_point < n_points; n_point++ )
{
ADJUST_COORD( m_packet.FlatPolygon.vertex[ n_point ].n_coord );
}
n_leftpoint = 0;
for( n_point = 1; n_point < n_points; n_point++ )
for( n_point = 1; n_point < 3; n_point++ )
{
if( COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) ||
( COORD_Y( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) &&
COORD_X( m_packet.FlatPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) ) )
if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
{
n_leftpoint = n_point;
}
@ -1360,13 +1337,13 @@ void psxgpu_device::FlatPolygon( int n_points )
n_dx1 = 0;
n_dx2 = 0;
n_y = COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord );
n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
for( ;; )
{
if( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
{
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
if( n_leftpoint == n_rightpoint )
@ -1374,18 +1351,18 @@ void psxgpu_device::FlatPolygon( int n_points )
break;
}
}
n_cx1.w.h = COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
n_distance = COORD_Y( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx1 = (INT32)( ( COORD_X( m_packet.FlatPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
}
if( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.FlatPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
{
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
if( n_rightpoint == n_leftpoint )
@ -1393,14 +1370,14 @@ void psxgpu_device::FlatPolygon( int n_points )
break;
}
}
n_cx2.w.h = COORD_X( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
n_distance = COORD_Y( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx2 = (INT32)( ( COORD_X( m_packet.FlatPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
}
if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
{
@ -1428,7 +1405,7 @@ void psxgpu_device::FlatPolygon( int n_points )
}
}
void psxgpu_device::FlatTexturedPolygon( int n_points )
void psxgpu_device::FlatTexturedPolygon( int n_startpoint )
{
INT16 n_y;
INT16 n_x;
@ -1473,20 +1450,19 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
UINT16 n_point;
UINT16 n_rightpoint;
UINT16 n_leftpoint;
const UINT16 *p_n_rightpointlist;
const UINT16 *p_n_leftpointlist;
UINT16 *p_clut;
UINT16 *p_vram;
UINT32 n_bgr;
struct FLATTEXTUREDVERTEX *vertex = &m_packet.FlatTexturedPolygon.vertex[ n_startpoint ];
#if defined( MAME_DEBUG )
if( m_debug.n_skip == 2 )
{
return;
}
for( n_point = 0; n_point < n_points; n_point++ )
for( n_point = 0; n_point < 3; n_point++ )
{
DebugMesh( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
}
DebugMeshEnd();
#endif
@ -1523,28 +1499,12 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
break;
}
if( n_points == 4 )
{
p_n_rightpointlist = m_p_n_nextpointlist4;
p_n_leftpointlist = m_p_n_prevpointlist4;
}
else
{
p_n_rightpointlist = m_p_n_nextpointlist3;
p_n_leftpointlist = m_p_n_prevpointlist3;
}
for( n_point = 0; n_point < n_points; n_point++ )
{
ADJUST_COORD( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord );
}
n_leftpoint = 0;
for( n_point = 1; n_point < n_points; n_point++ )
for( n_point = 1; n_point < 3; n_point++ )
{
if( COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ||
( COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) &&
COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ) )
if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
{
n_leftpoint = n_point;
}
@ -1558,13 +1518,13 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
n_dv1 = 0;
n_dv2 = 0;
n_y = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord );
n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
for( ;; )
{
if( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
{
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
if( n_leftpoint == n_rightpoint )
@ -1572,22 +1532,22 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
break;
}
}
n_cx1.w.h = COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cu1.w.h = TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
n_cv1.w.h = TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cu1.w.h = TEXTURE_U( vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
n_cv1.w.h = TEXTURE_V( vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
n_distance = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx1 = (INT32)( ( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_du1 = (INT32)( ( TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
n_dv1 = (INT32)( ( TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_du1 = (INT32)( ( TEXTURE_U( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
n_dv1 = (INT32)( ( TEXTURE_V( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
}
if( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.FlatTexturedPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
{
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
if( n_rightpoint == n_leftpoint )
@ -1595,18 +1555,18 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
break;
}
}
n_cx2.w.h = COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cu2.w.h = TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
n_cv2.w.h = TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cu2.w.h = TEXTURE_U( vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
n_cv2.w.h = TEXTURE_V( vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
n_distance = COORD_Y( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx2 = (INT32)( ( COORD_X( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_du2 = (INT32)( ( TEXTURE_U( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
n_dv2 = (INT32)( ( TEXTURE_V( m_packet.FlatTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_du2 = (INT32)( ( TEXTURE_U( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
n_dv2 = (INT32)( ( TEXTURE_V( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
}
if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
{
@ -1650,7 +1610,7 @@ void psxgpu_device::FlatTexturedPolygon( int n_points )
}
}
void psxgpu_device::GouraudPolygon( int n_points )
void psxgpu_device::GouraudPolygon( int n_startpoint )
{
INT16 n_y;
INT16 n_x;
@ -1689,23 +1649,20 @@ void psxgpu_device::GouraudPolygon( int n_points )
INT32 n_db2;
INT32 n_distance;
UINT16 n_point;
UINT16 n_rightpoint;
UINT16 n_leftpoint;
const UINT16 *p_n_rightpointlist;
const UINT16 *p_n_leftpointlist;
UINT16 *p_vram;
struct GOURAUDVERTEX *vertex = &m_packet.GouraudPolygon.vertex[ n_startpoint ];
#if defined( MAME_DEBUG )
if( m_debug.n_skip == 3 )
{
return;
}
for( n_point = 0; n_point < n_points; n_point++ )
for( n_point = 0; n_point < 3; n_point++ )
{
DebugMesh( COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
}
DebugMeshEnd();
#endif
@ -1723,28 +1680,12 @@ void psxgpu_device::GouraudPolygon( int n_points )
SOLIDSETUP
if( n_points == 4 )
{
p_n_rightpointlist = m_p_n_nextpointlist4;
p_n_leftpointlist = m_p_n_prevpointlist4;
}
else
{
p_n_rightpointlist = m_p_n_nextpointlist3;
p_n_leftpointlist = m_p_n_prevpointlist3;
}
for( n_point = 0; n_point < n_points; n_point++ )
{
ADJUST_COORD( m_packet.GouraudPolygon.vertex[ n_point ].n_coord );
}
n_leftpoint = 0;
for( n_point = 1; n_point < n_points; n_point++ )
for( n_point = 1; n_point < 3; n_point++ )
{
if( COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) ||
( COORD_Y( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) &&
COORD_X( m_packet.GouraudPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) ) )
if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
{
n_leftpoint = n_point;
}
@ -1760,13 +1701,13 @@ void psxgpu_device::GouraudPolygon( int n_points )
n_db1 = 0;
n_db2 = 0;
n_y = COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord );
n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
for( ;; )
{
if( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
{
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
if( n_leftpoint == n_rightpoint )
@ -1774,24 +1715,24 @@ void psxgpu_device::GouraudPolygon( int n_points )
break;
}
}
n_cx1.w.h = COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cr1.w.h = BGR_R( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
n_cg1.w.h = BGR_G( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
n_cb1.w.h = BGR_B( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cr1.w.h = BGR_R( vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
n_cg1.w.h = BGR_G( vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
n_cb1.w.h = BGR_B( vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
n_distance = COORD_Y( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx1 = (INT32)( ( COORD_X( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_dr1 = (INT32)( ( BGR_R( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
n_dg1 = (INT32)( ( BGR_G( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
n_db1 = (INT32)( ( BGR_B( m_packet.GouraudPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_dr1 = (INT32)( ( BGR_R( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
n_dg1 = (INT32)( ( BGR_G( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
n_db1 = (INT32)( ( BGR_B( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
}
if( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.GouraudPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
{
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
if( n_rightpoint == n_leftpoint )
@ -1799,20 +1740,20 @@ void psxgpu_device::GouraudPolygon( int n_points )
break;
}
}
n_cx2.w.h = COORD_X( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cr2.w.h = BGR_R( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
n_cg2.w.h = BGR_G( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
n_cb2.w.h = BGR_B( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cr2.w.h = BGR_R( vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
n_cg2.w.h = BGR_G( vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
n_cb2.w.h = BGR_B( vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
n_distance = COORD_Y( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx2 = (INT32)( ( COORD_X( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_dr2 = (INT32)( ( BGR_R( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
n_dg2 = (INT32)( ( BGR_G( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
n_db2 = (INT32)( ( BGR_B( m_packet.GouraudPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_dr2 = (INT32)( ( BGR_R( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
n_dg2 = (INT32)( ( BGR_G( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
n_db2 = (INT32)( ( BGR_B( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
}
if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
{
@ -1863,7 +1804,7 @@ void psxgpu_device::GouraudPolygon( int n_points )
}
}
void psxgpu_device::GouraudTexturedPolygon( int n_points )
void psxgpu_device::GouraudTexturedPolygon( int n_startpoint )
{
INT16 n_y;
INT16 n_x;
@ -1923,20 +1864,19 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
UINT16 n_point;
UINT16 n_rightpoint;
UINT16 n_leftpoint;
const UINT16 *p_n_rightpointlist;
const UINT16 *p_n_leftpointlist;
UINT16 *p_clut;
UINT16 *p_vram;
UINT32 n_bgr;
struct GOURAUDTEXTUREDVERTEX *vertex = &m_packet.GouraudTexturedPolygon.vertex[ n_startpoint ];
#if defined( MAME_DEBUG )
if( m_debug.n_skip == 4 )
{
return;
}
for( n_point = 0; n_point < n_points; n_point++ )
for( n_point = 0; n_point < 3; n_point++ )
{
DebugMesh( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( vertex[ n_point ].n_coord ), COORD_DY( vertex[ n_point ].n_coord ) );
}
DebugMeshEnd();
#endif
@ -1962,28 +1902,12 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
decode_tpage( m_packet.GouraudTexturedPolygon.vertex[ 1 ].n_texture.w.h );
TEXTURESETUP
if( n_points == 4 )
{
p_n_rightpointlist = m_p_n_nextpointlist4;
p_n_leftpointlist = m_p_n_prevpointlist4;
}
else
{
p_n_rightpointlist = m_p_n_nextpointlist3;
p_n_leftpointlist = m_p_n_prevpointlist3;
}
for( n_point = 0; n_point < n_points; n_point++ )
{
ADJUST_COORD( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord );
}
n_leftpoint = 0;
for( n_point = 1; n_point < n_points; n_point++ )
for( n_point = 1; n_point < 3; n_point++ )
{
if( COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ||
( COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) &&
COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_point ].n_coord ) < COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) ) )
if( COORD_DY( vertex[ n_point ].n_coord ) < COORD_DY( vertex[ n_leftpoint ].n_coord ) ||
( COORD_DY( vertex[ n_point ].n_coord ) == COORD_DY( vertex[ n_leftpoint ].n_coord ) &&
COORD_DX( vertex[ n_point ].n_coord ) < COORD_DX( vertex[ n_leftpoint ].n_coord ) ) )
{
n_leftpoint = n_point;
}
@ -2003,13 +1927,13 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
n_dv1 = 0;
n_dv2 = 0;
n_y = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord );
n_y = COORD_DY( vertex[ n_rightpoint ].n_coord );
for( ;; )
{
if( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) )
{
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
if( n_leftpoint == n_rightpoint )
@ -2017,13 +1941,13 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
break;
}
}
n_cx1.w.h = COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
n_cx1.w.h = COORD_DX( vertex[ n_leftpoint ].n_coord ); n_cx1.w.l = 0;
switch( n_cmd & 0x01 )
{
case 0x00:
n_cr1.w.h = BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
n_cg1.w.h = BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
n_cb1.w.h = BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
n_cr1.w.h = BGR_R( vertex[ n_leftpoint ].n_bgr ); n_cr1.w.l = 0;
n_cg1.w.h = BGR_G( vertex[ n_leftpoint ].n_bgr ); n_cg1.w.l = 0;
n_cb1.w.h = BGR_B( vertex[ n_leftpoint ].n_bgr ); n_cb1.w.l = 0;
break;
case 0x01:
n_cr1.w.h = 0x80; n_cr1.w.l = 0;
@ -2031,21 +1955,21 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
n_cb1.w.h = 0x80; n_cb1.w.l = 0;
break;
}
n_cu1.w.h = TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
n_cv1.w.h = TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
n_cu1.w.h = TEXTURE_U( vertex[ n_leftpoint ].n_texture ); n_cu1.w.l = 0;
n_cv1.w.h = TEXTURE_V( vertex[ n_leftpoint ].n_texture ); n_cv1.w.l = 0;
n_leftpoint = p_n_leftpointlist[ n_leftpoint ];
n_distance = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_leftpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx1 = (INT32)( ( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
n_dx1 = (INT32)( ( COORD_DX( vertex[ n_leftpoint ].n_coord ) << 16 ) - n_cx1.d ) / n_distance;
switch( n_cmd & 0x01 )
{
case 0x00:
n_dr1 = (INT32)( ( BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
n_dg1 = (INT32)( ( BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
n_db1 = (INT32)( ( BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
n_dr1 = (INT32)( ( BGR_R( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cr1.d ) / n_distance;
n_dg1 = (INT32)( ( BGR_G( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cg1.d ) / n_distance;
n_db1 = (INT32)( ( BGR_B( vertex[ n_leftpoint ].n_bgr ) << 16 ) - n_cb1.d ) / n_distance;
break;
case 0x01:
n_dr1 = 0;
@ -2053,12 +1977,12 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
n_db1 = 0;
break;
}
n_du1 = (INT32)( ( TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
n_dv1 = (INT32)( ( TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
n_du1 = (INT32)( ( TEXTURE_U( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cu1.d ) / n_distance;
n_dv1 = (INT32)( ( TEXTURE_V( vertex[ n_leftpoint ].n_texture ) << 16 ) - n_cv1.d ) / n_distance;
}
if( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) )
if( n_y == COORD_DY( vertex[ n_rightpoint ].n_coord ) )
{
while( n_y == COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
while( n_y == COORD_DY( vertex[ p_n_rightpointlist[ n_rightpoint ] ].n_coord ) )
{
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
if( n_rightpoint == n_leftpoint )
@ -2066,13 +1990,13 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
break;
}
}
n_cx2.w.h = COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
n_cx2.w.h = COORD_DX( vertex[ n_rightpoint ].n_coord ); n_cx2.w.l = 0;
switch( n_cmd & 0x01 )
{
case 0x00:
n_cr2.w.h = BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
n_cg2.w.h = BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
n_cb2.w.h = BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
n_cr2.w.h = BGR_R( vertex[ n_rightpoint ].n_bgr ); n_cr2.w.l = 0;
n_cg2.w.h = BGR_G( vertex[ n_rightpoint ].n_bgr ); n_cg2.w.l = 0;
n_cb2.w.h = BGR_B( vertex[ n_rightpoint ].n_bgr ); n_cb2.w.l = 0;
break;
case 0x01:
n_cr2.w.h = 0x80; n_cr2.w.l = 0;
@ -2080,21 +2004,21 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
n_cb2.w.h = 0x80; n_cb2.w.l = 0;
break;
}
n_cu2.w.h = TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
n_cv2.w.h = TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
n_cu2.w.h = TEXTURE_U( vertex[ n_rightpoint ].n_texture ); n_cu2.w.l = 0;
n_cv2.w.h = TEXTURE_V( vertex[ n_rightpoint ].n_texture ); n_cv2.w.l = 0;
n_rightpoint = p_n_rightpointlist[ n_rightpoint ];
n_distance = COORD_Y( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) - n_y;
n_distance = COORD_DY( vertex[ n_rightpoint ].n_coord ) - n_y;
if( n_distance < 1 )
{
break;
}
n_dx2 = (INT32)( ( COORD_X( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
n_dx2 = (INT32)( ( COORD_DX( vertex[ n_rightpoint ].n_coord ) << 16 ) - n_cx2.d ) / n_distance;
switch( n_cmd & 0x01 )
{
case 0x00:
n_dr2 = (INT32)( ( BGR_R( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
n_dg2 = (INT32)( ( BGR_G( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
n_db2 = (INT32)( ( BGR_B( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
n_dr2 = (INT32)( ( BGR_R( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cr2.d ) / n_distance;
n_dg2 = (INT32)( ( BGR_G( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cg2.d ) / n_distance;
n_db2 = (INT32)( ( BGR_B( vertex[ n_rightpoint ].n_bgr ) << 16 ) - n_cb2.d ) / n_distance;
break;
case 0x01:
n_dr2 = 0;
@ -2102,8 +2026,8 @@ void psxgpu_device::GouraudTexturedPolygon( int n_points )
n_db2 = 0;
break;
}
n_du2 = (INT32)( ( TEXTURE_U( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
n_dv2 = (INT32)( ( TEXTURE_V( m_packet.GouraudTexturedPolygon.vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
n_du2 = (INT32)( ( TEXTURE_U( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cu2.d ) / n_distance;
n_dv2 = (INT32)( ( TEXTURE_V( vertex[ n_rightpoint ].n_texture ) << 16 ) - n_cv2.d ) / n_distance;
}
if( (INT16)n_cx1.w.h != (INT16)n_cx2.w.h && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
{
@ -2191,15 +2115,15 @@ void psxgpu_device::MonochromeLine( void )
{
return;
}
DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( m_packet.MonochromeLine.vertex[ 0 ].n_coord ), COORD_DY( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) );
DebugMesh( COORD_DX( m_packet.MonochromeLine.vertex[ 1 ].n_coord ), COORD_DY( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) );
DebugMeshEnd();
#endif
n_xstart = COORD_X( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_x;
n_xend = COORD_X( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_x;
n_ystart = COORD_Y( m_packet.MonochromeLine.vertex[ 0 ].n_coord ) + n_drawoffset_y;
n_yend = COORD_Y( m_packet.MonochromeLine.vertex[ 1 ].n_coord ) + n_drawoffset_y;
n_xstart = COORD_DX( m_packet.MonochromeLine.vertex[ 0 ].n_coord );
n_xend = COORD_DX( m_packet.MonochromeLine.vertex[ 1 ].n_coord );
n_ystart = COORD_DY( m_packet.MonochromeLine.vertex[ 0 ].n_coord );
n_yend = COORD_DY( m_packet.MonochromeLine.vertex[ 1 ].n_coord );
n_r = BGR_R( m_packet.MonochromeLine.n_bgr );
n_g = BGR_G( m_packet.MonochromeLine.n_bgr );
@ -2294,19 +2218,19 @@ void psxgpu_device::GouraudLine( void )
{
return;
}
DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_x, COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( m_packet.GouraudLine.vertex[ 0 ].n_coord ), COORD_DY( m_packet.GouraudLine.vertex[ 0 ].n_coord ) );
DebugMesh( COORD_DX( m_packet.GouraudLine.vertex[ 1 ].n_coord ), COORD_DY( m_packet.GouraudLine.vertex[ 1 ].n_coord ) );
DebugMeshEnd();
#endif
n_xstart = COORD_X( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_x;
n_ystart = COORD_Y( m_packet.GouraudLine.vertex[ 0 ].n_coord ) + n_drawoffset_y;
n_xstart = COORD_DX( m_packet.GouraudLine.vertex[ 0 ].n_coord );
n_ystart = COORD_DY( m_packet.GouraudLine.vertex[ 0 ].n_coord );
n_cr1.w.h = BGR_R( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cr1.w.l = 0;
n_cg1.w.h = BGR_G( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cg1.w.l = 0;
n_cb1.w.h = BGR_B( m_packet.GouraudLine.vertex[ 0 ].n_bgr ); n_cb1.w.l = 0;
n_xend = COORD_X( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_x;
n_yend = COORD_Y( m_packet.GouraudLine.vertex[ 1 ].n_coord ) + n_drawoffset_y;
n_xend = COORD_DX( m_packet.GouraudLine.vertex[ 1 ].n_coord );
n_yend = COORD_DY( m_packet.GouraudLine.vertex[ 1 ].n_coord );
n_cr2.w.h = BGR_R( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cr1.w.l = 0;
n_cg2.w.h = BGR_G( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cg1.w.l = 0;
n_cb2.w.h = BGR_B( m_packet.GouraudLine.vertex[ 1 ].n_bgr ); n_cb1.w.l = 0;
@ -2455,10 +2379,10 @@ void psxgpu_device::FlatRectangle( void )
{
return;
}
DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) );
DebugMesh( COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatRectangle.n_size ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ), COORD_DY( m_packet.FlatRectangle.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_DY( m_packet.FlatRectangle.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ), COORD_DY( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle.n_coord ) + SIZE_W( m_packet.FlatRectangle.n_size ), COORD_DY( m_packet.FlatRectangle.n_coord ) + SIZE_H( m_packet.FlatRectangle.n_size ) );
DebugMeshEnd();
#endif
@ -2470,12 +2394,12 @@ void psxgpu_device::FlatRectangle( void )
n_g.w.h = BGR_G( m_packet.FlatRectangle.n_bgr ); n_g.w.l = 0;
n_b.w.h = BGR_B( m_packet.FlatRectangle.n_bgr ); n_b.w.l = 0;
n_y = COORD_Y( m_packet.FlatRectangle.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.FlatRectangle.n_coord );
n_h = SIZE_H( m_packet.FlatRectangle.n_size );
while( n_h > 0 )
{
n_x = COORD_X( m_packet.FlatRectangle.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.FlatRectangle.n_coord );
n_distance = SIZE_W( m_packet.FlatRectangle.n_size );
if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
@ -2520,10 +2444,10 @@ void psxgpu_device::FlatRectangle8x8( void )
{
return;
}
DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y + 8 );
DebugMesh( COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x + 8, COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y + 8 );
DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ), COORD_DY( m_packet.FlatRectangle8x8.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ) + 8, COORD_DY( m_packet.FlatRectangle8x8.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ), COORD_DY( m_packet.FlatRectangle8x8.n_coord ) + 8 );
DebugMesh( COORD_DX( m_packet.FlatRectangle8x8.n_coord ) + 8, COORD_DY( m_packet.FlatRectangle8x8.n_coord ) + 8 );
DebugMeshEnd();
#endif
@ -2535,12 +2459,12 @@ void psxgpu_device::FlatRectangle8x8( void )
n_g.w.h = BGR_G( m_packet.FlatRectangle8x8.n_bgr ); n_g.w.l = 0;
n_b.w.h = BGR_B( m_packet.FlatRectangle8x8.n_bgr ); n_b.w.l = 0;
n_y = COORD_Y( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.FlatRectangle8x8.n_coord );
n_h = 8;
while( n_h > 0 )
{
n_x = COORD_X( m_packet.FlatRectangle8x8.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.FlatRectangle8x8.n_coord );
n_distance = 8;
if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
@ -2585,10 +2509,10 @@ void psxgpu_device::FlatRectangle16x16( void )
{
return;
}
DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y + 16 );
DebugMesh( COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x + 16, COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y + 16 );
DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ), COORD_DY( m_packet.FlatRectangle16x16.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ) + 16, COORD_DY( m_packet.FlatRectangle16x16.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ), COORD_DY( m_packet.FlatRectangle16x16.n_coord ) + 16 );
DebugMesh( COORD_DX( m_packet.FlatRectangle16x16.n_coord ) + 16, COORD_DY( m_packet.FlatRectangle16x16.n_coord ) + 16 );
DebugMeshEnd();
#endif
@ -2600,12 +2524,12 @@ void psxgpu_device::FlatRectangle16x16( void )
n_g.w.h = BGR_G( m_packet.FlatRectangle16x16.n_bgr ); n_g.w.l = 0;
n_b.w.h = BGR_B( m_packet.FlatRectangle16x16.n_bgr ); n_b.w.l = 0;
n_y = COORD_Y( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.FlatRectangle16x16.n_coord );
n_h = 16;
while( n_h > 0 )
{
n_x = COORD_X( m_packet.FlatRectangle16x16.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.FlatRectangle16x16.n_coord );
n_distance = 16;
if( n_distance > 0 && n_y >= (INT32)n_drawarea_y1 && n_y <= (INT32)n_drawarea_y2 )
@ -2661,10 +2585,10 @@ void psxgpu_device::FlatTexturedRectangle( void )
{
return;
}
DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
DebugMesh( COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) );
DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
DebugMesh( COORD_DX( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_W( m_packet.FlatTexturedRectangle.n_size ), COORD_DY( m_packet.FlatTexturedRectangle.n_coord ) + SIZE_H( m_packet.FlatTexturedRectangle.n_size ) );
DebugMeshEnd();
#endif
@ -2695,12 +2619,12 @@ void psxgpu_device::FlatTexturedRectangle( void )
}
n_v = TEXTURE_V( m_packet.FlatTexturedRectangle.n_texture );
n_y = COORD_Y( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.FlatTexturedRectangle.n_coord );
n_h = SIZE_H( m_packet.FlatTexturedRectangle.n_size );
while( n_h > 0 )
{
n_x = COORD_X( m_packet.FlatTexturedRectangle.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.FlatTexturedRectangle.n_coord );
n_u = TEXTURE_U( m_packet.FlatTexturedRectangle.n_texture );
n_distance = SIZE_W( m_packet.FlatTexturedRectangle.n_size );
@ -2759,10 +2683,10 @@ void psxgpu_device::Sprite8x8( void )
{
return;
}
DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y + 7 );
DebugMesh( COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y + 7 );
DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ), COORD_DY( m_packet.Sprite8x8.n_coord ) );
DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ) + 7, COORD_DY( m_packet.Sprite8x8.n_coord ) );
DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ), COORD_DY( m_packet.Sprite8x8.n_coord ) + 7 );
DebugMesh( COORD_DX( m_packet.Sprite8x8.n_coord ) + 7, COORD_DY( m_packet.Sprite8x8.n_coord ) + 7 );
DebugMeshEnd();
#endif
@ -2793,12 +2717,12 @@ void psxgpu_device::Sprite8x8( void )
}
n_v = TEXTURE_V( m_packet.Sprite8x8.n_texture );
n_y = COORD_Y( m_packet.Sprite8x8.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.Sprite8x8.n_coord );
n_h = 8;
while( n_h > 0 )
{
n_x = COORD_X( m_packet.Sprite8x8.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.Sprite8x8.n_coord );
n_u = TEXTURE_U( m_packet.Sprite8x8.n_texture );
n_distance = 8;
@ -2857,10 +2781,10 @@ void psxgpu_device::Sprite16x16( void )
{
return;
}
DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y + 7 );
DebugMesh( COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x + 7, COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y + 7 );
DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ), COORD_DY( m_packet.Sprite16x16.n_coord ) );
DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ) + 7, COORD_DY( m_packet.Sprite16x16.n_coord ) );
DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ), COORD_DY( m_packet.Sprite16x16.n_coord ) + 7 );
DebugMesh( COORD_DX( m_packet.Sprite16x16.n_coord ) + 7, COORD_DY( m_packet.Sprite16x16.n_coord ) + 7 );
DebugMeshEnd();
#endif
@ -2891,12 +2815,12 @@ void psxgpu_device::Sprite16x16( void )
}
n_v = TEXTURE_V( m_packet.Sprite16x16.n_texture );
n_y = COORD_Y( m_packet.Sprite16x16.n_coord ) + n_drawoffset_y;
n_y = COORD_DY( m_packet.Sprite16x16.n_coord );
n_h = 16;
while( n_h > 0 )
{
n_x = COORD_X( m_packet.Sprite16x16.n_coord ) + n_drawoffset_x;
n_x = COORD_DX( m_packet.Sprite16x16.n_coord );
n_u = TEXTURE_U( m_packet.Sprite16x16.n_texture );
n_distance = 16;
@ -2930,15 +2854,15 @@ void psxgpu_device::Dot( void )
{
return;
}
DebugMesh( COORD_X( m_packet.Dot.vertex.n_coord ) + n_drawoffset_x, COORD_Y( m_packet.Dot.vertex.n_coord ) + n_drawoffset_y );
DebugMesh( COORD_DX( m_packet.Dot.vertex.n_coord ), COORD_DY( m_packet.Dot.vertex.n_coord ) );
DebugMeshEnd();
#endif
n_r = BGR_R( m_packet.Dot.n_bgr );
n_g = BGR_G( m_packet.Dot.n_bgr );
n_b = BGR_B( m_packet.Dot.n_bgr );
n_x = COORD_X( m_packet.Dot.vertex.n_coord ) + n_drawoffset_x;
n_y = COORD_Y( m_packet.Dot.vertex.n_coord ) + n_drawoffset_y;
n_x = COORD_DX( m_packet.Dot.vertex.n_coord );
n_y = COORD_DY( m_packet.Dot.vertex.n_coord );
if( (INT16)n_x >= (INT32)n_drawarea_x1 &&
(INT16)n_y >= (INT32)n_drawarea_y1 &&
@ -3038,7 +2962,7 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: monochrome 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
FlatPolygon( 3 );
FlatPolygon( 0 );
n_gpu_buffer_offset = 0;
}
break;
@ -3053,7 +2977,7 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
FlatTexturedPolygon( 3 );
FlatTexturedPolygon( 0 );
n_gpu_buffer_offset = 0;
}
break;
@ -3068,7 +2992,8 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: monochrome 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
FlatPolygon( 4 );
FlatPolygon( 0 );
FlatPolygon( 1 );
n_gpu_buffer_offset = 0;
}
break;
@ -3083,7 +3008,8 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
FlatTexturedPolygon( 4 );
FlatTexturedPolygon( 0 );
FlatTexturedPolygon( 1 );
n_gpu_buffer_offset = 0;
}
break;
@ -3098,7 +3024,7 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: gouraud 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
GouraudPolygon( 3 );
GouraudPolygon( 0 );
n_gpu_buffer_offset = 0;
}
break;
@ -3113,7 +3039,7 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: gouraud textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
GouraudTexturedPolygon( 3 );
GouraudTexturedPolygon( 0 );
n_gpu_buffer_offset = 0;
}
break;
@ -3128,7 +3054,8 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: gouraud 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
GouraudPolygon( 4 );
GouraudPolygon( 0 );
GouraudPolygon( 1 );
n_gpu_buffer_offset = 0;
}
break;
@ -3143,7 +3070,8 @@ void psxgpu_device::dma_write( UINT32 *p_ram, INT32 n_size )
else
{
verboselog( machine(), 1, "%02x: gouraud textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
GouraudTexturedPolygon( 4 );
GouraudTexturedPolygon( 0 );
GouraudTexturedPolygon( 1 );
n_gpu_buffer_offset = 0;
}
break;