tests: Ensure texture mipCount is valid

Look up the allowed image formats for the image being
created and clamp the mipCount to be no more than
the allowed maximum.
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index a3277c8..cb25cb4 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -700,6 +700,17 @@
          ASSERT_TRUE(false) << "Error: Cannot find requested tiling configuration";
     }
 
+    VkImageFormatProperties imageFormatProperties = {0};
+    vkGetPhysicalDeviceImageFormatProperties(
+                m_device->phy().handle(), fmt, VK_IMAGE_TYPE_2D,
+                tiling,
+                usage,
+                0, // VkImageCreateFlags
+                &imageFormatProperties);
+    if (imageFormatProperties.maxMipLevels < mipCount) {
+        mipCount = imageFormatProperties.maxMipLevels;
+    }
+
     VkImageCreateInfo imageCreateInfo = vk_testing::Image::create_info();
     imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
     imageCreateInfo.format = fmt;