diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index 6ad02a28cb..f2a3dad842 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -2640,6 +2640,7 @@ bool VulkanRenderer::AcquireNextSwapchainImage(bool mainWindow) if (!UpdateSwapchainProperties(mainWindow)) return false; + // std::cout << "acquire" << std::endl; bool result = chainInfo.AcquireImage(); if (!result) return false; @@ -2732,14 +2733,17 @@ void VulkanRenderer::SwapBuffer(bool mainWindow) ClearColorImageRaw(chainInfo.m_swapchainImages[chainInfo.swapchainImageIndex], 0, 0, clearColor, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR); } - WaitCommandBufferFinished(m_commandBufferIDOfPrevFrame); - m_commandBufferIDOfPrevFrame = GetCurrentCommandBufferId(); + const size_t currentFrameCmdBufferID = GetCurrentCommandBufferId(); VkSemaphore presentSemaphore = chainInfo.m_presentSemaphores[chainInfo.swapchainImageIndex]; SubmitCommandBuffer(presentSemaphore); // submit all command and signal semaphore cemu_assert_debug(m_numSubmittedCmdBuffers > 0); + // wait for the previous frame to finish rendering. + WaitCommandBufferFinished(m_commandBufferIDOfPrevFrame); + m_commandBufferIDOfPrevFrame = currentFrameCmdBufferID; + VkPresentIdKHR presentId = {}; VkPresentInfoKHR presentInfo = {}; @@ -2769,6 +2773,7 @@ void VulkanRenderer::SwapBuffer(bool mainWindow) } } + // std::cout << "swap" << std::endl; VkResult result = vkQueuePresentKHR(m_presentQueue, &presentInfo); if (result < 0 && result != VK_ERROR_OUT_OF_DATE_KHR) {