From c4fdac59cea610d1227a8856f6e6e822daa3ec9e Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Fri, 17 Sep 2021 13:43:50 -0600 Subject: vulkaninf: Support 64 bit flags 64 bit flags use the bitvalues field instead of the requires field in the XML to specify the flagbits name. Thus the autogen needed to account for that. In addition, if a flag was promoted to core, the autogen didn't use the core version, this commit also fixes that. --- scripts/vulkaninfo_generator.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'scripts/vulkaninfo_generator.py') diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index fc4b145e..956dedce 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -288,7 +288,7 @@ class VulkanInfoGenerator(OutputGenerator): out += PrintBitMaskToString(bitmask, flag.name, self) for s in (x for x in self.all_structures if x.name in types_to_gen and x.name not in struct_blacklist): - out += PrintStructure(s, types_to_gen, names_of_structures_to_gen) + out += PrintStructure(s, types_to_gen, names_of_structures_to_gen, self.aliases) out += "pNextChainInfos get_chain_infos() {\n" out += " pNextChainInfos infos;\n" @@ -508,7 +508,7 @@ def PrintBitMaskToString(bitmask, name, gen): return out -def PrintStructure(struct, types_to_gen, structure_names): +def PrintStructure(struct, types_to_gen, structure_names, aliases): if len(struct.members) == 0: return "" out = '' @@ -587,12 +587,16 @@ def PrintStructure(struct, types_to_gen, structure_names): v.name + ", " + str(max_key_len) + ");\n" elif v.name not in ['sType', 'pNext']: # if it is an enum/flag/bitmask, add the calculated width - if v.typeID not in structure_names: - out += " Dump" + v.typeID + \ + type_name = v.typeID + for key, value in aliases.items(): + if type_name in value: + type_name = key + if type_name not in structure_names: + out += " Dump" + type_name + \ "(p, \"" + v.name + "\", obj." + \ v.name + ", " + str(max_key_len) + ");\n" else: - out += " Dump" + v.typeID + \ + out += " Dump" + type_name + \ "(p, \"" + v.name + "\", obj." + v.name + ");\n" if struct.name in ["VkPhysicalDeviceLimits", "VkPhysicalDeviceSparseProperties"]: out += " p.ObjectEnd();\n" @@ -837,6 +841,9 @@ class VulkanFlags: self.name = rootNode.get('name') self.type = rootNode.get('type') self.enum = rootNode.get('requires') + # 64 bit flags use bitvalues, not requires + if self.enum == None: + self.enum = rootNode.get('bitvalues') class VulkanVariable: -- cgit v1.2.3