From fadcac5a8e7812438fab5f8d18a5a37677bf36f5 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 5 Dec 2017 15:24:58 +0100 Subject: [PATCH] [dxgi] Fixed swap chain issue in ResizeTargets --- src/dxgi/dxgi_swapchain.cpp | 15 +++++++++++++-- tests/d3d11/test_d3d11_triangle.cpp | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 65383acc..52bf6342 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -241,14 +241,25 @@ namespace dxvk { / pNewTargetParameters->RefreshRate.Denominator; displayMode.driverdata = nullptr; + // TODO test mode change flag + if (SDL_SetWindowDisplayMode(m_window, &displayMode)) { - throw DxvkError(str::format( + Logger::err(str::format( "DxgiSwapChain::ResizeTarget: Failed to set display mode:\n", SDL_GetError())); return DXGI_ERROR_DRIVER_INTERNAL_ERROR; } - return S_OK; + try { + m_presenter->recreateSwapchain( + m_desc.BufferDesc.Width, + m_desc.BufferDesc.Height, + m_desc.BufferDesc.Format); + return S_OK; + } catch (const DxvkError& err) { + Logger::err(err.message()); + return DXGI_ERROR_DRIVER_INTERNAL_ERROR; + } } diff --git a/tests/d3d11/test_d3d11_triangle.cpp b/tests/d3d11/test_d3d11_triangle.cpp index f35aee18..275dda2f 100644 --- a/tests/d3d11/test_d3d11_triangle.cpp +++ b/tests/d3d11/test_d3d11_triangle.cpp @@ -54,6 +54,9 @@ public: if (FAILED(m_device->CreateRenderTargetView(m_buffer.ptr(), nullptr, &m_bufferView))) throw DxvkError("Failed to create render target view"); + if (FAILED(m_swapChain->ResizeTarget(&swapDesc.BufferDesc))) + throw DxvkError("Failed to resize window"); + }