diff tests/test_vulkan_wrapper.nim @ 316:b145a05c2459

add: changing rendering system, not finished yet, also upgrading to Nim 2
author Sam <sam@basx.dev>
date Mon, 07 Aug 2023 00:23:00 +0700
parents 4921ec86dcb4
children 30117d8f0052
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Sun Jul 23 19:59:47 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Mon Aug 07 00:23:00 2023 +0700
@@ -90,25 +90,18 @@
       attr[Vec4f]("color", memoryPerformanceHint=PreferFastWrite),
       attr[Vec3f]("translate", perInstance=true)
     ]
-    vertexOutput = @[attr[Vec4f]("outcolor")]
-    uniforms = @[attr[float32]("time")]
-    samplers = @[attr[Sampler2DType]("my_little_texture")]
+    intermediate = @[attr[Vec4f]("outcolor")]
     fragOutput = @[attr[Vec4f]("color")]
-    vertexCode = compileGlslShader(
-      stage=VK_SHADER_STAGE_VERTEX_BIT,
+    samplers = @[attr[Sampler2DType]("my_little_texture")]
+    uniforms = @[attr[float32]("time")]
+    (vertexCode, fragmentCode) = compileVertexFragmentShaderSet(
       inputs=vertexInput,
-      uniforms=uniforms,
+      intermediate=intermediate,
+      outputs=fragOutput,
       samplers=samplers,
-      outputs=vertexOutput,
-      main="""gl_Position = vec4(position + translate, 1.0); outcolor = color;"""
-    )
-    fragmentCode = compileGlslShader(
-      stage=VK_SHADER_STAGE_FRAGMENT_BIT,
-      inputs=vertexOutput,
       uniforms=uniforms,
-      samplers=samplers,
-      outputs=fragOutput,
-      main="color = texture(my_little_texture, outcolor.xy) * 0.5 + outcolor * 0.5;"
+      vertexCode="""gl_Position = vec4(position + translate, 1.0); outcolor = color;""",
+      fragmentCode="color = texture(my_little_texture, outcolor.xy) * 0.5 + outcolor * 0.5;",
     )
   var renderPass = engine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode)
   engine.setRenderer(renderPass)