summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorNeoBrainX <NeoBrainX@gmail.com>2013-06-29 23:14:08 +0200
committerNeoBrainX <NeoBrainX@gmail.com>2013-06-29 23:14:08 +0200
commiteb153cfdedf4ec3563576aca5deb9ef33338ac7d (patch)
tree64a0eec180bc7216a8d7112ebf939928cfd6f0e3 /Source/Core
parent99301bd158a90d93dc7fb74e50118b1517a40ed3 (diff)
PixelShaderGen: Fix a small early-ztest related bug.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index ad8cc4d7c5..1c10459160 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -592,6 +592,8 @@ static void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE Api
if (per_pixel_depth && bpmem.zcontrol.early_ztest)
out.Write("depth = zCoord;\n");
+ // Note: depth texture output is only written to depth buffer if late depth test is used
+ // theoretical final depth value is used for fog calculation, though, so we have to emulate ztextures anyway
if (bpmem.ztex2.op != ZTEXTURE_DISABLE && !skip_ztexture)
{
// use the texture input of the last texture stage (textemp), hopefully this has been read and is in correct format...
@@ -603,13 +605,9 @@ static void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_TYPE Api
out.Write("zCoord = zCoord * (16777215.0f/16777216.0f);\n");
out.Write("zCoord = frac(zCoord);\n");
out.Write("zCoord = zCoord * (16777216.0f/16777215.0f);\n");
-
- // Note: depth texture output is only written to depth buffer if late depth test is used
- // final depth value is used for fog calculation, though
- if (per_pixel_depth)
- out.Write("depth = zCoord;\n");
}
- else if (per_pixel_depth && !bpmem.zcontrol.early_ztest)
+
+ if (per_pixel_depth && !bpmem.zcontrol.early_ztest)
out.Write("depth = zCoord;\n");
if (dstAlphaMode == DSTALPHA_ALPHA_PASS)