diff --git a/src/VkBootstrap.cpp b/src/VkBootstrap.cpp index 7e94028..a50bcd9 100644 --- a/src/VkBootstrap.cpp +++ b/src/VkBootstrap.cpp @@ -1633,7 +1633,7 @@ Result query_surface_support_details(VkPhysicalDevice phy return SurfaceSupportDetails{ capabilities, formats, present_modes }; } -Result find_desired_surface_format(VkPhysicalDevice phys_device, +Result find_desired_surface_format(VkPhysicalDevice /* phys_device */, std::vector const& available_formats, std::vector const& desired_formats) { for (auto const& desired_format : desired_formats) { @@ -1671,11 +1671,6 @@ VkPresentModeKHR find_present_mode(std::vector const& availabl return VK_PRESENT_MODE_FIFO_KHR; } -bool is_unextended_present_mode(VkPresentModeKHR present_mode) { - return (present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) || (present_mode == VK_PRESENT_MODE_MAILBOX_KHR) || - (present_mode == VK_PRESENT_MODE_FIFO_KHR) || (present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR); -} - template T minimum(T a, T b) { return a < b ? a : b; } template T maximum(T a, T b) { return a > b ? a : b; } @@ -1795,7 +1790,12 @@ Result SwapchainBuilder::build() const { VkPresentModeKHR present_mode = detail::find_present_mode(surface_support.present_modes, desired_present_modes); // VkSurfaceCapabilitiesKHR::supportedUsageFlags is only only valid for some present modes. For shared present modes, we should also check VkSharedPresentSurfaceCapabilitiesKHR::sharedPresentSupportedUsageFlags. - if (detail::is_unextended_present_mode(present_mode) && + auto is_unextended_present_mode = [](VkPresentModeKHR present_mode) { + return (present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) || (present_mode == VK_PRESENT_MODE_MAILBOX_KHR) || + (present_mode == VK_PRESENT_MODE_FIFO_KHR) || (present_mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR); + }; + + if (is_unextended_present_mode(present_mode) && (info.image_usage_flags & surface_support.capabilities.supportedUsageFlags) != info.image_usage_flags) { return Error{ SwapchainError::required_usage_not_supported }; }