layers: Eliminate false positive on ownership xfer

Add logic that correctly ignores the src(dst)StageMask for barrier
operations that are resource acquire(release) operations.  When barrier
operations transfer ownership they envitably run on two different queue
families which may have incompatible capabilities.  For release
operations dstStageMask should be ignored.  For acquire operations the
srcStageMask should be.

Note: this can only be done if *all* operations for a barrier command
are of one type, as the *StageMasks are specified at the command level.

Change-Id: I6c238ab121eaa1230e66716120d37204740408d6
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp
index 48212e1..4142c83 100644
--- a/layers/buffer_validation.cpp
+++ b/layers/buffer_validation.cpp
@@ -573,11 +573,10 @@
 }
 
 static bool IsReleaseOp(layer_data *device_data, GLOBAL_CB_NODE *cb_state, VkImageMemoryBarrier const *barrier) {
-    if (barrier->srcQueueFamilyIndex == barrier->dstQueueFamilyIndex)
-        return false;
+    if (!IsTransferOp(barrier)) return false;
 
     auto pool = GetCommandPoolNode(device_data, cb_state->createInfo.commandPool);
-    return pool->queueFamilyIndex == barrier->srcQueueFamilyIndex;
+    return pool && IsReleaseOp<VkImageMemoryBarrier, true>(pool, barrier);
 }
 
 void TransitionImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *cb_state, uint32_t memBarrierCount,