From ca2f36f256cd4450b735c8fe07ac86cd0982cdb4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 17 Nov 2015 13:44:24 +0100 Subject: [PATCH] Revert "Create d3d_create_device" This reverts commit 2a312e153f5682f3dc3f894ca6990c0405d1fb10. --- gfx/d3d/d3d.cpp | 26 +++++++++++++++++++++++--- gfx/d3d/d3d_wrapper.cpp | 32 -------------------------------- gfx/d3d/d3d_wrapper.h | 3 --- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index 62600dd360..2c71240de0 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -250,9 +250,29 @@ static bool d3d_init_base(void *data, const video_info_t *info) d3d->cur_mon_id = 0; #endif - if (!d3d_create_device(d3d->cur_mon_id, &d3dpp, d3d->g_pD3D, &d3d->dev, - win32_get_window())) - return false; + if (FAILED(d3d->d3d_err = d3d->g_pD3D->CreateDevice( + d3d->cur_mon_id, + D3DDEVTYPE_HAL, + win32_get_window(), + D3DCREATE_HARDWARE_VERTEXPROCESSING, + &d3dpp, + &d3d->dev))) + { + RARCH_WARN("[D3D]: Failed to init device with hardware vertex processing (code: 0x%x). Trying to fall back to software vertex processing.\n", + (unsigned)d3d->d3d_err); + + if (FAILED(d3d->d3d_err = d3d->g_pD3D->CreateDevice( + d3d->cur_mon_id, + D3DDEVTYPE_HAL, + win32_get_window(), + D3DCREATE_SOFTWARE_VERTEXPROCESSING, + &d3dpp, + &d3d->dev))) + { + RARCH_ERR("Failed to initialize device.\n"); + return false; + } + } return true; } diff --git a/gfx/d3d/d3d_wrapper.cpp b/gfx/d3d/d3d_wrapper.cpp index 7f3badd941..9088cff6dc 100644 --- a/gfx/d3d/d3d_wrapper.cpp +++ b/gfx/d3d/d3d_wrapper.cpp @@ -32,38 +32,6 @@ static bool d3d_restore_device(LPDIRECT3DDEVICE dev) return true; } -bool d3d_create_device(unsigned monitor_id, D3DPRESENT_PARAMETERS *d3dpp, - LPDIRECT3D adapter, LPDIRECT3DDEVICE dev, HWND window) -{ - HRESULT err; - - if (FAILED(err = adapter->CreateDevice( - monitor_id, - D3DDEVTYPE_HAL, - window, - D3DCREATE_HARDWARE_VERTEXPROCESSING, - d3dpp, - dev))) - { - RARCH_WARN("[D3D]: Failed to init device with hardware vertex processing (code: 0x%x). Trying to fall back to software vertex processing.\n", - (unsigned)err); - - if (FAILED(err = adapter->CreateDevice( - monitor_id, - D3DDEVTYPE_HAL, - window, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, - d3dpp, - dev))) - { - RARCH_ERR("Failed to initialize device.\n"); - return false; - } - } - - return true; -} - bool d3d_swap(void *data, LPDIRECT3DDEVICE dev) { if (!d3d_restore_device(dev)) diff --git a/gfx/d3d/d3d_wrapper.h b/gfx/d3d/d3d_wrapper.h index b5e2a0815d..f0e3188ef8 100644 --- a/gfx/d3d/d3d_wrapper.h +++ b/gfx/d3d/d3d_wrapper.h @@ -112,9 +112,6 @@ void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value); bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp); -bool d3d_create_device(unsigned monitor_id, D3DPRESENT_PARAMETERS *d3dpp, - LPDIRECT3D adapter, LPDIRECT3DDEVICE dev, HWND window); - #ifdef __cplusplus } #endif