bevy/crates/bevy_pbr/src/render
re0312 36c6f29832
Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073)
# Objective
- After #13894, I noticed the performance of `many_lights `dropped from
120+ to 60+. I reviewed the PR but couldn't identify any mistakes. After
profiling, I discovered that `Hashmap::Clone `was very slow when its not
empty, causing `extract_light` to increase from 3ms to 8ms.
- Lighting only checks visibility for 3D Meshes. We don't need to
maintain a TypeIdMap for this, as it not only impacts performance
negatively but also reduces ergonomics.

## Solution

- use VisibleMeshEntities for lighint visibility checking.


## Performance
cargo run --release --example many_lights  --features bevy/trace_tracy 
name="bevy_pbr::light::check_point_light_mesh_visibility"}

![image](https://github.com/bevyengine/bevy/assets/45868716/8bad061a-f936-45a0-9bb9-4fbdaceec08b)

system{name="bevy_pbr::render::light::extract_lights"}

![image](https://github.com/bevyengine/bevy/assets/45868716/ca75b46c-b4ad-45d3-8c8d-66442447b753)


## Migration Guide

> now `SpotLightBundle` , `CascadesVisibleEntities `and
`CubemapVisibleEntities `use VisibleMeshEntities instead of
`VisibleEntities`

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-07-14 17:00:54 +00:00
..
clustered_forward.wgsl
fog.rs
fog.wgsl
forward_io.wgsl
gpu_preprocess.rs
light.rs Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> (#14073) 2024-07-14 17:00:54 +00:00
mesh_bindings.rs
mesh_bindings.wgsl
mesh_functions.wgsl
mesh_preprocess.wgsl
mesh_types.wgsl
mesh_view_bindings.rs
mesh_view_bindings.wgsl
mesh_view_types.wgsl
mesh.rs
mesh.wgsl
mod.rs
morph.rs
morph.wgsl
parallax_mapping.wgsl
pbr_ambient.wgsl
pbr_bindings.wgsl
pbr_fragment.wgsl
pbr_functions.wgsl
pbr_lighting.wgsl
pbr_prepass_functions.wgsl
pbr_prepass.wgsl
pbr_transmission.wgsl
pbr_types.wgsl
pbr.wgsl
rgb9e5.wgsl
shadow_sampling.wgsl
shadows.wgsl
skin.rs
skinning.wgsl
utils.wgsl
view_transformations.wgsl
wireframe.wgsl