I have a problem I have postponed until now but I need to resolve this. In our application the main thread handles Win32 window events and message handling. A second thread is used for rendering, and contains all our Vulkan code. This works perfectly fine until the issue of window resizing comes up. If I drag a resizable window around a bit, I will receive Vulkan validation errors like this after a few seconds:
Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x2871d308270, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1266,473), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1286,473), minImageExtent = (1286,473), maxImageExtent = (1286,473). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://vulkan.lunarg.com/doc/view/220.127.116.11/windows/1.2-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
I presume what is happening is the window is being resized on the main thread and the new size does not match the expected size at the start of a rendering operation.
How do you suggest I handle this issue?