# HG changeset patch # User Sam # Date 1674124772 -25200 # Node ID 5c8ce3d5a519e122fd84e5e2407a00494f28f845 # Parent 9fd6a78c94a204369d1aeb14c50d1c6a84c964f1 fix: wrong number of swapchain images diff -r 9fd6a78c94a2 -r 5c8ce3d5a519 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,