From: ptitSeb Date: Fri, 11 Oct 2013 04:33:23 +0000 (+0200) Subject: Some attempts to speedup Rice when using FB X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=mupen64plus-pandora.git;a=commitdiff_plain;h=ca22e7b76883b946060a6b40bb8709c1981e1cf6 Some attempts to speedup Rice when using FB --- diff --git a/source/gles2rice/src/Config.cpp b/source/gles2rice/src/Config.cpp old mode 100644 new mode 100755 index 125be0b..98d86cd --- a/source/gles2rice/src/Config.cpp +++ b/source/gles2rice/src/Config.cpp @@ -429,6 +429,10 @@ static void ReadConfiguration(void) { windowSetting.bDisplayFullscreen = ConfigGetParamBool(l_ConfigVideoGeneral, "Fullscreen"); windowSetting.uDisplayWidth = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenWidth"); +#if 1 + if (windowSetting.uDisplayWidth==800) + windowSetting.uDisplayWidth = 640; // no strech +#endif windowSetting.uDisplayHeight = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenHeight"); windowSetting.bVerticalSync = ConfigGetParamBool(l_ConfigVideoGeneral, "VerticalSync"); @@ -460,6 +464,8 @@ static void ReadConfiguration(void) options.bShowFPS = ConfigGetParamBool(l_ConfigVideoRice, "ShowFPS"); options.mipmapping = ConfigGetParamInt(l_ConfigVideoRice, "Mipmapping"); + //*SEB* Force to 0 has other setting crash on the Pandora + options.mipmapping = 0; options.fogMethod = ConfigGetParamInt(l_ConfigVideoRice, "FogMethod"); options.forceTextureFilter = ConfigGetParamInt(l_ConfigVideoRice, "ForceTextureFilter"); options.textureEnhancement = ConfigGetParamInt(l_ConfigVideoRice, "TextureEnhancement"); @@ -470,7 +476,9 @@ static void ReadConfiguration(void) options.colorQuality = ConfigGetParamInt(l_ConfigVideoRice, "ColorQuality"); options.OpenglRenderSetting = ConfigGetParamInt(l_ConfigVideoRice, "OpenGLRenderSetting"); options.anisotropicFiltering = ConfigGetParamInt(l_ConfigVideoRice, "AnisotropicFiltering"); - + //*SEB* Force to 0 has mipmapping is already forced to 0 + options.anisotropicFiltering = 0; + CDeviceBuilder::SelectDeviceType((SupportedDeviceType)options.OpenglRenderSetting); status.isMMXSupported = isMMXSupported(); diff --git a/source/gles2rice/src/OGLGraphicsContext.cpp b/source/gles2rice/src/OGLGraphicsContext.cpp index ab394f1..3be9fc0 100644 --- a/source/gles2rice/src/OGLGraphicsContext.cpp +++ b/source/gles2rice/src/OGLGraphicsContext.cpp @@ -113,7 +113,11 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind /* Set the video mode */ m64p_video_mode ScreenMode = bWindowed ? M64VIDEO_WINDOWED : M64VIDEO_FULLSCREEN; m64p_video_flags flags = M64VIDEOFLAG_SUPPORT_RESIZING; +#if 1 + if (CoreVideo_SetVideoMode(800, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode, flags) != M64ERR_SUCCESS) +#else if (CoreVideo_SetVideoMode(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, colorBufferDepth, ScreenMode, flags) != M64ERR_SUCCESS) +#endif { DebugMessage(M64MSG_ERROR, "Failed to set %i-bit video mode: %ix%i", colorBufferDepth, (int)windowSetting.uDisplayWidth, (int)windowSetting.uDisplayHeight); CoreVideo_Quit(); diff --git a/source/gles2rice/src/OGLRender.cpp b/source/gles2rice/src/OGLRender.cpp index 4b66a6c..542faec 100755 --- a/source/gles2rice/src/OGLRender.cpp +++ b/source/gles2rice/src/OGLRender.cpp @@ -815,7 +815,6 @@ void OGLRender::DrawSimple2DTexture(float x0, float y0, float x1, float y1, floa GLboolean cullface = glIsEnabled(GL_CULL_FACE); glDisable(GL_CULL_FACE); OPENGL_CHECK_ERRORS; - glViewportWrapper(0, windowSetting.statusBarHeightToUse, windowSetting.uDisplayWidth, windowSetting.uDisplayHeight); OPENGL_CHECK_ERRORS; diff --git a/source/gles2rice/src/RSP_Parser.cpp b/source/gles2rice/src/RSP_Parser.cpp index d3a69d3..0c2de1f 100644 --- a/source/gles2rice/src/RSP_Parser.cpp +++ b/source/gles2rice/src/RSP_Parser.cpp @@ -780,6 +780,13 @@ uint32 DLParser_CheckUcode(uint32 ucStart, uint32 ucDStart, uint32 ucSize, uint3 extern int dlistMtxCount; extern bool bHalfTxtScale; +extern float mspervi; +extern float numvi; +static int skipframe=0; +static unsigned int oldtick=0; +static int oldskip=0; +extern bool skipping; + void DLParser_Process(OSTask * pTask) { static int skipframe=0; @@ -796,7 +803,7 @@ void DLParser_Process(OSTask * pTask) } status.bScreenIsDrawn = true; - if( options.bSkipFrame ) +/* if( options.bSkipFrame ) { skipframe++; if(skipframe%2) @@ -806,12 +813,44 @@ void DLParser_Process(OSTask * pTask) return; } } - +*/ if( currentRomOptions.N64RenderToTextureEmuType != TXT_BUF_NONE && defaultRomOptions.bSaveVRAM ) { g_pFrameBufferManager->CheckRenderTextureCRCInRDRAM(); } + unsigned int newtick=0; + static int count = 0; + if( options.bSkipFrame ) + { + skipping=false; + newtick = SDL_GetTicks(); + if (newtick-oldtick>400 || skipframe>4 || numvi==0) { + oldtick=newtick; // too long frame delay, something must have gone wrong + skipping=false; + } else + if ((float)(newtick-oldtick)>=mspervi*numvi+3.0f) { + skipping=true; + } + // don't jump frameskipping... + if (skipping) { + //want to skip, be progress slowly... + if (skipframe>oldskip+1) + skipping = false; + } + if (skipping) { + skipframe++; + status.bScreenIsDrawn = false; + TriggerDPInterrupt(); + TriggerSPInterrupt(); + return; + } + oldskip = skipframe; + skipframe=0; + oldtick=newtick; + numvi=0; + } + g_pOSTask = pTask; DebuggerPauseCountN( NEXT_DLIST ); diff --git a/source/gles2rice/src/TextureManager.cpp b/source/gles2rice/src/TextureManager.cpp index fb868e2..3e4411b 100644 --- a/source/gles2rice/src/TextureManager.cpp +++ b/source/gles2rice/src/TextureManager.cpp @@ -865,6 +865,9 @@ void CTextureManager::ConvertTexture(TxtrCacheEntry * pEntry, bool fromTMEM) { pF( pEntry->pTexture, pEntry->ti ); +/*printf("Decompress 32bit Texture:\n\tFormat: %s\n\tImage Size:%d\n", + pszImgFormat[pEntry->ti.Format], pnImgSize[pEntry->ti.Size]); +printf("Palette Format: %s (%d)\n", textlutname[pEntry->ti.TLutFmt>>RSP_SETOTHERMODE_SHIFT_TEXTLUT], pEntry->ti.TLutFmt>>RSP_SETOTHERMODE_SHIFT_TEXTLUT);*/ LOG_TEXTURE( { DebuggerAppendMsg("Decompress 32bit Texture:\n\tFormat: %s\n\tImage Size:%d\n", @@ -874,6 +877,7 @@ void CTextureManager::ConvertTexture(TxtrCacheEntry * pEntry, bool fromTMEM) } else { +//printf("ConvertTexture: Unable to decompress %s/%dbpp", pszImgFormat[pEntry->ti.Format], pnImgSize[pEntry->ti.Size]); TRACE2("ConvertTexture: Unable to decompress %s/%dbpp", pszImgFormat[pEntry->ti.Format], pnImgSize[pEntry->ti.Size]); } diff --git a/source/gles2rice/src/Video.cpp b/source/gles2rice/src/Video.cpp index d49d829..c4ce745 100644 --- a/source/gles2rice/src/Video.cpp +++ b/source/gles2rice/src/Video.cpp @@ -101,6 +101,11 @@ ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL; ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL; ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL; +// For Fameskip +float mspervi = 1000.0f/60.0f; //default is shortest frame +float numvi = 0.0f; +bool skipping = false; + //--------------------------------------------------------------------------------------- // Forward function declarations @@ -171,12 +176,21 @@ static void UpdateScreenStep2 (void) } g_CritialSection.Lock(); + + //framskip, count vi + numvi++; + if( status.bHandleN64RenderTexture ) g_pFrameBufferManager->CloseRenderTexture(true); + + if (skipping) { + g_CritialSection.Unlock(); + return; + } g_pFrameBufferManager->SetAddrBeDisplayed(*g_GraphicsInfo.VI_ORIGIN_REG); - if( status.gDlistCount == 0 ) + if(status.gDlistCount == 0) { // CPU frame buffer update uint32 width = *g_GraphicsInfo.VI_WIDTH_REG; @@ -326,10 +340,13 @@ static bool StartVideo(void) GenerateCurrentRomOptions(); status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID); - if( status.dwTvSystem == TV_SYSTEM_NTSC ) + if( status.dwTvSystem == TV_SYSTEM_NTSC ) { status.fRatio = 0.75f; - else - status.fRatio = 9/11.0f;; + mspervi=1000.0f/60.0f; //for framskipping + } else { + status.fRatio = 9/11.0f; + mspervi=1000.0f/50.0f; //for framskipping + } InitExternalTextures();