From ebcab68822d058fef0bcd0fa4ddb0692190c909d Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 9 Jan 2020 03:19:25 +0000 Subject: [PATCH] [d3d9] Respect specific mip size for implicit viewport in SetRenderTarget Closes #1295 --- src/d3d9/d3d9_device.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index bf6dfab28..2e2880fa0 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -1134,19 +1134,22 @@ namespace dxvk { return D3DERR_INVALIDCALL; if (RenderTargetIndex == 0) { + uint32_t width = std::max(1u, desc->Width >> rt->GetMipLevel()); + uint32_t height = std::max(1u, desc->Height >> rt->GetMipLevel()); + D3DVIEWPORT9 viewport; viewport.X = 0; viewport.Y = 0; - viewport.Width = desc->Width; - viewport.Height = desc->Height; + viewport.Width = width; + viewport.Height = height; viewport.MinZ = 0.0f; viewport.MaxZ = 1.0f; RECT scissorRect; scissorRect.left = 0; scissorRect.top = 0; - scissorRect.right = desc->Width; - scissorRect.bottom = desc->Height; + scissorRect.right = width; + scissorRect.bottom = height; if (m_state.viewport != viewport) { m_flags.set(D3D9DeviceFlag::DirtyFFViewport);