From 8f27d03af3199bb3b794cbc9d437ffc3ac5e8d51 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 30 Apr 2013 00:04:20 -0700 Subject: [PATCH] Double alpha at least for a known case. Makes Popolocrois look much better now. --- GPU/GLES/FragmentShaderGenerator.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index 5d8632668..ae6e9fb6e 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -86,6 +86,7 @@ void ComputeFragmentShaderID(FragmentShaderID *id) { bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue(); bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue(); bool enableColorDoubling = (gstate.texfunc & 0x10000) != 0; + bool enableAlphaDoubling = gstate.getBlendFuncA() == GE_SRCBLEND_DOUBLESRCALPHA || gstate.getBlendFuncB() == GE_DSTBLEND_DOUBLESRCALPHA; bool doTextureProjection = gstate.getUVGenMode() == 1; // id->d[0] |= (gstate.clearmode & 1); @@ -105,6 +106,7 @@ void ComputeFragmentShaderID(FragmentShaderID *id) { id->d[0] |= (enableFog & 1) << 15; id->d[0] |= (doTextureProjection & 1) << 16; id->d[0] |= (enableColorDoubling & 1) << 17; + id->d[0] |= (enableAlphaDoubling & 1) << 18; } } @@ -125,6 +127,8 @@ void GenerateFragmentShader(char *buffer) { bool enableAlphaTest = gstate.isAlphaTestEnabled() && !IsAlphaTestTriviallyTrue() && !gstate.isModeClear(); bool enableColorTest = gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue() && !gstate.isModeClear(); bool enableColorDoubling = (gstate.texfunc & 0x10000) != 0; + // TODO: This only does one of the four possible modes. + bool enableAlphaDoubling = gstate.getBlendFuncA() == GE_SRCBLEND_DOUBLESRCALPHA || gstate.getBlendFuncB() == GE_DSTBLEND_DOUBLESRCALPHA; bool doTextureProjection = gstate.getUVGenMode() == 1; if (doTexture) @@ -233,6 +237,10 @@ void GenerateFragmentShader(char *buffer) { WRITE(p, " if (v.a %s u_alphacolorref.a) discard;\n", alphaTestFuncs[alphaTestFunc]); } } + + if (enableAlphaDoubling) { + WRITE(p, " v.a = v.a * 2.0;\n"); + } if (enableColorTest) { int colorTestFunc = gstate.colortest & 3;