diff options
| author | 2022-04-18 23:21:02 +0200 | |
|---|---|---|
| committer | 2022-10-06 21:00:53 +0200 | |
| commit | cdce7f781bafabc364e61fa5cabf938349c9b82e (patch) | |
| tree | f2817ceb0bb60deb501c619e204445eda5538a92 /src/video_core | |
| parent | NvDec: Fix regressions. (diff) | |
| download | yuzu-cdce7f781bafabc364e61fa5cabf938349c9b82e.tar.gz yuzu-cdce7f781bafabc364e61fa5cabf938349c9b82e.tar.xz yuzu-cdce7f781bafabc364e61fa5cabf938349c9b82e.zip | |
Vulkan Swapchain: Overall improvements.
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_swapchain.cpp | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index d12669c9d..51d9e8f68 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -147,7 +147,7 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | |||
| 147 | const auto recreate_swapchain = [&] { | 147 | const auto recreate_swapchain = [&] { |
| 148 | if (!has_been_recreated) { | 148 | if (!has_been_recreated) { |
| 149 | has_been_recreated = true; | 149 | has_been_recreated = true; |
| 150 | scheduler.WaitWorker(); | 150 | scheduler.Finish(); |
| 151 | } | 151 | } |
| 152 | const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout(); | 152 | const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout(); |
| 153 | swapchain.Create(layout.width, layout.height, is_srgb); | 153 | swapchain.Create(layout.width, layout.height, is_srgb); |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index a69ae7725..706d9ba74 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -36,7 +36,8 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { | |||
| 36 | // Mailbox (triple buffering) doesn't lock the application like fifo (vsync), | 36 | // Mailbox (triple buffering) doesn't lock the application like fifo (vsync), |
| 37 | // prefer it if vsync option is not selected | 37 | // prefer it if vsync option is not selected |
| 38 | const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); | 38 | const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); |
| 39 | if (found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) { | 39 | if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Borderless && |
| 40 | found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) { | ||
| 40 | return VK_PRESENT_MODE_MAILBOX_KHR; | 41 | return VK_PRESENT_MODE_MAILBOX_KHR; |
| 41 | } | 42 | } |
| 42 | if (!Settings::values.use_speed_limit.GetValue()) { | 43 | if (!Settings::values.use_speed_limit.GetValue()) { |
| @@ -156,8 +157,16 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u3 | |||
| 156 | present_mode = ChooseSwapPresentMode(present_modes); | 157 | present_mode = ChooseSwapPresentMode(present_modes); |
| 157 | 158 | ||
| 158 | u32 requested_image_count{capabilities.minImageCount + 1}; | 159 | u32 requested_image_count{capabilities.minImageCount + 1}; |
| 159 | if (capabilities.maxImageCount > 0 && requested_image_count > capabilities.maxImageCount) { | 160 | // Ensure Tripple buffering if possible. |
| 160 | requested_image_count = capabilities.maxImageCount; | 161 | if (capabilities.maxImageCount > 0) { |
| 162 | if (requested_image_count > capabilities.maxImageCount) { | ||
| 163 | requested_image_count = capabilities.maxImageCount; | ||
| 164 | } else { | ||
| 165 | requested_image_count = | ||
| 166 | std::max(requested_image_count, std::min(3U, capabilities.maxImageCount)); | ||
| 167 | } | ||
| 168 | } else { | ||
| 169 | requested_image_count = std::max(requested_image_count, 3U); | ||
| 161 | } | 170 | } |
| 162 | VkSwapchainCreateInfoKHR swapchain_ci{ | 171 | VkSwapchainCreateInfoKHR swapchain_ci{ |
| 163 | .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, | 172 | .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, |