问题
1.I'm learning the initialization part of D3D through the book Introduction to 3D Game Programming with DirectX 11. When I compile and run the code on the book I got a message from VS2012 which says "Direct3D Feature Level 11 unsupported",which indicates my machine successfully creates the device but doesn't support Directx 11. here is the actual code:
UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_FEATURE_LEVEL featureLevel;
ID3D11Device* md3dDevice;
ID3D11DeviceContext* md3dImmediateContext;
HRESULT hr = D3D11CreateDevice(
0, // default adapter
D3D_DRIVER_TYPE_HARDWARE,
0, // no software device
createDeviceFlags,
0, 0, // default feature level array
D3D11_SDK_VERSION,
&md3dDevice,
&featureLevel,
&md3dImmediateContext);
if( FAILED(hr) )
{
MessageBox(0, L"D3D11CreateDevice Failed.", 0, 0);
return false;
}
if( featureLevel != D3D_FEATURE_LEVEL_11_0 )
{
MessageBox(0, L"Direct3D Feature Level 11 unsupported", 0, 0);
}
but I've checked several times in dxdiag and been told Directx version is Directx 11.0.I've checked as many possibly relevant answers as I can but those solutions I found such as installing Direct X Runtime and remote windows debugger tool but they didn't work. My OS is Win7-64bit, IDE is vs2012 using C++, Directx SDK is DXSDK_Jun10;
2.This problem follows the first one when I check the 4xMsaa quality level by the following code and turns out m4xMsaaQuality is 0:
UINT m4xMsaaQuality;
md3dDevice->CheckMultisampleQualityLevels(
DXGI_FORMAT_R8G8B8A8_UNORM, 1, & m4xMsaaQuality);
assert(m4xMsaaQuality > 0 );
I just know it is a result of unsupported combination of format and sample count, but I'm not aware of why it happens. When I playing video games I can turn both Directx 11 and 4X MSAA on without any obstacles. Hope someone can get me some help and I'll keep an eye on this question.
回答1:
I post this based on my experience and it's just a hunch but let me guess: You have an integrated Intel graphics card and a regular DX11 compatible GPU.
The problem could be caused by your application choosing a weaker GPU by default. If it's the case try forcing the system to always use your better GPU. I don't know what hardware you're running but games normally are programmed to always use the best GPU available. Custom applications however tend to choose an energy-efficient GPU because it's default when just running windows. You should have some GPU control panel where you can switch GPU usage preferences.
回答2:
The problem is quite obvious, you are checking if your GPU supports Samples=1 and Quality=4. Quality here refers to the AA technique which is "vendor dependent". Usually MSAA is specified with Quality=1. MSAA 4X is ofcourse Samples = 4 Quality = 1. See https://msdn.microsoft.com/en-us/library/windows/desktop/ff476499%28v=vs.85%29.aspx
来源:https://stackoverflow.com/questions/26035897/two-problems-while-initializing-directx-11-0-1-featurelevel-2-4xmsaa-quality