vkd3d: Handle empty viewports.

Assassin's Creed Valhalla relies on this.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2020-11-19 02:45:14 +01:00 committed by Hans-Kristian Arntzen
parent ecc504922e
commit 6886bb7f11
1 changed files with 6 additions and 9 deletions

View File

@ -4739,15 +4739,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(d3d12_command_li
viewport_count = ARRAY_SIZE(dyn_state->viewports);
}
for (i = 0; i < viewport_count; ++i)
{
if (!viewports[i].Width || !viewports[i].Height)
{
FIXME_ONCE("Invalid viewport %u, ignoring RSSetViewports().\n", i);
return;
}
}
for (i = 0; i < viewport_count; ++i)
{
VkViewport *vk_viewport = &dyn_state->viewports[i];
@ -4757,6 +4748,12 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(d3d12_command_li
vk_viewport->height = -viewports[i].Height;
vk_viewport->minDepth = viewports[i].MinDepth;
vk_viewport->maxDepth = viewports[i].MaxDepth;
if (vk_viewport->width <= 0.0f)
{
vk_viewport->width = 1.0f;
vk_viewport->height = 0.0f;
}
}
if (dyn_state->viewport_count != viewport_count)