From 009e772fe81b15c6c0b6c91258b124dbaed5ed04 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Tue, 17 Dec 2019 23:59:37 +0000 Subject: [PATCH] [d3d9] Remove initial device reset outside of constructor Allows us to funnel hresults from that to the response of CreateDevice --- src/d3d9/d3d9_device.cpp | 6 ------ src/d3d9/d3d9_device.h | 2 -- src/d3d9/d3d9_interface.cpp | 13 +++++++++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 2d4d466c..8b98ebc0 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -37,8 +37,6 @@ namespace dxvk { D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, - D3DPRESENT_PARAMETERS* pPresentationParameters, - D3DDISPLAYMODEEX* pDisplayMode, Rc dxvkDevice) : m_adapter ( pAdapter ) , m_dxvkDevice ( dxvkDevice ) @@ -81,10 +79,6 @@ namespace dxvk { SetupFPU(); m_availableMemory = DetermineInitialTextureMemory(); - - HRESULT hr = InitialReset(pPresentationParameters, pDisplayMode); - if (FAILED(hr)) - throw DxvkError("D3D9DeviceEx: Initial device reset failed."); } diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index d3bdec4c..81a82255 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -110,8 +110,6 @@ namespace dxvk { D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, - D3DPRESENT_PARAMETERS* pPresentationParameters, - D3DDISPLAYMODEEX* pDisplayMode, Rc dxvkDevice); ~D3D9DeviceEx(); diff --git a/src/d3d9/d3d9_interface.cpp b/src/d3d9/d3d9_interface.cpp index e13ea04e..c51cf241 100644 --- a/src/d3d9/d3d9_interface.cpp +++ b/src/d3d9/d3d9_interface.cpp @@ -287,15 +287,20 @@ namespace dxvk { try { auto dxvkDevice = dxvkAdapter->createDevice(m_instance, clientApi, D3D9DeviceEx::GetDeviceFeatures(dxvkAdapter)); - *ppReturnedDeviceInterface = ref(new D3D9DeviceEx( + auto* device = new D3D9DeviceEx( this, adapter, DeviceType, hFocusWindow, BehaviorFlags, - pPresentationParameters, - pFullscreenDisplayMode, - dxvkDevice)); + dxvkDevice); + + HRESULT hr = device->InitialReset(pPresentationParameters, pFullscreenDisplayMode); + + if (FAILED(hr)) + return hr; + + *ppReturnedDeviceInterface = ref(device); } catch (const DxvkError& e) { Logger::err(e.message());