From 71caf75b7a0b2c5d6429c3fb9363e8d622de2db7 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Fri, 13 May 2016 18:09:24 +0600 Subject: [PATCH] Don't add blending to shaders for COPY and FILL cycle modes. --- src/GLES2/GLSLCombiner_gles2.cpp | 14 ++++++++------ src/OGL3X/GLSLCombiner_ogl3x.cpp | 14 ++++++++------ src/ShaderUtils.cpp | 5 +++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/GLES2/GLSLCombiner_gles2.cpp b/src/GLES2/GLSLCombiner_gles2.cpp index b257294f..13985d19 100644 --- a/src/GLES2/GLSLCombiner_gles2.cpp +++ b/src/GLES2/GLSLCombiner_gles2.cpp @@ -330,15 +330,17 @@ void ShaderCombiner::updateFogMode(bool _bForce) void ShaderCombiner::updateBlendMode(bool _bForce) { - m_uniforms.uBlendMux1.set(gDP.otherMode.c1_m1a, - gDP.otherMode.c1_m1b, - gDP.otherMode.c1_m2a, - gDP.otherMode.c1_m2b, - _bForce); + if (gDP.otherMode.cycleType <= G_CYC_2CYCLE) { + m_uniforms.uBlendMux1.set(gDP.otherMode.c1_m1a, + gDP.otherMode.c1_m1b, + gDP.otherMode.c1_m2a, + gDP.otherMode.c1_m2b, + _bForce); + } int forceBlend1 = gDP.otherMode.cycleType == G_CYC_2CYCLE ? 1 : 0; int forceBlend2 = 0; - if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) { + if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType <= G_CYC_2CYCLE) { forceBlend1 = 1; if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { forceBlend2 = 1; diff --git a/src/OGL3X/GLSLCombiner_ogl3x.cpp b/src/OGL3X/GLSLCombiner_ogl3x.cpp index 6adb7987..7eeb56cb 100644 --- a/src/OGL3X/GLSLCombiner_ogl3x.cpp +++ b/src/OGL3X/GLSLCombiner_ogl3x.cpp @@ -635,15 +635,17 @@ void ShaderCombiner::updateFogMode(bool _bForce) void ShaderCombiner::updateBlendMode(bool _bForce) { - m_uniforms.uBlendMux1.set(gDP.otherMode.c1_m1a, - gDP.otherMode.c1_m1b, - gDP.otherMode.c1_m2a, - gDP.otherMode.c1_m2b, - _bForce); + if (gDP.otherMode.cycleType <= G_CYC_2CYCLE) { + m_uniforms.uBlendMux1.set(gDP.otherMode.c1_m1a, + gDP.otherMode.c1_m1b, + gDP.otherMode.c1_m2a, + gDP.otherMode.c1_m2b, + _bForce); + } int forceBlend1 = gDP.otherMode.cycleType == G_CYC_2CYCLE ? 1 : 0; int forceBlend2 = 0; - if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) { + if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType <= G_CYC_2CYCLE) { forceBlend1 = 1; if (gDP.otherMode.cycleType == G_CYC_2CYCLE) { forceBlend2 = 1; diff --git a/src/ShaderUtils.cpp b/src/ShaderUtils.cpp index 92c1d7c9..e89e12ea 100644 --- a/src/ShaderUtils.cpp +++ b/src/ShaderUtils.cpp @@ -308,13 +308,14 @@ int compileCombiner(Combiner & _color, Combiner & _alpha, std::string & _strShad } #endif - _strShader.append(fragment_shader_blender1); + if (gDP.otherMode.cycleType <= G_CYC_2CYCLE) + _strShader.append(fragment_shader_blender1); if (gDP.otherMode.cycleType == G_CYC_2CYCLE) _strShader.append(fragment_shader_blender2); _strShader.append( " fragColor = vec4(color2, alpha2); \n" - ); + ); return nInputs; }