diff options
author | 2024-06-12 12:06:28 +1200 | |
---|---|---|
committer | 2024-06-25 09:53:15 +0000 | |
commit | 9d84eae592f9760b1985e628a59dc40a424717b4 (patch) | |
tree | 08b6ae1a8614bc5f9562a7856f39fcea8bfee426 | |
parent | 6557491ca6b2f80cd3d8e0b820232b6067b6917d (diff) |
Unbitrot libvulkan's code generator
The generator py scripts were broken when VKSC was released. Fix them
and submit the updated autogenerated code.
Bug: b/346650750
Flag: EXEMPT bugfix
Test: ran the script after fixes
Change-Id: I44352b052e5d018b91b327f1c8b3763146ed8fbe
-rw-r--r-- | vulkan/libvulkan/api_gen.cpp | 11 | ||||
-rw-r--r-- | vulkan/scripts/generator_common.py | 89 | ||||
-rw-r--r-- | vulkan/scripts/null_generator.py | 2 |
3 files changed, 64 insertions, 38 deletions
diff --git a/vulkan/libvulkan/api_gen.cpp b/vulkan/libvulkan/api_gen.cpp index a9706bc871..a3fe33e67e 100644 --- a/vulkan/libvulkan/api_gen.cpp +++ b/vulkan/libvulkan/api_gen.cpp @@ -178,7 +178,7 @@ bool InitDispatchTable( INIT_PROC(false, instance, GetPhysicalDeviceExternalSemaphoreProperties); INIT_PROC(false, instance, GetPhysicalDeviceExternalFenceProperties); INIT_PROC(false, instance, EnumeratePhysicalDeviceGroups); - INIT_PROC_EXT(KHR_swapchain, false, instance, GetPhysicalDevicePresentRectanglesKHR); + INIT_PROC_EXT(KHR_swapchain, true, instance, GetPhysicalDevicePresentRectanglesKHR); INIT_PROC(false, instance, GetPhysicalDeviceToolProperties); // clang-format on @@ -325,9 +325,9 @@ bool InitDispatchTable( INIT_PROC(false, dev, BindBufferMemory2); INIT_PROC(false, dev, BindImageMemory2); INIT_PROC(false, dev, CmdSetDeviceMask); - INIT_PROC_EXT(KHR_swapchain, false, dev, GetDeviceGroupPresentCapabilitiesKHR); - INIT_PROC_EXT(KHR_swapchain, false, dev, GetDeviceGroupSurfacePresentModesKHR); - INIT_PROC_EXT(KHR_swapchain, false, dev, AcquireNextImage2KHR); + INIT_PROC_EXT(KHR_swapchain, true, dev, GetDeviceGroupPresentCapabilitiesKHR); + INIT_PROC_EXT(KHR_swapchain, true, dev, GetDeviceGroupSurfacePresentModesKHR); + INIT_PROC_EXT(KHR_swapchain, true, dev, AcquireNextImage2KHR); INIT_PROC(false, dev, CmdDispatchBase); INIT_PROC(false, dev, CreateDescriptorUpdateTemplate); INIT_PROC(false, dev, DestroyDescriptorUpdateTemplate); @@ -659,6 +659,8 @@ VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pNa "vkGetDrmDisplayEXT", "vkGetInstanceProcAddr", "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT", + "vkGetPhysicalDeviceCalibrateableTimeDomainsKHR", + "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR", "vkGetPhysicalDeviceDisplayPlaneProperties2KHR", "vkGetPhysicalDeviceDisplayProperties2KHR", "vkGetPhysicalDeviceExternalBufferProperties", @@ -703,6 +705,7 @@ VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pNa "vkGetPhysicalDeviceToolProperties", "vkGetPhysicalDeviceToolPropertiesEXT", "vkGetPhysicalDeviceVideoCapabilitiesKHR", + "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR", "vkGetPhysicalDeviceVideoFormatPropertiesKHR", "vkSubmitDebugUtilsMessageEXT", }; diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py index 866c1b7b75..6b4cbad2e2 100644 --- a/vulkan/scripts/generator_common.py +++ b/vulkan/scripts/generator_common.py @@ -351,9 +351,50 @@ def parse_vulkan_registry(): 'external', 'vulkan-headers', 'registry', 'vk.xml') tree = element_tree.parse(registry) root = tree.getroot() + + for exts in root.iter('extensions'): + for extension in exts.iter('extension'): + if 'vulkan' not in extension.get('supported').split(','): + # ANDROID_native_buffer is a weird special case -- it's declared in vk.xml as + # disabled but we _do_ want to generate plumbing for it in the Android loader. + if extension.get('name') != 'VK_ANDROID_native_buffer': + print('skip extension disabled or not for vulkan: ' + extension.get('name')) + continue + + apiversion = 'VK_VERSION_1_0' + if extension.tag == 'extension': + extname = extension.get('name') + if (extension.get('type') == 'instance' and + extension.get('promotedto') is not None): + promoted_inst_ext_dict[extname] = \ + version_2_api_version(extension.get('promotedto')) + for req in extension.iter('require'): + if req.get('feature') is not None: + apiversion = req.get('feature') + for commands in req: + if commands.tag == 'command': + cmd_name = commands.get('name') + if cmd_name not in extension_dict: + extension_dict[cmd_name] = extname + version_dict[cmd_name] = apiversion + + for feature in root.iter('feature'): + if 'vulkan' not in feature.get('api').split(','): + continue + + apiversion = feature.get('name') + for req in feature.iter('require'): + for command in req: + if command.tag == 'command': + cmd_name = command.get('name') + version_dict[cmd_name] = apiversion + for commands in root.iter('commands'): for command in commands: if command.tag == 'command': + if command.get('api') == 'vulkansc': + continue + parameter_list = [] protoset = False cmd_name = '' @@ -361,12 +402,18 @@ def parse_vulkan_registry(): if command.get('alias') is not None: alias = command.get('alias') cmd_name = command.get('name') - alias_dict[cmd_name] = alias - command_list.append(cmd_name) - param_dict[cmd_name] = param_dict[alias].copy() - return_type_dict[cmd_name] = return_type_dict[alias] + # At this stage all valid commands have been added to the version + # dict so we can use it to filter valid commands + if cmd_name in version_dict: + alias_dict[cmd_name] = alias + command_list.append(cmd_name) + param_dict[cmd_name] = param_dict[alias].copy() + return_type_dict[cmd_name] = return_type_dict[alias] for params in command: if params.tag == 'param': + if params.get('api') == 'vulkansc': + # skip SC-only param variant + continue param_type = '' if params.text is not None and params.text.strip(): param_type = params.text.strip() + ' ' @@ -387,39 +434,13 @@ def parse_vulkan_registry(): cmd_type = c.text if c.tag == 'name': cmd_name = c.text - protoset = True - command_list.append(cmd_name) - return_type_dict[cmd_name] = cmd_type + if cmd_name in version_dict: + protoset = True + command_list.append(cmd_name) + return_type_dict[cmd_name] = cmd_type if protoset: param_dict[cmd_name] = parameter_list.copy() - for exts in root.iter('extensions'): - for extension in exts: - apiversion = 'VK_VERSION_1_0' - if extension.tag == 'extension': - extname = extension.get('name') - if (extension.get('type') == 'instance' and - extension.get('promotedto') is not None): - promoted_inst_ext_dict[extname] = \ - version_2_api_version(extension.get('promotedto')) - for req in extension: - if req.get('feature') is not None: - apiversion = req.get('feature') - for commands in req: - if commands.tag == 'command': - cmd_name = commands.get('name') - if cmd_name not in extension_dict: - extension_dict[cmd_name] = extname - version_dict[cmd_name] = apiversion - - for feature in root.iter('feature'): - apiversion = feature.get('name') - for req in feature: - for command in req: - if command.tag == 'command': - cmd_name = command.get('name') - if cmd_name in command_list: - version_dict[cmd_name] = apiversion version_code_set = set() for version in version_dict.values(): diff --git a/vulkan/scripts/null_generator.py b/vulkan/scripts/null_generator.py index e9faef663b..3624c1d032 100644 --- a/vulkan/scripts/null_generator.py +++ b/vulkan/scripts/null_generator.py @@ -89,6 +89,8 @@ def gen_cpp(): f.write(gencom.copyright_and_warning(2015)) f.write("""\ +#include <android/hardware_buffer.h> + #include <algorithm> #include "null_driver_gen.h" |