gsdx tc: extend the wrap option to the texture cache

This commit is contained in:
Gregory Hainaut 2017-01-22 22:27:38 +01:00
parent bf10873405
commit 09b8aaed71
2 changed files with 9 additions and 3 deletions

View File

@ -24,6 +24,7 @@
bool s_IS_OPENGL = false; bool s_IS_OPENGL = false;
bool GSTextureCache::m_disable_partial_invalidation = false; bool GSTextureCache::m_disable_partial_invalidation = false;
bool GSTextureCache::m_wrap_gs_mem = false;
GSTextureCache::GSTextureCache(GSRenderer* r) GSTextureCache::GSTextureCache(GSRenderer* r)
: m_renderer(r) : m_renderer(r)
@ -46,6 +47,8 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
m_texture_inside_rt = false; m_texture_inside_rt = false;
} }
m_wrap_gs_mem = theApp.GetConfigB("wrap_gs_mem");
m_paltex = theApp.GetConfigB("paltex"); m_paltex = theApp.GetConfigB("paltex");
m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far
m_crc_hack_level = theApp.GetConfigI("crc_hack_level"); m_crc_hack_level = theApp.GetConfigI("crc_hack_level");
@ -1657,9 +1660,9 @@ void GSTextureCache::Source::Update(const GSVector4i& rect, int layer)
{ {
uint32 block = base + off->block.col[x >> 3]; uint32 block = base + off->block.col[x >> 3];
if(block < MAX_BLOCKS) if(block < MAX_BLOCKS || m_wrap_gs_mem)
{ {
uint32 addr = i >> 3; uint32 addr = (i >> 3) % MAX_BLOCKS;
uint32 row = addr >> 5; uint32 row = addr >> 5;
uint32 col = 1 << (addr & 31); uint32 col = 1 << (addr & 31);
@ -1686,8 +1689,10 @@ void GSTextureCache::Source::Update(const GSVector4i& rect, int layer)
{ {
uint32 block = base + off->block.col[x >> 3]; uint32 block = base + off->block.col[x >> 3];
if(block < MAX_BLOCKS) if(block < MAX_BLOCKS || m_wrap_gs_mem)
{ {
block %= MAX_BLOCKS;
uint32 row = block >> 5; uint32 row = block >> 5;
uint32 col = 1 << (block & 31); uint32 col = 1 << (block & 31);

View File

@ -132,6 +132,7 @@ protected:
int m_crc_hack_level; int m_crc_hack_level;
static bool m_disable_partial_invalidation; static bool m_disable_partial_invalidation;
bool m_texture_inside_rt; bool m_texture_inside_rt;
static bool m_wrap_gs_mem;
virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false, int x_offset = 0, int y_offset = 0); virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false, int x_offset = 0, int y_offset = 0);
virtual Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type); virtual Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type);