Nameless Engine
Loading...
Searching...
No Matches
VulkanShadowMapArrayIndexManager.h
1#pragma once
2
3// Standard.
4#include <unordered_map>
5
6// Custom.
7#include "render/general/resource/shadow/ShadowMapArrayIndexManager.h"
8#include "shader/general/resource/ShaderArrayIndexManager.h"
9#include "render/general/resource/frame/FrameResourceManager.h"
10
11// External.
12#include "vulkan/vulkan.h"
13
14namespace ne {
15 class VulkanPipeline;
16
19 public:
21
24
27
28 virtual ~VulkanShadowMapArrayIndexManager() override;
29
37
38 protected:
50 [[nodiscard]] virtual std::optional<Error>
51 registerShadowMapResource(ShadowMapHandle* pShadowMapHandle) override;
52
60 [[nodiscard]] virtual std::optional<Error>
61 unregisterShadowMapResource(ShadowMapHandle* pShadowMapHandle) override;
62
70 [[nodiscard]] virtual std::optional<Error> bindShadowMapsToPipeline(Pipeline* pPipeline) override;
71
77 [[nodiscard]] virtual std::optional<Error> bindShadowMapsToAllPipelines() override;
78
79 private:
81 struct InternalData {
91 std::unique_ptr<ShaderArrayIndexManager> pIndexManager;
92
94 std::unordered_map<ShadowMapHandle*, std::unique_ptr<ShaderArrayIndex>> registeredShadowMaps;
95 };
96
106 [[nodiscard]] std::optional<Error>
107 bindShadowMapsToAllPipelines(ShadowMapHandle* pOnlyBindThisShadowMap);
108
119 [[nodiscard]] std::optional<Error>
120 bindShadowMapsToPipeline(Pipeline* pPipeline, ShadowMapHandle* pOnlyBindThisShadowMap);
121
131 [[nodiscard]] std::optional<Error> bindShadowMapToPipelineIfUsed(
132 ShadowMapHandle* pShadowMapHandle, VulkanPipeline* pPipeline, VkSampler pSampler);
133
135 std::pair<std::recursive_mutex, InternalData> mtxInternalData;
136 };
137}
Definition: Pipeline.h:20
Definition: Renderer.h:43
Definition: ShadowMapArrayIndexManager.h:25
Renderer *const pRenderer
Definition: ShadowMapArrayIndexManager.h:134
const std::string sShaderArrayResourceName
Definition: ShadowMapArrayIndexManager.h:137
Definition: ShadowMapHandle.h:23
Definition: VulkanPipeline.h:21
Definition: VulkanShadowMapArrayIndexManager.h:18
virtual std::optional< Error > bindShadowMapsToPipeline(Pipeline *pPipeline) override
Definition: VulkanShadowMapArrayIndexManager.cpp:94
virtual std::optional< Error > registerShadowMapResource(ShadowMapHandle *pShadowMapHandle) override
Definition: VulkanShadowMapArrayIndexManager.cpp:37
virtual std::optional< Error > bindShadowMapsToAllPipelines() override
Definition: VulkanShadowMapArrayIndexManager.cpp:98
virtual std::optional< Error > unregisterShadowMapResource(ShadowMapHandle *pShadowMapHandle) override
Definition: VulkanShadowMapArrayIndexManager.cpp:76
std::pair< std::recursive_mutex, InternalData > mtxInternalData
Definition: VulkanShadowMapArrayIndexManager.h:135
std::optional< Error > bindShadowMapToPipelineIfUsed(ShadowMapHandle *pShadowMapHandle, VulkanPipeline *pPipeline, VkSampler pSampler)
Definition: VulkanShadowMapArrayIndexManager.cpp:184
Definition: VulkanShadowMapArrayIndexManager.h:81
std::unique_ptr< ShaderArrayIndexManager > pIndexManager
Definition: VulkanShadowMapArrayIndexManager.h:91
std::unordered_map< ShadowMapHandle *, std::unique_ptr< ShaderArrayIndex > > registeredShadowMaps
Definition: VulkanShadowMapArrayIndexManager.h:94