How to debug DirextX on Windows 10 Mobile

Another one of these little ‘gotchas’. Morten asked the question why he couldn’t debug DirectX on mobile, but it was possible on desktop and the IOT version of windows 10. I am not a DirectX expert at all, but this was weird. So I asked around internally what was going on.

First, if you want to do this on Desktop you need to install the graphics tools as an additional feature before you can do this.

This is something you need to do for Mobile as well, although it happens a bit different. You can do that by hitting ALT-F5 in Visual Studio or use the menu:

image

btw, you can also use ALT-F5 on desktop and make Visual Studio install the graphic tools for you.

After that you will be able to debug. The following line will return true instead of false:

HRESULT hr = D3D11CreateDevice(
                     nullptr,
                     D3D_DRIVER_TYPE_NULL,       // There is no need to create a real hardware device.
                     0,
                     D3D11_CREATE_DEVICE_DEBUG,  // Check for the SDK layers.
                     nullptr,                    // Any feature level will do.
                     0,
                     D3D11_SDK_VERSION,          // Always set this to D3D11_SDK_VERSION for Windows Store apps.
                     nullptr,                    // No need to keep the D3D device reference.
                     nullptr,                    // No need to know the feature level.
                     nullptr                     // No need to keep the D3D device context reference.
                     );