Use Ash builders for Vulkan struct construction + refactor #2525
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Ash builder methods are now used instead of raw pointers, so that lifetimes are correctly tracked. This did, however, need some significant refactoring because of how borrowing rules work. For that reason, I moved all Ash struct construction into the structs themselves (as methods). The methods and structs follow a tiered logic where each value borrows from those below it:
to_vk
->ash::vk::FooCreateInfo
to_vk_extensions
->mut FooCreateInfoExtensionsVk
to_vk_fields1
->FooCreateInfoFields1Vk
to_vk_fields1_extensions
->mut FooCreateInfoFields1ExtensionsVk
to_vk_fields2
->FooCreateInfoFields2Vk
to_vk_fields2_extensions
->mut FooCreateInfoFields2ExtensionsVk
to_vk_fields3
->FooCreateInfoFields3Vk
Mutable borrows are needed for the extension structs because
push_next
takes a mutable reference.The
DeviceFeatures
andDeviceProperties
construction have been left out of this, those need more attention that will be done in a separate PR.