Skip to content
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

Refactor check_light_mesh_visibility for performance #2 #13906

Merged
merged 14 commits into from
Jun 26, 2024

Conversation

re0312
Copy link
Contributor

@re0312 re0312 commented Jun 18, 2024

Objective

Solution

  • check_dir_light_mesh_visibility defers setting the entity's ViewVisibility so that Bevy can schedule it to run in parallel with check_point_light_mesh_visibility.

  • Reduce HashMap lookups for directional light checking as much as possible

  • Use par_iter to parallelize the checking process within each system.

@re0312
Copy link
Contributor Author

re0312 commented Jun 18, 2024

Marking as draft until #13905 get merged.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 18, 2024
@re0312 re0312 marked this pull request as ready for review June 18, 2024 03:52
@alice-i-cecile alice-i-cecile requested a review from IceSentry June 18, 2024 11:17
crates/bevy_pbr/src/light/mod.rs Outdated Show resolved Hide resolved
crates/bevy_pbr/src/light/mod.rs Outdated Show resolved Hide resolved
crates/bevy_pbr/src/light/mod.rs Outdated Show resolved Hide resolved
crates/bevy_pbr/src/light/mod.rs Outdated Show resolved Hide resolved
crates/bevy_pbr/src/light/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@kristoff3r kristoff3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me now, and I tested that many_cubes with shadows still works

@Elabajaba Elabajaba self-requested a review June 21, 2024 23:16
Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with this code, but the implementation makes sense to me and the perf gain look pretty good.

I tested various examples and they all seemed to work correctly.

@IceSentry IceSentry added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 26, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 26, 2024
Merged via the queue into bevyengine:main with commit a3f91a2 Jun 26, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants