mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Fix cases where DX9 cards detected as having DX10/11 under Windows 7. Changed the device selector to display either DX10 or DX11 depending on the supposed feature set availability reported by drivers/dx.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3277 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
67ddabd231
commit
c394708651
|
@ -25,6 +25,13 @@
|
|||
#include "GSUtil.h"
|
||||
#include "resource.h"
|
||||
|
||||
static const D3D_FEATURE_LEVEL levels[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// DX11 Detection (includes DXGI detection and dynamic library method bindings)
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
@ -32,15 +39,16 @@
|
|||
|
||||
static IDXGIFactory* m_DXGIFactory = NULL;
|
||||
static bool m_D3D11Available = false;
|
||||
static bool m_HasD3D11Features = false;
|
||||
|
||||
static HMODULE s_hModD3D11 = NULL;
|
||||
static FnPtr_D3D11CreateDevice s_DynamicD3D11CreateDevice = NULL;
|
||||
static PFN_D3D11_CREATE_DEVICE s_DynamicD3D11CreateDevice = NULL;
|
||||
|
||||
static HMODULE s_hModDXGI = NULL;
|
||||
static FnPtr_CreateDXGIFactory s_DynamicCreateDXGIFactory = NULL;
|
||||
|
||||
|
||||
static bool DXUT_EnsureD3D11APIs( void )
|
||||
static bool DXUT_EnsureD3D11APIs()
|
||||
{
|
||||
// If any function pointer is non-NULL, this function has already been called.
|
||||
if( s_DynamicD3D11CreateDevice )
|
||||
|
@ -63,28 +71,22 @@ static bool DXUT_EnsureD3D11APIs( void )
|
|||
|
||||
if( s_hModD3D11 != NULL )
|
||||
{
|
||||
s_DynamicD3D11CreateDevice = (FnPtr_D3D11CreateDevice)GetProcAddress( s_hModD3D11, "D3D11CreateDevice" );
|
||||
s_DynamicD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress( s_hModD3D11, "D3D11CreateDevice" );
|
||||
}
|
||||
|
||||
return ( s_DynamicD3D11CreateDevice != NULL );
|
||||
}
|
||||
|
||||
static bool WINAPI DXUT_Dynamic_CreateDXGIFactory( REFIID rInterface, void ** ppOut )
|
||||
static bool DXUTDelayLoadDXGI()
|
||||
{
|
||||
if( !DXUT_EnsureD3D11APIs() ) return false;
|
||||
|
||||
return s_DynamicCreateDXGIFactory( rInterface, ppOut ) == S_OK;
|
||||
}
|
||||
|
||||
static bool DXUTDelayLoadDXGI()
|
||||
{
|
||||
if( m_DXGIFactory == NULL )
|
||||
{
|
||||
DXUT_Dynamic_CreateDXGIFactory( __uuidof( IDXGIFactory ), (LPVOID*)&m_DXGIFactory );
|
||||
m_D3D11Available = ( m_DXGIFactory != NULL );
|
||||
if( s_DynamicCreateDXGIFactory( __uuidof( IDXGIFactory ), (LPVOID*)&m_DXGIFactory ) != S_OK ) return false;
|
||||
}
|
||||
|
||||
return m_D3D11Available;
|
||||
return ( m_DXGIFactory != NULL );
|
||||
}
|
||||
|
||||
static void* GetDX11Proc( const char* methodname )
|
||||
|
@ -95,8 +97,24 @@ static void* GetDX11Proc( const char* methodname )
|
|||
|
||||
bool GSUtil::IsDirect3D11Available()
|
||||
{
|
||||
return DXUTDelayLoadDXGI();
|
||||
//return m_D3D11Available;
|
||||
if( !DXUTDelayLoadDXGI() ) return false;
|
||||
|
||||
CComPtr<ID3D11Device> dev;
|
||||
CComPtr<ID3D11DeviceContext> ctx;
|
||||
D3D_FEATURE_LEVEL level;
|
||||
|
||||
HRESULT hr = s_DynamicD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, levels, countof(levels),
|
||||
D3D11_SDK_VERSION, &dev, &level, &ctx);
|
||||
|
||||
m_D3D11Available = !FAILED(hr);
|
||||
m_HasD3D11Features = (level == D3D_FEATURE_LEVEL_11_0);
|
||||
|
||||
return m_D3D11Available;
|
||||
}
|
||||
|
||||
bool GSUtil::HasD3D11Features()
|
||||
{
|
||||
return m_D3D11Available && m_HasD3D11Features;
|
||||
}
|
||||
|
||||
void GSUtil::UnloadDynamicLibraries()
|
||||
|
@ -169,13 +187,6 @@ bool GSDevice11::Create(GSWnd* wnd)
|
|||
flags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
||||
D3D_FEATURE_LEVEL levels[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
};
|
||||
|
||||
D3D_FEATURE_LEVEL level;
|
||||
|
||||
hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, levels, countof(levels), D3D11_SDK_VERSION, &scd, &m_swapchain, &m_dev, &level, &m_ctx);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "GSTexture11.h"
|
||||
|
||||
typedef HRESULT (WINAPI * FnPtr_CreateDXGIFactory)(REFIID, void ** );
|
||||
typedef HRESULT (WINAPI * FnPtr_D3D11CreateDevice)( IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, ID3D11Device**, D3D_FEATURE_LEVEL *, ID3D11DeviceContext**);
|
||||
|
||||
typedef HRESULT (WINAPI * FnPtr_D3D11CreateDeviceAndSwapChain) (
|
||||
__in IDXGIAdapter *pAdapter,
|
||||
|
|
|
@ -133,9 +133,9 @@ void GSDialog::ComboBoxInit(UINT id, const GSSetting* settings, int count, uint3
|
|||
{
|
||||
if(settings[i].id <= maxid)
|
||||
{
|
||||
string str = settings[i].name;
|
||||
string str(settings[i].name);
|
||||
|
||||
if(settings[i].note != NULL)
|
||||
if(!settings[i].note.empty())
|
||||
{
|
||||
str = str + " (" + settings[i].note + ")";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
struct GSSetting
|
||||
{
|
||||
uint32 id;
|
||||
const char* name;
|
||||
const char* note;
|
||||
std::string name;
|
||||
std::string note;
|
||||
};
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
|
||||
GSSetting GSSettingsDlg::g_renderers[] =
|
||||
{
|
||||
{0, "Direct3D9 (Hardware)", NULL},
|
||||
{1, "Direct3D9 (Software)", NULL},
|
||||
{2, "Direct3D9 (Null)", NULL},
|
||||
{3, "Direct3D10/11 (Hardware)", NULL},
|
||||
{4, "Direct3D10/11 (Software)", NULL},
|
||||
{5, "Direct3D10/11 (Null)", NULL},
|
||||
{12, "Null (Software)", NULL},
|
||||
{13, "Null (Null)", NULL},
|
||||
{0, "Direct3D9 (Hardware)", ""},
|
||||
{1, "Direct3D9 (Software)", ""},
|
||||
{2, "Direct3D9 (Null)", ""},
|
||||
{3, "Direct3D%d ", "Hardware"},
|
||||
{4, "Direct3D%d ", "Software"},
|
||||
{5, "Direct3D%d ", "Null"},
|
||||
{12, "Null (Software)", ""},
|
||||
{13, "Null (Null)", ""},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_interlace[] =
|
||||
{
|
||||
{0, "None", NULL},
|
||||
{0, "None", ""},
|
||||
{1, "Weave tff", "saw-tooth"},
|
||||
{2, "Weave bff", "saw-tooth"},
|
||||
{3, "Bob tff", "use blend if shaking"},
|
||||
|
@ -50,19 +50,19 @@ GSSetting GSSettingsDlg::g_interlace[] =
|
|||
|
||||
GSSetting GSSettingsDlg::g_aspectratio[] =
|
||||
{
|
||||
{0, "Stretch", NULL},
|
||||
{1, "4:3", NULL},
|
||||
{2, "16:9", NULL},
|
||||
{0, "Stretch", ""},
|
||||
{1, "4:3", ""},
|
||||
{2, "16:9", ""},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_upscale_multiplier[] =
|
||||
{
|
||||
{1, "1x (Use D3D internal Res)", NULL},
|
||||
{2, "2x", NULL},
|
||||
{3, "3x", NULL},
|
||||
{4, "4x", NULL},
|
||||
{5, "5x", NULL},
|
||||
{6, "6x", NULL},
|
||||
{1, "1x", "Use D3D internal Res"},
|
||||
{2, "2x", ""},
|
||||
{3, "3x", ""},
|
||||
{4, "4x", ""},
|
||||
{5, "5x", ""},
|
||||
{6, "6x", ""},
|
||||
};
|
||||
|
||||
GSSettingsDlg::GSSettingsDlg( bool isOpen2 )
|
||||
|
@ -113,7 +113,11 @@ void GSSettingsDlg::OnInit()
|
|||
|
||||
for(size_t i = 0; i < countof(g_renderers); i++)
|
||||
{
|
||||
if(i >= 3 && i <= 5 && !isdx11avail) continue;
|
||||
if(i >= 3 && i <= 5)
|
||||
{
|
||||
if(!isdx11avail) continue;
|
||||
g_renderers[i].name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "10" : "11");
|
||||
}
|
||||
|
||||
renderers.push_back(g_renderers[i]);
|
||||
}
|
||||
|
|
|
@ -44,5 +44,6 @@ public:
|
|||
|
||||
static void* GetDX9Proc( const char* methodname );
|
||||
static bool IsDirect3D11Available();
|
||||
static bool HasD3D11Features();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue