FIRST_PARAM_BLACKLIST = {'VkInstance', 'VkPhysicalDevice'} FUNC_BLACKLIST = {'vkCreateInstance', 'vkDestroyInstance', 'vkGetDeviceProcAddr', 'vkDestroyDevice', 'vkEnumerateInstanceVersion', 'vkEnumerateInstanceLayerProperties', 'vkEnumerateInstanceExtensionProperties', 'vkCmdDrawMeshTasksEXT', 'vkCmdDrawMeshTasksIndirectEXT', 'vkCmdDrawMeshTasksIndirectCountEXT', 'vkGetDeviceGroupSurfacePresentModes2EXT', 'vkGetShaderModuleIdentifierEXT', 'vkGetShaderModuleCreateInfoIdentifierEXT'} # TODO: some of these could probably be handled better if I parsed the xml file correctly ... TYPE_BLACKLIST = {'VkPhysicalDeviceMeshShaderFeaturesEXT', 'VkPhysicalDeviceMeshShaderPropertiesEXT', 'VkSurfaceFullScreenExclusiveWin32InfoEXT', 'VkPhysicalDeviceLegacyDitheringFeaturesEXT', 'VkAndroidHardwareBufferFormatProperties2ANDROID', 'VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT', 'VkImageViewSampleWeightCreateInfoQCOM', 'VkPhysicalDeviceImageProcessingFeaturesQCOM', 'VkPhysicalDeviceImageProcessingPropertiesQCOM', 'VkPhysicalDeviceTilePropertiesFeaturesQCOM', 'VkTilePropertiesQCOM', 'VkPhysicalDeviceAmigoProfilingFeaturesSEC', 'VkAmigoProfilingSubmitInfoSEC', 'VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT', 'VkPhysicalDeviceDepthClampZeroOneFeaturesEXT', 'VkDrawMeshTasksIndirectCommandEXT'} def func_name_to_caps(name): assert(name[0:2] == "vk") caps = [name[2]] wasupper = True for char in name[3:]: if char.isupper(): if not wasupper: caps.append("_") wasupper = True else: wasupper = False caps.append(char.upper()) return "".join(caps) STRUCT_NAME_EXCEPTIONS = { 'VkPhysicalDeviceIDProperties': 'VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES' } def struct_name_to_enum(name): assert(name[0:2] == "Vk") exception = name in STRUCT_NAME_EXCEPTIONS if exception: return exception caps = ["VK_STRUCTURE_TYPE_", name[2]] wasupper = True wasnumeric = False for char in name[3:]: if char.isupper(): if not wasupper: caps.append("_") wasupper = True else: wasupper = False if char.isnumeric(): if not wasnumeric: caps.append("_") wasnumeric = True else: wasnumeric = False caps.append(char.upper()) return "".join(caps) def write_preamble(f, header_guard = None, includes = [], c_file = False): f.write(""" // This file has been automatically generated. Do NOT edit edit manually, all your changes will be lost when it is regenerated. """) if header_guard is not None: f.write(f""" #pragma once #if !defined({header_guard}) #define {header_guard} 1 """) for include in includes: f.write(f""" #include {include}""") if c_file: f.write(""" #if defined(__cplusplus) extern "C" { #endif """) else: f.write(""" namespace vk_capture { """) def write_epilogue(f, header_guard = None, c_file = False): if c_file: f.write(""" #if defined(__cplusplus) } // extern "C" #endif """) else: f.write(""" } // namespace vk_capture """) if header_guard is not None: f.write(f""" #endif // {header_guard} """)