diff tests/test_text.nim @ 1379:9ca552dad5fc

did: continue working on new glyph-renderer
author sam <sam@basx.dev>
date Thu, 12 Dec 2024 19:17:43 +0700
parents 92c089136a05
children 4aa9e703af48
line wrap: on
line diff
--- a/tests/test_text.nim	Sat Dec 07 21:34:24 2024 +0700
+++ b/tests/test_text.nim	Thu Dec 12 19:17:43 2024 +0700
@@ -12,13 +12,24 @@
 type FontDS = object
   fontAtlas: Image[Gray]
 
+type EMPTY = object
+
 proc test_01_static_label_new(time: float32) =
   var font = loadFont("Overhaul.ttf", lineHeightPixels = 160)
   var renderdata = initRenderData()
   var pipeline =
     createPipeline[GlyphShader[200]](renderPass = vulkan.swapchain.renderPass)
+  var glyphs = Glyphs(
+    position: asGPUArray([vec3()], VertexBufferMapped),
+    scale: asGPUArray([1'f32], VertexBufferMapped),
+    color: asGPUArray([vec4(1, 1, 1, 1)], VertexBufferMapped),
+    glyphIndex: asGPUArray([0'u16], VertexBufferMapped),
+  )
 
-  var ds = asDescriptorSetData(GlyphDescriptors[200](fontAtlas: font.fontAtlas.copy()))
+  var ds =
+    asDescriptorSetData(GlyphDescriptorSet[200](fontAtlas: font.fontAtlas.copy()))
+  assignBuffers(renderdata, glyphs)
+  assignBuffers(renderdata, ds)
   uploadImages(renderdata, ds)
   initDescriptorSet(renderdata, pipeline.layout(0), ds)
 
@@ -35,7 +46,7 @@
         vec4(0, 0, 0, 0),
       ):
         withPipeline(commandbuffer, pipeline):
-          render(commandbuffer, pipeline, label1, vec3(), vec4(1, 1, 1, 1))
+          render(commandbuffer, pipeline, EMPTY(), glyphs, fixedVertexCount = 6)
 
         # cleanup
   checkVkResult vkDeviceWaitIdle(vulkan.device)
@@ -69,15 +80,7 @@
         vec4(0, 0, 0, 0),
       ):
         withPipeline(commandbuffer, pipeline):
-          proc render(
-            commandBuffer = commandbuffer,
-            pipeline = pipeline,
-            mesh: TMesh,
-            instances: TInstance,
-            fixedVertexCount = -1,
-            fixedInstanceCount = -1,
-          )
-
+          render(commandbuffer, pipeline, label1, vec3(), vec4(1, 1, 1, 1))
         # cleanup
   checkVkResult vkDeviceWaitIdle(vulkan.device)
   destroyPipeline(pipeline)
@@ -288,10 +291,10 @@
 
     # tests a simple triangle with minimalistic shader and vertex format
     test_01_static_label_new(time)
-    test_01_static_label(time)
-    test_02_multiple_animated(time)
-    test_03_layouting(time)
-    test_04_lots_of_texts(time)
+    # test_01_static_label(time)
+    # test_02_multiple_animated(time)
+    # test_03_layouting(time)
+    # test_04_lots_of_texts(time)
 
     checkVkResult vkDeviceWaitIdle(vulkan.device)
     vkDestroyRenderPass(vulkan.device, renderpass.vk, nil)