gsdx-tc: add an option to avoid blow up dx :p

texture_cache_depth = 1 (default for openGL)
This commit is contained in:
Gregory Hainaut 2015-06-07 18:42:30 +02:00
parent 74d84aafb5
commit 76160505f7
4 changed files with 14 additions and 2 deletions

View File

@ -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<Target*>::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<Target*>::iterator i = m_dst[type].begin(); i != m_dst[type].end(); i++)
{
Target* t = *i;

View File

@ -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();

View File

@ -31,6 +31,8 @@ protected:
void Read(Target* t, const GSVector4i& r);
virtual bool CanConvertDepth() { return false; }
public:
GSTextureCache11(GSRenderer* r);
};

View File

@ -31,6 +31,8 @@ protected:
void Read(Target* t, const GSVector4i& r);
virtual bool CanConvertDepth() { return false; }
public:
GSTextureCache9(GSRenderer* r);
};