From: Conor McCarthy cmccarthy@codeweavers.com
Vulkan 1.1 introduced support for heights <= 0. --- libs/vkd3d/command.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index f685948d..5edde229 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3943,6 +3943,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCo { VkViewport vk_viewports[D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList2(iface); + struct vkd3d_instance *instance = list->device->vkd3d_instance; const struct vkd3d_vk_device_procs *vk_procs; unsigned int i, count;
@@ -3963,10 +3964,26 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCo vk_viewports[count].minDepth = viewports[i].MinDepth; vk_viewports[count].maxDepth = viewports[i].MaxDepth;
- if (vk_viewports[count].width <= 0.0f || !vk_viewports[count].height) + /* Vulkan 1.1 is required for height <= 0 */ + if (instance->vk_api_version < VK_API_VERSION_1_1) { - FIXME_ONCE("Ignoring invalid viewport %u.\n", i); - continue; + /* Vulkan height is negative for positive D3D12 heights, so skip only width <= 0 + * or zero height, and hope negative heights work. */ + if (vk_viewports[count].width <= 0.0f || !vk_viewports[count].height) + { + FIXME_ONCE("Ignoring invalid viewport %u.\n", i); + continue; + } + } + else + { + if (vk_viewports[count].width <= 0.0f) + { + /* Vulkan does not support width <= 0 */ + FIXME_ONCE("Setting invalid viewport %u to zero height.\n", i); + vk_viewports[count].width = 1.0f; + vk_viewports[count].height = 0.0f; + } } ++count; }