Pipeline barriers between transfer write commands

风流意气都作罢 提交于 2021-02-08 04:49:06

问题


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?

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


回答1:


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

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".

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.



来源:https://stackoverflow.com/questions/55088595/pipeline-barriers-between-transfer-write-commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!