SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::CommandQueue< CommandBufferType > Class Template Referenceabstract

Represents a ICommandQueue. More...

#include <CommandQueue.h>

Inheritance diagram for spark::render::CommandQueue< CommandBufferType >:
spark::render::ICommandQueue

Public Types

using command_buffer_type = CommandBufferType
 

Public Member Functions

virtual std::shared_ptr< command_buffer_type > createCommandBuffer (bool begin_recording=false, bool secondary=false) const noexcept=0
 Creates a command buffer that can be used to allocate commands on the queue.
 
virtual std::size_t submit (std::shared_ptr< command_buffer_type > command_buffer) const noexcept=0
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
virtual std::size_t submit (std::shared_ptr< const command_buffer_type > command_buffer) const noexcept=0
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
virtual std::size_t submit (const std::vector< std::shared_ptr< const command_buffer_type > > &command_buffers) const noexcept=0
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
virtual std::size_t submit (const std::vector< std::shared_ptr< command_buffer_type > > &command_buffers) const noexcept=0
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
- Public Member Functions inherited from spark::render::ICommandQueue
virtual bool isBound () const noexcept=0
 Checks whether the queue is currently bound to the parent device.
 
virtual QueuePriority priority () const noexcept=0
 Gets the priority of the queue.
 
virtual QueueType type () const noexcept=0
 Gets the type of the queue.
 
virtual void bind () const noexcept=0
 Binds the queue to the parent device.
 
virtual void release () const noexcept=0
 Releases the queue from the parent device.
 
std::shared_ptr< ICommandBuffercreateCommandBuffer (bool begin_recording=false, bool secondary=false) const noexcept
 Creates a command buffer that can be used to allocate commands on the queue.
 
std::size_t submit (std::shared_ptr< ICommandBuffer > command_buffer) const noexcept
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
std::size_t submit (std::shared_ptr< const ICommandBuffer > command_buffer) const noexcept
 Submits a single command buffer to the queue and inserts a fence to wait for it.
 
std::size_t submit (const std::vector< std::shared_ptr< const ICommandBuffer > > &command_buffers) const noexcept
 Submits multiple command buffers to the queue and inserts a fence to wait for them.
 
std::size_t submit (const std::vector< std::shared_ptr< ICommandBuffer > > &command_buffers) const noexcept
 Submits multiple command buffers to the queue and inserts a fence to wait for them.
 
virtual void waitFor (std::size_t fence) const noexcept=0
 Waits for fence value fence to complete on the command queue.
 
virtual std::size_t currentFence () const noexcept=0
 Gets the latest fence inserted into the queue.
 

Detailed Description

template<typename CommandBufferType>
class spark::render::CommandQueue< CommandBufferType >

Represents a ICommandQueue.

Template Parameters
CommandBufferTypeType of the command buffer that is used by the queue. (inherits from ICommandBuffer)

Member Function Documentation

◆ createCommandBuffer()

template<typename CommandBufferType >
virtual std::shared_ptr< command_buffer_type > spark::render::CommandQueue< CommandBufferType >::createCommandBuffer ( bool begin_recording = false,
bool secondary = false ) const
nodiscardpure virtualnoexcept

Creates a command buffer that can be used to allocate commands on the queue.

Parameters
begin_recordingtrue if the command buffer should be in recording state after creation, false otherwise.
secondarytrue if the command buffer should be a secondary command buffer, false otherwise.
Returns
A std::shared_ptr to the created ICommandBuffer.

Specifying secondary allows to create secondary command buffers (aka. bundles). Those are intended to be used as efficient pre-recorded command buffers that are re-used multiple times. Using such a command buffer allows drivers to pre-apply optimizations, which causes a one-time cost during setup, but reduces cost when re- applying the command buffer multiple times. Ideally they are used as small chunks of re-occurring workloads.

A secondary command buffer must not be submitted to a queue, but rather to a primary command buffer by calling ICommandBuffer::execute().

Implemented in spark::render::vk::VulkanQueue.

◆ submit() [1/4]

template<typename CommandBufferType >
virtual std::size_t spark::render::CommandQueue< CommandBufferType >::submit ( const std::vector< std::shared_ptr< command_buffer_type > > & command_buffers) const
nodiscardpure virtualnoexcept

Submits a single command buffer to the queue and inserts a fence to wait for it.

Parameters
command_bufferThe command buffer to submit to the queue.
Returns
The fence that was inserted to wait for the command buffer.
Note
Submitting a recording command buffer will implicitly end the recording.

◆ submit() [2/4]

template<typename CommandBufferType >
virtual std::size_t spark::render::CommandQueue< CommandBufferType >::submit ( const std::vector< std::shared_ptr< const command_buffer_type > > & command_buffers) const
nodiscardpure virtualnoexcept

Submits a single command buffer to the queue and inserts a fence to wait for it.

Parameters
command_bufferThe command buffer to submit to the queue.
Returns
The fence that was inserted to wait for the command buffer.
Note
Submitting a recording command buffer will implicitly end the recording.

◆ submit() [3/4]

template<typename CommandBufferType >
virtual std::size_t spark::render::CommandQueue< CommandBufferType >::submit ( std::shared_ptr< command_buffer_type > command_buffer) const
nodiscardpure virtualnoexcept

Submits a single command buffer to the queue and inserts a fence to wait for it.

Parameters
command_bufferThe command buffer to submit to the queue.
Returns
The fence that was inserted to wait for the command buffer.
Note
Submitting a recording command buffer will implicitly end the recording.

◆ submit() [4/4]

template<typename CommandBufferType >
virtual std::size_t spark::render::CommandQueue< CommandBufferType >::submit ( std::shared_ptr< const command_buffer_type > command_buffer) const
nodiscardpure virtualnoexcept

Submits a single command buffer to the queue and inserts a fence to wait for it.

Parameters
command_bufferThe command buffer to submit to the queue.
Returns
The fence that was inserted to wait for the command buffer.
Note
Submitting a recording command buffer will implicitly end the recording.