![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
This class abstract the vulkan descriptor pool for easier use. More...
#include <C_descriptorPool.hpp>
Public Member Functions | |
DescriptorPool (Context const &context) | |
DescriptorPool (DescriptorPool const &r)=delete | |
DescriptorPool (DescriptorPool &&r) noexcept | |
DescriptorPool & | operator= (DescriptorPool const &r)=delete |
DescriptorPool & | operator= (DescriptorPool &&r) noexcept=delete |
void | create (std::vector< VkDescriptorPoolSize > &&descriptorPoolSizes, uint32_t maxSetsPerPool, bool isUnique, bool individuallyFree) |
Create the descriptor pool. | |
void | destroy () final |
std::optional< DescriptorSet > | allocateDescriptorSet (VkDescriptorSetLayout layout, uint32_t variableElements=0) const |
Allocate a descriptor set. | |
void | freeDescriptorSet (VkDescriptorSet descriptorSet, VkDescriptorPool descriptorPool) const |
Free a descriptor set. | |
void | resetPools () const |
Reset all the pools. | |
uint32_t | getMaxSetsPerPool () const |
bool | isUnique () const |
bool | isCreated () const |
constexpr Context const & | getContext () const |
void | swapContext (Context const &context) |
Protected Member Functions | |
void | verifyContext (ContextAware const &r) const |
This class abstract the vulkan descriptor pool for easier use.
In vulkan, a descriptor pool must be created with a fixed size without a way to resize it. This class help by allocating any number of descriptor sets by creating multiple pools if needed.
|
nodiscard |
Allocate a descriptor set.
layout | The descriptor set layout |
variableElements | The number of variable elements in the descriptor set |
void fge::vulkan::DescriptorPool::create | ( | std::vector< VkDescriptorPoolSize > && | descriptorPoolSizes, |
uint32_t | maxSetsPerPool, | ||
bool | isUnique, | ||
bool | individuallyFree ) |
Create the descriptor pool.
When the number of descriptor sets allocated reach the maxSetsPerPool, a new pool is created.
descriptorPoolSizes | A vector of VkDescriptorPoolSize |
maxSetsPerPool | The max number of descriptor sets per pool |
isUnique | If true, only one pool is created and will fail if the maxSetsPerPool is reached |
individuallyFree | If true, the descriptor sets are individually freed |
|
finalvirtual |
Implements fge::vulkan::ContextAware.
void fge::vulkan::DescriptorPool::freeDescriptorSet | ( | VkDescriptorSet | descriptorSet, |
VkDescriptorPool | descriptorPool ) const |
Free a descriptor set.
This function should not be directly called, DescriptorSet::destroy() should be used instead.
descriptorSet | The descriptor set |
descriptorPool | The descriptor pool that the descriptor set was allocated from |
void fge::vulkan::DescriptorPool::resetPools | ( | ) | const |
Reset all the pools.
This function call vkResetDescriptorPool on all the pools.