本文介绍了使用DirectX 11后重置窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个可以在OpenGL,DirectX 9和DirectX 11之间切换以进行渲染而无需重新启动或重新创建窗口的应用程序.在OpenGL和DirectX 9之间以及在DirectX 11模式之间进行切换效果很好,但是,在使用DirectX 11之后,其他渲染模式将不再起作用.

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.

释放所有DirectX 11接口后,窗口仍显示最后渲染的帧,甚至在调整窗口大小时也可以正确更新.可以创建DirectX 9设备并且Present调用成功,但是,我所看到的只是DirectX 11绘制的最后一帧.

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.

我使用了IDXGIDebug :: ReportLiveObjects来确保所有DirectX 11接口均已实际发布.我也尝试了IDXGIFactory :: MakeWindowAssociation,但无法解决问题.

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.

顺便说一句,创建一个新窗口将是一种解决方法,但是我想对DirectX 9/11和OpenGL使用相同的窗口.

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.

推荐答案

问题的原因是DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. http://msdn.microsoft. com/en-us/library/windows/desktop/hh706346(v = vs.85).aspx

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

在使用翻转模型时,只有运行时传递给DWM的翻转模型交换链中的Direct3D内容可见.运行时将忽略所有其他bitblt模型Direct3D或GDI内容更新.

这说明了为什么在翻转顺序模式下使用DirectX 11后为什么我没有使用DirectX 9输出任何信息.

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

这篇关于使用DirectX 11后重置窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 23:41