Let’s look at the definition of the second synchronization scope for a semaphore wait operation:
The second synchronization scope includes every command submitted in the same batch. In the case of
vkQueueSubmit
, the second synchronization scope is limited to operations on the pipeline stages determined by the destination stage mask specified by the corresponding element ofpWaitDstStageMask
. In the case ofvkQueueSubmit2
, the second synchronization scope is limited to the pipeline stage specified byVkSemaphoreSubmitInfo::stageMask
. Also, in the case of eithervkQueueSubmit2
orvkQueueSubmit
, the second synchronization scope additionally includes all commands that occur later in submission order.
From the perspective of using vkQueueSubmit
/vkQueueSubmit2
command it becomes unclear how exactly stageMask
is applied to submitted commands.
Basically i have two possible interpretation of the specification, and cannot conclude which of them is the correct one:
stageMask
is applied to commands later in submission order (as well as to commands in the current batch)stageMask
applied only to commands in the current batch, while other commands later in submission includes fully without stage masking.
I would like to believe that the option 1) is the correct one, as it corellates with pipeline scopes definition (which are defined more clearly):
The second synchronization scope and access scope of each memory dependency defined by
pDependencyInfo
are applied to operations that occurred later in submission order.
The second access scope is limited to accesses in the pipeline stages determined by the destination stage mask specified by
dstStageMask
. Within that, the second access scope only includes the second access scopes defined by elements of thepMemoryBarriers
,pBufferMemoryBarriers
andpImageMemoryBarriers
arrays, which each define a set of memory barriers. If no memory barriers are specified, then the second access scope includes no accesses.
LLM experiment
I tried using LLMs for get their interpretation of this exact question.
The prompt:
The second synchronization scope includes every command submitted in the same batch. In the case of vkQueueSubmit, the second synchronization scope is limited to operations on the pipeline stages determined by the destination stage mask specified by the corresponding element of pWaitDstStageMask. In the case of vkQueueSubmit2, the second synchronization scope is limited to the pipeline stage specified by VkSemaphoreSubmitInfo::stageMask. Also, in the case of either vkQueueSubmit2 or vkQueueSubmit, the second synchronization scope additionally includes all commands that occur later in submission order.
I need you to clarify the rules from specification
- I use vkQueueSubmit
- I have some stages includeed in stage mask
- We split all operations in 4 groups
A: stages for commands in the same batch, included in stage mask
B: stages for commands in the same batch, not included in stage mask
C: stages for commands outside current batch but later in submission order, included in stage mask
D: stages for commands outside current batch but later in submission order, not included in stage maskWhich of them are included in the second synchronizaton scope for semaphore?
Answers:
(AC corresponds to 1) interpretation, ACD corresponds to 2) interpretation)