summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderManager.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2016-08-06 03:40:45 +0200
committerJules Blok <jules.blok@gmail.com>2016-08-15 13:11:26 +0200
commit4582853af48f67047e57b997bf923488bf444931 (patch)
treee424b72407891d84730d4315d168a72596a1d22c /Source/Core/VideoCommon/VertexShaderManager.cpp
parente9e81ece6538c6676054dbc0e9d156fcc59801c9 (diff)
VertexShaderGen: Use reversed depth range.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index 83600463e9..dabc7870fd 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -387,9 +387,12 @@ void VertexShaderManager::SetConstants()
constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x;
constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y;
- // The depth range is handled in the vertex shader.
+ // The depth range is handled in the vertex shader. We need to reverse
+ // the far value to get a reversed depth range mapping. This is necessary
+ // because we have the most precision at the near plane, while the console
+ // has the most percision at the far plane.
constants.pixelcentercorrection[2] = xfmem.viewport.zRange / 16777215.0f;
- constants.pixelcentercorrection[3] = xfmem.viewport.farZ / 16777215.0f;
+ constants.pixelcentercorrection[3] = 1.0f - xfmem.viewport.farZ / 16777215.0f;
dirty = true;
// This is so implementation-dependent that we can't have it here.