GSdx: fixed a crashing in the previous revision, dx9 slowdown problems will be addressed later

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1440 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2009-06-27 19:05:36 +00:00
parent 7bb9a3cc25
commit 8abcc6dab2
2 changed files with 25 additions and 16 deletions

View File

@ -562,7 +562,7 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
if(right < x) if(right < x)
{ {
Write(GSVector4i(left, y, right, y + s.y).rintersect(tr), buff, pitch); Write(GSVector4i(left, y, right, y + s.y), tr, buff, pitch);
left = right = x; left = right = x;
} }
@ -576,7 +576,7 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
if(left < right) if(left < right)
{ {
Write(GSVector4i(left, y, right, y + s.y).rintersect(tr), buff, pitch); Write(GSVector4i(left, y, right, y + s.y), tr, buff, pitch);
} }
} }
} }
@ -607,7 +607,7 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
{ {
if(right < x) if(right < x)
{ {
Write(GSVector4i(left, y, right, y + s.y).rintersect(tr), buff, pitch); Write(GSVector4i(left, y, right, y + s.y), tr, buff, pitch);
left = right = x; left = right = x;
} }
@ -621,7 +621,7 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
if(left < right) if(left < right)
{ {
Write(GSVector4i(left, y, right, y + s.y).rintersect(tr), buff, pitch); Write(GSVector4i(left, y, right, y + s.y), tr, buff, pitch);
} }
} }
@ -649,25 +649,34 @@ void GSTextureCache::Source::Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TE
m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, s.x * s.y * sizeof(uint32) * blocks); m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, s.x * s.y * sizeof(uint32) * blocks);
} }
void GSTextureCache::Source::Write(const GSVector4i& r, uint8* buff, int pitch) void GSTextureCache::Source::Write(const GSVector4i& r, const GSVector4i& tr, uint8* buff, int pitch)
{ {
if(r.rempty()) return; if(r.rempty()) return;
GSLocalMemory::readTexture rtx = GSLocalMemory::m_psm[m_TEX0.PSM].rtx; GSLocalMemory::readTexture rtx = GSLocalMemory::m_psm[m_TEX0.PSM].rtx;
GSTexture::GSMap m; if((r > tr).mask() & 0xff00)
if(m_texture->Map(m, &r))
{
(m_renderer->m_mem.*rtx)(r, m.bits, m.pitch, m_TEX0, m_TEXA);
m_texture->Unmap();
}
else
{ {
(m_renderer->m_mem.*rtx)(r, buff, pitch, m_TEX0, m_TEXA); (m_renderer->m_mem.*rtx)(r, buff, pitch, m_TEX0, m_TEXA);
m_texture->Update(r, buff, pitch); m_texture->Update(r.rintersect(tr), buff, pitch);
}
else
{
GSTexture::GSMap m;
if(m_texture->Map(m, &r))
{
(m_renderer->m_mem.*rtx)(r, m.bits, m.pitch, m_TEX0, m_TEXA);
m_texture->Unmap();
}
else
{
(m_renderer->m_mem.*rtx)(r, buff, pitch, m_TEX0, m_TEXA);
m_texture->Update(r, buff, pitch);
}
} }
} }

View File

@ -67,7 +67,7 @@ public:
virtual bool Create(Target* dst) = 0; virtual bool Create(Target* dst) = 0;
virtual void Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& rect); virtual void Update(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& rect);
void Write(const GSVector4i& r, uint8* buff, int pitch); void Write(const GSVector4i& r, const GSVector4i& tr, uint8* buff, int pitch);
}; };
class Target : public Surface class Target : public Surface