comparison src/engine.nim @ 9:227e53d1a853

fix: segfault on shutdown
author Sam <sam@basx.dev>
date Sat, 24 Dec 2022 22:38:03 +0700
parents 1134f41a49e9
children 3415afff1d1a
comparison
equal deleted inserted replaced
8:1134f41a49e9 9:227e53d1a853
555 addr(bufferImageIndex) 555 addr(bufferImageIndex)
556 ) 556 )
557 if nextImageResult == VK_ERROR_OUT_OF_DATE_KHR: 557 if nextImageResult == VK_ERROR_OUT_OF_DATE_KHR:
558 vulkan.frameDimension = window.getFrameDimension(vulkan.device.physicalDevice.device, vulkan.surface) 558 vulkan.frameDimension = window.getFrameDimension(vulkan.device.physicalDevice.device, vulkan.surface)
559 (vulkan.swapchain, vulkan.framebuffers) = vulkan.recreateSwapchain() 559 (vulkan.swapchain, vulkan.framebuffers) = vulkan.recreateSwapchain()
560 return
561 elif not (nextImageResult in [VK_SUCCESS, VK_SUBOPTIMAL_KHR]): 560 elif not (nextImageResult in [VK_SUCCESS, VK_SUBOPTIMAL_KHR]):
562 raise newException(Exception, "Vulkan error: vkAcquireNextImageKHR returned " & $nextImageResult) 561 raise newException(Exception, "Vulkan error: vkAcquireNextImageKHR returned " & $nextImageResult)
563 checkVkResult vulkan.device.device.vkResetFences(1, addr(vulkan.inFlightFences[currentFrame])) 562 checkVkResult vulkan.device.device.vkResetFences(1, addr(vulkan.inFlightFences[currentFrame]))
564 563
565 checkVkResult vulkan.commandBuffers[currentFrame].vkResetCommandBuffer(VkCommandBufferResetFlags(0)) 564 checkVkResult vulkan.commandBuffers[currentFrame].vkResetCommandBuffer(VkCommandBufferResetFlags(0))
640 engine.vulkan.instance.vkDestroySurfaceKHR(engine.vulkan.surface, nil) 639 engine.vulkan.instance.vkDestroySurfaceKHR(engine.vulkan.surface, nil)
641 engine.vulkan.device.device.vkDestroyDevice(nil) 640 engine.vulkan.device.device.vkDestroyDevice(nil)
642 when ENABLEVULKANVALIDATIONLAYERS: 641 when ENABLEVULKANVALIDATIONLAYERS:
643 engine.vulkan.instance.vkDestroyDebugUtilsMessengerEXT(engine.vulkan.debugMessenger, nil) 642 engine.vulkan.instance.vkDestroyDebugUtilsMessengerEXT(engine.vulkan.debugMessenger, nil)
644 glslang_finalize_process() 643 glslang_finalize_process()
644 engine.window.trash()
645 engine.vulkan.instance.vkDestroyInstance(nil) 645 engine.vulkan.instance.vkDestroyInstance(nil)
646 engine.window.trash()