VideoCommon: Pass WindowSystemInfo to InitBackendInfo

This commit is contained in:
Pokechu22
2023-03-25 17:16:53 -07:00
parent 7845fb00ee
commit c63f0f37cd
21 changed files with 76 additions and 57 deletions

View File

@ -281,7 +281,7 @@ void VideoBackendBase::ActivateBackend(const std::string& name)
g_video_backend = iter->get();
}
void VideoBackendBase::PopulateBackendInfo()
void VideoBackendBase::PopulateBackendInfo(const WindowSystemInfo& wsi)
{
g_Config.Refresh();
// Reset backend_info so if the backend forgets to initialize something it doesn't end up using
@ -289,18 +289,18 @@ void VideoBackendBase::PopulateBackendInfo()
g_Config.backend_info = {};
ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
g_Config.backend_info.DisplayName = g_video_backend->GetDisplayName();
g_video_backend->InitBackendInfo();
g_video_backend->InitBackendInfo(wsi);
// We validate the config after initializing the backend info, as system-specific settings
// such as anti-aliasing, or the selected adapter may be invalid, and should be checked.
g_Config.VerifyValidity();
}
void VideoBackendBase::PopulateBackendInfoFromUI()
void VideoBackendBase::PopulateBackendInfoFromUI(const WindowSystemInfo& wsi)
{
// If the core is running, the backend info will have been populated already.
// If we did it here, the UI thread can race with the with the GPU thread.
if (!Core::IsRunning())
PopulateBackendInfo();
PopulateBackendInfo(wsi);
}
void VideoBackendBase::DoState(PointerWrap& p)

View File

@ -47,7 +47,7 @@ public:
virtual std::string GetName() const = 0;
virtual std::string GetDisplayName() const { return GetName(); }
virtual void InitBackendInfo() = 0;
virtual void InitBackendInfo(const WindowSystemInfo& wsi) = 0;
virtual std::optional<std::string> GetWarningMessage() const { return {}; }
// Prepares a native window for rendering. This is called on the main thread, or the
@ -69,9 +69,9 @@ public:
static void ActivateBackend(const std::string& name);
// Fills the backend_info fields with the capabilities of the selected backend/device.
static void PopulateBackendInfo();
static void PopulateBackendInfo(const WindowSystemInfo& wsi);
// Called by the UI thread when the graphics config is opened.
static void PopulateBackendInfoFromUI();
static void PopulateBackendInfoFromUI(const WindowSystemInfo& wsi);
// Wrapper function which pushes the event to the GPU thread.
void DoState(PointerWrap& p);