Resetting window after using DirectX 11

1.8k views Asked by At

I've written an application that can switch between OpenGL, DirectX 9 and DirectX 11 for rendering without restarting or recreating the window. Switching between OpenGL and DirectX 9 as well as to DirectX 11 mode works well, however, after using DirectX 11 no other rendering mode works any longer.

After releasing all DirectX 11 interfaces, the window still shows the last rendered frame, it is even properly updated when resizing the window. A DirectX 9 device can be created and the Present calls succeed, however, all I see is the last frame drawn by DirectX 11.

I’ve used IDXGIDebug::ReportLiveObjects to make sure all DirectX 11 interfaces have actually been released. I’ve also tried IDXGIFactory::MakeWindowAssociation, but it didn’t fix the issue.

Why is the last frame repainted, who repaints it? How do I get rid of it and restore the original behavior of the window.

By the way, creating a new window would be a workaround, but I would like to use the same window for DirectX 9/11 and OpenGL.

1

There are 1 answers

2
Peter Wimmer On BEST ANSWER

The reason for the problem is DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. http://msdn.microsoft.com/en-us/library/windows/desktop/hh706346(v=vs.85).aspx says

When you use the flip model, only Direct3D content in flip model swap chains that the runtime passes to DWM are visible. The runtime ignores all other bitblt model Direct3D or GDI content updates.

That explains why I don't get any output using DirectX 9 after using DirectX 11 in flip sequential mode.