无法初始化Direct3D VS 2015(Win 10)

时间:2015-11-09 17:54:46

标签: c++ directx windows-10 directx-11

我正在关注rastertek.com上的DirectX 11系列2教程。目前我正在使用教程3(初始化DirectX),并且由于某种原因,当我运行程序时,CreateDeviceAndSwapChain函数会一直失败。我已按照步骤链接Windows 10 SDK库并从此处包含到项目(rastertek.com/dx12tut01.html),我的GPU是Nvidia 780 Ti。我也尝试过他的预编译.exe工作正常。有什么问题?如果需要截图,请告诉我们!

//enable debug mode
UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;

#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif 

//create the swap chain, d3d device, and d3d device context
result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, &featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain, &m_device, NULL, &m_deviceContext);
if (FAILED(result)) {
    return false;
}

1 个答案:

答案 0 :(得分:0)

嗯,在我的情况下,我有一台笔记本电脑,英特尔4400和geforce 840m(使用win10 + visual studio 2015),我手动将featureLevel设置为11.1,结果知道英特尔支持该功能级别,但是geforce支持最高11.0。无论如何,它仍然不清楚你的问题是什么,错误信息是什么,或者其他什么,所以你可以尝试降低功能级别,将0作为标志传递。