diff options
author | Ryan Holtz <rholtz@batcountryentertainment.com> | 2013-05-19 22:30:52 +0000 |
---|---|---|
committer | Ryan Holtz <rholtz@batcountryentertainment.com> | 2013-05-19 22:30:52 +0000 |
commit | 5c0fb782ddd6b26f0b7434813a84627fb0f0bdc0 (patch) | |
tree | 1b08c0ef087eba552f3b78c44a414266ce63c945 | |
parent | bff57eb2a0e2e00636c10d8da9ef0efcbe071c46 (diff) |
Reset D3D device before destroying device. Fixes crash when selecting games from internal menu with HLSL enabled. nw
-rw-r--r-- | src/osd/windows/drawd3d.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index 7f04476c916..eaedf7ed904 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -794,7 +794,9 @@ int renderer::pre_window_draw_check() if (m_device != NULL) { if (device_test_cooperative()) + { return 1; + } } // in window mode, we need to track the window size @@ -1001,9 +1003,8 @@ try_again: video_config.waitvsync || video_config.syncrefresh) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; - printf("m_device is %08x%08x\n", (UINT32)((UINT64)m_device >> 32), (UINT32)((UINT64)m_device & 0x00000000ffffffff)); // create the D3D device - result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, win_window_list->hwnd, + result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_window->hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &m_presentation, &m_device); if (result != D3D_OK) { @@ -1013,7 +1014,9 @@ try_again: { m_create_error_count++; if (m_create_error_count < 10) + { return 0; + } } // fatal error if we just can't do it @@ -1154,7 +1157,10 @@ void renderer::device_delete() // free the device itself if (m_device != NULL) + { + (*d3dintf->device.reset)(m_device, &m_presentation); (*d3dintf->device.release)(m_device); + } m_device = NULL; } |