From 69c090b14a34f94b1346bdd209eaea0866366e07 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 28 Sep 2019 20:29:55 +0300 Subject: [PATCH] vk: Check frame descriptors before rendering in case of a flip request between begin() and end() - There is no reason to delay async flip requests since most of the work can be handled during rendering anyway --- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 46 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 6e98b150af..e806cdf657 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -925,30 +925,6 @@ void VKGSRender::begin() return; init_buffers(rsx::framebuffer_creation_context::context_draw); - - if (!framebuffer_status_valid) - return; - - if (m_current_frame->flags & frame_context_state::dirty) - { - check_present_status(); - - if (m_current_frame->swap_command_buffer) - { - // Borrow time by using the auxilliary context - m_aux_frame_context.grab_resources(*m_current_frame); - m_current_frame = &m_aux_frame_context; - } - else if (m_current_frame->used_descriptors) - { - m_current_frame->descriptor_pool.reset(0); - m_current_frame->used_descriptors = 0; - } - - verify(HERE), !m_current_frame->swap_command_buffer; - - m_current_frame->flags &= ~frame_context_state::dirty; - } } void VKGSRender::update_draw_state() @@ -1206,6 +1182,28 @@ void VKGSRender::end() return; } + // Check for frame resource status here because it is possible for an async flip to happen between begin/end + if (UNLIKELY(m_current_frame->flags & frame_context_state::dirty)) + { + check_present_status(); + + if (UNLIKELY(m_current_frame->swap_command_buffer)) + { + // Borrow time by using the auxilliary context + m_aux_frame_context.grab_resources(*m_current_frame); + m_current_frame = &m_aux_frame_context; + } + else if (m_current_frame->used_descriptors) + { + m_current_frame->descriptor_pool.reset(0); + m_current_frame->used_descriptors = 0; + } + + verify(HERE), !m_current_frame->swap_command_buffer; + + m_current_frame->flags &= ~frame_context_state::dirty; + } + m_profiler.start(); // Check for data casts