diff options
author | GPUCode <geoster3d@gmail.com> | 2023-05-03 06:48:18 +0200 |
---|---|---|
committer | GPUCode <geoster3d@gmail.com> | 2023-05-03 06:50:10 +0200 |
commit | f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee (patch) | |
tree | c3b3a36f0050941e51e404b531d2a3e14fc1b39e /src/video_core | |
parent | Merge pull request #9973 from GPUCode/async-present (diff) | |
download | yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar.gz yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar.bz2 yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar.lz yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar.xz yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.tar.zst yuzu-f3fcc15ad5d77aa6d8cbd8dcc3f043e218224dee.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_present_manager.cpp | 11 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_present_manager.h | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 69dc76180..908625c66 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -134,7 +134,7 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { Frame* frame = present_manager.GetRenderFrame(); blit_screen.DrawToSwapchain(frame, *framebuffer, use_accelerated, is_srgb); scheduler.Flush(*frame->render_ready); - scheduler.Record([this, frame](vk::CommandBuffer) { present_manager.PushFrame(frame); }); + present_manager.Present(frame); gpu.RendererFrameEndNotify(); rasterizer.TickFrame(); diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp index a137c66f2..c49583013 100644 --- a/src/video_core/renderer_vulkan/vk_present_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp @@ -153,16 +153,19 @@ Frame* PresentManager::GetRenderFrame() { return frame; } -void PresentManager::PushFrame(Frame* frame) { +void PresentManager::Present(Frame* frame) { if (!use_present_thread) { + scheduler.WaitWorker(); CopyToSwapchain(frame); free_queue.push(frame); return; } - std::unique_lock lock{queue_mutex}; - present_queue.push(frame); - frame_cv.notify_one(); + scheduler.Record([this, frame](vk::CommandBuffer) { + std::unique_lock lock{queue_mutex}; + present_queue.push(frame); + frame_cv.notify_one(); + }); } void PresentManager::RecreateFrame(Frame* frame, u32 width, u32 height, bool is_srgb, diff --git a/src/video_core/renderer_vulkan/vk_present_manager.h b/src/video_core/renderer_vulkan/vk_present_manager.h index 9885fd7c6..420a775e2 100644 --- a/src/video_core/renderer_vulkan/vk_present_manager.h +++ b/src/video_core/renderer_vulkan/vk_present_manager.h @@ -45,7 +45,7 @@ public: Frame* GetRenderFrame(); /// Pushes a frame for presentation - void PushFrame(Frame* frame); + void Present(Frame* frame); /// Recreates the present frame to match the provided parameters void RecreateFrame(Frame* frame, u32 width, u32 height, bool is_srgb, |