- fixes in new gxFIFO (NSB, FFx, Arcanoid and others work now)

- fix 3D flush;
This commit is contained in:
mtabachenko 2009-07-14 16:13:50 +00:00
parent 01af8a7453
commit a6b05cf101
2 changed files with 47 additions and 28 deletions

View File

@ -179,19 +179,35 @@ void GFX_FIFOsend(u8 cmd, u32 param)
BOOL GFX_FIFOrecv(u8 *cmd, u32 *param) BOOL GFX_FIFOrecv(u8 *cmd, u32 *param)
{ {
u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600); u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
#if 0
if (gxstat & 0xC0000000) if (gxstat & 0xC0000000)
{ {
setIF(0, (1<<21)); setIF(0, (1<<21));
} }
gxstat &= 0xF000FFFF; #endif
if (gxFIFO.tail == 0) // empty if (gxFIFO.tail == 0) // empty
{ {
//gxstat |= (0x01FF << 16); gxstat &= 0xF000FFFF;
gxstat |= 0x06000000; gxstat |= 0x06000000;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat); T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
if ((gxstat & 0x80000000)) // empty
{
setIF(0, (1<<21));
}
return FALSE; return FALSE;
} }
if (gxstat & 0x40000000) // IRQ: less half
{
if (gxstat & 0x02000000) setIF(0, (1<<21));
}
if ((gxstat & 0x80000000)) // IRQ: empty
{
if (gxstat & 0x04000000) setIF(0, (1<<21));
}
gxstat &= 0xF000FFFF;
*cmd = gxFIFO.cmd[0]; *cmd = gxFIFO.cmd[0];
*param = gxFIFO.param[0]; *param = gxFIFO.param[0];
gxFIFO.tail--; gxFIFO.tail--;
@ -226,10 +242,10 @@ void GFX_FIFOcnt(u32 val)
} }
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat); T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
if (gxstat & 0xC0000000) /*if (gxstat & 0xC0000000)
{ {
setIF(0, (1<<21)); setIF(0, (1<<21));
} }*/
} }
// ========================================================= DISP FIFO // ========================================================= DISP FIFO

View File

@ -1535,7 +1535,7 @@ void gfx3d_execute3D()
u8 cmd = 0; u8 cmd = 0;
u32 param = 0; u32 param = 0;
//if (isSwapBuffers) return; if (isSwapBuffers) return;
if (GFX_FIFOrecv(&cmd, &param)) if (GFX_FIFOrecv(&cmd, &param))
{ {
@ -1570,16 +1570,12 @@ void gfx3d_execute3D()
void gfx3d_glFlush(u32 v) void gfx3d_glFlush(u32 v)
{ {
flushPending = TRUE;
if(!flushPending)
{
gfx3d.sortmode = BIT0(v);
gfx3d.wbuffer = BIT1(v);
}
#ifdef USE_GEOMETRY_FIFO_EMULATION #ifdef USE_GEOMETRY_FIFO_EMULATION
gfx3d.sortmode = BIT0(v);
gfx3d.wbuffer = BIT1(v);
#if 0 #if 0
if (polygonListCompleted == 2) if (polygonListCompleted == 2)
{ {
//u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600); //u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
@ -1590,13 +1586,19 @@ void gfx3d_glFlush(u32 v)
} }
#endif #endif
gfx3d_doFlush(); //gfx3d_doFlush();
isSwapBuffers = true; isSwapBuffers = true;
//u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600); //u32 gxstat = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600);
//gxstat |= 0x08000000; // set busy flag //gxstat |= 0x08000000; // set busy flag
//T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat); //T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
#else #else
if(!flushPending)
{
gfx3d.sortmode = BIT0(v);
gfx3d.wbuffer = BIT1(v);
flushPending = TRUE;
}
//see discussion at top of file //see discussion at top of file
if(CommonSettings.gfx3d_flushMode == 0) if(CommonSettings.gfx3d_flushMode == 0)
gfx3d_doFlush(); gfx3d_doFlush();
@ -1708,8 +1710,10 @@ void gfx3d_VBlankSignal()
{ {
#ifdef USE_GEOMETRY_FIFO_EMULATION #ifdef USE_GEOMETRY_FIFO_EMULATION
isVBlank = true; isVBlank = true;
if (isSwapBuffers) if (isSwapBuffers)
{ {
//if (bWaitForPolys) return;
gfx3d_doFlush();
isSwapBuffers = false; isSwapBuffers = false;
GFX_DELAY(392); GFX_DELAY(392);
} }
@ -1732,21 +1736,20 @@ void gfx3d_VBlankEndSignal(bool skipFrame)
{ {
#ifdef USE_GEOMETRY_FIFO_EMULATION #ifdef USE_GEOMETRY_FIFO_EMULATION
isVBlank = false; isVBlank = false;
if (drawPending)
{
drawPending = FALSE;
//if the null 3d core is chosen, then we need to clear out the 3d buffers to keep old data from being rendered if(skipFrame) return;
if(gpu3D == &gpu3DNull || !CommonSettings.showGpu.main) if (!drawPending) return;
{ drawPending = FALSE;
memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedScreen));
memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedAlpha)); //if the null 3d core is chosen, then we need to clear out the 3d buffers to keep old data from being rendered
} if(gpu3D == &gpu3DNull || !CommonSettings.showGpu.main)
else {
{ memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedScreen));
if(CommonSettings.showGpu.main) memset(gfx3d_convertedScreen,0,sizeof(gfx3d_convertedAlpha));
gpu3D->NDS_3D_Render(); }
} else
{
gpu3D->NDS_3D_Render();
} }
#else #else
//if we are skipping 3d frames then the 3d rendering will get held up here. //if we are skipping 3d frames then the 3d rendering will get held up here.