From fd445f7b4dce02617de194b2e338df36e0c752ef Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 11 Feb 2019 19:54:01 +0100 Subject: [PATCH] [d3d11] Move D3D11 presenter creation to WineDXGISwapChainFactory --- src/d3d11/d3d11_device.cpp | 22 +++++++++------------- src/d3d11/d3d11_device.h | 6 ++++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index d03e3d1e..74efb1c1 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1686,8 +1686,9 @@ namespace dxvk { WineDXGISwapChainFactory::WineDXGISwapChainFactory( - IDXGIVkPresentDevice* pDevice) - : m_device(pDevice) { + D3D11DXGIDevice* pContainer, + D3D11Device* pDevice) + : m_container(pContainer), m_device(pDevice) { } @@ -1741,17 +1742,12 @@ namespace dxvk { fsDesc.Windowed = TRUE; } - // Create presenter for the device - Com presenter; - - HRESULT hr = m_device->CreateSwapChainForHwnd( - hWnd, &desc, &presenter); - - if (FAILED(hr)) - return hr; - try { - // Create actual swap chain object + // Create presenter for the device + Com presenter = new D3D11SwapChain( + m_container, m_device, hWnd, &desc); + + // Create the actual swap chain *ppSwapChain = ref(new DxgiSwapChain( pFactory, presenter.ptr(), hWnd, &desc, &fsDesc)); return S_OK; @@ -1775,7 +1771,7 @@ namespace dxvk { m_d3d11Device (this, FeatureLevel, FeatureFlags), m_d3d11Presenter(this, &m_d3d11Device), m_d3d11Interop (this, &m_d3d11Device), - m_wineFactory (&m_d3d11Presenter), + m_wineFactory (this, &m_d3d11Device), m_frameLatencyCap(m_d3d11Device.GetOptions()->maxFrameLatency) { for (uint32_t i = 0; i < m_frameEvents.size(); i++) m_frameEvents[i] = new DxvkEvent(); diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index 15972436..cfc71074 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -396,7 +396,8 @@ namespace dxvk { public: WineDXGISwapChainFactory( - IDXGIVkPresentDevice* pDevice); + D3D11DXGIDevice* pContainer, + D3D11Device* pDevice); ULONG STDMETHODCALLTYPE AddRef(); @@ -416,7 +417,8 @@ namespace dxvk { private: - IDXGIVkPresentDevice* m_device; + D3D11DXGIDevice* m_container; + D3D11Device* m_device; };