|
|
@ -36,7 +36,8 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) {
|
|
|
|
// Mailbox (triple buffering) doesn't lock the application like fifo (vsync),
|
|
|
|
// Mailbox (triple buffering) doesn't lock the application like fifo (vsync),
|
|
|
|
// prefer it if vsync option is not selected
|
|
|
|
// prefer it if vsync option is not selected
|
|
|
|
const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR);
|
|
|
|
const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR);
|
|
|
|
if (found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) {
|
|
|
|
if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Borderless &&
|
|
|
|
|
|
|
|
found_mailbox != modes.end() && !Settings::values.use_vsync.GetValue()) {
|
|
|
|
return VK_PRESENT_MODE_MAILBOX_KHR;
|
|
|
|
return VK_PRESENT_MODE_MAILBOX_KHR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!Settings::values.use_speed_limit.GetValue()) {
|
|
|
|
if (!Settings::values.use_speed_limit.GetValue()) {
|
|
|
@ -156,8 +157,16 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, u3
|
|
|
|
present_mode = ChooseSwapPresentMode(present_modes);
|
|
|
|
present_mode = ChooseSwapPresentMode(present_modes);
|
|
|
|
|
|
|
|
|
|
|
|
u32 requested_image_count{capabilities.minImageCount + 1};
|
|
|
|
u32 requested_image_count{capabilities.minImageCount + 1};
|
|
|
|
if (capabilities.maxImageCount > 0 && requested_image_count > capabilities.maxImageCount) {
|
|
|
|
// Ensure Tripple buffering if possible.
|
|
|
|
requested_image_count = capabilities.maxImageCount;
|
|
|
|
if (capabilities.maxImageCount > 0) {
|
|
|
|
|
|
|
|
if (requested_image_count > capabilities.maxImageCount) {
|
|
|
|
|
|
|
|
requested_image_count = capabilities.maxImageCount;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
requested_image_count =
|
|
|
|
|
|
|
|
std::max(requested_image_count, std::min(3U, capabilities.maxImageCount));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
requested_image_count = std::max(requested_image_count, 3U);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VkSwapchainCreateInfoKHR swapchain_ci{
|
|
|
|
VkSwapchainCreateInfoKHR swapchain_ci{
|
|
|
|
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
|
|
|
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
|
|
|