diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 85b51c26eb..5ce6f6bef7 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -30,6 +30,8 @@ GSTextureCache::GSTextureCache(GSRenderer* r) UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks", 0) && !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0); m_paltex = !!theApp.GetConfig("paltex", 0); + m_can_convert_depth = theApp.GetConfig("texture_cache_depth", 1); + m_temp = (uint8*)_aligned_malloc(1024 * 1024 * sizeof(uint32), 32); } @@ -144,7 +146,7 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con } } - if (dst == NULL) { + if (dst == NULL && CanConvertDepth()) { // Let's try a trick to avoid to use wrongly a depth buffer // Unfortunately, I don't have any Arc the Lad testcase // @@ -240,7 +242,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int dst->Update(); } else { - if (type == DepthStencil) { + if (type == DepthStencil && CanConvertDepth()) { // Depth stencil can be an older RT but only check recent RT to avoid to pick // some bad data. for(list::iterator i = m_dst[RenderTarget].begin(); i != m_dst[RenderTarget].end(); i++) @@ -377,6 +379,9 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int // must invalidate the Target/Depth respectively void GSTextureCache::InvalidateVideoMemType(int type, uint32 bp) { + if (!CanConvertDepth()) + return; + for(list::iterator i = m_dst[type].begin(); i != m_dst[type].end(); i++) { Target* t = *i; diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 0879c63a64..39a64368b6 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -110,6 +110,7 @@ protected: bool m_paltex; int m_spritehack; uint8* m_temp; + bool m_can_convert_depth; virtual Source* CreateSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, Target* t = NULL, bool half_right = false); virtual Target* CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type); @@ -122,6 +123,8 @@ protected: virtual void Read(Target* t, const GSVector4i& r) = 0; #endif + virtual bool CanConvertDepth() { return m_can_convert_depth; } + public: GSTextureCache(GSRenderer* r); virtual ~GSTextureCache(); diff --git a/plugins/GSdx/GSTextureCache11.h b/plugins/GSdx/GSTextureCache11.h index 9e0522d784..d110dbe156 100644 --- a/plugins/GSdx/GSTextureCache11.h +++ b/plugins/GSdx/GSTextureCache11.h @@ -31,6 +31,8 @@ protected: void Read(Target* t, const GSVector4i& r); + virtual bool CanConvertDepth() { return false; } + public: GSTextureCache11(GSRenderer* r); }; diff --git a/plugins/GSdx/GSTextureCache9.h b/plugins/GSdx/GSTextureCache9.h index 67a0d89200..1fbf701860 100644 --- a/plugins/GSdx/GSTextureCache9.h +++ b/plugins/GSdx/GSTextureCache9.h @@ -31,6 +31,8 @@ protected: void Read(Target* t, const GSVector4i& r); + virtual bool CanConvertDepth() { return false; } + public: GSTextureCache9(GSRenderer* r); };