GS/HW: Use valid rect over size in CopyRGBFromDepthToColor()

Avoids a copy.
This commit is contained in:
Stenzek 2024-05-26 13:42:39 +10:00 committed by Connor McLaughlin
parent e863da9490
commit 94bd7c96b9
1 changed files with 4 additions and 1 deletions

View File

@ -2872,7 +2872,7 @@ bool GSTextureCache::CopyRGBFromDepthToColor(Target* dst, Target* depth_src)
dst->m_TEX0.TBP0, psm_str(dst->m_TEX0.PSM));
// The depth target might be larger (Driv3r).
const GSVector2i new_size = depth_src->GetUnscaledSize().max(dst->GetUnscaledSize());
const GSVector2i new_size = dst->GetUnscaledSize().max(GSVector2i(depth_src->m_valid.z, depth_src->m_valid.w));
const GSVector2i new_scaled_size = ScaleRenderTargetSize(new_size, dst->GetScale());
const bool needs_new_tex = (new_size != dst->m_unscaled_size);
GSTexture* tex = dst->m_texture;
@ -2884,6 +2884,9 @@ bool GSTextureCache::CopyRGBFromDepthToColor(Target* dst, Target* depth_src)
return false;
m_target_memory_usage = (m_target_memory_usage - dst->m_texture->GetMemUsage()) + tex->GetMemUsage();
// Inject new size into hash cache to avoid future resizes.
GetTargetSize(dst->m_TEX0.TBP0, dst->m_TEX0.TBW, dst->m_TEX0.PSM, new_size.x, new_size.y);
}
// Remove any dirty rectangles contained by this update, we don't want to pull from local memory.