Nameless Engine
Loading...
Searching...
No Matches
ShaderTextureResourceBindingManager.h
1#pragma once
2
3// Standard.
4#include <memory>
5#include <mutex>
6#include <unordered_map>
7#include <unordered_set>
8
9// Custom.
10#include "shader/general/resource/binding/ShaderResourceBinding.h"
11#include "shader/general/resource/binding/texture/ShaderTextureResourceBindingUniquePtr.h"
12
13namespace ne {
14 class Renderer;
15
28 // Only renderer should be allowed to create this manager.
29 friend class Renderer;
30
31 // Unique pointers will notify the manager before destruction.
33
34 public:
36
39
42
55 std::variant<ShaderTextureResourceBindingUniquePtr, Error> createShaderTextureResource(
56 const std::string& sShaderResourceName,
57 const std::string& sResourceAdditionalInfo,
58 const std::unordered_set<Pipeline*>& pipelinesToUse,
59 std::unique_ptr<TextureHandle> pTextureToUse);
60
68 std::pair<
69 std::recursive_mutex,
70 std::unordered_map<ShaderTextureResourceBinding*, std::unique_ptr<ShaderTextureResourceBinding>>>*
72
73 private:
80
88 std::variant<ShaderTextureResourceBindingUniquePtr, Error>
89 handleResourceCreation(std::variant<std::unique_ptr<ShaderTextureResourceBinding>, Error> result);
90
97 void destroyResource(ShaderTextureResourceBinding* pResourceToDestroy);
98
100 Renderer* pRenderer = nullptr;
101
108 std::pair<
109 std::recursive_mutex,
110 std::unordered_map<ShaderTextureResourceBinding*, std::unique_ptr<ShaderTextureResourceBinding>>>
112 };
113} // namespace ne
Definition: Error.h:27
Definition: Renderer.h:43
Definition: ShaderTextureResourceBindingManager.h:27
std::pair< std::recursive_mutex, std::unordered_map< ShaderTextureResourceBinding *, std::unique_ptr< ShaderTextureResourceBinding > > > mtxShaderTextureResources
Definition: ShaderTextureResourceBindingManager.h:111
~ShaderTextureResourceBindingManager()
Definition: ShaderTextureResourceBindingManager.cpp:87
void destroyResource(ShaderTextureResourceBinding *pResourceToDestroy)
Definition: ShaderTextureResourceBindingManager.cpp:61
Renderer * pRenderer
Definition: ShaderTextureResourceBindingManager.h:100
std::variant< ShaderTextureResourceBindingUniquePtr, Error > createShaderTextureResource(const std::string &sShaderResourceName, const std::string &sResourceAdditionalInfo, const std::unordered_set< Pipeline * > &pipelinesToUse, std::unique_ptr< TextureHandle > pTextureToUse)
Definition: ShaderTextureResourceBindingManager.cpp:15
std::pair< std::recursive_mutex, std::unordered_map< ShaderTextureResourceBinding *, std::unique_ptr< ShaderTextureResourceBinding > > > * getResources()
Definition: ShaderTextureResourceBindingManager.cpp:79
std::variant< ShaderTextureResourceBindingUniquePtr, Error > handleResourceCreation(std::variant< std::unique_ptr< ShaderTextureResourceBinding >, Error > result)
Definition: ShaderTextureResourceBindingManager.cpp:40
Definition: ShaderTextureResourceBindingUniquePtr.h:14
Definition: ShaderResourceBinding.h:86