简体   繁体   中英

Vulkan vkResetCommandPool vs vkResetCommandBuffer

The description of vkResetCommandPool just says

Resetting a command pool recycles all of the resources from all of the command buffers allocated from the command pool back to the command pool. All command buffers that have been allocated from the command pool are put in the initial state.

Is it the same as resetting all the existing command buffers allocated from the command pool, which is the same as calling vkResetCommandBuffer for each single buffer assuming that the command pool was created with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT .

I am wondering whether the additional control brought by VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT will impact the performance. If I have a few swapchain images and want to reset my command buffer when drawing each frame. Is it better to create a separate command pool for each swapchain image and reset the corresponding command pool when drawing every frame, or just create a single command pool with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT and reset the corresponding command buffer when drawing each frame?

The answer is mostly going to be "it depends". How many command buffers do you have per frame?

If you have many command buffers per frame, it's probably less expensive to have one pool per frame and reset the pool.

If you have few command buffers per frame then it's probably cheaper to reset individual command buffers.

That said, it's entirely implementation-defined behaviour, so if you have a concern about it write a small benchmark and test your hypothesis.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM