diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2025-11-06 22:08:27 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-11-06 22:34:40 -0600 |
| commit | da6c65bf3b83fa1cfe5da5dc5e43ec49b2786b52 (patch) | |
| tree | 1538fff3c783052707c8513738ba5cdc636ece48 /Source/Core/VideoCommon | |
| parent | 5650be68425960131225bcd3ea5a8dfc85074148 (diff) | |
Common: Remove the string parameters from the HookableEvent interface.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/AbstractGfx.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Assets/CustomResourceManager.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/FrameDumper.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/FramebufferManager.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Present.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/ShaderCache.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Statistics.cpp | 21 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.h | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 7 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VideoEvents.h | 12 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Widescreen.cpp | 28 |
14 files changed, 49 insertions, 55 deletions
diff --git a/Source/Core/VideoCommon/AbstractGfx.cpp b/Source/Core/VideoCommon/AbstractGfx.cpp index ca6ad881b1..0e7e05e0f0 100644 --- a/Source/Core/VideoCommon/AbstractGfx.cpp +++ b/Source/Core/VideoCommon/AbstractGfx.cpp @@ -18,8 +18,8 @@ std::unique_ptr<AbstractGfx> g_gfx; AbstractGfx::AbstractGfx() { - m_config_changed = GetVideoEvents().config_changed_event.Register( - [this](u32 bits) { OnConfigChanged(bits); }, "AbstractGfx"); + m_config_changed = + GetVideoEvents().config_changed_event.Register([this](u32 bits) { OnConfigChanged(bits); }); } bool AbstractGfx::IsHeadless() const diff --git a/Source/Core/VideoCommon/Assets/CustomResourceManager.cpp b/Source/Core/VideoCommon/Assets/CustomResourceManager.cpp index ac8199ef86..6f8d3557bb 100644 --- a/Source/Core/VideoCommon/Assets/CustomResourceManager.cpp +++ b/Source/Core/VideoCommon/Assets/CustomResourceManager.cpp @@ -29,8 +29,8 @@ void CustomResourceManager::Initialize() m_asset_loader.Initialize(); - m_xfb_event = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { XFBTriggered(); }, "CustomResourceManager"); + m_xfb_event = + GetVideoEvents().after_frame_event.Register([this](Core::System&) { XFBTriggered(); }); } void CustomResourceManager::Shutdown() diff --git a/Source/Core/VideoCommon/FrameDumper.cpp b/Source/Core/VideoCommon/FrameDumper.cpp index f39424805c..8bb98833f2 100644 --- a/Source/Core/VideoCommon/FrameDumper.cpp +++ b/Source/Core/VideoCommon/FrameDumper.cpp @@ -29,8 +29,8 @@ static bool DumpFrameToPNG(const FrameData& frame, const std::string& file_name) FrameDumper::FrameDumper() { - m_frame_end_handle = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { FlushFrameDump(); }, "FrameDumper"); + m_frame_end_handle = + GetVideoEvents().after_frame_event.Register([this](Core::System&) { FlushFrameDump(); }); } FrameDumper::~FrameDumper() diff --git a/Source/Core/VideoCommon/FramebufferManager.cpp b/Source/Core/VideoCommon/FramebufferManager.cpp index fc514811d5..8872f551c1 100644 --- a/Source/Core/VideoCommon/FramebufferManager.cpp +++ b/Source/Core/VideoCommon/FramebufferManager.cpp @@ -84,8 +84,8 @@ bool FramebufferManager::Initialize() return false; } - m_end_of_frame_event = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { EndOfFrame(); }, "FramebufferManager"); + m_end_of_frame_event = + GetVideoEvents().after_frame_event.Register([this](Core::System&) { EndOfFrame(); }); return true; } diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp index 0bf8e844ec..a3c98ee9d7 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp @@ -18,7 +18,7 @@ CustomShaderCache::CustomShaderCache() m_async_uber_shader_compiler->StartWorkerThreads(1); // TODO m_frame_end_handler = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { RetrieveAsyncShaders(); }, "RetrieveAsyncShaders"); + [this](Core::System&) { RetrieveAsyncShaders(); }); } CustomShaderCache::~CustomShaderCache() diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp index 6a523c61a2..3caaa999fd 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp @@ -95,8 +95,8 @@ bool GraphicsModManager::Initialize() g_ActiveConfig.graphics_mod_config->SetChangeCount(old_game_mod_changes); g_graphics_mod_manager->Load(*g_ActiveConfig.graphics_mod_config); - m_end_of_frame_event = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { EndOfFrame(); }, "ModManager"); + m_end_of_frame_event = + GetVideoEvents().after_frame_event.Register([this](Core::System&) { EndOfFrame(); }); } return true; diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp index 24c767cc69..a8266a18a7 100644 --- a/Source/Core/VideoCommon/Present.cpp +++ b/Source/Core/VideoCommon/Present.cpp @@ -94,8 +94,8 @@ static void TryToSnapToXFBSize(int& width, int& height, int xfb_width, int xfb_h Presenter::Presenter() { - m_config_changed = GetVideoEvents().config_changed_event.Register( - [this](u32 bits) { ConfigChanged(bits); }, "Presenter"); + m_config_changed = + GetVideoEvents().config_changed_event.Register([this](u32 bits) { ConfigChanged(bits); }); } Presenter::~Presenter() diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index fbed022aa5..a3d07368f6 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -47,7 +47,7 @@ bool ShaderCache::Initialize() m_async_shader_compiler = g_gfx->CreateAsyncShaderCompiler(); m_frame_end_handler = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { RetrieveAsyncShaders(); }, "RetrieveAsyncShaders"); + [this](Core::System&) { RetrieveAsyncShaders(); }); return true; } diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp index 97c9264d18..642df5694a 100644 --- a/Source/Core/VideoCommon/Statistics.cpp +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -500,18 +500,15 @@ void Statistics::DisplayScissor() 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"); + s_before_frame_event = GetVideoEvents().before_frame_event.Register([] { g_stats.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, + }); + }); } void Statistics::Shutdown() diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index ee27c3e80b..9a95400679 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -463,8 +463,8 @@ private: void OnFrameEnd(); - Common::EventHook m_frame_event = GetVideoEvents().after_frame_event.Register( - [this](Core::System&) { OnFrameEnd(); }, "TextureCache"); + Common::EventHook m_frame_event = + GetVideoEvents().after_frame_event.Register([this](Core::System&) { OnFrameEnd(); }); VideoCommon::TextureUtils::TextureDumper m_texture_dumper; }; diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 1af9ad8eb4..ce6c07ddb1 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -120,11 +120,10 @@ bool VertexManagerBase::Initialize() { auto& video_events = GetVideoEvents(); - m_frame_end_event = video_events.after_frame_event.Register( - [this](Core::System&) { OnEndFrame(); }, "VertexManagerBase"); + m_frame_end_event = + video_events.after_frame_event.Register([this](Core::System&) { OnEndFrame(); }); m_after_present_event = video_events.after_present_event.Register( - [this](const PresentInfo& pi) { m_ticks_elapsed = pi.emulated_timestamp; }, - "VertexManagerBase"); + [this](const PresentInfo& pi) { m_ticks_elapsed = pi.emulated_timestamp; }); m_index_generator.Init(); m_custom_shader_cache = std::make_unique<CustomShaderCache>(); m_cpu_cull.Init(); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 63d061e684..c4d764176c 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -221,8 +221,8 @@ void VideoConfig::VerifyValidity() void VideoConfig::Init() { - s_check_config_event = GetVideoEvents().after_frame_event.Register( - [](Core::System&) { CheckForConfigChanges(); }, "CheckForConfigChanges"); + s_check_config_event = + GetVideoEvents().after_frame_event.Register([](Core::System&) { CheckForConfigChanges(); }); } void VideoConfig::Shutdown() diff --git a/Source/Core/VideoCommon/VideoEvents.h b/Source/Core/VideoCommon/VideoEvents.h index f8f29db589..ccee5bc3bd 100644 --- a/Source/Core/VideoCommon/VideoEvents.h +++ b/Source/Core/VideoCommon/VideoEvents.h @@ -69,17 +69,17 @@ struct PresentInfo struct VideoEvents { // Called when certain video config setting are changed - Common::HookableEvent<u32> config_changed_event{"ConfigChanged"}; + Common::HookableEvent<u32> config_changed_event; // An event called just before the first draw call of a frame - Common::HookableEvent<> before_frame_event{"BeforeFrame"}; + Common::HookableEvent<> before_frame_event; // An event called after the frame XFB copy begins processing on the host GPU. // Useful for "once per frame" usecases. // Note: In a few rare cases, games do multiple XFB copies per frame and join them while // presenting. // If this matters to your usecase, you should use BeforePresent instead. - Common::HookableEvent<Core::System&> after_frame_event{"AfterFrame"}; + Common::HookableEvent<Core::System&> after_frame_event; // An event called just as a frame is queued for presentation. // The exact timing of this event depends on the "Immediately Present XFB" option. @@ -89,14 +89,14 @@ struct VideoEvents // frame. // // frame_count: The number of frames - Common::HookableEvent<PresentInfo&> before_present_event{"BeforePresent"}; + Common::HookableEvent<PresentInfo&> before_present_event; // An event that is triggered after a frame is presented. // The exact timing of this event depends on backend/driver support. - Common::HookableEvent<PresentInfo&> after_present_event{"AfterPresent"}; + Common::HookableEvent<PresentInfo&> after_present_event; // An end of frame event that runs on the CPU thread - Common::HookableEvent<> vi_end_field_event{"VIEndField"}; + Common::HookableEvent<> vi_end_field_event; }; VideoEvents& GetVideoEvents(); diff --git a/Source/Core/VideoCommon/Widescreen.cpp b/Source/Core/VideoCommon/Widescreen.cpp index e980d24d57..987e733555 100644 --- a/Source/Core/VideoCommon/Widescreen.cpp +++ b/Source/Core/VideoCommon/Widescreen.cpp @@ -32,26 +32,24 @@ WidescreenManager::WidescreenManager() auto& system = Core::System::GetInstance(); auto& video_events = system.GetVideoEvents(); - m_config_changed = video_events.config_changed_event.Register( - [this](u32 bits) { - if (bits & (CONFIG_CHANGE_BIT_ASPECT_RATIO)) - { - // If the widescreen flag isn't being overridden by any settings, - // reset it to default if heuristic aren't running or to the last - // heuristic value if they were running. - if (std::optional<bool> is_game_widescreen = GetWidescreenOverride()) - m_is_game_widescreen = *is_game_widescreen; - else - m_is_game_widescreen = (m_heuristic_state == HeuristicState::Active_Found_Anamorphic); - } - }, - "Widescreen"); + m_config_changed = video_events.config_changed_event.Register([this](u32 bits) { + if (bits & (CONFIG_CHANGE_BIT_ASPECT_RATIO)) + { + // If the widescreen flag isn't being overridden by any settings, + // reset it to default if heuristic aren't running or to the last + // heuristic value if they were running. + if (std::optional<bool> is_game_widescreen = GetWidescreenOverride()) + m_is_game_widescreen = *is_game_widescreen; + else + m_is_game_widescreen = (m_heuristic_state == HeuristicState::Active_Found_Anamorphic); + } + }); // VertexManager doesn't maintain statistics in Wii mode. if (!system.IsWii()) { m_update_widescreen = video_events.after_frame_event.Register( - [this](Core::System&) { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic"); + [this](Core::System&) { UpdateWidescreenHeuristic(); }); } } |
