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

#include <DirectXShadowMapArrayIndexManager.h>

Inheritance diagram for ne::DirectXShadowMapArrayIndexManager:
ne::ShadowMapArrayIndexManager

Public Member Functions

 DirectXShadowMapArrayIndexManager (const DirectXShadowMapArrayIndexManager &)=delete
 
DirectXShadowMapArrayIndexManageroperator= (const DirectXShadowMapArrayIndexManager &)=delete
 
 DirectXShadowMapArrayIndexManager (DirectXShadowMapArrayIndexManager &&) noexcept=delete
 
DirectXShadowMapArrayIndexManageroperator= (DirectXShadowMapArrayIndexManager &&) noexcept=delete
 
virtual ~DirectXShadowMapArrayIndexManager () override
 
ContinuousDirectXDescriptorRangegetSrvDescriptorRange () const
 
- Public Member Functions inherited from ne::ShadowMapArrayIndexManager
 ShadowMapArrayIndexManager (const ShadowMapArrayIndexManager &)=delete
 
ShadowMapArrayIndexManageroperator= (const ShadowMapArrayIndexManager &)=delete
 
 ShadowMapArrayIndexManager (ShadowMapArrayIndexManager &&) noexcept=delete
 
ShadowMapArrayIndexManageroperator= (ShadowMapArrayIndexManager &&) noexcept=delete
 

Static Public Member Functions

static std::variant< std::unique_ptr< DirectXShadowMapArrayIndexManager >, Errorcreate (Renderer *pRenderer, GpuResourceManager *pResourceManager, const std::string &sShaderArrayResourceName)
 
- Static Public Member Functions inherited from ne::ShadowMapArrayIndexManager
static std::variant< std::unique_ptr< ShadowMapArrayIndexManager >, Errorcreate (Renderer *pRenderer, GpuResourceManager *pResourceManager, const std::string &sShaderArrayResourceName)
 

Protected Member Functions

 DirectXShadowMapArrayIndexManager (Renderer *pRenderer, const std::string &sShaderArrayResourceName)
 
virtual std::optional< ErrorregisterShadowMapResource (ShadowMapHandle *pShadowMapHandle) override
 
virtual std::optional< ErrorunregisterShadowMapResource (ShadowMapHandle *pShadowMapHandle) override
 
virtual std::optional< ErrorbindShadowMapsToPipeline (Pipeline *pPipeline) override
 
virtual std::optional< ErrorbindShadowMapsToAllPipelines () override
 
- Protected Member Functions inherited from ne::ShadowMapArrayIndexManager
 ShadowMapArrayIndexManager (Renderer *pRenderer, const std::string &sShaderArrayResourceName)
 
virtual std::optional< ErrorregisterShadowMapResource (ShadowMapHandle *pShadowMapHandle)=0
 
virtual std::optional< ErrorunregisterShadowMapResource (ShadowMapHandle *pShadowMapHandle)=0
 
virtual std::optional< ErrorbindShadowMapsToPipeline (Pipeline *pPipeline)=0
 
virtual std::optional< ErrorbindShadowMapsToAllPipelines ()=0
 
std::string_view getShaderArrayResourceName ()
 
RenderergetRenderer () const
 

Private Member Functions

void onSrvRangeIndicesChanged ()
 

Private Attributes

std::unique_ptr< ContinuousDirectXDescriptorRangepSrvRange
 
std::pair< std::recursive_mutex, std::unordered_set< ShadowMapHandle * > > mtxRegisteredShadowMaps
 

Additional Inherited Members

- Static Protected Member Functions inherited from ne::ShadowMapArrayIndexManager
static void changeShadowMapArrayIndex (ShadowMapHandle *pShadowMapHandle, unsigned int iNewArrayIndex)
 

Detailed Description

Manages indices of shadows maps into a descriptor array used by shaders.

Constructor & Destructor Documentation

◆ ~DirectXShadowMapArrayIndexManager()

ne::DirectXShadowMapArrayIndexManager::~DirectXShadowMapArrayIndexManager ( )
overridevirtual

Makes sure no descriptor is registered.

◆ DirectXShadowMapArrayIndexManager()

ne::DirectXShadowMapArrayIndexManager::DirectXShadowMapArrayIndexManager ( Renderer pRenderer,
const std::string &  sShaderArrayResourceName 
)
protected

Initializes the manager except for SRV range which is expected to be initialized after construction.

Warning
Only used internally, prefer to use create.
Parameters
pRendererRenderer.
sShaderArrayResourceNameName of the array (defined in shaders) that this manager controls.

Member Function Documentation

◆ bindShadowMapsToAllPipelines()

std::optional< Error > ne::DirectXShadowMapArrayIndexManager::bindShadowMapsToAllPipelines ( )
overrideprotectedvirtual

Goes through all graphics pipelines ad binds shadow maps to pipelines that use them.

Returns
Error if something went wrong.

Implements ne::ShadowMapArrayIndexManager.

◆ bindShadowMapsToPipeline()

std::optional< Error > ne::DirectXShadowMapArrayIndexManager::bindShadowMapsToPipeline ( Pipeline pPipeline)
overrideprotectedvirtual

Looks if the specified pipeline uses shadow maps and if uses binds shadow maps to the pipeline.

Parameters
pPipelinePipeline to bind shadow maps to.
Returns
Error if something went wrong.

Implements ne::ShadowMapArrayIndexManager.

◆ create()

std::variant< std::unique_ptr< DirectXShadowMapArrayIndexManager >, Error > ne::DirectXShadowMapArrayIndexManager::create ( Renderer pRenderer,
GpuResourceManager pResourceManager,
const std::string &  sShaderArrayResourceName 
)
static

Creates a new index manager.

Parameters
pRendererRenderer.
pResourceManagerResource manager.
sShaderArrayResourceNameName of the array (defined in shaders) that this manager controls.
Returns
Error if something went wrong, otherwise created manager.

◆ getSrvDescriptorRange()

ContinuousDirectXDescriptorRange * ne::DirectXShadowMapArrayIndexManager::getSrvDescriptorRange ( ) const
inline

Returns internal SRV descriptor range to the array of shadow maps.

Returns
SRV descriptor range.

◆ onSrvRangeIndicesChanged()

void ne::DirectXShadowMapArrayIndexManager::onSrvRangeIndicesChanged ( )
private

Called after SRV range changed its location in the heap.

◆ registerShadowMapResource()

std::optional< Error > ne::DirectXShadowMapArrayIndexManager::registerShadowMapResource ( ShadowMapHandle pShadowMapHandle)
overrideprotectedvirtual

Reserves an index into a descriptor array for the shadow map resource of the specified handle and bind internal GPU shadow map resource (if the handle) to that descriptor.

Remarks
Use unregisterShadowMapResource to unregister it later (must be done before this manager is destroyed) when shadow map is being destroyed.
Parameters
pShadowMapHandleShadow map to register.
Returns
Error if something went wrong.

Implements ne::ShadowMapArrayIndexManager.

◆ unregisterShadowMapResource()

std::optional< Error > ne::DirectXShadowMapArrayIndexManager::unregisterShadowMapResource ( ShadowMapHandle pShadowMapHandle)
overrideprotectedvirtual

Unregisters a shadow map and frees its index into a descriptor array to be used by others.

Parameters
pShadowMapHandleShadow map to unregister.
Returns
Error if something went wrong.

Implements ne::ShadowMapArrayIndexManager.

Member Data Documentation

◆ mtxRegisteredShadowMaps

std::pair<std::recursive_mutex, std::unordered_set<ShadowMapHandle*> > ne::DirectXShadowMapArrayIndexManager::mtxRegisteredShadowMaps
private

Info about shadows maps that take place in this array.

◆ pSrvRange

std::unique_ptr<ContinuousDirectXDescriptorRange> ne::DirectXShadowMapArrayIndexManager::pSrvRange
private

Continuous SRV descriptor range of registered shadow maps for shaders.

Remarks
Always valid, never changing pointer.

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