bevy/crates/bevy_render/src/mesh
JMS55 5e8dec8a90 Have the mesh allocator handle modified meshes (#18531)
# Objective
Fixes https://github.com/bevyengine/bevy/issues/16586.

## Solution
- Free meshes before allocating new ones (so hopefully the existing
allocation is used, but it's not guaranteed since it might end up
getting used by a smaller mesh first).
- Keep track of modified render assets, and have the mesh allocator free
their allocations.
- Cleaned up some render asset code to make it more understandable,
since it took me several minutes to reverse engineer/remember how it was
supposed to work.

Long term we'll probably want to explicitly reusing allocations for
modified meshes that haven't grown in size, or do delta uploads using a
compute shader or something, but this is an easy fix for the near term.

## Testing
Ran the example provided in the issue. No crash after a few minutes, and
memory usage remains steady.
2025-03-27 23:31:05 +01:00
..
allocator.rs Have the mesh allocator handle modified meshes (#18531) 2025-03-27 23:31:05 +01:00
components.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
mod.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00