Fifo: Make g_bSkipCurrentFrame a TU-local variable

This is only ever queried, making it a global isn't necessary.
This commit is contained in:
Lioncash 2016-01-23 23:20:13 -05:00
parent 48e7e5b72e
commit 5ebd1e215b
9 changed files with 19 additions and 14 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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",

View File

@ -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)
{

View File

@ -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)

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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)