|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Fluent builder for queue submissions with timeline and binary semaphores. More...
#include <QueueSubmitBuilder.h>
Public Member Functions | |
| QueueSubmitBuilder (const TimelineSynchronizer &sync, uint64_t frameNumber) | |
| Constructs a submit builder. | |
| QueueSubmitBuilder & | waitFor (PipelineStage stage, VkPipelineStageFlags2 waitStages, uint64_t frameNumber) |
| Adds a timeline wait for a specific frame's stage (GPU-GPU sync) | |
| QueueSubmitBuilder & | waitForCurrent (PipelineStage stage, VkPipelineStageFlags2 waitStages) |
| Convenience: wait for same frame's earlier stage. | |
| QueueSubmitBuilder & | waitForPrevious (PipelineStage stage, VkPipelineStageFlags2 waitStages) |
| Convenience: wait for previous frame's stage. | |
| QueueSubmitBuilder & | waitForResourceReuse (PipelineStage stage, VkPipelineStageFlags2 waitStages) |
| Convenience: wait for resource reuse (frames-in-flight pattern) | |
| QueueSubmitBuilder & | waitForBinary (VkSemaphore semaphore, VkPipelineStageFlags2 waitStages) |
| Adds a binary semaphore wait (for swapchain acquire, etc.) | |
| QueueSubmitBuilder & | signalStage (PipelineStage stage) |
| Signals the timeline semaphore at a specific stage. | |
| QueueSubmitBuilder & | signalBinary (VkSemaphore semaphore) |
| Signals a binary semaphore at completion (for present) | |
| QueueSubmitBuilder & | withCommandBuffer (VkCommandBuffer cmdBuffer) |
| Adds a command buffer to be executed. | |
| QueueSubmitBuilder & | withCommandBuffers (const std::vector< VkCommandBuffer > &cmdBuffers) |
| Adds multiple command buffers to be executed. | |
| VkResult | submit (VkQueue queue, VkFence fence=VK_NULL_HANDLE) |
| Builds and submits to the specified queue. | |
| uint64_t | getLastSignalValue () const |
| Gets the signal value for the last stage added Useful for debugging or for CPU-side waits. | |
Private Attributes | |
| const TimelineSynchronizer & | sync_ |
| uint64_t | frameNumber_ |
| uint64_t | lastSignalValue_ = 0 |
| std::vector< VkSemaphoreSubmitInfo > | waitInfos_ |
| std::vector< VkSemaphoreSubmitInfo > | signalInfos_ |
| std::vector< VkCommandBufferSubmitInfo > | cmdBufferInfos_ |
Fluent builder for queue submissions with timeline and binary semaphores.
Provides a clean API for constructing VkSubmitInfo2 structures with proper synchronization between pipeline stages. Supports both timeline semaphores (for GPU-GPU sync) and binary semaphores (for swapchain/present operations).
Example usage:
Definition at line 31 of file QueueSubmitBuilder.h.
|
explicit |
Constructs a submit builder.
| sync | The timeline synchronizer for value computation |
| frameNumber | The current frame number |
Definition at line 6 of file QueueSubmitBuilder.cpp.
References frameNumber_, and sync_.
Referenced by signalBinary(), signalStage(), waitFor(), waitForBinary(), waitForCurrent(), waitForPrevious(), waitForResourceReuse(), withCommandBuffer(), and withCommandBuffers().
|
inlinenodiscard |
Gets the signal value for the last stage added Useful for debugging or for CPU-side waits.
Definition at line 148 of file QueueSubmitBuilder.h.
References lastSignalValue_.
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::signalBinary | ( | VkSemaphore | semaphore | ) |
Signals a binary semaphore at completion (for present)
| semaphore | The binary semaphore to signal |
Definition at line 111 of file QueueSubmitBuilder.cpp.
References QueueSubmitBuilder(), and signalInfos_.
Referenced by EngineCore::Renderer::submitGraphics().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::signalStage | ( | PipelineStage | stage | ) |
Signals the timeline semaphore at a specific stage.
| stage | The pipeline stage being completed |
Definition at line 94 of file QueueSubmitBuilder.cpp.
References frameNumber_, lastSignalValue_, QueueSubmitBuilder(), signalInfos_, and sync_.
Referenced by EngineCore::Renderer::submitGraphics(), EngineCore::Renderer::submitInitialTransfers(), and EngineCore::Renderer::submitTransfer().
| VkResult EngineCore::QueueSubmitBuilder::submit | ( | VkQueue | queue, |
| VkFence | fence = VK_NULL_HANDLE ) |
Builds and submits to the specified queue.
| queue | The queue to submit to |
| fence | Optional fence to signal on completion |
Definition at line 150 of file QueueSubmitBuilder.cpp.
References cmdBufferInfos_, signalInfos_, and waitInfos_.
Referenced by EngineCore::Renderer::submitGraphics(), EngineCore::Renderer::submitInitialTransfers(), and EngineCore::Renderer::submitTransfer().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::waitFor | ( | PipelineStage | stage, |
| VkPipelineStageFlags2 | waitStages, | ||
| uint64_t | frameNumber ) |
Adds a timeline wait for a specific frame's stage (GPU-GPU sync)
| stage | The pipeline stage to wait for |
| waitStages | The Vulkan pipeline stages that need to wait |
| frameNumber | Which frame's stage to wait for |
Definition at line 12 of file QueueSubmitBuilder.cpp.
References QueueSubmitBuilder(), sync_, and waitInfos_.
Referenced by waitForCurrent().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::waitForBinary | ( | VkSemaphore | semaphore, |
| VkPipelineStageFlags2 | waitStages ) |
Adds a binary semaphore wait (for swapchain acquire, etc.)
| semaphore | The binary semaphore to wait on |
| waitStages | The Vulkan pipeline stages that need to wait |
Definition at line 76 of file QueueSubmitBuilder.cpp.
References QueueSubmitBuilder(), and waitInfos_.
Referenced by EngineCore::Renderer::submitGraphics().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::waitForCurrent | ( | PipelineStage | stage, |
| VkPipelineStageFlags2 | waitStages ) |
Convenience: wait for same frame's earlier stage.
| stage | The pipeline stage to wait for |
| waitStages | The Vulkan pipeline stages that need to wait |
Definition at line 31 of file QueueSubmitBuilder.cpp.
References frameNumber_, QueueSubmitBuilder(), and waitFor().
Referenced by EngineCore::Renderer::submitGraphics().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::waitForPrevious | ( | PipelineStage | stage, |
| VkPipelineStageFlags2 | waitStages ) |
Convenience: wait for previous frame's stage.
| stage | The pipeline stage to wait for |
| waitStages | The Vulkan pipeline stages that need to wait |
Definition at line 38 of file QueueSubmitBuilder.cpp.
References frameNumber_, QueueSubmitBuilder(), sync_, and waitInfos_.
Referenced by EngineCore::Renderer::submitGraphics().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::waitForResourceReuse | ( | PipelineStage | stage, |
| VkPipelineStageFlags2 | waitStages ) |
Convenience: wait for resource reuse (frames-in-flight pattern)
Waits for the frame that last used this resource slot.
| stage | The pipeline stage to wait for |
| waitStages | The Vulkan pipeline stages that need to wait |
Definition at line 57 of file QueueSubmitBuilder.cpp.
References frameNumber_, QueueSubmitBuilder(), sync_, and waitInfos_.
Referenced by EngineCore::Renderer::submitTransfer().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::withCommandBuffer | ( | VkCommandBuffer | cmdBuffer | ) |
Adds a command buffer to be executed.
| cmdBuffer | The command buffer to execute |
Definition at line 127 of file QueueSubmitBuilder.cpp.
References cmdBufferInfos_, and QueueSubmitBuilder().
Referenced by EngineCore::Renderer::submitGraphics(), EngineCore::Renderer::submitInitialTransfers(), EngineCore::Renderer::submitTransfer(), and withCommandBuffers().
| QueueSubmitBuilder & EngineCore::QueueSubmitBuilder::withCommandBuffers | ( | const std::vector< VkCommandBuffer > & | cmdBuffers | ) |
Adds multiple command buffers to be executed.
| cmdBuffers | The command buffers to execute |
Definition at line 141 of file QueueSubmitBuilder.cpp.
References QueueSubmitBuilder(), and withCommandBuffer().
|
private |
Definition at line 157 of file QueueSubmitBuilder.h.
Referenced by submit(), and withCommandBuffer().
|
private |
Definition at line 152 of file QueueSubmitBuilder.h.
Referenced by QueueSubmitBuilder(), signalStage(), waitForCurrent(), waitForPrevious(), and waitForResourceReuse().
|
private |
Definition at line 153 of file QueueSubmitBuilder.h.
Referenced by getLastSignalValue(), and signalStage().
|
private |
Definition at line 156 of file QueueSubmitBuilder.h.
Referenced by signalBinary(), signalStage(), and submit().
|
private |
Definition at line 151 of file QueueSubmitBuilder.h.
Referenced by QueueSubmitBuilder(), signalStage(), waitFor(), waitForPrevious(), and waitForResourceReuse().
|
private |
Definition at line 155 of file QueueSubmitBuilder.h.
Referenced by submit(), waitFor(), waitForBinary(), waitForPrevious(), and waitForResourceReuse().