From 5d78eeb6d35b9ab424ab0b8d63aa61c372542b5f Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 1 May 2024 15:35:08 +0200 Subject: [PATCH] vkd3d: Simplify control flow for swapchain images. --- libs/vkd3d/command.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 4a69ff53..95366d34 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -2052,20 +2052,15 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, * state when GPU finishes execution of a command list. */ if (is_swapchain_image) { - if (resource->present_state == D3D12_RESOURCE_STATE_PRESENT) - { - *access_mask = VK_ACCESS_MEMORY_READ_BIT; - *stage_flags = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; - if (image_layout) - *image_layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - return true; - } - else if (resource->present_state != D3D12_RESOURCE_STATE_COMMON) - { - vk_barrier_parameters_from_d3d12_resource_state(resource->present_state, 0, + if (resource->present_state != D3D12_RESOURCE_STATE_PRESENT) + return vk_barrier_parameters_from_d3d12_resource_state(resource->present_state, 0, resource, vk_queue_flags, vk_info, access_mask, stage_flags, image_layout); - return true; - } + + *access_mask = VK_ACCESS_MEMORY_READ_BIT; + *stage_flags = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + if (image_layout) + *image_layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + return true; } *access_mask = VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT;