from common import write_epilogue, write_preamble, FUNC_BLACKLIST HEADER_GUARD = 'VK_CAPTURE_FUNCTIONS_HPP_INCLUDED' def write_funcsig(f, cmd): if 'alias' in cmd or cmd["name"] in FUNC_BLACKLIST: return if len(cmd['params']) > 0 and cmd['params'][0]['type'] in ('VkInstance', 'VkPhysicalDevice'): return f.write(f"""{cmd["return_type"]} {cmd["name"]}(""") f.write(", ".join([f"""{p['type']} {p['name']}{p['name_type_suffix']}""" for p in cmd['params']])) f.write(");\n") def generate(targets): assert(len(targets) == 1) with open(targets[0], 'w') as f: write_preamble(f, header_guard=HEADER_GUARD, includes = ['']) # commands = list(vulkan_hpp['commands'].values()) # commands.sort(key=lambda cmd: cmd['platform']) # plat = '' # for cmd in commands: # if plat != cmd['platform']: # if plat != '': # f.write(f"""#endif // defined({vulkan_hpp['platforms'][plat]['protect']})\n""") # plat = cmd['platform'] # f.write(f"""#if defined({vulkan_hpp['platforms'][plat]['protect']})\n""") # write_funcsig(f, cmd) # # finish the final platform # f.write(f"""#endif // defined({vulkan_hpp['platforms'][plat]['protect']})\n""") write_epilogue(f, header_guard=HEADER_GUARD)