diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-04-30 21:39:00 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-05-03 03:51:29 +0200 |
commit | 6f0929df82be77f116988cf16cde4ebbc5f978dc (patch) | |
tree | b12668b13bce18dc9b628cf77b2d935ca0ab4f71 /src/video_core/renderer_vulkan | |
parent | Merge pull request #9973 from GPUCode/async-present (diff) | |
download | yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar.gz yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar.bz2 yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar.lz yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar.xz yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.tar.zst yuzu-6f0929df82be77f116988cf16cde4ebbc5f978dc.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 23bbea7f1..08d82769c 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -34,21 +34,22 @@ VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats) } VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { - // Mailbox (triple buffering) doesn't lock the application like fifo (vsync), - // prefer it if vsync option is not selected - const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); - if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Borderless && - found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) { + // Mailbox (triple buffering) doesn't lock the application like FIFO (vsync) + // FIFO present mode locks the framerate to the monitor's refresh rate + const bool has_mailbox = + std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR) != modes.end(); + const bool has_imm = + std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_IMMEDIATE_KHR) != modes.end(); + const Settings::VSyncMode mode = Settings::values.vsync_mode.GetValue(); + + if (mode == Settings::VSyncMode::Immediate && has_imm) { + LOG_INFO(Render_Vulkan, "Using swap present mode Immediate"); + return VK_PRESENT_MODE_IMMEDIATE_KHR; + } else if (mode == Settings::VSyncMode::Mailbox && has_mailbox) { + LOG_INFO(Render_Vulkan, "Using swap present mode Mailbox"); return VK_PRESENT_MODE_MAILBOX_KHR; } - if (!Settings::values.use_speed_limit.GetValue()) { - // FIFO present mode locks the framerate to the monitor's refresh rate, - // Find an alternative to surpass this limitation if FPS is unlocked. - const auto found_imm = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_IMMEDIATE_KHR); - if (found_imm != modes.end()) { - return VK_PRESENT_MODE_IMMEDIATE_KHR; - } - } + LOG_INFO(Render_Vulkan, "Using swap present mode FIFO"); return VK_PRESENT_MODE_FIFO_KHR; } |