LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::Backends::VulkanQueue Class Reference

Implements a Vulkan command queue. More...

#include <vulkan.hpp>

Inherits LiteFX::Rendering::CommandQueue< VulkanCommandBuffer >, and LiteFX::Resource< VkQueue >.

Classes

class  VulkanQueueImpl
 

Public Member Functions

 VulkanQueue (const VulkanDevice &device, const QueueType &type, const QueuePriority &priority, const UInt32 &familyId, const UInt32 &queueId)
 Initializes the Vulkan command queue. More...
 
 VulkanQueue (const VulkanQueue &)=delete
 
 VulkanQueue (VulkanQueue &&)=delete
 
virtual ~VulkanQueue () noexcept
 
virtual const VulkanDevicedevice () const noexcept
 Returns a reference to the device that provides this queue. More...
 
virtual const VkCommandPool & commandPool () const noexcept
 Returns a reference of the command pool that is used to allocate commands. More...
 
virtual const UInt32familyId () const noexcept
 Returns the queue family ID. More...
 
virtual const UInt32queueId () const noexcept
 Returns the queue ID. More...
 
virtual const VkSemaphore & timelineSemaphore () const noexcept
 Returns the internal timeline semaphore used to synchronize the queue execution. More...
 
virtual UInt64 submit (const VulkanCommandBuffer &commandBuffer, Span< VkSemaphore > waitForSemaphores, Span< VkPipelineStageFlags > waitForStages, Span< VkSemaphore > signalSemaphores={ }) const
 Submits a single command buffer and inserts a fence to wait for it. More...
 
virtual UInt64 submit (const Array< const VulkanCommandBuffer * > &commandBuffers, Span< VkSemaphore > waitForSemaphores, Span< VkPipelineStageFlags > waitForStages, Span< VkSemaphore > signalSemaphores={ }) const
 Submits a set of command buffers and inserts a fence to wait for them. More...
 
virtual UniquePtr< VulkanCommandBuffercreateCommandBuffer (const bool &secondary, const bool &beginRecording) const
 Creates a command buffer that can be used to allocate commands on the queue. More...
 
virtual bool isBound () const noexcept override
 Returns true, if the command queue is bound on the parent device. More...
 
virtual const QueuePriority & priority () const noexcept override
 Returns the priority of the queue. More...
 
virtual const QueueType & type () const noexcept override
 Returns the type of the queue. More...
 
virtual void bind () override
 Binds the queue on the parent device. More...
 
virtual void release () override
 Releases the queue from the parent device. More...
 
virtual UniquePtr< VulkanCommandBuffercreateCommandBuffer (const bool &beginRecording=false) const override
 
virtual UInt64 submit (const VulkanCommandBuffer &commandBuffer) const override
 
virtual UInt64 submit (const Array< const VulkanCommandBuffer * > &commandBuffers) const override
 
virtual void waitFor (const UInt64 &fence) const noexcept override
 Waits for a certain fence value to complete on the command queue. More...
 
virtual UInt64 currentFence () const noexcept override
 Returns the value of the latest fence inserted into the queue. More...
 
- Public Member Functions inherited from LiteFX::Rendering::CommandQueue< VulkanCommandBuffer >
virtual ~CommandQueue () noexcept=default
 
virtual UniquePtr< command_buffer_typecreateCommandBuffer (const bool &beginRecording=false) const=0
 
virtual UInt64 submit (const command_buffer_type &commandBuffer) const=0
 
virtual UInt64 submit (const Array< const command_buffer_type * > &commandBuffers) const=0
 
- Public Member Functions inherited from LiteFX::Rendering::ICommandQueue
virtual ~ICommandQueue () noexcept=default
 
virtual bool isBound () const noexcept=0
 Returns true, if the command queue is bound on the parent device. More...
 
virtual const QueuePriority & priority () const noexcept=0
 Returns the priority of the queue. More...
 
virtual const QueueType & type () const noexcept=0
 Returns the type of the queue. More...
 
virtual void bind ()=0
 Binds the queue on the parent device. More...
 
virtual void release ()=0
 Releases the queue from the parent device. More...
 
UniquePtr< ICommandBuffercreateCommandBuffer (const bool &beginRecording=false) const
 Creates a command buffer that can be used to allocate commands on the queue. More...
 
UInt64 submit (const ICommandBuffer &commandBuffer) const
 Submits a single command buffer and inserts a fence to wait for it. More...
 
UInt64 submit (const Array< const ICommandBuffer * > &commandBuffers) const
 Submits a set of command buffers and inserts a fence to wait for them. More...
 
virtual void waitFor (const UInt64 &fence) const noexcept=0
 Waits for a certain fence value to complete on the command queue. More...
 
virtual UInt64 currentFence () const noexcept=0
 Returns the value of the latest fence inserted into the queue. More...
 
- Public Member Functions inherited from LiteFX::Resource< VkQueue >
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
virtual ~Resource () noexcept=default
 
const VkQueue & handle () const noexcept override
 Returns the resource managed by the class. More...
 
- Public Member Functions inherited from LiteFX::IResource< VkQueue >
virtual ~IResource () noexcept=default
 
virtual const VkQueue & handle () const noexcept=0
 Returns the resource managed by the class. More...
 

Additional Inherited Members

- Public Types inherited from LiteFX::Rendering::CommandQueue< VulkanCommandBuffer >
using command_buffer_type = VulkanCommandBuffer
 
- Protected Member Functions inherited from LiteFX::Resource< VkQueue >
 Resource (const VkQueue handle) noexcept
 Initializes the managed resource. More...
 
VkQueue & handle () noexcept override
 Returns the resource managed by the class. More...
 
virtual VkQueue & handle () noexcept=0
 Returns the resource managed by the class. More...
 

Detailed Description

Implements a Vulkan command queue.

See also
VulkanCommandBuffer

Constructor & Destructor Documentation

◆ VulkanQueue() [1/3]

VulkanQueue::VulkanQueue ( const VulkanDevice device,
const QueueType &  type,
const QueuePriority &  priority,
const UInt32 familyId,
const UInt32 queueId 
)
explicit

Initializes the Vulkan command queue.

Parameters
deviceThe device, commands get send to.
typeThe type of the command queue.
priorityThe priority, of which commands are issued on the device.
familyIdThe ID of the queue family.
queueIdThe ID of the queue.

◆ VulkanQueue() [2/3]

LiteFX::Rendering::Backends::VulkanQueue::VulkanQueue ( const VulkanQueue )
delete

◆ VulkanQueue() [3/3]

LiteFX::Rendering::Backends::VulkanQueue::VulkanQueue ( VulkanQueue &&  )
delete

◆ ~VulkanQueue()

VulkanQueue::~VulkanQueue ( )
virtualdefaultnoexcept

Member Function Documentation

◆ bind()

void VulkanQueue::bind ( )
overridevirtual

Binds the queue on the parent device.

Implements LiteFX::Rendering::ICommandQueue.

◆ commandPool()

const VkCommandPool & VulkanQueue::commandPool ( ) const
virtualnoexcept

Returns a reference of the command pool that is used to allocate commands.

Note that the command pool does only exist, if the queue is bound on a device.

See also
isBound, bind, release
Returns
A reference of the command pool that is used to allocate commands

◆ createCommandBuffer() [1/2]

UniquePtr< VulkanCommandBuffer > VulkanQueue::createCommandBuffer ( const bool &  beginRecording = false) const
overridevirtual

◆ createCommandBuffer() [2/2]

UniquePtr< VulkanCommandBuffer > VulkanQueue::createCommandBuffer ( const bool &  secondary,
const bool &  beginRecording 
) const
virtual

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

Parameters
secondaryIf set to true, the queue will create a secondary command buffer instance.
beginRecordingIf set to true, the command buffer will be initialized in recording state and can receive commands straight away.
Returns
The instance of the command buffer.

◆ currentFence()

UInt64 VulkanQueue::currentFence ( ) const
overridevirtualnoexcept

Returns the value of the latest fence inserted into the queue.

Implements LiteFX::Rendering::ICommandQueue.

◆ device()

const VulkanDevice & VulkanQueue::device ( ) const
virtualnoexcept

Returns a reference to the device that provides this queue.

Returns
A reference to the queue's parent device.

◆ familyId()

const UInt32 & VulkanQueue::familyId ( ) const
virtualnoexcept

Returns the queue family ID.

Returns
The queue family ID.

◆ isBound()

bool VulkanQueue::isBound ( ) const
overridevirtualnoexcept

Returns true, if the command queue is bound on the parent device.

Implements LiteFX::Rendering::ICommandQueue.

◆ priority()

const QueuePriority & VulkanQueue::priority ( ) const
overridevirtualnoexcept

Returns the priority of the queue.

Implements LiteFX::Rendering::ICommandQueue.

◆ queueId()

const UInt32 & VulkanQueue::queueId ( ) const
virtualnoexcept

Returns the queue ID.

Returns
The queue ID.

◆ release()

void VulkanQueue::release ( )
overridevirtual

Releases the queue from the parent device.

Implements LiteFX::Rendering::ICommandQueue.

◆ submit() [1/4]

UInt64 VulkanQueue::submit ( const Array< const VulkanCommandBuffer * > &  commandBuffers) const
overridevirtual

◆ submit() [2/4]

UInt64 VulkanQueue::submit ( const Array< const VulkanCommandBuffer * > &  commandBuffers,
Span< VkSemaphore >  waitForSemaphores,
Span< VkPipelineStageFlags >  waitForStages,
Span< VkSemaphore >  signalSemaphores = { } 
) const
virtual

Submits a set of command buffers and inserts a fence to wait for them.

Note that submitting a command buffer that is currently recording will implicitly close the command buffer.

Parameters
commandBuffersThe command buffers to submit to the command queue.
waitForSemaphoresThe semaphores to wait for on each pipeline stage. There must be a semaphore for each entry in the waitForStages array.
waitForStagesThe pipeline stages of the current render pass to wait for before submitting the command buffer.
signalSemaphoresThe semaphores to signal, when the command buffer is executed.
Returns
The value of the fence, inserted after the command buffers.
See also
waitFor

◆ submit() [3/4]

UInt64 VulkanQueue::submit ( const VulkanCommandBuffer commandBuffer) const
overridevirtual

◆ submit() [4/4]

UInt64 VulkanQueue::submit ( const VulkanCommandBuffer commandBuffer,
Span< VkSemaphore >  waitForSemaphores,
Span< VkPipelineStageFlags >  waitForStages,
Span< VkSemaphore >  signalSemaphores = { } 
) const
virtual

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

Note that submitting a command buffer that is currently recording will implicitly close the command buffer.

Parameters
commandBufferThe command buffer to submit to the command queue.
waitForSemaphoresThe semaphores to wait for on each pipeline stage. There must be a semaphore for each entry in the waitForStages array.
waitForStagesThe pipeline stages of the current render pass to wait for before submitting the command buffer.
signalSemaphoresThe semaphores to signal, when the command buffer is executed.
Returns
The value of the fence, inserted after the command buffer.
See also
waitFor

◆ timelineSemaphore()

const VkSemaphore & VulkanQueue::timelineSemaphore ( ) const
virtualnoexcept

Returns the internal timeline semaphore used to synchronize the queue execution.

Returns
The internal timeline semaphore.

◆ type()

const QueueType & VulkanQueue::type ( ) const
overridevirtualnoexcept

Returns the type of the queue.

Implements LiteFX::Rendering::ICommandQueue.

◆ waitFor()

void VulkanQueue::waitFor ( const UInt64 fence) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::ICommandQueue.