From 09b8aaed711fc557a5dd7afedeceb7f271f54884 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 22 Jan 2017 22:27:38 +0100 Subject: [PATCH] gsdx tc: extend the wrap option to the texture cache --- plugins/GSdx/GSTextureCache.cpp | 11 ++++++++--- plugins/GSdx/GSTextureCache.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index c2d08f4638..5dd2baea50 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -24,6 +24,7 @@ bool s_IS_OPENGL = false; bool GSTextureCache::m_disable_partial_invalidation = false; +bool GSTextureCache::m_wrap_gs_mem = false; GSTextureCache::GSTextureCache(GSRenderer* r) : m_renderer(r) @@ -46,6 +47,8 @@ GSTextureCache::GSTextureCache(GSRenderer* r) m_texture_inside_rt = false; } + m_wrap_gs_mem = theApp.GetConfigB("wrap_gs_mem"); + m_paltex = theApp.GetConfigB("paltex"); m_can_convert_depth &= s_IS_OPENGL; // only supported by openGL so far 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]; - 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 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]; - if(block < MAX_BLOCKS) + if(block < MAX_BLOCKS || m_wrap_gs_mem) { + block %= MAX_BLOCKS; + uint32 row = block >> 5; uint32 col = 1 << (block & 31); diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 4d87b70bea..a1547542b3 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -132,6 +132,7 @@ protected: int m_crc_hack_level; static bool m_disable_partial_invalidation; 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 Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type);