summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2016-08-22 14:37:56 +0200
committerJules Blok <jules.blok@gmail.com>2016-08-23 09:57:11 +0200
commit65472260d8cd81ecbfdb9856424aa584f0b1ce2a (patch)
tree9f7fa16cbfb9e1008c9716633780310e39af4aa7 /Source/Core/VideoBackends/D3D/Render.cpp
parentf1964f90d647251b677b3de29d08c4c22ea5344a (diff)
D3D: Correctly invert the viewport depth range.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index a6301e53a2..57e481cde4 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -580,8 +580,10 @@ void Renderer::SetViewport()
// We do depth clipping and depth range in the vertex shader instead of relying
// on the graphics API. However we still need to ensure depth values don't exceed
- // the maximum value supported by the console GPU.
- D3D11_VIEWPORT vp = CD3D11_VIEWPORT(X, Y, Wd, Ht, D3D11_MIN_DEPTH, GX_MAX_DEPTH);
+ // the maximum value supported by the console GPU. We also need to account for the
+ // fact that the entire depth buffer is inverted on D3D, so we set GX_MAX_DEPTH as
+ // an inverted near value.
+ D3D11_VIEWPORT vp = CD3D11_VIEWPORT(X, Y, Wd, Ht, 1.0f - GX_MAX_DEPTH, D3D11_MAX_DEPTH);
D3D::context->RSSetViewports(1, &vp);
}