Lysa  0.0
Lysa 3D Engine
AsyncQueue Class Reference

Detailed Description

A lightweight background submission system used to build and submit GPU command lists asynchronously. It owns a worker thread that drains a queue of recorded commands and submits them to the appropriate Vireo submit queue (transfer or graphic), allowing asset uploads and simple GPU work to happen without stalling the main thread.

Classes

struct  Command
 

Public Member Functions

 AsyncQueue (const std::shared_ptr< vireo::Vireo > &vireo, const std::shared_ptr< vireo::SubmitQueue > &transferQueue, const std::shared_ptr< vireo::SubmitQueue > &graphicQueue)
 
 ~AsyncQueue ()
 
Command beginCommand (vireo::CommandType commandType, const std::source_location &location=std::source_location::current ())
 
void endCommand (const Command &command, bool immediate=false)
 
void waitIdle () const
 
void collectCompleted () const
 
std::shared_ptr< vireo::Buffer > createBuffer (const Command &command, vireo::BufferType type, size_t instanceSize, uint32 instanceCount)
 
 AsyncQueue (const AsyncQueue &) = delete
 
AsyncQueue & operator= (const AsyncQueue &) = delete
 

Constructor & Destructor Documentation

AsyncQueue ( const std::shared_ptr< vireo::Vireo > &  vireo,
const std::shared_ptr< vireo::SubmitQueue > &  transferQueue,
const std::shared_ptr< vireo::SubmitQueue > &  graphicQueue 
)

Construct an asynchronous queue manager bound to Vireo and two submit queues (transfer and graphic).

~AsyncQueue ( )

Release background resources and flush outstanding commands. Safe to call during application shutdown.

AsyncQueue ( const AsyncQueue &  )
delete

Member Function Documentation

Command beginCommand ( vireo::CommandType  commandType,
const std::source_location &  location = std::source_location::current () 
)

Acquire a command for the specified queue type and begin recording on its command list. The source_location is captured by default for debugging purposes.

void collectCompleted ( ) const

Release resources of the last completed submission without waiting for the GPU.

std::shared_ptr<vireo::Buffer> createBuffer ( const Command &  command,
vireo::BufferType  type,
size_t  instanceSize,
uint32  instanceCount 
)

Create a buffer that is tracked alongside the provided command so the resource remains alive until the GPU work referencing it has been completed.

void endCommand ( const Command &  command,
bool  immediate = false 
)

Finish recording and enqueue the command for submission. If immediate is true, the queue may attempt to submit pending commands right away.

AsyncQueue& operator= ( const AsyncQueue &  )
delete
void waitIdle ( ) const

Submit all queued commands and wait for GPU work to finish.