Question about Command Buffers and Command Pools

Hello everybody, so for me Command Buffers and Command Pools are a bit unclear. And I want to ask couple questions about it.

  1. Is it possible to rerecord command buffer after it was recorded? For instance, I want to change my command buffer that i could draw one more object within my command buffer. Is it possible to archieve without removing/readding command buffer into command pool?

  2. Is it better to have one big command buffer in which i would draw all my objects. Or should i have one per pipeline?

  1. Command buffer modification is impossible.
  2. Command submission has a certain latency, so you should split work into ~10 command buffers per frame so you could perform submission in parallel with creation. It’s probably worth checking these slides out: http://gpuopen.com/gdc16-wrapup-presentations/
  1. Yes, there are 2 main methods of resetting a command buffer.

First is resetting the pool. This will reset all command buffers allocated from the pool and is only valid if no command buffer of it is in use.

The other option is resetting just the command buffer. This requires that the pool is created with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT. This can cause fragmentation of the pool and eventual reduced performance; prefer resetting the entire pool.

After either of these operations you can rerecord the command buffers.

  1. Begin() resets Command buffer if you follow the other rules and synchronization
  2. For truly independent workload, definitely separate CB and separate Queue (and perhaps separate thread). For other, the answer gets complicated.