mirror of https://github.com/PCSX2/pcsx2.git
GS-HW: Check for CLUT upload before invalidating or running on GPU.
Clean up some preload code and improve the detection.
This commit is contained in:
parent
8ac21357c3
commit
4c7ad66bd7
|
@ -209,6 +209,7 @@ void GSRendererHW::VSync(u32 field, bool registers_written)
|
||||||
else
|
else
|
||||||
m_force_preload = false;
|
m_force_preload = false;
|
||||||
|
|
||||||
|
m_draw_transfers.clear();
|
||||||
|
|
||||||
if (GSConfig.LoadTextureReplacements)
|
if (GSConfig.LoadTextureReplacements)
|
||||||
GSTextureReplacements::ProcessAsyncLoadedTextures();
|
GSTextureReplacements::ProcessAsyncLoadedTextures();
|
||||||
|
@ -4002,6 +4003,12 @@ GSRendererHW::CLUTDrawTestResult GSRendererHW::PossibleCLUTDraw()
|
||||||
// If we have GPU CLUT enabled, don't do a CPU draw when it would result in a download.
|
// If we have GPU CLUT enabled, don't do a CPU draw when it would result in a download.
|
||||||
if (GSConfig.UserHacks_GPUTargetCLUTMode != GSGPUTargetCLUTMode::Disabled)
|
if (GSConfig.UserHacks_GPUTargetCLUTMode != GSGPUTargetCLUTMode::Disabled)
|
||||||
{
|
{
|
||||||
|
for (auto upload : m_draw_transfers)
|
||||||
|
{
|
||||||
|
if (upload.DBP == m_context->TEX0.TBP0 && GSUtil::HasSharedBits(upload.DPSM, m_context->TEX0.PSM))
|
||||||
|
return CLUTDrawTestResult::CLUTDrawOnCPU;
|
||||||
|
}
|
||||||
|
|
||||||
GSTextureCache::Target* tgt = m_tc->GetExactTarget(m_context->TEX0.TBP0, m_context->TEX0.TBW, m_context->TEX0.PSM);
|
GSTextureCache::Target* tgt = m_tc->GetExactTarget(m_context->TEX0.TBP0, m_context->TEX0.TBW, m_context->TEX0.PSM);
|
||||||
if (tgt)
|
if (tgt)
|
||||||
{
|
{
|
||||||
|
@ -4021,6 +4028,14 @@ GSRendererHW::CLUTDrawTestResult GSRendererHW::PossibleCLUTDraw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (auto upload : m_draw_transfers)
|
||||||
|
{
|
||||||
|
if (upload.DBP == m_context->TEX0.TBP0 && GSUtil::HasSharedBits(upload.DPSM, m_context->TEX0.PSM))
|
||||||
|
return CLUTDrawTestResult::CLUTDrawOnCPU;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GIFRegBITBLTBUF BITBLTBUF = {};
|
GIFRegBITBLTBUF BITBLTBUF = {};
|
||||||
BITBLTBUF.SBP = m_context->TEX0.TBP0;
|
BITBLTBUF.SBP = m_context->TEX0.TBP0;
|
||||||
|
|
|
@ -706,12 +706,9 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
|
||||||
{
|
{
|
||||||
if (!is_frame && !forced_preload)
|
if (!is_frame && !forced_preload)
|
||||||
{
|
{
|
||||||
// Check for an EE transfer that matches our RT.
|
for (auto transfer : static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers)
|
||||||
while (static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.size() > 0)
|
|
||||||
{
|
{
|
||||||
const GIFRegBITBLTBUF* transfer = &static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.front();
|
if (transfer.DBP == TEX0.TBP0 && GSUtil::HasSharedBits(transfer.DPSM, TEX0.PSM))
|
||||||
|
|
||||||
if (transfer->DBP == TEX0.TBP0 && GSUtil::HasSharedBits(transfer->DPSM, TEX0.PSM))
|
|
||||||
{
|
{
|
||||||
GL_INS("Preloading the RT DATA");
|
GL_INS("Preloading the RT DATA");
|
||||||
const GSVector4i newrect = GSVector4i(0, 0, real_w, real_h);
|
const GSVector4i newrect = GSVector4i(0, 0, real_w, real_h);
|
||||||
|
@ -719,7 +716,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
|
||||||
dst->Update(true);
|
dst->Update(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.pop_front();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -729,7 +725,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, con
|
||||||
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW);
|
AddDirtyRectTarget(dst, newrect, TEX0.PSM, TEX0.TBW);
|
||||||
dst->Update(true);
|
dst->Update(true);
|
||||||
}
|
}
|
||||||
static_cast<GSRendererHW*>(g_gs_renderer.get())->m_draw_transfers.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (used)
|
if (used)
|
||||||
|
|
Loading…
Reference in New Issue