vkCmdWaitEvents的第一个同步作用域是什么?
What is the first synchronization scope of vkCmdWaitEvents?
在 7.5 中,Vulkan 规范说明了 vkCmdWaitEvents
The first synchronization scope only includes event signal operations that operate on members of pEvents
, and the operations that happened-before the event signal operations. Event signal operations performed by vkCmdSetEvent
that occur earlier in submission order are included in the first synchronization scope, if the logically latest pipeline stage in their stageMask
parameter is logically earlier than or equal to the logically latest pipeline stage in srcStageMask
.
我对这种措辞感到困惑。这是否意味着第一个同步范围是传递给 pEvents
、 加上 任何较早提交并满足阶段掩码和提交顺序要求的事件的信号,还是事件信号都传入了满足要求?
在任何一种情况下,既然你可以只用 pEvents
传递事件,那么 srcStageMask
有什么用?
The first synchronization scope only includes event signal operations that operate on members of pEvents
, and the operations that happened-before the event signal operations.
vkCmdWaitEvents
的第一个范围只是 pEvent
上的假设信号(以及所有 happens-before 它传递的东西,正如事件信号所定义的那样。
Event signal operations performed by vkCmdSetEvent
that occur earlier in submission order are included in the first synchronization scope, [...]
vkCmdSetEvent
不能被 driver 重新排序到 vkCmdWaitEvents
之后。如果确实如此,那基本上就坏了。 IE。如果你打电话:
vkCmdSetEvent(e);
vkCmdWaitEvents(e);
那么driver不允许执行它:
vkCmdWaitEvents(e);
vkCmdSetEvent(e);
if the logically latest pipeline stage in their stageMask
parameter is logically earlier than or equal to the logically latest pipeline stage in srcStageMask
.
仅在遵守特定规则时才适用重新排序禁令。
如果你录制:
vkCmdSetEvent(e, stageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
vkCmdWaitEvents(e, srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
然后你会读作:“在所有 BOTTOM_OF_PIPE
之后发出信号事件,然后等待 TOP_OF_PIPE
之前发出信号的所有事件。”但那是一个空集! BOTTOM_OF_PIPE
之后和 TOP_OF_PIPE
之前不能同时出现任何内容!所以等待可能不会记录这样的信号。
In either case, since you can just pass in events with pEvents
, what is srcStageMask
is useful for?
想象一个信号只不过是在内存中某处翻转的一个位。那么您可能会问,为什么 Vulkan 流水线屏障中存在流水线阶段。最坏的情况是,某些 driver 可能需要管道中的内容起源于何处以及内容被消耗的地方。
通常我认为stageMask == srcStageMask
,但作为设计问题,Vulkan driver 不会强制为您记住自己的东西。它只会再问你一遍。
在 7.5 中,Vulkan 规范说明了 vkCmdWaitEvents
The first synchronization scope only includes event signal operations that operate on members of
pEvents
, and the operations that happened-before the event signal operations. Event signal operations performed byvkCmdSetEvent
that occur earlier in submission order are included in the first synchronization scope, if the logically latest pipeline stage in theirstageMask
parameter is logically earlier than or equal to the logically latest pipeline stage insrcStageMask
.
我对这种措辞感到困惑。这是否意味着第一个同步范围是传递给 pEvents
、 加上 任何较早提交并满足阶段掩码和提交顺序要求的事件的信号,还是事件信号都传入了满足要求?
在任何一种情况下,既然你可以只用 pEvents
传递事件,那么 srcStageMask
有什么用?
The first synchronization scope only includes event signal operations that operate on members of
pEvents
, and the operations that happened-before the event signal operations.
vkCmdWaitEvents
的第一个范围只是 pEvent
上的假设信号(以及所有 happens-before 它传递的东西,正如事件信号所定义的那样。
Event signal operations performed by
vkCmdSetEvent
that occur earlier in submission order are included in the first synchronization scope, [...]
vkCmdSetEvent
不能被 driver 重新排序到 vkCmdWaitEvents
之后。如果确实如此,那基本上就坏了。 IE。如果你打电话:
vkCmdSetEvent(e);
vkCmdWaitEvents(e);
那么driver不允许执行它:
vkCmdWaitEvents(e);
vkCmdSetEvent(e);
if the logically latest pipeline stage in their
stageMask
parameter is logically earlier than or equal to the logically latest pipeline stage insrcStageMask
.
仅在遵守特定规则时才适用重新排序禁令。
如果你录制:
vkCmdSetEvent(e, stageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
vkCmdWaitEvents(e, srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
然后你会读作:“在所有 BOTTOM_OF_PIPE
之后发出信号事件,然后等待 TOP_OF_PIPE
之前发出信号的所有事件。”但那是一个空集! BOTTOM_OF_PIPE
之后和 TOP_OF_PIPE
之前不能同时出现任何内容!所以等待可能不会记录这样的信号。
In either case, since you can just pass in events with
pEvents
, what issrcStageMask
is useful for?
想象一个信号只不过是在内存中某处翻转的一个位。那么您可能会问,为什么 Vulkan 流水线屏障中存在流水线阶段。最坏的情况是,某些 driver 可能需要管道中的内容起源于何处以及内容被消耗的地方。
通常我认为stageMask == srcStageMask
,但作为设计问题,Vulkan driver 不会强制为您记住自己的东西。它只会再问你一遍。