summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-08-31 21:47:39 +0000
committerhrydgard <hrydgard@gmail.com>2009-08-31 21:47:39 +0000
commitd65fb1a30a8997746c490ac3688ca7da2e486bba (patch)
treefc0253298f73fd2eb786f55031055ce1675104ae /Source/Core
parent62ab5cf0e5e556704becc6dcd24a6b19546c9d86 (diff)
D3D: Fix alpha test (I think, not tested much, no pun intended)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4124 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 9833969476..b158487d0b 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -873,7 +873,7 @@ static bool WriteAlphaTest(char *&p, bool HLSL)
return true;
if (comp[0] == ALPHACMP_NEVER || comp[1] == ALPHACMP_NEVER)
{
- WRITE(p, "discard;\n");
+ WRITE(p, HLSL ? "clip(-1);" : "discard;\n");
return false;
}
break;
@@ -882,7 +882,7 @@ static bool WriteAlphaTest(char *&p, bool HLSL)
return true;
if (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)
{
- WRITE(p, "discard;\n");
+ WRITE(p, HLSL ? "clip(-1);" : "discard;\n");
return false;
}
break;
@@ -891,14 +891,14 @@ static bool WriteAlphaTest(char *&p, bool HLSL)
return true;
if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER))
{
- WRITE(p, "discard;\n");
+ WRITE(p, HLSL ? "clip(-1);" : "discard;\n");
return false;
}
break;
case 3: // XNOR
if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_NEVER) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_ALWAYS))
{
- WRITE(p, "discard;\n");
+ WRITE(p, HLSL ? "clip(-1);" : "discard;\n");
return false;
}
if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER))
@@ -927,7 +927,12 @@ static bool WriteAlphaTest(char *&p, bool HLSL)
WriteAlphaCompare(p, 1, bpmem.alphaFunc.comp1);
- WRITE(p, ");\n");
+ if (HLSL) {
+ // clip works differently than discard - discard takes a bool, clip takes a value that kills the pixel on negative
+ WRITE(p, " ? -1 : 1);\n");
+ } else {
+ WRITE(p, ");\n");
+ }
return true;
}