GlistEngine
Loading...
Searching...
No Matches
gVKSync.h
Go to the documentation of this file.
1/*
2 * gVKSync.h
3 *
4 * Synchronisation primitives of the Vulkan frame loop. Semaphores order work
5 * between GPU operations, fences let the CPU wait for the GPU.
6 * Created by: Ozlem Tutuneken.
7 */
8
9#pragma once
10
11#ifndef CORE_GVKSYNC_H
12#define CORE_GVKSYNC_H
13
14#include "gVKContext.h"
15
16#ifdef GVK_VULKAN
17
18/*
19 * Creates the per frame primitives: GVK_MAX_FRAMES_IN_FLIGHT image available
20 * semaphores and the same number of fences. The fences must be created already
21 * signalled, otherwise the very first vkWaitForFences never returns and the
22 * application freezes on its first frame.
23 */
24bool gvkCreateFrameSyncObjects(gVKContext& ctx);
25void gvkDestroyFrameSyncObjects(gVKContext& ctx);
26
27/*
28 * Creates one render finished semaphore per swapchain image. These are per image
29 * rather than per frame on purpose: presentation waits on the semaphore selected
30 * by the acquired image index, and binding them to the frame index instead makes
31 * current validation layers report semaphore reuse. Recreated with the swapchain.
32 */
33bool gvkCreatePresentSemaphores(gVKContext& ctx, uint32_t imagecount);
34void gvkDestroyPresentSemaphores(gVKContext& ctx);
35
36#endif /* GVK_VULKAN */
37
38#endif /* CORE_GVKSYNC_H */