# HG changeset patch # User Sam # Date 1674124772 -25200 # Node ID 5ab7fb4d9ee9038d55a3db6e2a24625712221d28 # Parent 7684744ab1a4e27d4580df60716eee01279032b2 fix: wrong number of swapchain images diff -r 7684744ab1a4 -r 5ab7fb4d9ee9 src/semicongine/engine.nim --- a/src/semicongine/engine.nim Thu Jan 19 17:00:06 2023 +0700 +++ b/src/semicongine/engine.nim Thu Jan 19 17:39:32 2023 +0700 @@ -180,11 +180,13 @@ let capabilities = physicalDevice.device.getSurfaceCapabilities(surface) var selectedPresentationMode = getPresentMode(physicalDevice.presentModes) + var imageCount = capabilities.minImageCount + 1 + imageCount = max(min(capabilities.maxImageCount, imageCount), 1) # setup swapchain var swapchainCreateInfo = VkSwapchainCreateInfoKHR( sType: VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, surface: surface, - minImageCount: max(capabilities.minImageCount + 1, capabilities.maxImageCount), + minImageCount: imageCount, imageFormat: surfaceFormat.format, imageColorSpace: surfaceFormat.colorSpace, imageExtent: dimension,