LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::CommandQueue< TCommandBuffer > Class Template Referenceabstract

Represents a command queue. More...

#include <rendering.hpp>

Inherits LiteFX::Rendering::ICommandQueue.

Public Types

using command_buffer_type = TCommandBuffer
 

Public Member Functions

 ~CommandQueue () noexcept override=default
 
virtual SharedPtr< command_buffer_typecreateCommandBuffer (bool beginRecording=false, bool secondary=false) const =0
 
virtual UInt64 submit (const SharedPtr< command_buffer_type > &commandBuffer) const
 
virtual UInt64 submit (const SharedPtr< const command_buffer_type > &commandBuffer) const =0
 
virtual UInt64 submit (Enumerable< SharedPtr< const command_buffer_type > > commandBuffers) const =0
 
UInt64 submit (const SharedPtr< const ICommandBuffer > &commandBuffer) const
 Submits a single command buffer with shared ownership and inserts a fence to wait for it.
 
UInt64 submit (const SharedPtr< ICommandBuffer > &commandBuffer) const
 Submits a single command buffer with shared ownership and inserts a fence to wait for it.
 
UInt64 submit (Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
 Submits a set of command buffers with shared ownership and inserts a fence to wait for them.
 
- Public Member Functions inherited from LiteFX::Rendering::ICommandQueue
 ~ICommandQueue () noexcept override=default
 
virtual QueuePriority priority () const noexcept=0
 Returns the priority of the queue.
 
virtual QueueType type () const noexcept=0
 Returns the type of the queue.
 
virtual void beginDebugRegion (const String &label, const Vectors::ByteVector3 &color=DEFAULT_DEBUG_COLOR) const noexcept
 Starts a new debug region.
 
virtual void endDebugRegion () const noexcept
 Ends the current debug region.
 
virtual void setDebugMarker (const String &label, const Vectors::ByteVector3 &color=DEFAULT_DEBUG_COLOR) const noexcept
 Inserts a debug marker.
 
SharedPtr< ICommandBuffercreateCommandBuffer (bool beginRecording=false, bool secondary=false) const
 Creates a command buffer that can be used to allocate commands on the queue.
 
UInt64 submit (const SharedPtr< const ICommandBuffer > &commandBuffer) const
 Submits a single command buffer with shared ownership and inserts a fence to wait for it.
 
UInt64 submit (const SharedPtr< ICommandBuffer > &commandBuffer) const
 Submits a single command buffer with shared ownership and inserts a fence to wait for it.
 
UInt64 submit (Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
 Submits a set of command buffers with shared ownership and inserts a fence to wait for them.
 
virtual void waitFor (UInt64 fence) const =0
 Lets the CPU wait for a certain fence value to complete on the command queue.
 
void waitFor (const ICommandQueue &queue, UInt64 fence) const
 Lets the command queue wait for a certain fence value to complete on another queue.
 
virtual UInt64 currentFence () const noexcept=0
 Returns the value of the latest fence inserted into the queue.
 
- Public Member Functions inherited from LiteFX::SharedObject
virtual ~SharedObject () noexcept=default
 Destroys the shared object.
 
template<typename TSelf >
auto shared_from_this (this TSelf &&self) noexcept
 Returns a shared pointer to the current object instance.
 
template<typename TSelf >
auto weak_from_this (this TSelf &&self) noexcept -> WeakPtr< std::remove_reference_t< TSelf > >
 Returns a weak pointer to the current object instance.
 

Protected Member Functions

 CommandQueue () noexcept=default
 
 CommandQueue (CommandQueue &&) noexcept=default
 
 CommandQueue (const CommandQueue &)=default
 
CommandQueueoperator= (CommandQueue &&) noexcept=default
 
CommandQueueoperator= (const CommandQueue &)=default
 
- Protected Member Functions inherited from LiteFX::Rendering::ICommandQueue
 ICommandQueue () noexcept=default
 
 ICommandQueue (const ICommandQueue &)=default
 
 ICommandQueue (ICommandQueue &&) noexcept=default
 
ICommandQueueoperator= (const ICommandQueue &)=default
 
ICommandQueueoperator= (ICommandQueue &&) noexcept=default
 
void releaseSharedState (const ICommandBuffer &commandBuffer) const
 
- Protected Member Functions inherited from LiteFX::SharedObject
 SharedObject () noexcept=default
 Initializes a new shared object.
 
 SharedObject (SharedObject &&) noexcept=default
 
 SharedObject (const SharedObject &)=default
 
SharedObjectoperator= (SharedObject &&) noexcept=default
 
SharedObjectoperator= (const SharedObject &)=default
 

Additional Inherited Members

- Public Attributes inherited from LiteFX::Rendering::ICommandQueue
Event< QueueSubmittingEventArgssubmitting
 Invoked, when one or more command buffers are submitted to the queue.
 
Event< QueueSubmittedEventArgssubmitted
 Invoked, after one or more command buffers have been submitted to the queue.
 
- Static Public Attributes inherited from LiteFX::Rendering::ICommandQueue
static constexpr Vectors::ByteVector3 DEFAULT_DEBUG_COLOR = { 128_b, 128_b, 128_b }
 The default color value for a debug region or marker, if no other has been specified.
 
- Static Protected Member Functions inherited from LiteFX::SharedObject
template<typename T , typename... TArgs>
static auto create (TArgs &&... args) -> SharedPtr< T >
 Generic factory method used to create instances of the shared object.
 

Detailed Description

template<typename TCommandBuffer>
requires meta::implements<TCommandBuffer, CommandBuffer<typename TCommandBuffer::command_buffer_type, typename TCommandBuffer::buffer_type, typename TCommandBuffer::vertex_buffer_type, typename TCommandBuffer::index_buffer_type, typename TCommandBuffer::image_type, typename TCommandBuffer::barrier_type, typename TCommandBuffer::pipeline_type, typename TCommandBuffer::bottom_level_acceleration_structure_type, typename TCommandBuffer::top_level_acceleration_structure_type>>
class LiteFX::Rendering::CommandQueue< TCommandBuffer >

Represents a command queue.

Template Parameters
TCommandBufferThe type of the command buffer for this queue. Must implement CommandBuffer.

Member Typedef Documentation

◆ command_buffer_type

template<typename TCommandBuffer >
using LiteFX::Rendering::CommandQueue< TCommandBuffer >::command_buffer_type = TCommandBuffer

Constructor & Destructor Documentation

◆ CommandQueue() [1/3]

template<typename TCommandBuffer >
LiteFX::Rendering::CommandQueue< TCommandBuffer >::CommandQueue ( )
protecteddefaultnoexcept

◆ CommandQueue() [2/3]

template<typename TCommandBuffer >
LiteFX::Rendering::CommandQueue< TCommandBuffer >::CommandQueue ( CommandQueue< TCommandBuffer > && )
protecteddefaultnoexcept

◆ CommandQueue() [3/3]

template<typename TCommandBuffer >
LiteFX::Rendering::CommandQueue< TCommandBuffer >::CommandQueue ( const CommandQueue< TCommandBuffer > & )
protecteddefault

◆ ~CommandQueue()

template<typename TCommandBuffer >
LiteFX::Rendering::CommandQueue< TCommandBuffer >::~CommandQueue ( )
overridedefaultnoexcept

Member Function Documentation

◆ createCommandBuffer()

template<typename TCommandBuffer >
virtual SharedPtr< command_buffer_type > LiteFX::Rendering::CommandQueue< TCommandBuffer >::createCommandBuffer ( bool beginRecording = false,
bool secondary = false ) const
pure virtual

◆ operator=() [1/2]

template<typename TCommandBuffer >
CommandQueue & LiteFX::Rendering::CommandQueue< TCommandBuffer >::operator= ( CommandQueue< TCommandBuffer > && )
protecteddefaultnoexcept

◆ operator=() [2/2]

template<typename TCommandBuffer >
CommandQueue & LiteFX::Rendering::CommandQueue< TCommandBuffer >::operator= ( const CommandQueue< TCommandBuffer > & )
protecteddefault

◆ submit() [1/6]

template<typename TCommandBuffer >
virtual UInt64 LiteFX::Rendering::CommandQueue< TCommandBuffer >::submit ( const SharedPtr< command_buffer_type > & commandBuffer) const
inlinevirtual

◆ submit() [2/6]

template<typename TCommandBuffer >
virtual UInt64 LiteFX::Rendering::CommandQueue< TCommandBuffer >::submit ( const SharedPtr< const command_buffer_type > & commandBuffer) const
pure virtual

◆ submit() [3/6]

template<typename TCommandBuffer >
UInt64 LiteFX::Rendering::ICommandQueue::submit ( const SharedPtr< const ICommandBuffer > & commandBuffer) const
inline

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

By calling this method, the queue takes shared ownership over the commandBuffer until the fence is passed. The reference will be released during a waitFor, if the awaited fence is inserted after the associated one.

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.
Returns
The value of the fence, inserted after the command buffer.
See also
waitFor

◆ submit() [4/6]

template<typename TCommandBuffer >
UInt64 LiteFX::Rendering::ICommandQueue::submit ( const SharedPtr< ICommandBuffer > & commandBuffer) const
inline

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

By calling this method, the queue takes shared ownership over the commandBuffer until the fence is passed. The reference will be released during a waitFor, if the awaited fence is inserted after the associated one.

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.
Returns
The value of the fence, inserted after the command buffer.
See also
waitFor

◆ submit() [5/6]

template<typename TCommandBuffer >
virtual UInt64 LiteFX::Rendering::CommandQueue< TCommandBuffer >::submit ( Enumerable< SharedPtr< const command_buffer_type > > commandBuffers) const
pure virtual

◆ submit() [6/6]

template<typename TCommandBuffer >
UInt64 LiteFX::Rendering::ICommandQueue::submit ( Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
inline

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

By calling this method, the queue takes shared ownership over the commandBuffers until the fence is passed. The reference will be released during a waitFor, if the awaited fence is inserted after the associated one.

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.
Returns
The value of the fence, inserted after the command buffers.
See also
waitFor