Manages frame synchronization, swapchain image acquisition, queue submission, and command buffers.
More...
#include <FrameManager.hpp>
|
| | FrameManager (VkDevice dev, VkQueue graphicsQ, VkQueue presentQ, VkSwapchainKHR sc, uint32_t framesInFlight=2) |
| | Construct a new Frame Manager object.
|
| | ~FrameManager () |
| | Destroy the Frame Manager object, releasing sync handles.
|
| void | init (VkCommandPool commandPool) |
| | Allocates command buffers and creates semaphores and fences.
|
| void | beginFrame (uint32_t &imageIndex) |
| | Prepares for frame drawing by waiting for the in-flight fence, acquiring the next swapchain image, and resetting command buffers.
|
| void | endFrame (uint32_t imageIndex) |
| | Submits command buffers to the graphics queue and presents the swapchain image.
|
| VkCommandBuffer | getCurrentCommandBuffer () const |
| | Gets command buffer active for the current in-flight frame.
|
Manages frame synchronization, swapchain image acquisition, queue submission, and command buffers.
◆ FrameManager()
| FrameManager::FrameManager |
( |
VkDevice | dev, |
|
|
VkQueue | gQ, |
|
|
VkQueue | pQ, |
|
|
VkSwapchainKHR | sc, |
|
|
uint32_t | framesInFlight = 2 ) |
Construct a new Frame Manager object.
Construct a new Frame Manager:: Frame Manager object.
- Parameters
-
| dev | Logical Vulkan device. |
| graphicsQ | Queue for rendering submissions. |
| presentQ | Queue for presentation. |
| sc | Target Vulkan swapchain. |
| framesInFlight | Number of frames allowed in flight concurrently. |
| dev | Logical device context. |
| gQ | Graphics queue. |
| pQ | Present queue. |
| sc | Swapchain. |
| framesInFlight | Frame buffer count. |
◆ ~FrameManager()
| FrameManager::~FrameManager |
( |
| ) |
|
Destroy the Frame Manager object, releasing sync handles.
Destroy the Frame Manager:: Frame Manager object and clean up synchronization handles.
◆ beginFrame()
| void FrameManager::beginFrame |
( |
uint32_t & | imageIndex | ) |
|
Prepares for frame drawing by waiting for the in-flight fence, acquiring the next swapchain image, and resetting command buffers.
Waits on in-flight synchronization fences, gets next swapchain index and resets command buffers.
- Parameters
-
| imageIndex | Out parameter for acquired image index. |
| imageIndex | Target index reference. |
◆ endFrame()
| void FrameManager::endFrame |
( |
uint32_t | imageIndex | ) |
|
Submits command buffers to the graphics queue and presents the swapchain image.
Submits rendering command buffer to graphics queue and registers present requests.
- Parameters
-
| imageIndex | Acquired swapchain image index. |
| imageIndex | Target swapchain index. |
◆ getCurrentCommandBuffer()
| VkCommandBuffer FrameManager::getCurrentCommandBuffer |
( |
| ) |
const |
|
inline |
Gets command buffer active for the current in-flight frame.
- Returns
- Current command buffer.
◆ init()
| void FrameManager::init |
( |
VkCommandPool | commandPool | ) |
|
Allocates command buffers and creates semaphores and fences.
Initializes frame resources, creating semaphores, fences, and allocating command buffers.
- Parameters
-
| commandPool | Parent Vulkan command pool. |
| commandPool | The Vulkan command pool. |
◆ commandBuffers
| std::vector<VkCommandBuffer> FrameManager::commandBuffers |
|
private |
◆ currentFrame
| uint32_t FrameManager::currentFrame = 0 |
|
private |
◆ device
| VkDevice FrameManager::device |
|
private |
◆ graphicsQueue
| VkQueue FrameManager::graphicsQueue |
|
private |
◆ imageAvailableSemaphores
| std::vector<VkSemaphore> FrameManager::imageAvailableSemaphores |
|
private |
◆ inFlightFences
| std::vector<VkFence> FrameManager::inFlightFences |
|
private |
◆ maxFramesInFlight
| uint32_t FrameManager::maxFramesInFlight |
|
private |
◆ presentQueue
| VkQueue FrameManager::presentQueue |
|
private |
◆ renderFinishedSemaphores
| std::vector<VkSemaphore> FrameManager::renderFinishedSemaphores |
|
private |
◆ swapchain
| VkSwapchainKHR FrameManager::swapchain |
|
private |
The documentation for this class was generated from the following files: