Fix #138032: Vulkan: Loading minimized windows on Windows/NVIDIA

Minimized windows have the resolution of 0,0. The surface supports
swapchains with this resolution, however it doesn't work and leads
to crashes and UBs.

This PR fixes this to use a minimum resolution of 1,1.

Pull Request: https://projects.blender.org/blender/blender/pulls/138750
This commit is contained in:
Jeroen Bakker
2025-05-12 10:30:13 +02:00
parent ddbd880fa9
commit e934792169

View File

@@ -882,6 +882,19 @@ GHOST_TSuccess GHOST_ContextVK::recreateSwapchain()
}
}
/* Windows/NVIDIA doesn't support creating a surface image with resolution 0,0. Minimuzed windows
* have an extent of 0,0. Although it fits in the specs returned by
* vkGetPhysicalDeviceSurfaceCapabilitiesKHR.
*
* Ref #138032
*/
if (m_render_extent.width == 0) {
m_render_extent.width = 1;
}
if (m_render_extent.height == 0) {
m_render_extent.height = 1;
}
/* Use double buffering when using FIFO. Increasing the number of images could stall when doing
* actions that require low latency (paint cursor, UI resizing). MAILBOX prefers triple
* buffering. */