[host] dxgi: fix incorrect skip logic

This commit is contained in:
Geoffrey McRae 2022-05-18 15:59:31 +10:00
parent 57e20007db
commit 0f8c0b5fb3

View File

@ -298,8 +298,6 @@ static bool dxgi_init(void)
const char * optOutput = option_get_string("dxgi", "output" );
for (int i = 0; IDXGIFactory1_EnumAdapters1(this->factory, i, &this->adapter) != DXGI_ERROR_NOT_FOUND; ++i)
{
if (optAdapter)
{
DXGI_ADAPTER_DESC1 adapterDesc;
status = IDXGIAdapter1_GetDesc1(this->adapter, &adapterDesc);
@ -320,9 +318,14 @@ static bool dxgi_init(void)
{
DEBUG_INFO("Not using unsupported adapter: %ls",
adapterDesc.Description);
goto next_adapter;
IDXGIAdapter1_Release(this->adapter);
this->adapter = NULL;
continue;
}
if (optAdapter)
{
const size_t s = (wcslen(adapterDesc.Description)+1) * 2;
char * desc = malloc(s);
wcstombs(desc, adapterDesc.Description, s);
@ -331,16 +334,14 @@ static bool dxgi_init(void)
{
DEBUG_INFO("Not using adapter: %ls", adapterDesc.Description);
free(desc);
goto next_adapter;
IDXGIAdapter1_Release(this->adapter);
this->adapter = NULL;
continue;
}
free(desc);
DEBUG_INFO("Adapter matched, trying: %ls", adapterDesc.Description);
break;
next_adapter:
IDXGIAdapter1_Release(this->adapter);
this->adapter = NULL;
}
for (int n = 0; IDXGIAdapter1_EnumOutputs(this->adapter, n, &this->output) != DXGI_ERROR_NOT_FOUND; ++n)