From 87dc472a8d9bec0ae2a0ce259e0b5e8ae2b070ea Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 1 Apr 2019 15:45:41 +0200 Subject: [PATCH] [dxvk] Set empty scissor rect when the app requests empty viewport Since we cannot set the viewport size to zero, we should set an empty scissor rect so that rasterization is still effectively disabled for the given viewport index. Fixes #813, #957. --- src/dxvk/dxvk_context.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 84f406739..d527b127e 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1895,10 +1895,14 @@ namespace dxvk { m_state.vp.scissorRects[i] = scissorRects[i]; // Vulkan viewports are not allowed to have a width or - // height of zero, so we fall back to a dummy viewport. + // height of zero, so we fall back to a dummy viewport + // and instead set an empty scissor rect, which is legal. if (viewports[i].width == 0.0f || viewports[i].height == 0.0f) { m_state.vp.viewports[i] = VkViewport { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f }; + m_state.vp.scissorRects[i] = VkRect2D { + VkOffset2D { 0, 0 }, + VkExtent2D { 0, 0 } }; } }