changeset 1056:0c0be07b97cc

fix: error, and shorten some code
author sam <sam@basx.dev>
date Sat, 30 Mar 2024 22:21:47 +0700
parents 4bf4c029b880
children 70d4d53ee9d2
files semicongine/vulkan/swapchain.nim
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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]