mirror of https://github.com/PCSX2/pcsx2.git
gsdx-tc: allow to reuse the right part of large RT as source
This commit is contained in:
parent
7ac533a4d1
commit
e5326d1bd2
|
@ -92,6 +92,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||
}
|
||||
|
||||
Target* dst = NULL;
|
||||
bool half_right = false;
|
||||
|
||||
#ifdef DISABLE_HW_TEXTURE_CACHE
|
||||
if( 0 )
|
||||
|
@ -115,11 +116,20 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||
{
|
||||
Target* t = *i;
|
||||
|
||||
if(t->m_used && t->m_dirty.empty() && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM))
|
||||
{
|
||||
dst = t;
|
||||
if(t->m_used && t->m_dirty.empty()) {
|
||||
if (GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0, t->m_TEX0.PSM)) {
|
||||
dst = t;
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
} else if ((t->m_TEX0.TBW == 20) && (t->m_TEX0.PSM == 2) && GSUtil::HasSharedBits(bp, psm, t->m_TEX0.TBP0 + 0x140, t->m_TEX0.PSM)) {
|
||||
// try to detect render target bigger than 1024 Texels
|
||||
|
||||
half_right = true;
|
||||
dst = t;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +146,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
|
|||
GL_CACHE("TC: src miss (0x%x)", TEX0.TBP0);
|
||||
}
|
||||
#endif
|
||||
src = CreateSource(TEX0, TEXA, dst);
|
||||
src = CreateSource(TEX0, TEXA, dst, half_right);
|
||||
|
||||
if(src == NULL)
|
||||
{
|
||||
|
@ -631,7 +641,7 @@ void GSTextureCache::IncAge()
|
|||
}
|
||||
|
||||
//Fixme: Several issues in here. Not handling depth stencil, pitch conversion doesnt work.
|
||||
GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* dst)
|
||||
GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* dst, bool half_right)
|
||||
{
|
||||
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM];
|
||||
Source* src = new Source(m_renderer, TEX0, TEXA, m_temp);
|
||||
|
@ -788,13 +798,22 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
|
||||
if((sRect == dRect).alltrue())
|
||||
{
|
||||
m_renderer->m_dev->CopyRect(sTex, dTex, GSVector4i(0, 0, w, h));
|
||||
// Note: use dstsize.x instead of w because w is limited to 1024 whereas dstsize.x could
|
||||
// be bigger (1280 for snow engine games)
|
||||
if (half_right)
|
||||
m_renderer->m_dev->CopyRect(sTex, dTex, GSVector4i(dstsize.x/2, 0, dstsize.x, h));
|
||||
else
|
||||
m_renderer->m_dev->CopyRect(sTex, dTex, GSVector4i(0, 0, w, h)); // <= likely wrong dstsize.x could be bigger than w
|
||||
}
|
||||
else
|
||||
{
|
||||
sRect.z /= sTex->GetWidth();
|
||||
sRect.w /= sTex->GetHeight();
|
||||
|
||||
if (half_right) {
|
||||
sRect.x = sRect.z/2.0f;
|
||||
}
|
||||
|
||||
m_renderer->m_dev->StretchRect(sTex, sRect, dTex, dRect, 0, linear);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ protected:
|
|||
int m_spritehack;
|
||||
uint8* m_temp;
|
||||
|
||||
virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL);
|
||||
virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false);
|
||||
virtual Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type);
|
||||
|
||||
virtual int Get8bitFormat() = 0;
|
||||
|
|
Loading…
Reference in New Issue