GS: Remove ExpandTarget on EE Write

This commit is contained in:
refractionpcsx2 2023-03-19 16:03:19 +00:00
parent 443cc08229
commit db22377a0d
8 changed files with 0 additions and 69 deletions

View File

@ -1512,7 +1512,6 @@ void GSState::FlushWrite()
r.top = m_env.TRXPOS.DSAY; r.top = m_env.TRXPOS.DSAY;
r.right = r.left + m_env.TRXREG.RRW; r.right = r.left + m_env.TRXREG.RRW;
r.bottom = r.top + m_env.TRXREG.RRH; r.bottom = r.top + m_env.TRXREG.RRH;
ExpandTarget(m_env.BITBLTBUF, r);
InvalidateVideoMem(m_env.BITBLTBUF, r, true); InvalidateVideoMem(m_env.BITBLTBUF, r, true);
const GSLocalMemory::writeImage wi = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM].wi; const GSLocalMemory::writeImage wi = GSLocalMemory::m_psm[m_env.BITBLTBUF.DPSM].wi;
@ -1789,7 +1788,6 @@ void GSState::Write(const u8* mem, int len)
if (m_tr.end == 0 && len >= m_tr.total) if (m_tr.end == 0 && len >= m_tr.total)
{ {
// received all data in one piece, no need to buffer it // received all data in one piece, no need to buffer it
ExpandTarget(m_env.BITBLTBUF, r);
InvalidateVideoMem(blit, r, true); InvalidateVideoMem(blit, r, true);
psm.wi(m_mem, m_tr.x, m_tr.y, mem, m_tr.total, blit, m_env.TRXPOS, m_env.TRXREG); psm.wi(m_mem, m_tr.x, m_tr.y, mem, m_tr.total, blit, m_env.TRXPOS, m_env.TRXREG);

View File

@ -891,7 +891,6 @@ public:
virtual void ReadbackTextureCache(); virtual void ReadbackTextureCache();
virtual void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) {} virtual void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) {}
virtual void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) {} virtual void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) {}
virtual void ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) {}
virtual void Move(); virtual void Move();

View File

@ -923,11 +923,6 @@ GSVector4i GSRendererHW::GetSplitTextureShuffleDrawRect() const
return r.insert64<0>(0).ralign<Align_Outside>(frame_psm.pgs); return r.insert64<0>(0).ralign<Align_Outside>(frame_psm.pgs);
} }
void GSRendererHW::ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r)
{
m_tc->ExpandTarget(BITBLTBUF, r);
}
void GSRendererHW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite) void GSRendererHW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite)
{ {
// printf("[%d] InvalidateVideoMem %d,%d - %d,%d %05x (%d)\n", static_cast<int>(g_perfmon.GetFrame()), r.left, r.top, r.right, r.bottom, static_cast<int>(BITBLTBUF.DBP), static_cast<int>(BITBLTBUF.DPSM)); // printf("[%d] InvalidateVideoMem %d,%d - %d,%d %05x (%d)\n", static_cast<int>(g_perfmon.GetFrame()), r.left, r.top, r.right, r.bottom, static_cast<int>(BITBLTBUF.DBP), static_cast<int>(BITBLTBUF.DPSM));

View File

@ -167,7 +167,6 @@ public:
GSTexture* GetOutput(int i, float& scale, int& y_offset) override; GSTexture* GetOutput(int i, float& scale, int& y_offset) override;
GSTexture* GetFeedbackOutput(float& scale) override; GSTexture* GetFeedbackOutput(float& scale) override;
void ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) override;
void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) override; void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) override;
void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) override; void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) override;
void Move() override; void Move() override;

View File

@ -1554,62 +1554,6 @@ bool GSTextureCache::PrepareDownloadTexture(u32 width, u32 height, GSTexture::Fo
return true; return true;
} }
// Expands targets where the write from the EE overlaps the edge of a render target and uses the same base pointer.
void GSTextureCache::ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r)
{
GIFRegTEX0 TEX0;
TEX0.TBP0 = BITBLTBUF.DBP;
TEX0.TBW = BITBLTBUF.DBW;
TEX0.PSM = BITBLTBUF.DPSM;
Target* dst = nullptr;
auto& list = m_dst[RenderTarget];
RGBAMask rgba;
rgba._u32 = GSUtil::GetChannelMask(TEX0.PSM);
for (auto i = list.begin(); i != list.end(); ++i)
{
Target* t = *i;
if (TEX0.TBP0 == t->m_TEX0.TBP0 && GSLocalMemory::m_psm[TEX0.PSM].bpp == GSLocalMemory::m_psm[t->m_TEX0.PSM].bpp && t->Overlaps(TEX0.TBP0, TEX0.TBW, TEX0.PSM, r))
{
list.MoveFront(i.Index());
dst = t;
break;
}
}
if (!dst)
return;
// Only expand the target when the FBW matches. Otherwise, games like GT4 will end up with the main render target
// being 2000+ due to unrelated EE writes.
if (TEX0.TBW == dst->m_TEX0.TBW)
{
// Round up to the nearest even height, like the draw target allocator.
const s32 aligned_height = Common::AlignUpPow2(r.w, 2);
if (r.z > dst->m_unscaled_size.x || aligned_height > dst->m_unscaled_size.y)
{
// We don't recycle here, because most of the time when this happens it's strange-sized textures
// which are being expanded one-line-at-a-time.
if (dst->ResizeTexture(std::max(r.z, dst->m_unscaled_size.x),
std::max(aligned_height, dst->m_unscaled_size.y), false))
{
AddDirtyRectTarget(dst, r, TEX0.PSM, TEX0.TBW, rgba);
GetTargetHeight(TEX0.TBP0, TEX0.TBW, TEX0.PSM, aligned_height);
dst->UpdateValidity(r);
dst->UpdateValidBits(GSLocalMemory::m_psm[TEX0.PSM].fmsk);
}
}
}
else
{
const GSVector4i clamped_r(r.rintersect(dst->GetUnscaledRect()));
AddDirtyRectTarget(dst, clamped_r, TEX0.PSM, TEX0.TBW, rgba);
dst->UpdateValidity(clamped_r);
dst->UpdateValidBits(GSLocalMemory::m_psm[TEX0.PSM].fmsk);
}
}
// Goal: Depth And Target at the same address is not possible. On GS it is // Goal: Depth And Target at the same address is not possible. On GS it is
// the same memory but not on the Dx/GL. Therefore a write to the Depth/Target // the same memory but not on the Dx/GL. Therefore a write to the Depth/Target
// must invalidate the Target/Depth respectively // must invalidate the Target/Depth respectively

View File

@ -444,7 +444,6 @@ public:
u32 GetTargetHeight(u32 fbp, u32 fbw, u32 psm, u32 min_height); u32 GetTargetHeight(u32 fbp, u32 fbw, u32 psm, u32 min_height);
bool Has32BitTarget(u32 bp); bool Has32BitTarget(u32 bp);
void ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r);
void InvalidateVideoMemType(int type, u32 bp); void InvalidateVideoMemType(int type, u32 bp);
void InvalidateVideoMemSubTarget(GSTextureCache::Target* rt); void InvalidateVideoMemSubTarget(GSTextureCache::Target* rt);
void InvalidateVideoMem(const GSOffset& off, const GSVector4i& r, bool eewrite = false, bool target = true); void InvalidateVideoMem(const GSOffset& off, const GSVector4i& r, bool eewrite = false, bool target = true);

View File

@ -617,8 +617,6 @@ void GSRendererSW::Sync(int reason)
g_perfmon.Put(GSPerfMon::Fillrate, pixels); g_perfmon.Put(GSPerfMon::Fillrate, pixels);
} }
void GSRendererSW::ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) {}
void GSRendererSW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite) void GSRendererSW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite)
{ {
if (LOG) if (LOG)

View File

@ -78,7 +78,6 @@ protected:
void Draw() override; void Draw() override;
void Queue(GSRingHeap::SharedPtr<GSRasterizerData>& item); void Queue(GSRingHeap::SharedPtr<GSRasterizerData>& item);
void Sync(int reason); void Sync(int reason);
void ExpandTarget(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) override;
void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) override; void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool eewrite = false) override;
void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) override; void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) override;