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.
"
Component: Vulkan
VK-GL-CTS Issue: 131
(cherry picked from commit
5534b44a15b530ece4b310e1dd935fb9b0cefeb6)
Change-Id: Ia2481fbcd12a32a6470af26df213a2f930c2e6db
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;
}