Diligent Engine API Reference: Diligent::IResourceMapping Class Reference

Diligent Engine API Reference

Public Member Functions | List of all members
Diligent::IResourceMapping Class Referenceabstract

Resouce mapping. More...

Inheritance diagram for Diligent::IResourceMapping:

## Public Member Functions
virtual void | QueryInterface (const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
| Queries the specific interface, see IObject::QueryInterface() for details.
virtual void | AddResource (const Char *Name, IDeviceObject *pObject, bool bIsUnique)=0
| Adds a resource to the mapping. More...
virtual void | AddResourceArray (const Char *Name, Uint32 StartIndex, IDeviceObject *const *ppObjects, Uint32 NumElements, bool bIsUnique)=0
| Adds resource array to the mapping. More...
virtual void | RemoveResourceByName (const Char *Name, Uint32 ArrayIndex=0)=0
| Removes a resource from the mapping using its literal name. More...
virtual void | GetResource (const Char *Name, IDeviceObject **ppResource, Uint32 ArrayIndex=0)=0
| Finds a resource in the mapping. More...
virtual size_t | GetSize ()=0
| Returns the size of the resource mapping, i.e. the number of objects.

## Detailed Description

Resouce mapping.

This interface provides mapping between literal names and resource pointers. It is created by IRenderDevice::CreateResourceMapping().

Remarks
  Resource mapping holds strong references to all objects it keeps.

## Member Function Documentation

## ◆ AddResource()

virtual void Diligent::IResourceMapping::AddResource | ( | const Char * | Name,
|  | IDeviceObject * | pObject,
|  | bool | bIsUnique
| ) |  |
| pure virtual

Adds a resource to the mapping.

Parameters

  [in] | Name | - Resource name.
  [in] | pObject | - Pointer to the object.
  [in] | bIsUnique | - Flag indicating if a resource with the same name is allowed to be found in the mapping. In the latter case, the new resource replaces the existing one.

Remarks
  Resource mapping increases the reference counter for referenced objects. So an object will not be released as long as it is in the resource mapping.

Implemented in Diligent::ResourceMappingImpl.

## ◆ AddResourceArray()

virtual void Diligent::IResourceMapping::AddResourceArray | ( | const Char * | Name,
|  | Uint32 | StartIndex,
|  | IDeviceObject *const * | ppObjects,
|  | Uint32 | NumElements,
|  | bool | bIsUnique
| ) |  |
| pure virtual

Adds resource array to the mapping.

Parameters

  [in] | Name | - Resource array name.
  [in] | StartIndex | - First index in the array, where the first element will be inserted
  [in] | ppObjects | - Pointer to the array of objects.
  [in] | NumElements | - Number of elements to add
  [in] | bIsUnique | - Flag indicating if a resource with the same name is allowed to be found in the mapping. In the latter case, the new resource replaces the existing one.

Remarks
  Resource mapping increases the reference counter for referenced objects. So an object will not be released as long as it is in the resource mapping.

Implemented in Diligent::ResourceMappingImpl.

## ◆ GetResource()

virtual void Diligent::IResourceMapping::GetResource | ( | const Char * | Name,
|  | IDeviceObject ** | ppResource,
|  | Uint32 | ArrayIndex = `0`
| ) |  |
| pure virtual

Finds a resource in the mapping.

Parameters

  [in] | Name | - Resource name.
  [in] | ArrayIndex | - for arrays, index of the array element.
  [out] | ppResource | - Address of the memory location where the pointer to the object with the given name will be written. If no object is found, nullptr will be written.

Remarks
  The method increases the reference counter of the returned object, so Release() must be called.

Implemented in Diligent::ResourceMappingImpl.

## ◆ RemoveResourceByName()

virtual void Diligent::IResourceMapping::RemoveResourceByName | ( | const Char * | Name,
|  | Uint32 | ArrayIndex = `0`
| ) |  |
| pure virtual

Removes a resource from the mapping using its literal name.

Parameters

  [in] | Name | - Name of the resource to remove.
  [in] | ArrayIndex | - For array resources, index in the array

Implemented in Diligent::ResourceMappingImpl.