D3D11_CREATE_DEVICE_DEBUG debug flag doesn't work


Good afternoon. In my project, I created a device with the D3D11_CREATE_DEVICE_DEBUG flag, but it still does not display error information. I get error 0x80070057, but the debug flag shows nothing, as if I haven't initialized it.

D3D11CreateDevice(nullptr, DriverTypes[DriverTypeIndex], nullptr, D3D11_CREATE_DEVICE_DEBUG, FeatureLevels, NumFeatureLevels,
            D3D11_SDK_VERSION, &pD3DDev, &FeatureLevel, &pCtx);
asked on Stack Overflow Oct 29, 2020 by user14487311

2 Answers


According to the document for D3D11CreateDevice function, in order to use D3D11_CREATE_DEVICE_DEBUG flag, you must have D3D11*SDKLayers.dll installed. It can be obtained through the Windows SDK.

answered on Stack Overflow Oct 29, 2020 by Brian Vu

You must have Windows SDK. If you can compile the code, you likely have it.

To view the debug output from the D3D debug runtime, you must run your app with debugger attached.

And not just any debugger. If your app has components written in .NET, visual studio has 2 distinct debuggers, managed and native. Managed debugger doesn’t listen to these OutputDebugString events, you must run with native debugger attached. If your startup project is .NET, right click on the startup project, Debug tab, check “Enable native code debugging”.

P.S. I wonder why are using an array for driver types? In almost 100% of cases, the only reasonable value to pass there is D3D_DRIVER_TYPE_HARDWARE

answered on Stack Overflow Oct 29, 2020 by Soonts

User contributions licensed under CC BY-SA 3.0