D3D depth range

This commit is contained in:
Jack Andersen 2016-04-04 16:25:55 -10:00
parent 4cec163804
commit dc7da6aa21
2 changed files with 6 additions and 5 deletions

View File

@ -923,9 +923,10 @@ struct D3D11CommandQueue : IGraphicsCommandQueue
m_boundTarget = ctarget; m_boundTarget = ctarget;
} }
void setViewport(const SWindowRect& rect) void setViewport(const SWindowRect& rect, float znear, float zfar)
{ {
D3D11_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(rect.location[1]), FLOAT(rect.size[0]), FLOAT(rect.size[1]), 0.0, 1.0}; D3D11_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(m_boundTarget->m_height - rect.location[1] - rect.size[1]),
FLOAT(rect.size[0]), FLOAT(rect.size[1]), znear, zfar};
m_deferredCtx->RSSetViewports(1, &vp); m_deferredCtx->RSSetViewports(1, &vp);
} }

View File

@ -1149,10 +1149,10 @@ struct D3D12CommandQueue : IGraphicsCommandQueue
m_boundTarget = ctarget; m_boundTarget = ctarget;
} }
void setViewport(const SWindowRect& rect) void setViewport(const SWindowRect& rect, float znear, float zfar)
{ {
D3D12_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(rect.location[1]), D3D12_VIEWPORT vp = {FLOAT(rect.location[0]), FLOAT(m_boundTarget->m_height - rect.location[1] - rect.size[1]),
FLOAT(rect.size[0]), FLOAT(rect.size[1]), 0.0f, 1.0f}; FLOAT(rect.size[0]), FLOAT(rect.size[1]), znear, zfar};
m_cmdList->RSSetViewports(1, &vp); m_cmdList->RSSetViewports(1, &vp);
} }