8#include <unordered_set>
15#include "render/general/resource/UploadBuffer.h"
16#include "misc/Error.h"
19 class GpuResourceManager;
20 class ShaderCpuWriteResourceBinding;
83 "update cast and type limit check below");
86 if (iNewIndex > UINT_MAX) [[unlikely]] {
87 Error error(std::format(
"received slot index {} exceeds type limit", iNewIndex));
158 std::unordered_set<DynamicCpuWriteShaderResourceArraySlot*>
activeSlots;
233 static std::variant<std::unique_ptr<DynamicCpuWriteShaderResourceArray>,
Error>
create(
288 std::variant<std::unique_ptr<DynamicCpuWriteShaderResourceArraySlot>,
Error>
319 [[nodiscard]] std::optional<Error>
createArray(
size_t iCapacity);
Definition: DynamicCpuWriteShaderResourceArrayManager.h:27
Definition: DynamicCpuWriteShaderResourceArray.h:29
unsigned int getIndexIntoArray() const
Definition: DynamicCpuWriteShaderResourceArray.h:59
DynamicCpuWriteShaderResourceArray *const pArray
Definition: DynamicCpuWriteShaderResourceArray.h:96
unsigned int iIndexInArray
Definition: DynamicCpuWriteShaderResourceArray.h:108
void updateDataBecauseGpuUnused(void *pData)
Definition: DynamicCpuWriteShaderResourceArray.cpp:43
void updateIndex(size_t iNewIndex)
Definition: DynamicCpuWriteShaderResourceArray.h:79
ShaderCpuWriteResourceBinding *const pShaderResource
Definition: DynamicCpuWriteShaderResourceArray.h:99
Definition: DynamicCpuWriteShaderResourceArray.h:118
void updateSlotData(DynamicCpuWriteShaderResourceArraySlot *pSlot, void *pData)
Definition: DynamicCpuWriteShaderResourceArray.cpp:169
size_t getCapacityStepSize() const
Definition: DynamicCpuWriteShaderResourceArray.cpp:460
size_t getSizeInBytes()
Definition: DynamicCpuWriteShaderResourceArray.cpp:453
std::variant< std::unique_ptr< DynamicCpuWriteShaderResourceArraySlot >, Error > insert(ShaderCpuWriteResourceBinding *pShaderResource)
Definition: DynamicCpuWriteShaderResourceArray.cpp:380
const std::string sHandledShaderResourceName
Definition: DynamicCpuWriteShaderResourceArray.h:354
size_t getElementSize() const
Definition: DynamicCpuWriteShaderResourceArray.cpp:458
std::string_view getHandledShaderResourceName() const
Definition: DynamicCpuWriteShaderResourceArray.cpp:47
std::pair< std::recursive_mutex, InternalResources > * getInternalResources()
Definition: DynamicCpuWriteShaderResourceArray.cpp:52
std::pair< std::recursive_mutex, InternalResources > mtxInternalResources
Definition: DynamicCpuWriteShaderResourceArray.h:340
const size_t iCapacityStepSize
Definition: DynamicCpuWriteShaderResourceArray.h:351
static std::variant< size_t, Error > calculateCapacityStepSize(size_t iElementSizeInBytes)
Definition: DynamicCpuWriteShaderResourceArray.cpp:95
size_t getSize()
Definition: DynamicCpuWriteShaderResourceArray.cpp:443
static std::string formatBytesToKilobytes(size_t iSizeInBytes)
Definition: DynamicCpuWriteShaderResourceArray.cpp:88
static std::variant< std::unique_ptr< DynamicCpuWriteShaderResourceArray >, Error > create(GpuResourceManager *pResourceManager, const std::string &sHandledShaderResourceName, size_t iElementSizeInBytes)
Definition: DynamicCpuWriteShaderResourceArray.cpp:57
std::optional< Error > createArray(size_t iCapacity)
Definition: DynamicCpuWriteShaderResourceArray.cpp:182
std::optional< Error > shrinkArray()
Definition: DynamicCpuWriteShaderResourceArray.cpp:328
GpuResourceManager *const pResourceManager
Definition: DynamicCpuWriteShaderResourceArray.h:343
void markSlotAsNoLongerBeingUsed(DynamicCpuWriteShaderResourceArraySlot *pSlot)
Definition: DynamicCpuWriteShaderResourceArray.cpp:130
std::optional< Error > expandArray()
Definition: DynamicCpuWriteShaderResourceArray.cpp:275
const size_t iElementSizeInBytes
Definition: DynamicCpuWriteShaderResourceArray.h:357
size_t getCapacity()
Definition: DynamicCpuWriteShaderResourceArray.cpp:448
std::string getFullErrorMessage() const
Definition: Error.cpp:84
void showError() const
Definition: Error.cpp:102
Definition: GpuResourceManager.h:43
Definition: ShaderCpuWriteResourceBinding.h:25
Definition: DynamicCpuWriteShaderResourceArray.h:127
size_t iNextFreeArrayIndex
Definition: DynamicCpuWriteShaderResourceArray.h:145
std::queue< size_t > noLongerUsedArrayIndices
Definition: DynamicCpuWriteShaderResourceArray.h:148
std::unique_ptr< UploadBuffer > pUploadBuffer
Definition: DynamicCpuWriteShaderResourceArray.h:131
size_t iCapacity
Definition: DynamicCpuWriteShaderResourceArray.h:137
std::unordered_set< DynamicCpuWriteShaderResourceArraySlot * > activeSlots
Definition: DynamicCpuWriteShaderResourceArray.h:158