From 2df1db4c7ef30ebb87f4b9e45af9e0677a27f968 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 7 Dec 2013 23:24:25 -0800 Subject: [PATCH] Avoid optimizing out both constant colors. --- GPU/GLES/StateMapping.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 281a056116..f22a94762d 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -236,9 +236,18 @@ void TransformDrawEngine::ApplyDrawState(int prim) { glstate.blendColor.set(blendColor); } } - } else if (constantAlpha < 1.0f) { - const float blendColor[4] = {1.0f, 1.0f, 1.0f, constantAlpha}; - glstate.blendColor.set(blendColor); + } else { + // We optimized both, but that's probably not necessary, so let's pick one to be constant. + // For now let's just pick whichever was fixed instead of checking error. + if (blendFuncA == GE_SRCBLEND_FIXA) { + glBlendFuncA = GL_CONSTANT_COLOR; + const float blendColor[4] = {fixA.x, fixA.y, fixA.z, constantAlpha}; + glstate.blendColor.set(blendColor); + } else { + glBlendFuncB = GL_CONSTANT_COLOR; + const float blendColor[4] = {fixB.x, fixB.y, fixB.z, constantAlpha}; + glstate.blendColor.set(blendColor); + } } } else if (constantAlpha < 1.0f) { const float blendColor[4] = {1.0f, 1.0f, 1.0f, constantAlpha};