Make copy texture test more extensive

By doing the copy multiple times, we exercise both paths where the
destination is already initialized and when it's not.

This adds tests for all combinations of formats and flags.

Bug: angleproject:2958
Change-Id: I56afb44496acd1b4d5a8527f4dbee29afbac9c81
Reviewed-on: https://chromium-review.googlesource.com/c/1398643
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
index e2ca46f..c6158a2 100644
--- a/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderTargetVk.cpp
@@ -10,19 +10,26 @@
 #include "libANGLE/renderer/vulkan/RenderTargetVk.h"
 
 #include "libANGLE/renderer/vulkan/CommandGraph.h"
+#include "libANGLE/renderer/vulkan/TextureVk.h"
 #include "libANGLE/renderer/vulkan/vk_format_utils.h"
 #include "libANGLE/renderer/vulkan/vk_helpers.h"
 
 namespace rx
 {
-RenderTargetVk::RenderTargetVk(vk::ImageHelper *image, vk::ImageView *imageView, size_t layerIndex)
-    : mImage(image), mImageView(imageView), mLayerIndex(layerIndex)
+RenderTargetVk::RenderTargetVk(vk::ImageHelper *image,
+                               vk::ImageView *imageView,
+                               size_t layerIndex,
+                               TextureVk *owner)
+    : mImage(image), mImageView(imageView), mLayerIndex(layerIndex), mOwner(owner)
 {}
 
 RenderTargetVk::~RenderTargetVk() {}
 
 RenderTargetVk::RenderTargetVk(RenderTargetVk &&other)
-    : mImage(other.mImage), mImageView(other.mImageView), mLayerIndex(other.mLayerIndex)
+    : mImage(other.mImage),
+      mImageView(other.mImageView),
+      mLayerIndex(other.mLayerIndex),
+      mOwner(other.mOwner)
 {}
 
 void RenderTargetVk::onColorDraw(vk::FramebufferHelper *framebufferVk,
@@ -107,6 +114,7 @@
     ASSERT(image && image->valid() && imageView && imageView->valid());
     mImage     = image;
     mImageView = imageView;
+    mOwner     = nullptr;
 }
 
 vk::ImageHelper *RenderTargetVk::getImageForRead(vk::RecordableGraphResource *readingResource,
@@ -133,4 +141,13 @@
     return mImage;
 }
 
+angle::Result RenderTargetVk::ensureImageInitialized(ContextVk *contextVk)
+{
+    if (mOwner)
+    {
+        return mOwner->ensureImageInitialized(contextVk);
+    }
+    return angle::Result::Continue;
+}
+
 }  // namespace rx