Fix image feature checks for swapchain_mutable.*
authorPiers Daniell <pdaniell@nvidia.com>
Mon, 3 Dec 2018 22:27:34 +0000 (15:27 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 6 Dec 2018 15:50:04 +0000 (10:50 -0500)
This fix mirrors what was already done in
https://gerrit.khronos.org/#/c/2799/ for the other
image.mutable.* tests. Without this fix the
DE_FATAL("Invalid download method") assert will fire
for some of the sub tests and the test won't be
properly skipped when the platform doesn't support
the format.

Components: Vulkan

Affects: dEQP-VK.image.swapchain_mutable.*

VK-GL-CTS Issue: 1295

Change-Id: I009baa8697ae09f7e9b8001b90159658ced4c62a

external/vulkancts/modules/vulkan/image/vktImageMutableTests.cpp

index f045670..1a26ea3 100644 (file)
@@ -2115,6 +2115,12 @@ tcu::TestStatus testSwapchainMutable(Context& context, CaseDef caseDef)
        case UPLOAD_STORE:
                viewFormatFeatureFlags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
                break;
+       case UPLOAD_CLEAR:
+               viewFormatFeatureFlags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
+               break;
+       case UPLOAD_COPY:
+               viewFormatFeatureFlags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
+               break;
        default:
                DE_FATAL("Invalid upload method");
                break;
@@ -2130,6 +2136,9 @@ tcu::TestStatus testSwapchainMutable(Context& context, CaseDef caseDef)
        case DOWNLOAD_LOAD:
                viewFormatFeatureFlags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
                break;
+       case DOWNLOAD_COPY:
+               viewFormatFeatureFlags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
+               break;
        default:
                DE_FATAL("Invalid download method");
                break;
@@ -2145,17 +2154,26 @@ tcu::TestStatus testSwapchainMutable(Context& context, CaseDef caseDef)
        if ((viewFormatProps.optimalTilingFeatures & viewFormatFeatureFlags) != viewFormatFeatureFlags)
                TCU_THROW(NotSupportedError, "View format doesn't support upload/download method");
 
+       const bool haveMaintenance2 = isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_maintenance2");
+
        // We don't use the base image for anything other than transfer
        // operations so there are no features to check.  However, The Vulkan
        // 1.0 spec does not allow us to create an image view with usage that
        // is not supported by the main format.  With VK_KHR_maintenance2, we
        // can do this via VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR.
        if ((imageFormatProps.optimalTilingFeatures & viewFormatFeatureFlags) != viewFormatFeatureFlags &&
-               !isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_maintenance2"))
+               !haveMaintenance2)
        {
                TCU_THROW(NotSupportedError, "Image format doesn't support upload/download method");
        }
 
+       // If no format feature flags are supported, the format itself is not supported,
+       // and images of that format cannot be created.
+       if (imageFormatProps.optimalTilingFeatures == 0)
+       {
+               TCU_THROW(NotSupportedError, "Base image format is not supported");
+       }
+
        // Create a color buffer for host-inspection of results
        // For the Copy download method, this is the target of the download, for other
        // download methods, pixel data will be copied to this buffer from the download