D3D11 check with less D3D10 copy and paste and more working

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2960 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1 2010-05-07 09:49:39 +00:00
parent 3005f0d0f8
commit 07eed4ed47
1 changed files with 9 additions and 36 deletions

View File

@ -191,9 +191,7 @@ bool GSUtil::CheckSSE()
typedef IDirect3D9* (WINAPI * LPDIRECT3DCREATE9) (UINT);
typedef HRESULT (WINAPI * LPCREATEDXGIFACTORY)(REFIID, void ** );
typedef HRESULT (WINAPI * LPD3D11CREATEDEVICE)( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT32, ID3D10Device** );
typedef HRESULT (WINAPI * LPD3D11CREATESTATEBLOCK)( ID3D10Device *pDevice, D3D10_STATE_BLOCK_MASK *pStateBlockMask, ID3D10StateBlock **ppStateBlock );
typedef HRESULT (WINAPI * LPD3D11CREATEDEVICE)( IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, ID3D11Device**, D3D_FEATURE_LEVEL *, ID3D11DeviceContext**);
// ---------------------------------------------------------------------------------
// DX10/11 Detection (includes DXGI detection and dynamic library method bindings)
@ -216,28 +214,16 @@ static LPD3DPERF_GETSTATUS s_DynamicD3DPERF_GetStatus = NULL;
*/
static HMODULE s_hModD3D11 = NULL;
static LPD3D11CREATESTATEBLOCK s_DynamicD3D11CreateStateBlock = NULL;
static LPD3D11CREATEDEVICE s_DynamicD3D11CreateDevice = NULL;
/*static LPD3D10STATEBLOCKMASKUNION s_DynamicD3D10StateBlockMaskUnion = NULL;
static LPD3D10STATEBLOCKMASKINTERSECT s_DynamicD3D10StateBlockMaskIntersect = NULL;
static LPD3D10STATEBLOCKMASKDIFFERENCE s_DynamicD3D10StateBlockMaskDifference = NULL;
static LPD3D10STATEBLOCKMASKENABLECAPTURE s_DynamicD3D10StateBlockMaskEnableCapture = NULL;
static LPD3D10STATEBLOCKMASKDISABLECAPTURE s_DynamicD3D10StateBlockMaskDisableCapture = NULL;
static LPD3D10STATEBLOCKMASKENABLEALL s_DynamicD3D10StateBlockMaskEnableAll = NULL;
static LPD3D10STATEBLOCKMASKDISABLEALL s_DynamicD3D10StateBlockMaskDisableAll = NULL;
static LPD3D10STATEBLOCKMASKGETSETTING s_DynamicD3D10StateBlockMaskGetSetting = NULL;
*/
static HMODULE s_hModDXGI = NULL;
static LPCREATEDXGIFACTORY s_DynamicCreateDXGIFactory = NULL;
static bool DXUT_EnsureD3D11APIs( void )
{
// If any module is non-NULL, this function has already been called. Note
// that this doesn't guarantee that all ProcAddresses were found.
if( s_hModD3D11 != NULL || s_hModDXGI != NULL )
// If any function pointer is non-NULL, this function has already been called.
if( s_DynamicD3D11CreateDevice )
return true;
s_hModDXGI = LoadLibrary( _T("dxgi.dll") );
@ -245,32 +231,19 @@ static bool DXUT_EnsureD3D11APIs( void )
{
s_DynamicCreateDXGIFactory = (LPCREATEDXGIFACTORY)GetProcAddress( s_hModDXGI, "CreateDXGIFactory" );
}
// If DXGI isn't installed then this system isn't even capable of DX10 support; so no point
// in checking for DX10 DLLs.
// If DXGI isn't installed then this system isn't even capable of DX11 support; so no point
// in checking for DX11 DLLs.
if( s_DynamicCreateDXGIFactory == NULL ) return false;
// Check for DX11 DLLs.
// Check for DX11 and DX10 DLLs. DX11 is fully backward compat, so we can just use the single
// module handle for either of them.
s_hModD3D11 = LoadLibrary( _T("d3d11.dll") );
if( s_hModD3D11 == NULL ) LoadLibrary( _T("d3d11_beta.dll") );
if( s_hModD3D11 == NULL ) LoadLibrary( _T("d3d11.dll") );
if( s_hModD3D11 != NULL )
{
s_DynamicD3D11CreateStateBlock = (LPD3D11CREATESTATEBLOCK)GetProcAddress( s_hModD3D11, "D3D10CreateStateBlock" );
s_DynamicD3D11CreateDevice = (LPD3D11CREATEDEVICE)GetProcAddress( s_hModD3D11, "D3D10CreateDevice" );
/*s_DynamicD3D10StateBlockMaskUnion = (LPD3D10STATEBLOCKMASKUNION)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskUnion" );
s_DynamicD3D10StateBlockMaskIntersect = (LPD3D10STATEBLOCKMASKINTERSECT)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskIntersect" );
s_DynamicD3D10StateBlockMaskDifference = (LPD3D10STATEBLOCKMASKDIFFERENCE)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskDifference" );
s_DynamicD3D10StateBlockMaskEnableCapture = (LPD3D10STATEBLOCKMASKENABLECAPTURE)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskEnableCapture" );
s_DynamicD3D10StateBlockMaskDisableCapture = (LPD3D10STATEBLOCKMASKDISABLECAPTURE)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskDisableCapture" );
s_DynamicD3D10StateBlockMaskEnableAll = (LPD3D10STATEBLOCKMASKENABLEALL)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskEnableAll" );
s_DynamicD3D10StateBlockMaskDisableAll = (LPD3D10STATEBLOCKMASKDISABLEALL)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskDisableAll" );
s_DynamicD3D10StateBlockMaskGetSetting = (LPD3D10STATEBLOCKMASKGETSETTING)GetProcAddress( s_hModD3D10, "D3D10StateBlockMaskGetSetting" );*/
s_DynamicD3D11CreateDevice = (LPD3D11CREATEDEVICE)GetProcAddress( s_hModD3D11, "D3D11CreateDevice" );
}
return ( s_DynamicD3D11CreateDevice != NULL );