From 96ecaffee0bce29aa514d2eb47cbccddccf5ad66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 22 Oct 2014 20:45:08 -0700 Subject: [PATCH] Cleanup. --- src/renderer_d3d9.cpp | 18 +++++++++++------- src/renderer_d3d9.h | 5 ----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 48cd6bf38..435a6d255 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -256,8 +256,12 @@ namespace bgfx #if BGFX_CONFIG_RENDERER_DIRECT3D9EX static const GUID IID_IDirect3D9 = { 0x81bdcbca, 0x64d4, 0x426d, { 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c } }; static const GUID IID_IDirect3DDevice9Ex = { 0xb18b10ce, 0x2649, 0x405a, { 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a } }; -#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX + typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**); + static Direct3DCreate9ExFn Direct3DCreate9Ex; +#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX + typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion); + static Direct3DCreate9Fn Direct3DCreate9; static PFN_D3DPERF_SET_MARKER D3DPERF_SetMarker; static PFN_D3DPERF_BEGIN_EVENT D3DPERF_BeginEvent; static PFN_D3DPERF_END_EVENT D3DPERF_EndEvent; @@ -332,19 +336,19 @@ namespace bgfx #if BGFX_CONFIG_RENDERER_DIRECT3D9EX m_d3d9ex = NULL; - Direct3DCreate9ExFn direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9dll, "Direct3DCreate9Ex"); - if (NULL != direct3DCreate9Ex) + Direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9dll, "Direct3DCreate9Ex"); + if (NULL != Direct3DCreate9Ex) { - direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9ex); + Direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9ex); DX_CHECK(m_d3d9ex->QueryInterface(IID_IDirect3D9, (void**)&m_d3d9) ); m_pool = D3DPOOL_DEFAULT; } else #endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX { - Direct3DCreate9Fn direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9dll, "Direct3DCreate9"); - BGFX_FATAL(NULL != direct3DCreate9, Fatal::UnableToInitialize, "Function Direct3DCreate9 not found."); - m_d3d9 = direct3DCreate9(D3D_SDK_VERSION); + Direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9dll, "Direct3DCreate9"); + BGFX_FATAL(NULL != Direct3DCreate9, Fatal::UnableToInitialize, "Function Direct3DCreate9 not found."); + m_d3d9 = Direct3DCreate9(D3D_SDK_VERSION); m_pool = D3DPOOL_MANAGED; } diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index 92816d179..8c466997f 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -14,11 +14,6 @@ # endif // !BGFX_CONFIG_RENDERER_DIRECT3D9EX # include -# if BGFX_CONFIG_RENDERER_DIRECT3D9EX -typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**); -# endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX -typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion); - #elif BX_PLATFORM_XBOX360 # include # define D3DUSAGE_DYNAMIC 0 // not supported on X360