Mercurial > games > semicongine
diff 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 |
line wrap: on
line diff
--- a/semiconginev2/rendering/vulkan_wrappers.nim Sun Jul 21 11:31:11 2024 +0700 +++ b/semiconginev2/rendering/vulkan_wrappers.nim Mon Jul 22 00:46:10 2024 +0700 @@ -347,6 +347,22 @@ WithSingleUseCommandBuffer(commandBuffer): when T is (VkBuffer, uint64): + # first make sure memory has been made available with a memory barrier + # we are just waiting for the vertex input stage, but I think that is fine for most buffer copies (for now at least) + let memoryBarrier = VkMemoryBarrier(sType: VK_STRUCTURE_TYPE_MEMORY_BARRIER) + vkCmdPipelineBarrier( + commandBuffer = commandBuffer, + srcStageMask = toBits [VK_PIPELINE_STAGE_VERTEX_INPUT_BIT], + dstStageMask = toBits [VK_PIPELINE_STAGE_TRANSFER_BIT], + dependencyFlags = VkDependencyFlags(0), + memoryBarrierCount = 1, + pMemoryBarriers = addr(memoryBarrier), + bufferMemoryBarrierCount = 0, + pBufferMemoryBarriers = nil, + imageMemoryBarrierCount = 0, + pImageMemoryBarriers = nil, + ) + # now copy stuff let copyRegion = VkBufferCopy( size: bufferSize, dstOffset: target[1],