9
\$\begingroup\$

I have a D3D11 application, and I want to add proper fullscreen suport. Now I can let DXGI switch my window to fullscreen for me, and I'm under the impression that DXGI will take care of everything needed to make the swap chain flip front and backbuffer instead of blitting them.

However, letting DXGI perform the swich seems unreliable with a multi monitor setup - secondary screens stay entirely black after the switch a great deal of the time, with no apparent reason or pattern to it.

It can take a few times switching back and forth before I get the fullscreen window and the rest of the desktop being shown on the other screens.

Apparently I'm not alone with this, Battlefield 3 and WoW seem to have similar issues for a lot of people.

Now, the actual question: I guess since even those AAA game dev companies can't get this to work, my biggest hope would be to somehow perform the switch to fullscreen myself.

Is there anything I can do to elevate my window/swapchain into proper, buffer-flipping fullscreen mode?

\$\endgroup\$
1
  • \$\begingroup\$ At the time of this writing, the current version of World of Warcraft no longer has the display mode configuration issues/memory leaks you mentioned. They were certainly problematic but have been fixed as of 7.3.2 \$\endgroup\$
    – Gazer
    Nov 9, 2017 at 2:55

2 Answers 2

3
\$\begingroup\$

To my knowledge, the onlything that works is:

 DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);

at the start of your application and:

DwmEnableComposition(DWM_EC_ENABLECOMPOSITION);

before quitting. For the transitions, proceed as usual. I have tried InvalidateRect(NULL, NULL, true) just after switching to fullscreen to no avail. Hope this helps.

\$\endgroup\$
2
  • \$\begingroup\$ After trying everything, it seems you are correct. Only disabling composition reliably prevents this from happening. Not the answer I had hoped for, but better than nothing I suppose. \$\endgroup\$
    – user13213
    Feb 18, 2013 at 4:25
  • \$\begingroup\$ Note that Windows 8.1 and later ignores this setting. You can't disable DWM. \$\endgroup\$ Oct 20, 2015 at 17:24
1
\$\begingroup\$

You're indeed not the only one facing this issue. First thing to check: make sure you're using the latest/beta/top-notch drivers for the video card you're using.

Now, I'd say that there's only a small chance that you can get this working better than the automatic DXGI implementation. This kind of issue is highly dependent on the adapter vendor, driver version, and monitor configuration. So by fixing it on one machine you may end up breaking it on more.

I advise against returning to the dark ages of DirectX 9 where you had to do everything by hand. A better idea would be to try fixing the automatic switching. Some trails to follow:

  • Read the (sparse) documentation carefully.

  • If you're not doing it already, try to respond to the WM_SIZE event that you receive upon switching from/to full-screen, as described here. If you do so, make sure that you are properly releasing all references to the back buffer before calling ResizeBuffers, as described there. Failing to do so might cause this kind of weird semi-issues.

  • Try to start directly in full-screen, and to create your swap chain with one of the enumerated display modes. If this works all the time, this might mean that you're not using one of the enumerated display mode when handling WM_SIZE (or not entirely, things such as the refresh rate can be important).

  • Try mucking around with the swap effect and the buffer count of your swap chain description. You should probably be using DXGI_SWAP_EFFECT_SEQUENTIAL and a BufferCount >= 2. Maybe your driver has poor support for more "exotic" options.

\$\endgroup\$
2
  • \$\begingroup\$ Resizing the buffers works fine. I've also tried all the swap effects, they don't seem to make a difference, and I've always used 2 buffers. I would try the fullscreen thing, (even though I don't know what you mean by "using one of the enumerated display modes" - when responding to WM_SIZE all I do is ResizeBuffers, there is nowhere to pass a display mode as an argument) but I spontaneously installed windows 8 and guess what, I can't replicate the problem right now.. \$\endgroup\$
    – user13213
    Jan 25, 2013 at 19:55
  • \$\begingroup\$ Went back to windows7, and tried creating the swapchain in fullscreen from the start, but the issue persists. \$\endgroup\$
    – user13213
    Feb 18, 2013 at 4:23

You must log in to answer this question.