Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
DescriptorIndexAllocator.h
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <stack>
4#include <vector>
5
6namespace EngineCore
7{
16{
17public:
19 explicit DescriptorIndexAllocator(int descriptorCount);
20
31 [[nodiscard]] uint32_t allocate();
32
41 void free(uint32_t index);
42
51 [[nodiscard]] const std::vector<uint32_t> &getUsedIndices() const;
52
61 void reset(int newSize);
62
63 size_t getCapacity() const;
64
65private:
66 std::stack<uint32_t> freeIndices;
67 std::vector<uint32_t> usedIndices;
68 uint32_t capacity;
69};
70}
uint32_t allocate()
Get an index where there is no data in the array.
void reset(int newSize)
Resets all values in the buffers and allocates with new size.
const std::vector< uint32_t > & getUsedIndices() const
Gets the indices of all allocated fields in the array.
void free(uint32_t index)
Frees a cell in the array where the memory is not used anymore.
Log category system implementation.