comparison semiconginev2/rendering/renderer.nim @ 1236:176383220123

add: first font-rendering test
author sam <sam@basx.dev>
date Sat, 20 Jul 2024 17:45:44 +0700
parents 841e12f33c47
children 69489a678141
comparison
equal deleted inserted replaced
1235:c70fee6568f6 1236:176383220123
288 FlushBuffer(gpuData.buffer) 288 FlushBuffer(gpuData.buffer)
289 else: 289 else:
290 WithStagingBuffer((gpuData.buffer.vk, gpuData.offset), gpuData.size, stagingPtr): 290 WithStagingBuffer((gpuData.buffer.vk, gpuData.offset), gpuData.size, stagingPtr):
291 copyMem(stagingPtr, gpuData.rawPointer, gpuData.size) 291 copyMem(stagingPtr, gpuData.rawPointer, gpuData.size)
292 292
293 proc UpdateAllGPUBuffers*[T](value: T) = 293 proc UpdateAllGPUBuffers*[T](value: T, flush = false) =
294 for name, fieldvalue in value.fieldPairs(): 294 for name, fieldvalue in value.fieldPairs():
295 when typeof(fieldvalue) is GPUData: 295 when typeof(fieldvalue) is GPUData:
296 UpdateGPUBuffer(fieldvalue) 296 UpdateGPUBuffer(fieldvalue, flush = flush)
297 when typeof(fieldvalue) is array: 297 when typeof(fieldvalue) is array:
298 when elementType(fieldvalue) is GPUData: 298 when elementType(fieldvalue) is GPUData:
299 for entry in fieldvalue: 299 for entry in fieldvalue:
300 UpdateGPUBuffer(entry) 300 UpdateGPUBuffer(entry, flush = flush)
301 301
302 proc AssignGPUData(renderdata: var RenderData, value: var GPUData) = 302 proc AssignGPUData(renderdata: var RenderData, value: var GPUData) =
303 # find buffer that has space 303 # find buffer that has space
304 var selectedBufferI = -1 304 var selectedBufferI = -1
305 305