mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Improve readback-avoiding CLUT heuristics
Use target overlap instead of exact match.
This commit is contained in:
parent
4ef69248d0
commit
a9d693e1c3
|
@ -5241,12 +5241,12 @@ GSRendererHW::CLUTDrawTestResult GSRendererHW::PossibleCLUTDraw()
|
||||||
if (HasEEUpload(r))
|
if (HasEEUpload(r))
|
||||||
return CLUTDrawTestResult::CLUTDrawOnCPU;
|
return CLUTDrawTestResult::CLUTDrawOnCPU;
|
||||||
|
|
||||||
GSTextureCache::Target* tgt = g_texture_cache->GetExactTarget(
|
const GSTextureCache::Target* tgt = g_texture_cache->FindOverlappingTarget(
|
||||||
m_cached_ctx.TEX0.TBP0, m_cached_ctx.TEX0.TBW, GSTextureCache::RenderTarget, m_cached_ctx.TEX0.TBP0);
|
m_cached_ctx.TEX0.TBP0, m_cached_ctx.TEX0.TBW, m_cached_ctx.TEX0.PSM, r);
|
||||||
if (tgt)
|
if (tgt)
|
||||||
{
|
{
|
||||||
bool is_dirty = false;
|
bool is_dirty = false;
|
||||||
for (GSDirtyRect& rc : tgt->m_dirty)
|
for (const GSDirtyRect& rc : tgt->m_dirty)
|
||||||
{
|
{
|
||||||
if (!rc.GetDirtyRect(m_cached_ctx.TEX0).rintersect(r).rempty())
|
if (!rc.GetDirtyRect(m_cached_ctx.TEX0).rintersect(r).rempty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -3339,6 +3339,26 @@ GSTextureCache::Target* GSTextureCache::GetTargetWithSharedBits(u32 BP, u32 PSM)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GSTextureCache::Target* GSTextureCache::FindOverlappingTarget(u32 BP, u32 end_bp) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
for (Target* tgt : m_dst[i])
|
||||||
|
{
|
||||||
|
if (CheckOverlap(tgt->m_TEX0.TBP0, tgt->m_end_block, BP, end_bp))
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
GSTextureCache::Target* GSTextureCache::FindOverlappingTarget(u32 BP, u32 BW, u32 PSM, GSVector4i rc) const
|
||||||
|
{
|
||||||
|
const u32 end_bp = GSLocalMemory::GetUnwrappedEndBlockAddress(BP, BW, PSM, rc);
|
||||||
|
return FindOverlappingTarget(BP, end_bp);
|
||||||
|
}
|
||||||
|
|
||||||
GSVector2i GSTextureCache::GetTargetSize(u32 bp, u32 fbw, u32 psm, s32 min_width, s32 min_height)
|
GSVector2i GSTextureCache::GetTargetSize(u32 bp, u32 fbw, u32 psm, s32 min_width, s32 min_height)
|
||||||
{
|
{
|
||||||
TargetHeightElem search = {};
|
TargetHeightElem search = {};
|
||||||
|
|
|
@ -488,6 +488,8 @@ public:
|
||||||
/// Looks up a target in the cache, and only returns it if the BP/BW match exactly.
|
/// Looks up a target in the cache, and only returns it if the BP/BW match exactly.
|
||||||
Target* GetExactTarget(u32 BP, u32 BW, int type, u32 end_bp);
|
Target* GetExactTarget(u32 BP, u32 BW, int type, u32 end_bp);
|
||||||
Target* GetTargetWithSharedBits(u32 BP, u32 PSM) const;
|
Target* GetTargetWithSharedBits(u32 BP, u32 PSM) const;
|
||||||
|
Target* FindOverlappingTarget(u32 BP, u32 end_bp) const;
|
||||||
|
Target* FindOverlappingTarget(u32 BP, u32 BW, u32 PSM, GSVector4i rc) const;
|
||||||
|
|
||||||
GSVector2i GetTargetSize(u32 bp, u32 fbw, u32 psm, s32 min_width, s32 min_height);
|
GSVector2i GetTargetSize(u32 bp, u32 fbw, u32 psm, s32 min_width, s32 min_height);
|
||||||
bool Has32BitTarget(u32 bp);
|
bool Has32BitTarget(u32 bp);
|
||||||
|
|
Loading…
Reference in New Issue