# HG changeset patch # User sam # Date 1711812107 -25200 # Node ID 17943f768402b83577820be9397fc0ebc9e6ad24 # Parent 5ef3e789b67271bf6277ef3e9b1a41af2738069a fix: error, and shorten some code diff -r 5ef3e789b672 -r 17943f768402 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]