template<typename ResourceDescType>
Diligent::StateObjectsRegistry class

Template class implementing state object registry.

Template parameters
ResourceDescType - type of the resource description. The type must have operator== and a hash function defined.

Public static variables

static int DeletedObjectsToPurge constexpr
Number of outstanding deleted objects to purge the registry.

Public functions

void Add(const ResourceDescType& ObjectDesc, IDeviceObject* pObject)
Adds a new object to the registry.
void Find(const ResourceDescType& Desc, IDeviceObject** ppObject)
Finds the object in the registry.
void Purge()
Purges outstanding deleted objects from the registry.
void ReportDeletedObject()
Increments the number of outstanding deleted objects. When this number reaches DeletedObjectsToPurge, Purge() will be called.

Function documentation

template<typename ResourceDescType>
void Diligent::StateObjectsRegistry<ResourceDescType>::Add(const ResourceDescType& ObjectDesc, IDeviceObject* pObject)

Adds a new object to the registry.

Parameters
ObjectDesc in - object description.
pObject in - pointer to the object.

Besides adding a new object, the function also checks the number of outstanding deleted objects and calls Purge() if the number has reached the threshold value DeletedObjectsToPurge. Creating a state object is assumed to be an expensive operation and should be performed during the initialization. Occasional purge operations should not add significant cost to it.