Skip to content

Commit

Permalink
[dxvk] Set empty scissor rect when the app requests empty viewport
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
doitsujin committed Apr 1, 2019
1 parent 44b79b5 commit d74b55b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dxvk/dxvk_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,10 +1615,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 } };
}
}

Expand Down

0 comments on commit d74b55b

Please sign in to comment.