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

#include <VulkanShadowMapArrayIndexManager.h>

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

Classes

struct  InternalData
 

Public Member Functions

 VulkanShadowMapArrayIndexManager (const VulkanShadowMapArrayIndexManager &)=delete
 
VulkanShadowMapArrayIndexManageroperator= (const VulkanShadowMapArrayIndexManager &)=delete
 
 VulkanShadowMapArrayIndexManager (VulkanShadowMapArrayIndexManager &&) noexcept=delete
 
VulkanShadowMapArrayIndexManageroperator= (VulkanShadowMapArrayIndexManager &&) noexcept=delete
 
 VulkanShadowMapArrayIndexManager (Renderer *pRenderer, const std::string &sShaderArrayResourceName)
 
- Public Member Functions inherited from ne::ShadowMapArrayIndexManager
 ShadowMapArrayIndexManager (const ShadowMapArrayIndexManager &)=delete
 
ShadowMapArrayIndexManageroperator= (const ShadowMapArrayIndexManager &)=delete
 
 ShadowMapArrayIndexManager (ShadowMapArrayIndexManager &&) noexcept=delete
 
ShadowMapArrayIndexManageroperator= (ShadowMapArrayIndexManager &&) noexcept=delete
 

Protected Member Functions

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

std::optional< ErrorbindShadowMapsToAllPipelines (ShadowMapHandle *pOnlyBindThisShadowMap)
 
std::optional< ErrorbindShadowMapsToPipeline (Pipeline *pPipeline, ShadowMapHandle *pOnlyBindThisShadowMap)
 
std::optional< ErrorbindShadowMapToPipelineIfUsed (ShadowMapHandle *pShadowMapHandle, VulkanPipeline *pPipeline, VkSampler pSampler)
 

Private Attributes

std::pair< std::recursive_mutex, InternalDatamtxInternalData
 

Additional Inherited Members

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

◆ VulkanShadowMapArrayIndexManager()

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

Initializes the manager.

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

Member Function Documentation

◆ bindShadowMapsToAllPipelines() [1/2]

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::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.

◆ bindShadowMapsToAllPipelines() [2/2]

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::bindShadowMapsToAllPipelines ( ShadowMapHandle pOnlyBindThisShadowMap)
private

Goes through all graphics pipelines ad binds shadow map(s) to pipelines that use them.

Parameters
pOnlyBindThisShadowMapIf nullptr then binds all shadow maps from mtxInternalData, otherwise only binds the specified already registered (!) shadow map to all pipelines that reference it.
Returns
Error if something went wrong.

◆ bindShadowMapsToPipeline() [1/2]

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::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.

◆ bindShadowMapsToPipeline() [2/2]

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::bindShadowMapsToPipeline ( Pipeline pPipeline,
ShadowMapHandle pOnlyBindThisShadowMap 
)
private

Looks if the specified pipeline uses shadow map(s) and if uses binds shadow map(s) to the pipeline.

Parameters
pPipelinePipeline to bind shadow maps to.
pOnlyBindThisShadowMapIf nullptr then binds all shadow maps from mtxInternalData, otherwise only binds the specified already registered (!) shadow map to the specified pipelines if it references it.
Returns
Error if something went wrong.

◆ bindShadowMapToPipelineIfUsed()

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::bindShadowMapToPipelineIfUsed ( ShadowMapHandle pShadowMapHandle,
VulkanPipeline pPipeline,
VkSampler  pSampler 
)
private

Binds the specified shadow map to the specified pipeline.

Parameters
pShadowMapHandleHandle to shadow map to bind.
pPipelinePipeline to bind the shadow map to.
pSamplerTexture sampler to use.
Returns
Error if something went wrong.

◆ registerShadowMapResource()

std::optional< Error > ne::VulkanShadowMapArrayIndexManager::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::VulkanShadowMapArrayIndexManager::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

◆ mtxInternalData

std::pair<std::recursive_mutex, InternalData> ne::VulkanShadowMapArrayIndexManager::mtxInternalData
private

Mutex guarded internal data.


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