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: Only call assume_init() when Vulkan returns SUCCESS #669

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

MarijnS95
Copy link
Collaborator

@MarijnS95 MarijnS95 commented Oct 13, 2022

It is undefined behaviour to construct a safe object by calling MaybeUninit::assume_init() when the object in question hasn't been initialized by anything (in this case the underlying Vulkan call) at all, even if the object is never "used". Postpone the assume_init() call until after checking if vk::Result::SUCCESS has been returned by the native implementation, by introducing a new assume_init_on_success() helper that takes a MaybeUninit<T>.

ash/src/prelude.rs Outdated Show resolved Hide resolved
ash/src/prelude.rs Outdated Show resolved Hide resolved
It is undefined behaviour to construct a safe object by calling
`MaybeUninit::assume_init()` when the object in question hasn't been
initialized by anything (in this case the underlying Vulkan call) at
all, even if the object is never "used".  Postpone the `assume_init()`
call until after checking if `vk::Result::SUCCESS` has been returned by
the native implementation, by introducing a new
`assume_init_on_success()` helper that takes a `MaybeUninit<T>`.
@MarijnS95 MarijnS95 merged commit eb682d4 into master Oct 14, 2022
@MarijnS95 MarijnS95 deleted the on-success branch October 14, 2022 18:27
MarijnS95 added a commit that referenced this pull request Oct 16, 2022
…669)

It is undefined behaviour to construct a safe object by calling
`MaybeUninit::assume_init()` when the object in question hasn't been
initialized by anything (in this case the underlying Vulkan call) at
all, even if the object is never "used".  Postpone the `assume_init()`
call until after checking if `vk::Result::SUCCESS` has been returned by
the native implementation, by introducing a new
`assume_init_on_success()` helper that takes a `MaybeUninit<T>`.
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.

None yet

2 participants