tests: Bugfix check and add mip copy tests

Fixed a bug in the buffer size calculation for compressed mip levels
when copying less than a full block at the perimeter. Added a set of
validation tests that exercise copies in/out of mip levels of
compressed textures. Added an image init() fxn to the test framework
that takes an imageCreateInfo input, to allow full control of image
varieties.

Change-Id: I240ed6e1f45889e58b759f8f261392725dadb498
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index f294642..f77191a 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -759,6 +759,41 @@
     SetLayout(image_aspect, newLayout);
 }
 
+void VkImageObj::init(const VkImageCreateInfo *create_info) {
+    VkFormatProperties image_fmt;
+    vkGetPhysicalDeviceFormatProperties(m_device->phy().handle(), create_info->format, &image_fmt);
+
+    switch (create_info->tiling) {
+        case VK_IMAGE_TILING_OPTIMAL:
+            if (!IsCompatible(create_info->usage, image_fmt.optimalTilingFeatures)) {
+                ASSERT_TRUE(false) << "VkImageObj::init() error: unsupported tiling configuration";
+            }
+            break;
+        case VK_IMAGE_TILING_LINEAR:
+            if (!IsCompatible(create_info->usage, image_fmt.optimalTilingFeatures)) {
+                ASSERT_TRUE(false) << "VkImageObj::init() error: unsupported tiling configuration";
+            }
+            break;
+        default:
+            break;
+    }
+    layout(create_info->initialLayout);
+
+    vk_testing::Image::init(*m_device, *create_info, 0);
+
+    VkImageAspectFlags image_aspect = 0;
+    if (vk_format_is_depth_and_stencil(create_info->format)) {
+        image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_DEPTH_BIT;
+    } else if (vk_format_is_depth_only(create_info->format)) {
+        image_aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
+    } else if (vk_format_is_stencil_only(create_info->format)) {
+        image_aspect = VK_IMAGE_ASPECT_STENCIL_BIT;
+    } else {  // color
+        image_aspect = VK_IMAGE_ASPECT_COLOR_BIT;
+    }
+    SetLayout(image_aspect, VK_IMAGE_LAYOUT_GENERAL);
+}
+
 VkResult VkImageObj::CopyImage(VkImageObj &src_image) {
     VkResult U_ASSERT_ONLY err;
     VkImageLayout src_image_layout, dest_image_layout;