From 553099abf199b5428045df3148aec872a0182d21 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 Jan 2018 19:41:55 +0100 Subject: [PATCH] Add d3d_check_device_type --- gfx/common/d3d_common.c | 36 ++++++++++++++++++++++++++++++++++++ gfx/common/d3d_common.h | 6 ++++++ 2 files changed, 42 insertions(+) diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index cc512f7c42..3faff4b36f 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -263,6 +263,42 @@ void d3d_deinitialize_symbols(void) #endif } +bool d3d_check_device_type(LPDIRECT3D d3d, + unsigned idx, + D3DFORMAT disp_format, + D3DFORMAT backbuffer_format, + bool windowed_mode) +{ + if (!d3d) + return false; +#if defined(HAVE_D3D9) && !defined(__cplusplus) + if (FAILED(IDirect3D9_CheckDeviceType(d3d, + 0, + D3DDEVTYPE_HAL, + disp_format, + backbuffer_format, + windowed_mode))) + return false; +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + if (FAILED(IDirect3D8_CheckDeviceType(d3d, + 0, + D3DDEVTYPE_HAL, + disp_format, + backbuffer_format, + windowed_mode))) + return false; +#else + if (FAILED(d3d->CheckDeviceType( + 0, + D3DDEVTYPE_HAL, + disp_format, + backbuffer_format, + windowed_mode))) + return false; +#endif + return true; +} + bool d3d_get_adapter_display_mode(LPDIRECT3D d3d, unsigned idx, D3DDISPLAYMODE *display_mode) diff --git a/gfx/common/d3d_common.h b/gfx/common/d3d_common.h index 280ff418a6..2a4a04275c 100644 --- a/gfx/common/d3d_common.h +++ b/gfx/common/d3d_common.h @@ -183,6 +183,12 @@ bool d3d_initialize_symbols(void); void d3d_deinitialize_symbols(void); +bool d3d_check_device_type(LPDIRECT3D d3d, + unsigned idx, + D3DFORMAT disp_format, + D3DFORMAT backbuffer_format, + bool windowed_mode); + bool d3dx_create_font_indirect(LPDIRECT3DDEVICE dev, void *desc, void **font_data);