mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Use valid rect over size in CopyRGBFromDepthToColor()
Avoids a copy.
This commit is contained in:
parent
e863da9490
commit
94bd7c96b9
|
@ -2872,7 +2872,7 @@ bool GSTextureCache::CopyRGBFromDepthToColor(Target* dst, Target* depth_src)
|
||||||
dst->m_TEX0.TBP0, psm_str(dst->m_TEX0.PSM));
|
dst->m_TEX0.TBP0, psm_str(dst->m_TEX0.PSM));
|
||||||
|
|
||||||
// The depth target might be larger (Driv3r).
|
// 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 GSVector2i new_scaled_size = ScaleRenderTargetSize(new_size, dst->GetScale());
|
||||||
const bool needs_new_tex = (new_size != dst->m_unscaled_size);
|
const bool needs_new_tex = (new_size != dst->m_unscaled_size);
|
||||||
GSTexture* tex = dst->m_texture;
|
GSTexture* tex = dst->m_texture;
|
||||||
|
@ -2884,6 +2884,9 @@ bool GSTextureCache::CopyRGBFromDepthToColor(Target* dst, Target* depth_src)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_target_memory_usage = (m_target_memory_usage - dst->m_texture->GetMemUsage()) + tex->GetMemUsage();
|
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.
|
// Remove any dirty rectangles contained by this update, we don't want to pull from local memory.
|
||||||
|
|
Loading…
Reference in New Issue