简体   繁体   中英

DirectX 11 not working, but 10 is?

First off, according to dxdiag, I have DirectX version 11. However, I'm going through a tutorial (rastertek.com) and while initializing my directx device (specifically the D3D11CreateDeviceAndSwapChain function), it returns an error (therefore the program gets stopped). On the above site, there are both tutorials for D11 and D10, and, as previously stated, the D11 version won't work, however the D10 version does work. So I don't get why even though I have DX version 11, the program fails.

Here's where the program returns an error:

result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1, 
                       D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain, &m_device, NULL, &m_deviceContext);

You can see where all of these variables come from at http://www.rastertek.com/dx11tut03.html , it's a little bit more than 1/3 down the page.

I have seen other problems with this function in other forums (and what they do doesn't help me), as well as msdn which says if the first parameter is non-null, set the second parameter to D3D_DRIVER_TYPE_UNKNOWN, which still doesn't make a difference.

Any enlightenment on this problem is greatly appreciated! Thanks!!

As requested:
dxdiag only shows which version of DirectX is installed on the system, but that does not mean that the hardware really does support it.
Therefore it is possible that dxdiag shows DirectX 11 while the hardware only supports up to DirectX 10, which will cause DirectX11 only code to fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM