KiCad PCB EDA Suite
Loading...
Searching...
No Matches
RHI_DEFERRED_RELEASE_QUEUE Class Reference

Holds destroyed GPU resource handles until no in-flight command buffer can still reference them. More...

#include <rhi_deferred_release.h>

Public Member Functions

void Enqueue (RHI_DEFERRED_RESOURCE_TYPE aType, uint32_t aHandleValue, uint64_t aCurrentFrame)
 
template<typename Func>
void ProcessRetired (uint64_t aCompletedFrame, Func &&aFreeFunc)
 
bool HasRetired (uint64_t aCompletedFrame) const
 
size_t PendingCount () const
 
template<typename Func>
void FlushAll (Func &&aFreeFunc)
 

Private Attributes

std::mutex m_mutex
 
std::vector< RHI_DEFERRED_RELEASE_ENTRY > m_entries
 

Detailed Description

Holds destroyed GPU resource handles until no in-flight command buffer can still reference them.

The UI thread enqueues while the render thread frees. The free callback runs outside the lock so slow GPU destruction does not block producers and a callback that re-enters the queue cannot deadlock.

Definition at line 56 of file rhi_deferred_release.h.

Member Function Documentation

◆ Enqueue()

void RHI_DEFERRED_RELEASE_QUEUE::Enqueue ( RHI_DEFERRED_RESOURCE_TYPE aType,
uint32_t aHandleValue,
uint64_t aCurrentFrame )
inline

Definition at line 59 of file rhi_deferred_release.h.

References m_entries, m_mutex, and RHI_FRAMES_IN_FLIGHT.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ FlushAll()

template<typename Func>
void RHI_DEFERRED_RELEASE_QUEUE::FlushAll ( Func && aFreeFunc)
inline

Definition at line 107 of file rhi_deferred_release.h.

References m_entries, and m_mutex.

Referenced by BOOST_AUTO_TEST_CASE().

◆ HasRetired()

bool RHI_DEFERRED_RELEASE_QUEUE::HasRetired ( uint64_t aCompletedFrame) const
inline
Returns
true when ProcessRetired( aCompletedFrame ) would free at least one entry.

Definition at line 89 of file rhi_deferred_release.h.

References m_entries, m_mutex, and RHI_DEFERRED_RELEASE_ENTRY::retireFrame.

Referenced by BOOST_AUTO_TEST_CASE().

◆ PendingCount()

size_t RHI_DEFERRED_RELEASE_QUEUE::PendingCount ( ) const
inline

Definition at line 100 of file rhi_deferred_release.h.

References m_entries, and m_mutex.

◆ ProcessRetired()

template<typename Func>
void RHI_DEFERRED_RELEASE_QUEUE::ProcessRetired ( uint64_t aCompletedFrame,
Func && aFreeFunc )
inline

Definition at line 67 of file rhi_deferred_release.h.

References m_entries, and m_mutex.

Member Data Documentation

◆ m_entries

std::vector<RHI_DEFERRED_RELEASE_ENTRY> RHI_DEFERRED_RELEASE_QUEUE::m_entries
private

Definition at line 122 of file rhi_deferred_release.h.

Referenced by Enqueue(), FlushAll(), HasRetired(), PendingCount(), and ProcessRetired().

◆ m_mutex

std::mutex RHI_DEFERRED_RELEASE_QUEUE::m_mutex
mutableprivate

Definition at line 121 of file rhi_deferred_release.h.

Referenced by Enqueue(), FlushAll(), HasRetired(), PendingCount(), and ProcessRetired().


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