summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorpierre <pierre@pirsoft.de>2010-05-23 22:46:13 +0000
committerpierre <pierre@pirsoft.de>2010-05-23 22:46:13 +0000
commitb73b77014fa1dfe7659f93e1d7e72df7268cc985 (patch)
tree64fb232292e5168adbca551ba5120f401b395f2e /Source/Core
parent88cf89e7fed62e2ff3972afb5e51e6eaafe3a145 (diff)
Rework the logic for avoiding lerp() in shader code
This should give the exact same shader code except for the cases of SELA == SELB and SELC == 1, the latter only for the color combinder. In these two cases the results of the shader should not change in any way. It would have been possible to optimize the SELC == HALF case too, if the actual factor had been 0.5f instead of 0.4980392f. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5472 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 112e57d5a0..beb44c45d9 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -761,18 +761,16 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
if(!(cc.d == TEVCOLORARG_ZERO && cc.op == 0))
WRITE(p, "%s%s",tevCInputTable[cc.d],tevOpTable[cc.op]);
- if (cc.a == TEVCOLORARG_ZERO && cc.b == TEVCOLORARG_ZERO)
- WRITE(p, "float3(0.0f,0.0f,0.0f)");
- else if (cc.a == TEVCOLORARG_ZERO && cc.c == TEVCOLORARG_ZERO)
- WRITE(p, "float3(0.0f,0.0f,0.0f)");
- else if (cc.b == TEVCOLORARG_ZERO && cc.c == TEVCOLORARG_ZERO)
+ if (cc.a == cc.b)
WRITE(p,"%s",tevCInputTable[cc.a]);
+ else if (cc.c == TEVCOLORARG_ZERO)
+ WRITE(p,"%s",tevCInputTable[cc.a]);
+ else if (cc.c == TEVCOLORARG_ONE)
+ WRITE(p,"%s",tevCInputTable[cc.b]);
else if (cc.a == TEVCOLORARG_ZERO)
WRITE(p,"%s*%s",tevCInputTable[cc.b],tevCInputTable[cc.c]);
else if (cc.b == TEVCOLORARG_ZERO)
WRITE(p,"%s*(float3(1.0f,1.0f,1.0f)-%s)",tevCInputTable[cc.a],tevCInputTable[cc.c]);
- else if (cc.c == TEVCOLORARG_ZERO)
- WRITE(p,"%s",tevCInputTable[cc.a]);
else
WRITE(p, "lerp(%s,%s,%s)",tevCInputTable[cc.a], tevCInputTable[cc.b],tevCInputTable[cc.c]);
@@ -809,18 +807,14 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
if(!(ac.d == TEVALPHAARG_ZERO && ac.op == 0))
WRITE(p, "%s%s",tevAInputTable[ac.d],tevOpTable[ac.op]);
- if (ac.a == TEVALPHAARG_ZERO && ac.b == TEVALPHAARG_ZERO)
- WRITE(p, "0.0f");
- else if (ac.a == TEVALPHAARG_ZERO && ac.c == TEVALPHAARG_ZERO)
- WRITE(p, "0.0f");
- else if (ac.b == TEVALPHAARG_ZERO && ac.c == TEVALPHAARG_ZERO)
+ if (ac.a == ac.b)
+ WRITE(p,"%s",tevAInputTable[ac.a]);
+ else if (ac.c == TEVALPHAARG_ZERO)
WRITE(p,"%s",tevAInputTable[ac.a]);
else if (ac.a == TEVALPHAARG_ZERO)
WRITE(p,"%s*%s",tevAInputTable[ac.b],tevAInputTable[ac.c]);
else if (ac.b == TEVALPHAARG_ZERO)
WRITE(p,"%s*(1.0f-%s)",tevAInputTable[ac.a],tevAInputTable[ac.c]);
- else if (ac.c == TEVALPHAARG_ZERO)
- WRITE(p,"%s",tevAInputTable[ac.a]);
else
WRITE(p, "lerp(%s,%s,%s)",tevAInputTable[ac.a],tevAInputTable[ac.b],tevAInputTable[ac.c]);