GS: Clear local memory on hardware reset

This commit is contained in:
Connor McLaughlin 2022-05-27 21:20:32 +10:00 committed by refractionpcsx2
parent 5963efcec8
commit f6d997ca87
12 changed files with 21 additions and 20 deletions

View File

@ -38,7 +38,7 @@ void gsSetVideoMode(GS_VideoMode mode)
// Make sure framelimiter options are in sync with GS capabilities.
void gsReset()
{
GetMTGS().ResetGS();
GetMTGS().ResetGS(true);
UpdateVSyncRate();
memzero(g_RealGSMem);

View File

@ -380,7 +380,7 @@ public:
// Waits for the GS to empty out the entire ring buffer contents.
void WaitGS(bool syncRegs=true, bool weakWait=false, bool isMTVU=false);
void ResetGS();
void ResetGS(bool hardware_reset);
void PrepDataPacket( MTGS_RingCommand cmd, u32 size );
void PrepDataPacket( GIF_PATH pathidx, u32 size );

View File

@ -373,11 +373,11 @@ bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* b
return true;
}
void GSreset()
void GSreset(bool hardware_reset)
{
try
{
g_gs_renderer->Reset();
g_gs_renderer->Reset(hardware_reset);
}
catch (GSRecoverableError)
{

View File

@ -57,7 +57,7 @@ void GSinitConfig();
void GSshutdown();
bool GSopen(const Pcsx2Config::GSOptions& config, GSRendererType renderer, u8* basemem);
bool GSreopen(bool recreate_display);
void GSreset();
void GSreset(bool hardware_reset);
void GSclose();
void GSgifSoftReset(u32 mask);
void GSwriteCSR(u32 csr);

View File

@ -137,7 +137,7 @@ GSState::GSState()
m_env.PRMODECONT.AC = 1;
m_last_prim.U32[0] = PRIM->U32[0];
Reset();
Reset(false);
ResetHandlers();
}
@ -178,10 +178,11 @@ void GSState::SetFrameSkip(int skip)
}
}
void GSState::Reset()
void GSState::Reset(bool hardware_reset)
{
// FIXME: bios logo not shown cut in half after reset, missing graphics in GoW after first FMV
// memset(m_mem.m_vm8, 0, m_mem.m_vmsize);
if (hardware_reset)
memset(m_mem.m_vm8, 0, m_mem.m_vmsize);
memset(&m_path, 0, sizeof(m_path));
memset(&m_v, 0, sizeof(m_v));
@ -2396,7 +2397,7 @@ int GSState::Defrost(const freezeData* fd)
Flush();
Reset();
Reset(false);
ReadState(&m_env.PRIM, data);

View File

@ -302,7 +302,7 @@ public:
float GetTvRefreshRate();
virtual void Reset();
virtual void Reset(bool hardware_reset);
virtual void UpdateSettings(const Pcsx2Config::GSOptions& old_config);
void Flush();

View File

@ -202,14 +202,14 @@ int GSRendererHW::GetUpscaleMultiplier()
return GSConfig.UpscaleMultiplier;
}
void GSRendererHW::Reset()
void GSRendererHW::Reset(bool hardware_reset)
{
// TODO: GSreset can come from the main thread too => crash
// m_tc->RemoveAll();
m_reset = true;
GSRenderer::Reset();
GSRenderer::Reset(hardware_reset);
}
void GSRendererHW::UpdateSettings(const Pcsx2Config::GSOptions& old_config)

View File

@ -183,7 +183,7 @@ public:
GSVector2 GetTextureScaleFactor() override;
GSVector2i GetTargetSize();
void Reset() override;
void Reset(bool hardware_reset) override;
void UpdateSettings(const Pcsx2Config::GSOptions& old_config) override;
void VSync(u32 field, bool registers_written) override;

View File

@ -66,13 +66,13 @@ GSRendererSW::~GSRendererSW()
GSRendererSW::Destroy();
}
void GSRendererSW::Reset()
void GSRendererSW::Reset(bool hardware_reset)
{
Sync(-1);
m_tc->RemoveAll();
GSRenderer::Reset();
GSRenderer::Reset(hardware_reset);
}
void GSRendererSW::Destroy()

View File

@ -78,7 +78,7 @@ protected:
std::atomic<u32> m_fzb_pages[512]; // u16 frame/zbuf pages interleaved
std::atomic<u16> m_tex_pages[512];
void Reset() override;
void Reset(bool hardware_reset) override;
void VSync(u32 field, bool registers_written) override;
GSTexture* GetOutput(int i, int& y_offset) override;
GSTexture* GetFeedbackOutput() override;

View File

@ -166,7 +166,7 @@ void SysMtgsThread::ThreadEntryPoint()
GSshutdown();
}
void SysMtgsThread::ResetGS()
void SysMtgsThread::ResetGS(bool hardware_reset)
{
pxAssertDev(!IsOpen() || (m_ReadPos == m_WritePos), "Must close or terminate the GS thread prior to gsReset.");
@ -180,7 +180,7 @@ void SysMtgsThread::ResetGS()
m_VsyncSignalListener = 0;
MTGS_LOG("MTGS: Sending Reset...");
SendSimplePacket(GS_RINGTYPE_RESET, 0, 0, 0);
SendSimplePacket(GS_RINGTYPE_RESET, static_cast<int>(hardware_reset), 0, 0);
SendSimplePacket(GS_RINGTYPE_FRAMESKIP, 0, 0, 0);
SetEvent();
}
@ -495,7 +495,7 @@ void SysMtgsThread::MainLoop()
case GS_RINGTYPE_RESET:
MTGS_LOG("(MTGS Packet Read) ringtype=Reset");
GSreset();
GSreset(tag.data != 0);
break;
case GS_RINGTYPE_SOFTRESET:

View File

@ -882,7 +882,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
}
GSvsync(1, false);
GSreset();
GSreset(false);
GSfreeze(FreezeAction::Load, &fd);
size_t i = 0;