-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> #14073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lighting Should Only hold Vec<Entity> instead of TypeId<Vec<Entity>> #14073
Conversation
|
|
||
| #[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)] | ||
| #[reflect(Component)] | ||
| pub struct VisibleMeshEntities { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few doc comments would be great to be able to differentiate this from VisibleEntities
pcwalton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine. Lights could in theory affect other types of objects, but that would require a lot of refactoring, so we can specialize them to Meshes for now.
Objective
many_lightsdropped from 120+ to 60+. I reviewed the PR but couldn't identify any mistakes. After profiling, I discovered thatHashmap::Clonewas very slow when its not empty, causingextract_lightto increase from 3ms to 8ms.Solution
Performance
cargo run --release --example many_lights --features bevy/trace_tracy

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

Migration Guide