| 37 | generators = {} |
| 38 | |
| 39 | def RunGenerators(api: str, registry: str, video_registry: str, directory: str, styleFile: str, targetFilter: str, flatOutput: bool): |
| 40 | |
| 41 | try: |
| 42 | common_codegen.RunShellCmd(f'clang-format --version') |
| 43 | has_clang_format = True |
| 44 | except: |
| 45 | has_clang_format = False |
| 46 | if not has_clang_format: |
| 47 | print("WARNING: Unable to find clang-format!") |
| 48 | |
| 49 | # These live in the Vulkan-Docs repo, but are pulled in via the |
| 50 | # Vulkan-Headers/registry folder |
| 51 | # At runtime we inject python path to find these helper scripts |
| 52 | scripts = os.path.dirname(registry) |
| 53 | scripts_directory_path = os.path.dirname(os.path.abspath(__file__)) |
| 54 | registry_headers_path = os.path.join(scripts_directory_path, scripts) |
| 55 | sys.path.insert(0, registry_headers_path) |
| 56 | try: |
| 57 | from reg import Registry |
| 58 | except: |
| 59 | print("ModuleNotFoundError: No module named 'reg'") # normal python error message |
| 60 | print(f'{registry_headers_path} is not pointing to the Vulkan-Headers registry directory.') |
| 61 | print("Inside Vulkan-Headers there is a registry/reg.py file that is used.") |
| 62 | sys.exit(1) # Return without call stack so easy to spot error |
| 63 | |
| 64 | from base_generator import BaseGeneratorOptions |
| 65 | from generators.mock_icd_generator import MockICDOutputGenerator |
| 66 | from generators.vulkan_tools_helper_file_generator import HelperFileOutputGenerator |
| 67 | from generators.vulkaninfo_generator import VulkanInfoGenerator |
| 68 | |
| 69 | # These set fields that are needed by both OutputGenerator and BaseGenerator, |
| 70 | # but are uniform and don't need to be set at a per-generated file level |
| 71 | from base_generator import (SetTargetApiName, SetMergedApiNames) |
| 72 | SetTargetApiName(api) |
| 73 | |
| 74 | # Generated directory and dispatch table helper file name may be API specific (e.g. Vulkan SC) |
| 75 | mock_icd_generated_directory = 'icd/generated' |
| 76 | vulkaninfo_generated_directory = 'vulkaninfo/generated' |
| 77 | |
| 78 | generators.update({ |
| 79 | 'vk_typemap_helper.h': { |
| 80 | 'generator' : HelperFileOutputGenerator, |
| 81 | 'genCombined': False, |
| 82 | 'directory' : mock_icd_generated_directory, |
| 83 | }, |
| 84 | 'function_declarations.h': { |
| 85 | 'generator' : MockICDOutputGenerator, |
| 86 | 'genCombined': False, |
| 87 | 'directory' : mock_icd_generated_directory, |
| 88 | }, |
| 89 | 'function_definitions.h': { |
| 90 | 'generator' : MockICDOutputGenerator, |
| 91 | 'genCombined': False, |
| 92 | 'directory' : mock_icd_generated_directory, |
| 93 | }, |
| 94 | 'vulkaninfo.hpp': { |
| 95 | 'generator' : VulkanInfoGenerator, |
| 96 | 'genCombined': False, |