- Reduced the overhead of the new scaler. Instead of just using 1024*1024 blindly, it tries to adapt to games native resolutions.
- Yet another change to IncAge(), since it seems to be (mis)used to do texture invalidation. (Fixes Disgaea 2 when booting through the BIOS)
- Added some comments

Note: 
Before working on the texture cache GetDisplayRect(),GetFrameRect() and GetDeviceSize() really need fixing. It's useless to try and find surfaces when not knowing the real size of things.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2174 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2009-11-10 11:38:32 +00:00
parent 2685f25694
commit efdeabd865
3 changed files with 67 additions and 20 deletions

View File

@ -495,6 +495,27 @@ protected:
TEX0.PSM = DISPFB.PSM;
// TRACE(_T("[%d] GetOutput %d %05x (%d)\n"), (int)m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM);
//This routine ups m_width and m_height globally, should games have a bigger native res than the startup values
//(currently 640*512, because of some unknown yet problem with smaller sizes)
int multiplier = upscale_Multiplier();
if (multiplier > 1)
{
int testh = GetDisplayRect().height() * multiplier;
//on startup testh and testw are 1 for a while (invalid)
if ((testh > m_height) && testh != 1) {
m_height=testh;
//printf("changed height > %d\n", m_height );
}
else if (testh == 1)return NULL;
int testw = GetDisplayRect().width() * multiplier;
if ((testw > m_width) && testw != 1 ) {
m_width=testw;
//printf("changed width > %d\n", m_width );
}
else if (testw == 1)return NULL;
}
GSTexture* t = NULL;
@ -533,7 +554,28 @@ protected:
void Draw()
{
if(IsBadFrame(m_skip, m_gamefix_skipdraw)) return;
//This routine ups m_width and m_height globally, should games have a bigger native res than the startup values
//(currently 640*512, because of some unknown yet problem with smaller sizes)
int multiplier = upscale_Multiplier();
if (multiplier > 1)
{
int testh = GetDisplayRect().height() * multiplier;
//on startup testh and testw are 1 for a while (invalid)
if ((testh > m_height) && testh != 1) {
m_height=testh*multiplier;
//printf("changed height > %d\n", m_height );
}
else if (testh == 1)return;
int testw = GetDisplayRect().width() * multiplier;
if ((testw > m_width) && testw != 1 ) {
m_width=testw;
//printf("changed width > %d\n", m_width );
}
else if (testw == 1)return;
}
GSDrawingEnvironment& env = m_env;
GSDrawingContext* context = m_context;
@ -724,8 +766,8 @@ public:
if (m_upscale_multiplier > 4) m_upscale_multiplier = 1; //use the normal upscale math
if (m_upscale_multiplier > 1)
{
m_width = 1024 * m_upscale_multiplier;
m_height = 1024 * m_upscale_multiplier;
m_width = 640 * m_upscale_multiplier; //512 is also common, but this is not always detected right.
m_height = 512 * m_upscale_multiplier; //448 is also common, but this is not always detected right.
}
}
m_gamefix_skipdraw = theApp.GetConfig("gamefix_skipdraw", m_gamefix_skipdraw);
@ -747,4 +789,4 @@ public:
m_width = 1280; // TODO: uses a 1280px wide 16 bit render target, but this only fixes half of the problem
}
}
};
};

View File

@ -254,6 +254,7 @@ GSVector4i GSState::GetFrameRect(int i)
if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD && h > 1) h >>= 1;
//Breaks Disgaea2 FMV borders, causes blur in dragon quest 8
r.left = m_regs->DISP[i].DISPFB.DBX;
r.top = m_regs->DISP[i].DISPFB.DBY;
r.right = r.left + w;

View File

@ -190,6 +190,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
hh *= 2;
}
//This vp2 fix doesn't work most of the time
if(hh < 512 && m_renderer->m_context->SCISSOR.SCAY1 == 511) // vp2
{
hh = 512;
@ -470,25 +471,28 @@ void GSTextureCache::IncAge()
m_src.m_used = false;
// Clearing of Rendertargets causes flickering in many scene transitions, so let's not :p
//maxage = 4; // ffx intro scene changes leave the old image untouched for a couple of frames and only then start using it
// Clearing of Rendertargets causes flickering in many scene transitions.
// Sigh, this seems to be used to invalidate surfaces. So set a huge maxage to avoid flicker,
// but still invalidate surfaces. (Disgaea 2 fmv when booting the game through the BIOS)
// Original maxage was 4 here, Xenosaga 2 needs at least 240, else it flickers on scene transitions.
maxage = 400; // ffx intro scene changes leave the old image untouched for a couple of frames and only then start using it
//for(int type = 0; type < 2; type++)
//{
// for(list<Target*>::iterator i = m_dst[type].begin(); i != m_dst[type].end(); )
// {
// list<Target*>::iterator j = i++;
for(int type = 0; type < 2; type++)
{
for(list<Target*>::iterator i = m_dst[type].begin(); i != m_dst[type].end(); )
{
list<Target*>::iterator j = i++;
// Target* t = *j;
Target* t = *j;
// if(++t->m_age > maxage)
// {
// m_dst[type].erase(j);
if(++t->m_age > maxage)
{
m_dst[type].erase(j);
// delete t;
// }
// }
//}
delete t;
}
}
}
}
//Fixme: Several issues in here. Not handling depth stencil, pitch conversion doesnt work.
@ -1419,4 +1423,4 @@ void GSTextureCache::SourceMap::RemoveAt(Source* s)
}
delete s;
}
}