[dxgi] Fix undefined display mode format for display mode transitions

Fixes resolution change option in Dark Souls 3.
This commit is contained in:
Philip Rebohle 2018-10-06 08:00:20 +02:00
parent 09bbb68d98
commit 87f1cd2385
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 15 additions and 6 deletions

View File

@ -403,13 +403,12 @@ namespace dxvk {
DXGI_OUTPUT_DESC desc; DXGI_OUTPUT_DESC desc;
output->GetDesc(&desc); output->GetDesc(&desc);
const RECT newRect = desc.DesktopCoordinates; RECT newRect = desc.DesktopCoordinates;
::MoveWindow(m_window, newRect.left, newRect.top, ::MoveWindow(m_window, newRect.left, newRect.top,
newRect.right - newRect.left, newRect.bottom - newRect.top, TRUE); newRect.right - newRect.left, newRect.bottom - newRect.top, TRUE);
} }
return S_OK; return S_OK;
} }
@ -633,13 +632,23 @@ namespace dxvk {
return DXGI_ERROR_INVALID_CALL; return DXGI_ERROR_INVALID_CALL;
// Find a mode that the output supports // Find a mode that the output supports
DXGI_MODE_DESC preferredMode = *pDisplayMode;
DXGI_MODE_DESC selectedMode; DXGI_MODE_DESC selectedMode;
HRESULT hr = output->FindClosestMatchingMode( if (preferredMode.Format == DXGI_FORMAT_UNKNOWN)
pDisplayMode, &selectedMode, nullptr); preferredMode.Format = m_desc.Format;
if (FAILED(hr)) HRESULT hr = output->FindClosestMatchingMode(
&preferredMode, &selectedMode, nullptr);
if (FAILED(hr)) {
Logger::err(str::format(
"DXGI: Failed to query closest mode:",
"\n Format: ", preferredMode.Format,
"\n Mode: ", preferredMode.Width, "x", preferredMode.Height,
"@", preferredMode.RefreshRate.Numerator / preferredMode.RefreshRate.Denominator));
return hr; return hr;
}
return output->SetDisplayMode(&selectedMode); return output->SetDisplayMode(&selectedMode);
} }