Rether / docs
engine/apis/vulkan/Vulkan descriptor pool
gardenPre-allocated stock for shader resources

Vulkan descriptor pool

updated 2026.08.29created 2026.08.29~2 min

The concept

Like the Vulkan command pool, the descriptor pool is pre-allocated at startup, right after the Vulkan logical device — no allocation happens in the rendering loop. Where the command pool feeds the GPU its instructions, the descriptor pool feeds the shaders their data: it produces the descriptor sets that let us hand CPU-side resources (matrices, textures) to a shader.

In game engine

First we declare the stock levels — how many descriptors of each type the pool holds:

// cpp
// Resource Pools. A material set holds one sampler per texture slot, so
// the sampler budget must be a multiple of the set budget for the pool to
// reach 'maxSets' before it runs out of descriptors.
constexpr uint32_t maxSets             = 1000;
constexpr uint32_t samplersPerMaterial = 8;

std::array poolSizes = {
    vk::DescriptorPoolSize(vk::DescriptorType::eUniformBuffer, maxSets),
    vk::DescriptorPoolSize(vk::DescriptorType::eCombinedImageSampler,
                           maxSets * samplersPerMaterial)};
  • UniformBuffer: mathematical matrices (camera position, projection, object transform).
  • CombinedImageSampler: textures of 3D models (e.g. the texture of a brick wall). A material set holds one sampler per texture slot, so the sampler budget is maxSets * samplersPerMaterial — otherwise the pool would run out of samplers before reaching its set budget.

Then we create the pool itself:

// cpp
vk::DescriptorPoolCreateInfo descriptorpoolInfo{};
descriptorpoolInfo.maxSets = maxSets;
descriptorpoolInfo.flags =
    vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet;
descriptorpoolInfo.setPoolSizes(poolSizes);

d_descriptorPool = vk::raii::DescriptorPool(d_device, descriptorpoolInfo);
  • maxSets: the maximum number of "packs" (descriptor sets) this factory can produce in total, using the stock levels defined above.
  • eFreeDescriptorSet: by default Vulkan does not allow destroying a single descriptor set, only the entire pool at once. This flag lets us free memory object by object.

Keyboard

search this vault⌘K / /
step the sidebarjk
open selected↵
switch browse mode123
switch vaultgv
toggle themet
close / clearesc
this help?
esc to close