bevy/crates/bevy_sprite/src/mesh2d
Brian Reavis d40c5b54ae
Material, mesh, skin extraction optimization (#17976)
# Objective

The extraction systems for materials, meshes, and skins previously
iterated over `RemovedComponents<ViewVisibility>` in addition to more
specific variants like `RemovedComponents<MeshMaterial3d<M>>`. This
caused each system to loop through and check many irrelevant despawned
entities—sometimes multiple times. With many material types, this
overhead added up and became noticeable in frames with many despawns.

<img width="1091" alt="Screenshot 2025-02-21 at 10 28 01 AM"
src="https://github.com/user-attachments/assets/63fec1c9-232c-45f6-9150-daf8751ecf85"
/>

## Solution

This PR removes superfluous `RemovedComponents` iteration for
`ViewVisibility` and `GlobalTransform`, ensuring that we only iterate
over the most specific `RemovedComponents` relevant to the system (e.g.,
material components, mesh components). This is guaranteed to match what
the system originally collected.

### Before (red) / After (yellow):
<img width="838" alt="Screenshot 2025-02-21 at 10 46 17 AM"
src="https://github.com/user-attachments/assets/0e06b06d-7e91-4da5-a919-b843eb442a72"
/>
Log plot to highlight the long tail that this PR is addressing.
2025-07-09 06:23:44 +00:00
..
color_material.rs Remove Shader weak_handles from bevy_sprite. (#19392) 2025-05-27 04:01:34 +00:00
color_material.wgsl Add uv_transform to ColorMaterial (#17879) 2025-02-24 21:17:26 +00:00
material.rs Material, mesh, skin extraction optimization (#17976) 2025-07-09 06:23:44 +00:00
mesh2d_bindings.wgsl
mesh2d_functions.wgsl Fix mesh tag feature for 2d. (#18636) 2025-03-31 18:07:20 +00:00
mesh2d_types.wgsl Fix mesh tag feature for 2d. (#18636) 2025-03-31 18:07:20 +00:00
mesh2d_vertex_output.wgsl
mesh2d_view_bindings.wgsl add tonemapping LUT bindings for sprite and mesh2d pipelines (#13262) 2024-05-28 12:09:26 +00:00
mesh2d_view_types.wgsl
mesh2d.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
mesh.rs Make render and compute pipeline descriptors defaultable. (#19903) 2025-07-02 18:47:27 +00:00
mod.rs
wireframe2d.rs Allow calling add_render_graph_node on World. (#19912) 2025-07-02 14:56:18 +00:00
wireframe2d.wgsl Add binned 2d/3d Wireframe render phase (#18587) 2025-04-09 21:34:53 +00:00