From: Conor McCarthy cmccarthy@codeweavers.com
Fixes blank screen in Assassin's Creed: Valhalla. --- libs/vkd3d/command.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 6eddcfa2..5647d48c 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3944,7 +3944,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); const struct vkd3d_vk_device_procs *vk_procs; - unsigned int i; + unsigned int i, count;
TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports);
@@ -3954,24 +3954,25 @@ static void STDMETHODCALLTYPE d3d12_command_list_RSSetViewports(ID3D12GraphicsCo viewport_count = ARRAY_SIZE(vk_viewports); }
- for (i = 0; i < viewport_count; ++i) + for (i = 0, count = 0; i < viewport_count; ++i) { - vk_viewports[i].x = viewports[i].TopLeftX; - vk_viewports[i].y = viewports[i].TopLeftY + viewports[i].Height; - vk_viewports[i].width = viewports[i].Width; - vk_viewports[i].height = -viewports[i].Height; - vk_viewports[i].minDepth = viewports[i].MinDepth; - vk_viewports[i].maxDepth = viewports[i].MaxDepth; + vk_viewports[count].x = viewports[i].TopLeftX; + vk_viewports[count].y = viewports[i].TopLeftY + viewports[i].Height; + vk_viewports[count].width = viewports[i].Width; + vk_viewports[count].height = -viewports[i].Height; + vk_viewports[count].minDepth = viewports[i].MinDepth; + vk_viewports[count].maxDepth = viewports[i].MaxDepth;
- if (!vk_viewports[i].width || !vk_viewports[i].height) + if (!vk_viewports[count].width || !vk_viewports[count].height) { - FIXME_ONCE("Invalid viewport %u, ignoring RSSetViewports().\n", i); - return; + FIXME_ONCE("Ignoring invalid viewport %u.\n", i); + continue; } + ++count; }
vk_procs = &list->device->vk_procs; - VK_CALL(vkCmdSetViewport(list->vk_command_buffer, 0, viewport_count, vk_viewports)); + VK_CALL(vkCmdSetViewport(list->vk_command_buffer, 0, count, vk_viewports)); }
static void STDMETHODCALLTYPE d3d12_command_list_RSSetScissorRects(ID3D12GraphicsCommandList2 *iface,