Use enumerateDeviceExtensionProperties in mandatory features
authorAlexander Galazin <alexander.galazin@arm.com>
Thu, 29 Aug 2019 06:04:01 +0000 (08:04 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 30 Aug 2019 08:47:26 +0000 (04:47 -0400)
Affects: dEQP-VK.api.info.device.mandatory_features

Components: Vulkan

VK-GL-CTS issue: 1966

Change-Id: I4d72da3a36e6d31ac4025ff2b25fc3b83fdc20d3

external/vulkancts/framework/vulkan/vkMandatoryFeatures.inl
external/vulkancts/scripts/gen_framework.py
external/vulkancts/scripts/src/mandatory_features.txt

index 15eab74387e4d01c1c9ab22650b857b1b8b4762b..09b6b02c75cdceda58d3194f26bca912e2549c1c 100644 (file)
@@ -6,6 +6,10 @@ bool checkMandatoryFeatures(const vkt::Context& context)
        if ( !vk::isInstanceExtensionSupported(context.getUsedApiVersion(), context.getInstanceExtensions(), "VK_KHR_get_physical_device_properties2") )
                TCU_THROW(NotSupportedError, "Extension VK_KHR_get_physical_device_properties2 is not present");
 
+       VkPhysicalDevice                                        physicalDevice          = context.getPhysicalDevice();
+       const InstanceInterface&                        vki                                     = context.getInstanceInterface();
+       const vector<VkExtensionProperties>     deviceExtensions        = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
+
        tcu::TestLog& log = context.getTestContext().getLog();
        vk::VkPhysicalDeviceFeatures2 coreFeatures;
        deMemset(&coreFeatures, 0, sizeof(coreFeatures));
@@ -13,73 +17,81 @@ bool checkMandatoryFeatures(const vkt::Context& context)
        void** nextPtr = &coreFeatures.pNext;
 
        vk::VkPhysicalDevice8BitStorageFeaturesKHR physicalDevice8BitStorageFeaturesKHR;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_8bit_storage"))
+       deMemset(&physicalDevice8BitStorageFeaturesKHR, 0, sizeof(physicalDevice8BitStorageFeaturesKHR));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_8bit_storage")) )
        {
-               deMemset(&physicalDevice8BitStorageFeaturesKHR, 0, sizeof(physicalDevice8BitStorageFeaturesKHR));
-               physicalDevice8BitStorageFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR;
+               physicalDevice8BitStorageFeaturesKHR.sType = getStructureType<VkPhysicalDevice8BitStorageFeaturesKHR>();
                *nextPtr = &physicalDevice8BitStorageFeaturesKHR;
                nextPtr  = &physicalDevice8BitStorageFeaturesKHR.pNext;
        }
 
        vk::VkPhysicalDeviceDescriptorIndexingFeaturesEXT physicalDeviceDescriptorIndexingFeaturesEXT;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing"))
+       deMemset(&physicalDeviceDescriptorIndexingFeaturesEXT, 0, sizeof(physicalDeviceDescriptorIndexingFeaturesEXT));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
-               deMemset(&physicalDeviceDescriptorIndexingFeaturesEXT, 0, sizeof(physicalDeviceDescriptorIndexingFeaturesEXT));
-               physicalDeviceDescriptorIndexingFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT;
+               physicalDeviceDescriptorIndexingFeaturesEXT.sType = getStructureType<VkPhysicalDeviceDescriptorIndexingFeaturesEXT>();
                *nextPtr = &physicalDeviceDescriptorIndexingFeaturesEXT;
                nextPtr  = &physicalDeviceDescriptorIndexingFeaturesEXT.pNext;
        }
 
        vk::VkPhysicalDeviceInlineUniformBlockFeaturesEXT physicalDeviceInlineUniformBlockFeaturesEXT;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_inline_uniform_block"))
+       deMemset(&physicalDeviceInlineUniformBlockFeaturesEXT, 0, sizeof(physicalDeviceInlineUniformBlockFeaturesEXT));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_inline_uniform_block")) )
        {
-               deMemset(&physicalDeviceInlineUniformBlockFeaturesEXT, 0, sizeof(physicalDeviceInlineUniformBlockFeaturesEXT));
-               physicalDeviceInlineUniformBlockFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT;
+               physicalDeviceInlineUniformBlockFeaturesEXT.sType = getStructureType<VkPhysicalDeviceInlineUniformBlockFeaturesEXT>();
                *nextPtr = &physicalDeviceInlineUniformBlockFeaturesEXT;
                nextPtr  = &physicalDeviceInlineUniformBlockFeaturesEXT.pNext;
        }
 
        vk::VkPhysicalDeviceMultiviewFeatures physicalDeviceMultiviewFeatures;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_multiview"))
+       deMemset(&physicalDeviceMultiviewFeatures, 0, sizeof(physicalDeviceMultiviewFeatures));
+
+       if ( context.contextSupports(vk::ApiVersion(1, 1, 0)) || isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_multiview")) )
        {
-               deMemset(&physicalDeviceMultiviewFeatures, 0, sizeof(physicalDeviceMultiviewFeatures));
-               physicalDeviceMultiviewFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
+               physicalDeviceMultiviewFeatures.sType = getStructureType<VkPhysicalDeviceMultiviewFeatures>();
                *nextPtr = &physicalDeviceMultiviewFeatures;
                nextPtr  = &physicalDeviceMultiviewFeatures.pNext;
        }
 
        vk::VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR physicalDevicePipelineExecutablePropertiesFeaturesKHR;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_pipeline_executable_properties"))
+       deMemset(&physicalDevicePipelineExecutablePropertiesFeaturesKHR, 0, sizeof(physicalDevicePipelineExecutablePropertiesFeaturesKHR));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_pipeline_executable_properties")) )
        {
-               deMemset(&physicalDevicePipelineExecutablePropertiesFeaturesKHR, 0, sizeof(physicalDevicePipelineExecutablePropertiesFeaturesKHR));
-               physicalDevicePipelineExecutablePropertiesFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR;
+               physicalDevicePipelineExecutablePropertiesFeaturesKHR.sType = getStructureType<VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR>();
                *nextPtr = &physicalDevicePipelineExecutablePropertiesFeaturesKHR;
                nextPtr  = &physicalDevicePipelineExecutablePropertiesFeaturesKHR.pNext;
        }
 
        vk::VkPhysicalDeviceScalarBlockLayoutFeaturesEXT physicalDeviceScalarBlockLayoutFeaturesEXT;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_scalar_block_layout"))
+       deMemset(&physicalDeviceScalarBlockLayoutFeaturesEXT, 0, sizeof(physicalDeviceScalarBlockLayoutFeaturesEXT));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_scalar_block_layout")) )
        {
-               deMemset(&physicalDeviceScalarBlockLayoutFeaturesEXT, 0, sizeof(physicalDeviceScalarBlockLayoutFeaturesEXT));
-               physicalDeviceScalarBlockLayoutFeaturesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT;
+               physicalDeviceScalarBlockLayoutFeaturesEXT.sType = getStructureType<VkPhysicalDeviceScalarBlockLayoutFeaturesEXT>();
                *nextPtr = &physicalDeviceScalarBlockLayoutFeaturesEXT;
                nextPtr  = &physicalDeviceScalarBlockLayoutFeaturesEXT.pNext;
        }
 
        vk::VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR physicalDeviceUniformBufferStandardLayoutFeaturesKHR;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_uniform_buffer_standard_layout"))
+       deMemset(&physicalDeviceUniformBufferStandardLayoutFeaturesKHR, 0, sizeof(physicalDeviceUniformBufferStandardLayoutFeaturesKHR));
+
+       if ( context.contextSupports(vk::ApiVersion(1, 1, 0)) )
        {
-               deMemset(&physicalDeviceUniformBufferStandardLayoutFeaturesKHR, 0, sizeof(physicalDeviceUniformBufferStandardLayoutFeaturesKHR));
-               physicalDeviceUniformBufferStandardLayoutFeaturesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR;
+               physicalDeviceUniformBufferStandardLayoutFeaturesKHR.sType = getStructureType<VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR>();
                *nextPtr = &physicalDeviceUniformBufferStandardLayoutFeaturesKHR;
                nextPtr  = &physicalDeviceUniformBufferStandardLayoutFeaturesKHR.pNext;
        }
 
        vk::VkPhysicalDeviceVariablePointersFeatures physicalDeviceVariablePointersFeatures;
-       if (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_variable_pointers"))
+       deMemset(&physicalDeviceVariablePointersFeatures, 0, sizeof(physicalDeviceVariablePointersFeatures));
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_variable_pointers")) )
        {
-               deMemset(&physicalDeviceVariablePointersFeatures, 0, sizeof(physicalDeviceVariablePointersFeatures));
-               physicalDeviceVariablePointersFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES;
+               physicalDeviceVariablePointersFeatures.sType = getStructureType<VkPhysicalDeviceVariablePointersFeatures>();
                *nextPtr = &physicalDeviceVariablePointersFeatures;
                nextPtr  = &physicalDeviceVariablePointersFeatures.pNext;
        }
@@ -95,7 +107,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( coreFeatures.features.shaderSampledImageArrayDynamicIndexing == VK_FALSE )
                {
@@ -104,7 +116,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( coreFeatures.features.shaderStorageBufferArrayDynamicIndexing == VK_FALSE )
                {
@@ -113,7 +125,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_8bit_storage") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_8bit_storage")) )
        {
                if ( physicalDevice8BitStorageFeaturesKHR.storageBuffer8BitAccess == VK_FALSE )
                {
@@ -122,7 +134,16 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_multiview") )
+       if ( context.contextSupports(vk::ApiVersion(1, 1, 0)) )
+       {
+               if ( physicalDeviceMultiviewFeatures.multiview == VK_FALSE )
+               {
+                       log << tcu::TestLog::Message << "Mandatory feature multiview not supported" << tcu::TestLog::EndMessage;
+                       result = false;
+               }
+       }
+
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_multiview")) )
        {
                if ( physicalDeviceMultiviewFeatures.multiview == VK_FALSE )
                {
@@ -131,7 +152,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_variable_pointers") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_variable_pointers")) )
        {
                if ( physicalDeviceVariablePointersFeatures.variablePointersStorageBuffer == VK_FALSE )
                {
@@ -140,7 +161,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.shaderUniformTexelBufferArrayDynamicIndexing == VK_FALSE )
                {
@@ -149,7 +170,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.shaderStorageTexelBufferArrayDynamicIndexing == VK_FALSE )
                {
@@ -158,7 +179,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.shaderSampledImageArrayNonUniformIndexing == VK_FALSE )
                {
@@ -167,7 +188,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.shaderStorageBufferArrayNonUniformIndexing == VK_FALSE )
                {
@@ -176,7 +197,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.shaderUniformTexelBufferArrayNonUniformIndexing == VK_FALSE )
                {
@@ -185,7 +206,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingSampledImageUpdateAfterBind == VK_FALSE )
                {
@@ -194,7 +215,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingStorageImageUpdateAfterBind == VK_FALSE )
                {
@@ -203,7 +224,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingStorageBufferUpdateAfterBind == VK_FALSE )
                {
@@ -212,7 +233,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingUniformTexelBufferUpdateAfterBind == VK_FALSE )
                {
@@ -221,7 +242,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingStorageTexelBufferUpdateAfterBind == VK_FALSE )
                {
@@ -230,7 +251,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingUpdateUnusedWhilePending == VK_FALSE )
                {
@@ -239,7 +260,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.descriptorBindingPartiallyBound == VK_FALSE )
                {
@@ -248,7 +269,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceDescriptorIndexingFeaturesEXT.runtimeDescriptorArray == VK_FALSE )
                {
@@ -257,7 +278,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_inline_uniform_block") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_inline_uniform_block")) )
        {
                if ( physicalDeviceInlineUniformBlockFeaturesEXT.inlineUniformBlock == VK_FALSE )
                {
@@ -266,7 +287,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_inline_uniform_block") && vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_descriptor_indexing") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_inline_uniform_block")) && isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_descriptor_indexing")) )
        {
                if ( physicalDeviceInlineUniformBlockFeaturesEXT.descriptorBindingInlineUniformBlockUpdateAfterBind == VK_FALSE )
                {
@@ -275,7 +296,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_EXT_scalar_block_layout") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_EXT_scalar_block_layout")) )
        {
                if ( physicalDeviceScalarBlockLayoutFeaturesEXT.scalarBlockLayout == VK_FALSE )
                {
@@ -284,7 +305,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_uniform_buffer_standard_layout") )
+       if ( context.contextSupports(vk::ApiVersion(1, 1, 0)) )
        {
                if ( physicalDeviceUniformBufferStandardLayoutFeaturesKHR.uniformBufferStandardLayout == VK_FALSE )
                {
@@ -293,7 +314,7 @@ bool checkMandatoryFeatures(const vkt::Context& context)
                }
        }
 
-       if ( vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_pipeline_executable_properties") )
+       if ( isExtensionSupported(deviceExtensions, RequiredExtension("VK_KHR_pipeline_executable_properties")) )
        {
                if ( physicalDevicePipelineExecutablePropertiesFeaturesKHR.pipelineExecutableInfo == VK_FALSE )
                {
index 7c9d3a6500e024948ebdea2dffc317fe9e024da4..637e5f11a14cd588a75712f0d68f9fc113b6e67d 100644 (file)
@@ -1615,36 +1615,64 @@ def writeContextDefs(dfDefs, filename):
        pattern = "const vk::{0}&\tContext::get{1}\t(void) const {{ return m_device->get{1}();\t}}"
        genericDeviceFeaturesWriter(dfDefs, pattern, filename)
 
+def splitWithQuotation(line):
+       result = []
+       splitted = re.findall(r'[^"\s]\S*|".+?"', line)
+       for s in splitted:
+               result.append(s.replace('"', ''))
+       return result
+
 def writeMandatoryFeatures(filename):
        stream = []
-       pattern = r'\s*([\w]+)\s+([\w]+)\s+([\w]+)\s+EXTENSIONS\s*\(([\s\w]*)\)'
+       pattern = r'\s*([\w]+)\s+([\w]+)\s+REQUIREMENTS\s+\((.*)\)'
        mandatoryFeatures = readFile(os.path.join(VULKAN_H_DIR, "mandatory_features.txt"))
        matches = re.findall(pattern, mandatoryFeatures)
        dictStructs = {}
        dictData = []
        for m in matches:
-               allExtensions = m[3].split()
-               dictData.append( [ m[0], m[1], allExtensions ] )
+               allRequirements = splitWithQuotation(m[2])
+               dictData.append( [ m[0], m[1], allRequirements ] )
                if m[0] != 'VkPhysicalDeviceFeatures' :
-                       dictStructs[m[0]] = [ m[0][2:3].lower() + m[0][3:], m[2], allExtensions[0] ]
+                       if (m[0] not in dictStructs):
+                               dictStructs[m[0]] = [m[0][2:3].lower() + m[0][3:]]
+                       if (allRequirements[0]):
+                               if (allRequirements[0] not in dictStructs[m[0]][1:]):
+                                       dictStructs[m[0]].append(allRequirements[0])
 
        stream.extend(['bool checkMandatoryFeatures(const vkt::Context& context)\n{',
                                   '\tif ( !vk::isInstanceExtensionSupported(context.getUsedApiVersion(), context.getInstanceExtensions(), "VK_KHR_get_physical_device_properties2") )',
                                   '\t\tTCU_THROW(NotSupportedError, "Extension VK_KHR_get_physical_device_properties2 is not present");',
                                   '',
+                                  '\tVkPhysicalDevice\t\t\t\t\tphysicalDevice\t\t= context.getPhysicalDevice();',
+                                  '\tconst InstanceInterface&\t\t\tvki\t\t\t\t\t= context.getInstanceInterface();',
+                                  '\tconst vector<VkExtensionProperties>\tdeviceExtensions\t= enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);',
+                                  '',
                                   '\ttcu::TestLog& log = context.getTestContext().getLog();',
                                   '\tvk::VkPhysicalDeviceFeatures2 coreFeatures;',
                                   '\tdeMemset(&coreFeatures, 0, sizeof(coreFeatures));',
                                   '\tcoreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;',
                                   '\tvoid** nextPtr = &coreFeatures.pNext;',
                                   ''])
+
        listStruct = sorted(dictStructs.items(), key=lambda tup: tup[0]) # sort to have same results for py2 and py3
        for k, v in listStruct:
                stream.extend(['\tvk::' + k + ' ' + v[0]+ ';',
-                                          '\tif (vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "' + v[2] + '"))',
-                                          '\t{',
-                                          '\t\tdeMemset(&' + v[0] + ', 0, sizeof(' + v[0] + '));',
-                                          '\t\t' + v[0] + '.sType = ' + v[1] + ';',
+                                       '\tdeMemset(&' + v[0] + ', 0, sizeof(' + v[0] + '));',
+                                       ''])
+               reqs = v[1:]
+               if len(reqs) > 0 :
+                       cond = 'if ( '
+                       for i, req in enumerate(reqs) :
+                               if (req.startswith("ApiVersion")):
+                                       cond = cond + 'context.contextSupports(vk::' + req + ')'
+                               else:
+                                       cond = cond + 'isExtensionSupported(deviceExtensions, RequiredExtension("' + req + '"))'
+                               if i+1 < len(reqs) :
+                                       cond = cond + ' || '
+                       cond = cond + ' )'
+                       stream.append('\t' + cond)
+               stream.extend(['\t{',
+                                          '\t\t' + v[0] + '.sType = getStructureType<' + k + '>();',
                                           '\t\t*nextPtr = &' + v[0] + ';',
                                           '\t\tnextPtr  = &' + v[0] + '.pNext;',
                                           '\t}',
@@ -1660,8 +1688,13 @@ def writeMandatoryFeatures(filename):
                        structName = dictStructs[v[0]][0]
                if len(v[2]) > 0 :
                        condition = 'if ( '
-                       for i, ext in enumerate(v[2]) :
-                               condition = condition + 'vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "' + ext + '")'
+                       for i, req in enumerate(v[2]) :
+                               if (req.startswith("ApiVersion")):
+                                       condition = condition + 'context.contextSupports(vk::' + req + ')'
+                               elif '.' in req:
+                                       condition = condition + req
+                               else:
+                                       condition = condition + 'isExtensionSupported(deviceExtensions, RequiredExtension("' + req + '"))'
                                if i+1 < len(v[2]) :
                                        condition = condition + ' && '
                        condition = condition + ' )'
index 960bc5b2d98df4e11007eefc71c6145a88c389c6..bbb95466ba8411f1f285314fd143d505da5522cc 100644 (file)
@@ -6,27 +6,28 @@
 // * structure type enum
 // * required extensions that enable specified feature
 
-VkPhysicalDeviceFeatures                                                               robustBufferAccess                                                                      not_used                                                                                                                                                EXTENSIONS ()
-VkPhysicalDeviceFeatures                                                               shaderSampledImageArrayDynamicIndexing                          not_used                                                                                                                                                EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceFeatures                                                               shaderStorageBufferArrayDynamicIndexing                         not_used                                                                                                                                                EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDevice8BitStorageFeaturesKHR                                 storageBuffer8BitAccess                                                         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR                                             EXTENSIONS ( VK_KHR_8bit_storage )
-VkPhysicalDeviceMultiviewFeatures                                              multiview                                                                                       VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES                                                    EXTENSIONS ( VK_KHR_multiview )
-VkPhysicalDeviceVariablePointersFeatures                               variablePointersStorageBuffer                                           VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES                                    EXTENSIONS ( VK_KHR_variable_pointers )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderUniformTexelBufferArrayDynamicIndexing            VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderStorageTexelBufferArrayDynamicIndexing            VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderSampledImageArrayNonUniformIndexing                       VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderStorageBufferArrayNonUniformIndexing                      VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderUniformTexelBufferArrayNonUniformIndexing         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingSampledImageUpdateAfterBind            VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageImageUpdateAfterBind            VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageBufferUpdateAfterBind           VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingUniformTexelBufferUpdateAfterBind      VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageTexelBufferUpdateAfterBind      VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingUpdateUnusedWhilePending                       VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingPartiallyBound                                         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  runtimeDescriptorArray                                                          VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT                              EXTENSIONS ( VK_EXT_descriptor_indexing )
-VkPhysicalDeviceInlineUniformBlockFeaturesEXT                  inlineUniformBlock                                                                      VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT                             EXTENSIONS ( VK_EXT_inline_uniform_block )
-VkPhysicalDeviceInlineUniformBlockFeaturesEXT                  descriptorBindingInlineUniformBlockUpdateAfterBind      VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT                             EXTENSIONS ( VK_EXT_inline_uniform_block VK_EXT_descriptor_indexing )
-VkPhysicalDeviceScalarBlockLayoutFeaturesEXT                   scalarBlockLayout                                                                       VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT                              EXTENSIONS ( VK_EXT_scalar_block_layout )
-VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR uniformBufferStandardLayout                                                     VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR   EXTENSIONS ( VK_KHR_uniform_buffer_standard_layout )
-VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR        pipelineExecutableInfo                                                          VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR   EXTENSIONS ( VK_KHR_pipeline_executable_properties )
+VkPhysicalDeviceFeatures                                                               robustBufferAccess                                                                      REQUIREMENTS ()
+VkPhysicalDeviceFeatures                                                               shaderSampledImageArrayDynamicIndexing                          REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceFeatures                                                               shaderStorageBufferArrayDynamicIndexing                         REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDevice8BitStorageFeaturesKHR                                 storageBuffer8BitAccess                                                         REQUIREMENTS ( VK_KHR_8bit_storage )
+VkPhysicalDeviceMultiviewFeatures                                              multiview                                                                                       REQUIREMENTS ( "ApiVersion(1, 1, 0)" )
+VkPhysicalDeviceMultiviewFeatures                                              multiview                                                                                       REQUIREMENTS ( VK_KHR_multiview )
+VkPhysicalDeviceVariablePointersFeatures                               variablePointersStorageBuffer                                           REQUIREMENTS ( VK_KHR_variable_pointers )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderUniformTexelBufferArrayDynamicIndexing            REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderStorageTexelBufferArrayDynamicIndexing            REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderSampledImageArrayNonUniformIndexing                       REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderStorageBufferArrayNonUniformIndexing                      REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  shaderUniformTexelBufferArrayNonUniformIndexing         REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingSampledImageUpdateAfterBind            REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageImageUpdateAfterBind            REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageBufferUpdateAfterBind           REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingUniformTexelBufferUpdateAfterBind      REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingStorageTexelBufferUpdateAfterBind      REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingUpdateUnusedWhilePending                       REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  descriptorBindingPartiallyBound                                         REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceDescriptorIndexingFeaturesEXT                  runtimeDescriptorArray                                                          REQUIREMENTS ( VK_EXT_descriptor_indexing )
+VkPhysicalDeviceInlineUniformBlockFeaturesEXT                  inlineUniformBlock                                                                      REQUIREMENTS ( VK_EXT_inline_uniform_block )
+VkPhysicalDeviceInlineUniformBlockFeaturesEXT                  descriptorBindingInlineUniformBlockUpdateAfterBind      REQUIREMENTS ( VK_EXT_inline_uniform_block VK_EXT_descriptor_indexing )
+VkPhysicalDeviceScalarBlockLayoutFeaturesEXT                   scalarBlockLayout                                                                       REQUIREMENTS ( VK_EXT_scalar_block_layout )
+VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR uniformBufferStandardLayout                                                     REQUIREMENTS ( "ApiVersion(1, 1, 0)" )
+VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR        pipelineExecutableInfo                                                          REQUIREMENTS ( VK_KHR_pipeline_executable_properties )