mirror of https://github.com/PCSX2/pcsx2.git
zzogl-pg: Work on the transfer code a bit.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2804 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
9ea97041fb
commit
a8841d6e77
|
@ -109,7 +109,8 @@ bool GIFPath::StepReg()
|
|||
}
|
||||
|
||||
__forceinline u32 _gifTransfer( GIF_PATH pathidx, const u8* pMem, u32 size )
|
||||
{ GIFPath& path = m_path[pathidx];
|
||||
{
|
||||
GIFPath& path = m_path[pathidx];
|
||||
|
||||
while(size > 0)
|
||||
{
|
||||
|
|
|
@ -251,6 +251,15 @@ static bool SPAM_PASS;
|
|||
#define WARN_LOG 0&&
|
||||
#endif
|
||||
|
||||
|
||||
enum GIF_FLG
|
||||
{
|
||||
GIF_FLG_PACKED = 0,
|
||||
GIF_FLG_REGLIST = 1,
|
||||
GIF_FLG_IMAGE = 2,
|
||||
GIF_FLG_IMAGE2 = 3
|
||||
};
|
||||
|
||||
#define REG64(name) \
|
||||
union name \
|
||||
{ \
|
||||
|
@ -814,9 +823,7 @@ typedef struct {
|
|||
int imageTransfer;
|
||||
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
|
||||
|
||||
pathInfo path1;
|
||||
pathInfo path2;
|
||||
pathInfo path3;
|
||||
pathInfo path[3];
|
||||
|
||||
} GSinternal;
|
||||
|
||||
|
|
|
@ -311,12 +311,13 @@ void CALLBACK GSreset() {
|
|||
gs.q = 1;
|
||||
}
|
||||
|
||||
void CALLBACK GSgifSoftReset(u32 mask){
|
||||
void CALLBACK GSgifSoftReset(u32 mask)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
if( mask & 1 ) memset(&gs.path1, 0, sizeof(gs.path1));
|
||||
if( mask & 2 ) memset(&gs.path2, 0, sizeof(gs.path2));
|
||||
if( mask & 4 ) memset(&gs.path3, 0, sizeof(gs.path3));
|
||||
if( mask & 1 ) memset(&gs.path[0], 0, sizeof(gs.path[0]));
|
||||
if( mask & 2 ) memset(&gs.path[1], 0, sizeof(gs.path[1]));
|
||||
if( mask & 4 ) memset(&gs.path[2], 0, sizeof(gs.path[2]));
|
||||
gs.imageTransfer = -1;
|
||||
gs.q = 1;
|
||||
gs.nTriFanVert = -1;
|
||||
|
@ -558,18 +559,21 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
ERROR_LOG("Using %s:%d.%d.%d\n", libraryName, zgsrevision, zgsbuild, zgsminor);
|
||||
ERROR_LOG("creating zerogs\n");
|
||||
//if (conf.record) recOpen();
|
||||
if( !ZeroGS::Create(conf.width, conf.height) )
|
||||
return -1;
|
||||
if (!ZeroGS::Create(conf.width, conf.height)) return -1;
|
||||
|
||||
ERROR_LOG("initialization successful\n");
|
||||
|
||||
if( conf.bilinear == 2 ) {
|
||||
if( conf.bilinear == 2 )
|
||||
{
|
||||
ZeroGS::AddMessage("forced bilinear filtering - on", 1000);
|
||||
}
|
||||
else if( conf.bilinear == 1 ) {
|
||||
else if( conf.bilinear == 1 )
|
||||
{
|
||||
ZeroGS::AddMessage("normal bilinear filtering - on", 1000);
|
||||
}
|
||||
if( conf.aa ) {
|
||||
|
||||
if( conf.aa )
|
||||
{
|
||||
char strtitle[64];
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa], 1000);
|
||||
ZeroGS::AddMessage(strtitle);
|
||||
|
@ -588,9 +592,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
QueryPerformanceFrequency(&temp);
|
||||
luPerfFreq = temp.QuadPart;
|
||||
|
||||
gs.path1.mode = 0;
|
||||
gs.path2.mode = 0;
|
||||
gs.path3.mode = 0;
|
||||
gs.path[0].mode = gs.path[1].mode = gs.path[2].mode = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -599,24 +601,31 @@ void ProcessMessages()
|
|||
{
|
||||
MSG msg;
|
||||
ZeroMemory( &msg, sizeof(msg) );
|
||||
while( 1 ) {
|
||||
while( 1 )
|
||||
{
|
||||
if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
|
||||
{
|
||||
switch( msg.message ) {
|
||||
switch( msg.message )
|
||||
{
|
||||
case WM_KEYDOWN :
|
||||
if( msg.wParam == VK_F5 ) {
|
||||
if( msg.wParam == VK_F5 )
|
||||
{
|
||||
OnKeyboardF5(GetKeyState(VK_SHIFT)&0x8000);
|
||||
}
|
||||
else if( msg.wParam == VK_F6 ) {
|
||||
else if( msg.wParam == VK_F6 )
|
||||
{
|
||||
OnKeyboardF6(GetKeyState(VK_SHIFT)&0x8000);
|
||||
}
|
||||
else if( msg.wParam == VK_F7 ) {
|
||||
else if( msg.wParam == VK_F7 )
|
||||
{
|
||||
OnKeyboardF7(GetKeyState(VK_SHIFT)&0x8000);
|
||||
}
|
||||
else if( msg.wParam == VK_F9 ) {
|
||||
else if( msg.wParam == VK_F9 )
|
||||
{
|
||||
OnKeyboardF9(GetKeyState(VK_SHIFT)&0x8000);
|
||||
}
|
||||
else if( msg.wParam == VK_ESCAPE ) {
|
||||
else if( msg.wParam == VK_ESCAPE )
|
||||
{
|
||||
|
||||
if( conf.options & GSOPTION_FULLSCREEN ) {
|
||||
// destroy that msg
|
||||
|
@ -639,10 +648,13 @@ void ProcessMessages()
|
|||
DispatchMessage( &msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( (GetKeyState(VK_MENU)&0x8000) && (GetKeyState(VK_RETURN)&0x8000) ) {
|
||||
if ((GetKeyState(VK_MENU)&0x8000) && (GetKeyState(VK_RETURN)&0x8000))
|
||||
{
|
||||
conf.options ^= GSOPTION_FULLSCREEN;
|
||||
|
||||
ZeroGS::SetChangeDeviceSize(
|
||||
|
@ -677,18 +689,20 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
ERROR_LOG("Using %s:%d.%d.%d\n", libraryName, zgsrevision, zgsbuild, zgsminor);
|
||||
ERROR_LOG("creating zerogs\n");
|
||||
//if (conf.record) recOpen();
|
||||
if( !ZeroGS::Create(conf.width, conf.height) )
|
||||
return -1;
|
||||
if (!ZeroGS::Create(conf.width, conf.height)) return -1;
|
||||
|
||||
ERROR_LOG("initialization successful\n");
|
||||
|
||||
if( conf.bilinear == 2 ) {
|
||||
if( conf.bilinear == 2 )
|
||||
{
|
||||
ZeroGS::AddMessage("bilinear filtering - forced", 1000);
|
||||
}
|
||||
else if( conf.bilinear == 1 ) {
|
||||
else if( conf.bilinear == 1 )
|
||||
{
|
||||
ZeroGS::AddMessage("bilinear filtering - normal", 1000);
|
||||
}
|
||||
if( conf.aa ) {
|
||||
if( conf.aa )
|
||||
{
|
||||
char strtitle[64];
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZeroGS::AddMessage(strtitle,1000);
|
||||
|
@ -696,9 +710,7 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
|
||||
GS_LOG("GSopen ok\n");
|
||||
|
||||
gs.path1.mode = 0;
|
||||
gs.path2.mode = 0;
|
||||
gs.path3.mode = 0;
|
||||
gs.path[0].mode = gs.path[1].mode = gs.path[2].mode = 0;
|
||||
luPerfFreq = 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -97,26 +97,37 @@ void CALLBACK GSgetLastTag(u64* ptag)
|
|||
extern HANDLE g_hCurrentThread;
|
||||
#endif
|
||||
|
||||
void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
||||
__forceinline void gifTransferLog(int index, u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
#ifdef _WIN32
|
||||
assert( g_hCurrentThread == GetCurrentThread() );
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
if( conf.log & 0x20 ) {
|
||||
static int nSaveIndex=0;
|
||||
GS_LOG("%d: p:%d %x\n", nSaveIndex++, (path==&gs.path3)?3:(path==&gs.path2?2:1), size);
|
||||
if( conf.log & 0x20 )
|
||||
{
|
||||
static int nSaveIndex = 0;
|
||||
GS_LOG("%d: p:%d %x\n", nSaveIndex++, index + 1, size);
|
||||
int vals[4] = {0};
|
||||
for(int i = 0; i < size; i++) {
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
for(int j = 0; j < 4; ++j )
|
||||
vals[j] ^= pMem[4*i+j];
|
||||
}
|
||||
GS_LOG("%x %x %x %x\n", vals[0], vals[1], vals[2], vals[3]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<int index> void _GSgifTransfer(u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
pathInfo *path = &gs.path[index];
|
||||
|
||||
#ifdef _WIN32
|
||||
assert( g_hCurrentThread == GetCurrentThread() );
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
gifTransferLog(index, pMem, size);
|
||||
#endif
|
||||
|
||||
while(size > 0)
|
||||
{
|
||||
|
@ -127,10 +138,10 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
|||
pMem+= 4;
|
||||
size--;
|
||||
|
||||
if ((g_GameSettings & GAME_PATH3HACK) && path == &gs.path3 && gs.path3.tag.eop)
|
||||
if ((g_GameSettings & GAME_PATH3HACK) && (index == 2) && gs.path[2].tag.eop)
|
||||
nPath3Hack = 1;
|
||||
|
||||
if (path == &gs.path1)
|
||||
if (index == 0)
|
||||
{
|
||||
if (path->mode == 1)
|
||||
{
|
||||
|
@ -149,11 +160,10 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
|||
|
||||
if(path->tag.nloop == 0 )
|
||||
{
|
||||
if( path == &gs.path1 )
|
||||
if (index == 0)
|
||||
{
|
||||
// ffx hack
|
||||
if( path->tag.eop )
|
||||
return;
|
||||
if( path->tag.eop ) return;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -168,7 +178,8 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
|||
}
|
||||
}
|
||||
|
||||
switch(path->mode) {
|
||||
switch(path->mode)
|
||||
{
|
||||
case 1: // PACKED
|
||||
{
|
||||
assert( path->tag.nloop > 0 );
|
||||
|
@ -256,47 +267,24 @@ void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
|||
break;
|
||||
}
|
||||
|
||||
if( path == &gs.path1 && path->tag.eop )
|
||||
return;
|
||||
if ((index == 0) && path->tag.eop) return;
|
||||
}
|
||||
|
||||
// This is case when not all data was readed from one try: VU1 to much data.
|
||||
// So we should redone reading from start
|
||||
if (path == &gs.path1 && size == 0 && path->tag.nloop > 0) {
|
||||
// This is the case when not all data was readed from one try: VU1 has too much data.
|
||||
// So we should redo reading from the start.
|
||||
if ((index == 0) && size == 0 && path->tag.nloop > 0)
|
||||
{
|
||||
ERROR_LOG_SPAMA("VU1 too much data, ignore if gfx are fine %d\n", path->tag.nloop)
|
||||
// TODO: this code is not working correctly. Anyway, ringing work only in single-threadred mode.
|
||||
// _GSgifTransfer(&gs.path1, (u32*)((u8*)pMem-0x4000), (0x4000)/16);
|
||||
// TODO: this code is not working correctly. Anyway, ringing work only in single-threaded mode.
|
||||
// _GSgifTransfer(&gs.path[0], (u32*)((u8*)pMem-0x4000), (0x4000)/16);
|
||||
}
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
//GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path2.mode, gs.path2.tag.nloop);
|
||||
|
||||
_GSgifTransfer(&gs.path2, pMem, size);
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
//GS_LOG("GSgifTransfer3 size = %lx (mode %d, gs.path3.tag.nloop = %d)\n", size, gs.path3.mode, gs.path3.tag.nloop);
|
||||
|
||||
nPath3Hack = 0;
|
||||
_GSgifTransfer(&gs.path3, pMem, size);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
static int count = 0;
|
||||
#endif
|
||||
|
||||
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
//pathInfo *path = &gs.path1;
|
||||
//pathInfo *path = &gs.path[0];
|
||||
|
||||
//GS_LOG("GSgifTransfer1 0x%x (mode %d)\n", addr, path->mode);
|
||||
|
||||
|
@ -307,15 +295,38 @@ void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr)
|
|||
count++;
|
||||
#endif
|
||||
|
||||
gs.path1.tag.nloop = 0;
|
||||
gs.path1.tag.eop = 0;
|
||||
_GSgifTransfer(&gs.path1, (u32*)((u8*)pMem+addr), (0x4000 - addr)/16);
|
||||
gs.path[0].tag.nloop = 0;
|
||||
gs.path[0].tag.eop = 0;
|
||||
_GSgifTransfer<0>((u32*)((u8*)pMem+addr), (0x4000 - addr)/16);
|
||||
|
||||
if( !gs.path1.tag.eop && gs.path1.tag.nloop > 0 ) {
|
||||
if (!gs.path[0].tag.eop && (gs.path[0].tag.nloop > 0))
|
||||
{
|
||||
assert( (addr&0xf) == 0 ); //BUG
|
||||
gs.path1.tag.nloop = 0;
|
||||
gs.path[0].tag.nloop = 0;
|
||||
ERROR_LOG("Transfer1 - 2\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
//GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path[1].mode, gs.path[1].tag.nloop);
|
||||
|
||||
_GSgifTransfer<1>(pMem, size);
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
//GS_LOG("GSgifTransfer3 size = %lx (mode %d, gs.path3.tag.nloop = %d)\n", size, gs.path[2].mode, gs.path[2].tag.nloop);
|
||||
|
||||
nPath3Hack = 0;
|
||||
_GSgifTransfer<2>(pMem, size);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
static int count = 0;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue