Vulkan: Add RenderTargetVk::getImageForRead.

This helper method will also transition the Image to the correct read
layout. We will need to revisit the implementation when working on
simulatenous read.

Bug: angleproject:2539
Change-Id: Id61404460f3ef0dbb054e6ac2dfc0b59adb78402
Reviewed-on: https://chromium-review.googlesource.com/1108378
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Luc Ferron <lucferron@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
index 4d6cfa9..48c2c10 100644
--- a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
@@ -104,8 +104,23 @@
     mImageView = imageView;
 }
 
-vk::ImageHelper *RenderTargetVk::getImageForWrite(Serial currentSerial,
-                                                  vk::CommandGraphResource *writingResource) const
+vk::ImageHelper *RenderTargetVk::getImageForRead(vk::CommandGraphResource *readingResource,
+                                                 VkImageLayout layout,
+                                                 VkImageAspectFlags aspectFlags,
+                                                 vk::CommandBuffer *commandBuffer)
+{
+    ASSERT(mImage && mImage->valid());
+
+    // TODO(jmadill): Better simultaneous resource access. http://anglebug.com/2679
+    mResource->addWriteDependency(readingResource);
+
+    mImage->changeLayoutWithStages(aspectFlags, layout, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
+                                   VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, commandBuffer);
+
+    return mImage;
+}
+
+vk::ImageHelper *RenderTargetVk::getImageForWrite(vk::CommandGraphResource *writingResource) const
 {
     ASSERT(mImage && mImage->valid());
     mResource->addWriteDependency(writingResource);