Vulkan: Check image extents for surface compatibility.

This commit is contained in:
BearOso 2023-09-04 11:56:10 -05:00
parent f45e22b08d
commit 5314bc8db0
1 changed files with 9 additions and 5 deletions

View File

@ -139,11 +139,15 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
swapchain_object.reset(); swapchain_object.reset();
return false; return false;
} }
else if (extents.width > 8192 || extents.height > 8192)
{ if (extents.width > surface_capabilities.maxImageExtent.width)
extents.width = 512; extents.width = surface_capabilities.maxImageExtent.width;
extents.height = 512; if (extents.height > surface_capabilities.maxImageExtent.height)
} extents.height = surface_capabilities.maxImageExtent.height;
if (extents.width < surface_capabilities.minImageExtent.width)
extents.width = surface_capabilities.minImageExtent.width;
if (extents.height < surface_capabilities.minImageExtent.height)
extents.height = surface_capabilities.minImageExtent.height;
auto present_modes = physical_device.getSurfacePresentModesKHR(surface); auto present_modes = physical_device.getSurfacePresentModesKHR(surface);
auto tearing_present_mode = vk::PresentModeKHR::eFifo; auto tearing_present_mode = vk::PresentModeKHR::eFifo;