From ded7a2921dea239dda91de3bb9897b3fb8a68afb Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Sat, 2 Jan 2010 21:09:12 +0000 Subject: [PATCH] I'm back, after two weeks pure work and nothing of dolphin, take a look at the code and discover this very small fix, apply color clamping before alpha test, the way is done in the software plugin, have some nice effects, this will fix some things and brake others but the feedback is needed. if you want to know where to start testing look at SMS :) HAPPY 2010 for everyone git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4775 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 1249011538..6b472eb317 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -537,6 +537,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, u32 HLSL) } WRITE(p, "depth = zCoord;\n"); + WRITE(p, "prev = saturate(prev);\n"); //if (bpmem.genMode.numindstages ) WRITE(p, "prev.rg = indtex0.xy;\nprev.b = 0;\n"); @@ -733,7 +734,7 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL) // combine the color channel if (cc.bias != 3) // if not compare { - //normal color combiner goes here + //normal color combiner goes here if (cc.shift>0) WRITE(p, " %s*(%s%s",tevScaleTable[cc.shift],tevCInputTable[cc.d],tevOpTable[cc.op]); else @@ -775,7 +776,7 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL) if (ac.bias != 3) // if not compare { - //normal alpha combiner goes here + //normal alpha combiner goes here if (ac.shift>0) WRITE(p, " %s*(%s%s",tevScaleTable[ac.shift],tevAInputTable[ac.d],tevOpTable[ac.op]); else @@ -853,17 +854,15 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con static const char *tevAlphaFuncsTable[] = { "(false)", //ALPHACMP_NEVER 0 - "(prev.a < %s - (1.0f/510.0f))", //ALPHACMP_LESS 1 + "(prev.a < %s - (0.5f/255.0f))", //ALPHACMP_LESS 1 "(abs( prev.a - %s ) < (1.0f/255.0f))", //ALPHACMP_EQUAL 2 - "(prev.a < %s + (1.0f/510.0f))", //ALPHACMP_LEQUAL 3 - "(prev.a > %s + (1.0f/510.0f))", //ALPHACMP_GREATER 4 + "(prev.a < %s + (0.5f/255.0f))", //ALPHACMP_LEQUAL 3 + "(prev.a > %s + (0.5f/255.0f))", //ALPHACMP_GREATER 4 "(abs( prev.a - %s ) > (1.0f/255.0f))", //ALPHACMP_NEQUAL 5 - "(prev.a > %s - (1.0f/510.0f))", //ALPHACMP_GEQUAL 6 + "(prev.a > %s - (0.5f/255.0f))", //ALPHACMP_GEQUAL 6 "(true)" //ALPHACMP_ALWAYS 7 }; - - static const char *tevAlphaFunclogicTable[] = { " && ", // and