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:
parent
09bbb68d98
commit
87f1cd2385
@ -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;
|
||||
}
|
||||
|
||||
@ -418,7 +417,7 @@ namespace dxvk {
|
||||
BOOL Fullscreen,
|
||||
IDXGIOutput* pTarget) {
|
||||
std::lock_guard<std::mutex> lock(m_lockWindow);
|
||||
|
||||
|
||||
if (m_descFs.Windowed && Fullscreen)
|
||||
return this->EnterFullscreenMode(pTarget);
|
||||
else if (!m_descFs.Windowed && !Fullscreen)
|
||||
@ -628,18 +627,28 @@ namespace dxvk {
|
||||
IDXGIOutput* pOutput,
|
||||
const DXGI_MODE_DESC* pDisplayMode) {
|
||||
auto output = static_cast<DxgiOutput*>(pOutput);
|
||||
|
||||
|
||||
if (output == nullptr)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
// Find a mode that the output supports
|
||||
DXGI_MODE_DESC preferredMode = *pDisplayMode;
|
||||
DXGI_MODE_DESC selectedMode;
|
||||
|
||||
if (preferredMode.Format == DXGI_FORMAT_UNKNOWN)
|
||||
preferredMode.Format = m_desc.Format;
|
||||
|
||||
HRESULT hr = output->FindClosestMatchingMode(
|
||||
pDisplayMode, &selectedMode, nullptr);
|
||||
&preferredMode, &selectedMode, nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user