writeSupportedExtensions for VKSC
authorMarcin Zając <marcin.zajac@mobica.com>
Tue, 17 May 2022 15:40:26 +0000 (17:40 +0200)
committerPiers Daniell <pdaniell@nvidia.com>
Fri, 20 May 2022 20:46:11 +0000 (14:46 -0600)
Remove depreciated extensions_data.txt file in gen_framework.py
for vkSupportedExtensions.inl file generation

Components: Vulkan

VK-GL-CTS issue: 3690

Change-Id: Id216ea169c4245fc81177ca02677bbbf7320b803

external/vulkancts/framework/vulkan/generated/vulkansc/vkSupportedExtensions.inl
external/vulkancts/scripts/gen_framework.py

index b5a6116..fb8c86d 100644 (file)
@@ -4,13 +4,67 @@
  */
 
 
-void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&)
+void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>& dst)
 {
-       DE_UNREF(coreVersion);
+       if (coreVersion >= VK_API_VERSION_1_2)
+       {
+               dst.push_back("VK_EXT_descriptor_indexing");
+               dst.push_back("VK_EXT_host_query_reset");
+               dst.push_back("VK_EXT_sampler_filter_minmax");
+               dst.push_back("VK_EXT_scalar_block_layout");
+               dst.push_back("VK_EXT_separate_stencil_usage");
+               dst.push_back("VK_EXT_shader_viewport_index_layer");
+               dst.push_back("VK_KHR_8bit_storage");
+               dst.push_back("VK_KHR_buffer_device_address");
+               dst.push_back("VK_KHR_create_renderpass2");
+               dst.push_back("VK_KHR_depth_stencil_resolve");
+               dst.push_back("VK_KHR_draw_indirect_count");
+               dst.push_back("VK_KHR_driver_properties");
+               dst.push_back("VK_KHR_image_format_list");
+               dst.push_back("VK_KHR_imageless_framebuffer");
+               dst.push_back("VK_KHR_sampler_mirror_clamp_to_edge");
+               dst.push_back("VK_KHR_separate_depth_stencil_layouts");
+               dst.push_back("VK_KHR_shader_atomic_int64");
+               dst.push_back("VK_KHR_shader_float16_int8");
+               dst.push_back("VK_KHR_shader_float_controls");
+               dst.push_back("VK_KHR_shader_subgroup_extended_types");
+               dst.push_back("VK_KHR_spirv_1_4");
+               dst.push_back("VK_KHR_timeline_semaphore");
+               dst.push_back("VK_KHR_uniform_buffer_standard_layout");
+               dst.push_back("VK_KHR_vulkan_memory_model");
+       }
+       if (coreVersion >= VK_API_VERSION_1_1)
+       {
+               dst.push_back("VK_KHR_16bit_storage");
+               dst.push_back("VK_KHR_bind_memory2");
+               dst.push_back("VK_KHR_dedicated_allocation");
+               dst.push_back("VK_KHR_descriptor_update_template");
+               dst.push_back("VK_KHR_device_group");
+               dst.push_back("VK_KHR_external_fence");
+               dst.push_back("VK_KHR_external_memory");
+               dst.push_back("VK_KHR_external_semaphore");
+               dst.push_back("VK_KHR_get_memory_requirements2");
+               dst.push_back("VK_KHR_maintenance1");
+               dst.push_back("VK_KHR_maintenance2");
+               dst.push_back("VK_KHR_maintenance3");
+               dst.push_back("VK_KHR_multiview");
+               dst.push_back("VK_KHR_relaxed_block_layout");
+               dst.push_back("VK_KHR_sampler_ycbcr_conversion");
+               dst.push_back("VK_KHR_shader_draw_parameters");
+               dst.push_back("VK_KHR_storage_buffer_storage_class");
+               dst.push_back("VK_KHR_variable_pointers");
+       }
 }
 
-void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&)
+void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>& dst)
 {
-       DE_UNREF(coreVersion);
+       if (coreVersion >= VK_API_VERSION_1_1)
+       {
+               dst.push_back("VK_KHR_device_group_creation");
+               dst.push_back("VK_KHR_external_fence_capabilities");
+               dst.push_back("VK_KHR_external_memory_capabilities");
+               dst.push_back("VK_KHR_external_semaphore_capabilities");
+               dst.push_back("VK_KHR_get_physical_device_properties2");
+       }
 }
 
index 04afae4..e9060d4 100755 (executable)
@@ -552,6 +552,7 @@ def parseVersions (src):
        # 4. minor version number
        return [(m.group()[:-2], m.start(), getApiVariantIndexByName(m.group(1)), int(m.group(2)), int(m.group(3))) for m in re.finditer('VK(SC)?_VERSION_([1-9])_([0-9]) 1', src)]
 
+
 def parseHandles (src):
        matches = re.findall(r'VK_DEFINE(_NON_DISPATCHABLE|)_HANDLE\((' + IDENT_PTRN + r')\)[ \t]*[\n\r]', src)
        handles = []
@@ -1760,17 +1761,6 @@ def writeDriverIds(apiName, filename):
 
 
 def writeSupportedExtensions(apiName, api, filename):
-       def getCoreVersion (extensionName, extensionsData):
-               # returns None when extension was not added to core for any Vulkan version
-               # returns array containing DEVICE or INSTANCE string followed by the vulkan version in which this extension is core
-               # note that this function is also called for vulkan 1.0 source for which extName is None
-               if not extensionName:
-                       return None
-               ptrn            = extensionName + r'\s+(DEVICE|INSTANCE)\s+([0-9_]+)'
-               coreVersion = re.search(ptrn, extensionsData, re.I)
-               if coreVersion != None:
-                       return [coreVersion.group(1)] + [int(number) for number in coreVersion.group(2).split('_')[:4]]
-               return None
 
        def writeExtensionsForVersions(map):
                result = []
@@ -1781,7 +1771,7 @@ def writeSupportedExtensions(apiName, api, filename):
                                result.append('         dst.push_back("' + extension.name + '");')
                        result.append(" }")
 
-               if  not map:
+               if not map:
                        result.append(" DE_UNREF(coreVersion);")
 
                return result
@@ -1804,18 +1794,42 @@ def writeSupportedExtensions(apiName, api, filename):
                                deviceMap[Version(ext.versionInCore[1:])] = list + [ext] if list else [ext]
                        versionSet.add(Version(ext.versionInCore[1:]))
 
+       # add list of extensions missing in Vulkan SC specification
+       if apiName == 'SC':
+               for extensionName, data in api.additionalExtensionData:
+                       # make sure that this extension was registered
+                       if 'register_extension' not in data.keys():
+                               continue
+                       # save array containing 'device' or 'instance' string followed by the optional vulkan version in which this extension is core;
+                       # note that register_extension section is also required for partialy promoted extensions like VK_EXT_extended_dynamic_state2
+                       # but those extensions should not fill 'core' tag
+                       match = re.match("(\d).(\d).(\d).(\d)", data['register_extension']['core'])
+                       if match != None:
+                               currVersion = Version([int(match.group(1)), int(match.group(2)), int(match.group(3)), int(match.group(4))])
+                               ext = Extension(extensionName, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+                               if currVersion.api==0 and currVersion.major==1 and currVersion.minor>2:
+                                       continue
+                               if data['register_extension']['type'] == 'instance':
+                                       list = instanceMap.get(currVersion)
+                                       instanceMap[currVersion] = list + [ext] if list else [ext]
+                               else:
+                                       list = deviceMap.get(currVersion)
+                                       deviceMap[currVersion] = list + [ext] if list else [ext]
+                               versionSet.add(currVersion)
+
        lines = addVersionDefines(versionSet) + [
        "",
-       "void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(deviceMap) != 0 else ""),
+       "void getCoreDeviceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(deviceMap) != 0 or apiName == 'SC' else ""),
        "{"] + writeExtensionsForVersions(deviceMap) + [
        "}",
        "",
-       "void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(instanceMap) != 0 else ""),
+       "void getCoreInstanceExtensionsImpl (uint32_t coreVersion, ::std::vector<const char*>&%s)" % (" dst" if len(instanceMap) != 0 or apiName == 'SC' else ""),
        "{"] + writeExtensionsForVersions(instanceMap) + [
        "}",
        ""] + removeVersionDefines(versionSet)
        writeInlFile(filename, INL_HEADER, lines)
 
+
 def writeExtensionFunctions (api, filename):
 
        def isInstanceExtension (ext):