summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2015-05-08 14:26:48 +0200
committerJules Blok <jules.blok@gmail.com>2015-05-08 14:43:43 +0200
commit1d745d632ab9f4774bc38782cd688a5fa48bc097 (patch)
tree1f9c0beba0e258cd796e34aa900271576de02b76 /Source/Core/VideoCommon/PixelShaderGen.cpp
parentd04af15ad442d410ebc9d2ba348fea062eb89d92 (diff)
PixelShaderGen: Clamp zCoord to the depth range.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 975b8e7f71..562cb9be07 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -570,6 +570,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
// the screen space depth value = far z + (clip z / clip w) * z range
out.Write("\tint zCoord = " I_ZBIAS"[1].x + int((clipPos.z / clipPos.w) * float(" I_ZBIAS"[1].y));\n");
}
+ out.Write("\tzCoord = clamp(zCoord, " I_ZBIAS"[1].x - " I_ZBIAS"[1].y, " I_ZBIAS"[1].x);\n");
// depth texture can safely be ignored if the result won't be written to the depth buffer (early_ztest) and isn't used for fog either
const bool skip_ztexture = !per_pixel_depth && !bpmem.fog.c_proj_fsel.fsel;