Fix test using protected features without creating a device with them enabled
authorMichal Opalka <michal.opalka@arm.com>
Mon, 30 Nov 2020 07:48:36 +0000 (08:48 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 3 Dec 2020 17:25:01 +0000 (12:25 -0500)
The vulkan device was created without protected memory extension,
while later the tests queried physical device if the feature is supported
and based on that created protected image.

Components: Vulkan

Affects:
dEQP-VK.api.external.memory.android_hardware_buffer.image_formats.*

VK-GL-CTS Issue: 2675

Change-Id: I6d606fb34c89474b529c0f9e0e7a93202e801521

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

index 37d35bf..926fd7f 100644 (file)
@@ -241,7 +241,8 @@ vk::Move<vk::VkDevice> createTestDevice (const Context&                                                                     context,
                                                                                 const vk::VkExternalMemoryHandleTypeFlags              externalMemoryTypes,
                                                                                 const vk::VkExternalFenceHandleTypeFlags               externalFenceTypes,
                                                                                 deUint32                                                                               queueFamilyIndex,
-                                                                                bool                                                                                   useDedicatedAllocs = false)
+                                                                                bool                                                                                   useDedicatedAllocs = false,
+                                                                                void * protectedFeatures = DE_NULL)
 {
        const deUint32                          apiVersion                              = context.getUsedApiVersion();
        bool                                            useExternalSemaphore    = false;
@@ -361,7 +362,7 @@ vk::Move<vk::VkDevice> createTestDevice (const Context&                                                                     context,
        const vk::VkDeviceCreateInfo                    deviceCreateInfo                =
        {
                vk::VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
-               DE_NULL,
+               protectedFeatures,
                0u,
 
                DE_LENGTH_OF_ARRAY(queues),
@@ -4076,7 +4077,19 @@ tcu::TestStatus testAndroidHardwareBufferImageFormat  (Context& context, vk::VkF
        const vk::InstanceDriver&                                         vki                                   (instance.getDriver());
        const vk::VkPhysicalDevice                                        physicalDevice                (vk::chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
        const deUint32                                                            queueFamilyIndex              (chooseQueueFamilyIndex(vki, physicalDevice, 0u));
-       const vk::Unique<vk::VkDevice>                            device                                (createTestDevice(context, vkp, instance, vki, physicalDevice, 0u, externalMemoryType, 0u, queueFamilyIndex));
+
+       vk::VkPhysicalDeviceProtectedMemoryFeatures             protectedFeatures;
+       protectedFeatures.sType                         = vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES;
+       protectedFeatures.pNext                         = DE_NULL;
+       protectedFeatures.protectedMemory       = VK_FALSE;
+
+       vk::VkPhysicalDeviceFeatures2                                   deviceFeatures;
+       deviceFeatures.sType            = vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
+       deviceFeatures.pNext            = &protectedFeatures;
+
+       vki.getPhysicalDeviceFeatures2(physicalDevice, &deviceFeatures);
+
+       const vk::Unique<vk::VkDevice>                            device                                (createTestDevice(context, vkp, instance, vki, physicalDevice, 0u, externalMemoryType, 0u, queueFamilyIndex, false, &protectedFeatures));
        const vk::DeviceDriver                                            vkd                                   (vkp, instance, *device);
        TestLog&                                                                          log                             = context.getTestContext().getLog();
        const vk::VkPhysicalDeviceLimits                          limits                          = getPhysicalDeviceProperties(vki, physicalDevice).limits;