bevy/crates
vero 6465e3bd9f
Fix Mesh allocator bug and reduce Mesh data copies by two (#15566)
# Objective

- First step towards #15558

## Solution

- Rename `get_vertex_buffer_data` to `create_packed_vertex_buffer_data`
to make it clear that it is not "free" and actually allocates
- Compute length analytically for preallocation instead of creating the
buffer to get its length and immediately discard it
- Use existing vertex attribute size calculation method to reduce code
duplication
- Fix a bug where mesh index data was being replaced by unnecessarily
newly created mesh vertex data in some cases
- Overall reduces mesh copies by two. We still have plenty to go, but
these were the easy ones.

## Testing

- I ran 3d_scene, lighting, and many_cubes, they look fine.
- Benchmarks would be nice, but this is very obviously a win in perf and
correctness.

---

## Migration Guide

- `Mesh::create_packed_vertex_buffer_data` has been renamed
`Mesh::create_packed_vertex_buffer_data` to reflect the fact that it
copies data and allocates.

## Showcase

- look mom, less copies
2024-10-01 17:15:57 +00:00
..
bevy_a11y Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_animation Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
bevy_app Runtime required components (#15458) 2024-09-30 19:20:16 +00:00
bevy_asset bevy_asset: Improve NestedLoader API (#15509) 2024-10-01 14:14:04 +00:00
bevy_audio Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
bevy_color Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_core Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_core_pipeline The Cooler 'Retain Rendering World' (#15320) 2024-09-30 18:51:43 +00:00
bevy_derive Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_dev_tools Simplified ui_stack_system (#9889) 2024-09-30 18:43:57 +00:00
bevy_diagnostic Runtime required components (#15458) 2024-09-30 19:20:16 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs 15540 Make World::flush_commands private (#15553) 2024-09-30 22:07:09 +00:00
bevy_encase_derive Update `glam to 0.29, encase` to 0.10. (#15249) 2024-09-23 19:44:02 +00:00
bevy_gilrs Implement gamepads as entities (#12770) 2024-09-27 20:07:20 +00:00
bevy_gizmos The Cooler 'Retain Rendering World' (#15320) 2024-09-30 18:51:43 +00:00
bevy_gltf Migrate lights to required components (#15554) 2024-10-01 03:20:43 +00:00
bevy_hierarchy Add VisitEntities for generic and reflectable Entity iteration (#15425) 2024-09-30 17:32:03 +00:00
bevy_input Fix window spawning triggering ButtonInput<KeyCode>::just_pressed/just_released (#12372) 2024-09-30 18:24:36 +00:00
bevy_internal Split TextureAtlasSources out of TextureAtlasLayout and make TextureAtlasLayout serializable (#15344) 2024-09-30 17:11:56 +00:00
bevy_log Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_macro_utils Modify derive_label to support no_std environments (#15465) 2024-09-27 20:23:26 +00:00
bevy_math Curve-based animation (#15434) 2024-09-30 19:56:55 +00:00
bevy_mikktspace Add no_std support to bevy_mikktspace (#15528) 2024-09-30 18:17:03 +00:00
bevy_pbr Fix Mesh allocator bug and reduce Mesh data copies by two (#15566) 2024-10-01 17:15:57 +00:00
bevy_picking Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_ptr Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_reflect bevy_reflect: Generic parameter info (#15475) 2024-09-30 17:58:37 +00:00
bevy_remote Add content-type header to BRP HTTP responses (#15552) 2024-09-30 21:23:55 +00:00
bevy_render Fix Mesh allocator bug and reduce Mesh data copies by two (#15566) 2024-10-01 17:15:57 +00:00
bevy_scene Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
bevy_sprite The Cooler 'Retain Rendering World' (#15320) 2024-09-30 18:51:43 +00:00
bevy_state Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_tasks bump async-channel to 2.3.0 (#15497) 2024-09-28 19:21:59 +00:00
bevy_text Cleanup unneeded lifetimes in bevy_asset (#15546) 2024-09-30 21:54:59 +00:00
bevy_time Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_transform Migrate visibility to required components (#15474) 2024-09-27 19:06:16 +00:00
bevy_ui The Cooler 'Retain Rendering World' (#15320) 2024-09-30 18:51:43 +00:00
bevy_utils Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
bevy_window Add VisitEntities for generic and reflectable Entity iteration (#15425) 2024-09-30 17:32:03 +00:00
bevy_winit Fix window spawning triggering ButtonInput<KeyCode>::just_pressed/just_released (#12372) 2024-09-30 18:24:36 +00:00