summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-04-02 14:16:36 -0400
committerGitHub <noreply@github.com>2021-04-02 14:16:36 -0400
commit5513d5f4f732fb1e436765ab87e7d60ba02b1ad6 (patch)
tree5b2e53d93472280f50b8ee41c440fc475616db87 /Source/Core/VideoCommon/VertexShaderGen.cpp
parenta2fa9aab5be3ec4916bd3beb05163c325dcbc9dd (diff)
parentf339bc69c8cccca9cf975927ef025d4645f00d5e (diff)
Merge pull request #9591 from blaahaj/sonic-epsilon
VertexShaderGen: Sonic epsilon hack for OpenGL ES
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index cf400a21ba..28d1e78442 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -498,6 +498,12 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
"o.clipDist1 = clipDist1;\n");
}
}
+ else
+ {
+ // Same depth adjustment for Sonic. Without depth clamping, it unfortunately
+ // affects non-clipping uses of depth too.
+ out.Write("o.pos.z = o.pos.z * (1.0 - 1e-7);\n");
+ }
// Write the true depth value. If the game uses depth textures, then the pixel shader will
// override it with the correct values if not then early z culling will improve speed.