uint32_t allocate()
Get an index where there is no data in the array.
DescriptorIndexAllocator(int descriptorCount)
Creates an allocator with descriptor indices in the range [0, descriptorCount).
size_t getCapacity() const
Gets the number of descriptor indices managed by the allocator.
std::stack< uint32_t > freeIndices
const std::vector< uint32_t > & getUsedIndices() const
Gets the indices of all allocated fields in the array.
std::vector< uint32_t > usedIndices
void reset(int newSize)
Resets all values in the buffers and allocates with new size.
DescriptorIndexAllocator()=delete
Default construction is disabled because the allocator needs a fixed capacity.
void free(uint32_t index)
Frees a cell in the array where the memory is not used anymore.
void reserve(uint32_t index)
Marks a specific free index as allocated.