-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - Only compute sprite color once per quad #7498
[Merged by Bors] - Only compute sprite color once per quad #7498
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
This seems to have the same effect as #7311 but for 2D sprites. Could you test the results with Tracy on one of the stress tests (i.e. |
@james7132 Added tracy comparisons for |
bors r+ |
# Objective This change substantially increased performance when drawing thousands of colored sprites. ## Solution The same color is used for each vertex in the quad sprites are drawn too, but the color is converted to a linear color each time. This computation only needs to be done once. The `as_linear_rgba_f32()` call was showing up in profiling the `basic` example in my [particle system library](https://github.com/abnormalbrain/bevy_particle_systems) as a hot path. This change added about 50 fps to the example, from about 150fps to about 200 fps, when rendering around 10k colored sprites. Tracy Results: "This trace" is with the change. Change in frame time: ![image](https://user-images.githubusercontent.com/102993888/216752612-5e0ad0ce-1c59-4b56-873e-8018287408bb.png) Change in `queue_sprites`: ![image](https://user-images.githubusercontent.com/102993888/216752767-6f1a6a5c-6181-45d3-bf86-5823bd81dfc4.png)
Pull request successfully merged into main. Build succeeded:
|
Objective
This change substantially increased performance when drawing thousands of colored sprites.
Solution
The same color is used for each vertex in the quad sprites are drawn too, but the color is converted to a linear color each time. This computation only needs to be done once.
The
as_linear_rgba_f32()
call was showing up in profiling thebasic
example in my particle system library as a hot path. This change added about 50 fps to the example, from about 150fps to about 200 fps, when rendering around 10k colored sprites.Tracy Results:
"This trace" is with the change.
Change in frame time:
Change in
queue_sprites
: