Closed
Conversation
Member
You can use |
Contributor
Author
|
@mockersf great point, thank you! I don't know how I avoided reading the |
Contributor
|
Backlog cleanup: closing as an inactive WIP PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
The purpose of this PR is to demonstrate how puffin support can be integrated into Bevy. Currently, this PR is based on my fork of the
puffinlibrary which implements a tracing layer for puffin: EmbarkStudios/puffin#79. But regardless of whether thetracingsupport lands intopuffinitself or it'll be an independent crate, it's possible for Bevy to integratepuffinas atracinglayer without replacingtracingwith an alternative crate such asprofilingorpuffinitself (but it might still be worth to discuss those as well).Solution
The current approach is to add the
puffin_tracingcrate (which isn't published atm) as an optional dependency and introduce a feature which passesPuffinLayeras atracing-subscriberlayer. This implies that users will have to addpuffin,bevy_egui,puffin_eguicrates to their apps themselves so that Bevy can avoid depending on those directly.It would be fair to note that such integration can also exist outside of Bevy as a plugin (today, I also published one: https://github.com/mvlabat/bevy_puffin).
But it doesn't offer an ideal UX, as it's incompatible with Bevy'sLogPlugin, which renders it impossible to use theDefaultPluginsplugin group and makes users add those plugins manually.Alternatively, we can also allow users to customize
LogPluginby passing their own layers.To discuss
I noted that this change doesn't make Bevy depend on
puffinitself (only onpuffin_tracing, which still transitively depends onpuffinthough), but there still might be a valid reason to do that. For example, we can add a system which would callpuffin::GlobalProfiler::lock().new_frame();. As a counter-argument, users may want to control marking a new frame themselves, but I can't imagine the use-cases for that yet.