GSDX: Committing pointless extra work for the record before reverting. Everything is terrible.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5548 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2013-02-08 15:35:28 +00:00
parent 5988c70822
commit 23cd8fd641
7 changed files with 102 additions and 107 deletions

View File

@ -172,14 +172,14 @@ template<int n> void GSClut::WriteCLUT32_CSM2(const GIFRegTEX0& TEX0, const GIFR
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT32);
uint32* RESTRICT s = &m_mem->m_vm32[o->pixel.row[TEXCLUT.COV]];
uint32 addr = o->pixel.row[TEXCLUT.COV];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + (TEX0.CSA << 4);
for(int i = 0; i < n; i++)
{
uint32 c = s[col[i]];
uint32 c = m_mem->ReadPixel32(addr + col[i]);
clut[i] = (uint16)(c & 0xffff);
clut[i + 256] = (uint16)(c >> 16);
@ -190,14 +190,14 @@ template<int n> void GSClut::WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFR
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16);
uint16* RESTRICT s = &m_mem->m_vm16[o->pixel.row[TEXCLUT.COV]];
uint32 addr = o->pixel.row[TEXCLUT.COV];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + (TEX0.CSA << 4);
for(int i = 0; i < n; i++)
{
clut[i] = s[col[i]];
clut[i] = (uint16)m_mem->ReadPixel16(addr + col[i]);
}
}
@ -205,14 +205,14 @@ template<int n> void GSClut::WriteCLUT16S_CSM2(const GIFRegTEX0& TEX0, const GIF
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16S);
uint16* RESTRICT s = &m_mem->m_vm16[o->pixel.row[TEXCLUT.COV]];
uint32 addr = o->pixel.row[TEXCLUT.COV];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + (TEX0.CSA << 4);
for(int i = 0; i < n; i++)
{
clut[i] = s[col[i]];
clut[i] = (uint16)m_mem->ReadPixel16(addr + col[i]);
}
}

View File

@ -83,9 +83,11 @@ GSLocalMemory::psm_t GSLocalMemory::m_psm[64];
GSLocalMemory::GSLocalMemory()
: m_clut(this)
{
m_vm8 = (uint8*)vmalloc(m_vmsize * 2, false);
m_vm8 = (uint8*)vmalloc(m_vmsize * 16, false);
m_vm16 = (uint16*)m_vm8;
m_vm32 = (uint32*)m_vm8;
DWORD oldprotect;
VirtualProtect(m_vm8 + m_vmsize, m_vmsize * 15, PAGE_NOACCESS, &oldprotect);
memset(m_vm8, 0, m_vmsize);
@ -621,7 +623,7 @@ vector<GSVector2i>* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0)
for(int x = 0, i = y << 7; x < tw; x += bs.x, i += bs.x)
{
uint32 page = (base + o->block.col[x >> 3]) >> 5;
uint32 page = (base + o->block.col[x >> 3]) >> 5 & 511;
if(page < MAX_PAGES)
{
@ -1383,6 +1385,8 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
int sx = (int)TRXPOS.SSAX;
int ex = sx + (int)TRXREG.RRW;
uint32 addr = psm->pa(0, y, bp, bw);
switch(BITBLTBUF.SPSM)
{
case PSM_PSMCT32:
@ -1395,19 +1399,18 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint32* RESTRICT ps = &m_vm32[psm->pa(0, y, bp, bw)];
for(int ex4 = ex - 4; len >= 4 && x <= ex4; len -= 4, x += 4, pd += 4)
{
pd[0] = ps[offset[x + 0]];
pd[1] = ps[offset[x + 1]];
pd[2] = ps[offset[x + 2]];
pd[3] = ps[offset[x + 3]];
pd[0] = ReadPixel32(addr + offset[x + 0]);
pd[1] = ReadPixel32(addr + offset[x + 1]);
pd[2] = ReadPixel32(addr + offset[x + 2]);
pd[3] = ReadPixel32(addr + offset[x + 3]);
}
for(; len > 0 && x < ex; len--, x++, pd++)
{
*pd = ps[offset[x]];
*pd = ReadPixel32(addr + offset[x]);
}
if(x == ex) {x = sx; y++;}
@ -1423,11 +1426,10 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint32* RESTRICT ps = &m_vm32[psm->pa(0, y, bp, bw)];
for(; len > 0 && x < ex; len--, x++, pb += 3)
{
uint32 c = ps[offset[x]];
uint32 c = ReadPixel32(addr + offset[x]);
pb[0] = (uint8)(c);
pb[1] = (uint8)(c >> 8);
@ -1449,19 +1451,18 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint16* RESTRICT ps = &m_vm16[psm->pa(0, y, bp, bw)];
for(int ex4 = ex - 4; len >= 4 && x <= ex4; len -= 4, x += 4, pw += 4)
{
pw[0] = ps[offset[x + 0]];
pw[1] = ps[offset[x + 1]];
pw[2] = ps[offset[x + 2]];
pw[3] = ps[offset[x + 3]];
pw[0] = (uint16)ReadPixel16(addr + offset[x + 0]);
pw[1] = (uint16)ReadPixel16(addr + offset[x + 1]);
pw[2] = (uint16)ReadPixel16(addr + offset[x + 2]);
pw[3] = (uint16)ReadPixel16(addr + offset[x + 3]);
}
for(; len > 0 && x < ex; len--, x++, pw++)
{
*pw = ps[offset[x]];
*pw = (uint16)ReadPixel16(addr + offset[x]);
}
if(x == ex) {x = sx; y++;}
@ -1474,19 +1475,18 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint8* RESTRICT ps = &m_vm8[psm->pa(0, y, bp, bw)];
for(int ex4 = ex - 4; len >= 4 && x <= ex4; len -= 4, x += 4, pb += 4)
{
pb[0] = ps[offset[x + 0]];
pb[1] = ps[offset[x + 1]];
pb[2] = ps[offset[x + 2]];
pb[3] = ps[offset[x + 3]];
pb[0] = (uint8)ReadPixel8(addr + offset[x + 0]);
pb[1] = (uint8)ReadPixel8(addr + offset[x + 1]);
pb[2] = (uint8)ReadPixel8(addr + offset[x + 2]);
pb[3] = (uint8)ReadPixel8(addr + offset[x + 3]);
}
for(; len > 0 && x < ex; len--, x++, pb++)
{
*pb = ps[offset[x]];
*pb = (uint8)ReadPixel8(addr + offset[x]);
}
if(x == ex) {x = sx; y++;}
@ -1498,12 +1498,11 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
uint32 addr = psm->pa(0, y, bp, bw);
int* RESTRICT offset = psm->rowOffset[y & 7];
for(; len > 0 && x < ex; len--, x += 2, pb++)
{
*pb = ReadPixel4(addr + offset[x + 0]) | (ReadPixel4(addr + offset[x + 1]) << 4);
*pb = (uint8)(ReadPixel4(addr + offset[x + 0]) | (ReadPixel4(addr + offset[x + 1]) << 4));
}
if(x == ex) {x = sx; y++;}
@ -1516,19 +1515,18 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint32* RESTRICT ps = &m_vm32[psm->pa(0, y, bp, bw)];
for(int ex4 = ex - 4; len >= 4 && x <= ex4; len -= 4, x += 4, pb += 4)
{
pb[0] = (uint8)(ps[offset[x + 0]] >> 24);
pb[1] = (uint8)(ps[offset[x + 1]] >> 24);
pb[2] = (uint8)(ps[offset[x + 2]] >> 24);
pb[3] = (uint8)(ps[offset[x + 3]] >> 24);
pb[0] = (uint8)ReadPixel8H(addr + offset[x + 0]);
pb[1] = (uint8)ReadPixel8H(addr + offset[x + 1]);
pb[2] = (uint8)ReadPixel8H(addr + offset[x + 2]);
pb[3] = (uint8)ReadPixel8H(addr + offset[x + 3]);
}
for(; len > 0 && x < ex; len--, x++, pb++)
{
*pb = (uint8)(ps[offset[x]] >> 24);
*pb = (uint8)ReadPixel8H(addr + offset[x]);
}
if(x == ex) {x = sx; y++;}
@ -1541,14 +1539,13 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* offset = psm->rowOffset[y & 7];
uint32* RESTRICT ps = &m_vm32[psm->pa(0, y, bp, bw)];
for(; len > 0 && x < ex; len--, x += 2, pb++)
{
uint32 c0 = (ps[offset[x + 0]] >> 24) & 0x0f;
uint32 c1 = (ps[offset[x + 1]] >> 20) & 0xf0;
uint32 c0 = ReadPixel4HL(addr + offset[x + 0]);
uint32 c1 = ReadPixel4HL(addr + offset[x + 1]);
*pb = (uint8)(c0 | c1);
*pb = (uint8)(c0 | c1 << 4);
}
if(x == ex) {x = sx; y++;}
@ -1561,14 +1558,13 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
while(len > 0)
{
int* RESTRICT offset = psm->rowOffset[y & 7];
uint32* RESTRICT ps = &m_vm32[psm->pa(0, y, bp, bw)];
for(; len > 0 && x < ex; len--, x += 2, pb++)
{
uint32 c0 = (ps[offset[x + 0]] >> 28) & 0x0f;
uint32 c1 = (ps[offset[x + 1]] >> 24) & 0xf0;
uint32 c0 = ReadPixel4HH(addr + offset[x + 0]);
uint32 c1 = ReadPixel4HH(addr + offset[x + 1]);
*pb = (uint8)(c0 | c1);
*pb = (uint8)(c0 | c1 << 4);
}
if(x == ex) {x = sx; y++;}
@ -2040,7 +2036,7 @@ uint32* GSOffset::GetPages(const GSVector4i& rect, uint32* pages, GSVector4i* bb
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 n = (base + block.col[x]) >> 5;
uint32 n = (base + block.col[x]) >> 5 & (MAX_PAGES-1);
if(n < MAX_PAGES)
{

View File

@ -230,9 +230,7 @@ public:
uint8* BlockPtr(uint32 bp) const
{
ASSERT(bp < 16384);
return &m_vm8[bp << 8];
return &m_vm8[(bp & MAX_BLOCKS-1) << 8];
}
uint8* BlockPtr32(int x, int y, uint32 bp, uint32 bw) const
@ -387,52 +385,52 @@ public:
__forceinline uint32 ReadPixel32(uint32 addr) const
{
return m_vm32[addr];
return m_vm32[addr & 0xFFFFF];
}
__forceinline uint32 ReadPixel24(uint32 addr) const
{
return m_vm32[addr] & 0x00ffffff;
return m_vm32[addr & 0xFFFFF] & 0x00ffffff;
}
__forceinline uint32 ReadPixel16(uint32 addr) const
{
return (uint32)m_vm16[addr];
return (uint32)m_vm16[addr & 0x1FFFFF];
}
__forceinline uint32 ReadPixel8(uint32 addr) const
{
return (uint32)m_vm8[addr];
return (uint32)m_vm8[addr & 0x3FFFFF];
}
__forceinline uint32 ReadPixel4(uint32 addr) const
{
return (m_vm8[addr >> 1] >> ((addr & 1) << 2)) & 0x0f;
return (m_vm8[addr >> 1 & 0x3FFFFF] >> ((addr & 1) << 2)) & 0x0f;
}
__forceinline uint32 ReadPixel8H(uint32 addr) const
{
return m_vm32[addr] >> 24;
return m_vm32[addr & 0xFFFFF] >> 24;
}
__forceinline uint32 ReadPixel4HL(uint32 addr) const
{
return (m_vm32[addr] >> 24) & 0x0f;
return (m_vm32[addr & 0xFFFFF] >> 24) & 0x0f;
}
__forceinline uint32 ReadPixel4HH(uint32 addr) const
{
return (m_vm32[addr] >> 28) & 0x0f;
return (m_vm32[addr & 0xFFFFF] >> 28) & 0x0f;
}
__forceinline uint32 ReadFrame24(uint32 addr) const
{
return 0x80000000 | (m_vm32[addr] & 0xffffff);
return 0x80000000 | (m_vm32[addr & 0xFFFFF] & 0xffffff);
}
__forceinline uint32 ReadFrame16(uint32 addr) const
{
uint32 c = (uint32)m_vm16[addr];
uint32 c = (uint32)m_vm16[addr & 0x1FFFFF];
return ((c & 0x8000) << 16) | ((c & 0x7c00) << 9) | ((c & 0x03e0) << 6) | ((c & 0x001f) << 3);
}
@ -534,44 +532,44 @@ public:
__forceinline void WritePixel32(uint32 addr, uint32 c)
{
m_vm32[addr] = c;
m_vm32[addr & 0xFFFFF] = c;
}
__forceinline void WritePixel24(uint32 addr, uint32 c)
{
m_vm32[addr] = (m_vm32[addr] & 0xff000000) | (c & 0x00ffffff);
m_vm32[addr & 0xFFFFF] = (m_vm32[addr & 0xFFFFF] & 0xff000000) | (c & 0x00ffffff);
}
__forceinline void WritePixel16(uint32 addr, uint32 c)
{
m_vm16[addr] = (uint16)c;
m_vm16[addr & 0x1FFFFF] = (uint16)c;
}
__forceinline void WritePixel8(uint32 addr, uint32 c)
{
m_vm8[addr] = (uint8)c;
m_vm8[addr & 0x3FFFFF] = (uint8)c;
}
__forceinline void WritePixel4(uint32 addr, uint32 c)
{
int shift = (addr & 1) << 2; addr >>= 1;
m_vm8[addr] = (uint8)((m_vm8[addr] & (0xf0 >> shift)) | ((c & 0x0f) << shift));
m_vm8[addr & 0x3FFFFF] = (uint8)((m_vm8[addr & 0x3FFFFF] & (0xf0 >> shift)) | ((c & 0x0f) << shift));
}
__forceinline void WritePixel8H(uint32 addr, uint32 c)
{
m_vm32[addr] = (m_vm32[addr] & 0x00ffffff) | (c << 24);
m_vm32[addr & 0xFFFFF] = (m_vm32[addr & 0xFFFFF] & 0x00ffffff) | (c << 24);
}
__forceinline void WritePixel4HL(uint32 addr, uint32 c)
{
m_vm32[addr] = (m_vm32[addr] & 0xf0ffffff) | ((c & 0x0f) << 24);
m_vm32[addr & 0xFFFFF] = (m_vm32[addr & 0xFFFFF] & 0xf0ffffff) | ((c & 0x0f) << 24);
}
__forceinline void WritePixel4HH(uint32 addr, uint32 c)
{
m_vm32[addr] = (m_vm32[addr] & 0x0fffffff) | ((c & 0x0f) << 28);
m_vm32[addr & 0xFFFFF] = (m_vm32[addr & 0xFFFFF] & 0x0fffffff) | ((c & 0x0f) << 28);
}
__forceinline void WriteFrame16(uint32 addr, uint32 c)
@ -674,12 +672,12 @@ public:
for(int y = r.top; y < r.bottom; y++, src += pitch)
{
uint32* RESTRICT s = (uint32*)src;
uint32* RESTRICT d = &m_vm32[o->pixel.row[y]];
int d = o->pixel.row[y];
int* RESTRICT col = o->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
d[col[x]] = s[x];
m_vm32[d + col[x] & 0xFFFFF] = s[x];
}
}
}
@ -691,12 +689,12 @@ public:
for(int y = r.top; y < r.bottom; y++, src += pitch)
{
uint32* RESTRICT s = (uint32*)src;
uint32* RESTRICT d = &m_vm32[o->pixel.row[y]];
int d = o->pixel.row[y];
int* RESTRICT col = o->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
d[col[x]] = (d[col[x]] & 0xff000000) | (s[x] & 0x00ffffff);
m_vm32[d + col[x] & 0xFFFFF] = (m_vm32[d + col[x] & 0xFFFFF] & 0xff000000) | (s[x] & 0x00ffffff);
}
}
}
@ -708,12 +706,12 @@ public:
for(int y = r.top; y < r.bottom; y++, src += pitch)
{
uint16* RESTRICT s = (uint16*)src;
uint16* RESTRICT d = &m_vm16[o->pixel.row[y]];
int d = o->pixel.row[y];
int* RESTRICT col = o->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
d[col[x]] = s[x];
m_vm16[d + col[x] & 0x1FFFFF] = s[x];
}
}
}
@ -725,7 +723,7 @@ public:
for(int y = r.top; y < r.bottom; y++, src += pitch)
{
uint32* RESTRICT s = (uint32*)src;
uint16* RESTRICT d = &m_vm16[o->pixel.row[y]];
int d = o->pixel.row[y];
int* RESTRICT col = o->pixel.col[0];
for(int x = r.left; x < r.right; x++)
@ -733,24 +731,24 @@ public:
uint32 rb = s[x] & 0x00f800f8;
uint32 ga = s[x] & 0x8000f800;
d[col[x]] = (uint16)((ga >> 16) | (rb >> 9) | (ga >> 6) | (rb >> 3));
m_vm16[d + col[x] & 0x1FFFFF] = (uint16)((ga >> 16) | (rb >> 9) | (ga >> 6) | (rb >> 3));
}
}
}
__forceinline uint32 ReadTexel32(uint32 addr, const GIFRegTEXA& TEXA) const
{
return m_vm32[addr];
return m_vm32[addr & 0xFFFFF];
}
__forceinline uint32 ReadTexel24(uint32 addr, const GIFRegTEXA& TEXA) const
{
return Expand24To32(m_vm32[addr], TEXA);
return Expand24To32(m_vm32[addr & 0xFFFFF], TEXA);
}
__forceinline uint32 ReadTexel16(uint32 addr, const GIFRegTEXA& TEXA) const
{
return Expand16To32(m_vm16[addr], TEXA);
return Expand16To32(m_vm16[addr & 0x1FFFFF], TEXA);
}
__forceinline uint32 ReadTexel8(uint32 addr, const GIFRegTEXA& TEXA) const

View File

@ -170,7 +170,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
{
if(m_vt.m_max.p.z > 0xffff)
{
ASSERT(m_vt.m_min.p.z > 0xffff); // sfex capcom logo
//ASSERT(m_vt.m_min.p.z > 0xffff); // sfex capcom logo
// Fixme : Same as above, I guess.
if (m_vt.m_min.p.z > 0xffff)
{

View File

@ -1572,20 +1572,20 @@ void GSState::Move()
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint32* RESTRICT s = &m_mem.m_vm32[spo->pixel.row[sy]];
uint32* RESTRICT d = &m_mem.m_vm32[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x < w; x++) d[dcol[x]] = s[scol[x]];
for(int x = 0; x < w; x++) m_mem.WritePixel32(d + dcol[x], m_mem.ReadPixel32(s + scol[x]));
}
}
else
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint32* RESTRICT s = &m_mem.m_vm32[spo->pixel.row[sy]];
uint32* RESTRICT d = &m_mem.m_vm32[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x > -w; x--) d[dcol[x]] = s[scol[x]];
for(int x = 0; x > -w; x--) m_mem.WritePixel32(d + dcol[x], m_mem.ReadPixel32(s + scol[x]));
}
}
}
@ -1595,20 +1595,20 @@ void GSState::Move()
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint32* RESTRICT s = &m_mem.m_vm32[spo->pixel.row[sy]];
uint32* RESTRICT d = &m_mem.m_vm32[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x < w; x++) d[dcol[x]] = (d[dcol[x]] & 0xff000000) | (s[scol[x]] & 0x00ffffff);
for(int x = 0; x < w; x++) m_mem.WritePixel24(d + dcol[x], m_mem.ReadPixel24(s + scol[x]));
}
}
else
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint32* RESTRICT s = &m_mem.m_vm32[spo->pixel.row[sy]];
uint32* RESTRICT d = &m_mem.m_vm32[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x > -w; x--) d[dcol[x]] = (d[dcol[x]] & 0xff000000) | (s[scol[x]] & 0x00ffffff);
for(int x = 0; x > -w; x--) m_mem.WritePixel24(d + dcol[x], m_mem.ReadPixel24(s + scol[x]));
}
}
}
@ -1618,20 +1618,20 @@ void GSState::Move()
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint16* RESTRICT s = &m_mem.m_vm16[spo->pixel.row[sy]];
uint16* RESTRICT d = &m_mem.m_vm16[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x < w; x++) d[dcol[x]] = s[scol[x]];
for(int x = 0; x < w; x++) m_mem.WritePixel16(d + dcol[x], m_mem.ReadPixel16(s + scol[x]));
}
}
else
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint16* RESTRICT s = &m_mem.m_vm16[spo->pixel.row[sy]];
uint16* RESTRICT d = &m_mem.m_vm16[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
for(int x = 0; x > -w; x--) d[dcol[x]] = s[scol[x]];
for(int x = 0; x > -w; x--) m_mem.WritePixel16(d + dcol[x], m_mem.ReadPixel16(s + scol[x]));
}
}
}
@ -1642,26 +1642,26 @@ void GSState::Move()
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint8* RESTRICT s = &m_mem.m_vm8[spo->pixel.row[sy]];
uint8* RESTRICT d = &m_mem.m_vm8[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
int* RESTRICT scol = &spo->pixel.col[sy & 7][sx];
int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx];
for(int x = 0; x < w; x++) d[dcol[x]] = s[scol[x]];
for(int x = 0; x < w; x++) m_mem.WritePixel8(d + dcol[x], m_mem.ReadPixel8(s + scol[x]));
}
}
else
{
for(int y = 0; y < h; y++, sy += yinc, dy += yinc)
{
uint8* RESTRICT s = &m_mem.m_vm8[spo->pixel.row[sy]];
uint8* RESTRICT d = &m_mem.m_vm8[dpo->pixel.row[dy]];
uint32 s = spo->pixel.row[sy];
uint32 d = dpo->pixel.row[dy];
int* RESTRICT scol = &spo->pixel.col[sy & 7][sx];
int* RESTRICT dcol = &dpo->pixel.col[dy & 7][dx];
for(int x = 0; x > -w; x--) d[dcol[x]] = s[scol[x]];
for(int x = 0; x > -w; x--) m_mem.WritePixel8(d + dcol[x], m_mem.ReadPixel8(s + scol[x]));
}
}
}

View File

@ -409,6 +409,7 @@ void GSTextureCache::InvalidateVideoMem(GSOffset* o, const GSVector4i& rect, boo
if(GSUtil::HasSharedBits(psm, t->m_TEX0.PSM) && bp < t->m_TEX0.TBP0)
{
uint32 rowsize = bw * 8192;
// FIXME: what if TBP0 < bp?
uint32 offset = (uint32)((t->m_TEX0.TBP0 - bp) * 256);
if(rowsize > 0 && offset % rowsize == 0)
@ -922,7 +923,7 @@ void GSTextureCache::Source::Update(const GSVector4i& rect)
for(int x = r.left, i = (y << 7) + x; x < r.right; x += bs.x, i += bs.x)
{
uint32 block = base + o->block.col[x >> 3];
uint32 block = base + o->block.col[x >> 3] & (MAX_BLOCKS-1);
if(block < MAX_BLOCKS)
{
@ -951,7 +952,7 @@ void GSTextureCache::Source::Update(const GSVector4i& rect)
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + o->block.col[x >> 3];
uint32 block = base + o->block.col[x >> 3] & (MAX_BLOCKS-1);
if(block < MAX_BLOCKS)
{
@ -1185,7 +1186,7 @@ void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSO
for(int x = 0; x < tw; x += bs.x)
{
uint32 page = (base + o->block.col[x >> 3]) >> 5;
uint32 page = (base + o->block.col[x >> 3]) >> 5 & (MAX_PAGES-1);
if(page < MAX_PAGES)
{

View File

@ -278,7 +278,7 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
for(int x = r.left, i = (y << 7) + x; x < r.right; x += bs.x, i += bs.x)
{
uint32 block = base + o->block.col[x];
uint32 block = base + o->block.col[x] & (MAX_BLOCKS-1);
if(block < MAX_BLOCKS)
{
@ -305,7 +305,7 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + o->block.col[x];
uint32 block = base + o->block.col[x] & (MAX_BLOCKS-1);
if(block < MAX_BLOCKS)
{