Apply suggested changes for PR #138

This commit is contained in:
Yoan Lecoq 2022-06-21 20:33:51 +02:00 committed by Charles Giessen
parent 31408e0b9e
commit 8251bdbeee

View File

@ -1774,14 +1774,15 @@ detail::Result<Swapchain> SwapchainBuilder::build() const {
return detail::Error{ SwapchainError::failed_query_surface_support_details, surface_support_ret.vk_result() }; return detail::Error{ SwapchainError::failed_query_surface_support_details, surface_support_ret.vk_result() };
auto surface_support = surface_support_ret.value(); auto surface_support = surface_support_ret.value();
uint32_t image_count; uint32_t image_count = info.min_image_count;
if (info.required_min_image_count >= 1) { if (info.required_min_image_count >= 1) {
if (info.required_min_image_count < surface_support.capabilities.minImageCount) if (info.required_min_image_count < surface_support.capabilities.minImageCount)
return make_error_code(SwapchainError::required_min_image_count_too_low); return make_error_code(SwapchainError::required_min_image_count_too_low);
image_count = info.required_min_image_count; image_count = info.required_min_image_count;
} else if (info.min_image_count == 0) { } else if (info.min_image_count == 0) {
image_count = surface_support.capabilities.minImageCount + 1; // This has been the default behavior so far. // We intentionally use minImageCount + 1 to maintain existing behavior, even if it typically results in triple buffering on most systems.
image_count = surface_support.capabilities.minImageCount + 1;
} else { } else {
image_count = info.min_image_count; image_count = info.min_image_count;
if (image_count < surface_support.capabilities.minImageCount) if (image_count < surface_support.capabilities.minImageCount)