Vulkan/Wayland: Use old swapchain size if none provided.

This commit is contained in:
BearOso 2024-02-07 18:41:18 -06:00
parent f83a57fe25
commit 68af8fe783
1 changed files with 5 additions and 2 deletions

View File

@ -124,7 +124,10 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
else
num_swapchain_images = desired_num_swapchain_images;
extents = surface_capabilities.currentExtent;
// If extents aren't reported (Wayland), we have to rely on Wayland to report
// the size, so keep current extent.
if (surface_capabilities.currentExtent.width != -1)
extents = surface_capabilities.currentExtent;
uint32_t graphics_queue_index = 0;
auto queue_properties = physical_device.getQueueFamilyProperties();
@ -396,4 +399,4 @@ vk::RenderPass &Swapchain::get_render_pass()
return render_pass.get();
}
} // namespace Vulkan
} // namespace Vulkan