-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Make the get
function on InstanceInputUniformBuffer
less error prone
#17131
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
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
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? |
…one (bevyengine#17131) # Objective the `get` function on [`InstanceInputUniformBuffer`] seems very error-prone. This PR hopes to fix this. ## Solution Do a few checks to ensure the index is in bounds and that the `BDI` is not removed. Return `Option<BDI>` instead of `BDI`. ## Testing - Did you test these changes? If so, how? added a test to verify that the instance buffer works correctly ## Future Work Performance decreases when using .binary_search(). However this is likely due to the fact that [`InstanceInputUniformBuffer::get`] for now is never used, and only get_unchecked. ## Migration Guide `InstanceInputUniformBuffer::get` now returns `Option<BDI>` instead of `BDI` to reduce panics. If you require the old functionality of `InstanceInputUniformBuffer::get` consider using `InstanceInputUniformBuffer::get_unchecked`. --------- Co-authored-by: Tim Overbeek <oorbeck@gmail.com>
Objective
the
get
function on [InstanceInputUniformBuffer
] seems very error-prone. This PR hopes to fix this.Solution
Do a few checks to ensure the index is in bounds and that the
BDI
is not removed.Return
Option<BDI>
instead ofBDI
.Testing
added a test to verify that the instance buffer works correctly
Future Work
Performance decreases when using .binary_search(). However this is likely due to the fact that [
InstanceInputUniformBuffer::get
] for now is never used, and only get_unchecked.Migration Guide
InstanceInputUniformBuffer::get
now returnsOption<BDI>
instead ofBDI
to reduce panics. If you require the old functionality ofInstanceInputUniformBuffer::get
consider usingInstanceInputUniformBuffer::get_unchecked
.