changeset 563:fb42da98c1aa

did: update to use new shader concept
author Sam <sam@basx.dev>
date Fri, 17 Mar 2023 01:11:58 +0700
parents bfb75f2cd493
children 20837928dc63
files tests/test_vulkan_wrapper.nim
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Fri Mar 17 01:11:43 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Fri Mar 17 01:11:58 2023 +0700
@@ -7,6 +7,8 @@
 type
   Vertex = object
     pos: Vec3
+  Uniforms = object
+    time: float32
 
 
 when isMainModule:
@@ -74,17 +76,28 @@
     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)
+  var vertexshader = shader(Vertex, Uniforms, device):
+    shadertype: VK_SHADER_STAGE_VERTEX_BIT
+    entrypoint: "main"
+    version: 450
+    code: """"""
+  var fragmentshader = shader(Vertex, Uniforms, device):
+    shadertype: VK_SHADER_STAGE_FRAGMENT_BIT
+    entrypoint: "main"
+    version: 450
+    code: ""
+
+  #var vertexshader = loadShaderCode[Vertex, Uniforms](device, vertexshadercode)
+  #var fragmentshader = loadShaderCode[Vertex, Uniforms](device, fragmentshadercode)
+  #var pipeline = renderpass.createPipeline(vertexshaderhandle, fragmentshaderhandle)
 
   echo "All successfull"
   echo "Start cleanup"
 
   # cleanup
-  pipeline.destroy()
-  vertexshader.destroy()
-  fragmentshader.destroy()
+  #pipeline.destroy()
+  #vertexshader.destroy()
+  #fragmentshader.destroy()
   inflight.destroy()
   imageAvailable.destroy()
   renderFinished.destroy()