Skip to content

Commit

Permalink
gsdx: wrap gs page/block instead to skip them
Browse files Browse the repository at this point in the history
Fix FMV of Thrillville when coupled with wrap_gs_mem = 1
  • Loading branch information
gregory38 committed Oct 25, 2016
1 parent db4b4fb commit 5dfb7d6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 43 deletions.
31 changes: 11 additions & 20 deletions plugins/GSdx/GSLocalMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,9 @@ 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 + off->block.col[x >> 3]) >> 5;
uint32 page = ((base + off->block.col[x >> 3]) >> 5) % MAX_PAGES;

if(page < MAX_PAGES)
{
tmp[page].insert(i >> 3); // ((y << 7) | x) >> 3
}
tmp[page].insert(i >> 3); // ((y << 7) | x) >> 3
}
}

Expand Down Expand Up @@ -2114,19 +2111,16 @@ 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;

if(n < MAX_PAGES)
{
uint32& row = tmp[n >> 5];
uint32 col = 1 << (n & 31);
uint32& row = tmp[n >> 5];
uint32 col = 1 << (n & 31);

if((row & col) == 0)
{
row |= col;
if((row & col) == 0)
{
row |= col;

*p++ = n;
}
*p++ = n;
}
}
}
Expand Down Expand Up @@ -2167,12 +2161,9 @@ GSVector4i* GSOffset::GetPagesAsBits(const GSVector4i& rect, GSVector4i* pages,

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;

if(n < MAX_PAGES)
{
((uint32*)pages)[n >> 5] |= 1 << (n & 31);
}
((uint32*)pages)[n >> 5] |= 1 << (n & 31);
}
}

Expand Down
40 changes: 17 additions & 23 deletions plugins/GSdx/GSTextureCacheSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,18 @@ 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 + off->block.col[x];
uint32 block = (base + off->block.col[x]) % MAX_BLOCKS;

if(block < MAX_BLOCKS)
{
uint32 row = i >> 5;
uint32 col = 1 << (i & 31);
uint32 row = i >> 5;
uint32 col = 1 << (i & 31);

if((m_valid[row] & col) == 0)
{
m_valid[row] |= col;
if((m_valid[row] & col) == 0)
{
m_valid[row] |= col;

(mem.*rtxbP)(block, &dst[x << shift], pitch, m_TEXA);
(mem.*rtxbP)(block, &dst[x << shift], pitch, m_TEXA);

blocks++;
}
blocks++;
}
}
}
Expand All @@ -305,21 +302,18 @@ bool GSTextureCacheSW::Texture::Update(const GSVector4i& rect)

for(int x = r.left; x < r.right; x += bs.x)
{
uint32 block = base + off->block.col[x];
uint32 block = (base + off->block.col[x]) % MAX_BLOCKS;

if(block < MAX_BLOCKS)
{
uint32 row = block >> 5;
uint32 col = 1 << (block & 31);
uint32 row = block >> 5;
uint32 col = 1 << (block & 31);

if((m_valid[row] & col) == 0)
{
m_valid[row] |= col;
if((m_valid[row] & col) == 0)
{
m_valid[row] |= col;

(mem.*rtxbP)(block, &dst[x << shift], pitch, m_TEXA);
(mem.*rtxbP)(block, &dst[x << shift], pitch, m_TEXA);

blocks++;
}
blocks++;
}
}
}
Expand Down Expand Up @@ -374,4 +368,4 @@ bool GSTextureCacheSW::Texture::Save(const string& fn, bool dds) const
}

return false;
}
}

0 comments on commit 5dfb7d6

Please sign in to comment.