In Vulkan make sure to add barriers between write operations
authorGreg Daniel <egdaniel@google.com>
Tue, 21 Mar 2017 13:48:44 +0000 (09:48 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 21 Mar 2017 14:28:53 +0000 (14:28 +0000)
BUG=skia:6396

Change-Id: I60faf6ad9095f18c64e33a0359e30239efbac79f
Reviewed-on: https://skia-review.googlesource.com/9963
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>

infra/bots/recipe_modules/sktest/api.py
infra/bots/recipe_modules/sktest/example.expected/Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan.json
src/gpu/vk/GrVkImage.cpp

index 8a2eee7..73df2c3 100644 (file)
@@ -401,7 +401,6 @@ def dm_flags(bot):
     match.append('~ComposedImageFilterBounds_Gpu')
     match.append('~CopySurface')
     match.append('~ImageFilterZeroBlurSigma_Gpu')
-    match.append('~ReadWriteAlpha')
     match.append('~XfermodeImageFilterCroppedInput_Gpu')
 
   if 'Vulkan' in bot and 'IntelIris540' in bot and 'Ubuntu' in bot:
index d0457ca..c3302a2 100644 (file)
@@ -33,11 +33,12 @@ void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout,
              VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout);
     VkImageLayout currentLayout = this->currentLayout();
 
-    // If the old and new layout are the same, there is no reason to put in a barrier since the
-    // operations used for each layout are implicitly synchronized with eachother. The one exception
-    // is if the layout is GENERAL. In this case the image could have been used for any operation so
-    // we must respect the barrier.
-    if (newLayout == currentLayout && VK_IMAGE_LAYOUT_GENERAL != currentLayout) {
+    // If the old and new layout are the same and the layout is a read only layout, there is no need
+    // to put in a barrier.
+    if (newLayout == currentLayout &&
+        (VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL == currentLayout ||
+         VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL == currentLayout ||
+         VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL == currentLayout)) {
         return;
     }