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

Use Ash builders for Vulkan struct construction + refactor #2525

Merged
merged 7 commits into from
Oct 2, 2024

Conversation

Rua
Copy link
Contributor

@Rua Rua commented Apr 25, 2024

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
  • etc.

Mutable borrows are needed for the extension structs because push_next takes a mutable reference.

The DeviceFeatures and DeviceProperties construction have been left out of this, those need more attention that will be done in a separate PR.

@marc0246 marc0246 merged commit 9033311 into vulkano-rs:master Oct 2, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants