summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorGPUCode <geoster3d@gmail.com>2023-05-01 22:12:28 +0200
committerGPUCode <geoster3d@gmail.com>2023-05-01 22:13:24 +0200
commitf403d2794187bd136fb4d30fb7a6aea950145013 (patch)
tree0e78d295ae6cbe48dc5ab76b96424044e90dad5b /src/video_core/renderer_vulkan
parentvk_blit_screen: Recreate FSR when frame is recreated (diff)
downloadyuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar.gz
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar.bz2
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar.lz
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar.xz
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.tar.zst
yuzu-f403d2794187bd136fb4d30fb7a6aea950145013.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_present_manager.cpp16
-rw-r--r--src/video_core/renderer_vulkan/vk_present_manager.h3
2 files changed, 17 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp
index 0b8e8ad27..a137c66f2 100644
--- a/src/video_core/renderer_vulkan/vk_present_manager.cpp
+++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/microprofile.h"
+#include "common/settings.h"
#include "common/thread.h"
#include "video_core/renderer_vulkan/vk_present_manager.h"
#include "video_core/renderer_vulkan/vk_scheduler.h"
@@ -97,6 +98,7 @@ PresentManager::PresentManager(Core::Frontend::EmuWindow& render_window_, const
: render_window{render_window_}, device{device_},
memory_allocator{memory_allocator_}, scheduler{scheduler_}, swapchain{swapchain_},
blit_supported{CanBlitToSwapchain(device.GetPhysical(), swapchain.GetImageViewFormat())},
+ use_present_thread{Settings::values.async_presentation.GetValue()},
image_count{swapchain.GetImageCount()} {
auto& dld = device.GetLogical();
@@ -126,7 +128,9 @@ PresentManager::PresentManager(Core::Frontend::EmuWindow& render_window_, const
free_queue.push(&frame);
}
- present_thread = std::jthread([this](std::stop_token token) { PresentThread(token); });
+ if (use_present_thread) {
+ present_thread = std::jthread([this](std::stop_token token) { PresentThread(token); });
+ }
}
PresentManager::~PresentManager() = default;
@@ -150,6 +154,12 @@ Frame* PresentManager::GetRenderFrame() {
}
void PresentManager::PushFrame(Frame* frame) {
+ if (!use_present_thread) {
+ CopyToSwapchain(frame);
+ free_queue.push(frame);
+ return;
+ }
+
std::unique_lock lock{queue_mutex};
present_queue.push(frame);
frame_cv.notify_one();
@@ -227,6 +237,10 @@ void PresentManager::RecreateFrame(Frame* frame, u32 width, u32 height, bool is_
}
void PresentManager::WaitPresent() {
+ if (!use_present_thread) {
+ return;
+ }
+
// Wait for the present queue to be empty
{
std::unique_lock queue_lock{queue_mutex};
diff --git a/src/video_core/renderer_vulkan/vk_present_manager.h b/src/video_core/renderer_vulkan/vk_present_manager.h
index f5d9fc96d..9885fd7c6 100644
--- a/src/video_core/renderer_vulkan/vk_present_manager.h
+++ b/src/video_core/renderer_vulkan/vk_present_manager.h
@@ -75,7 +75,8 @@ private:
std::mutex queue_mutex;
std::mutex free_mutex;
std::jthread present_thread;
- bool blit_supported{};
+ bool blit_supported;
+ bool use_present_thread;
std::size_t image_count;
};