gpt4 book ai didi

c++ - Vulkan:在多个命令缓冲区中排序图像内存屏障

转载 作者:可可西里 更新时间:2023-11-01 18:36:43 24 4
gpt4 key购买 nike

对于资源转换,您需要知道资源的“之前”和“之后”VkImageLayout(例如,在 VkImageMemoryBarrier 中传递给 vkCmdPipelineBarrier)。 Vulkan 不保证命令缓冲区的任何执行顺序,除非在 API 文档中明确说明(来自 this 答案)。然而,vkCmdPipelineBarrier确实明确表示它在命令缓冲区中的命令之间、调用之前和之后创建了依赖关系。因此,当图像在单个命令缓冲区中转换时,可以随时“了解”图像的布局。

但是,vkQueueSumbit 不强制命令缓冲区的执行顺序。如果有两个命令缓冲区,每个缓冲区都有 vkCmdPipelineBarrier 调用将同一图像转换为不同的布局,这两个操作之间是否存在任何依赖关系,或者在这种情况下是否需要显式同步?

最佳答案

第 2.2.1 节说:

Command buffer boundaries, both between primary command buffers of the same or different batches or submissions as well as between primary and secondary command buffers, do not introduce any implicit ordering constraints. In other words, submitting the set of command buffers (which can include executing secondary command buffers) between any semaphore or fence operations plays back the recorded commands as if they had all been recorded into a single primary command buffer, except that the current state is reset on each boundary.

在 6.4 节中,它指出用于同步的命令对包括:

First set: commands before a pipeline barrier.

Second set: commands after that pipeline barrier in the same queue (possibly limited to within the same subpass).

请注意,它说的是“在同一个队列中”,而不是“在同一个命令缓冲区中”。

这两个语句都清楚地表明管道障碍会影响队列的命令执行。执行依赖性不限于单个命令缓冲区的命令。

关于c++ - Vulkan:在多个命令缓冲区中排序图像内存屏障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36601127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com