Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::ObjectCollector< Traits > Class Template Reference

#include <ObjectCollector.h>

Classes

struct  Descriptor
 

Public Types

using ObjectType = typename Traits::ObjectType
 
using ObjectPtrType = Ptr< ObjectType >
 
using CollectFunction = AZStd::function< void(ObjectType &)>
 

Public Member Functions

void Init (const Descriptor &descriptor)
 
void Shutdown ()
 
void QueueForCollect (ObjectPtrType object)
 Queues a single pointer for collection.
 
void QueueForCollect (ObjectType *objects, size_t objectCount)
 Queues an array of objects for collection.
 
void QueueForCollect (ObjectType **objects, size_t objectCount)
 Queues an array of pointers to the object for collection.
 
void Collect (bool forceFlush=false)
 
size_t GetObjectCount () const
 
void Notify (ObjectCollectorNotifyFunction notifyFunction)
 Notifies after the current set of pending objects is released.
 

Detailed Description

template<typename Traits = ObjectCollectorTraits>
class AZ::RHI::ObjectCollector< Traits >

Deferred-releases reference-counted objects at a specific latency. Example: Use to batch-release objects that exist on the GPU timeline at the end of the frame after syncing the oldest GPU frame.

Member Typedef Documentation

◆ CollectFunction

template<typename Traits = ObjectCollectorTraits>
using AZ::RHI::ObjectCollector< Traits >::CollectFunction = AZStd::function<void(ObjectType&)>

This method is called when the collection pass is releasing an object. The user can provide their own "collector" function to do something other than release (e.g. reuse from a pool).

Member Function Documentation

◆ Collect()

template<typename Traits >
void AZ::RHI::ObjectCollector< Traits >::Collect ( bool  forceFlush = false)

Runs a collection cycle. All objects scheduled for collection (according to the collection latency) are provided to the collect function (if it exists), and the references are released.

◆ GetObjectCount()

template<typename Traits >
size_t AZ::RHI::ObjectCollector< Traits >::GetObjectCount

Returns the number of objects pending to be collected. Must not be called at collection time.


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