GS-HW: Force preload 1 frame after reset

This commit is contained in:
refractionpcsx2 2023-01-31 10:49:31 +00:00
parent 2fd88b901b
commit 8ac21357c3
4 changed files with 11 additions and 19 deletions

View File

@ -223,6 +223,7 @@ public:
u32 m_dirty_gs_regs;
int m_backed_up_ctx;
std::list<GIFRegBITBLTBUF> m_draw_transfers;
bool m_force_preload;
static int s_n;

View File

@ -202,9 +202,13 @@ void GSRendererHW::VSync(u32 field, bool registers_written)
{
if (m_reset)
{
m_tc->InvalidateFrameAge();
m_tc->RemoveAll();
m_reset = false;
m_force_preload = true;
}
else
m_force_preload = false;
if (GSConfig.LoadTextureReplacements)
GSTextureReplacements::ProcessAsyncLoadedTextures();
@ -1363,7 +1367,7 @@ void GSRendererHW::Draw()
}
// SW CLUT Render enable.
bool preload = GSConfig.PreloadFrameWithGSData;
bool preload = GSConfig.PreloadFrameWithGSData | m_force_preload;
if (GSConfig.UserHacks_CPUCLUTRender > 0 || GSConfig.UserHacks_GPUTargetCLUTMode != GSGPUTargetCLUTMode::Disabled)
{
const CLUTDrawTestResult result = (GSConfig.UserHacks_CPUCLUTRender == 2) ? PossibleCLUTDrawAggressive() : PossibleCLUTDraw();

View File

@ -61,19 +61,6 @@ void GSTextureCache::RemovePartial()
}
}
// Causes old frames to be flushed
void GSTextureCache::InvalidateFrameAge()
{
for (int type = 0; type < 2; type++)
{
for (auto t : m_dst[type])
{
if (t->m_is_frame)
t->m_age = 9999;
}
}
}
void GSTextureCache::RemoveAll()
{
m_src.RemoveAll();
@ -713,10 +700,11 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
//
// From a performance point of view, it might cost a little on big upscaling
// but normally few RT are miss so it must remain reasonable.
bool supported_fmt = !GSConfig.UserHacks_DisableDepthSupport || psm_s.depth == 0;
if ((is_frame || preload) && TEX0.TBW > 0 && supported_fmt)
const bool supported_fmt = !GSConfig.UserHacks_DisableDepthSupport || psm_s.depth == 0;
const bool forced_preload = static_cast<GSRendererHW*>(g_gs_renderer.get())->m_force_preload;
if ((is_frame || preload || forced_preload) && TEX0.TBW > 0 && supported_fmt)
{
if (!is_frame)
if (!is_frame && !forced_preload)
{
// Check for an EE transfer that matches our RT.
while (static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.size() > 0)

View File

@ -353,7 +353,6 @@ public:
void Read(Target* t, const GSVector4i& r);
void Read(Source* t, const GSVector4i& r);
void RemoveAll();
void InvalidateFrameAge();
void RemovePartial();
void AddDirtyRectTarget(Target* target, GSVector4i rect, u32 psm, u32 bw);