Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
DescriptorAllocator.hpp
1#pragma once
2
3#include "Common.hpp"
4#include "graphics/GPUObjects.hpp"
5
6#include <deque>
7
8struct GPUContext;
9
15public:
16
21 void init(GPUContext* context, uint poolCount);
22
27 DescriptorSet allocateSet(VkDescriptorSetLayout& setLayout);
28
32 void freeSet(const DescriptorSet& set);
33
35 void clean();
36
38 VkDescriptorPool getImGuiPool(){ return _imguiPool.handle; }
39
40private:
41
44 VkDescriptorPool handle = VK_NULL_HANDLE;
45 uint64_t lastFrame = 0;
46 uint allocated = 0;
47 uint id = 0;
48 };
49
55 DescriptorPool createPool(uint count, bool combined);
56
57 GPUContext* _context = nullptr;
58 std::deque<DescriptorPool> _pools;
60
61 uint _maxPoolCount = 2;
63};
Manage descriptor set allocations by creating and reusing internal descriptor pools.
Definition: DescriptorAllocator.hpp:14
DescriptorSet allocateSet(VkDescriptorSetLayout &setLayout)
Definition: DescriptorAllocator.cpp:16
std::deque< DescriptorPool > _pools
Available pools.
Definition: DescriptorAllocator.hpp:58
void clean()
Definition: DescriptorAllocator.cpp:91
uint _maxPoolCount
Maximum number of pools to create.
Definition: DescriptorAllocator.hpp:61
GPUContext * _context
The GPU context.
Definition: DescriptorAllocator.hpp:57
void init(GPUContext *context, uint poolCount)
Definition: DescriptorAllocator.cpp:6
DescriptorPool _imguiPool
ImGui dedicated pool.
Definition: DescriptorAllocator.hpp:59
VkDescriptorPool getImGuiPool()
Definition: DescriptorAllocator.hpp:38
uint _currentPoolCount
Current number of created pools.
Definition: DescriptorAllocator.hpp:62
DescriptorPool createPool(uint count, bool combined)
Definition: DescriptorAllocator.cpp:101
void freeSet(const DescriptorSet &set)
Definition: DescriptorAllocator.cpp:71
Descriptor pool management info.
Definition: DescriptorAllocator.hpp:43
VkDescriptorPool handle
Native handle.
Definition: DescriptorAllocator.hpp:44
uint allocated
Number of currently used descriptors.
Definition: DescriptorAllocator.hpp:46
uint64_t lastFrame
Last frame used.
Definition: DescriptorAllocator.hpp:45
Descriptor set allocation.
Definition: GPUTypes.hpp:508
Global GPU context, storing all structures used for resource allocation and tracking,...
Definition: GPUInternal.hpp:72