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

Improve DeviceLayout convenience #2599

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

marc0246
Copy link
Contributor

@marc0246 marc0246 commented Nov 2, 2024

This greatly improves ergonomics of working with DeviceLayout, which is important considering I would like DeviceLayout to be the one shared way of specifying a layout for all allocation, like buffers and suballocations thereof. DeviceLayout::repeat et al. taking NonZeroDeviceSize was a mistake as that adds way too much boilerplate for little benefit. The added constructors bring us with line with std's Layout such that users don't have to import and create a Layout just to create a DeviceLayout.

Changelog:

### Breaking changes
Changes to memory allocation:
- `DeviceLayout::repeat` and `BufferContentsLayout::layout_for_len` now take `DeviceSize` as argument.
- `DeviceLayout::{from_layout,into_layout}` return an `Option` now.

### Additions
- Added `DeviceLayout::{new_sized,new_unsized,for_value}` for improved ergonomics when (sub)allocating buffers.
- Added `DeviceAlignment::of_val`.

@Rua Rua merged commit a52e327 into vulkano-rs:master Nov 4, 2024
6 checks passed
Rua added a commit that referenced this pull request Nov 4, 2024
@marc0246 marc0246 deleted the device-layout-convenience branch November 4, 2024 19:53
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