VideoCommon: Simplify VideoBackendBase::GetDefaultBackendName

Now we can just call GetDefaultVideoBackend to get the default backend
and get its name by calling GetName.
This commit is contained in:
Léo Lam 2020-10-21 21:41:28 +02:00
parent aaaa3896c0
commit d08b80828d
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 2 additions and 8 deletions

View File

@ -206,16 +206,10 @@ static VideoBackendBase* GetDefaultVideoBackend()
return backends.front().get(); return backends.front().get();
} }
// This function is called at static initialization, so we can't rely on s_default_backend being set
std::string VideoBackendBase::GetDefaultBackendName() std::string VideoBackendBase::GetDefaultBackendName()
{ {
#ifdef HAS_OPENGL auto* default_backend = GetDefaultVideoBackend();
return OGL::VideoBackend::NAME; return default_backend ? default_backend->GetName() : "";
#elif defined(_WIN32)
return DX11::VideoBackend::NAME;
#else
return Vulkan::VideoBackend::NAME;
#endif
} }
const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvailableBackends() const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvailableBackends()