Fix wrong wait stage mask
authorJoerg Wagner <jorg.wagner@arm.com>
Wed, 9 Oct 2019 18:53:46 +0000 (20:53 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 16 Oct 2019 11:40:04 +0000 (07:40 -0400)
The wait stage mask wasn't accounting for the
stages the readers actually operate in, hence
being effectless.
Track the union of the reader's stage masks
and use that to block execution on the semaphore.

Affects:
dEQP-VK.synchronization.signal_order.*

Components: Vulkan
VK-GL-CTS issue: 2044

Change-Id: Ia4d5c7bcb9dd6eec25e7245dc41754acccd1b995

external/vulkancts/modules/vulkan/synchronization/vktSynchronizationSignalOrderTests.cpp

index 99b488f..c20bbb3 100644 (file)
@@ -704,12 +704,17 @@ public:
                DE_ASSERT(stageBits.size() == iterations.size());
                DE_ASSERT(semaphoreHandlesA.size() == iterations.size());
 
-               // Record all read operations into a single command buffer.
+               // Record all read operations into a single command buffer and record the union of their stage masks.
+               VkPipelineStageFlags readStages = 0;
                ptrCmdBufferB = makeVkSharedPtr(makeCommandBuffer(vkB, *deviceB, *cmdPoolB));
                cmdBufferB = **(ptrCmdBufferB);
                beginCommandBuffer(vkB, cmdBufferB);
                for (deUint32 iterIdx = 0; iterIdx < iterations.size(); iterIdx++)
-                       iterations[iterIdx].readOp->recordCommands(cmdBufferB);
+               {
+                       QueueSubmitOrderSharedIteration& iter = iterations[iterIdx];
+                       readStages |= iter.readOp->getInSyncInfo().stageMask;
+                       iter.readOp->recordCommands(cmdBufferB);
+               }
                endCommandBuffer(vkB, cmdBufferB);
 
                // Export the last semaphore for use on deviceB and create another semaphore to signal on deviceB.
@@ -787,7 +792,7 @@ public:
                                &timelineSubmitInfo : DE_NULL,                                                  // const void*                                  pNext;
                                1u,                                                                                                             // deUint32                                             waitSemaphoreCount;
                                &semaphoreHandlesB.front(),                                                             // const VkSemaphore*                   pWaitSemaphores;
-                               &stageBits[0],                                                                                  // const VkPipelineStageFlags*  pWaitDstStageMask;
+                               &readStages,                                                                                    // const VkPipelineStageFlags*  pWaitDstStageMask;
                                1u,                                                                                                             // deUint32                                             commandBufferCount;
                                &cmdBufferB,                                                                                    // const VkCommandBuffer*               pCommandBuffers;
                                1u,                                                                                                             // deUint32                                             signalSemaphoreCount;
@@ -1340,12 +1345,17 @@ public:
                DE_ASSERT(stageBits.size() == iterations.size());
                DE_ASSERT(semaphoreHandlesA.size() == iterations.size());
 
-               // Record all read operations into a single command buffer.
+               // Record all read operations into a single command buffer and track the union of their execution stages.
+               VkPipelineStageFlags readStages = 0;
                ptrCmdBufferB = makeVkSharedPtr(makeCommandBuffer(vk, device, *cmdPoolB));
                cmdBufferB = **(ptrCmdBufferB);
                beginCommandBuffer(vk, cmdBufferB);
                for (deUint32 iterIdx = 0; iterIdx < iterations.size(); iterIdx++)
-                       iterations[iterIdx].readOp->recordCommands(cmdBufferB);
+               {
+                       QueueSubmitOrderIteration& iter = iterations[iterIdx];
+                       readStages |= iter.readOp->getInSyncInfo().stageMask;
+                       iter.readOp->recordCommands(cmdBufferB);
+               }
                endCommandBuffer(vk, cmdBufferB);
 
                addSemaphore(vk, device, semaphoresB, semaphoreHandlesB, timelineValuesB, timelineValuesA.back());
@@ -1412,7 +1422,7 @@ public:
                                &timelineSubmitInfo : DE_NULL,                                                  // const void*                                  pNext;
                                1u,                                                                                                             // deUint32                                             waitSemaphoreCount;
                                &semaphoreHandlesA.back(),                                                              // const VkSemaphore*                   pWaitSemaphores;
-                               &stageBits[0],                                                                                  // const VkPipelineStageFlags*  pWaitDstStageMask;
+                               &readStages,                                                                                    // const VkPipelineStageFlags*  pWaitDstStageMask;
                                1u,                                                                                                             // deUint32                                             commandBufferCount;
                                &cmdBufferB,                                                                                    // const VkCommandBuffer*               pCommandBuffers;
                                1u,                                                                                                             // deUint32                                             signalSemaphoreCount;