Toast Engine
Loading...
Searching...
No Matches
renderer::AsyncCompute Class Reference

Classes

struct  SharedFamilies
 For eConcurrent create infos with count entries since one family repeats. More...

Public Types

using Ticket = uint64_t
 Timeline value so completing one completes every earlier one.

Public Member Functions

 AsyncCompute (const vk::raii::Device &device, uint32_t queue_family_index, vk::Queue queue, std::mutex *queue_mutex)
 AsyncCompute (const AsyncCompute &)=delete
auto operator= (const AsyncCompute &) -> AsyncCompute &=delete
 AsyncCompute (AsyncCompute &&)=delete
auto operator= (AsyncCompute &&) -> AsyncCompute &=delete
auto submit (const std::function< void(vk::CommandBuffer)> &record, std::string_view debug_name={}) -> Ticket
auto isComplete (Ticket ticket) const -> bool
auto wait (Ticket ticket, uint64_t timeout_ns=std::numeric_limits< uint64_t >::max()) const -> bool
auto completedTicket () const -> Ticket
auto lastSubmittedTicket () const -> Ticket
auto queueFamilyIndex () const noexcept -> uint32_t
auto timeline () const noexcept -> vk::Semaphore
 Never wait on it from a frame submit or the frame couples to async work again.
auto sharedFamilies (uint32_t graphics_family) const noexcept -> SharedFamilies

Static Public Attributes

static constexpr Ticket k_no_ticket = 0

Constructor & Destructor Documentation

◆ AsyncCompute()

renderer::AsyncCompute::AsyncCompute ( const vk::raii::Device & device,
uint32_t queue_family_index,
vk::Queue queue,
std::mutex * queue_mutex )
Parameters
queue_mutexnon null when another subsystem submits to the same VkQueue

Member Function Documentation

◆ submit()

auto renderer::AsyncCompute::submit ( const std::function< void(vk::CommandBuffer)> & record,
std::string_view debug_name = {} ) -> Ticket

Thread safe and records outside the lock so threads record in parallel An exception from record propagates and no ticket is handed out

◆ wait()

auto renderer::AsyncCompute::wait ( Ticket ticket,
uint64_t timeout_ns = std::numeric_limits<uint64_t>::max() ) const -> bool
Returns
false on timeout

The documentation for this class was generated from the following files: