bevy/crates/bevy_pbr/src
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
..
cluster Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
deferred Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
light Refactor and simplify custom projections (#17063) 2025-01-01 20:44:24 +00:00
light_probe Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
lightmap Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
meshlet Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
prepass Introduce two-level bins for multidrawable meshes. (#16898) 2025-01-06 18:34:40 +00:00
render Make the get function on InstanceInputUniformBuffer less error prone (#17131) 2025-01-06 19:15:19 +00:00
ssao Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
ssr Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
volumetric_fog Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
components.rs Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
extended_material.rs Make #[bindless] in ExtendedMaterial actually enable bindless mode. (#16818) 2024-12-15 19:18:58 +00:00
fog.rs Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
lib.rs Remove all deprecated code (#16338) 2025-01-05 20:33:39 +00:00
material_bind_groups.rs Remove tracing re-export from bevy_utils (#17161) 2025-01-05 23:06:34 +00:00
material.rs Introduce two-level bins for multidrawable meshes. (#16898) 2025-01-06 18:34:40 +00:00
mesh_material.rs Revert default mesh materials (#15930) 2024-10-15 19:47:40 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Fix depth_bias and build errors on less capable platforms (#17079) 2025-01-06 18:39:08 +00:00
wireframe.rs Revert "Have EntityCommands methods consume self for easier chaining" (#15523) 2024-10-02 12:47:26 +00:00