diff tests/test_vulkan_wrapper.nim @ 560:8de8a2102071

add: vertex and (initial) shader types and methods
author Sam <sam@basx.dev>
date Tue, 14 Mar 2023 13:21:40 +0700
parents baaa620887b4
children c782d7e52b25
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Mon Mar 06 23:50:21 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Tue Mar 14 13:21:40 2023 +0700
@@ -4,6 +4,10 @@
 import semicongine/platform/window
 import semicongine/math
 
+type
+  Vertex = object
+    pos: Vec3
+
 
 when isMainModule:
   # print basic driver infos
@@ -64,13 +68,27 @@
     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)
+  var
+    commandPool = device.createCommandPool(family=device.firstGraphicsQueue().get().family, nBuffers=1)
+    imageAvailable = device.createSemaphore()
+    renderFinished = device.createSemaphore()
+    inflight = device.createFence()
+
+  var vertexshader = device.createVertexShader("#version 450\nvoid main() {}", Vertex())
+  var fragmentshader = device.createFragmentShader("#version 450\nvoid main() {}")
+  var pipeline = renderpass.createPipeline(vertexshader, fragmentshader)
 
   echo "All successfull"
   echo "Start cleanup"
 
+  # cleanup
+  pipeline.destroy()
+  vertexshader.destroy()
+  fragmentshader.destroy()
+  inflight.destroy()
+  imageAvailable.destroy()
+  renderFinished.destroy()
   commandPool.destroy()
-  # cleanup
   for fb in framebuffers.mitems:
     fb.destroy()
   renderpass.destroy()