From f787483dbb8467d093ceccd8e460319bbb16d507 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sat, 12 Jan 2019 14:34:00 +0700 Subject: [PATCH] Correct condition for uEnableDepth uniform. Fixed depth compare for particles in Indiana Jones when N64 depth compare enabled, #1977 --- .../GLSL/glsl_CombinerProgramUniformFactory.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp index 56be0719..4a0903c8 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactory.cpp @@ -611,15 +611,15 @@ public: if (pBuffer == nullptr || pBuffer->m_pDepthBuffer == nullptr) return; - const int nDepthEnabled = (gSP.geometryMode & G_ZBUFFER) > 0 ? 1 : 0; - uEnableDepth.set(nDepthEnabled, _force); - if (nDepthEnabled == 0) { - uEnableDepthCompare.set(0, _force); - uEnableDepthUpdate.set(0, _force); - } - else { + const bool nDepthEnabled = ((gSP.geometryMode & G_ZBUFFER) || gDP.otherMode.depthSource == G_ZS_PRIM) && + gDP.otherMode.cycleType <= G_CYC_2CYCLE; + uEnableDepth.set(nDepthEnabled ? 1 : 0, _force); + if (nDepthEnabled) { uEnableDepthCompare.set(gDP.otherMode.depthCompare, _force); uEnableDepthUpdate.set(gDP.otherMode.depthUpdate, _force); + } else { + uEnableDepthCompare.set(0, _force); + uEnableDepthUpdate.set(0, _force); } uDepthMode.set(gDP.otherMode.depthMode, _force); uDepthSource.set(gDP.otherMode.depthSource, _force);