From 29fb03034ad154327f7c8f871fecb40050179a45 Mon Sep 17 00:00:00 2001 From: Máté Ferenc Nagy-Egri Date: Thu, 26 Sep 2024 13:53:05 +0200 Subject: Fix twocall_chain_vectors mechanism Instead of unconditionally querying properties twice, only call the query again if the given output struct has array members. Also fix the case where if there are no output structs with array properties (VulkanSC), then don't end up with unresolved external symbols. --- scripts/vulkaninfo_generator.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index 46125f98..e4cdd1e9 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -901,19 +901,10 @@ void setup_{listName}_chain({chain_details['holder_type']}& start, std::unique_p out += ' }\n' out += '}\n' - should_print_twocall_func = False - for s in structs_to_print: - if not s.hasLengthmember: - continue - if s.name in STRUCT_BLACKLIST: - continue - should_print_twocall_func = True - - if not should_print_twocall_func: - return out - out += '\n' - out += f'void prepare_{listName}_twocall_chain_vectors(std::unique_ptr<{listName}_chain>& chain) {{\n' + out += f'bool prepare_{listName}_twocall_chain_vectors(std::unique_ptr<{listName}_chain>& chain) {{\n' + out += ' (void)chain;\n' + is_twocall = False for s in structs_to_print: if not s.hasLengthmember: continue @@ -925,6 +916,8 @@ void setup_{listName}_chain({chain_details['holder_type']}& start, std::unique_p out += f' chain->{s.name}_{member.name}.resize(chain->{s.name[2:]}.{member.arrayLength});\n' out += f' chain->{s.name[2:]}.{member.name} = chain->{s.name}_{member.name}.data();\n' out += AddGuardFooter(s) + is_twocall = True + out += f' return {"true" if is_twocall else "false"};\n' out += '}\n' return out -- cgit v1.2.3