Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix twocall_chain_vectors mechanism #1031

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions scripts/vulkaninfo_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,19 +901,10 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
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
Expand All @@ -925,6 +916,8 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp
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
Expand Down
29 changes: 28 additions & 1 deletion vulkaninfo/generated/vulkaninfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4061,13 +4061,15 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp
}
}

void prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr<phys_device_props2_chain>& chain) {
bool prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr<phys_device_props2_chain>& chain) {
(void)chain;
chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopySrcLayouts.resize(chain->PhysicalDeviceHostImageCopyPropertiesEXT.copySrcLayoutCount);
chain->PhysicalDeviceHostImageCopyPropertiesEXT.pCopySrcLayouts = chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopySrcLayouts.data();
chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopyDstLayouts.resize(chain->PhysicalDeviceHostImageCopyPropertiesEXT.copyDstLayoutCount);
chain->PhysicalDeviceHostImageCopyPropertiesEXT.pCopyDstLayouts = chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopyDstLayouts.data();
chain->VkPhysicalDeviceLayeredApiPropertiesListKHR_pLayeredApis.resize(chain->PhysicalDeviceLayeredApiPropertiesListKHR.layeredApiCount);
chain->PhysicalDeviceLayeredApiPropertiesListKHR.pLayeredApis = chain->VkPhysicalDeviceLayeredApiPropertiesListKHR_pLayeredApis.data();
return true;
}
struct phys_device_mem_props2_chain {
phys_device_mem_props2_chain() = default;
Expand Down Expand Up @@ -4096,6 +4098,11 @@ void setup_phys_device_mem_props2_chain(VkPhysicalDeviceMemoryProperties2& start
chain->initialize_chain(gpu);
start.pNext = chain->start_of_chain;
};

bool prepare_phys_device_mem_props2_twocall_chain_vectors(std::unique_ptr<phys_device_mem_props2_chain>& chain) {
(void)chain;
return false;
}
struct phys_device_features2_chain {
phys_device_features2_chain() = default;
phys_device_features2_chain(const phys_device_features2_chain &) = delete;
Expand Down Expand Up @@ -5408,6 +5415,11 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, bool show_pro
place = structure->pNext;
}
}

bool prepare_phys_device_features2_twocall_chain_vectors(std::unique_ptr<phys_device_features2_chain>& chain) {
(void)chain;
return false;
}
struct surface_capabilities2_chain {
surface_capabilities2_chain() = default;
surface_capabilities2_chain(const surface_capabilities2_chain &) = delete;
Expand Down Expand Up @@ -5474,6 +5486,11 @@ void chain_iterator_surface_capabilities2(Printer &p, AppInstance &inst, AppGpu
place = structure->pNext;
}
}

bool prepare_surface_capabilities2_twocall_chain_vectors(std::unique_ptr<surface_capabilities2_chain>& chain) {
(void)chain;
return false;
}
struct format_properties2_chain {
format_properties2_chain() = default;
format_properties2_chain(const format_properties2_chain &) = delete;
Expand Down Expand Up @@ -5524,6 +5541,11 @@ void chain_iterator_format_properties2(Printer &p, AppGpu &gpu, void * place) {
place = structure->pNext;
}
}

bool prepare_format_properties2_twocall_chain_vectors(std::unique_ptr<format_properties2_chain>& chain) {
(void)chain;
return false;
}
struct queue_properties2_chain {
queue_properties2_chain() = default;
queue_properties2_chain(const queue_properties2_chain &) = delete;
Expand Down Expand Up @@ -5583,6 +5605,11 @@ void chain_iterator_queue_properties2(Printer &p, AppGpu &gpu, void * place) {
place = structure->pNext;
}
}

bool prepare_queue_properties2_twocall_chain_vectors(std::unique_ptr<queue_properties2_chain>& chain) {
(void)chain;
return false;
}
bool operator==(const VkExtent2D & a, const VkExtent2D b);
bool operator==(const VkSurfaceCapabilities2EXT & a, const VkSurfaceCapabilities2EXT b);
bool operator==(const VkSurfaceCapabilities2KHR & a, const VkSurfaceCapabilities2KHR b);
Expand Down
2 changes: 1 addition & 1 deletion vulkaninfo/vulkaninfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void setup_surface_capabilities2_chain(VkSurfaceCapabilities2KHR &start, std::un
void setup_format_properties2_chain(VkFormatProperties2 &start, std::unique_ptr<format_properties2_chain> &chain, AppGpu &gpu);
void setup_queue_properties2_chain(VkQueueFamilyProperties2 &start, std::unique_ptr<queue_properties2_chain> &chain, AppGpu &gpu);

void prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr<phys_device_props2_chain> &chain);
bool prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr<phys_device_props2_chain> &chain);

/* An ptional contains either a value or nothing. The optional asserts if a value is trying to be gotten but none exist.
* The interface is taken from C++17's <optional> with many aspects removed.
Expand Down
Loading