-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Remove unnecesssary values Vec from DynamicUniformBuffer and DynamicStorageBuffer #8299
Remove unnecesssary values Vec from DynamicUniformBuffer and DynamicStorageBuffer #8299
Conversation
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it doesn’t break anything, and I’m sure we’d find out quickly. :) Wondering how this was missed previously. I imagine I was involved in the missing it.
# Objective While working on #8299, I noticed that we're using a `capacity` field, even though `wgpu::Buffer` exposes a `size` accessor that does the same thing. ## Solution Remove it from all buffer wrappers. Use `wgpu::Buffer::size` instead. Default to 0 if no buffer has been allocated yet.
Objective
Fixes #8284.
values
is being pushed to separately from the actual scratch buffer inDynamicUniformBuffer::push
andDynamicStorageBuffer::push
. In both types,values
is really only used to track the number of elements being added to the buffer, yet is causing extra allocations, size increments and excess copies.Solution
Remove it and its remaining uses. Replace it with accesses to
scratch
instead.I removed the
len
accessor, as it may be non-trivial to compute just fromscratch
. If this is still desirable to have, we can keep alen
member field to track it instead of relying onscratch
.