Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Direct3D application performs better in full screen mode?

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?

like image 654
smt Avatar asked Nov 20 '08 08:11

smt


People also ask

What is d3d fullscreen?

Direct3D applications can run in either of two modes: full-screen or windowed. Full-screen mode means the window that the application runs in covers the entire desktop, hiding all running applications (including your development environment).

What is the use of fullscreen mode?

Full screen mode allows you to watch videos that take up your entire screen.

What is Fullscreen exclusive?

Full-Screen Exclusive Mode. Full-screen exclusive mode is a powerful new feature that enables you to suspend the windowing system so that drawing can be done directly to the screen. Display Mode. This section describes how to choose and set the display mode.

How do I make Windows 10 full screen?

The easiest way to go full screen in an application or a game is to use the Alt + Enter keyboard shortcut. This method works for most games and apps unless they use it to enable other features. The shortcut is also used to switch from full-screen mode to windowed.


3 Answers

There's a bit on MSDN that says full screen mode uses buffer flipping, if set up correctly, as opposed to blitting. It makes sense.

Of course you can (and in a way, do) give exclusive control for part of the screen to an application, but what happens to the rest of the screen? You still have to blit, do occlusion checking, etc. on the rest of the windows, and I think that's what causes the performance hit.

like image 40
aib Avatar answered Oct 12 '22 20:10

aib


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).

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.

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.

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

like image 103
Simon Kozlov Avatar answered Oct 12 '22 21:10

Simon Kozlov


I'll add to @aib's answer that the rest of the screen is being managed by the OS. So, if anything else needs to be drawn/worked upon simultaneously, there has to be a performance hit.

For example, if you have a video playing in Windows Media Player in one window, then start Civilization in another, when Civ starts doing its fancy graphics, it will need to share screen space with everything else (like the video.

Whereas if the DirectX app has the full-screen, everything else might be "updating" or "playing", but not being drawn.

like image 5
warren Avatar answered Oct 12 '22 19:10

warren