From 748127d6586f5089d4cbdc3ba7c8838cc9042240 Mon Sep 17 00:00:00 2001 From: Luigi__ Date: Fri, 3 Apr 2009 12:33:10 +0000 Subject: [PATCH] The frameskip now also makes the 3D soft rasterizer skip frames. But it causes a problem that appears in iDeaS: 3D and 2D aren't synchronized when using frameskip. Feel free to revert it if that problem is annoying for you. --- desmume/src/NDSSystem.cpp | 2 +- desmume/src/OGLRender.cpp | 2 +- desmume/src/gfx3d.cpp | 4 ++-- desmume/src/gfx3d.h | 2 +- desmume/src/rasterize.cpp | 5 ++++- desmume/src/render3D.cpp | 3 ++- desmume/src/render3D.h | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index f078bf854..6301abd88 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -1680,7 +1680,7 @@ u32 NDS_exec(s32 nb) } else if(nds.VCount==215) { - gfx3d_VBlankEndSignal(); + gfx3d_VBlankEndSignal(skipThisFrame); } else if(nds.VCount==263) { diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index a2df8284f..62790bd7c 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -687,7 +687,7 @@ static void Control() } } -static void OGLRender() +static void OGLRender(bool skipdraw) { if(!BEGINGL()) return; diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index fb2383103..76004e2d2 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -1374,12 +1374,12 @@ void gfx3d_VBlankSignal() drawPending = TRUE; } -void gfx3d_VBlankEndSignal() +void gfx3d_VBlankEndSignal(bool skipdraw) { if(!drawPending) return; drawPending = FALSE; - gpu3D->NDS_3D_Render(); + gpu3D->NDS_3D_Render(skipdraw); } #ifdef USE_GEOMETRY_FIFO_EMULATION diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index 859227ba1..bc152af94 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -237,7 +237,7 @@ unsigned int gfx3d_glGetPosRes(unsigned int index); unsigned short gfx3d_glGetVecRes(unsigned int index); void gfx3d_glFlush(unsigned long v); void gfx3d_VBlankSignal(); -void gfx3d_VBlankEndSignal(); +void gfx3d_VBlankEndSignal(bool skipdraw); void gfx3d_Control(unsigned long v); u32 gfx3d_GetGXstatus(); void gfx3d_sendCommandToFIFO(u32 val); diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 4c8cddc06..fe8c09e4f 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -1145,8 +1145,11 @@ static void clipPoly(POLY* poly) } -static void SoftRastRender() +static void SoftRastRender(bool skipdraw) { + if(skipdraw) + return; + Fragment clearFragment; clearFragment.color.components.r = gfx3d.clearColor&0x1F; clearFragment.color.components.g = (gfx3d.clearColor>>5)&0x1F; diff --git a/desmume/src/render3D.cpp b/desmume/src/render3D.cpp index 8ef8c0c50..c90a8cf28 100644 --- a/desmume/src/render3D.cpp +++ b/desmume/src/render3D.cpp @@ -26,13 +26,14 @@ static void NDS_nullFunc1 (void){} static char NDS_nullFunc2 (void){ return 1; } static void NDS_nullFunc3 (int,unsigned short*) {} static void NDS_nullFunc4 (int,unsigned short*,unsigned char*) {} +static void NDS_nullFunc5 (bool){} GPU3DInterface gpu3DNull = { "None", NDS_nullFunc2, //NDS_3D_Init NDS_nullFunc1, //NDS_3D_Reset NDS_nullFunc1, //NDS_3D_Close - NDS_nullFunc1, //NDS_3D_Render + NDS_nullFunc5, //NDS_3D_Render NDS_nullFunc1, //NDS_3D_VramReconfigureSignal NDS_nullFunc4, //NDS_3D_GetLine NDS_nullFunc3 //NDS_3D_GetLineCaptured diff --git a/desmume/src/render3D.h b/desmume/src/render3D.h index 8df9133c4..20efc19d1 100644 --- a/desmume/src/render3D.h +++ b/desmume/src/render3D.h @@ -39,7 +39,7 @@ typedef struct Render3DInterface void (CALL_CONVENTION* NDS_3D_Close) (void); //called when the renderer should do its job and render the current display lists - void (CALL_CONVENTION* NDS_3D_Render) (void); + void (CALL_CONVENTION* NDS_3D_Render) (bool skipdraw); //called when the emulator reconfigures its vram. you may need to invalidate your texture cache. void (CALL_CONVENTION* NDS_3D_VramReconfigureSignal) ();