diff tests/test_vulkan_wrapper.nim @ 559:baaa620887b4

add: more vulkan objects
author Sam <sam@basx.dev>
date Mon, 06 Mar 2023 23:50:21 +0700
parents affa6571a2c9
children 4deffc94484a
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Thu Mar 02 23:16:45 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Mon Mar 06 23:50:21 2023 +0700
@@ -2,6 +2,7 @@
 
 import semicongine/vulkan
 import semicongine/platform/window
+import semicongine/math
 
 
 when isMainModule:
@@ -53,15 +54,26 @@
     selectedPhysicalDevice.filterForGraphicsPresentationQueues()
   )
 
-  echo "Created device ", device.physicalDevice.name
+  # setup render pipeline
   var (swapchain, res) = device.createSwapchain(device.physicalDevice.getSurfaceFormats().filterSurfaceFormat())
   if res != VK_SUCCESS:
     raise newException(Exception, "Unable to create swapchain")
+  var renderpass = device.simpleForwardRenderPass(swapchain.format)
+  var framebuffers: seq[Framebuffer]
+  for imageview in swapchain.imageviews:
+    framebuffers.add device.createFramebuffer(renderpass, [imageview], swapchain.dimension)
+
+  # todo: could be create inside "device", but it would be nice to have nim v2 with support for circular dependencies first
+  var commandPool = device.createCommandPool(family=device.firstGraphicsQueue().get().family, nBuffers=1)
 
   echo "All successfull"
   echo "Start cleanup"
 
+  commandPool.destroy()
   # cleanup
+  for fb in framebuffers.mitems:
+    fb.destroy()
+  renderpass.destroy()
   swapchain.destroy()
   device.destroy()