jyheng
jyheng

Reputation: 23

"Direct3D Feature Level 11 unsupported." under the environment of Win7 + VS2010

I have just started learning D3D recently. I have setup my environment in accordance with the online tutorial I am following, but there was a problem when I ran the Chapter 6 BOX source of Luna's book about DX11.

I get the following dialog box when running ("Direct3D Feature Level 11 unsupported.")

The code segment of the problem:

D3D_FEATURE_LEVEL featureLevel;
HRESULT hr = D3D11CreateDevice(
        0,                 // default adapter
        md3dDriverType,
        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);
    return false;
}

I found a similar problem on the stackoverflow (Two problems while initializing Directx 11.0 - 1.FeatureLevel, 2. 4xMSAA quality), but the answers do not solve my problem. I have updated my graphics driver.

I've used the DxDiag tool and the results are as follows:

dxdiag

Upvotes: 2

Views: 1948

Answers (2)

Chuck Walbourn
Chuck Walbourn

Reputation: 41077

Windows 7 includes the DirectX 11 API, but that doesn't mean you have a DirectX 11 capable piece of video hardware. DirectX 11 (the API) supports a range of video hardware that are arranged into Direct3D hardware feature levels. Just because your current driver/card doesn't support 11.0, it may support 10.1 or 10.0 which has many (but not all) the same features.

On Windows 8 or later, there are additional feature levels beyond 11.0 you can request. By default, if you pass nullptr to the default feature level array, it will only return 9.1, 9.2, 9.3, 10.0, 10.1, or 11.0.

Note that on Windows 7 Service Pack 1, the DirectX 11.1 Runtime can be installed but it does not support the newer driver model. Therefore, you can't use Direct3D hardware Feature Level 11.1--these cards all support 11.0 so you can fallback to that. See DirectX 11.1 and Windows 7. DirectX 11.2 and beyond are not available for Windows 7.

Frank Luna's source assumes you have a 11.0 capable video card for simplicity, but you can still do many things with an older card. See Anatomy of Direct3D 11 Create Device for details on how to create a device with a range of feature levels.

Alternatively, you can get a newer video card.

As you are new to DirectX development, be sure to read Book Recommendations for notes on some aspects of Luna's book that were out-of-date shortly after the print date of the book. You may also want to look at the DirectX Tool Kit tutorials.

Finally, consider moving to a more recent version of Visual Studio. At this point, most of the modern DirectX supporting libraries won't build with VS 2010 as it only had a few C++11 draft language features implemented. You should take a look at using VS Community edition which is free as long as you meet the license requirements.

Upvotes: 1

MuertoExcobito
MuertoExcobito

Reputation: 10039

Just because your graphics drivers are up to date, does not mean that they support the D3D_FEATURE_LEVEL_11_0. It's unclear which video card you actually have from your DxDiag, but the default specs for the HP 3005 MT show the best available card as the Nvidia 315, and it only supports DirectX 10.1.

At stated in the documentation for D3D11CreateDeivce:

If pFeatureLevels is set to NULL, this function uses the following array of feature levels:

{ D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1, };

Meaning that the function will succeed if any of these feature levels is supported by your device (it will attempt them in order). Likely, it's giving you a device where featureLevel is D3D_FEATURE_LEVEL_10_1 (or lower, depending on the actual card). Time to buy a new video card.

Upvotes: 0

Related Questions