comparison tests/test_text.nim @ 1321:385dbd68a947

did: a TON of copy elimination, some tests run now waaaay faster
author sam <sam@basx.dev>
date Thu, 15 Aug 2024 12:12:27 +0700
parents 5de466f5f087
children 373a4888f6ac
comparison
equal deleted inserted replaced
1320:19e3eedb9a41 1321:385dbd68a947
89 labels[i].refresh() 89 labels[i].refresh()
90 inc p 90 inc p
91 withNextFrame(framebuffer, commandbuffer): 91 withNextFrame(framebuffer, commandbuffer):
92 withRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)): 92 withRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
93 withPipeline(commandbuffer, pipeline): 93 withPipeline(commandbuffer, pipeline):
94 for label in labels: 94 for label in labels.litems:
95 render(commandbuffer, pipeline, label) 95 render(commandbuffer, pipeline, label)
96 96
97 # cleanup 97 # cleanup
98 checkVkResult vkDeviceWaitIdle(vulkan.device) 98 checkVkResult vkDeviceWaitIdle(vulkan.device)
99 destroyPipeline(pipeline) 99 destroyPipeline(pipeline)
175 $i, 175 $i,
176 color = vec4(rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0)), 176 color = vec4(rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0)),
177 scale = rand(0.0002 .. 0.002), 177 scale = rand(0.0002 .. 0.002),
178 position = vec3(rand(-0.5 .. 0.5), rand(-0.5 .. 0.5), rand(-0.1 .. 0.1)) 178 position = vec3(rand(-0.5 .. 0.5), rand(-0.5 .. 0.5), rand(-0.1 .. 0.1))
179 ) 179 )
180 labels = labels.sortedByIt(-it.position.z) 180 labels.sort(proc(x, y: Textbox): int = cmp(x.position.z, y.position.z), Ascending)
181 181
182 var start = getMonoTime() 182 var start = getMonoTime()
183 while ((getMonoTime() - start).inMilliseconds().int / 1000) < time: 183 while ((getMonoTime() - start).inMilliseconds().int / 1000) < time:
184 for l in labels.mitems: 184 for l in labels.mitems:
185 l.refresh() 185 l.refresh()