Nameless Engine
Loading...
Searching...
No Matches
ne::ShaderArrayIndexManager Class Reference

#include <ShaderArrayIndexManager.h>

Classes

struct  InternalData
 

Public Member Functions

 ShaderArrayIndexManager (const std::string &sName, unsigned int iArraySize)
 
 ~ShaderArrayIndexManager ()
 
std::unique_ptr< ShaderArrayIndexreserveIndex ()
 

Private Member Functions

void onIndexNoLongerUsed (unsigned int iIndex)
 

Private Attributes

std::pair< std::recursive_mutex, InternalDatamtxData
 
const unsigned int iArraySize = 0
 
const std::string sName
 

Friends

class ShaderArrayIndex
 

Detailed Description

Controls and provides indices into shader arrays (defined in shaders).

Remarks
If you need to bind something to a specific descriptor in a shader array this manager can give you an index to a descriptor (in the array) that you can use.

Constructor & Destructor Documentation

◆ ShaderArrayIndexManager()

ne::ShaderArrayIndexManager::ShaderArrayIndexManager ( const std::string &  sName,
unsigned int  iArraySize 
)

Constructs a new index manager.

Parameters
sNameName of the manager (used for logging). It's recommended to not only specify the shader resource name (that this manager is handling) but also some additional information if possible.
iArraySizeSpecified to mark the maximum possible number of elements in the array, if reached a warning will be logged.

◆ ~ShaderArrayIndexManager()

ne::ShaderArrayIndexManager::~ShaderArrayIndexManager ( )

Makes sure there are no active indices in use.

Member Function Documentation

◆ onIndexNoLongerUsed()

void ne::ShaderArrayIndexManager::onIndexNoLongerUsed ( unsigned int  iIndex)
private

Called by index objects in their destructor to notify that an index is no longer used.

Parameters
iIndexIndex that's no longer being used.

◆ reserveIndex()

std::unique_ptr< ShaderArrayIndex > ne::ShaderArrayIndexManager::reserveIndex ( )

Returns a new (unused) index into the shader array that this manager is handling.

Returns
New index.

Member Data Documentation

◆ iArraySize

const unsigned int ne::ShaderArrayIndexManager::iArraySize = 0
private

Optional parameter that could be specified during creation to mark the maximum possible number of elements in the array.

◆ mtxData

std::pair<std::recursive_mutex, InternalData> ne::ShaderArrayIndexManager::mtxData
private

Internal data.

◆ sName

const std::string ne::ShaderArrayIndexManager::sName
private

Name of the manager (used for logging).


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