NAP
Public Member Functions | List of all members
DescriptorSetAllocator Class Referencefinal

#include <descriptorsetallocator.h>

Public Member Functions

 DescriptorSetAllocator (VkDevice device)
 
 ~DescriptorSetAllocator ()
 
VkDescriptorSet allocate (VkDescriptorSetLayout layout, int numUBODescriptors, int numSSBODescriptors, int numSamplerDescriptors)
 

Description

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.

Constructor & Destructor Documentation

◆ DescriptorSetAllocator()

DescriptorSetAllocator ( VkDevice  device)
Parameters
deviceresource to allocate descriptors from

◆ ~DescriptorSetAllocator()

Member Function Documentation

◆ allocate()

VkDescriptorSet allocate ( VkDescriptorSetLayout  layout,
int  numUBODescriptors,
int  numSSBODescriptors,
int  numSamplerDescriptors 
)

Allocate a DescriptorSetLayout that is compatible with VkDescriptorSetLayout (same amount of UBOs and samplers).

Parameters
layoutlayout of the descriptor set
numUBODescriptorsnumber of uniform buffer object descriptors
numSSBODescriptorsnumber of storage buffer object descriptors
numSamplerDescriptorsnumber of sampler descriptors.