From 8a73f98b1fe006d6ecfb4886d84513d3707cfac7 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sat, 30 Mar 2024 20:30:11 +0000 Subject: [PATCH] GS/TC: When preloading new targets, include the preloaded size as valid --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index bf50221074..6ac2095e1e 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -2367,7 +2367,7 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(GIFRegTEX0 TEX0, const GSVe dst->m_last_draw = GSState::s_n; - if (dst->m_dirty.empty() && (GSUtil::GetChannelMask(TEX0.PSM) & 0x8)) + if (dst->m_dirty.empty() && GSLocalMemory::m_psm[TEX0.PSM].depth == 0 && (GSUtil::GetChannelMask(TEX0.PSM) & 0x8)) dst->m_rt_alpha_scale = true; else dst->m_last_draw -= 1; // If we preload and it needs to decorrect and we couldn't catch it early, we need to make sure it decorrects the data. @@ -2494,6 +2494,8 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons if (!eerect.rempty()) { + if(!hw_clear) + dst->UpdateValidity(newrect); GL_INS("Preloading the RT DATA from updated GS Memory"); AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16); } @@ -2511,12 +2513,12 @@ bool GSTextureCache::PreloadTarget(GIFRegTEX0 TEX0, const GSVector2i& size, cons } } GL_INS("Preloading the RT DATA"); + + // Don't set valid here, because we have no guarantee this is the data we want. AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW, rgba, GSLocalMemory::m_psm[TEX0.PSM].trbpp >= 16); } } - dst->UpdateValidity(GSVector4i::loadh(valid_size)); - // Can't do channel writes to depth targets, and DirectX can't partial copy depth targets. if (psm_s.depth == 0) {