diff options
| author | Stenzek <stenzek@gmail.com> | 2018-10-10 00:56:18 +1100 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2018-12-04 17:36:08 +1000 |
| commit | b409a87d1a4256cdd7b5ccd3133d416ca15148f1 (patch) | |
| tree | ceca1d91fe3bcf5c6169634cecd74503940fe1dc /Source | |
| parent | fa8262fa4af2a6be524b1201f1e8f1db3820282a (diff) | |
D3D: Clamp viewport to current framebuffer dimensions, not target
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/Render.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 834dc893d0..e06a5b4c69 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -549,10 +549,12 @@ void Renderer::SetViewport(float x, float y, float width, float height, float ne { // In D3D, the viewport rectangle must fit within the render target. D3D11_VIEWPORT vp; - vp.TopLeftX = MathUtil::Clamp(x, 0.0f, static_cast<float>(m_target_width - 1)); - vp.TopLeftY = MathUtil::Clamp(y, 0.0f, static_cast<float>(m_target_height - 1)); - vp.Width = MathUtil::Clamp(width, 1.0f, static_cast<float>(m_target_width) - vp.TopLeftX); - vp.Height = MathUtil::Clamp(height, 1.0f, static_cast<float>(m_target_height) - vp.TopLeftY); + vp.TopLeftX = MathUtil::Clamp(x, 0.0f, static_cast<float>(m_current_framebuffer_width - 1)); + vp.TopLeftY = MathUtil::Clamp(y, 0.0f, static_cast<float>(m_current_framebuffer_height - 1)); + vp.Width = + MathUtil::Clamp(width, 1.0f, static_cast<float>(m_current_framebuffer_width) - vp.TopLeftX); + vp.Height = + MathUtil::Clamp(height, 1.0f, static_cast<float>(m_current_framebuffer_height) - vp.TopLeftY); vp.MinDepth = near_depth; vp.MaxDepth = far_depth; D3D::context->RSSetViewports(1, &vp); |
