5

I am developing a directX 11 application. I am using IDXGIFactory2::CreateSwapChainForHwnd to create the swap chain after creating the DX11 device. The DX11 code is in an object that gets destroyed then re-created to render another video stream to the same HWND (window handle).

On the first run of the application IDXGIFactory2::CreateSwapChainForHwnd succeeds no problem. Then the application destroys the object with the DX11 code which destroys the DX11 device and swapchain etc. It goes to re-init the DX11 code again with the same HWND and this time IDXGIFactory2::CreateSwapChainForHwnd FAILS with E_ACCESSDENIED.

I have read the MSDN documentation that says there is a problem with differed destruction when changing swap chains. Here:

http://msdn.microsoft.com/en-us/library/windows/desktop/ff476425(v=vs.85).aspx#Defer_Issues_with_Flip

I tried to implement the suggested workaround to force the destruction of the objects:

D3D11Context->ClearState();
D3D11Context->Flush();

But IDXGIFactory2::CreateSwapChainForHwnd still returns E_ACCESSDENIED.

Does anyone have any insight as to why this could be happening? Thanks!

breakc0de
  • 83
  • 1
  • 6
  • Have you tried using the DirectX Control Panel to enable debug output, and then running it a Debug build and reading through the console output? The DirectX Debugging logs are usually very informative and often suggest a fix – axon Dec 13 '13 at 00:45
  • That actually was very helpful. Thanks I was able to use the control panel to figure out my bug. – breakc0de Jan 07 '14 at 23:14
  • It turns out an object I thought was being freed up was not being freed after calling DXGI EnumAdapters call. – breakc0de Jan 07 '14 at 23:22
  • 1
    For those looking for the DirectX Control Panel, run `dxcpl.exe` from the Run dialog. – Nathan Kidd Nov 22 '16 at 20:28

0 Answers0