summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2016-08-03 02:01:36 +0200
committerJules Blok <jules.blok@gmail.com>2016-08-15 13:11:23 +0200
commitc223bd47b9b2a83ed53201964e4912e2faec3d66 (patch)
tree914c4ae4ca1f8c01fbccef8516024fcf2f86914e /Source/Core/VideoCommon/VertexShaderGen.cpp
parent0015d2e86b76772a57fb4554c84c4b47adce341e (diff)
VideoCommon: Implement depth range equation in vertex shader.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index aa69550bd8..e23be6590c 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -399,14 +399,14 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
out.Write("o.colors_1 = color1;\n");
}
+ // We have to handle the depth range in the vertex shader, because some games will use a depth range beyond
+ // the normal depth range of 0..1.
+ out.Write("o.pos.z = o.pos.w * " I_PIXELCENTERCORRECTION".w + o.pos.z * " I_PIXELCENTERCORRECTION".z;\n");
+
// write the true depth value, if the game uses depth textures pixel shaders will override with
// the correct values
// if not early z culling will improve speed
- if (g_ActiveConfig.backend_info.bSupportsClipControl)
- {
- out.Write("o.pos.z = -o.pos.z;\n");
- }
- else // OGL
+ if (!g_ActiveConfig.backend_info.bSupportsClipControl)
{
// this results in a scale from -1..0 to -1..1 after perspective
// divide