diff tests/test_vulkan_wrapper.nim @ 321:30117d8f0052

did next step in renderpipeline-refactoring, using shaderconfiguration objects instead for less ambigious shader-pipeline configuration
author Sam <sam@basx.dev>
date Tue, 15 Aug 2023 23:51:37 +0700
parents b145a05c2459
children 6dab370d1758
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Sun Aug 13 19:00:11 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Tue Aug 15 23:51:37 2023 +0700
@@ -85,25 +85,20 @@
 
   # INIT RENDERER:
   const
-    vertexInput = @[
-      attr[Vec3f]("position", memoryPerformanceHint=PreferFastRead),
-      attr[Vec4f]("color", memoryPerformanceHint=PreferFastWrite),
-      attr[Vec3f]("translate", perInstance=true)
-    ]
-    intermediate = @[attr[Vec4f]("outcolor")]
-    fragOutput = @[attr[Vec4f]("color")]
-    samplers = @[attr[Sampler2DType]("my_little_texture")]
-    uniforms = @[attr[float32]("time")]
-    (vertexCode, fragmentCode) = compileVertexFragmentShaderSet(
-      inputs=vertexInput,
-      intermediate=intermediate,
-      outputs=fragOutput,
-      samplers=samplers,
-      uniforms=uniforms,
+    shaderConfiguration = createShaderConfiguration(
+      inputs=[
+        attr[Vec3f]("position", memoryPerformanceHint=PreferFastRead),
+        attr[Vec4f]("color", memoryPerformanceHint=PreferFastWrite),
+        attr[Vec3f]("translate", perInstance=true)
+      ],
+      intermediates=[attr[Vec4f]("outcolor")],
+      outputs=[attr[Vec4f]("color")],
+      uniforms=[attr[float32]("time")],
+      samplers=[attr[Sampler2DType]("my_little_texture")],
       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)
+  var renderPass = engine.gpuDevice.simpleForwardRenderPass(shaderConfiguration)
   engine.setRenderer(renderPass)
 
   # INIT SCENES