Manages Vulkan semaphores and fences to synchronize frames in flight.
More...
#include <VulkanFrameSync.hpp>
|
| VkDevice | device = VK_NULL_HANDLE |
| | Reference to logical device.
|
| uint32_t | maxFrames = 0 |
| | Max frames allowed in flight.
|
| uint32_t | currentFrame = 0 |
| | Active frame index.
|
| std::vector< VkSemaphore > | imageAvailableSemaphores |
| | Semaphores waiting for image availability.
|
| std::vector< VkSemaphore > | renderFinishedSemaphores |
| | Semaphores waiting for render passes to complete.
|
| std::vector< VkFence > | inFlightFences |
| | Fences waiting for queue work execution completion.
|
Manages Vulkan semaphores and fences to synchronize frames in flight.
◆ VulkanFrameSync() [1/2]
| VulkanFrameSync::VulkanFrameSync |
( |
| ) |
|
|
default |
Construct a new Vulkan Frame Sync object.
◆ ~VulkanFrameSync()
| VulkanFrameSync::~VulkanFrameSync |
( |
| ) |
|
Destroy the Vulkan Frame Sync object and release sync objects.
Destroy the Vulkan Frame Sync:: Vulkan Frame Sync object.
◆ VulkanFrameSync() [2/2]
◆ create()
| void VulkanFrameSync::create |
( |
VkDevice | dev, |
|
|
uint32_t | maxFramesInFlight = 2 ) |
Allocates synchronization semaphores and fences.
Creates synchronization objects (semaphores, fences) for in-flight frames.
- Parameters
-
| device | Vulkan logical device context. |
| maxFramesInFlight | Maximum frame buffers in flight concurrently. |
| dev | Logical device context. |
| maxFramesInFlight | Maximum frames allowed concurrently in flight. |
◆ destroy()
| void VulkanFrameSync::destroy |
( |
| ) |
|
Safely destroys synchronization primitives.
Safely destroys synchronization semaphores and fences.
◆ getCurrentFrameIndex()
| uint32_t VulkanFrameSync::getCurrentFrameIndex |
( |
| ) |
const |
|
inline |
Gets current active double-buffered index.
- Returns
- Index value.
◆ getImageAvailableSemaphore()
| VkSemaphore VulkanFrameSync::getImageAvailableSemaphore |
( |
| ) |
const |
|
inline |
Gets image acquisition semaphore.
- Returns
- VkSemaphore handle.
◆ getInFlightFence()
| VkFence VulkanFrameSync::getInFlightFence |
( |
| ) |
const |
|
inline |
Gets current in-flight queue submission fence.
- Returns
- VkFence handle.
◆ getRenderFinishedSemaphore()
| VkSemaphore VulkanFrameSync::getRenderFinishedSemaphore |
( |
| ) |
const |
|
inline |
Gets render completion semaphore.
- Returns
- VkSemaphore handle.
◆ nextFrame()
| void VulkanFrameSync::nextFrame |
( |
| ) |
|
Progresses the frame index counter.
Advances active frame buffer index.
◆ operator=()
◆ waitForCurrentFrame()
| void VulkanFrameSync::waitForCurrentFrame |
( |
| ) |
|
Blocks host execution until current frame fence is signaled, then resets it.
Blocks CPU thread until active frame fence is signaled, then resets it.
◆ currentFrame
| uint32_t VulkanFrameSync::currentFrame = 0 |
|
private |
◆ device
| VkDevice VulkanFrameSync::device = VK_NULL_HANDLE |
|
private |
Reference to logical device.
◆ imageAvailableSemaphores
| std::vector<VkSemaphore> VulkanFrameSync::imageAvailableSemaphores |
|
private |
Semaphores waiting for image availability.
◆ inFlightFences
| std::vector<VkFence> VulkanFrameSync::inFlightFences |
|
private |
Fences waiting for queue work execution completion.
◆ maxFrames
| uint32_t VulkanFrameSync::maxFrames = 0 |
|
private |
Max frames allowed in flight.
◆ renderFinishedSemaphores
| std::vector<VkSemaphore> VulkanFrameSync::renderFinishedSemaphores |
|
private |
Semaphores waiting for render passes to complete.
The documentation for this class was generated from the following files: