diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index d0dffb4231..f19df34409 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -626,7 +626,6 @@ GLuint GSDeviceOGL::CompilePS(PSSelector sel) + format("#define PS_LTF %d\n", sel.ltf) + format("#define PS_COLCLIP %d\n", sel.colclip) + format("#define PS_DATE %d\n", sel.date) - + format("#define PS_SPRITEHACK %d\n", sel.spritehack) + format("#define PS_TCOFFSETHACK %d\n", sel.tcoffsethack) //+ format("#define PS_POINT_SAMPLER %d\n", sel.point_sampler) + format("#define PS_IIP %d\n", sel.iip) diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 8f41c22589..69f634c2ac 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -305,7 +305,6 @@ class GSDeviceOGL : public GSDevice uint32 fba:1; uint32 aout:1; uint32 date:3; - uint32 spritehack:1; uint32 tcoffsethack:1; //uint32 point_sampler:1; Not tested, so keep the bit for blend uint32 iip:1; @@ -319,14 +318,14 @@ class GSDeviceOGL : public GSDevice uint32 wmt:2; uint32 ltf:1; - uint32 _free:3; + uint32 _free:4; }; uint32 key; }; // FIXME is the & useful ? - operator uint32() {return key & 0x1fffffff;} + operator uint32() {return key & 0x0fffffff;} PSSelector() : key(0) {} }; diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 69b297fd8a..b57ceca219 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -447,6 +447,8 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // By default don't use texture ps_sel.tfx = 4; + bool spritehack = false; + int atst = ps_sel.atst; if(tex) { @@ -464,7 +466,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour ps_sel.tfx = context->TEX0.TFX; ps_sel.tcc = context->TEX0.TCC; ps_sel.ltf = bilinear && !simple_sample; - ps_sel.spritehack = tex->m_spritehack_t; + spritehack = tex->m_spritehack_t; // FIXME the ati is currently disabled on the shader. I need to find a .gs to test that we got same // bug on opengl // FIXME for the moment disable it on subroutine (it will kill my perf for nothings) @@ -518,6 +520,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour dev->PSSetShaderResource(0, tex->m_texture); } } + + if (spritehack && (ps_sel.atst == 2)) { + ps_sel.atst = 1; + } } // WARNING: setup of the program must be done first. So you can setup @@ -603,7 +609,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour static const uint32 iatst[] = {1, 0, 5, 6, 7, 2, 3, 4}; - ps_sel.atst = iatst[ps_sel.atst]; + ps_sel.atst = iatst[atst]; + if (spritehack && (ps_sel.atst == 2)) { + ps_sel.atst = 1; + } dev->SetupPS(ps_sel); diff --git a/plugins/GSdx/res/glsl/tfx_fs.glsl b/plugins/GSdx/res/glsl/tfx_fs.glsl index cb51f40165..5fe38025a6 100644 --- a/plugins/GSdx/res/glsl/tfx_fs.glsl +++ b/plugins/GSdx/res/glsl/tfx_fs.glsl @@ -325,7 +325,7 @@ void atst(vec4 c) discard; #elif (PS_ATST == 1) // always // nothing to do -#elif (PS_ATST == 2) && (PS_SPRITEHACK == 0) // l +#elif (PS_ATST == 2) // l if ((AREF - a - 0.5f) < 0.0f) discard; #elif (PS_ATST == 3 ) // le diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index f490f25342..4e4ec35a3b 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -1046,7 +1046,7 @@ static const char* tfx_fs_all_glsl = " discard;\n" "#elif (PS_ATST == 1) // always\n" " // nothing to do\n" - "#elif (PS_ATST == 2) && (PS_SPRITEHACK == 0) // l\n" + "#elif (PS_ATST == 2) // l\n" " if ((AREF - a - 0.5f) < 0.0f)\n" " discard;\n" "#elif (PS_ATST == 3 ) // le\n"