Mercurial > games > semicongine
view src/semicongine/vulkan/syncing.nim @ 624:3f13de7d8ec4
fix: API change for shader attributes
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 29 Apr 2023 18:29:19 +0700 |
parents | 05ac2455ff60 |
children | 7f921d7d0a2b |
line wrap: on
line source
import ./api import ./device type Semaphore* = object vk*: VkSemaphore device: Device Fence* = object vk*: VkFence device: Device proc createSemaphore*(device: Device): Semaphore = assert device.vk.valid var semaphoreInfo = VkSemaphoreCreateInfo(sType: VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) result.device = device checkVkResult device.vk.vkCreateSemaphore(addr(semaphoreInfo), nil, addr(result.vk)) proc createFence*(device: Device): Fence = assert device.vk.valid var fenceInfo = VkFenceCreateInfo( sType: VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, flags: toBits [VK_FENCE_CREATE_SIGNALED_BIT] ) result.device = device checkVkResult device.vk.vkCreateFence(addr(fenceInfo), nil, addr(result.vk)) proc wait*(fence: Fence) = assert fence.device.vk.valid assert fence.vk.valid var varFence = fence.vk checkVkResult vkWaitForFences(fence.device.vk, 1, addr(varFence), false, high(uint64)) proc reset*(fence: Fence) = assert fence.device.vk.valid assert fence.vk.valid var varFence = fence.vk checkVkResult vkResetFences(fence.device.vk, 1, addr(varFence)) proc destroy*(semaphore: var Semaphore) = assert semaphore.device.vk.valid assert semaphore.vk.valid semaphore.device.vk.vkDestroySemaphore(semaphore.vk, nil) semaphore.vk.reset proc destroy*(fence: var Fence) = assert fence.device.vk.valid assert fence.vk.valid fence.device.vk.vkDestroyFence(fence.vk, nil) fence.vk.reset