swapchain: Workaround weird behavior with FindClosestMatchingMode.

Use a default format if there is no format specified.
Otherwise, the call fails on both Wine and DXVK DXGIs.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2020-10-05 11:58:54 +02:00
parent 624e42f742
commit d02d95f606
1 changed files with 6 additions and 0 deletions

View File

@ -385,6 +385,12 @@ static HRESULT d3d12_swapchain_set_display_mode(struct d3d12_swapchain *swapchai
{
DXGI_MODE_DESC matching_mode;
HRESULT hr;
/* Workaround. FindClosestMatchingMode can take UNKNOWN format, but neither Wine nor DXVK DXGI seems to like it.
* Just opt for existing format to workaround the issue. */
if (mode->Format == DXGI_FORMAT_UNKNOWN)
mode->Format = swapchain->desc.Format;
if (FAILED(hr = IDXGIOutput_FindClosestMatchingMode(output, mode, &matching_mode, NULL)))
{
WARN("Failed to find closest matching mode, hr %#x.\n", hr);