Resetting window after using DirectX 11

。_饼干妹妹 提交于 2020-01-01 14:22:48

问题


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:


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.



来源:https://stackoverflow.com/questions/20647359/resetting-window-after-using-directx-11

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!