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

Buffer and image uploads take a command buffer instead of making one #2030

Merged
merged 1 commit into from
Oct 8, 2022

Conversation

Rua
Copy link
Contributor

@Rua Rua commented Oct 7, 2022

Changelog:

Remove this line (and remove the bullet from the previous one to merge it into the line above):

- `DeviceLocalBuffer::{from_buffer, from_data, from_iter}` and `ImmutableImage::{from_iter, from_buffer}` now take an implementation of `CommandBufferAllocator`.

Add:

### Breaking changes
Changes to buffer and image uploads:
- `DeviceLocalBuffer::{from_buffer, from_data, from_iter}` and `ImmutableImage::{from_iter, from_buffer}` now take a mutable reference to an `AutoCommandBufferBuilder` instead of a queue, and no longer return a future. The upload command will be recorded into the provided command buffer, which should be executed later.

Creating a new command buffer builder, recording a single copy command onto it, and then building and submitting a single queue command with just the one tiny command buffer is not very efficient. If a lot of things are uploaded, this can also lead to stack overflows when you try to flush this giant pile of futures all at once, as discovered on Discord. With these changes, the user has the freedom to manage this a bit better themselves, and they can group all uploads into a single command buffer if they wish.

Copy link
Member

@AustinJ235 AustinJ235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@AustinJ235 AustinJ235 merged commit df26f81 into vulkano-rs:master Oct 8, 2022
AustinJ235 added a commit that referenced this pull request Oct 8, 2022
Rua added a commit to Rua/vulkano that referenced this pull request Oct 9, 2022
AustinJ235 pushed a commit that referenced this pull request Oct 12, 2022
@Rua Rua deleted the upload-cb branch December 6, 2022 11:23
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