From 6e5f70d39f245ec6a1802bc7d1135b3be998f914 Mon Sep 17 00:00:00 2001 From: DrChat Date: Thu, 1 Mar 2018 10:20:07 -0600 Subject: [PATCH] [Vulkan UI] WaitAndSignalSemaphore -> WaitOnSemaphore Fix a would-be bug dealing with pWaitDstStageMask --- src/xenia/ui/vulkan/vulkan_swap_chain.cc | 20 +++++++++++--------- src/xenia/ui/vulkan/vulkan_swap_chain.h | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/xenia/ui/vulkan/vulkan_swap_chain.cc b/src/xenia/ui/vulkan/vulkan_swap_chain.cc index 38c19852e..25ef70dbe 100644 --- a/src/xenia/ui/vulkan/vulkan_swap_chain.cc +++ b/src/xenia/ui/vulkan/vulkan_swap_chain.cc @@ -448,8 +448,8 @@ VkResult VulkanSwapChain::Reinitialize() { return Initialize(surface); } -void VulkanSwapChain::WaitAndSignalSemaphore(VkSemaphore sem) { - wait_and_signal_semaphores_.push_back(sem); +void VulkanSwapChain::WaitOnSemaphore(VkSemaphore sem) { + wait_semaphores_.push_back(sem); } void VulkanSwapChain::Shutdown() { @@ -491,7 +491,7 @@ void VulkanSwapChain::Shutdown() { } VkResult VulkanSwapChain::Begin() { - wait_and_signal_semaphores_.clear(); + wait_semaphores_.clear(); VkResult status; @@ -729,12 +729,14 @@ VkResult VulkanSwapChain::End() { return status; } - VkPipelineStageFlags wait_dst_stage = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; std::vector semaphores; - for (size_t i = 0; i < wait_and_signal_semaphores_.size(); i++) { - semaphores.push_back(wait_and_signal_semaphores_[i]); + std::vector wait_dst_stages; + for (size_t i = 0; i < wait_semaphores_.size(); i++) { + semaphores.push_back(wait_semaphores_[i]); + wait_dst_stages.push_back(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT); } semaphores.push_back(image_usage_semaphore_); + wait_dst_stages.push_back(VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT); // Submit commands. // Wait on the image usage semaphore (signaled when an image is available) @@ -743,11 +745,11 @@ VkResult VulkanSwapChain::End() { render_submit_info.pNext = nullptr; render_submit_info.waitSemaphoreCount = uint32_t(semaphores.size()); render_submit_info.pWaitSemaphores = semaphores.data(); - render_submit_info.pWaitDstStageMask = &wait_dst_stage; + render_submit_info.pWaitDstStageMask = wait_dst_stages.data(); render_submit_info.commandBufferCount = 1; render_submit_info.pCommandBuffers = &cmd_buffer_; - render_submit_info.signalSemaphoreCount = uint32_t(semaphores.size()) - 1; - render_submit_info.pSignalSemaphores = semaphores.data(); + render_submit_info.signalSemaphoreCount = 0; + render_submit_info.pSignalSemaphores = nullptr; if (presentation_queue_mutex_) { presentation_queue_mutex_->lock(); } diff --git a/src/xenia/ui/vulkan/vulkan_swap_chain.h b/src/xenia/ui/vulkan/vulkan_swap_chain.h index 14475536b..0adb35ac5 100644 --- a/src/xenia/ui/vulkan/vulkan_swap_chain.h +++ b/src/xenia/ui/vulkan/vulkan_swap_chain.h @@ -55,7 +55,7 @@ class VulkanSwapChain { VkResult Reinitialize(); // Waits on and signals a semaphore in this operation. - void WaitAndSignalSemaphore(VkSemaphore sem); + void WaitOnSemaphore(VkSemaphore sem); // Begins the swap operation, preparing state for rendering. VkResult Begin(); @@ -96,7 +96,7 @@ class VulkanSwapChain { VkSemaphore image_usage_semaphore_ = nullptr; uint32_t current_buffer_index_ = 0; std::vector buffers_; - std::vector wait_and_signal_semaphores_; + std::vector wait_semaphores_; }; } // namespace vulkan