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

Storage Support in AsBindGroup #6669

Closed
wants to merge 6 commits into from
Closed

Conversation

blaind
Copy link
Contributor

@blaind blaind commented Nov 17, 2022

Objective

Fixes #5499

Solution

  • Implement #[storage(..)] enum in AsBindGroup macro
  • Have an example with both read and write storage buffers

Changelog

Added

  • New #[storage(..)] enum in AsBindGroup macro

@james7132 james7132 added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Nov 17, 2022
@james7132
Copy link
Member

What's the difference between this PR and #6129?

@blaind
Copy link
Contributor Author

blaind commented Nov 17, 2022

What's the difference between this PR and #6129?

Didn't know about that before, wasn't linked to the issue #5499.

Seems like #6129 supports any type, and converts to a buffer internally (only at initialization time?). This one allows binding a Buffer, and updating that when needed.

@IceSentry
Copy link
Contributor

It wasn't linked because I didn't even know the issue existed 😅 I only created that PR because I was playing with storage buffers and didn't see a PR.

@IceSentry
Copy link
Contributor

Also, it doesn't support any type, it only works for types that implement ShaderType.

@james7132
Copy link
Member

With #6129 merged, I'm closing this PR. If the solution in that PR doesn't fit the needs here, either open a new PR or rebase this one to add the missing features required.

@james7132 james7132 closed this Jan 9, 2023
@IceSentry
Copy link
Contributor

Having the example from this PR would still be worth it. @blaind let me know if you want to open a separate PR or change this one with the example. Otherwise I'll open one with only the example.

@blaind
Copy link
Contributor Author

blaind commented Jan 12, 2023

This pull request supports a Buffer type, which allows flexibility. E.g. user can have a multi-gigabyte buffer and update only a small slice of that in a frame.

#6129 seems to have bevy-internal conversion, where the whole type is converted into a buffer on each update, and transferred from CPU to GPU at once.

The example in this one is not usable for #6129 I think

@blaind
Copy link
Contributor Author

blaind commented Jan 12, 2023

Can this one be reopened (I can't do it)? I'll rebase later to main later.

@IceSentry
Copy link
Contributor

For the example, I meant to have a similar example but updated to support #6129

If you see think both functionality can co-exist then that's even better

@IceSentry IceSentry reopened this Jan 12, 2023
bors bot pushed a commit that referenced this pull request Feb 22, 2023
# Objective

There was PR that introduced support for storage buffer is `AsBindGroup` macro [#6129](#6129), but it does not give more granular control over storage buffer, it will always copy all the data no matter which part of it was updated. There is also currently another open PR #6669 that tries to achieve exactly that, it is just not up to date and seems abandoned (Sorry if that is not right). In this PR I'm proposing a solution for both of these approaches to co-exist using `#[storage(n, buffer)]` and `#[storage(n)]` to distinguish between the cases.

We could also discuss in this PR if there is a need to extend this support to DynamicBuffers as well.
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
# Objective

There was PR that introduced support for storage buffer is `AsBindGroup` macro [bevyengine#6129](bevyengine#6129), but it does not give more granular control over storage buffer, it will always copy all the data no matter which part of it was updated. There is also currently another open PR bevyengine#6669 that tries to achieve exactly that, it is just not up to date and seems abandoned (Sorry if that is not right). In this PR I'm proposing a solution for both of these approaches to co-exist using `#[storage(n, buffer)]` and `#[storage(n)]` to distinguish between the cases.

We could also discuss in this PR if there is a need to extend this support to DynamicBuffers as well.
@alice-i-cecile
Copy link
Member

Added via #14663.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Storage Support in AsBindGroup
4 participants