Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate previously registered scopes when creating GlobalFrameView (#…
…206) GlobalFrameView might be created after some scopes were already registered and frame sink won't see them without prior propagation with GlobalProfiler::emit_scope_snapshot(). ### Checklist * [X] I have read the [Contributor Guide](../CONTRIBUTING.md) * [X] I have read and agree to the [Code of Conduct](../CODE_OF_CONDUCT.md) * [X] I have added a description of my changes and why I'd like them included in the section below ### Description of Changes I've modified init function of GlobalFrameView so that it calls GlobalProfiler::emit_scope_snapshot() after the frame sink is registered so that it can see previously registered scopes. ### Related Issues I've noticed this issue when trying to render profiler UI conditionally with being disabled by default and in result scopes that were registered before the first call to the `GlobalProfiler::new_frame()` were not propagated to the frame sink that was registered afterwards. Simple reproduction code: ```rust let mut render_profiler_ui = false; [..] if render_profiler_ui { puffin_egui::profiler_window(&ctx); } [..] render_profiler_ui |= input.key_pressed(Key::F12); ```
- Loading branch information