GS/Qt: Adjust how we handle Default adapter.

Try to resolve it again since it annoys me.

Treat is as empty.

Also do NOT translate Default adapter,
it messes with the ini config.
This commit is contained in:
lightningterror 2024-10-22 02:24:31 +02:00 committed by Ty
parent 9e15058634
commit 1b50057764
6 changed files with 16 additions and 6 deletions

View File

@ -1137,13 +1137,13 @@ void GraphicsSettingsWidget::updateRendererDependentOptions()
std::string current_adapter = Host::GetBaseStringSettingValue("EmuCore/GS", "Adapter", "");
m_ui.adapterDropdown->clear();
m_ui.adapterDropdown->setEnabled(!adapters.empty());
m_ui.adapterDropdown->addItem(tr("(Default)"));
m_ui.adapterDropdown->addItem(GetDefaultAdapter().c_str());
m_ui.adapterDropdown->setCurrentIndex(0);
if (m_dialog->isPerGameSettings())
{
m_ui.adapterDropdown->insertItem(
0, tr("Use Global Setting [%1]").arg(current_adapter.empty() ? tr("(Default)") : QString::fromStdString(current_adapter)));
0, tr("Use Global Setting [%1]").arg(current_adapter.empty() ? GetDefaultAdapter().c_str() : QString::fromStdString(current_adapter)));
if (!m_dialog->getSettingsInterface()->GetStringValue("EmuCore/GS", "Adapter", &current_adapter))
{
// clear the adapter so we don't set it to the global value

View File

@ -69,6 +69,12 @@ bool GSIsHardwareRenderer()
return (GSCurrentRenderer != GSRendererType::SW);
}
std::string GetDefaultAdapter()
{
// Will be treated as empty.
return "(Default)";
}
static RenderAPI GetAPIForRenderer(GSRendererType renderer)
{
switch (renderer)

View File

@ -89,6 +89,7 @@ void GSSetVSyncMode(GSVSyncMode mode, bool allow_present_throttle);
GSRendererType GSGetCurrentRenderer();
bool GSIsHardwareRenderer();
std::string GetDefaultAdapter();
bool GSWantsExclusiveFullscreen();
std::optional<float> GSGetHostRefreshRate();
std::vector<GSAdapterInfo> GSGetAdapterInfo(GSRendererType renderer);

View File

@ -197,7 +197,7 @@ bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const
wil::com_ptr_nothrow<IDXGIAdapter1> D3D::GetAdapterByName(IDXGIFactory5* factory, const std::string_view name)
{
if (name.empty())
if (name.empty() || name == GetDefaultAdapter())
return {};
// This might seem a bit odd to cache the names.. but there's a method to the madness.

View File

@ -851,7 +851,9 @@ bool GSDeviceMTL::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
}
if (!m_dev.dev)
{
if (!GSConfig.Adapter.empty())
if (GSConfig.Adapter == GetDefaultAdapter())
Console.WriteLn("Metal: Using default adapter");
else if (!GSConfig.Adapter.empty())
Console.Warning("Metal: Couldn't find adapter %s, using default", GSConfig.Adapter.c_str());
m_dev = GSMTLDevice(MRCTransfer(MTLCreateSystemDefaultDevice()));
if (!m_dev.dev)

View File

@ -2511,7 +2511,8 @@ bool GSDeviceVK::CreateDeviceAndSwapChain()
return false;
}
if (!GSConfig.Adapter.empty())
const bool is_default_gpu = GSConfig.Adapter == GetDefaultAdapter();
if (!(GSConfig.Adapter.empty() || is_default_gpu))
{
u32 gpu_index = 0;
for (; gpu_index < static_cast<u32>(gpus.size()); gpu_index++)
@ -2532,7 +2533,7 @@ bool GSDeviceVK::CreateDeviceAndSwapChain()
}
else
{
INFO_LOG("No GPU requested, using first ({})", gpus[0].second.name);
INFO_LOG("{} GPU requested, using first ({})", is_default_gpu ? "Default" : "No", gpus[0].second.name);
m_physical_device = gpus[0].first;
}