# HG changeset patch # User sam # Date 1711812107 -25200 # Node ID 0c0be07b97cc2c5627420063b5492f91397a7596 # Parent 4bf4c029b880192e1c3cb17bef6f9c7c21ce32df fix: error, and shorten some code diff -r 4bf4c029b880 -r 0c0be07b97cc semicongine/vulkan/swapchain.nim --- a/semicongine/vulkan/swapchain.nim Sat Mar 30 22:16:38 2024 +0700 +++ b/semicongine/vulkan/swapchain.nim Sat Mar 30 22:21:47 2024 +0700 @@ -91,14 +91,14 @@ let image = VulkanImage(vk: vkimage, format: surfaceFormat.format, device: device) let imageview = image.createImageView() swapChain.imageviews.add imageview - swapChain.framebuffers.add swapchain.device.createFramebuffer(renderPass, [imageview], swapchain.dimension) + swapChain.framebuffers.add device.createFramebuffer(renderPass, [imageview], swapchain.dimension) for i in 0 ..< swapchain.inFlightFrames: swapchain.queueFinishedFence.add device.createFence() swapchain.imageAvailableSemaphore.add device.createSemaphore() swapchain.renderFinishedSemaphore.add device.createSemaphore() debug &"Created swapchain with: {nImages} framebuffers, {inFlightFrames} in-flight frames, {swapchain.dimension.x}x{swapchain.dimension.y}" - assert swapchain.device.firstPresentationQueue().isSome, "No present queue found" - swapchain.presentQueue = swapchain.device.firstPresentationQueue().get + assert device.firstPresentationQueue().isSome, "No present queue found" + swapchain.presentQueue = device.firstPresentationQueue().get result = some(swapchain) else: result = none(Swapchain) @@ -132,7 +132,7 @@ proc swap*(swapchain: var Swapchain, queue: Queue, commandBuffer: VkCommandBuffer): bool = assert swapchain.device.vk.valid assert swapchain.vk.valid - assert queue.vk.isSome + assert queue.vk.valid var waitSemaphores = [swapchain.imageAvailableSemaphore[swapchain.currentInFlight].vk]