# HG changeset patch # User sam # Date 1711907330 -25200 # Node ID e0e7cdea5e4c97882301d0219e40a0d4fa5a3fbe # Parent 43e8d2236220b3d7e843f146bbaf4a4b79d0e5d9 fix: swapchain recreating had a bug diff -r 43e8d2236220 -r e0e7cdea5e4c semicongine/renderer.nim --- a/semicongine/renderer.nim Mon Apr 01 00:34:34 2024 +0700 +++ b/semicongine/renderer.nim Mon Apr 01 00:48:50 2024 +0700 @@ -413,8 +413,9 @@ scene.clearDirtyShaderGlobals() proc startNewFrame*(renderer: var Renderer) = - # this is kinda important as we will wait for the queue finished fence from the swapchain - if not renderer.swapchain.acquireNextFrame(): + # TODO: chance for an infinity-loop + while not renderer.swapchain.acquireNextFrame(): + checkVkResult renderer.device.vk.vkDeviceWaitIdle() let res = renderer.swapchain.recreate() if not res.isSome: raise newException(Exception, "Unable to recreate swapchain") diff -r 43e8d2236220 -r e0e7cdea5e4c semicongine/vulkan/commandbuffer.nim --- a/semicongine/vulkan/commandbuffer.nim Mon Apr 01 00:34:34 2024 +0700 +++ b/semicongine/vulkan/commandbuffer.nim Mon Apr 01 00:48:50 2024 +0700 @@ -82,7 +82,6 @@ commandBufferPool.destroy() - proc destroy*(commandpool: var CommandBufferPool) = assert commandpool.device.vk.valid assert commandpool.vk.valid