From 4b064a58f21e13dd7ddcb5b90b2cf756e850c1ce Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 14 Nov 2017 21:24:45 -1000 Subject: [PATCH] Make D3D depth range consistent with OpenGL and Vulkan --- lib/graphicsdev/D3D11.cpp | 2 +- lib/graphicsdev/D3D12.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/graphicsdev/D3D11.cpp b/lib/graphicsdev/D3D11.cpp index bb75609..36b0afd 100644 --- a/lib/graphicsdev/D3D11.cpp +++ b/lib/graphicsdev/D3D11.cpp @@ -1037,7 +1037,7 @@ struct D3D11CommandQueue : IGraphicsCommandQueue D3D11TextureR* ctarget = m_boundTarget.cast(); int boundHeight = ctarget->m_height; D3D11_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(boundHeight - rect.location[1] - rect.size[1]), - FLOAT(rect.size[0]), FLOAT(rect.size[1]), znear, zfar}; + FLOAT(rect.size[0]), FLOAT(rect.size[1]), 1.f - zfar, 1.f - znear}; m_deferredCtx->RSSetViewports(1, &vp); } } diff --git a/lib/graphicsdev/D3D12.cpp b/lib/graphicsdev/D3D12.cpp index cae5814..6192b83 100644 --- a/lib/graphicsdev/D3D12.cpp +++ b/lib/graphicsdev/D3D12.cpp @@ -1324,7 +1324,7 @@ struct D3D12CommandQueue : IGraphicsCommandQueue { D3D12TextureR* ctarget = m_boundTarget.cast(); D3D12_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(ctarget->m_height - rect.location[1] - rect.size[1]), - FLOAT(rect.size[0]), FLOAT(rect.size[1]), znear, zfar}; + FLOAT(rect.size[0]), FLOAT(rect.size[1]), 1.f - zfar, 1.f - znear}; m_cmdList->RSSetViewports(1, &vp); } }