Index: src/gpu/vk/GrVkImage.cpp |
diff --git a/src/gpu/vk/GrVkImage.cpp b/src/gpu/vk/GrVkImage.cpp |
index a7fe478c4fcd7414afc4d9e8b236eb3c4d043865..d0457ca28b687b74345b4df0a7c45dee1351ec96 100644 |
--- a/src/gpu/vk/GrVkImage.cpp |
+++ b/src/gpu/vk/GrVkImage.cpp |
@@ -32,9 +32,12 @@ void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout, |
SkASSERT(VK_IMAGE_LAYOUT_UNDEFINED != newLayout && |
VK_IMAGE_LAYOUT_PREINITIALIZED != newLayout); |
VkImageLayout currentLayout = this->currentLayout(); |
- // Is this reasonable? Could someone want to keep the same layout but use the masks to force |
- // a barrier on certain things? |
- if (newLayout == 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) { |
return; |
} |