diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 814af10b40abf..4716943211279 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -653,10 +653,10 @@ void GSDeviceOGL::Barrier(GLbitfield b) } /* Note: must be here because tfx_glsl is static */ -GLuint GSDeviceOGL::CompileVS(VSSelector sel) +GLuint GSDeviceOGL::CompileVS(VSSelector sel, int logz) { std::string macro = format("#define VS_BPPZ %d\n", sel.bppz) - + format("#define VS_LOGZ %d\n", sel.logz) + + format("#define VS_LOGZ %d\n", logz) + format("#define VS_TME %d\n", sel.tme) + format("#define VS_FST %d\n", sel.fst) + format("#define VS_WILDHACK %d\n", sel.wildhack) diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 2676f7eb7a54f..b0cd3166592ba 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -275,7 +275,6 @@ class GSDeviceOGL : public GSDevice { uint32 wildhack:1; uint32 bppz:2; - uint32 logz:1; // Next param will be handle by subroutine uint32 tme:1; uint32 fst:1; @@ -284,12 +283,12 @@ class GSDeviceOGL : public GSDevice uint32 key; }; - operator uint32() {return key & 0x7f;} + operator uint32() {return key & 0x3f;} VSSelector() : key(0) {} VSSelector(uint32 k) : key(k) {} - static uint32 size() { return 1 << 6; } + static uint32 size() { return 1 << 5; } }; __aligned(struct, 32) PSConstantBuffer @@ -612,7 +611,7 @@ class GSDeviceOGL : public GSDevice void OMSetWriteBuffer(GLenum buffer = GL_COLOR_ATTACHMENT0); void CreateTextureFX(); - GLuint CompileVS(VSSelector sel); + GLuint CompileVS(VSSelector sel, int logz); GLuint CompileGS(); GLuint CompilePS(PSSelector sel); GLuint CreateSampler(bool bilinear, bool tau, bool tav); diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 4fabe806e161d..9877346367fde 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -27,7 +27,6 @@ GSRendererOGL::GSRendererOGL() : GSRendererHW(new GSTextureCacheOGL(this)) { - m_logz = !!theApp.GetConfig("logz", 1); m_fba = !!theApp.GetConfig("fba", 1); UserHacks_AlphaHack = !!theApp.GetConfig("UserHacks_AlphaHack", 0) && !!theApp.GetConfig("UserHacks", 0); UserHacks_AlphaStencil = !!theApp.GetConfig("UserHacks_AlphaStencil", 0) && !!theApp.GetConfig("UserHacks", 0); @@ -262,7 +261,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour vs_sel.tme = PRIM->TME; vs_sel.fst = PRIM->FST; - vs_sel.logz = m_logz ? 1 : 0; vs_sel.wildhack = (UserHacks_WildHack && !isPackedUV_HackFlag) ? 1 : 0; // The real GS appears to do no masking based on the Z buffer format and writing larger Z values diff --git a/plugins/GSdx/GSRendererOGL.h b/plugins/GSdx/GSRendererOGL.h index 7c8dd3679b06c..7c6fadaf88dd2 100644 --- a/plugins/GSdx/GSRendererOGL.h +++ b/plugins/GSdx/GSRendererOGL.h @@ -35,7 +35,6 @@ class GSRendererOGL : public GSRendererHW { private: GSVector2 m_pixelcenter; - bool m_logz; bool m_fba; bool UserHacks_AlphaHack; bool UserHacks_AlphaStencil; diff --git a/plugins/GSdx/GSShaderOGL.cpp b/plugins/GSdx/GSShaderOGL.cpp index 7fc5d397a5002..a4873511bc523 100644 --- a/plugins/GSdx/GSShaderOGL.cpp +++ b/plugins/GSdx/GSShaderOGL.cpp @@ -263,7 +263,7 @@ void GSShaderOGL::UseProgram() hash_map::iterator it; // Note: shader are integer lookup pointer. They start from 1 and incr // every time you create a new shader OR a new program. - // Note2: vs & gs are precompiled at startup. FGLRX and radeon got value < 128. + // Note2: vs & gs are precompiled at startup. FGLRX and radeon got value < 128. GS has only 2 programs // We migth be able to pack the value in a 32bits int // I would need to check the behavior on Nvidia (pause/resume). uint64 sel = (uint64)GLState::vs << 40 | (uint64)GLState::gs << 20 | GLState::ps; diff --git a/plugins/GSdx/GSTextureFXOGL.cpp b/plugins/GSdx/GSTextureFXOGL.cpp index df5e2da6af7ad..1ec397a0c2b19 100644 --- a/plugins/GSdx/GSTextureFXOGL.cpp +++ b/plugins/GSdx/GSTextureFXOGL.cpp @@ -39,8 +39,15 @@ void GSDeviceOGL::CreateTextureFX() // It might cost a seconds at startup but it would reduce benchmark pollution m_gs = CompileGS(); - for (uint32 key = 0; key < VSSelector::size(); key++) - m_vs[key] = CompileVS(VSSelector(key)); + int logz = theApp.GetConfig("logz", 1); + for (uint32 key = 0; key < VSSelector::size(); key++) { + // wildhack is only useful if both TME and FST are enabled. + VSSelector sel(key); + if (sel.wildhack && (!sel.tme || !sel.fst)) + m_vs[key] = 0; + else + m_vs[key] = CompileVS(sel, logz); + } for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++) m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));