Mercurial > games > semicongine
annotate src/semicongine/vulkan/syncing.nim @ 566:cc7ba46fe3c4
add: descriptors, better swapchain implementation
author | Sam <sam@basx.dev> |
---|---|
date | Fri, 24 Mar 2023 00:11:42 +0700 |
parents | 8de8a2102071 |
children | 9c3e3dcb0328 |
rev | line source |
---|---|
559 | 1 import ./api |
2 import ./device | |
3 | |
4 type | |
566
cc7ba46fe3c4
add: descriptors, better swapchain implementation
Sam <sam@basx.dev>
parents:
560
diff
changeset
|
5 Semaphore* = object |
559 | 6 vk*: VkSemaphore |
7 device: Device | |
566
cc7ba46fe3c4
add: descriptors, better swapchain implementation
Sam <sam@basx.dev>
parents:
560
diff
changeset
|
8 Fence* = object |
559 | 9 vk*: VkFence |
10 device: Device | |
11 | |
560
8de8a2102071
add: vertex and (initial) shader types and methods
Sam <sam@basx.dev>
parents:
559
diff
changeset
|
12 proc createSemaphore*(device: Device): Semaphore = |
559 | 13 assert device.vk.valid |
14 var semaphoreInfo = VkSemaphoreCreateInfo(sType: VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) | |
15 result.device = device | |
16 checkVkResult device.vk.vkCreateSemaphore(addr(semaphoreInfo), nil, addr(result.vk)) | |
17 | |
560
8de8a2102071
add: vertex and (initial) shader types and methods
Sam <sam@basx.dev>
parents:
559
diff
changeset
|
18 proc createFence*(device: Device): Fence = |
559 | 19 assert device.vk.valid |
20 var fenceInfo = VkFenceCreateInfo( | |
21 sType: VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, | |
22 flags: toBits [VK_FENCE_CREATE_SIGNALED_BIT] | |
23 ) | |
24 result.device = device | |
25 checkVkResult device.vk.vkCreateFence(addr(fenceInfo), nil, addr(result.vk)) | |
26 | |
560
8de8a2102071
add: vertex and (initial) shader types and methods
Sam <sam@basx.dev>
parents:
559
diff
changeset
|
27 proc destroy*(semaphore: var Semaphore) = |
559 | 28 assert semaphore.device.vk.valid |
29 assert semaphore.vk.valid | |
30 semaphore.device.vk.vkDestroySemaphore(semaphore.vk, nil) | |
31 semaphore.vk.reset | |
32 | |
560
8de8a2102071
add: vertex and (initial) shader types and methods
Sam <sam@basx.dev>
parents:
559
diff
changeset
|
33 proc destroy*(fence: var Fence) = |
559 | 34 assert fence.device.vk.valid |
35 assert fence.vk.valid | |
36 fence.device.vk.vkDestroyFence(fence.vk, nil) | |
37 fence.vk.reset |