Command buffer and swap chain design


Currently I have a swap chain with one primary command buffer per image. Each command buffer has the chain image “baked” into it, so as the images cycle, the corresponding command buffer is used.

Is this correct design? I can’t imagine having more than 2-3 command buffers in the queue. Or am I potentially creating stalls somehow? I’d like to get this figured out before moving on.


There is no “correct design”; it’s simply a matter of what is working out for you, within the context of your rendering system and its needs.


Our needs are high framerates (currently targeting 120 hz) and very low latency.


Of course they are; you wouldn’t be using Vulkan otherwise. I’m talking about the structure of your rendering system, how you create and manage your CBs, how you deliver rendering commands and information, etc.

There is no “correct design” for this; it’s simply a matter of what best fits with the paradigm you’ve otherwise chosen for the rest of your rendering system. Your current choice is legitimate, but it isn’t any more correct than a choice that builds the primary CB on demand. Or one that renders to an image, then copies from that image into the swap chain image.


I am more getting at whether there we would want a different number of swap chain images and command buffers. It’s new to me and I don’t completely understand it, but I can’t imagine having more command buffers than swap chain images would do any good.