英文:
Is it possible to begin then end a VkCommandBuffer multiple times before submitting it in Vulkan?
问题
我想知道是否可以在开始记录命令到命令缓冲区后,结束命令缓冲区,然后再次开始(使用 vkBeginCommandBuffer
),同时仍然保留在第一个开始-结束会话中记录的所有命令。在Vulkan中是否可能实现这一点?
例如,您是否可以:
vkBeginCommandBuffer(commandBuffer, &beginInfo);
vkCmdFoo(commandBuffer, ...);
vkEndCommandBuffer(commandBuffer);
// 然后稍后:
vkBeginCommandBuffer(commandBuffer, &beginInfo);
vkCmdBar(commandBuffer, ...)
vkEndCommandBuffer(commandBuffer);
// 最后,提交命令缓冲区
vkQueueSubmit(...)
如果可以这样做,是否保证vkCmdFoo和vkCmdBar都会记录在命令缓冲区中?
谢谢!
英文:
I want to know if it is possible to begin recording commands into a command buffer, then end the command buffer before starting it again (with vkBeginCommandBuffer
) while still maintaining all the commands recorded in the first begin-end session. Is this possible in vulkan?
For example, can you:
vkBeginCommandBuffer(commandBuffer, &beginInfo);
vkCmdFoo(commandBuffer, ...);
vkEndCommandBuffer(commandBuffer);
// then later on:
vkBeginCommandBuffer(commandBuffer, &beginInfo);
vkCmdBar(commandBuffer, ...)
vkEndCommandBuffer(commandBuffer);
// finally, submit the command buffer
vkQueueSubmit(...)
And if you can do this, is it guaranteed that vkCmdFoo and vkCmdBar would both be recorded in the command buffer?
Thanks!
答案1
得分: 3
不。
除非重置并丢失当前内容,否则只能开始记录一次命令缓冲区。如果您需要多个开始/结束循环,您需要使用多个命令缓冲区。或者,只使用一个命令缓冲区,将vkEndCommandBuffer()
延迟到您确切知道已完成时。
请参阅规范中的生命周期说明:
英文:
No.
You can only begin recording a command buffer once, unless you reset and lose the current content. If you want multiple begin/end cycles you would need to use multiple command buffers. Alternatively use one, and defer the vkEndCommandBuffer()
until you know you are really done.
See the lifecycle in the spec here:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论