aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-03-21 09:48:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-21 14:28:53 +0000
commita3b6a551510eccf8bee95c739a1f1c7c70356608 (patch)
treeba52a3d689055d11b34d834db83df52769d61eea /src/gpu
parent1683f786cadf57a56fb1983ab8bb6df91c50d0ef (diff)
In Vulkan make sure to add barriers between write operations
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>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/vk/GrVkImage.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gpu/vk/GrVkImage.cpp b/src/gpu/vk/GrVkImage.cpp
index d0457ca28b..c3302a2b04 100644
--- a/src/gpu/vk/GrVkImage.cpp
+++ b/src/gpu/vk/GrVkImage.cpp
@@ -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;
}