diff options
| author | Jules Blok <jules.blok@gmail.com> | 2016-08-19 02:11:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-19 02:11:37 +0200 |
| commit | 40f4308dc2120ce4e105008f3cb46b6a1c553e64 (patch) | |
| tree | a3a83299c9d3f3873f94b2c75991877bb7b928a6 /Source/Core/VideoCommon/VertexShaderManager.cpp | |
| parent | 0015d2e86b76772a57fb4554c84c4b47adce341e (diff) | |
| parent | e86d7cbc999223ca113af7b4c0aac6850c1854fe (diff) | |
Merge pull request #4085 from Armada651/vertex-depth
VideoCommon: Implement depth range equation in vertex shader.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderManager.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 19fb1f371d..9b1c3437fe 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -386,6 +386,15 @@ void VertexShaderManager::SetConstants() const float pixel_size_y = 2.f / Renderer::EFBToScaledXf(2.f * xfmem.viewport.ht); 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. We need to reverse + // the far value to get a reversed depth range mapping. This is necessary + // because the standard depth range equation pushes all depth values towards + // the back of the depth buffer where conventionally depth buffers have the + // least precision. + constants.pixelcentercorrection[2] = xfmem.viewport.zRange / 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. g_renderer->SetViewport(); |
