Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Wraps synchronization primitives and command buffers for an inflight frame. More...
#include <foray_inflightframe.hpp>
Public Member Functions | |
void | Create (core::Context *context, uint32_t auxCommandBufferCount=0) |
void | Destroy () |
virtual | ~InFlightFrame () |
ESwapchainInteractResult | AcquireSwapchainImage () |
Acquires next swapchain image and stores the resulting index in mSwapchainImageIndex. | |
ESwapchainInteractResult | Present () |
Presents the previously acquired image. The primary command buffer must have been submitted prior to this call! | |
void | ClearSwapchainImage (VkCommandBuffer cmdBuffer, core::ImageLayoutCache &imgLayoutCache) |
Writes vkCmdClearColorImage cmd to the primary command buffer for the acquired image. | |
void | PrepareSwapchainImageForPresent (VkCommandBuffer cmdBuffer, core::ImageLayoutCache &imgLayoutCache) |
Adds a Pipeline barrier transitioning the swapchain image into present layout and assuring all writes to it have finished. | |
bool | HasFinishedExecution () |
Non-blocking check wether the frame has been finished execution. | |
void | WaitForExecutionFinished () |
Blocks the current thread until the frame has finished execution. | |
void | ResetFence () |
Resets the frames host synchronization fence. | |
void | SubmitAll () |
Submits all command buffers by getting all VkSubmitInfo2{} structures from DeviceSyncCommandBuffer::WriteToSubmitInfo(...) and submitting them in a single vkQueueSubmit2(...) call. | |
core::DeviceSyncCommandBuffer & | GetAuxiliaryCommandBuffer (uint32_t index) |
Get an auxiliary command buffer. | |
core::DeviceSyncCommandBuffer & | GetPrimaryCommandBuffer () |
Get primary command buffer. | |
core::DeviceSyncCommandBuffer & | GetCommandBuffer (CmdBufferIndex index) |
Get a command buffer. | |
const core::DeviceSyncCommandBuffer & | GetAuxiliaryCommandBuffer (uint32_t index) const |
Get an auxiliary command buffer. | |
const core::DeviceSyncCommandBuffer & | GetPrimaryCommandBuffer () const |
Get primary command buffer. | |
const core::DeviceSyncCommandBuffer & | GetCommandBuffer (CmdBufferIndex index) const |
Get a command buffer. | |
Protected Attributes | |
core::Context * | mContext = nullptr |
std::vector< std::unique_ptr< core::DeviceSyncCommandBuffer > > | mAuxiliaryCommandBuffers |
Auxiliary command buffers. | |
core::DeviceSyncCommandBuffer | mPrimaryCommandBuffer |
Primary command buffer. | |
VkSemaphore | mSwapchainImageReady = nullptr |
Semaphore signalled by the device when the swapchain image becomes ready. | |
VkSemaphore | mPrimaryCompletedSemaphore = nullptr |
Semaphore signalled by the primary command buffer when execution has finished. | |
VkFence | mPrimaryCompletedFence = nullptr |
Fence signalled after the primary / all command buffers have finished execution. | |
uint32_t | mSwapchainImageIndex = 0 |
Wraps synchronization primitives and command buffers for an inflight frame.
USAGE (SINGLE CMD BUFFER PER FRAME):
USAGE (MULTIPLE)
|
inlinevirtual |
ESwapchainInteractResult foray::base::InFlightFrame::AcquireSwapchainImage | ( | ) |
Acquires next swapchain image and stores the resulting index in mSwapchainImageIndex.
void foray::base::InFlightFrame::ClearSwapchainImage | ( | VkCommandBuffer | cmdBuffer, |
core::ImageLayoutCache & | imgLayoutCache | ||
) |
Writes vkCmdClearColorImage cmd to the primary command buffer for the acquired image.
void foray::base::InFlightFrame::Create | ( | core::Context * | context, |
uint32_t | auxCommandBufferCount = 0 |
||
) |
void foray::base::InFlightFrame::Destroy | ( | ) |
core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetAuxiliaryCommandBuffer | ( | uint32_t | index | ) |
Get an auxiliary command buffer.
index | Command buffer index to return |
const core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetAuxiliaryCommandBuffer | ( | uint32_t | index | ) | const |
Get an auxiliary command buffer.
index | Command buffer index to return |
core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetCommandBuffer | ( | CmdBufferIndex | index | ) |
Get a command buffer.
index | If PRIMARY_COMMAND_BUFFER, the primary is returned. Auxiliary command buffer index otherwise |
const core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetCommandBuffer | ( | CmdBufferIndex | index | ) | const |
Get a command buffer.
index | If PRIMARY_COMMAND_BUFFER, the primary is returned. Auxiliary command buffer index otherwise |
core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetPrimaryCommandBuffer | ( | ) |
Get primary command buffer.
const core::DeviceSyncCommandBuffer & foray::base::InFlightFrame::GetPrimaryCommandBuffer | ( | ) | const |
Get primary command buffer.
bool foray::base::InFlightFrame::HasFinishedExecution | ( | ) |
Non-blocking check wether the frame has been finished execution.
void foray::base::InFlightFrame::PrepareSwapchainImageForPresent | ( | VkCommandBuffer | cmdBuffer, |
core::ImageLayoutCache & | imgLayoutCache | ||
) |
Adds a Pipeline barrier transitioning the swapchain image into present layout and assuring all writes to it have finished.
ESwapchainInteractResult foray::base::InFlightFrame::Present | ( | ) |
Presents the previously acquired image. The primary command buffer must have been submitted prior to this call!
void foray::base::InFlightFrame::ResetFence | ( | ) |
Resets the frames host synchronization fence.
void foray::base::InFlightFrame::SubmitAll | ( | ) |
Submits all command buffers by getting all VkSubmitInfo2{} structures from DeviceSyncCommandBuffer::WriteToSubmitInfo(...) and submitting them in a single vkQueueSubmit2(...) call.
void foray::base::InFlightFrame::WaitForExecutionFinished | ( | ) |
Blocks the current thread until the frame has finished execution.
|
protected |
Auxiliary command buffers.
|
protected |
|
protected |
Primary command buffer.
|
protected |
Fence signalled after the primary / all command buffers have finished execution.
|
protected |
Semaphore signalled by the primary command buffer when execution has finished.
|
protected |
|
protected |
Semaphore signalled by the device when the swapchain image becomes ready.