为什么Direct3D应用程序在全屏模式下表现更好? [英] Why Direct3D application performs better in full screen mode?

查看:185
本文介绍了为什么Direct3D应用程序在全屏模式下表现更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与窗口模式相比,在全屏模式下Direct3D应用程序的性能似乎要好得多。造成这种情况的技术原因是什么?

The performance of a Direct3D application seems to be significantly better in full screen mode compared to windowed mode. What are the technical reasons behind this?

我想这与全屏应用程序可以独占显示权有关。但是,为什么应用程序无法获得屏幕(即窗口)的部分的排他控制权,并且具有相同的性能优势?

I guess it has something to do with the fact that a full screen application can gain exclusive control for the display. But why the application cannot gain exclusive control for part of the screen (i.e. window) and have the same performance benefits?

推荐答案

以下是有关事物在下面如何工作的说明。

Here are the cliff notes on how things work underneath.

监视器屏幕始终需要与所谓的主表面关联才能显示任何内容,即视频卡只能从显存中的一个表面扫描出去。

Monitor screen always needs to be associated with so-called primary surface to be able to display anything, i.e. videocard can only scan out of one surface in video memory.

当应用程序为全屏(并且所有设置均已正确设置以启用翻转)时,主表面只是应用程序的一个后备缓冲区,并且每帧翻转到另一个后备缓冲区。这是在屏幕上显示的最有效方法,但是它需要应用程序拥有整个监视器区域(即整个主表面)。

When application is fullscreen (and everything was set up correctly to enable flipping), primary surface is just one of the application backbuffers, and flipped to another backbuffer every frame. It is the most efficient way of presenting on the screen, but it requires application to own the entire monitor area (i.e. entire primary surface).

当没有全屏应用程序且DWM已关闭,主表面归OS所有,每个窗口化应用程序都执行从应用程序后缓冲区到主表面的冲突。这种锯齿处理需要一些GPU时间(以及屏幕上可见的其他应用程序的锯齿处理),因此它不如全屏演示有效。 XP是这样工作的。

When there's no fullscreen application and DWM is off, primary surface is owned by OS, and every windowed application performs a blit from application backbuffer to a primary surface. This blit takes some GPU time to complete (as well as blits from the other applications visible on the screen), so it's not as efficient as fullscreen presentation. XP worked that way.

当DWM组成屏幕时,事情变得更加复杂。
在这里,DWM拥有主曲面,需要在那里绘制应用程序窗口。为了使之成为可能,每个窗口都有一个关联的表面来保存其内容,该表面称为重定向表面(DWM允许DWM启用窗口重影,玻璃效果以及所有这些好东西)。每次D3D应用程序发布框架时,都会在重定向表面添加blit。
这样,就需要进行几次blit:应用程序将blit重定向到重定向表面,DWM将blit从重定向表面映射到主表面,这又比全屏显示要高一些。

When DWM is composing the screen, things get even more complicated. Here, DWM owns the primary surface and needs to draw application windows there. To make it possible, every window has an associated surface holding its contents, called redirection surface (which allows DWM to enable window ghosting, glass effects, and all that good stuff). Every time D3D application issues a frame, it adds a blit to a redirection surface. That way, several blits need to happen: blit to a redirection surface by the app, blit from a redirection surface to the primary by DWM, which is, again, some overhead compared to fullscreen.

请注意,所有其他工作都在GPU上,因此它不会影响CPU性能。

Note all of that additional work is on the GPU, so it doesn't affect CPU performance.

需要进一步阅读的内容:

Stuff to read further:

http ://blogs.msdn.com/greg_schechter/archive/2006/03/19/555087.aspx

http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx

http://blogs.msdn.com/greg_schechter/archive/2006/03/05/544314.aspx

这篇关于为什么Direct3D应用程序在全屏模式下表现更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆