diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index fa72ddc9c9..e6ceb8e145 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -71,12 +71,24 @@ static bool IsAlphaTestTriviallyTrue() { case GE_COMP_NOTEQUAL: case GE_COMP_GREATER: { - return (!gstate.isStencilTestEnabled() && +#if 0 + // Easy way to check the values in the debugger without ruining && early-out + bool doTextureAlpha = gstate.isTextureAlphaUsed(); + bool stencilTest = gstate.isStencilTestEnabled(); + bool depthTest = gstate.isDepthTestEnabled(); + GEComparison depthTestFunc = gstate.getDepthTestFunction(); + int alphaRef = gstate.getAlphaTestRef(); + int blendA = gstate.getBlendFuncA(); + bool blendEnabled = gstate.isAlphaBlendEnabled(); + int blendB = gstate.getBlendFuncA(); +#endif + return (gstate_c.vertexFullAlpha && (gstate_c.textureFullAlpha || !gstate.isTextureAlphaUsed())) || ( + (!gstate.isStencilTestEnabled() && !gstate.isDepthTestEnabled() && gstate.getAlphaTestRef() == 0 && gstate.isAlphaBlendEnabled() && gstate.getBlendFuncA() == GE_SRCBLEND_SRCALPHA && - safeDestFactors[(int)gstate.getBlendFuncB()]); + safeDestFactors[(int)gstate.getBlendFuncB()])); } case GE_COMP_LEQUAL: diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 1f4ead277a..ab2174aefd 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -265,6 +265,11 @@ void TransformDrawEngine::SetupVertexDecoder(u32 vertType) { if (vertTypeID != lastVType_) { dec_ = GetVertexDecoder(vertTypeID); lastVType_ = vertTypeID; + + // TODO: Add functionality to VertexDecoder to scan for non-full alpha in the two other formats, + // which are quite common. + int colorType = vertTypeID & GE_VTYPE_COL_MASK; + gstate_c.vertexFullAlpha = colorType == GE_VTYPE_COL_NONE || colorType == GE_VTYPE_COL_565; } } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 691308b38c..f7533097e4 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -441,6 +441,7 @@ struct GPUStateCache bool textureChanged; bool textureFullAlpha; + bool vertexFullAlpha; bool framebufChanged; int skipDrawReason;