Commit 371d95b8 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Handle 0-sized viewports

Issue exposed by a transform feedback test. Since we already create a scissor to match the viewport (be it 0-sized or not), we can create the Vulkan viewport with a small width/height if they are 0, as that's not allowed by Vulkan. Bug: angleproject:3205 Change-Id: Ib23d8b9f5e84447be2c4b7e8aff805e7d9e57323 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1665352 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 067687f4
...@@ -677,10 +677,22 @@ angle::Result GraphicsPipelineDesc::initializePipeline( ...@@ -677,10 +677,22 @@ angle::Result GraphicsPipelineDesc::initializePipeline(
// Set initial viewport and scissor state. // Set initial viewport and scissor state.
// 0-sized viewports are invalid in Vulkan. We always use a scissor that at least matches the
// requested viewport, so it's safe to adjust the viewport size here.
VkViewport viewport = mViewport;
if (viewport.width == 0)
{
viewport.width = 1;
}
if (viewport.height == 0)
{
viewport.height = 1;
}
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.flags = 0; viewportState.flags = 0;
viewportState.viewportCount = 1; viewportState.viewportCount = 1;
viewportState.pViewports = &mViewport; viewportState.pViewports = &viewport;
viewportState.scissorCount = 1; viewportState.scissorCount = 1;
viewportState.pScissors = &mScissor; viewportState.pScissors = &mScissor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment