Failed to create Direct3D11 device in D3D11RenderSystem::D3D11RenderSystem

188 views Asked by At

i have run into a problem about using Ogre-sdk,My system is win10,VisualStudio and GTX1660. When i download the SDK and run the SampleBrowser.exe it works well, then i complie from the source it works as well. But after some simple operate(i don't know), i'm runing into this error. even if i download a new one. my problem

I would like to know how to solve it, Any help here would be much appreciated!!

1

There are 1 answers

0
jituan On
// create device
    ID3D11DeviceN* device = NULL;
    HRESULT hr = D3D11CreateDeviceN(pAdapter, driverType, NULL, deviceFlags, pFirstFL, pLastFL - pFirstFL + 1, D3D11_SDK_VERSION, &device, pFeatureLevel, 0);

    if(FAILED(hr) && 0 != (deviceFlags & D3D11_CREATE_DEVICE_DEBUG))
    {
        StringStream error;
        error << "Failed to create Direct3D11 device with debug layer (" << hr << ")\nRetrying without debug layer.";
        Ogre::LogManager::getSingleton().logMessage(error.str());

        // create device - second attempt, without debug layer
        deviceFlags &= ~D3D11_CREATE_DEVICE_DEBUG;
        hr = D3D11CreateDeviceN(pAdapter, driverType, NULL, deviceFlags, pFirstFL, pLastFL - pFirstFL + 1, D3D11_SDK_VERSION, &device, pFeatureLevel, 0);
    }
    if(FAILED(hr))
    {
        OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, "Failed to create Direct3D11 device", "D3D11RenderSystem::D3D11RenderSystem");
    }

Hi, the function is as above.