diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp index 2ebe24e4..def82f4a 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp @@ -1535,20 +1535,20 @@ public: } else { if (_glinfo.isGLESX && _glinfo.noPerspective) { m_part = - "highp float writeDepth() \n" - "{ \n" - " if (uClampMode == 1 && (vZCoord > 1.0)) discard; \n" - " highp float depth = uDepthSource == 0 ? (vZCoord - uPolygonOffset) : uPrimDepth; \n" - " return clamp(depth * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" + "highp float writeDepth() \n" + "{ \n" + " if (uClampMode == 1 && (vZCoord > 1.0)) discard; \n" + " if (uDepthSource != 0) return uPrimDepth; \n" + " return clamp((vZCoord - uPolygonOffset) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" + "} \n" ; } else { m_part = - "highp float writeDepth() \n" - "{ \n" - " highp float depth = uDepthSource == 0 ? (gl_FragCoord.z * 2.0 - 1.0) : uPrimDepth; \n" - " return clamp(depth * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" - "} \n" + "highp float writeDepth() \n" + "{ \n" + " if (uDepthSource != 0) return uPrimDepth; \n" + " return clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n" + "} \n" ; } } diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h b/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h index bcb2df04..95028291 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h +++ b/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h @@ -20,7 +20,7 @@ namespace glsl { bool _saveCombinerKeys(const graphics::Combiners & _combiners) const; bool _loadFromCombinerKeys(graphics::Combiners & _combiners); - const u32 m_formatVersion = 0x21U; + const u32 m_formatVersion = 0x22U; const u32 m_keysFormatVersion = 0x04; const opengl::GLInfo & m_glinfo; opengl::CachedUseProgram * m_useProgram; diff --git a/src/gDP.cpp b/src/gDP.cpp index d2124965..d42f6f3e 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -69,12 +69,8 @@ void gDPSetOtherMode( u32 mode0, u32 mode1 ) void gDPSetPrimDepth( u16 z, u16 dz ) { - if (gSP.viewport.vscale[2] == 0) - gDP.primDepth.z = _FIXED2FLOAT(_SHIFTR(z, 0, 15), 15); - else - gDP.primDepth.z = min(1.0f, max(-1.0f, (_FIXED2FLOAT(_SHIFTR(z, 0, 15), 15) - gSP.viewport.vtrans[2]) / gSP.viewport.vscale[2])); + gDP.primDepth.z = _FIXED2FLOAT(_SHIFTR(z, 0, 15), 15); gDP.primDepth.deltaZ = _FIXED2FLOAT(_SHIFTR(dz, 0, 15), 15); - DebugMsg( DEBUG_NORMAL, "gDPSetPrimDepth( %f, %f );\n", gDP.primDepth.z, gDP.primDepth.deltaZ); }