From aaaa3896c09369ee0610992f14ab5a845e040315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 21 Oct 2020 21:34:38 +0200 Subject: VideoCommon: Get rid of the global g_available_video_backends Replace it with a function-local static that is initialized on first use. This gets rid of a global variable and removes the need for manual initialization in UICommon. This commit also replaces the weird find_if that looks for a non-null unique_ptr with a simple "is vector empty" check considering that none of the pointers can be null by construction. --- Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp') diff --git a/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp index c1e7c5f73f..5bf638ffc5 100644 --- a/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/SoftwareRendererWidget.cpp @@ -51,7 +51,7 @@ void SoftwareRendererWidget::CreateWidgets() rendering_layout->addWidget(new QLabel(tr("Backend:")), 1, 1); rendering_layout->addWidget(m_backend_combo, 1, 2); - for (const auto& backend : g_available_video_backends) + for (const auto& backend : VideoBackendBase::GetAvailableBackends()) m_backend_combo->addItem(tr(backend->GetDisplayName().c_str())); auto* overlay_box = new QGroupBox(tr("Overlay Information")); @@ -122,7 +122,7 @@ void SoftwareRendererWidget::ConnectWidgets() void SoftwareRendererWidget::LoadSettings() { - for (const auto& backend : g_available_video_backends) + for (const auto& backend : VideoBackendBase::GetAvailableBackends()) { if (backend->GetName() == Config::Get(Config::MAIN_GFX_BACKEND)) { @@ -137,7 +137,7 @@ void SoftwareRendererWidget::LoadSettings() void SoftwareRendererWidget::SaveSettings() { - for (const auto& backend : g_available_video_backends) + for (const auto& backend : VideoBackendBase::GetAvailableBackends()) { if (tr(backend->GetDisplayName().c_str()) == m_backend_combo->currentText()) { -- cgit v1.2.3