mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Common: Make HookableEvent use non-static data.
Co-authored-by: Dentomologist <dentomologist@gmail.com>
This commit is contained in:
co-authored by
Dentomologist
parent
9c28f19e56
commit
f289b06e0d
@@ -20,18 +20,8 @@
|
||||
|
||||
Statistics g_stats;
|
||||
|
||||
static Common::EventHook s_before_frame_event =
|
||||
BeforeFrameEvent::Register([] { g_stats.ResetFrame(); }, "Statistics::ResetFrame");
|
||||
|
||||
static Common::EventHook s_after_frame_event = AfterFrameEvent::Register(
|
||||
[](const Core::System& system) {
|
||||
DolphinAnalytics::Instance().ReportPerformanceInfo({
|
||||
.speed_ratio = system.GetSystemTimers().GetEstimatedEmulationPerformance(),
|
||||
.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims,
|
||||
.num_draw_calls = g_stats.this_frame.num_draw_calls,
|
||||
});
|
||||
},
|
||||
"Statistics::PerformanceSample");
|
||||
static Common::EventHook s_before_frame_event;
|
||||
static Common::EventHook s_after_frame_event;
|
||||
|
||||
static bool clear_scissors;
|
||||
|
||||
@@ -507,3 +497,25 @@ void Statistics::DisplayScissor()
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Statistics::Init()
|
||||
{
|
||||
s_before_frame_event = GetVideoEvents().before_frame_event.Register([] { g_stats.ResetFrame(); },
|
||||
"Statistics::ResetFrame");
|
||||
|
||||
s_after_frame_event = GetVideoEvents().after_frame_event.Register(
|
||||
[](const Core::System& system) {
|
||||
DolphinAnalytics::Instance().ReportPerformanceInfo({
|
||||
.speed_ratio = system.GetSystemTimers().GetEstimatedEmulationPerformance(),
|
||||
.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims,
|
||||
.num_draw_calls = g_stats.this_frame.num_draw_calls,
|
||||
});
|
||||
},
|
||||
"Statistics::PerformanceSample");
|
||||
}
|
||||
|
||||
void Statistics::Shutdown()
|
||||
{
|
||||
s_before_frame_event.reset();
|
||||
s_after_frame_event.reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user