Rether / docs
engine/apis/vulkan/Vulkan command pool
gardenThe factory for the GPU's to-do lists

Vulkan command pool

updated 2026.08.29created 2026.08.29~1 min

The concept

In Vulkan, dynamic memory allocation (the equivalent of new or malloc) within the rendering loop is strictly prohibited for performance reasons. Instead, large blocks of memory are pre-allocated at startup — the pools — which we dip into every frame. They are created right after the Vulkan logical device, alongside the Vulkan descriptor pool.

To give orders to the GPU (e.g. "draw a triangle", "change the color"), we write those instructions into a CommandBuffer. Those buffers are created by the command pool — a made-to-order factory for command buffers.

In game engine

// cpp
vk::CommandPoolCreateInfo poolInfo{};
poolInfo.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer;
poolInfo.queueFamilyIndex = graphicsQueueFamilyIndex();
d_commandPool             = vk::raii::CommandPool(d_device, poolInfo);

eResetCommandBuffer is the most important line for a game engine. Every frame (60 times per second) we write new commands; without this flag we would have to destroy the command buffer and create a new one every frame, which is very slow. With it, we are allowed to simply erase the previous content of a buffer and rewrite over it.

queueFamilyIndex ties the pool to a queue family: the command buffers this factory produces can only be submitted to the graphics queue found in Vulkan queue families, and nowhere else.

Keyboard

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