diff options
| author | NeoBrainX <NeoBrainX@gmail.com> | 2013-03-29 20:59:03 +0100 |
|---|---|---|
| committer | NeoBrainX <NeoBrainX@gmail.com> | 2013-03-29 20:59:03 +0100 |
| commit | 9eccd56ef08d1fd2d8a1e3b1d82d0c6f70347db2 (patch) | |
| tree | 215b0751593e950a9e8b6a98f200380c68584c22 /Source/Core/VideoCommon | |
| parent | 3c02f227db1e02f233f3aac8dc42476bd0b17f7a (diff) | |
PixelShaderGen: Some cleanups.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/BPMemory.h | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 39 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 1 |
3 files changed, 22 insertions, 23 deletions
diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index 1a29439b36..5154e2f5b0 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -157,6 +157,11 @@ #define TEVALPHAARG_KONST 6 #define TEVALPHAARG_ZERO 7 +#define GX_TEVPREV 0 +#define GX_TEVREG0 1 +#define GX_TEVREG1 2 +#define GX_TEVREG2 3 + #define ALPHACMP_NEVER 0 #define ALPHACMP_LESS 1 #define ALPHACMP_EQUAL 2 diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 49b77274a8..982f139fea 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -269,7 +269,9 @@ const char *WriteLocation(API_TYPE ApiType) template<class T> void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components) { + // TODO: Where does this TODO belong again...? // TODO: Can be optimized if using alpha pass + #define SetUidField(name, value) if (&out.GetUidData() != NULL) {out.GetUidData().name = value; }; #define OR_UidField(name, value) if (&out.GetUidData() != NULL) {out.GetUidData().name |= value; }; out.SetBuffer(text); @@ -915,7 +917,6 @@ static void WriteStage(T& out, int n, API_TYPE ApiType) || cc.c == TEVCOLORARG_C0 || cc.c == TEVCOLORARG_A0 || ac.a == TEVALPHAARG_A0 || ac.b == TEVALPHAARG_A0 || ac.c == TEVALPHAARG_A0) { - // TODO: WTF? out.SetConstantsUsed(C_COLORS+1,C_COLORS+1); if(RegisterStates[1].AlphaNeedOverflowControl || RegisterStates[1].ColorNeedOverflowControl) { @@ -971,26 +972,19 @@ static void WriteStage(T& out, int n, API_TYPE ApiType) RegisterStates[cc.dest].ColorNeedOverflowControl = (cc.clamp == 0); RegisterStates[cc.dest].AuxStored = false; -/* if (cc.d == TEVCOLORARG_C0 || cc.d == TEVCOLORARG_A0 || ac.d == TEVALPHAARG_A0) - { + if (cc.d == TEVCOLORARG_C0 || cc.d == TEVCOLORARG_A0 || ac.d == TEVALPHAARG_A0) out.SetConstantsUsed(C_COLORS+1,C_COLORS+1); - // TODO: 11 bit signed overflow.. - } + if (cc.d == TEVCOLORARG_C1 || cc.d == TEVCOLORARG_A1 || ac.d == TEVALPHAARG_A1) - { out.SetConstantsUsed(C_COLORS+2,C_COLORS+2); - // TODO: 11 bit signed overflow.. - } + if (cc.d == TEVCOLORARG_C2 || cc.d == TEVCOLORARG_A2 || ac.d == TEVALPHAARG_A2) - { out.SetConstantsUsed(C_COLORS+3,C_COLORS+3); - // TODO: 11 bit signed overflow.. - }*/ - // TODO: Are there enums for this? - if (cc.dest >= 1 && cc.dest <= 3) + if (cc.dest >= GX_TEVREG0 && cc.dest <= GX_TEVREG2) out.SetConstantsUsed(C_COLORS+cc.dest, C_COLORS+cc.dest); - if (ac.dest >= 1 && ac.dest <= 3) + + if (ac.dest >= GX_TEVREG0 && ac.dest <= GX_TEVREG2) out.SetConstantsUsed(C_COLORS+ac.dest, C_COLORS+ac.dest); out.Write("// color combine\n"); @@ -1103,14 +1097,14 @@ void SampleTexture(T& out, const char *destination, const char *texcoords, const static const char *tevAlphaFuncsTable[] = { - "(false)", //ALPHACMP_NEVER 0, TODO: Not safe? - "(prev.a <= %s - (0.25f/255.0f))", //ALPHACMP_LESS 1 - "(abs( prev.a - %s ) < (0.5f/255.0f))", //ALPHACMP_EQUAL 2 - "(prev.a < %s + (0.25f/255.0f))", //ALPHACMP_LEQUAL 3 - "(prev.a >= %s + (0.25f/255.0f))", //ALPHACMP_GREATER 4 - "(abs( prev.a - %s ) >= (0.5f/255.0f))", //ALPHACMP_NEQUAL 5 - "(prev.a > %s - (0.25f/255.0f))", //ALPHACMP_GEQUAL 6 - "(true)" //ALPHACMP_ALWAYS 7 + "(false)", // NEVER + "(prev.a <= %s - (0.25f/255.0f))", // LESS + "(abs( prev.a - %s ) < (0.5f/255.0f))", // EQUAL + "(prev.a < %s + (0.25f/255.0f))", // LEQUAL + "(prev.a >= %s + (0.25f/255.0f))", // GREATER + "(abs( prev.a - %s ) >= (0.5f/255.0f))", // NEQUAL + "(prev.a > %s - (0.25f/255.0f))", // GEQUAL + "(true)" // ALWAYS }; static const char *tevAlphaFunclogicTable[] = @@ -1132,7 +1126,6 @@ static void WriteAlphaTest(T& out, API_TYPE ApiType, DSTALPHA_MODE dstAlphaMode, out.SetConstantsUsed(C_ALPHA, C_ALPHA); - // using discard then return works the same in cg and dx9 but not in dx11 out.Write("\tif(!( "); diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index 1aceafa17d..f63a1e59c6 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -419,6 +419,7 @@ void PixelShaderManager::SetPSTextureDims(int texid) // This one is high in profiles (0.5%). // TODO: Move conversion out, only store the raw color value // and update it when the shader constant is set, only. +// TODO: Conversion should be checked in the context of tev_fixes.. void PixelShaderManager::SetColorChanged(int type, int num, bool high) { float *pf = &lastRGBAfull[type][num][0]; |
