comparison semiconginev2/rendering/vulkan_wrappers.nim @ 1239:69489a678141

add: better syncing, better swapchain access, correct font offset, two font-rendering tests
author sam <sam@basx.dev>
date Mon, 22 Jul 2024 00:46:10 +0700
parents 5dcb503ef0c0
children
comparison
equal deleted inserted replaced
1238:03634915bbdb 1239:69489a678141
345 ) 345 )
346 checkVkResult vkFlushMappedMemoryRanges(vulkan.device, 1, addr(stagingRange)) 346 checkVkResult vkFlushMappedMemoryRanges(vulkan.device, 1, addr(stagingRange))
347 347
348 WithSingleUseCommandBuffer(commandBuffer): 348 WithSingleUseCommandBuffer(commandBuffer):
349 when T is (VkBuffer, uint64): 349 when T is (VkBuffer, uint64):
350 # first make sure memory has been made available with a memory barrier
351 # we are just waiting for the vertex input stage, but I think that is fine for most buffer copies (for now at least)
352 let memoryBarrier = VkMemoryBarrier(sType: VK_STRUCTURE_TYPE_MEMORY_BARRIER)
353 vkCmdPipelineBarrier(
354 commandBuffer = commandBuffer,
355 srcStageMask = toBits [VK_PIPELINE_STAGE_VERTEX_INPUT_BIT],
356 dstStageMask = toBits [VK_PIPELINE_STAGE_TRANSFER_BIT],
357 dependencyFlags = VkDependencyFlags(0),
358 memoryBarrierCount = 1,
359 pMemoryBarriers = addr(memoryBarrier),
360 bufferMemoryBarrierCount = 0,
361 pBufferMemoryBarriers = nil,
362 imageMemoryBarrierCount = 0,
363 pImageMemoryBarriers = nil,
364 )
365 # now copy stuff
350 let copyRegion = VkBufferCopy( 366 let copyRegion = VkBufferCopy(
351 size: bufferSize, 367 size: bufferSize,
352 dstOffset: target[1], 368 dstOffset: target[1],
353 srcOffset: 0 369 srcOffset: 0
354 ) 370 )