Do not require unsupported sparse images in image_format_properties test
authorSlawomir Cygan <slawomir.cygan@intel.com>
Tue, 10 Jan 2017 15:59:29 +0000 (16:59 +0100)
committerPyry Haulos <phaulos@google.com>
Thu, 12 Jan 2017 20:50:22 +0000 (15:50 -0500)
Affects tests: dEQP-VK.api.info.image_format_properties*

This change removes the requirement for supporting sparse residency images:
- with compressed format
- with non-color format
- with format of pixel size that is not power ot two (for example: RGB).

 Additionally do not require 1D sparse residency images (not in spec),
 and require 2D/3D residency images basing on the device capabilities.

Spec 28.1. Sparse Resource Features:
"A sparse image created using VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
supports all non-compressed color formats with power-of-two element
size that non-sparse usage supports.

(...)

sparseResidencyImage2D: Support for creating 2D single-sampled VkImage
objects with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.

sparseResidencyImage3D: Support for creating 3D VkImage objects with
 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT.
"

Fixes bug: gitlab!567

Change-Id: If7d72c4392299e4c449a911140632dcc114fc908

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index 8e14bfa..d3b655a 100644 (file)
@@ -1871,6 +1871,28 @@ bool isRequiredImageParameterCombination (const VkPhysicalDeviceFeatures&        device
        DE_ASSERT(deviceFeatures.sparseBinding || (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
        DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
 
+       if (createFlags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)
+       {
+               if (isCompressedFormat(format))
+                       return false;
+
+               if (isDepthStencilFormat(format))
+                       return false;
+
+               if (!deIsPowerOfTwo32(mapVkFormat(format).getPixelSize()))
+                       return false;
+
+               switch (imageType)
+               {
+                       case VK_IMAGE_TYPE_2D:
+                               return (deviceFeatures.sparseResidencyImage2D == VK_TRUE);
+                       case VK_IMAGE_TYPE_3D:
+                               return (deviceFeatures.sparseResidencyImage3D == VK_TRUE);
+                       default:
+                               return false;
+               }
+       }
+
        return true;
 }