Merge pull request #11262 from K0bin/present-sync
VideoBackends:Vulkan: Synchronize presentation
This commit is contained in:
commit
c9f31ad6a6
|
@ -473,6 +473,7 @@ void CommandBufferManager::SubmitCommandBuffer(u32 command_buffer_index,
|
||||||
nullptr};
|
nullptr};
|
||||||
|
|
||||||
m_last_present_result = vkQueuePresentKHR(g_vulkan_context->GetPresentQueue(), &present_info);
|
m_last_present_result = vkQueuePresentKHR(g_vulkan_context->GetPresentQueue(), &present_info);
|
||||||
|
m_last_present_done.Set();
|
||||||
if (m_last_present_result != VK_SUCCESS)
|
if (m_last_present_result != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
// VK_ERROR_OUT_OF_DATE_KHR is not fatal, just means we need to recreate our swap chain.
|
// VK_ERROR_OUT_OF_DATE_KHR is not fatal, just means we need to recreate our swap chain.
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
// Was the last present submitted to the queue a failure? If so, we must recreate our swapchain.
|
// Was the last present submitted to the queue a failure? If so, we must recreate our swapchain.
|
||||||
bool CheckLastPresentFail() { return m_last_present_failed.TestAndClear(); }
|
bool CheckLastPresentFail() { return m_last_present_failed.TestAndClear(); }
|
||||||
VkResult GetLastPresentResult() const { return m_last_present_result; }
|
VkResult GetLastPresentResult() const { return m_last_present_result; }
|
||||||
|
bool CheckLastPresentDone() { return m_last_present_done.TestAndClear(); }
|
||||||
|
|
||||||
// Schedule a vulkan resource for destruction later on. This will occur when the command buffer
|
// Schedule a vulkan resource for destruction later on. This will occur when the command buffer
|
||||||
// is next re-used, and the GPU has finished working with the specified resource.
|
// is next re-used, and the GPU has finished working with the specified resource.
|
||||||
|
@ -159,6 +160,7 @@ private:
|
||||||
std::condition_variable m_submit_worker_condvar;
|
std::condition_variable m_submit_worker_condvar;
|
||||||
bool m_submit_worker_idle = true;
|
bool m_submit_worker_idle = true;
|
||||||
Common::Flag m_last_present_failed;
|
Common::Flag m_last_present_failed;
|
||||||
|
Common::Flag m_last_present_done;
|
||||||
VkResult m_last_present_result = VK_SUCCESS;
|
VkResult m_last_present_result = VK_SUCCESS;
|
||||||
bool m_use_threaded_submission = false;
|
bool m_use_threaded_submission = false;
|
||||||
u32 m_descriptor_set_count = DESCRIPTOR_SETS_PER_POOL;
|
u32 m_descriptor_set_count = DESCRIPTOR_SETS_PER_POOL;
|
||||||
|
|
|
@ -261,6 +261,9 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color)
|
||||||
{
|
{
|
||||||
StateTracker::GetInstance()->EndRenderPass();
|
StateTracker::GetInstance()->EndRenderPass();
|
||||||
|
|
||||||
|
if (!g_command_buffer_mgr->CheckLastPresentDone())
|
||||||
|
g_command_buffer_mgr->WaitForWorkerThreadIdle();
|
||||||
|
|
||||||
// Handle host window resizes.
|
// Handle host window resizes.
|
||||||
CheckForSurfaceChange();
|
CheckForSurfaceChange();
|
||||||
CheckForSurfaceResize();
|
CheckForSurfaceResize();
|
||||||
|
|
Loading…
Reference in New Issue