GS: Reset stats on open

Fixes junk/bogus stats when switching to/from software renderer, and
when shutting down/starting a new game.
This commit is contained in:
Connor McLaughlin 2022-06-28 23:01:34 +10:00 committed by refractionpcsx2
parent 590ca98463
commit 92aea38230
3 changed files with 17 additions and 12 deletions

View File

@ -285,6 +285,7 @@ static bool DoGSOpen(GSRendererType renderer, u8* basemem)
GSConfig.OsdShowGPU = EmuConfig.GS.OsdShowGPU && display->SetGPUTimingEnabled(true);
g_gs_renderer->SetRegsMem(basemem);
g_perfmon.Reset();
return true;
}

View File

@ -19,13 +19,15 @@
GSPerfMon g_perfmon;
GSPerfMon::GSPerfMon()
: m_frame(0)
, m_lastframe(0)
, m_count(0)
GSPerfMon::GSPerfMon() = default;
void GSPerfMon::Reset()
{
memset(m_counters, 0, sizeof(m_counters));
memset(m_stats, 0, sizeof(m_stats));
m_frame = 0;
m_lastframe = 0;
m_count = 0;
std::memset(m_counters, 0, sizeof(m_counters));
std::memset(m_stats, 0, sizeof(m_stats));
}
void GSPerfMon::EndFrame()

View File

@ -38,16 +38,18 @@ public:
};
protected:
double m_counters[CounterLast];
double m_stats[CounterLast];
u64 m_frame;
clock_t m_lastframe;
int m_count;
int m_disp_fb_sprite_blits;
double m_counters[CounterLast] = {};
double m_stats[CounterLast] = {};
u64 m_frame = 0;
clock_t m_lastframe = 0;
int m_count = 0;
int m_disp_fb_sprite_blits = 0;
public:
GSPerfMon();
void Reset();
void SetFrame(u64 frame) { m_frame = frame; }
u64 GetFrame() { return m_frame; }
void EndFrame();