Add dependency checking to dEQP-VK.api.info.*.extensions
authorYiwei Zhang <zzyiwei@google.com>
Fri, 31 Aug 2018 22:17:21 +0000 (15:17 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 4 Oct 2018 08:08:38 +0000 (04:08 -0400)
Update instance and device extension tests to also check the
dependencies of the required extension. Implement gen_ext_deps.py script
to generate vkApiExtensionDependencyInfo.inl from Vulkan registry.

Components: Vulkan

VK-GL-CTS Issue: 1340

Affects: dEQP-VK.api.info.*.extensions

Change-Id: Ie0c764f67a7c2c020e798fac6fe382f8f82ec375

external/vulkancts/framework/vulkan/vkApiExtensionDependencyInfo.inl [new file with mode: 0644]
external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
external/vulkancts/scripts/gen_ext_deps.py [new file with mode: 0644]
scripts/check_build_sanity.py

diff --git a/external/vulkancts/framework/vulkan/vkApiExtensionDependencyInfo.inl b/external/vulkancts/framework/vulkan/vkApiExtensionDependencyInfo.inl
new file mode 100644 (file)
index 0000000..195556d
--- /dev/null
@@ -0,0 +1,139 @@
+/* WARNING: This is auto-generated file. Do not modify, since changes will
+ * be lost! Modify the generating script instead.
+ *
+ * Generated from Khronos Vulkan API description (vk.xml) revision 9f2171b41192282a9957c43a37d5d8c6a982abed.
+ */
+static const std::pair<const char*, const char*>       instanceExtensionDependencies_1_0[]     =
+{
+       std::make_pair("VK_EXT_acquire_xlib_display", "VK_EXT_direct_mode_display"),
+       std::make_pair("VK_EXT_direct_mode_display", "VK_KHR_display"),
+       std::make_pair("VK_EXT_display_surface_counter", "VK_KHR_display"),
+       std::make_pair("VK_EXT_swapchain_colorspace", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_android_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_display", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_external_fence_capabilities", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_external_memory_capabilities", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_external_semaphore_capabilities", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_get_display_properties2", "VK_KHR_display"),
+       std::make_pair("VK_KHR_get_surface_capabilities2", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_mir_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_wayland_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_win32_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_xcb_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_xlib_surface", "VK_KHR_surface"),
+       std::make_pair("VK_MVK_ios_surface", "VK_KHR_surface"),
+       std::make_pair("VK_MVK_macos_surface", "VK_KHR_surface"),
+       std::make_pair("VK_NN_vi_surface", "VK_KHR_surface"),
+};
+static const std::pair<const char*, const char*>       instanceExtensionDependencies_1_1[]     =
+{
+       std::make_pair("VK_EXT_acquire_xlib_display", "VK_EXT_direct_mode_display"),
+       std::make_pair("VK_EXT_direct_mode_display", "VK_KHR_display"),
+       std::make_pair("VK_EXT_display_surface_counter", "VK_KHR_display"),
+       std::make_pair("VK_EXT_swapchain_colorspace", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_android_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_display", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_get_display_properties2", "VK_KHR_display"),
+       std::make_pair("VK_KHR_get_surface_capabilities2", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_mir_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_wayland_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_win32_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_xcb_surface", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_xlib_surface", "VK_KHR_surface"),
+       std::make_pair("VK_MVK_ios_surface", "VK_KHR_surface"),
+       std::make_pair("VK_MVK_macos_surface", "VK_KHR_surface"),
+       std::make_pair("VK_NN_vi_surface", "VK_KHR_surface"),
+};
+static const std::pair<const char*, const char*>       deviceExtensionDependencies_1_0[]       =
+{
+       std::make_pair("VK_AMD_shader_core_properties", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_AMD_texture_gather_bias_lod", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_ANDROID_external_memory_android_hardware_buffer", "VK_KHR_sampler_ycbcr_conversion"),
+       std::make_pair("VK_ANDROID_external_memory_android_hardware_buffer", "VK_KHR_external_memory"),
+       std::make_pair("VK_ANDROID_external_memory_android_hardware_buffer", "VK_EXT_queue_family_foreign"),
+       std::make_pair("VK_EXT_astc_decode_mode", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_conservative_rasterization", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_debug_marker", "VK_EXT_debug_report"),
+       std::make_pair("VK_EXT_descriptor_indexing", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_descriptor_indexing", "VK_KHR_maintenance3"),
+       std::make_pair("VK_EXT_discard_rectangles", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_display_control", "VK_EXT_display_surface_counter"),
+       std::make_pair("VK_EXT_display_control", "VK_KHR_swapchain"),
+       std::make_pair("VK_EXT_external_memory_dma_buf", "VK_KHR_external_memory_fd"),
+       std::make_pair("VK_EXT_external_memory_host", "VK_KHR_external_memory"),
+       std::make_pair("VK_EXT_hdr_metadata", "VK_KHR_swapchain"),
+       std::make_pair("VK_EXT_inline_uniform_block", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_inline_uniform_block", "VK_KHR_maintenance1"),
+       std::make_pair("VK_EXT_queue_family_foreign", "VK_KHR_external_memory"),
+       std::make_pair("VK_EXT_sampler_filter_minmax", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_EXT_vertex_attribute_divisor", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_GOOGLE_display_timing", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_16bit_storage", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_16bit_storage", "VK_KHR_storage_buffer_storage_class"),
+       std::make_pair("VK_KHR_8bit_storage", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_8bit_storage", "VK_KHR_storage_buffer_storage_class"),
+       std::make_pair("VK_KHR_create_renderpass2", "VK_KHR_multiview"),
+       std::make_pair("VK_KHR_create_renderpass2", "VK_KHR_maintenance2"),
+       std::make_pair("VK_KHR_dedicated_allocation", "VK_KHR_get_memory_requirements2"),
+       std::make_pair("VK_KHR_device_group", "VK_KHR_device_group_creation"),
+       std::make_pair("VK_KHR_display_swapchain", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_display_swapchain", "VK_KHR_display"),
+       std::make_pair("VK_KHR_external_fence", "VK_KHR_external_fence_capabilities"),
+       std::make_pair("VK_KHR_external_fence_fd", "VK_KHR_external_fence"),
+       std::make_pair("VK_KHR_external_fence_win32", "VK_KHR_external_fence"),
+       std::make_pair("VK_KHR_external_memory", "VK_KHR_external_memory_capabilities"),
+       std::make_pair("VK_KHR_external_memory_fd", "VK_KHR_external_memory"),
+       std::make_pair("VK_KHR_external_memory_win32", "VK_KHR_external_memory"),
+       std::make_pair("VK_KHR_external_semaphore", "VK_KHR_external_semaphore_capabilities"),
+       std::make_pair("VK_KHR_external_semaphore_fd", "VK_KHR_external_semaphore"),
+       std::make_pair("VK_KHR_external_semaphore_win32", "VK_KHR_external_semaphore"),
+       std::make_pair("VK_KHR_incremental_present", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_maintenance3", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_multiview", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_push_descriptor", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_sampler_ycbcr_conversion", "VK_KHR_maintenance1"),
+       std::make_pair("VK_KHR_sampler_ycbcr_conversion", "VK_KHR_bind_memory2"),
+       std::make_pair("VK_KHR_sampler_ycbcr_conversion", "VK_KHR_get_memory_requirements2"),
+       std::make_pair("VK_KHR_sampler_ycbcr_conversion", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_shared_presentable_image", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_shared_presentable_image", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_shared_presentable_image", "VK_KHR_get_surface_capabilities2"),
+       std::make_pair("VK_KHR_swapchain", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_variable_pointers", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_KHR_variable_pointers", "VK_KHR_storage_buffer_storage_class"),
+       std::make_pair("VK_KHR_win32_keyed_mutex", "VK_KHR_external_memory_win32"),
+       std::make_pair("VK_NVX_multiview_per_view_attributes", "VK_KHR_multiview"),
+       std::make_pair("VK_NVX_raytracing", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NVX_raytracing", "VK_KHR_get_memory_requirements2"),
+       std::make_pair("VK_NV_compute_shader_derivatives", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_corner_sampled_image", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_device_diagnostic_checkpoints", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_external_memory", "VK_NV_external_memory_capabilities"),
+       std::make_pair("VK_NV_external_memory_win32", "VK_NV_external_memory"),
+       std::make_pair("VK_NV_fragment_shader_barycentric", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_mesh_shader", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_scissor_exclusive", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_shader_image_footprint", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_shading_rate_image", "VK_KHR_get_physical_device_properties2"),
+       std::make_pair("VK_NV_win32_keyed_mutex", "VK_NV_external_memory_win32"),
+};
+static const std::pair<const char*, const char*>       deviceExtensionDependencies_1_1[]       =
+{
+       std::make_pair("VK_ANDROID_external_memory_android_hardware_buffer", "VK_EXT_queue_family_foreign"),
+       std::make_pair("VK_EXT_debug_marker", "VK_EXT_debug_report"),
+       std::make_pair("VK_EXT_display_control", "VK_EXT_display_surface_counter"),
+       std::make_pair("VK_EXT_display_control", "VK_KHR_swapchain"),
+       std::make_pair("VK_EXT_external_memory_dma_buf", "VK_KHR_external_memory_fd"),
+       std::make_pair("VK_EXT_hdr_metadata", "VK_KHR_swapchain"),
+       std::make_pair("VK_GOOGLE_display_timing", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_display_swapchain", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_display_swapchain", "VK_KHR_display"),
+       std::make_pair("VK_KHR_incremental_present", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_shared_presentable_image", "VK_KHR_swapchain"),
+       std::make_pair("VK_KHR_shared_presentable_image", "VK_KHR_get_surface_capabilities2"),
+       std::make_pair("VK_KHR_swapchain", "VK_KHR_surface"),
+       std::make_pair("VK_KHR_win32_keyed_mutex", "VK_KHR_external_memory_win32"),
+       std::make_pair("VK_NV_external_memory", "VK_NV_external_memory_capabilities"),
+       std::make_pair("VK_NV_external_memory_win32", "VK_NV_external_memory"),
+       std::make_pair("VK_NV_win32_keyed_mutex", "VK_NV_external_memory_win32"),
+};
index 22d016a1df9a04a29c6af3b9764f70377e8dad38..70fbb7d01c5b71591e03ef8f8e4e3231a8caea46 100644 (file)
@@ -59,6 +59,8 @@ namespace api
 namespace
 {
 
+#include "vkApiExtensionDependencyInfo.inl"
+
 using namespace vk;
 using std::vector;
 using std::set;
@@ -768,6 +770,38 @@ void checkDeviceExtensions (tcu::ResultCollector& results, const vector<string>&
        checkDuplicateExtensions(results, extensions);
 }
 
+void checkInstanceExtensionDependencies(tcu::ResultCollector& results,
+                                                                               int dependencyLength,
+                                                                               const std::pair<const char*, const char*>* dependencies,
+                                                                               const vector<VkExtensionProperties>& extensionProperties)
+{
+       for (int ndx = 0; ndx < dependencyLength; ndx++)
+       {
+               if (isExtensionSupported(extensionProperties, RequiredExtension(dependencies[ndx].first)) &&
+                       !isExtensionSupported(extensionProperties, RequiredExtension(dependencies[ndx].second)))
+               {
+                       results.fail("Extension " + string(dependencies[ndx].first) + " is missing dependency: " + string(dependencies[ndx].second));
+               }
+       }
+}
+
+void checkDeviceExtensionDependencies(tcu::ResultCollector& results,
+                                                                         int dependencyLength,
+                                                                         const std::pair<const char*, const char*>* dependencies,
+                                                                         const vector<VkExtensionProperties>& instanceExtensionProperties,
+                                                                         const vector<VkExtensionProperties>& deviceExtensionProperties)
+{
+       for (int ndx = 0; ndx < dependencyLength; ndx++)
+       {
+               if (isExtensionSupported(deviceExtensionProperties, RequiredExtension(dependencies[ndx].first)) &&
+                       !isExtensionSupported(deviceExtensionProperties, RequiredExtension(dependencies[ndx].second)) &&
+                       !isExtensionSupported(instanceExtensionProperties, RequiredExtension(dependencies[ndx].second)))
+               {
+                       results.fail("Extension " + string(dependencies[ndx].first) + " is missing dependency: " + string(dependencies[ndx].second));
+               }
+       }
+}
+
 tcu::TestStatus enumerateInstanceLayers (Context& context)
 {
        TestLog&                                                log                                     = context.getTestContext().getLog();
@@ -807,6 +841,19 @@ tcu::TestStatus enumerateInstanceExtensions (Context& context)
 
                checkInstanceExtensions(results, extensionNames);
                CheckEnumerateInstanceExtensionPropertiesIncompleteResult()(context, results, properties.size());
+
+               if (context.contextSupports(vk::ApiVersion(1, 1, 0)))
+               {
+                       checkInstanceExtensionDependencies(results,
+                                                                                          DE_LENGTH_OF_ARRAY(instanceExtensionDependencies_1_1),
+                                                                                          instanceExtensionDependencies_1_1, properties);
+               }
+               else if (context.contextSupports(vk::ApiVersion(1, 0, 0)))
+               {
+                       checkInstanceExtensionDependencies(results,
+                                                                                          DE_LENGTH_OF_ARRAY(instanceExtensionDependencies_1_0),
+                                                                                          instanceExtensionDependencies_1_0, properties);
+               }
        }
 
        {
@@ -901,19 +948,37 @@ tcu::TestStatus enumerateDeviceExtensions (Context& context)
        tcu::ResultCollector    results (log);
 
        {
-               const ScopedLogSection                          section         (log, "Global", "Global Extensions");
-               const vector<VkExtensionProperties>     properties      = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
-               vector<string>                                          extensionNames;
+               const ScopedLogSection                          section                                         (log, "Global", "Global Extensions");
+               const vector<VkExtensionProperties>     instanceExtensionProperties     = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
+               const vector<VkExtensionProperties>     deviceExtensionProperties       = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
+               vector<string>                                          deviceExtensionNames;
 
-               for (size_t ndx = 0; ndx < properties.size(); ndx++)
+               for (size_t ndx = 0; ndx < deviceExtensionProperties.size(); ndx++)
                {
-                       log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
+                       log << TestLog::Message << ndx << ": " << deviceExtensionProperties[ndx] << TestLog::EndMessage;
 
-                       extensionNames.push_back(properties[ndx].extensionName);
+                       deviceExtensionNames.push_back(deviceExtensionProperties[ndx].extensionName);
                }
 
-               checkDeviceExtensions(results, extensionNames);
-               CheckEnumerateDeviceExtensionPropertiesIncompleteResult()(context, results, properties.size());
+               checkDeviceExtensions(results, deviceExtensionNames);
+               CheckEnumerateDeviceExtensionPropertiesIncompleteResult()(context, results, deviceExtensionProperties.size());
+
+               if (context.contextSupports(vk::ApiVersion(1, 1, 0)))
+               {
+                       checkDeviceExtensionDependencies(results,
+                                                                                        DE_LENGTH_OF_ARRAY(deviceExtensionDependencies_1_1),
+                                                                                        deviceExtensionDependencies_1_1,
+                                                                                        instanceExtensionProperties,
+                                                                                        deviceExtensionProperties);
+               }
+               else if (context.contextSupports(vk::ApiVersion(1, 0, 0)))
+               {
+                       checkDeviceExtensionDependencies(results,
+                                                                                        DE_LENGTH_OF_ARRAY(deviceExtensionDependencies_1_0),
+                                                                                        deviceExtensionDependencies_1_0,
+                                                                                        instanceExtensionProperties,
+                                                                                        deviceExtensionProperties);
+               }
        }
 
        {
diff --git a/external/vulkancts/scripts/gen_ext_deps.py b/external/vulkancts/scripts/gen_ext_deps.py
new file mode 100644 (file)
index 0000000..8b69a97
--- /dev/null
@@ -0,0 +1,156 @@
+# -*- coding: utf-8 -*-
+
+#-------------------------------------------------------------------------
+# drawElements Quality Program utilities
+# --------------------------------------
+#
+# Copyright 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-------------------------------------------------------------------------
+
+import os
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "scripts"))
+
+import khr_util.format
+import khr_util.registry_cache
+
+VK_SOURCE                                              = khr_util.registry_cache.RegistrySource(
+                                                                       "https://github.com/KhronosGroup/Vulkan-Docs.git",
+                                                                       "xml/vk.xml",
+                                                                       "9f2171b41192282a9957c43a37d5d8c6a982abed",
+                                                                       "e7d8761b09a76c85d5f949bf6c930407dcea34f679b09ed6b4bf1398bd2e7742")
+VK_INL_FILE                                            = os.path.join(os.path.dirname(__file__), "..", "framework", "vulkan", "vkApiExtensionDependencyInfo.inl")
+VK_INL_HEADER                                  = khr_util.format.genInlHeader("Khronos Vulkan API description (vk.xml)", VK_SOURCE.getRevision())
+
+def VK_MAKE_VERSION(major, minor, patch):
+       return (((major) << 22) | ((minor) << 12) | (patch))
+
+VK_API_VERSION_1_0                             = VK_MAKE_VERSION(1, 0, 0)
+VK_API_VERSION_1_1                             = VK_MAKE_VERSION(1, 1, 0)
+VK_EXT_NOT_PROMOTED                            = 0xFFFFFFFF
+VK_EXT_TYPE_INST                               = 0
+VK_EXT_TYPE_DEV                                        = 1
+VK_INST_EXT_DEP_1_0                            = 'instanceExtensionDependencies_1_0'
+VK_INST_EXT_DEP_1_1                            = 'instanceExtensionDependencies_1_1'
+VK_DEV_EXT_DEP_1_0                             = 'deviceExtensionDependencies_1_0'
+VK_DEV_EXT_DEP_1_1                             = 'deviceExtensionDependencies_1_1'
+VK_XML_EXT_DEPS                                        = 'requires'
+VK_XML_EXT_NAME                                        = 'name'
+VK_XML_EXT_PROMO                               = 'promotedto'
+VK_XML_EXT_PROMO_1_1                   = 'VK_VERSION_1_1'
+VK_XML_EXT_REQUIRES_CORE               = 'requiresCore'
+VK_XML_EXT_REQUIRES_CORE_1_1   = '1.1'
+VK_XML_EXT_SUPPORTED                   = 'supported'
+VK_XML_EXT_SUPPORTED_VULKAN            = 'vulkan'
+VK_XML_EXT_TYPE                                        = 'type'
+VK_XML_EXT_TYPE_DEVICE                 = 'device'
+VK_XML_EXT_TYPE_INSTANCE               = 'instance'
+
+def writeInlFile(filename, lines):
+       khr_util.format.writeInlFile(filename, VK_INL_HEADER, lines)
+
+def genExtDepArray(extDepsName, extDepsDict):
+       yield 'static const std::pair<const char*, const char*>\t%s[]\t=' % extDepsName
+       yield '{'
+       for ext in sorted(extDepsDict.iterkeys()):
+               for dep in extDepsDict[ext]:
+                       yield '\tstd::make_pair("%s", "%s"),' % (ext, dep)
+       yield '};'
+
+def genExtDepInl(allExtDepsDict):
+       lines = []
+
+       if VK_INST_EXT_DEP_1_0 in allExtDepsDict:
+               lines = lines + [line for line in genExtDepArray(VK_INST_EXT_DEP_1_0, allExtDepsDict[VK_INST_EXT_DEP_1_0])]
+       if VK_INST_EXT_DEP_1_1 in allExtDepsDict:
+               lines = lines + [line for line in genExtDepArray(VK_INST_EXT_DEP_1_1, allExtDepsDict[VK_INST_EXT_DEP_1_1])]
+       if VK_DEV_EXT_DEP_1_0 in allExtDepsDict:
+               lines = lines + [line for line in genExtDepArray(VK_DEV_EXT_DEP_1_0, allExtDepsDict[VK_DEV_EXT_DEP_1_0])]
+       if VK_DEV_EXT_DEP_1_1 in allExtDepsDict:
+               lines = lines + [line for line in genExtDepArray(VK_DEV_EXT_DEP_1_1, allExtDepsDict[VK_DEV_EXT_DEP_1_1])]
+
+       writeInlFile(VK_INL_FILE, lines)
+
+class extInfo:
+       def __init__(self):
+               self.type       = VK_EXT_TYPE_INST
+               self.core       = VK_API_VERSION_1_0
+               self.promo      = VK_EXT_NOT_PROMOTED
+               self.deps       = []
+
+def genExtDepsOnApiVersion(ext, extInfoDict, apiVersion):
+       deps = []
+
+       for dep in extInfoDict[ext].deps:
+               if apiVersion >= extInfoDict[dep].promo:
+                       continue
+
+               deps.append(dep)
+
+       return deps
+
+def genExtDeps(extInfoDict):
+       allExtDepsDict                                          = {}
+       allExtDepsDict[VK_INST_EXT_DEP_1_0]     = {}
+       allExtDepsDict[VK_INST_EXT_DEP_1_1]     = {}
+       allExtDepsDict[VK_DEV_EXT_DEP_1_0]      = {}
+       allExtDepsDict[VK_DEV_EXT_DEP_1_1]      = {}
+
+       for ext, info in extInfoDict.iteritems():
+               if info.deps == None:
+                       continue
+
+               if info.type == VK_EXT_TYPE_INST:
+                       allExtDepsDict[VK_INST_EXT_DEP_1_1][ext]        = genExtDepsOnApiVersion(ext, extInfoDict, VK_API_VERSION_1_1);
+                       if info.core >= VK_API_VERSION_1_1:
+                               continue
+                       allExtDepsDict[VK_INST_EXT_DEP_1_0][ext]        = genExtDepsOnApiVersion(ext, extInfoDict, VK_API_VERSION_1_0);
+               else:
+                       allExtDepsDict[VK_DEV_EXT_DEP_1_1][ext]         = genExtDepsOnApiVersion(ext, extInfoDict, VK_API_VERSION_1_1);
+                       if info.core >= VK_API_VERSION_1_1:
+                               continue
+                       allExtDepsDict[VK_DEV_EXT_DEP_1_0][ext]         = genExtDepsOnApiVersion(ext, extInfoDict, VK_API_VERSION_1_0);
+
+       return allExtDepsDict
+
+def getExtInfoDict(vkRegistry):
+       extInfoDict = {}
+
+       for ext in vkRegistry.extensions:
+               if (ext.attrib[VK_XML_EXT_SUPPORTED] != VK_XML_EXT_SUPPORTED_VULKAN):
+                       continue
+
+               name                            = ext.attrib[VK_XML_EXT_NAME]
+               extInfoDict[name]       = extInfo()
+               if ext.attrib[VK_XML_EXT_TYPE] == VK_XML_EXT_TYPE_DEVICE:
+                       extInfoDict[name].type = VK_EXT_TYPE_DEV
+               if VK_XML_EXT_REQUIRES_CORE in ext.attrib:
+                       if ext.attrib[VK_XML_EXT_REQUIRES_CORE] == VK_XML_EXT_REQUIRES_CORE_1_1:
+                               extInfoDict[name].core = VK_API_VERSION_1_1
+               if VK_XML_EXT_PROMO in ext.attrib:
+                       if ext.attrib[VK_XML_EXT_PROMO] == VK_XML_EXT_PROMO_1_1:
+                               extInfoDict[name].promo = VK_API_VERSION_1_1
+               if VK_XML_EXT_DEPS in ext.attrib:
+                       extInfoDict[name].deps = ext.attrib[VK_XML_EXT_DEPS].split(',')
+
+       return extInfoDict
+
+def getVKRegistry():
+       return khr_util.registry_cache.getRegistry(VK_SOURCE)
+
+if __name__ == '__main__':
+       genExtDepInl(genExtDeps(getExtInfoDict(getVKRegistry())))
index ee98a8b61aa00ca81969f810b85183c34c1afcdf..f3dda162cebd5566a70c2fc5cacfd94a45b0650d 100644 (file)
@@ -190,7 +190,10 @@ EARLY_SPECIAL_RECIPES      = [
                        RunScript(os.path.join("scripts", "opengl", "gen_all.py")),
                        RunScript(os.path.join("external", "vulkancts", "scripts", "gen_framework.py")),
                        RunScript(os.path.join("scripts", "gen_android_mk.py")),
-               ])
+               ]),
+       ('gen-ext-deps', [
+                       RunScript(os.path.join("external", "vulkancts", "scripts", "gen_ext_deps.py"))
+               ]),
 ]
 
 LATE_SPECIAL_RECIPES   = [