gsdx tc: store a hint on the target size

The hint is based on the rendering
This commit is contained in:
Gregory Hainaut 2016-03-06 14:24:20 +01:00
parent 8ee9295f39
commit 9aea76b0e8
3 changed files with 19 additions and 4 deletions

View File

@ -579,7 +579,8 @@ void GSRendererHW::Draw()
if(fm != 0xffffffff && rt) if(fm != 0xffffffff && rt)
{ {
rt->m_valid = rt->m_valid.runion(r); //rt->m_valid = rt->m_valid.runion(r);
rt->UpdateValidity(r);
m_tc->InvalidateVideoMem(context->offset.fb, r, false); m_tc->InvalidateVideoMem(context->offset.fb, r, false);
@ -588,7 +589,8 @@ void GSRendererHW::Draw()
if(zm != 0xffffffff && ds) if(zm != 0xffffffff && ds)
{ {
ds->m_valid = ds->m_valid.runion(r); //ds->m_valid = ds->m_valid.runion(r);
ds->UpdateValidity(r);
m_tc->InvalidateVideoMem(context->offset.zb, r, false); m_tc->InvalidateVideoMem(context->offset.zb, r, false);

View File

@ -424,7 +424,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
{ {
dst = t; dst = t;
GL_CACHE("TC: Lookup Frame %dx%d, perfect hit: %d (0x%x)", w, h, dst->m_texture->GetID(), bp); GL_CACHE("TC: Lookup Frame %dx%d, perfect hit: %d (0x%x -> 0x%x)", w, h, dst->m_texture->GetID(), bp, t->m_end_block);
break; break;
} }
@ -434,7 +434,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
if(t->m_TEX0.TBP0 <= bp && bp < t->m_TEX0.TBP0 + 0xe00UL && (!dst || t->m_TEX0.TBP0 >= dst->m_TEX0.TBP0)) if(t->m_TEX0.TBP0 <= bp && bp < t->m_TEX0.TBP0 + 0xe00UL && (!dst || t->m_TEX0.TBP0 >= dst->m_TEX0.TBP0))
{ {
GL_CACHE("TC: Lookup Frame %dx%d, close hit: %d (0x%x, took 0x%x)", w, h, t->m_texture->GetID(), bp, t->m_TEX0.TBP0); GL_CACHE("TC: Lookup Frame %dx%d, close hit: %d (0x%x, took 0x%x -> 0x%x)", w, h, t->m_texture->GetID(), bp, t->m_TEX0.TBP0, t->m_end_block);
dst = t; dst = t;
} }
} }
@ -1615,6 +1615,16 @@ void GSTextureCache::Target::Update()
m_renderer->m_dev->Recycle(t); m_renderer->m_dev->Recycle(t);
} }
void GSTextureCache::Target::UpdateValidity(const GSVector4i& r)
{
m_valid = m_valid.runion(r);
// TODO: assumption: format is 32 bits
uint32 nb_block = m_TEX0.TBW * m_valid.height();
m_end_block = m_TEX0.TBP0 + nb_block;
//fprintf(stderr, "S: 0x%x E:0x%x\n", m_TEX0.TBP0, m_end_block);
}
// GSTextureCache::SourceMap // GSTextureCache::SourceMap
void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* off) void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* off)

View File

@ -83,10 +83,13 @@ public:
GSVector4i m_valid; GSVector4i m_valid;
bool m_depth_supported; bool m_depth_supported;
bool m_dirty_alpha; bool m_dirty_alpha;
uint32 m_end_block; // Hint of the target area
public: public:
Target(GSRenderer* r, const GIFRegTEX0& TEX0, uint8* temp, bool depth_supported); Target(GSRenderer* r, const GIFRegTEX0& TEX0, uint8* temp, bool depth_supported);
void UpdateValidity(const GSVector4i& r);
virtual void Update(); virtual void Update();
}; };