Wednesday, December 09, 2009

Full Screen or Windowed Mode

So...just between you and me and the blogosphere...X-Plane always runs in windowed mode.

Now if you are not a graphics programmer, do not panic. X-Plane does run full screen! "Full screen" means something very different to users vs. driver writers.
  • To users, full screen means "the application covers the entire screen." X-Plane does this!
  • To driver writers, full screen means "the application is the only thing using the screen, and because of this, we can optimize drawing." In other words, to nerds, full screen means taking exclusive control of a particular display.
Basically in "windowed" mode an application's 3-d rendering is copied to the screen per frame, while in full screen mode, the application draws directly to the screen, no copy.*

X-Plane doesn't use full screen mode - we simply make a window that is as large as the screen, with no decorations. Why did we decide to do this?
  1. Increased flexibility. Because we are always in windowed mode, we can resize, go between full screen and windowed mode, etc. without restarting or rebuilding our driver setup from scratch. This provides a user interface that responds to configuration immediately.
  2. No thrash with the window manager. Because we are a window, the user can fly x-plane with a third party add-on running on top of the window. (A few years ago this would have been a terrible idea, but window managers are getting a lot faster to the point where the performance penalty for an occluded window isn't as bad as it once was.)
  3. Less developer time. We already support ATI and NVidia on Mac, Windows and Linux - that's six configurations where something can go wrong. Add full screen and windowed mode and now it's twelve configurations.
  4. It is possible to run with the appearance of full screen across two monitors on a desktop. This is nice for users with dual-headed cards.
The downside is that we lose out on the framerate boost we'd get if we were full screen. Instead, a small amount of time must be spent copying the image to the screen when we finish drawing.

As it turns out, this amount of time has become trivially small. Going full screen might take us from 29.95 fps to 30 fps. Is it worth losing ease of support, ease of development, and ease of use for 0.05 fps? I don't think so.

(Note: on older cards, "copy" time does matter, particularly at huge resolutions. But with older cards you can't run at a huge resolution anyway without your framerate getting killed, so it's a bit moot.)

I think X-Plane is unusual in doing this - the norm for games that I have seen is to run full screen, which is why for most games you need hardware like the Matrox Triple-head to fly wtih two monitors.

* I suspect that if you require your back-buffer image to persist when flipped to the front buffer, then you take a performance hit anyway, but generally games do not want to rely on this.


  1. So what if you want to go fullscreen with a different resolution than the Desktop?

  2. Hi Jonathan,

    In that case, you change the monitor res, then you make the window big. :-)

  3. So then you don't get the performance boost of Crossfire? In that regard aren't you loosing out on about a 40% framerate boost? And what about Eyefinity!?

  4. Re: crossfire. Short answer is...I don't know. It's up to the driver to decide to do "clever things." I am still declaring a GL surface (even if it is a windowed surface) so I don't see any reason why in principle I don't get Crossfire. (It may be in practice that the driver can't recognize or optimize this case.)

    But then cross-fire assumes that your app doesn't have expensive synchronization, inter-frame dependencies, dependent texture renders, etc. In other words, this is just one of many possible issues.

    As a side note, I'm not a huge fan of Crossfire/SLI - they strike me as a way to charge the very highest-end users even more money, and the cases I've looked at for previous-generation high-end paired cards vs. the next generation high-end single card implies that CF/SLI don't deliver a very good value or an even remotely good long term proposition.

    Of course, my app is batch bound, not fill bound, so I might be the wrong person to ask!

  5. Hi Benjamin.

    I'm running x-plane 9.55 rc3, and have the "full screen" button *UN-checked*. Hovering the mouse over that button, says that the window is resizable by dragging the bottom right corner.

    Is it resizeable *smaller* than 1024x768 ? (which is what my screen/display settings is at).

    Clicking / dragging on the bottom right corner (after I moved the windows taskbar ;)) is not doing anything.