summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2016-06-27 11:04:31 -0700
committerNanley Chery <nanley.g.chery@intel.com>2016-06-28 14:17:18 -0700
commit99333e8453d6442b9855270711883e401b3e4f90 (patch)
treea3ec6b8d1e20df68b7a7ddf3a19c158646f4b97d
parentbd406e5ef7b650ab13cb43bdc7c0b58bbfdb4da3 (diff)
miptree: Skip attempts to make unsupported images
This causes tests that attempt to create linear depth buffers on Gen7+ (unsupported), to be skipped. Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
-rw-r--r--src/tests/func/miptree/miptree.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/tests/func/miptree/miptree.c b/src/tests/func/miptree/miptree.c
index 0ced389..37002cb 100644
--- a/src/tests/func/miptree/miptree.c
+++ b/src/tests/func/miptree/miptree.c
@@ -410,6 +410,19 @@ miptree_destroy(miptree_t *mt)
free(mt);
}
+static void
+can_create_image(VkImageType type, VkImageTiling tiling,
+ uint32_t usage, VkFormat format)
+{
+ VkImageFormatProperties fmt_properties;
+ VkResult result =
+ vkGetPhysicalDeviceImageFormatProperties(t_physical_dev, format,
+ type, tiling, usage,
+ 0, &fmt_properties);
+ if (result == VK_ERROR_FORMAT_NOT_SUPPORTED)
+ t_end(TEST_RESULT_SKIP);
+}
+
static const miptree_t *
miptree_create(void)
{
@@ -424,10 +437,19 @@ miptree_create(void)
const uint32_t depth = params->depth;
const uint32_t array_length = params->array_length;
const size_t buffer_size = miptree_calc_buffer_size();
+ const uint32_t usage_bits = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
+ VK_IMAGE_USAGE_TRANSFER_DST_BIT |
+ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
+ VK_IMAGE_USAGE_SAMPLED_BIT;
+ VkImageType image_type = image_type_from_image_view_type(params->view_type);
+
+ // Determine if an image can be created with this combination
+ can_create_image(image_type, VK_IMAGE_TILING_OPTIMAL,
+ usage_bits, format);
// Create the image that will contain the real miptree.
VkImage image = qoCreateImage(t_device,
- .imageType = image_type_from_image_view_type(params->view_type),
+ .imageType = image_type,
.format = format,
.mipLevels = levels,
.arrayLayers = array_length,
@@ -437,10 +459,7 @@ miptree_create(void)
.depth = depth,
},
.tiling = VK_IMAGE_TILING_OPTIMAL,
- .usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
- VK_IMAGE_USAGE_TRANSFER_DST_BIT |
- VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
- VK_IMAGE_USAGE_SAMPLED_BIT);
+ .usage = usage_bits);
VkBuffer src_buffer = qoCreateBuffer(t_device,
.size = buffer_size,
.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
@@ -501,6 +520,11 @@ miptree_create(void)
break;
case MIPTREE_UPLOAD_METHOD_COPY_FROM_LINEAR_IMAGE:
case MIPTREE_UPLOAD_METHOD_COPY_WITH_DRAW:
+
+ // Determine if an image can be created with this combination
+ can_create_image(VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_LINEAR,
+ VK_IMAGE_USAGE_TRANSFER_SRC_BIT, format);
+
src_vk_image = qoCreateImage(t_device,
.format = format,
.mipLevels = 1,
@@ -523,6 +547,11 @@ miptree_create(void)
break;
case MIPTREE_DOWNLOAD_METHOD_COPY_TO_LINEAR_IMAGE:
case MIPTREE_DOWNLOAD_METHOD_COPY_WITH_DRAW:
+
+ // Determine if an image can be created with this combination
+ can_create_image(VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_LINEAR,
+ VK_IMAGE_USAGE_TRANSFER_DST_BIT, format);
+
dest_vk_image = qoCreateImage(t_device,
.format = format,
.mipLevels = 1,