From 7ee099356c24db66247b617467e759da539de16b Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 29 Nov 2021 17:16:24 -0700 Subject: 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. --- scripts/vulkaninfo_generator.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'scripts') 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" -- cgit v1.2.3