Nameless Engine
Loading...
Searching...
No Matches
DynamicCpuWriteShaderResourceArrayManager.h
1#pragma once
2
3// Standrad.
4#include <mutex>
5#include <unordered_map>
6#include <string>
7#include <memory>
8#include <variant>
9#include <optional>
10
11// Custom.
12#include "misc/Error.h"
13
14namespace ne {
15 class DynamicCpuWriteShaderResourceArray;
16 class DynamicCpuWriteShaderResourceArraySlot;
17 class ShaderCpuWriteResourceBinding;
18 class VulkanRenderer;
19 class VulkanPipeline;
20
28 // Only resource manager is supposed to own this manager.
29 friend class GpuResourceManager;
30
31 public:
33
35
38 operator=(const DynamicCpuWriteShaderResourceArrayManager&) = delete;
39
56 std::variant<std::unique_ptr<DynamicCpuWriteShaderResourceArraySlot>, Error>
58
68 DynamicCpuWriteShaderResourceArray* getArrayForShaderResource(const std::string& sShaderResourceName);
69
70 private:
79 static std::string formatBytesToMegabytes(size_t iSizeInBytes);
80
87
89 void removeEmptyArrays();
90
93
98 std::pair<
99 std::recursive_mutex,
100 std::unordered_map<std::string, std::unique_ptr<DynamicCpuWriteShaderResourceArray>>>
102 };
103}
Definition: DynamicCpuWriteShaderResourceArrayManager.h:27
DynamicCpuWriteShaderResourceArray * getArrayForShaderResource(const std::string &sShaderResourceName)
Definition: DynamicCpuWriteShaderResourceArrayManager.cpp:94
GpuResourceManager *const pResourceManager
Definition: DynamicCpuWriteShaderResourceArrayManager.h:92
static std::string formatBytesToMegabytes(size_t iSizeInBytes)
Definition: DynamicCpuWriteShaderResourceArrayManager.cpp:118
std::variant< std::unique_ptr< DynamicCpuWriteShaderResourceArraySlot >, Error > reserveSlotsInArray(ShaderCpuWriteResourceBinding *pShaderResource)
Definition: DynamicCpuWriteShaderResourceArrayManager.cpp:16
std::pair< std::recursive_mutex, std::unordered_map< std::string, std::unique_ptr< DynamicCpuWriteShaderResourceArray > > > mtxCpuWriteShaderResourceArrays
Definition: DynamicCpuWriteShaderResourceArrayManager.h:101
void removeEmptyArrays()
Definition: DynamicCpuWriteShaderResourceArrayManager.cpp:107
Definition: DynamicCpuWriteShaderResourceArray.h:118
Definition: Error.h:27
Definition: GpuResourceManager.h:43
Definition: ShaderCpuWriteResourceBinding.h:25