Skip to content
Snippets Groups Projects
Commit 7d2bea42 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#96] Document command stream manager

parent 3d26ebba
No related branches found
No related tags found
1 merge request!97Resolve "Dokumentation vervollständigen"
Pipeline #27503 passed
...@@ -9,10 +9,17 @@ namespace vkcv { ...@@ -9,10 +9,17 @@ namespace vkcv {
class Core; class Core;
/**
* @brief Responsible for creation, deletion, callbacks and recording of command streams
*/
class CommandStreamManager class CommandStreamManager
{ {
friend class Core; friend class Core;
private: private:
/**
* @brief Represents one command stream, into which commands can be recorded into.
* Consists of a command buffer, the command buffer's command pool and a queue, as well as some callbacks.
*/
struct CommandStream { struct CommandStream {
inline CommandStream(vk::CommandBuffer cmdBuffer, vk::Queue queue, vk::CommandPool cmdPool) inline CommandStream(vk::CommandBuffer cmdBuffer, vk::Queue queue, vk::CommandPool cmdPool)
: cmdBuffer(cmdBuffer), cmdPool(cmdPool), queue(queue) {}; : cmdBuffer(cmdBuffer), cmdPool(cmdPool), queue(queue) {};
...@@ -38,17 +45,52 @@ namespace vkcv { ...@@ -38,17 +45,52 @@ namespace vkcv {
CommandStreamManager& operator=(CommandStreamManager&& other) = delete; CommandStreamManager& operator=(CommandStreamManager&& other) = delete;
CommandStreamManager& operator=(const CommandStreamManager& other) = delete; CommandStreamManager& operator=(const CommandStreamManager& other) = delete;
/**
* @brief Creates a new command stream
*
* @param queue Queue the command buffer will be submitted to
* @param cmdPool Command pool the command buffer will be allocated from
* @return Handle that represents the #CommandStream
*/
CommandStreamHandle createCommandStream( CommandStreamHandle createCommandStream(
const vk::Queue queue, const vk::Queue queue,
vk::CommandPool cmdPool); vk::CommandPool cmdPool);
/**
* @brief Record vulkan commands to a #CommandStream, using a record function
*
* @param handle Command stream handle
* @param record Function that records the vulkan commands
*/
void recordCommandsToStream(const CommandStreamHandle handle, const RecordCommandFunction record); void recordCommandsToStream(const CommandStreamHandle handle, const RecordCommandFunction record);
/**
* @brief Add a callback to a #CommandStream that is called
* every time the command stream is submitted and finished
*
* @param handle Command stream handle
* @param finish Callback that is called when a command stream submission is finished
*/
void addFinishCallbackToStream(const CommandStreamHandle handle, const FinishCommandFunction finish); void addFinishCallbackToStream(const CommandStreamHandle handle, const FinishCommandFunction finish);
/**
* @brief Submits a #CommandStream to it's queue and returns after execution is finished
*
* @param handle Command stream handle
* @param waitSemaphores Semaphores that are waited upon before executing the recorded commands
* @param signalSemaphores Semaphores that are signaled when execution of the recorded commands is finished
*/
void submitCommandStreamSynchronous( void submitCommandStreamSynchronous(
const CommandStreamHandle handle, const CommandStreamHandle handle,
std::vector<vk::Semaphore> &waitSemaphores, std::vector<vk::Semaphore> &waitSemaphores,
std::vector<vk::Semaphore> &signalSemaphores); std::vector<vk::Semaphore> &signalSemaphores);
/**
* @brief Returns the underlying vulkan handle of a #CommandStream to be used for manual command recording
*
* @param handle Command stream handle
* @return Vulkan handle of the #CommandStream
*/
vk::CommandBuffer getStreamCommandBuffer(const CommandStreamHandle handle); vk::CommandBuffer getStreamCommandBuffer(const CommandStreamHandle handle);
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment