diff options
| author | Charles Giessen <charles@lunarg.com> | 2021-11-29 17:16:24 -0700 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2022-02-02 16:22:12 -0700 |
| commit | 7ee099356c24db66247b617467e759da539de16b (patch) | |
| tree | 1882e95e05acedea08d0277da6401a8d8c220126 /scripts | |
| parent | fedc8b7faf7bd3018b5d3375c9b4783151398d4f (diff) | |
| download | usermoji-7ee099356c24db66247b617467e759da539de16b.tar.xz | |
vulkaninfo: Chain printers use correct version
Previously the version used was up to the caller of the chain printer function
to provide, but this was unnecessary as the printer should always use the
version of the type (instance or gpu) of printer in question. If both are
specified, it uses the gpu version since that implies physical_device functions.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/vulkaninfo_generator.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index f698f736..9e5bbddb 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -649,21 +649,26 @@ def PrintChainStruct(listName, structures, all_structures, chain_details): return out -def PrintChainIterator(listName, structures, all_structures, checkExtLoc, extTypes, aliases, versions): +def PrintChainIterator(listName, structures, all_structures, checkExtLoc, extTypes, aliases, vulkan_versions): out = '' out += f"void chain_iterator_{listName}(Printer &p, " - if checkExtLoc == "device": - out += f"AppGpu &gpu" - elif checkExtLoc == "instance": - out += f"AppInstance &inst" - elif checkExtLoc == "both": - out += f"AppInstance &inst, AppGpu &gpu" - out += f", void * place, VulkanVersion version) {{\n" + if checkExtLoc in ["instance", "both"]: + out += f"AppInstance &inst, " + if checkExtLoc in ["device", "both"]: + out += f"AppGpu &gpu, " + out += f"void * place) {{\n" out += f" while (place) {{\n" out += f" struct VkBaseOutStructure *structure = (struct VkBaseOutStructure *)place;\n" out += f" p.SetSubHeader();\n" sorted_structures = sorted( all_structures, key=operator.attrgetter('name')) + + version_desc = '' + if checkExtLoc in ["device", "both"]: + version_desc = "gpu.api_version" + else: + version_desc = "inst.instance_version" + for s in sorted_structures: if s.sTypeName is None: continue @@ -679,7 +684,7 @@ def PrintChainIterator(listName, structures, all_structures, checkExtLoc, extTyp break version = None oldVersionName = None - for v in versions: + for v in vulkan_versions: if s.name in v.names: version = v.minorVersion if s.name in aliases.keys(): @@ -702,13 +707,13 @@ def PrintChainIterator(listName, structures, all_structures, checkExtLoc, extTyp if has_version and extType is not None: out += f" ||\n " if has_version: - out += f"version.minor >= {str(version)}" + out += f"{version_desc}.minor >= {str(version)}" out += f")" out += f") {{\n" out += f" {s.name}* props = ({s.name}*)structure;\n" out += f" Dump{s.name}(p, " if s.name in aliases.keys() and version is not None: - out += f"version.minor >= {version} ?\"{s.name}\":\"{oldVersionName}\"" + out += f"{version_desc}.minor >= {version} ?\"{s.name}\":\"{oldVersionName}\"" else: out += f"\"{s.name}\"" out += f", *props);\n" |
