传输写命令之间的管道屏障 [英] Pipeline barriers between transfer write commands

查看:30
本文介绍了传输写命令之间的管道屏障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有两个传输命令,vkCmdFillBuffer() 后跟 vkCmdCopyQueryPoolResults().传输命令写入重叠的缓冲区范围.

We have two transfer commands, vkCmdFillBuffer() followed by vkCmdCopyQueryPoolResults(). The transfer commands write to overlapping buffer ranges.

命令之间是否需要管道屏障以避免写后写的危险?

Is a pipeline barrier needed between the commands in order to avoid write-after-write hazards?

Vulkan 是否为在同一流水线阶段执行的命令提供任何保证?

Does Vulkan provide any guarantee for commands executed in the same pipeline stage?

推荐答案

当然,您几乎总是需要在 Vulkan 中进行同步.Vulkan 进行隐式同步的地方很少.

Of course, you virtually always have to synchronize in Vulkan. There are only very few places where Vulkan does implicit synchronization.

您对流水线阶段有错误的直觉.命令独立地到达"管道的各个阶段.所有命令都从 VK_PIPELINE_STAGE_TOP_OF_PIPE 开始(它们按提交顺序到达"它).然后(没有同步)不确定哪个命令将进入管道的下一阶段.没有明确的同步原语就没有顺序.规范会说类似队列操作的执行可能重叠或无序发生".

You have the wrong intuition about pipeline stages. Commands indepentently "reach" stages of pipeline. All commands start at VK_PIPELINE_STAGE_TOP_OF_PIPE (they "reach" it in submission order). Then (without synch) it is not determined which command(s) will proceed to the next stage of pipeline. There's no order to it without explicit sync primitives. The spec would say something like "execution of queue operations may overlap or happen out of order".

所以如果没有同步 vkCmdCopyQueryPoolResults 甚至可能发生在 vkCmdFillBuffer 之前,我假设你不想要.如果两者同时发生,那就更糟了.然后数据可能包含来自两个来源(或两个来源)的一些乱七八糟的写入.结果将是未定义的.

So without sync vkCmdCopyQueryPoolResults may even happen before vkCmdFillBuffer, which I assume you do not want. If they both happen at the same time, that's even worse. The data may then contain some mess of writes from both sources (or from neither). The results would simply be undefined.

这篇关于传输写命令之间的管道屏障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆