GS: Clear current/merge textures on hardware reset

This commit is contained in:
Connor McLaughlin 2022-05-27 21:24:21 +10:00 committed by refractionpcsx2
parent f6d997ca87
commit 4fd06b5ea8
5 changed files with 31 additions and 0 deletions

View File

@ -496,6 +496,10 @@ int GSfreeze(FreezeAction mode, freezeData* data)
}
else if (mode == FreezeAction::Load)
{
// Since Defrost doesn't do a hardware reset (since it would be clearing
// local memory just before it's overwritten), we have to manually wipe
// out the current textures.
g_gs_device->ClearCurrent();
return g_gs_renderer->Defrost(data);
}
}

View File

@ -315,6 +315,21 @@ void GSDevice::StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dR
StretchRect(sTex, GSVector4(0, 0, 1, 1), dTex, dRect, shader, linear);
}
void GSDevice::ClearCurrent()
{
m_current = nullptr;
delete m_merge;
delete m_weavebob;
delete m_blend;
delete m_target_tmp;
m_merge = nullptr;
m_weavebob = nullptr;
m_blend = nullptr;
m_target_tmp = nullptr;
}
void GSDevice::Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
{
// KH:COM crashes at startup when booting *through the bios* due to m_merge being NULL.

View File

@ -727,6 +727,7 @@ public:
__fi FeatureSupport Features() const { return m_features; }
__fi GSTexture* GetCurrent() const { return m_current; }
void ClearCurrent();
void Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
void FXAA();

View File

@ -60,6 +60,15 @@ GSRenderer::GSRenderer() = default;
GSRenderer::~GSRenderer() = default;
void GSRenderer::Reset(bool hardware_reset)
{
// clear the current display texture
if (hardware_reset)
g_gs_device->ClearCurrent();
GSState::Reset(hardware_reset);
}
void GSRenderer::Destroy()
{
}

View File

@ -51,6 +51,8 @@ public:
GSRenderer();
virtual ~GSRenderer();
virtual void Reset(bool hardware_reset) override;
virtual void Destroy();
virtual void VSync(u32 field, bool registers_written);