Mercurial > games > semicongine
comparison tests/test_text.nim @ 1335:f2ff6f624932
fix: image copies of font atlas
author | sam <sam@basx.dev> |
---|---|
date | Thu, 22 Aug 2024 22:31:05 +0700 |
parents | df3c075e5dea |
children |
comparison
equal
deleted
inserted
replaced
1334:d5a6f69dc855 | 1335:f2ff6f624932 |
---|---|
16 var font = loadFont("Overhaul.ttf", lineHeightPixels = 160) | 16 var font = loadFont("Overhaul.ttf", lineHeightPixels = 160) |
17 var renderdata = initRenderData() | 17 var renderdata = initRenderData() |
18 var pipeline = | 18 var pipeline = |
19 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) | 19 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) |
20 | 20 |
21 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas)) | 21 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas.copy())) |
22 uploadImages(renderdata, ds) | 22 uploadImages(renderdata, ds) |
23 initDescriptorSet(renderdata, pipeline.layout(0), ds) | 23 initDescriptorSet(renderdata, pipeline.layout(0), ds) |
24 | 24 |
25 var label1 = | 25 var label1 = |
26 initTextbox(renderdata, pipeline.layout(0), font, 0.0005, "Hello semicongine!") | 26 initTextbox(renderdata, pipeline.layout(0), font, 0.0005, "Hello semicongine!") |
53 var renderdata = initRenderData() | 53 var renderdata = initRenderData() |
54 | 54 |
55 var pipeline = | 55 var pipeline = |
56 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) | 56 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) |
57 | 57 |
58 var ds1 = asDescriptorSetData(FontDS(fontAtlas: font1.fontAtlas)) | 58 var ds1 = asDescriptorSetData(FontDS(fontAtlas: font1.fontAtlas.copy())) |
59 uploadImages(renderdata, ds1) | 59 uploadImages(renderdata, ds1) |
60 initDescriptorSet(renderdata, pipeline.layout(0), ds1) | 60 initDescriptorSet(renderdata, pipeline.layout(0), ds1) |
61 | 61 |
62 var ds2 = asDescriptorSetData(FontDS(fontAtlas: font2.fontAtlas)) | 62 var ds2 = asDescriptorSetData(FontDS(fontAtlas: font2.fontAtlas.copy())) |
63 uploadImages(renderdata, ds2) | 63 uploadImages(renderdata, ds2) |
64 initDescriptorSet(renderdata, pipeline.layout(0), ds2) | 64 initDescriptorSet(renderdata, pipeline.layout(0), ds2) |
65 | 65 |
66 var ds3 = asDescriptorSetData(FontDS(fontAtlas: font3.fontAtlas)) | 66 var ds3 = asDescriptorSetData(FontDS(fontAtlas: font3.fontAtlas.copy())) |
67 uploadImages(renderdata, ds3) | 67 uploadImages(renderdata, ds3) |
68 initDescriptorSet(renderdata, pipeline.layout(0), ds3) | 68 initDescriptorSet(renderdata, pipeline.layout(0), ds3) |
69 | 69 |
70 var labels = [ | 70 var labels = [ |
71 initTextbox(renderdata, pipeline.layout(0), font1, 0.004, " 0"), | 71 initTextbox(renderdata, pipeline.layout(0), font1, 0.004, " 0"), |
126 var renderdata = initRenderData() | 126 var renderdata = initRenderData() |
127 | 127 |
128 var pipeline = | 128 var pipeline = |
129 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) | 129 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) |
130 | 130 |
131 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas)) | 131 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas.copy())) |
132 uploadImages(renderdata, ds) | 132 uploadImages(renderdata, ds) |
133 initDescriptorSet(renderdata, pipeline.layout(0), ds) | 133 initDescriptorSet(renderdata, pipeline.layout(0), ds) |
134 | 134 |
135 var labels: seq[Textbox] | 135 var labels: seq[Textbox] |
136 | 136 |
199 var renderdata = initRenderData() | 199 var renderdata = initRenderData() |
200 | 200 |
201 var pipeline = | 201 var pipeline = |
202 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) | 202 createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass) |
203 | 203 |
204 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas)) | 204 var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas.copy())) |
205 uploadImages(renderdata, ds) | 205 uploadImages(renderdata, ds) |
206 initDescriptorSet(renderdata, pipeline.layout(0), ds) | 206 initDescriptorSet(renderdata, pipeline.layout(0), ds) |
207 | 207 |
208 var labels: seq[Textbox] | 208 var labels: seq[Textbox] |
209 var positions = newSeq[Vec3f](100) | 209 var positions = newSeq[Vec3f](100) |