From e8656333f11f74308888bbca1d24a7f93dfa2013 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Jan 2016 02:22:53 +0100 Subject: [PATCH] Make it possible to manually set one of the devices with d3d_device_free --- gfx/common/d3d_common.cpp | 13 ++++--------- gfx/d3d/d3d.cpp | 5 +++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index 8e71debb4c..25cff7f14c 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -505,13 +505,8 @@ bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp) void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d) { - if (!dev) - return; - - dev->Release(); - - if (!pd3d) - return; - - pd3d->Release(); + if (dev) + dev->Release(); + if (pd3d) + pd3d->Release(); } diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 761294b506..b7f02fff33 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -388,7 +388,7 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info) if (!d3d_reset(d3d->dev, &d3dpp)) { d3d_deinitialize(d3d); - g_pD3D->Release(); + d3d_device_free(NULL, g_pD3D); g_pD3D = NULL; ret = d3d_init_base(d3d, info); @@ -847,7 +847,8 @@ static void d3d_free(void *data) #endif d3d_device_free(d3d->dev, g_pD3D); - g_pD3D = NULL; + d3d->dev = NULL; + g_pD3D = NULL; win32_monitor_from_window(window, true);