bevy/crates
Tim Overbeek 1162e03cec
Make the get function on InstanceInputUniformBuffer less error prone (#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>
2025-01-06 19:15:19 +00:00
..
bevy_a11y Update all previously-merged #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] attributes to include a reason field pointing to the tracking issue (#17136) 2025-01-06 05:40:08 +00:00
bevy_animation Update all previously-merged #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] attributes to include a reason field pointing to the tracking issue (#17136) 2025-01-06 05:40:08 +00:00
bevy_app Fix depth_bias and build errors on less capable platforms (#17079) 2025-01-06 18:39:08 +00:00
bevy_asset Disallow requesting write resource access in Queries (#17116) 2025-01-06 19:04:26 +00:00
bevy_audio bevy_audio: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] (#17119) 2025-01-06 19:09:08 +00:00
bevy_color Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_core_pipeline Anamorphic Bloom (#17096) 2025-01-06 18:43:21 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Fix depth_bias and build errors on less capable platforms (#17079) 2025-01-06 18:39:08 +00:00
bevy_diagnostic Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dylib Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_ecs Disallow requesting write resource access in Queries (#17116) 2025-01-06 19:04:26 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gizmos Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gltf Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_hierarchy Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_image Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_input Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_input_focus Add basic directional (gamepad) navigation for UI (and non-UI) (#17102) 2025-01-06 18:51:44 +00:00
bevy_internal Fix depth_bias and build errors on less capable platforms (#17079) 2025-01-06 18:39:08 +00:00
bevy_log Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_macro_utils Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_math Add basic directional (gamepad) navigation for UI (and non-UI) (#17102) 2025-01-06 18:51:44 +00:00
bevy_mesh Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_mikktspace Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_pbr Make the get function on InstanceInputUniformBuffer less error prone (#17131) 2025-01-06 19:15:19 +00:00
bevy_picking Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_ptr Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_reflect Fix depth_bias and build errors on less capable platforms (#17079) 2025-01-06 18:39:08 +00:00
bevy_remote Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_render Make the get function on InstanceInputUniformBuffer less error prone (#17131) 2025-01-06 19:15:19 +00:00
bevy_scene Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_sprite Introduce two-level bins for multidrawable meshes. (#16898) 2025-01-06 18:34:40 +00:00
bevy_state Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_tasks Update all previously-merged #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)] attributes to include a reason field pointing to the tracking issue (#17136) 2025-01-06 05:40:08 +00:00
bevy_text Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_time Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_transform Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_ui More DefaultUiCamera fixes (#17120) 2025-01-06 19:11:04 +00:00
bevy_utils Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_window Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_winit Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00