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:
DXGI ERROR: No target window specified in DXGI_SWAP_CHAIN_DESC, and no window associated with owning factory. [ UNKNOWN ERROR #7: ]
PIX: IDXGIFactory2::CreateSwapChainForHwnd returned 887a0001
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 the OutputWindow
specified 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:
04246c83()
[Frames below may be incorrect and/or missing]
dxgi.dll!CDXGIFactory::CreateSwapChainForHwndImpl(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC_INTERNAL *,bool,struct IDXGIOutput *,struct IDXGISwapChain1 * *)
dxgi.dll!CDXGIFactory::CreateSwapChain(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *)
VsGraphicsHelper.dll!CHookedIDXGIFactory::CreateSwapChain(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *)
VsGraphicsHelper.dll!CSpyHookedIDXGIFactory::CreateSwapChain(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *)
d3d11.dll!_D3D11CreateDeviceAndSwapChain@48()
VsGraphicsHelper.dll!CHookedD3D11Top::D3D11CreateDeviceAndSwapChain(struct IDXGIAdapter *,enum D3D_DRIVER_TYPE,struct HINSTANCE__ *,unsigned int,enum D3D_FEATURE_LEVEL *,unsigned int,unsigned int,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *,struct ID3D11Device * *,enum D3D_FEATURE_LEVEL *,struct ID3D11DeviceContext * *)
VsGraphicsHelper.dll!CSpyHookedD3D11Top::D3D11CreateDeviceAndSwapChain(struct IDXGIAdapter *,enum D3D_DRIVER_TYPE,struct HINSTANCE__ *,unsigned int,enum D3D_FEATURE_LEVEL *,unsigned int,unsigned int,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *,struct ID3D11Device * *,enum D3D_FEATURE_LEVEL *,struct ID3D11DeviceContext * *)
Win32ProjectScratch.exe!Direct3DWindowBase::CreateDeviceResources() Line 363
...
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 first Present()
if you are using a DXGI 1.0 factory (CreateDXGIFactory()
vs. CreateDXGIFactory
1()
):
D3D11: ERROR: ID3D11Device::CreateTexture2D: D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX is only available for devices created off of Dxgi1.1 factories or later. [ STATE_CREATION ERROR #103: CREATETEXTURE2D_INVALIDMISCFLAGS ]
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