diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 45333463f5..52308f3565 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -595,14 +595,14 @@ void ScreenShot() // This should only be called from VI void VideoThrottle() { - u32 TargetVPS = (SConfig::GetInstance().m_Framelimit > 1) ? + u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1) ? SConfig::GetInstance().m_Framelimit * 10 : VideoInterface::TargetRefreshRate; // When frame limit is NOT off if (SConfig::GetInstance().m_Framelimit) { // Make the limiter a bit loose - u32 frametime = DrawnVideo * 1000 / ++TargetVPS; + u32 frametime = DrawnFrame * 1000 / ++TargetFPS; while ((u32)Timer.GetTimeDifference() < frametime) Common::YieldCPU(); //Common::SleepCurrentThread(1); @@ -616,7 +616,7 @@ void VideoThrottle() u32 FPS = Common::AtomicLoad(DrawnFrame) * 1000 / ElapseTime; u32 VPS = --DrawnVideo * 1000 / ElapseTime; - u32 Speed = VPS * 100 / VideoInterface::TargetRefreshRate; + u32 Speed = FPS * 100 / VideoInterface::TargetRefreshRate; // Settings are shown the same for both extended and summary info std::string SSettings = StringFromFormat("%s %s", diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index ad42d6bdb5..f6cd4e947f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -86,6 +86,7 @@ static bool s_bScreenshot = false; static Common::CriticalSection s_criticalScreenshot; static char s_sScreenshotName[1024]; static LPDIRECT3DSURFACE9 ScreenShootMEMSurface = NULL; +extern volatile u32 s_swapRequested; // State translation lookup tables @@ -566,13 +567,13 @@ void CheckForResize() } } -extern volatile u32 s_swapRequested; + void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc) { if(!fbWidth || !fbHeight) return; - VideoFifo_CheckEFBAccess(); + //VideoFifo_CheckEFBAccess(); // If we're about to write to a requested XFB, make sure the previous // contents make it to the screen first. if (g_ActiveConfig.bUseXFB) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 2bc3b44edc..171bb6676a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -435,8 +435,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y) if (g_VideoInitialize.bOnThread) { while (Common::AtomicLoadAcquire(s_efbAccessRequested) && !s_FifoShuttingDown) - Common::SleepCurrentThread(1); - //Common::YieldCPU(); + //Common::SleepCurrentThread(1); + Common::YieldCPU(); } else VideoFifo_CheckEFBAccess(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 0ac8153660..f3e23037fc 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -775,18 +775,20 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); glClear(bits); } - +static bool XFBWrited = false; void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc) { s_skipSwap = g_bSkipCurrentFrame; - VideoFifo_CheckEFBAccess(); + //VideoFifo_CheckEFBAccess(); // If we're about to write to a requested XFB, make sure the previous // contents make it to the screen first. - VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight); + if (g_ActiveConfig.bUseXFB) + VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight); + g_framebufferManager.CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc); - + XFBWrited = true; // XXX: Without the VI, how would we know what kind of field this is? So // just use progressive. if (!g_ActiveConfig.bUseXFB) @@ -804,7 +806,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) g_VideoInitialize.pCopiedToXFB(false); return; } - + if(!XFBWrited) + return; if (field == FIELD_LOWER) xfbAddr -= fbWidth * 2; @@ -1142,6 +1145,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight()); g_VideoInitialize.pCopiedToXFB(false); + XFBWrited = false; } // Create On-Screen-Messages diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index ecc1fee9d2..947e98194e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -516,14 +516,14 @@ void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight) // Run from the CPU thread (from VideoInterface.cpp) void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) { - if (s_PluginInitialized) + if (s_PluginInitialized && g_ActiveConfig.bUseXFB) { // Make sure previous swap request has made it to the screen if (g_VideoInitialize.bOnThread) { while (Common::AtomicLoadAcquire(s_swapRequested) && !s_FifoShuttingDown) - Common::SleepCurrentThread(1); - //Common::YieldCPU(); + //Common::SleepCurrentThread(1); + Common::YieldCPU(); } else VideoFifo_CheckSwapRequest(); @@ -574,8 +574,8 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y) if (g_VideoInitialize.bOnThread) { while (Common::AtomicLoadAcquire(s_efbAccessRequested) && !s_FifoShuttingDown) - Common::SleepCurrentThread(1); - //Common::YieldCPU(); + //Common::SleepCurrentThread(1); + Common::YieldCPU(); } else VideoFifo_CheckEFBAccess();