gsdx: sed/o/off/

This commit is contained in:
Gregory Hainaut 2015-05-15 20:40:09 +02:00
parent 27d485a940
commit d870188d21
25 changed files with 213 additions and 213 deletions

View File

@ -1342,13 +1342,13 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
printf("%6d %6d | ", (int)((float)trlen * n / (end - start) / 1000), (int)((float)(w * h) * n / (end - start) / 1000));
const GSOffset* o = mem->GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
const GSOffset* off = mem->GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
start = clock();
for(int j = 0; j < n; j++)
{
(mem->*rtx)(o, r, ptr, w * 4, TEXA);
(mem->*rtx)(off, r, ptr, w * 4, TEXA);
}
end = clock();
@ -1361,7 +1361,7 @@ EXPORT_C GSBenchmark(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow
for(int j = 0; j < n; j++)
{
(mem->*rtxP)(o, r, ptr, w, TEXA);
(mem->*rtxP)(off, r, ptr, w, TEXA);
}
end = clock();

View File

@ -185,10 +185,10 @@ void GSClut::WriteCLUT16S_I4_CSM1(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& T
template<int n> void GSClut::WriteCLUT32_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT32);
GSOffset* off = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT32);
uint32* RESTRICT s = &m_mem->m_vm32[o->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint32* RESTRICT s = &m_mem->m_vm32[off->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &off->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + ((TEX0.CSA & 15) << 4);
@ -203,10 +203,10 @@ template<int n> void GSClut::WriteCLUT32_CSM2(const GIFRegTEX0& TEX0, const GIFR
template<int n> void GSClut::WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16);
GSOffset* off = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16);
uint16* RESTRICT s = &m_mem->m_vm16[o->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT s = &m_mem->m_vm16[off->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &off->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + (TEX0.CSA << 4);
@ -218,10 +218,10 @@ template<int n> void GSClut::WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFR
template<int n> void GSClut::WriteCLUT16S_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT)
{
GSOffset* o = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16S);
GSOffset* off = m_mem->GetOffset(TEX0.CBP, TEXCLUT.CBW, PSM_PSMCT16S);
uint16* RESTRICT s = &m_mem->m_vm16[o->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &o->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT s = &m_mem->m_vm16[off->pixel.row[TEXCLUT.COV]];
int* RESTRICT col = &off->pixel.col[0][TEXCLUT.COU << 4];
uint16* RESTRICT clut = m_clut + (TEX0.CSA << 4);

View File

@ -571,13 +571,13 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2)
if(m_sel.zoverflow || m_sel.zpsm == 0)
{
// GSVector4i o = GSVector4i::x80000000();
// GSVector4i off = GSVector4i::x80000000();
vpcmpeqd(xmm2, xmm2);
vpslld(xmm2, 31);
// GSVector4i zso = zs - o;
// GSVector4i zdo = zd - o;
// GSVector4i zso = zs - off;
// GSVector4i zdo = zd - off;
vpsubd(xmm0, xmm2);
vpsubd(xmm1, xmm2);

View File

@ -660,13 +660,13 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2)
if(m_sel.zoverflow || m_sel.zpsm == 0)
{
// GSVector4i o = GSVector4i::x80000000();
// GSVector4i off = GSVector4i::x80000000();
vpcmpeqd(temp1, temp1);
vpslld(temp1, 31);
// GSVector4i zso = zs - o;
// GSVector4i zdo = zd - o;
// GSVector4i zso = zs - off;
// GSVector4i zdo = zd - off;
vpsubd(xmm0, temp1);
vpsubd(xmm1, temp1);

View File

@ -661,13 +661,13 @@ void GSDrawScanlineCodeGenerator::TestZ(const Ymm& temp1, const Ymm& temp2)
if(m_sel.zoverflow || m_sel.zpsm == 0)
{
// GSVector8i o = GSVector8i::x80000000();
// GSVector8i off = GSVector8i::x80000000();
vpcmpeqd(temp1, temp1);
vpslld(temp1, 31);
// GSVector8i zso = zs - o;
// GSVector8i zdo = zd - o;
// GSVector8i zso = zs - off;
// GSVector8i zdo = zd - off;
vpsubd(ymm0, temp1);
vpsubd(ymm1, temp1);

View File

@ -664,13 +664,13 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2)
if(m_sel.zoverflow || m_sel.zpsm == 0)
{
// GSVector4i o = GSVector4i::x80000000();
// GSVector4i off = GSVector4i::x80000000();
pcmpeqd(temp1, temp1);
pslld(temp1, 31);
// GSVector4i zso = zs - o;
// GSVector4i zdo = zd - o;
// GSVector4i zso = zs - off;
// GSVector4i zdo = zd - off;
psubd(xmm0, temp1);
psubd(xmm1, temp1);

View File

@ -37,10 +37,10 @@
int _offset = dstpitch * h; \
for(int y = _r.top; y < _r.bottom; y += h >> 3, _dst += _offset) \
{ \
uint32 _base = o->block.row[y]; \
uint32 _base = off->block.row[y]; \
for(int x = _r.left; x < _r.right; x += w >> 3) \
{ \
const uint8* src = BlockPtr(_base + o->block.col[x]); \
const uint8* src = BlockPtr(_base + off->block.col[x]); \
uint8* dst = &_dst[x * bpp]; \
#define FOREACH_BLOCK_END }}
@ -474,11 +474,11 @@ GSOffset* GSLocalMemory::GetOffset(uint32 bp, uint32 bw, uint32 psm)
return i->second;
}
GSOffset* o = new GSOffset(bp, bw, psm);
GSOffset* off = new GSOffset(bp, bw, psm);
m_omap[hash] = o;
m_omap[hash] = off;
return o;
return off;
}
GSPixelOffset* GSLocalMemory::GetPixelOffset(const GIFRegFRAME& FRAME, const GIFRegZBUF& ZBUF)
@ -505,14 +505,14 @@ GSPixelOffset* GSLocalMemory::GetPixelOffset(const GIFRegFRAME& FRAME, const GIF
return i->second;
}
GSPixelOffset* o = (GSPixelOffset*)_aligned_malloc(sizeof(GSPixelOffset), 32);
GSPixelOffset* off = (GSPixelOffset*)_aligned_malloc(sizeof(GSPixelOffset), 32);
o->hash = hash;
o->fbp = fbp;
o->zbp = zbp;
o->fpsm = fpsm;
o->zpsm = zpsm;
o->bw = bw;
off->hash = hash;
off->fbp = fbp;
off->zbp = zbp;
off->fpsm = fpsm;
off->zpsm = zpsm;
off->bw = bw;
pixelAddress fpa = m_psm[fpsm].pa;
pixelAddress zpa = m_psm[zpsm].pa;
@ -522,19 +522,19 @@ GSPixelOffset* GSLocalMemory::GetPixelOffset(const GIFRegFRAME& FRAME, const GIF
for(int i = 0; i < 2048; i++)
{
o->row[i].x = (int)fpa(0, i, fbp, bw) << fs;
o->row[i].y = (int)zpa(0, i, zbp, bw) << zs;
off->row[i].x = (int)fpa(0, i, fbp, bw) << fs;
off->row[i].y = (int)zpa(0, i, zbp, bw) << zs;
}
for(int i = 0; i < 2048; i++)
{
o->col[i].x = m_psm[fpsm].rowOffset[0][i] << fs;
o->col[i].y = m_psm[zpsm].rowOffset[0][i] << zs;
off->col[i].x = m_psm[fpsm].rowOffset[0][i] << fs;
off->col[i].y = m_psm[zpsm].rowOffset[0][i] << zs;
}
m_pomap[hash] = o;
m_pomap[hash] = off;
return o;
return off;
}
GSPixelOffset4* GSLocalMemory::GetPixelOffset4(const GIFRegFRAME& FRAME, const GIFRegZBUF& ZBUF)
@ -561,14 +561,14 @@ GSPixelOffset4* GSLocalMemory::GetPixelOffset4(const GIFRegFRAME& FRAME, const G
return i->second;
}
GSPixelOffset4* o = (GSPixelOffset4*)_aligned_malloc(sizeof(GSPixelOffset4), 32);
GSPixelOffset4* off = (GSPixelOffset4*)_aligned_malloc(sizeof(GSPixelOffset4), 32);
o->hash = hash;
o->fbp = fbp;
o->zbp = zbp;
o->fpsm = fpsm;
o->zpsm = zpsm;
o->bw = bw;
off->hash = hash;
off->fbp = fbp;
off->zbp = zbp;
off->fpsm = fpsm;
off->zpsm = zpsm;
off->bw = bw;
pixelAddress fpa = m_psm[fpsm].pa;
pixelAddress zpa = m_psm[zpsm].pa;
@ -578,19 +578,19 @@ GSPixelOffset4* GSLocalMemory::GetPixelOffset4(const GIFRegFRAME& FRAME, const G
for(int i = 0; i < 2048; i++)
{
o->row[i].x = (int)fpa(0, i, fbp, bw) << fs;
o->row[i].y = (int)zpa(0, i, zbp, bw) << zs;
off->row[i].x = (int)fpa(0, i, fbp, bw) << fs;
off->row[i].y = (int)zpa(0, i, zbp, bw) << zs;
}
for(int i = 0; i < 512; i++)
{
o->col[i].x = m_psm[fpsm].rowOffset[0][i * 4] << fs;
o->col[i].y = m_psm[zpsm].rowOffset[0][i * 4] << zs;
off->col[i].x = m_psm[fpsm].rowOffset[0][i * 4] << fs;
off->col[i].y = m_psm[zpsm].rowOffset[0][i * 4] << zs;
}
m_po4map[hash] = o;
m_po4map[hash] = off;
return o;
return off;
}
static bool cmp_vec2x(const GSVector2i& a, const GSVector2i& b) {return a.x < b.x;}
@ -611,17 +611,17 @@ vector<GSVector2i>* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0)
int tw = std::max<int>(1 << TEX0.TW, bs.x);
int th = std::max<int>(1 << TEX0.TH, bs.y);
const GSOffset* o = GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
const GSOffset* off = GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
hash_map<uint32, hash_set<uint32> > tmp; // key = page, value = y:x, 7 bits each, max 128x128 tiles for the worst case (1024x1024 32bpp 8x8 blocks)
for(int y = 0; y < th; y += bs.y)
{
uint32 base = o->block.row[y >> 3];
uint32 base = off->block.row[y >> 3];
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 + off->block.col[x >> 3]) >> 5;
if(page < MAX_PAGES)
{
@ -1422,10 +1422,10 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
for(int ex8 = ex - 8; len >= 8 && x <= ex8; len -= 8, x += 8, pd += 8)
{
int o = offset[x];
int off = offset[x];
GSVector4i::store<false>(&pd[0], GSVector4i::load(&ps[o + 0], &ps[o + 4]));
GSVector4i::store<false>(&pd[4], GSVector4i::load(&ps[o + 8], &ps[o + 12]));
GSVector4i::store<false>(&pd[0], GSVector4i::load(&ps[off + 0], &ps[off + 4]));
GSVector4i::store<false>(&pd[4], GSVector4i::load(&ps[off + 8], &ps[off + 12]));
for(int i = 0; i < 8; i++) ASSERT(pd[i] == ps[offset[x + i]]);
}
@ -1608,7 +1608,7 @@ void GSLocalMemory::ReadImageX(int& tx, int& ty, uint8* dst, int len, GIFRegBITB
///////////////////
void GSLocalMemory::ReadTexture32(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture32(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 8, 8, 32)
{
@ -1617,7 +1617,7 @@ void GSLocalMemory::ReadTexture32(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
if(TEXA.AEM)
{
@ -1637,7 +1637,7 @@ void GSLocalMemory::ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i&
}
}
void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
if(TEXA.AEM)
{
@ -1657,7 +1657,7 @@ void GSLocalMemory::ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i&
}
}
void GSLocalMemory::ReadTexture8(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture8(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const uint32* pal = m_clut;
@ -1668,7 +1668,7 @@ void GSLocalMemory::ReadTexture8(const GSOffset* RESTRICT o, const GSVector4i& r
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const uint64* pal = m_clut;
@ -1679,7 +1679,7 @@ void GSLocalMemory::ReadTexture4(const GSOffset* RESTRICT o, const GSVector4i& r
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture8H(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture8H(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const uint32* pal = m_clut;
@ -1690,7 +1690,7 @@ void GSLocalMemory::ReadTexture8H(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4HL(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4HL(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const uint32* pal = m_clut;
@ -1701,7 +1701,7 @@ void GSLocalMemory::ReadTexture4HL(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4HH(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4HH(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const uint32* pal = m_clut;
@ -1786,9 +1786,9 @@ void GSLocalMemory::ReadTextureBlock4HH(uint32 bp, uint8* dst, int dstpitch, con
///////////////////
void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
const psm_t& psm = m_psm[o->psm];
const psm_t& psm = m_psm[off->psm];
readTexel rt = psm.rt;
readTexture rtx = psm.rtx;
@ -1799,9 +1799,9 @@ void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r,
{
GIFRegTEX0 TEX0;
TEX0.TBP0 = o->bp;
TEX0.TBW = o->bw;
TEX0.PSM = o->psm;
TEX0.TBP0 = off->bp;
TEX0.TBW = off->bw;
TEX0.PSM = off->psm;
GSVector4i cr = r.ralign<Align_Inside>(psm.bs);
@ -1854,19 +1854,19 @@ void GSLocalMemory::ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r,
if(!cr.rempty())
{
(this->*rtx)(o, cr, dst + (cr.left - r.left) * sizeof(32), dstpitch, TEXA);
(this->*rtx)(off, cr, dst + (cr.left - r.left) * sizeof(32), dstpitch, TEXA);
}
}
}
else
{
(this->*rtx)(o, r, dst, dstpitch, TEXA);
(this->*rtx)(off, r, dst, dstpitch, TEXA);
}
}
// 32/8
void GSLocalMemory::ReadTexture8P(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture8P(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 16, 16, 8)
{
@ -1875,7 +1875,7 @@ void GSLocalMemory::ReadTexture8P(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4P(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4P(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 32, 16, 8)
{
@ -1884,7 +1884,7 @@ void GSLocalMemory::ReadTexture4P(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture8HP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture8HP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{
@ -1893,7 +1893,7 @@ void GSLocalMemory::ReadTexture8HP(const GSOffset* RESTRICT o, const GSVector4i&
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4HLP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4HLP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{
@ -1902,7 +1902,7 @@ void GSLocalMemory::ReadTexture4HLP(const GSOffset* RESTRICT o, const GSVector4i
FOREACH_BLOCK_END
}
void GSLocalMemory::ReadTexture4HHP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
void GSLocalMemory::ReadTexture4HHP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA)
{
FOREACH_BLOCK_START(r, 8, 8, 8)
{

View File

@ -93,7 +93,7 @@ public:
typedef uint32 (GSLocalMemory::*readTexelAddr)(uint32 addr, const GIFRegTEXA& TEXA) const;
typedef void (GSLocalMemory::*writeImage)(int& tx, int& ty, const uint8* src, int len, GIFRegBITBLTBUF& BITBLTBUF, GIFRegTRXPOS& TRXPOS, GIFRegTRXREG& TRXREG);
typedef void (GSLocalMemory::*readImage)(int& tx, int& ty, uint8* dst, int len, GIFRegBITBLTBUF& BITBLTBUF, GIFRegTRXPOS& TRXPOS, GIFRegTRXREG& TRXREG) const;
typedef void (GSLocalMemory::*readTexture)(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
typedef void (GSLocalMemory::*readTexture)(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
typedef void (GSLocalMemory::*readTextureBlock)(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
__aligned(struct, 128) psm_t
@ -670,15 +670,15 @@ public:
WriteFrame16(PixelAddress16SZ(x, y, bp, bw), c);
}
__forceinline void WritePixel32(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r)
__forceinline void WritePixel32(uint8* RESTRICT src, uint32 pitch, GSOffset* off, const GSVector4i& r)
{
src -= r.left * sizeof(uint32);
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* RESTRICT col = o->pixel.col[0];
uint32* RESTRICT d = &m_vm32[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
@ -687,15 +687,15 @@ public:
}
}
__forceinline void WritePixel24(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r)
__forceinline void WritePixel24(uint8* RESTRICT src, uint32 pitch, GSOffset* off, const GSVector4i& r)
{
src -= r.left * sizeof(uint32);
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* RESTRICT col = o->pixel.col[0];
uint32* RESTRICT d = &m_vm32[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
@ -704,15 +704,15 @@ public:
}
}
__forceinline void WritePixel16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r)
__forceinline void WritePixel16(uint8* RESTRICT src, uint32 pitch, GSOffset* off, const GSVector4i& r)
{
src -= r.left * sizeof(uint16);
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* RESTRICT col = o->pixel.col[0];
uint16* RESTRICT d = &m_vm16[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
@ -721,15 +721,15 @@ public:
}
}
__forceinline void WriteFrame16(uint8* RESTRICT src, uint32 pitch, GSOffset* o, const GSVector4i& r)
__forceinline void WriteFrame16(uint8* RESTRICT src, uint32 pitch, GSOffset* off, const GSVector4i& r)
{
src -= r.left * sizeof(uint32);
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* RESTRICT col = o->pixel.col[0];
uint16* RESTRICT d = &m_vm16[off->pixel.row[y]];
int* RESTRICT col = off->pixel.col[0];
for(int x = r.left; x < r.right; x++)
{
@ -876,16 +876,16 @@ public:
// * => 32
void ReadTexture32(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture24(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture16(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8H(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HL(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HH(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture32(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture24(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture16(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8H(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HL(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HH(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTextureBlock32(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
void ReadTextureBlock24(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
@ -898,11 +898,11 @@ public:
// pal ? 8 : 32
void ReadTexture8P(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4P(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8HP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HLP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HHP(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8P(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4P(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture8HP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HLP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTexture4HHP(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
void ReadTextureBlock8P(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
void ReadTextureBlock4P(uint32 bp, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA) const;
@ -912,7 +912,7 @@ public:
//
template<typename T> void ReadTexture(const GSOffset* RESTRICT o, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
template<typename T> void ReadTexture(const GSOffset* RESTRICT off, const GSVector4i& r, uint8* dst, int dstpitch, const GIFRegTEXA& TEXA);
//

View File

@ -221,19 +221,19 @@ bool GSRenderer::Merge(int field)
src[i] = GSVector4(r) * scale / GSVector4(tex[i]->GetSize()).xyxy();
GSVector2 o(0, 0);
GSVector2 off(0, 0);
if(dr[i].top - baseline >= 4) // 2?
{
o.y = tex[i]->GetScale().y * (dr[i].top - baseline);
off.y = tex[i]->GetScale().y * (dr[i].top - baseline);
if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD)
{
o.y /= 2;
off.y /= 2;
}
}
dst[i] = GSVector4(o).xyxy() + scale * GSVector4(r.rsize());
dst[i] = GSVector4(off).xyxy() + scale * GSVector4(r.rsize());
fs.x = max(fs.x, (int)(dst[i].z + 0.5f));
fs.y = max(fs.y, (int)(dst[i].w + 0.5f));

View File

@ -197,7 +197,7 @@ const GSVector4 g_pos_scale(1.0f / 16, 1.0f / 16, 1.0f, 1.0f);
template<uint32 primclass, uint32 tme, uint32 fst>
void GSRendererCL::ConvertVertexBuffer(GSVertexCL* RESTRICT dst, const GSVertex* RESTRICT src, size_t count)
{
GSVector4i o = (GSVector4i)m_context->XYOFFSET;
GSVector4i off = (GSVector4i)m_context->XYOFFSET;
GSVector4 st_scale = GSVector4(16 << m_context->TEX0.TW, 16 << m_context->TEX0.TH, 1, 0);
for(int i = (int)m_vertex.next; i > 0; i--, src++, dst++)
@ -206,7 +206,7 @@ void GSRendererCL::ConvertVertexBuffer(GSVertexCL* RESTRICT dst, const GSVertex*
GSVector4i xyzuvf(src->m[1]);
dst->p = (GSVector4(xyzuvf.upl16() - o) * g_pos_scale).xyxy(GSVector4::cast(xyzuvf.ywyw())); // pass zf as uints
dst->p = (GSVector4(xyzuvf.upl16() - off) * g_pos_scale).xyxy(GSVector4::cast(xyzuvf.ywyw())); // pass zf as uints
GSVector4 t = GSVector4::zero();
@ -571,9 +571,9 @@ void GSRendererCL::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
{
if(LOG) {fprintf(s_fp, "w %05x %d %d, %d %d %d %d\n", BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM, r.x, r.y, r.z, r.w); fflush(s_fp);}
GSOffset* o = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
o->GetPagesAsBits(r, m_tmp_pages);
off->GetPagesAsBits(r, m_tmp_pages);
if(!m_synced)
{
@ -607,9 +607,9 @@ void GSRendererCL::InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
if(!m_synced)
{
GSOffset* o = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
o->GetPagesAsBits(r, m_tmp_pages);
off->GetPagesAsBits(r, m_tmp_pages);
for(int i = 0; i < 4; i++)
{
@ -1191,9 +1191,9 @@ bool GSRendererCL::SetupParameter(TFXJob* job, TFXParameter* pb, GSVertexCL* ver
GSVector4i* src_pages = job->GetSrcPages();
GSOffset* o = m_mem.GetOffset(context->TEX0.TBP0, context->TEX0.TBW, context->TEX0.PSM);
GSOffset* off = m_mem.GetOffset(context->TEX0.TBP0, context->TEX0.TBW, context->TEX0.PSM);
o->GetPagesAsBits(r, m_tmp_pages);
off->GetPagesAsBits(r, m_tmp_pages);
for(int i = 0; i < 4; i++)
{
@ -1324,9 +1324,9 @@ bool GSRendererCL::SetupParameter(TFXJob* job, TFXParameter* pb, GSVertexCL* ver
GetTextureMinMax(r, MIP_TEX0, MIP_CLAMP, job->sel.ltf);
GSOffset* o = m_mem.GetOffset(MIP_TEX0.TBP0, MIP_TEX0.TBW, MIP_TEX0.PSM);
GSOffset* off = m_mem.GetOffset(MIP_TEX0.TBP0, MIP_TEX0.TBW, MIP_TEX0.PSM);
o->GetPagesAsBits(r, m_tmp_pages);
off->GetPagesAsBits(r, m_tmp_pages);
for(int i = 0; i < 4; i++)
{

View File

@ -354,11 +354,11 @@ GSTexture* GSRendererCS::GetOutput(int i)
GSVector4i r(0, 0, w, h);
GSVector4i r2 = r.ralign<Align_Outside>(psm.bs);
GSOffset* o = m_mem.GetOffset(DISPFB.Block(), DISPFB.FBW, DISPFB.PSM);
GSOffset* off = m_mem.GetOffset(DISPFB.Block(), DISPFB.FBW, DISPFB.PSM);
Read(o, r2, false);
Read(off, r2, false);
(m_mem.*psm.rtx)(o, r2, m_output, 1024 * 4, m_env.TEXA);
(m_mem.*psm.rtx)(off, r2, m_output, 1024 * 4, m_env.TEXA);
m_texture[i]->Update(r, m_output, 1024 * 4);
@ -682,9 +682,9 @@ void GSRendererCS::Draw()
void GSRendererCS::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r)
{
GSOffset* o = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
Read(o, r, true); // TODO: fully overwritten pages are not needed to be read, only invalidated (important)
Read(off, r, true); // TODO: fully overwritten pages are not needed to be read, only invalidated (important)
// TODO: false deps, 8H/4HL/4HH texture sharing pages with 24-bit target
// TODO: invalidate texture cache
@ -692,12 +692,12 @@ void GSRendererCS::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
void GSRendererCS::InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut)
{
GSOffset* o = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
Read(o, r, false);
Read(off, r, false);
}
void GSRendererCS::Write(GSOffset* o, const GSVector4i& r)
void GSRendererCS::Write(GSOffset* off, const GSVector4i& r)
{
GSDevice11* dev = (GSDevice11*)m_dev;
@ -711,7 +711,7 @@ void GSRendererCS::Write(GSOffset* o, const GSVector4i& r)
box.bottom = 1;
box.back = 1;
uint32* pages = o->GetPages(r);
uint32* pages = off->GetPages(r);
for(size_t i = 0; pages[i] != GSOffset::EOP; i++)
{
@ -739,14 +739,14 @@ void GSRendererCS::Write(GSOffset* o, const GSVector4i& r)
ctx->UpdateSubresource(m_vm, 0, &box, m_mem.m_vm8 + page * PAGE_SIZE, 0, 0);
*/
if(0)
printf("[%lld] write %05x %d %d (%d)\n", __rdtsc(), o->bp, o->bw, o->psm, page);
printf("[%lld] write %05x %d %d (%d)\n", __rdtsc(), off->bp, off->bw, off->psm, page);
}
}
delete [] pages;
}
void GSRendererCS::Read(GSOffset* o, const GSVector4i& r, bool invalidate)
void GSRendererCS::Read(GSOffset* off, const GSVector4i& r, bool invalidate)
{
GSDevice11* dev = (GSDevice11*)m_dev;
@ -760,7 +760,7 @@ void GSRendererCS::Read(GSOffset* o, const GSVector4i& r, bool invalidate)
box.bottom = 1;
box.back = 1;
uint32* pages = o->GetPages(r);
uint32* pages = off->GetPages(r);
for(size_t i = 0; pages[i] != GSOffset::EOP; i++)
{
@ -799,7 +799,7 @@ void GSRendererCS::Read(GSOffset* o, const GSVector4i& r, bool invalidate)
ctx->Unmap(m_pb, 0);
if(0)
printf("[%lld] read %05x %d %d (%d)\n", __rdtsc(), o->bp, o->bw, o->psm, page);
printf("[%lld] read %05x %d %d (%d)\n", __rdtsc(), off->bp, off->bw, off->psm, page);
}
}
}

View File

@ -114,8 +114,8 @@ class GSRendererCS : public GSRenderer
hash_map<uint32, CComPtr<ID3D11PixelShader> > m_ps1;
CComPtr<ID3D11Buffer> m_ps_cb;
void Write(GSOffset* o, const GSVector4i& r);
void Read(GSOffset* o, const GSVector4i& r, bool invalidate);
void Write(GSOffset* off, const GSVector4i& r);
void Read(GSOffset* off, const GSVector4i& r, bool invalidate);
struct OffsetBuffer
{

View File

@ -63,10 +63,10 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
if(dev->HasStencil())
{
GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y);
GSVector4 o = GSVector4(-1.0f, 1.0f);
GSVector4 off = GSVector4(-1.0f, 1.0f);
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy());
GSVector4 dst = src * 2.0f + o.xxxx();
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + off.xxyy()) * s.xyxy()).sat(off.zzyy());
GSVector4 dst = src * 2.0f + off.xxxx();
GSVertexPT1 vertices[] =
{

View File

@ -243,10 +243,10 @@ void GSRendererDX9::UpdateFBA(GSTexture* rt)
// ia
GSVector4 s = GSVector4(rt->GetScale().x / rt->GetWidth(), rt->GetScale().y / rt->GetHeight());
GSVector4 o = GSVector4(-1.0f, 1.0f);
GSVector4 off = GSVector4(-1.0f, 1.0f);
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy());
GSVector4 dst = src * 2.0f + o.xxxx();
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + off.xxyy()) * s.xyxy()).sat(off.zzyy());
GSVector4 dst = src * 2.0f + off.xxxx();
GSVertexPT1 vertices[] =
{

View File

@ -303,8 +303,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
} else if (DATE) {
// TODO: do I need to clamp the value (if yes how? rintersect with rt?)
GSVector4 si = GSVector4(rtscale.x, rtscale.y);
GSVector4 o = GSVector4(-1.0f, 1.0f); // Round value
GSVector4 b = m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy();
GSVector4 off = GSVector4(-1.0f, 1.0f); // Round value
GSVector4 b = m_vt.m_min.p.xyxy(m_vt.m_max.p) + off.xxyy();
GSVector4i ri = GSVector4i(b * si.xyxy());
// Reduce the quantity of clean function
@ -319,8 +319,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
} else {
GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y);
GSVector4 src = (b * s.xyxy()).sat(o.zzyy());
GSVector4 dst = src * 2.0f + o.xxxx();
GSVector4 src = (b * s.xyxy()).sat(off.zzyy());
GSVector4 dst = src * 2.0f + off.xxxx();
GSVertexPT1 vertices[] =
{

View File

@ -336,7 +336,7 @@ void GSRendererSW::ConvertVertexBuffer(GSVertexSW* RESTRICT dst, const GSVertex*
#else
GSVector4i o = (GSVector4i)m_context->XYOFFSET;
GSVector4i off = (GSVector4i)m_context->XYOFFSET;
GSVector4 tsize = GSVector4(0x10000 << m_context->TEX0.TW, 0x10000 << m_context->TEX0.TH, 1, 0);
for(int i = (int)m_vertex.next; i > 0; i--, src++, dst++)
@ -347,14 +347,14 @@ void GSRendererSW::ConvertVertexBuffer(GSVertexSW* RESTRICT dst, const GSVertex*
GSVector4i xyzuvf(src->m[1]);
GSVector4i xy = xyzuvf.upl16() - o;
GSVector4i xy = xyzuvf.upl16() - off;
GSVector4i zf = xyzuvf.ywww().min_u32(GSVector4i::xffffff00());
#else
uint32 z = src->XYZ.Z;
GSVector4i xy = GSVector4i::load((int)src->XYZ.u32[0]).upl16() - o;
GSVector4i xy = GSVector4i::load((int)src->XYZ.u32[0]).upl16() - off;
GSVector4i zf = GSVector4i((int)std::min<uint32>(z, 0xffffff00), src->FOG); // NOTE: larger values of z may roll over to 0 when converting back to uint32 later
#endif
@ -681,9 +681,9 @@ void GSRendererSW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
{
if(LOG) {fprintf(s_fp, "w %05x %d %d, %d %d %d %d\n", BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM, r.x, r.y, r.z, r.w); fflush(s_fp);}
GSOffset* o = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.DBP, BITBLTBUF.DBW, BITBLTBUF.DPSM);
o->GetPages(r, m_tmp_pages);
off->GetPages(r, m_tmp_pages);
// check if the changing pages either used as a texture or a target
@ -700,7 +700,7 @@ void GSRendererSW::InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
}
}
m_tc->InvalidatePages(m_tmp_pages, o->psm); // if texture update runs on a thread and Sync(5) happens then this must come later
m_tc->InvalidatePages(m_tmp_pages, off->psm); // if texture update runs on a thread and Sync(5) happens then this must come later
}
void GSRendererSW::InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut)
@ -709,9 +709,9 @@ void GSRendererSW::InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GS
if(!m_rl->IsSynced())
{
GSOffset* o = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
GSOffset* off = m_mem.GetOffset(BITBLTBUF.SBP, BITBLTBUF.SBW, BITBLTBUF.SPSM);
o->GetPages(r, m_tmp_pages);
off->GetPages(r, m_tmp_pages);
for(uint32* RESTRICT p = m_tmp_pages; *p != GSOffset::EOP; p++)
{

View File

@ -963,14 +963,14 @@ template<int i> void GSState::GIFRegHandlerTEX2(const GIFReg* RESTRICT r)
template<int i> void GSState::GIFRegHandlerXYOFFSET(const GIFReg* RESTRICT r)
{
GSVector4i o = (GSVector4i)r->XYOFFSET & GSVector4i::x0000ffff();
GSVector4i off = (GSVector4i)r->XYOFFSET & GSVector4i::x0000ffff();
if(!o.eq(m_env.CTXT[i].XYOFFSET))
if(!off.eq(m_env.CTXT[i].XYOFFSET))
{
Flush();
}
m_env.CTXT[i].XYOFFSET = o;
m_env.CTXT[i].XYOFFSET = off;
m_env.CTXT[i].UpdateScissor();

View File

@ -317,13 +317,13 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
// Goal: invalidate data sent to the GPU when the source (GS memory) is modified
// Called each time you want to write to the GS memory
void GSTextureCache::InvalidateVideoMem(GSOffset* o, const GSVector4i& rect, bool target)
void GSTextureCache::InvalidateVideoMem(GSOffset* off, const GSVector4i& rect, bool target)
{
if(!o) return; // Fixme. Crashes Dual Hearts, maybe others as well. Was fine before r1549.
if(!off) return; // Fixme. Crashes Dual Hearts, maybe others as well. Was fine before r1549.
uint32 bp = o->bp;
uint32 bw = o->bw;
uint32 psm = o->psm;
uint32 bp = off->bp;
uint32 bw = off->bw;
uint32 psm = off->psm;
if(!target)
{
@ -348,7 +348,7 @@ void GSTextureCache::InvalidateVideoMem(GSOffset* o, const GSVector4i& rect, boo
uint32* pages = (uint32*)m_temp;
o->GetPages(rect, pages, &r);
off->GetPages(rect, pages, &r);
bool found = false;
@ -454,11 +454,11 @@ void GSTextureCache::InvalidateVideoMem(GSOffset* o, const GSVector4i& rect, boo
// Goal: retrive the data from the GPU to the GS memory.
// Called each time you want to read from the GS memory
void GSTextureCache::InvalidateLocalMem(GSOffset* o, const GSVector4i& r)
void GSTextureCache::InvalidateLocalMem(GSOffset* off, const GSVector4i& r)
{
uint32 bp = o->bp;
uint32 psm = o->psm;
//uint32 bw = o->bw;
uint32 bp = off->bp;
uint32 psm = off->psm;
//uint32 bw = off->bw;
// No depth handling please.
if (psm == PSM_PSMZ32 || psm == PSM_PSMZ24 || psm == PSM_PSMZ16 || psm == PSM_PSMZ16S)
@ -698,10 +698,10 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
//{
// for(int dx = 0; dx < dw; dx += blockWidth)
// {
// int o = dy * dw / blockHeight + dx;
// int off = dy * dw / blockHeight + dx;
// int sx = o % sw;
// int sy = o / sw;
// int sx = off % sw;
// int sy = off / sw;
// GSVector4 sr = GSVector4(GSVector4i(sx, sy).xyxy() + br) * scale / size;
// GSVector4 dr = GSVector4(GSVector4i(dx, dy).xyxy() + br) * scale;
@ -951,7 +951,7 @@ void GSTextureCache::Source::Update(const GSVector4i& rect)
m_complete = true; // lame, but better than nothing
}
const GSOffset* o = m_renderer->m_context->offset.tex;
const GSOffset* off = m_renderer->m_context->offset.tex;
uint32 blocks = 0;
@ -959,11 +959,11 @@ void GSTextureCache::Source::Update(const GSVector4i& rect)
{
for(int y = r.top; y < r.bottom; y += bs.y)
{
uint32 base = o->block.row[y >> 3];
uint32 base = off->block.row[y >> 3];
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 + off->block.col[x >> 3];
if(block < MAX_BLOCKS)
{
@ -988,11 +988,11 @@ void GSTextureCache::Source::Update(const GSVector4i& rect)
{
for(int y = r.top; y < r.bottom; y += bs.y)
{
uint32 base = o->block.row[y >> 3];
uint32 base = off->block.row[y >> 3];
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + o->block.col[x >> 3];
uint32 block = base + off->block.col[x >> 3];
if(block < MAX_BLOCKS)
{
@ -1071,7 +1071,7 @@ void GSTextureCache::Source::Flush(uint32 count)
GSLocalMemory& mem = m_renderer->m_mem;
const GSOffset* o = m_renderer->m_context->offset.tex;
const GSOffset* off = m_renderer->m_context->offset.tex;
GSLocalMemory::readTexture rtx = psm.rtx;
@ -1095,7 +1095,7 @@ void GSTextureCache::Source::Flush(uint32 count)
if((r > tr).mask() & 0xff00)
{
(mem.*rtx)(o, r, buff, pitch, m_TEXA);
(mem.*rtx)(off, r, buff, pitch, m_TEXA);
m_texture->Update(r.rintersect(tr), buff, pitch);
}
@ -1105,13 +1105,13 @@ void GSTextureCache::Source::Flush(uint32 count)
if(m_texture->Map(m, &r))
{
(mem.*rtx)(o, r, m.bits, m.pitch, plainTEXA);
(mem.*rtx)(off, r, m.bits, m.pitch, plainTEXA);
m_texture->Unmap();
}
else
{
(mem.*rtx)(o, r, buff, pitch, plainTEXA);
(mem.*rtx)(off, r, buff, pitch, plainTEXA);
m_texture->Update(r, buff, pitch);
}
@ -1156,7 +1156,7 @@ void GSTextureCache::Target::Update()
if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h))
{
const GSOffset* o = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM);
const GSOffset* off = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM);
GIFRegTEXA TEXA;
@ -1168,7 +1168,7 @@ void GSTextureCache::Target::Update()
if(t->Map(m))
{
m_renderer->m_mem.ReadTexture(o, r, m.bits, m.pitch, TEXA);
m_renderer->m_mem.ReadTexture(off, r, m.bits, m.pitch, TEXA);
t->Unmap();
}
@ -1176,7 +1176,7 @@ void GSTextureCache::Target::Update()
{
int pitch = ((w + 3) & ~3) * 4;
m_renderer->m_mem.ReadTexture(o, r, m_temp, pitch, TEXA);
m_renderer->m_mem.ReadTexture(off, r, m_temp, pitch, TEXA);
t->Update(r.rsize(), m_temp, pitch);
}
@ -1201,7 +1201,7 @@ void GSTextureCache::Target::Update()
// GSTextureCache::SourceMap
void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* o)
void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* off)
{
m_surfaces.insert(s);
@ -1228,11 +1228,11 @@ void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, const GSO
for(int y = 0; y < th; y += bs.y)
{
uint32 base = o->block.row[y >> 3];
uint32 base = off->block.row[y >> 3];
for(int x = 0; x < tw; x += bs.x)
{
uint32 page = (base + o->block.col[x >> 3]) >> 5;
uint32 page = (base + off->block.col[x >> 3]) >> 5;
if(page < MAX_PAGES)
{

View File

@ -98,7 +98,7 @@ public:
SourceMap() : m_used(false) {memset(m_pages, 0, sizeof(m_pages));}
void Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* o);
void Add(Source* s, const GIFRegTEX0& TEX0, const GSOffset* off);
void RemoveAll();
void RemoveAt(Source* s);
};
@ -134,8 +134,8 @@ public:
Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h, int type, bool used);
Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h);
void InvalidateVideoMem(GSOffset* o, const GSVector4i& r, bool target = true);
void InvalidateLocalMem(GSOffset* o, const GSVector4i& r);
void InvalidateVideoMem(GSOffset* off, const GSVector4i& r, bool target = true);
void InvalidateLocalMem(GSOffset* off, const GSVector4i& r);
void IncAge();
bool UserHacks_HalfPixelOffset;

View File

@ -72,19 +72,19 @@ void GSTextureCache11::Read(Target* t, const GSVector4i& r)
{
// TODO: block level write
GSOffset* o = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
GSOffset* off = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
switch(TEX0.PSM)
{
case PSM_PSMCT32:
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT24:
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
m_renderer->m_mem.WritePixel16(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel16(m.bits, m.pitch, off, r);
break;
default:
ASSERT(0);

View File

@ -70,19 +70,19 @@ void GSTextureCache9::Read(Target* t, const GSVector4i& r)
{
// TODO: block level write
GSOffset* o = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
GSOffset* off = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
switch(TEX0.PSM)
{
case PSM_PSMCT32:
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT24:
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
m_renderer->m_mem.WriteFrame16(m.bits, m.pitch, o, r);
m_renderer->m_mem.WriteFrame16(m.bits, m.pitch, off, r);
break;
default:
ASSERT(0);

View File

@ -77,19 +77,19 @@ void GSTextureCacheOGL::Read(Target* t, const GSVector4i& r)
{
// TODO: block level write
GSOffset* o = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
GSOffset* off = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
switch(TEX0.PSM)
{
case PSM_PSMCT32:
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT24:
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
m_renderer->m_mem.WritePixel16(m.bits, m.pitch, o, r);
m_renderer->m_mem.WritePixel16(m.bits, m.pitch, off, r);
break;
default:
ASSERT(0);

View File

@ -251,7 +251,7 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
GSLocalMemory& mem = m_state->m_mem;
const GSOffset* RESTRICT o = m_offset;
const GSOffset* RESTRICT off = m_offset;
uint32 blocks = 0;
@ -274,11 +274,11 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
{
for(int y = r.top; y < r.bottom; y += bs.y, dst += block_pitch)
{
uint32 base = o->block.row[y];
uint32 base = off->block.row[y];
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 + off->block.col[x];
if(block < MAX_BLOCKS)
{
@ -301,11 +301,11 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)
{
for(int y = r.top; y < r.bottom; y += bs.y, dst += block_pitch)
{
uint32 base = o->block.row[y];
uint32 base = off->block.row[y];
for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + o->block.col[x];
uint32 block = base + off->block.col[x];
if(block < MAX_BLOCKS)
{

View File

@ -445,11 +445,11 @@ void GSVertexTrace::FindMinMax(const void* vertex, const uint32* index, int coun
#endif
GSVector4 o(context->XYOFFSET);
GSVector4 off(context->XYOFFSET);
GSVector4 s(1.0f / 16, 1.0f / 16, 2.0f, 1.0f);
m_min.p = (GSVector4(pmin) - o) * s;
m_max.p = (GSVector4(pmax) - o) * s;
m_min.p = (GSVector4(pmin) - off) * s;
m_max.p = (GSVector4(pmax) - off) * s;
if(tme)
{

View File

@ -113,10 +113,10 @@ void* _aligned_malloc(size_t size, size_t alignment)
{
ASSERT(alignment <= 0x8000);
size_t r = (size_t)malloc(size + --alignment + 2);
size_t o = (r + 2 + alignment) & ~(size_t)alignment;
size_t off = (r + 2 + alignment) & ~(size_t)alignment;
if(!r) return NULL;
((uint16*)o)[-1] = (uint16)(o-r);
return (void*)o;
((uint16*)off)[-1] = (uint16)(off-r);
return (void*)off;
}
void _aligned_free(void* p)