Fix errors in sparse resources tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 19 Nov 2022 13:02:59 +0000 (14:02 +0100)
committerPiotr Byszewski <piotr.byszewski@mobica.com>
Fri, 16 Dec 2022 08:26:05 +0000 (08:26 +0000)
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

external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesBase.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesImageMemoryAliasing.cpp
external/vulkancts/modules/vulkan/sparse_resources/vktSparseResourcesShaderIntrinsicsBase.cpp

index f704e55..2f87c63 100644 (file)
@@ -175,6 +175,7 @@ void SparseResourcesBaseInstance::createDeviceSupportingQueues(const QueueRequir
        }
 
        vk::VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT shaderImageAtomicInt64Features = m_context.getShaderImageAtomicInt64FeaturesEXT();
+       shaderImageAtomicInt64Features.pNext = DE_NULL;
 
        const VkPhysicalDeviceFeatures  deviceFeatures  = getPhysicalDeviceFeatures(instanceDriver, physicalDevice);
        vk::VkPhysicalDeviceFeatures2   deviceFeatures2 = getPhysicalDeviceFeatures2(instanceDriver, physicalDevice);
index e946c47..dd4b16a 100755 (executable)
@@ -205,7 +205,7 @@ tcu::TestStatus ImageSparseMemoryAliasingInstance::iterate (void)
                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();
index 26fe504..5ce63e5 100755 (executable)
@@ -478,13 +478,37 @@ tcu::TestStatus SparseShaderIntrinsicsInstanceBase::iterate (void)
                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 @@ tcu::TestStatus SparseShaderIntrinsicsInstanceBase::iterate (void)
                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));