mirror of
https://github.com/libretro/pcsx2.git
synced 2024-12-19 08:06:40 +00:00
gsdx sw: wrap GS memory
Cost ought to remain small. Worst case is 2 extra "and" operation by group of pixels in scanline renderer I think PixelAddressN functions are mostly call in the init.
This commit is contained in:
parent
233f66db5e
commit
aa4b2d9f3a
@ -24,6 +24,7 @@
|
||||
#define PLUGIN_VERSION 0
|
||||
|
||||
#define VM_SIZE 4194304
|
||||
#define HALF_VM_SIZE (VM_SIZE / 2)
|
||||
#define PAGE_SIZE 8192
|
||||
#define BLOCK_SIZE 256
|
||||
#define COLUMN_SIZE 64
|
||||
|
@ -532,7 +532,7 @@ void GSDrawScanline::DrawScanline(int pixels, int left, int top, const GSVertexS
|
||||
|
||||
if(sel.zb)
|
||||
{
|
||||
za = fza_base->y + fza_offset->y;
|
||||
za = (fza_base->y + fza_offset->y) % HALF_VM_SIZE;
|
||||
|
||||
if(sel.prim != GS_SPRITE_CLASS)
|
||||
{
|
||||
@ -1130,7 +1130,7 @@ void GSDrawScanline::DrawScanline(int pixels, int left, int top, const GSVertexS
|
||||
|
||||
if(sel.fb)
|
||||
{
|
||||
fa = fza_base->x + fza_offset->x;
|
||||
fa = (fza_base->x + fza_offset->x) % HALF_VM_SIZE;
|
||||
|
||||
if(sel.rfb)
|
||||
{
|
||||
@ -1646,7 +1646,7 @@ void GSDrawScanline::DrawScanline(int pixels, int left, int top, const GSVertexS
|
||||
|
||||
if(sel.zb)
|
||||
{
|
||||
za = fza_base->y + fza_offset->y;
|
||||
za = (fza_base->y + fza_offset->y) % HALF_VM_SIZE;
|
||||
|
||||
if(sel.prim != GS_SPRITE_CLASS)
|
||||
{
|
||||
@ -2249,7 +2249,7 @@ void GSDrawScanline::DrawScanline(int pixels, int left, int top, const GSVertexS
|
||||
|
||||
if(sel.fb)
|
||||
{
|
||||
fa = fza_base->x + fza_offset->x;
|
||||
fa = (fza_base->x + fza_offset->x) % HALF_VM_SIZE;
|
||||
|
||||
if(sel.rfb)
|
||||
{
|
||||
|
@ -607,6 +607,7 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2)
|
||||
|
||||
mov(ebp, ptr[esi + 4]);
|
||||
add(ebp, ptr[edi + 4]);
|
||||
and(ebp, HALF_VM_SIZE - 1);
|
||||
|
||||
// GSVector4i zs = zi;
|
||||
|
||||
@ -2292,6 +2293,7 @@ void GSDrawScanlineCodeGenerator::ReadFrame()
|
||||
|
||||
mov(ebx, ptr[esi]);
|
||||
add(ebx, ptr[edi]);
|
||||
and(ebx, HALF_VM_SIZE - 1);
|
||||
|
||||
if(!m_sel.rfb)
|
||||
{
|
||||
@ -2903,4 +2905,4 @@ void GSDrawScanlineCodeGenerator::ReadTexel(const Xmm& dst, const Xmm& addr, uin
|
||||
else vpinsrd(dst, src, i);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -608,6 +608,7 @@ void GSDrawScanlineCodeGenerator::TestZ(const Ymm& temp1, const Ymm& temp2)
|
||||
|
||||
mov(ebp, ptr[esi + 4]);
|
||||
add(ebp, ptr[edi + 4]);
|
||||
and(ebp, HALF_VM_SIZE - 1);
|
||||
|
||||
// GSVector8i zs = zi;
|
||||
|
||||
@ -2257,6 +2258,7 @@ void GSDrawScanlineCodeGenerator::ReadFrame()
|
||||
|
||||
mov(ebx, ptr[esi]);
|
||||
add(ebx, ptr[edi]);
|
||||
and(ebx, HALF_VM_SIZE - 1);
|
||||
|
||||
if(!m_sel.rfb)
|
||||
{
|
||||
@ -2952,4 +2954,4 @@ void GSDrawScanlineCodeGenerator::ReadTexel(const Ymm& dst, const Ymm& addr, uin
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -611,6 +611,7 @@ void GSDrawScanlineCodeGenerator::TestZ(const Xmm& temp1, const Xmm& temp2)
|
||||
|
||||
mov(ebp, ptr[esi + 4]);
|
||||
add(ebp, ptr[edi + 4]);
|
||||
and(ebp, HALF_VM_SIZE - 1);
|
||||
|
||||
// GSVector4i zs = zi;
|
||||
|
||||
@ -2360,6 +2361,7 @@ void GSDrawScanlineCodeGenerator::ReadFrame()
|
||||
|
||||
mov(ebx, ptr[esi]);
|
||||
add(ebx, ptr[edi]);
|
||||
and(ebx, HALF_VM_SIZE - 1);
|
||||
|
||||
if(!m_sel.rfb)
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress32(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 5) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 11) + pageOffset32[bp & 0x1f][y & 0x1f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
@ -327,7 +327,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress16(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 6) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 12) + pageOffset16[bp & 0x1f][y & 0x3f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
@ -335,7 +335,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress16S(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 6) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 12) + pageOffset16S[bp & 0x1f][y & 0x3f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
@ -345,7 +345,7 @@ public:
|
||||
{
|
||||
// ASSERT((bw & 1) == 0); // allowed for mipmap levels
|
||||
|
||||
uint32 page = (bp >> 5) + (y >> 6) * (bw >> 1) + (x >> 7);
|
||||
uint32 page = ((bp >> 5) + (y >> 6) * (bw >> 1) + (x >> 7)) % MAX_PAGES;
|
||||
uint32 word = (page << 13) + pageOffset8[bp & 0x1f][y & 0x3f][x & 0x7f];
|
||||
|
||||
return word;
|
||||
@ -355,7 +355,7 @@ public:
|
||||
{
|
||||
// ASSERT((bw & 1) == 0); // allowed for mipmap levels
|
||||
|
||||
uint32 page = (bp >> 5) + (y >> 7) * (bw >> 1) + (x >> 7);
|
||||
uint32 page = ((bp >> 5) + (y >> 7) * (bw >> 1) + (x >> 7)) % MAX_PAGES;
|
||||
uint32 word = (page << 14) + pageOffset4[bp & 0x1f][y & 0x7f][x & 0x7f];
|
||||
|
||||
return word;
|
||||
@ -363,7 +363,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress32Z(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 5) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 5) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 11) + pageOffset32Z[bp & 0x1f][y & 0x1f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
@ -371,7 +371,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress16Z(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 6) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 12) + pageOffset16Z[bp & 0x1f][y & 0x3f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
@ -379,7 +379,7 @@ public:
|
||||
|
||||
static __forceinline uint32 PixelAddress16SZ(int x, int y, uint32 bp, uint32 bw)
|
||||
{
|
||||
uint32 page = (bp >> 5) + (y >> 6) * bw + (x >> 6);
|
||||
uint32 page = ((bp >> 5) + (y >> 6) * bw + (x >> 6)) % MAX_PAGES;
|
||||
uint32 word = (page << 12) + pageOffset16SZ[bp & 0x1f][y & 0x3f][x & 0x3f];
|
||||
|
||||
return word;
|
||||
|
Loading…
Reference in New Issue
Block a user