Vulkan: fix pipeline stages of memory barriers

VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT was used for barriers, but TOP and
BOTTOM bits can only be used for execution barriers.  These stages don't
access memory, so they don't participate in memory barriers at all.  A
validation error is generated as our current barriers violate this:

https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkCmdPipelineBarrier-pMemoryBarriers-01184

A note from the spec (see second paragraph in particular):

> An execution dependency with only VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT
> in the destination stage mask will only prevent that stage from
> executing in subsequently submitted commands. As this stage does not
> perform any actual execution, this is not observable - in effect, it
> does not delay processing of subsequent commands. Similarly an execution
> dependency with only VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT in the source
> stage mask will effectively not wait for any prior commands to complete.

> When defining a memory dependency, using only
> VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT or
> VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT would never make any accesses
> available and/or visible because these stages do not access memory.

> VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT and
> VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT are useful for accomplishing layout
> transitions and queue ownership operations when the required execution
> dependency is satisfied by other means - for example, semaphore
> operations between queues.

Bug: angleproject:2958
Change-Id: Ic616dcad7583db6b386d7d01a774b3ebd71a7081
Reviewed-on: https://chromium-review.googlesource.com/c/1352733
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/CommandGraph.cpp b/src/libANGLE/renderer/vulkan/CommandGraph.cpp
index ec0ce27..3c95e7f 100644
--- a/src/libANGLE/renderer/vulkan/CommandGraph.cpp
+++ b/src/libANGLE/renderer/vulkan/CommandGraph.cpp
@@ -492,9 +492,9 @@
                 memoryBarrier.srcAccessMask   = mGlobalMemoryBarrierSrcAccess;
                 memoryBarrier.dstAccessMask   = mGlobalMemoryBarrierDstAccess;
 
-                // Use the top of pipe stage to keep the state management simple.
-                primaryCommandBuffer->pipelineBarrier(VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
-                                                      VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 1,
+                // Use the all pipe stage to keep the state management simple.
+                primaryCommandBuffer->pipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
+                                                      VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1,
                                                       &memoryBarrier, 0, nullptr, 0, nullptr);
             }