简体   繁体   English

Vulkan vkResetCommandPool 与 vkResetCommandBuffer

[英]Vulkan vkResetCommandPool vs vkResetCommandBuffer

The description of vkResetCommandPool just says vkResetCommandPool的描述只是说

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 .是否与重置从命令池分配的所有现有命令缓冲区相同,这与假设命令池是使用VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT创建的,则与为每个单个缓冲区调用vkResetCommandBuffer相同。

I am wondering whether the additional control brought by VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT will impact the performance.我想知道VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT带来的额外控制是否会影响性能。 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?是为每个交换链图像创建单独的命令池并在绘制每一帧时重置相应的命令池,还是只使用VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT创建单个命令池并在绘制每一帧时重置相应的命令缓冲区?

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.也就是说,它完全是由实现定义的行为,所以如果您担心它,请编写一个小型基准测试并测试您的假设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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