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

extensions: Remove read_into_defaulted_vector() to let caller pass pNext #966

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented Dec 2, 2024

Depends on #967

We've often discussed pNext chains in output arrays (i.e. #465, #588, #744), and I always wondered why read_into_defaulted_vector() still existed: turns out this helper function was only hiding a few more remaining cases where the caller was previously not able to manually extend the pNext chain to request arbitrary more structures to be filled with information.

Replace these remaining cases with a separate _len() getter, and have the main function take a caller-allocated &mut [T] slice where they can initialize the target struct including pNext pointer chains.

@MarijnS95
Copy link
Collaborator Author

MarijnS95 commented Dec 2, 2024

Still need to do some code archaeology why this didn't get fixed in the past. We seem to have discussed it in #465 yet this helper made it in anyway (on a struct that has pNext...) and future PRs followed to reuse it in other extensions...

As well as a changelog entry.

@MarijnS95
Copy link
Collaborator Author

Looks like the Rust 1.83 update finally hit us. I already started looking into omitting these lifetimes but it's "hard" because the builder pattern in the generator doesn't trivially know if it's going to be referencing one from the impl block, if i.e. we have a pNext chain without structextends referencing it for example. Let's see what can be done.

@MarijnS95 MarijnS95 changed the base branch from master to rust-1.83 December 3, 2024 14:13
@MarijnS95 MarijnS95 marked this pull request as ready for review December 3, 2024 14:13
@MarijnS95 MarijnS95 added this to the Ash 0.39 with Vulkan 1.4 milestone Dec 3, 2024
Base automatically changed from rust-1.83 to master December 3, 2024 23:41
…`pNext`

We've often discussed `pNext` chains in output arrays (i.e. #465, #588,
 #744), and I always wondered why `read_into_defaulted_vector()` still
existed: turns out this helper function was only hiding a few more
remaining cases where the caller was previously _not_ able to manually
extend the `pNext` chain to request arbitrary more structures to be
filled with information.

Replace these remaining cases with a separate `_len()` getter, and have
the main function take a caller-allocated `&mut [T]` slice where they
can initialize the target struct including `pNext` pointer chains.
@MarijnS95 MarijnS95 merged commit 7dcf57b into master Dec 4, 2024
20 checks passed
@MarijnS95 MarijnS95 deleted the pnext-in-arrays branch December 4, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants