GS: Default adapter_index to -1 to indicate default

This commit is contained in:
TellowKrinkle 2021-11-23 01:21:49 -06:00 committed by tellowkrinkle
parent aaed932a67
commit f471c30036
2 changed files with 4 additions and 3 deletions

View File

@ -1091,7 +1091,6 @@ void GSApp::Init()
// Avoid to clutter the ini file with useless options
#ifdef _WIN32
// Per OS option.
m_default_configuration["adapter_index"] = "0";
m_default_configuration["CaptureFileName"] = "";
m_default_configuration["CaptureVideoCodecDisplayName"] = "";
m_default_configuration["debug_d3d"] = "0";
@ -1101,6 +1100,7 @@ void GSApp::Init()
#else
m_default_configuration["linux_replay"] = "1";
#endif
m_default_configuration["adapter_index"] = "-1";
m_default_configuration["aa1"] = "1";
m_default_configuration["accurate_date"] = "1";
m_default_configuration["accurate_blending_unit"] = "1";

View File

@ -78,10 +78,11 @@ namespace D3D
ASSERT(factory);
wil::com_ptr_nothrow<IDXGIAdapter1> adapter;
if (factory->EnumAdapters1(index, adapter.put()) == DXGI_ERROR_NOT_FOUND)
if (index < 0 || factory->EnumAdapters1(index, adapter.put()) == DXGI_ERROR_NOT_FOUND)
{
// try index 0 (default adapter)
fprintf(stderr, "D3D: adapter not found, falling back to the default\n");
if (index >= 0)
fprintf(stderr, "D3D: adapter not found, falling back to the default\n");
if (FAILED(factory->EnumAdapters1(0, adapter.put())))
{
// either there are no adapters connected or something major is wrong with the system