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

Add safe Subbuffer::reinterpret[_ref] methods #2201

Merged
merged 4 commits into from
May 6, 2023

Conversation

marc0246
Copy link
Contributor

@marc0246 marc0246 commented May 4, 2023

The functions Subbuffer::{try_cast, try_cast_slice, try_from_bytes} were modelled after bytemuck, but the issue is that since #2132 we have the ability to represent arbitrary unsized types in subbuffers, not just sized types and slices. So for instance there is currently no way to safely turn a subbuffer of bytes to a subbuffer of some custom DST. This PR addresses that by replacing those functions with just one Subbuffer::reinterpret[_ref] that works for any combination of types.

Changelog:

### Breaking changes
- The `Subbuffer::{try_cast, try_cast_slice, try_from_bytes}` functions were replaced by `Subbuffer::reinterpret[_ref]`.

@Rua Rua merged commit 3a9c8c8 into vulkano-rs:master May 6, 2023
Rua added a commit that referenced this pull request May 6, 2023
@marc0246 marc0246 deleted the subbuffer-reinterpret branch May 6, 2023 12:04
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
* Correct naming mistake

* Add `Subbuffer::reinterpret[_ref]`

* Remove old conversion functions

* Some fixes
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
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