diff --git a/pcsx2/GS/GSState.h b/pcsx2/GS/GSState.h index 2b70b71b13..bfed894e4a 100644 --- a/pcsx2/GS/GSState.h +++ b/pcsx2/GS/GSState.h @@ -223,6 +223,7 @@ public: u32 m_dirty_gs_regs; int m_backed_up_ctx; std::list m_draw_transfers; + bool m_force_preload; static int s_n; diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index 053cf5498b..1f5d861ac5 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -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(); diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index c0e289924b..3a47e1a90a 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -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(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(g_gs_renderer.get())->m_draw_transfers.size() > 0) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.h b/pcsx2/GS/Renderers/HW/GSTextureCache.h index 3bf8a5bee6..61ea6dab88 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.h +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.h @@ -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);