diff options
| author | Pierre Bourdon <delroth@lse.epita.fr> | 2012-03-24 20:49:39 +0100 |
|---|---|---|
| committer | Pierre Bourdon <delroth@lse.epita.fr> | 2012-03-24 20:49:39 +0100 |
| commit | 0f2d31e7278b938384cceea0b3c4c0820dafb243 (patch) | |
| tree | 51146b48e08fbc991639b1a86592f30965277f97 /Source/Core/VideoCommon/Src/PixelShaderGen.cpp | |
| parent | 7a1744575d7569dd52739836685b6e6643ace61a (diff) | |
| parent | c662b8ee2f55f28a14c51dfe44309a6dcf3710d8 (diff) | |
Merge branch 'zcomploc-support'
zcomploc is a feature of the GC/Wii GPU used to perform some depth operations.
It was previously not implemented in Dolphin. This commit adds support for it.
List of games fixed by this commit:
* 007: Everything or Nothing (Skybox in front of the map/models)
* Baten Kaitos (characters displayed in front of background objects)
* Tony Hawk's Pro Skater 3 (invisible skater)
* Ty the Tasmanian Tiger (floating floor)
* Super Smash Bros Brawl ("Link chasing pig" animation behind the score screen)
Fixes issue 4841.
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 662c9c59a8..89032c67ea 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -1181,10 +1181,31 @@ static bool WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode compindex = bpmem.alphaFunc.comp1 % 8; WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table - WRITE(p, ")){ocol0 = 0;%s%s discard;%s}\n", - dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND ? "ocol1 = 0;" : "", - DepthTextureEnable ? "depth = 1.f;" : "", - (ApiType != API_D3D11) ? "return;" : ""); + WRITE(p, ")) {\n"); + + WRITE(p, "ocol0 = 0;\n"); + if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) + WRITE(p, "ocol1 = 0;\n"); + if (DepthTextureEnable) + WRITE(p, "depth = 1.f;\n"); + + // HAXX: zcomploc is a way to control whether depth test is done before + // or after texturing and alpha test. PC GPU have no way to support this + // feature properly as of 2012: depth buffer and depth test are not + // programmable and the depth test is always done after texturing. + // + // We implement "depth test before texturing" by discarding the fragment + // when the alpha test fail. This is not a correct implementation because + // even if the depth test fails the fragment could be alpha blended, but + // we don't have a choice. + if (!(bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable)) + { + WRITE(p, "discard;\n"); + if (ApiType != API_D3D11) + WRITE(p, "return;\n"); + } + + WRITE(p, "}\n"); return true; } @@ -1242,4 +1263,4 @@ static void WriteFog(char *&p) WRITE(p, " prev.rgb = lerp(prev.rgb,"I_FOG"[0].rgb,fog);\n"); -}
\ No newline at end of file +} |
