Fix errors in sparse resources tests

VK_EXT_shader_image_atomic_int64 extension must be enabled on the device
if used
Feature structs from non-enabled extensions must not be passed to
VkDeviceCreateInfo pNext
Checks if image formats are supported are missing

Components: Vulkan

VK-GL-CTS issue: 4122

Affected tests:
dEQP-VK.sparse_resources.shader_intrinsics.*

Change-Id: I4fcac8eae1d53826d5ef5f8a7dcc04bfe95f7360
diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBase.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBase.cpp
index f704e55..2f87c63 100644
--- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBase.cpp
+++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBase.cpp
@@ -175,6 +175,7 @@
 	}
 
 	vk::VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT shaderImageAtomicInt64Features = m_context.getShaderImageAtomicInt64FeaturesEXT();
+	shaderImageAtomicInt64Features.pNext = DE_NULL;
 
 	const VkPhysicalDeviceFeatures	deviceFeatures	= getPhysicalDeviceFeatures(instanceDriver, physicalDevice);
 	vk::VkPhysicalDeviceFeatures2	deviceFeatures2	= getPhysicalDeviceFeatures2(instanceDriver, physicalDevice);
diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp
index e946c47..dd4b16a 100755
--- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp
+++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp
@@ -205,7 +205,7 @@
 		queueRequirements.push_back(QueueRequirements(VK_QUEUE_SPARSE_BINDING_BIT, 1u));
 		queueRequirements.push_back(QueueRequirements(VK_QUEUE_COMPUTE_BIT, 1u));
 
-		createDeviceSupportingQueues(queueRequirements);
+		createDeviceSupportingQueues(queueRequirements, formatIsR64(m_format));
 	}
 
 	const VkPhysicalDevice		physicalDevice			= getPhysicalDevice();
diff --git a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsicsBase.cpp b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsicsBase.cpp
index 26fe504..5ce63e5 100755
--- a/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsicsBase.cpp
+++ b/external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsicsBase.cpp
@@ -478,13 +478,37 @@
 		imageSparseInfo.mipLevels = getMipmapCount(m_format, formatDescription, imageFormatProperties, imageSparseInfo.extent);
 	}
 
+	// Create image to store texels copied from sparse image
+	imageTexelsInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
+	imageTexelsInfo.pNext = DE_NULL;
+	imageTexelsInfo.flags = 0u;
+	imageTexelsInfo.imageType = imageSparseInfo.imageType;
+	imageTexelsInfo.format = imageSparseInfo.format;
+	imageTexelsInfo.extent = imageSparseInfo.extent;
+	imageTexelsInfo.arrayLayers = imageSparseInfo.arrayLayers;
+	imageTexelsInfo.mipLevels = imageSparseInfo.mipLevels;
+	imageTexelsInfo.samples = imageSparseInfo.samples;
+	imageTexelsInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
+	imageTexelsInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+	imageTexelsInfo.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | imageOutputUsageFlags();
+	imageTexelsInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
+	imageTexelsInfo.queueFamilyIndexCount = 0u;
+	imageTexelsInfo.pQueueFamilyIndices = DE_NULL;
+
+	if (m_imageType == IMAGE_TYPE_CUBE || m_imageType == IMAGE_TYPE_CUBE_ARRAY)
+	{
+		imageTexelsInfo.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
+	}
+
+	checkImageSupport(instance, physicalDevice, imageTexelsInfo);
+
 	{
 		// Create logical device supporting both sparse and compute/graphics queues
 		QueueRequirementsVec queueRequirements;
 		queueRequirements.push_back(QueueRequirements(VK_QUEUE_SPARSE_BINDING_BIT, 1u));
 		queueRequirements.push_back(QueueRequirements(getQueueFlags(), 1u));
 
-		createDeviceSupportingQueues(queueRequirements);
+		createDeviceSupportingQueues(queueRequirements, formatIsR64(m_format));
 	}
 
 	// Create queues supporting sparse binding operations and compute/graphics operations
@@ -680,28 +704,6 @@
 		VK_CHECK(deviceInterface.queueBindSparse(sparseQueue.queueHandle, 1u, &bindSparseInfo, DE_NULL));
 	}
 
-	// Create image to store texels copied from sparse image
-	imageTexelsInfo.sType					= VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
-	imageTexelsInfo.pNext					= DE_NULL;
-	imageTexelsInfo.flags					= 0u;
-	imageTexelsInfo.imageType				= imageSparseInfo.imageType;
-	imageTexelsInfo.format					= imageSparseInfo.format;
-	imageTexelsInfo.extent					= imageSparseInfo.extent;
-	imageTexelsInfo.arrayLayers				= imageSparseInfo.arrayLayers;
-	imageTexelsInfo.mipLevels				= imageSparseInfo.mipLevels;
-	imageTexelsInfo.samples					= imageSparseInfo.samples;
-	imageTexelsInfo.tiling					= VK_IMAGE_TILING_OPTIMAL;
-	imageTexelsInfo.initialLayout			= VK_IMAGE_LAYOUT_UNDEFINED;
-	imageTexelsInfo.usage					= VK_IMAGE_USAGE_TRANSFER_SRC_BIT | imageOutputUsageFlags();
-	imageTexelsInfo.sharingMode				= VK_SHARING_MODE_EXCLUSIVE;
-	imageTexelsInfo.queueFamilyIndexCount	= 0u;
-	imageTexelsInfo.pQueueFamilyIndices		= DE_NULL;
-
-	if (m_imageType == IMAGE_TYPE_CUBE || m_imageType == IMAGE_TYPE_CUBE_ARRAY)
-	{
-		imageTexelsInfo.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
-	}
-
 	const Unique<VkImage>			imageTexels			(createImage(deviceInterface, getDevice(), &imageTexelsInfo));
 	const de::UniquePtr<Allocation>	imageTexelsAlloc	(bindImage(deviceInterface, getDevice(), getAllocator(), *imageTexels, MemoryRequirement::Any));