I was super happy when the “Graphics Debugger” feature was announced for Visual Studio 11, I immediately attempted to get it working on various projects I had, unfortunately I’ve only managed to get it working for Windows 8 Metro applications! Specifically the C++ Metro project templates run and capture all expected information correctly.
With Developer Preview versions of Visual Studio, and on Windows 7, any attempt to launch applications under the Graphics Debugger (Alt-F5) crash on D3D11CreateDeviceAndSwapChain(), even if they work fine. On my Visual Studio 11 Beta on Windows 8 Consumer Preview machine at work, I get a bit further, the Graphics Debugger HUD displays correctly, but any attempt at getting a capture (Print Screen in the app, or the toolbar button) simply results in a message (in the Output log and a yellow bar at the top of the opened .vsglog):
The Graphics Diagnostics engine couldn’t provide the results, most likely because the vsglog is making DirectX calls not supported on this machine.
This is even the case with directly porting the Direct3D calls from the Metro template applications! I don’t see any messaging from the MSDN documentation that this feature is only intended for Metro, so I expect I’m simply doing something stupid, but the applications work correctly when not under the Graphics Debugger.
Other information: D3D11_CREATE_DEVICE_DEBUG is set, with the DirectX control panel enabling Direct3D debugging, and I’m getting expected Create/Destroy informational messages and no other in Output.
Windows 8: A-ha! Through attaching another debugger to the graphics debugger host
VsGraphicsDesktopEngine.exe(found in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\VsGraphics\x86) and forcing Direct3D debugging through the DirectX Control Panel, I got the output:I thought that was pretty weird, since although I’m using CreateSwapChainForHwnd(), it uses DXGI_SWAP_CHAIN_DESC1, which doesn’t even have the field
OutputWindow. However I tried swapping my use of CreateSwapChainForHwnd() with CreateSwapChain() with theOutputWindowspecified and everything works!With further testing, I found any attempt at D3D11CreateDeviceAndSwapChain() fails, with a null adapter it runs, but captures give the bizzare "This Graphics Diagnostics engine doesn’t support D3D9. Playback of your application may be incomplete.", and with a specified adapter it crashes with this stack:
It seems only D3D11CreateDevice() followed by IDXGIFactory::CreateSwapChain() works – either by specifying an adapter or querying the device for it’s factory later.
Windows 7 has another gotcha: you have to use
D3D11CreateDevice()/IDXGIFactory::CreateSwapChain()still, but it also raises a DirectX debug layer error on the firstPresent()if you are using a DXGI 1.0 factory (CreateDXGIFactory()vs.CreateDXGIFactory1()):If you have the debug layer "break on severity" option turned on (which in general, you should), this will raise an exception in the debugger, making it look like another crash, however it is safely continuable – however you don’t get the VS Graphics Debugger HUD, and the object table window has broken content. On the other hand, if you follow it’s advice and use a DXGI 1.1 factory, you get a real crash in Present().
In summary, it seems the graphics debugger isn’t quite fully baked yet!
Props to @MrGomez for the idea to debug the debugger