diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 412e30763c..2c1ca596f7 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -714,7 +714,7 @@ void formatBufferDump(const u8* in, u8* out, int w, int h, int p) // This function has the final picture. We adjust the aspect ratio here. void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, float Gamma) { - if (Fifo::g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) + if (Fifo::WillSkipCurrentFrame() || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) { if (SConfig::GetInstance().m_DumpFrames && !frame_data.empty()) AVIDump::AddFrame(&frame_data[0], fbWidth, fbHeight); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b107e95645..bf2da15e3f 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1260,7 +1260,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co } static int w = 0, h = 0; - if (Fifo::g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) + if (Fifo::WillSkipCurrentFrame() || (!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) { DumpFrame(frame_data, w, h); Core::Callback_VideoCopiedToXFB(false); diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index e7f3089027..0e2b4e1934 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -191,7 +191,7 @@ void CopyTempBuffer(s16 x, s16 y, int bufferBase, int subBuffer, const char *nam void OnObjectBegin() { - if (!Fifo::g_bSkipCurrentFrame) + if (!Fifo::WillSkipCurrentFrame()) { if (g_ActiveConfig.bDumpTextures && stats.thisFrame.numDrawnObjects >= g_ActiveConfig.drawStart && stats.thisFrame.numDrawnObjects < g_ActiveConfig.drawEnd) DumpActiveTextures(); @@ -200,7 +200,7 @@ void OnObjectBegin() void OnObjectEnd() { - if (!Fifo::g_bSkipCurrentFrame) + if (!Fifo::WillSkipCurrentFrame()) { if (g_ActiveConfig.bDumpObjects && stats.thisFrame.numDrawnObjects >= g_ActiveConfig.drawStart && stats.thisFrame.numDrawnObjects < g_ActiveConfig.drawEnd) DumpEfb(StringFromFormat("%sobject%i.png", diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp index b22a70e5cb..34032437c8 100644 --- a/Source/Core/VideoBackends/Software/EfbCopy.cpp +++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp @@ -72,7 +72,7 @@ namespace EfbCopy rc.right = rc.left + (int)bpmem.copyTexSrcWH.x + 1; rc.bottom = rc.top + (int)bpmem.copyTexSrcWH.y + 1; - if (!Fifo::g_bSkipCurrentFrame) + if (!Fifo::WillSkipCurrentFrame()) { if (bpmem.triggerEFBCopy.copy_to_xfb) { diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 0f03f3e840..312a315ec7 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -109,7 +109,7 @@ void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidt // Called on the GPU thread void SWRenderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc, float Gamma) { - if (!Fifo::g_bSkipCurrentFrame) + if (!Fifo::WillSkipCurrentFrame()) { if (g_ActiveConfig.bUseXFB) diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 4962dc59ed..ff125652a6 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -380,7 +380,7 @@ static void BPWritten(const BPCmd& bp) case BPMEM_CLEARBBOX2: // Don't compute bounding box if this frame is being skipped! // Wrong but valid values are better than bogus values... - if (!Fifo::g_bSkipCurrentFrame) + if (!Fifo::WillSkipCurrentFrame()) { u8 offset = bp.address & 2; BoundingBox::active = true; diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp index e04f3ffcbf..953484c114 100644 --- a/Source/Core/VideoCommon/Fifo.cpp +++ b/Source/Core/VideoCommon/Fifo.cpp @@ -33,7 +33,7 @@ namespace Fifo static constexpr u32 FIFO_SIZE = 2 * 1024 * 1024; -bool g_bSkipCurrentFrame = false; +static bool s_skip_current_frame = false; static Common::BlockingLoop s_gpu_mainloop; @@ -82,7 +82,8 @@ void DoState(PointerWrap &p) // We're good and paused, right? s_video_buffer_seen_ptr = s_video_buffer_pp_read_ptr = s_video_buffer_read_ptr; } - p.Do(g_bSkipCurrentFrame); + + p.Do(s_skip_current_frame); p.Do(s_last_sync_gpu_tick); } @@ -129,7 +130,12 @@ void Shutdown() void SetRendering(bool enabled) { - g_bSkipCurrentFrame = !enabled; + s_skip_current_frame = !enabled; +} + +bool WillSkipCurrentFrame() +{ + return s_skip_current_frame; } // May be executed from any thread, even the graphics thread. diff --git a/Source/Core/VideoCommon/Fifo.h b/Source/Core/VideoCommon/Fifo.h index b30d41069e..e5e5cd36ac 100644 --- a/Source/Core/VideoCommon/Fifo.h +++ b/Source/Core/VideoCommon/Fifo.h @@ -13,8 +13,6 @@ class PointerWrap; namespace Fifo { -extern bool g_bSkipCurrentFrame; - // This could be in SConfig, but it depends on multiple settings // and can change at runtime. extern bool g_use_deterministic_gpu_thread; @@ -53,5 +51,6 @@ void EmulatorState(bool running); bool AtBreakpoint(); void ResetVideoBuffer(); void SetRendering(bool bEnabled); +bool WillSkipCurrentFrame(); -}; +} // namespace Fifo diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 3af3337b9e..1733a89ad9 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -277,7 +277,7 @@ u8* Run(DataReader src, u32* cycles, bool in_display_list) (cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, num_vertices, src, - Fifo::g_bSkipCurrentFrame, + Fifo::WillSkipCurrentFrame(), is_preprocess); if (bytes < 0)