SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::ICommandQueue Class Referenceabstract

Interface for a command queue. More...

#include <CommandQueue.h>

Inheritance diagram for spark::render::ICommandQueue:
spark::render::CommandQueue< VulkanCommandBuffer > spark::render::CommandQueue< CommandBufferType > spark::render::vk::VulkanQueue

Public Member Functions

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

Interface for a command queue.

Member Function Documentation

◆ bind()

virtual void spark::render::ICommandQueue::bind ( ) const
pure virtualnoexcept

Binds the queue to the parent device.

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

◆ createCommandBuffer()

std::shared_ptr< ICommandBuffer > spark::render::ICommandQueue::createCommandBuffer ( bool begin_recording = false,
bool secondary = false ) const
inlinenodiscardnoexcept

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().

◆ currentFence()

virtual std::size_t spark::render::ICommandQueue::currentFence ( ) const
nodiscardpure virtualnoexcept

Gets the latest fence inserted into the queue.

Returns
The latest fence value.

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

◆ isBound()

virtual bool spark::render::ICommandQueue::isBound ( ) const
nodiscardpure virtualnoexcept

Checks whether the queue is currently bound to the parent device.

Returns
true if the queue is bound, false otherwise.

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

◆ priority()

virtual QueuePriority spark::render::ICommandQueue::priority ( ) const
nodiscardpure virtualnoexcept

Gets the priority of the queue.

Returns
A QueuePriority value.

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

◆ release()

virtual void spark::render::ICommandQueue::release ( ) const
pure virtualnoexcept

Releases the queue from the parent device.

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

◆ submit() [1/4]

std::size_t spark::render::ICommandQueue::submit ( const std::vector< std::shared_ptr< const ICommandBuffer > > & command_buffers) const
inlinenodiscardnoexcept

Submits multiple command buffers to the queue and inserts a fence to wait for them.

Parameters
command_buffersA std::vector of command buffers to submit to the queue.
Returns
The fence that was inserted to wait for the command buffers.
Note
If any of the command buffers is currently recording, it will implicitly end the recording.

◆ submit() [2/4]

std::size_t spark::render::ICommandQueue::submit ( const std::vector< std::shared_ptr< ICommandBuffer > > & command_buffers) const
inlinenodiscardnoexcept

Submits multiple command buffers to the queue and inserts a fence to wait for them.

Parameters
command_buffersA std::vector of command buffers to submit to the queue.
Returns
The fence that was inserted to wait for the command buffers.
Note
If any of the command buffers is currently recording, it will implicitly end the recording.

◆ submit() [3/4]

std::size_t spark::render::ICommandQueue::submit ( std::shared_ptr< const ICommandBuffer > command_buffer) const
inlinenodiscardnoexcept

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]

std::size_t spark::render::ICommandQueue::submit ( std::shared_ptr< ICommandBuffer > command_buffer) const
inlinenodiscardnoexcept

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.

◆ type()

virtual QueueType spark::render::ICommandQueue::type ( ) const
nodiscardpure virtualnoexcept

Gets the type of the queue.

Returns
A QueueType value.

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

◆ waitFor()

virtual void spark::render::ICommandQueue::waitFor ( std::size_t fence) const
pure virtualnoexcept

Waits for fence value fence to complete on the command queue.

Parameters
fenceThe fence value to wait for.

Each time one or more command buffers are submitted to the queue, a fence is inserted and its value will be returned. By calling this method, it is possible to wait for this fence. A fence value is guaranteed to be larger than earlier fences, so the method returns, if the latest signaled fence value is larger or equal to the value specified in fence.

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