Nameless Engine
Loading...
Searching...
No Matches
ne::ShadowMapArrayIndexManager Class Referenceabstract

#include <ShadowMapArrayIndexManager.h>

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

Public Member Functions

 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< ShadowMapArrayIndexManager >, Errorcreate (Renderer *pRenderer, GpuResourceManager *pResourceManager, const std::string &sShaderArrayResourceName)
 

Protected Member Functions

 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
 

Static Protected Member Functions

static void changeShadowMapArrayIndex (ShadowMapHandle *pShadowMapHandle, unsigned int iNewArrayIndex)
 

Private Attributes

Renderer *const pRenderer = nullptr
 
const std::string sShaderArrayResourceName
 

Friends

class ShadowMapManager
 

Detailed Description

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

Allows requesting an index into the array of shadow maps and binds specified shadow map to array's descriptor.

Binds array of descriptors to the rendering pipeline to be used by shaders.

Constructor & Destructor Documentation

◆ ShadowMapArrayIndexManager()

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

Initializes object.

Parameters
pRendererRenderer.
sShaderArrayResourceNameName of the array (defined in shaders) that this manager controls.

Member Function Documentation

◆ bindShadowMapsToAllPipelines()

virtual std::optional< Error > ne::ShadowMapArrayIndexManager::bindShadowMapsToAllPipelines ( )
protectedpure virtual

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

Returns
Error if something went wrong.

Implemented in ne::DirectXShadowMapArrayIndexManager, and ne::VulkanShadowMapArrayIndexManager.

◆ bindShadowMapsToPipeline()

virtual std::optional< Error > ne::ShadowMapArrayIndexManager::bindShadowMapsToPipeline ( Pipeline pPipeline)
protectedpure virtual

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.

Implemented in ne::DirectXShadowMapArrayIndexManager, and ne::VulkanShadowMapArrayIndexManager.

◆ changeShadowMapArrayIndex()

void ne::ShadowMapArrayIndexManager::changeShadowMapArrayIndex ( ShadowMapHandle pShadowMapHandle,
unsigned int  iNewArrayIndex 
)
staticprotected

Usually called by derived classes to notify some shadow map handle that its descriptor array index was changed (because base index manager class is a friend class to the shadow map handle).

Parameters
pShadowMapHandleShadow map handle to notify.
iNewArrayIndexNew array index for this shadow map.

◆ create()

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

Creates a new renderer-specific 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.

◆ getRenderer()

Renderer * ne::ShadowMapArrayIndexManager::getRenderer ( ) const
protected

Returns renderer.

Warning
Do not delete (free) returned pointer.
Returns
Renderer.

◆ getShaderArrayResourceName()

std::string_view ne::ShadowMapArrayIndexManager::getShaderArrayResourceName ( )
protected

Returns name of the array (defined in shaders) that this manager controls.

Returns
Array name.

◆ registerShadowMapResource()

virtual std::optional< Error > ne::ShadowMapArrayIndexManager::registerShadowMapResource ( ShadowMapHandle pShadowMapHandle)
protectedpure virtual

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.
If internal GPU shadow map resource of the handle changes you must unregister and then register the handle again (after the new GPU resource was set to the handle) to bind the new GPU resource to the descriptor.
Parameters
pShadowMapHandleShadow map to register.
Returns
Error if something went wrong.

Implemented in ne::DirectXShadowMapArrayIndexManager, and ne::VulkanShadowMapArrayIndexManager.

◆ unregisterShadowMapResource()

virtual std::optional< Error > ne::ShadowMapArrayIndexManager::unregisterShadowMapResource ( ShadowMapHandle pShadowMapHandle)
protectedpure virtual

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.

Implemented in ne::DirectXShadowMapArrayIndexManager, and ne::VulkanShadowMapArrayIndexManager.

Member Data Documentation

◆ pRenderer

Renderer* const ne::ShadowMapArrayIndexManager::pRenderer = nullptr
private

Do not delete (free). Renderer.

◆ sShaderArrayResourceName

const std::string ne::ShadowMapArrayIndexManager::sShaderArrayResourceName
private

Name of the array (defined in shaders) that this manager controls.


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