1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[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

View File

@ -403,13 +403,12 @@ namespace dxvk {
DXGI_OUTPUT_DESC desc;
output->GetDesc(&desc);
const RECT newRect = desc.DesktopCoordinates;
RECT newRect = desc.DesktopCoordinates;
::MoveWindow(m_window, newRect.left, newRect.top,
newRect.right - newRect.left, newRect.bottom - newRect.top, TRUE);
}
return S_OK;
}
@ -633,13 +632,23 @@ namespace dxvk {
return DXGI_ERROR_INVALID_CALL;
// Find a mode that the output supports
DXGI_MODE_DESC preferredMode = *pDisplayMode;
DXGI_MODE_DESC selectedMode;
HRESULT hr = output->FindClosestMatchingMode(
pDisplayMode, &selectedMode, nullptr);
if (preferredMode.Format == DXGI_FORMAT_UNKNOWN)
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 output->SetDisplayMode(&selectedMode);
}