#include <descriptorsetallocator.h>
Public Member Functions | |
DescriptorSetAllocator (VkDevice device) | |
~DescriptorSetAllocator () | |
VkDescriptorSet | allocate (VkDescriptorSetLayout layout, int numUBODescriptors, int numSSBODescriptors, int numSamplerDescriptors) |
Allocates DescriptorSets from a pool. Each pool is bound to a specific combination of UBOs and samplers, as allocates resources for each UBO and sampler as well as the DescriptorSet itself. Any shader that has the same amount of UBOs and samplers can therefore allocate from the same pool.
So, we maintain a map that holds a key that is a combination of sampler/UBO count. As a value, there is a list of pools, because pools are preallocated with a fixed size of sets to allocate from. If the pool is full, we need to allocate a new pool.
So essentially we're managing a pool of DescriptorSetPools here.
DescriptorSetAllocator | ( | VkDevice | device | ) |
device | resource to allocate descriptors from |
VkDescriptorSet allocate | ( | VkDescriptorSetLayout | layout, |
int | numUBODescriptors, | ||
int | numSSBODescriptors, | ||
int | numSamplerDescriptors | ||
) |
Allocate a DescriptorSetLayout that is compatible with VkDescriptorSetLayout (same amount of UBOs and samplers).
layout | layout of the descriptor set |
numUBODescriptors | number of uniform buffer object descriptors |
numSSBODescriptors | number of storage buffer object descriptors |
numSamplerDescriptors | number of sampler descriptors. |