Erik McClure

The New Discord Overlay Breaks GSync and Borderless Optimizations


The new discord overlay no longer uses DLL injection, and is instead a permanent HWND_TOPMOST window glued to whatever window it happens to think is a game. Ignoring the fact that discord seems to think FL Studio, the minecraft launcher, and SteamVR’s desktop widget are “video games”, the real problem is that this breaks the Borderless Windowed Optimizations, which has the most obvious effect of disabling GSync/FreeSync on all games that the overlay enables itself on.

so it seems it also yoinks gsync, which means the game running underneath doesn't use gsync anymore. Wonderful!

— Tawmy (@tawmy.dev) March 29, 2025 at 11:45 AM

We can tell that it’s a normal window instead of DLL injection by simply finding the window in the win32 UI tree using inspect.exe:

Discord Overlay Window

Interestingly, they still seem to be using a D3D window to render the overlay. This might be a quirk of using Electron, or it might be a result of whatever library they’re using to render the overlay:

Intermediate D3D sibling window?

The reason this breaks everything is because the borderless windowed optimization works using a new flip model called the DXGI flip model. Instead of copying the contents of the backbuffer to another intermediate buffer used by the desktop for compositing, the compositor can use the backbuffer directly when it is compositing. This flip model was augmented in Windows 10 with Direct Flip, which allows this shared surface to bypass the compositor entirely and send frames to the monitor directly:

Depending on window and buffer configuration, it is possible to bypass desktop composition entirely and directly send application frames to the screen, in the same way that exclusive fullscreen does.

All modern gaming is built on top of this key optimization, because it allows seamless Alt-Tab behavior by allowing the DWM compositor to “wake up” and start compositing the screen like a normal application, then “go to sleep” once it knows a single borderless fullscreen application is the only thing rendering to that monitor, by simply piping it’s backbuffer directly to the device. If a combination of DXGI_FEATURE_PRESENT_ALLOW_TEARING and the right VSync mode is enabled, the app can update it’s backbuffer completely out-of-band from the rest of the desktop compositor, which is the only thing that allows GSync/FreeSync to work, as the monitor must sync it’s own refresh rate to whenever the game happens to complete a frame.

If any part of this pipeline is disrupted, it is no longer possible to forward frames to the monitor outside the normal update sequence of the compositor. Many things can break this, like not turning on optimizations for windowed games or having windows fail to recognize something as a game. If the vsync mode is set up wrong, it will break. If the flip mode is wrong, it will break. And most importantly, if even a single pixel of another app is displayed over the game, then in order to display that pixel, the compositor has to composite the window outputs together onto a secondary buffer, which must then be presented at the native refresh rate of the monitor because it has inputs from two different programs at different refresh rates, thus breaking GSync/FreeSync. It will also introduce additional frames of lag even if you don’t use GSync/FreeSync, which you may have noticed when a notification pops up while playing a game and it suddenly felt laggy until the notification went away.

DLL Injection was originally used for in-game overlays because games often used exclusive fullscreen. The drawback of DLL injection is that it crashes games when implemented incorrectly and also makes virus scanners very unhappy. With the new flip models, games don’t need to ask for exclusive fullscreen to get low latency, but they still have to be the only thing on the screen or it doesn’t work. Discord has either ignored why DLL injection was originally used, or decided that the drawbacks of DLL injection aren’t worth it and instead simply broken all the optimizations for windowed games that Microsoft introduced. Any half-decent graphics programmer would know this would happen, so it’s obvious that one of two things happened:

  1. Discord never involved a single graphics dev or gamedev with any experience in how games work about how their new overlay for games would interact with games.
  2. There is a very angry dev stalking the halls of discord HQ right now, cursing at the shadows because she knew. SHE KNEW. SHE WARNED THEM. BUT THEY DIDN’T LISTEN. Her manager probably ignored her warnings, or overruled them, saying “most gamers won’t even notice” or “DLL Injection has too many problems”. And now, if she shares this article with said manager, her manager will look bad and probably try to fire her for the crime of being competent, because that’s how big corporations work.

Usually I default to option (2), but option (1) is also possible if they already laid off the person who knew this would happen last year. But hey, if you are a graphics dev at discord who tried to warn your managers about this trashfire and you got “laid off” under mysterious circumstances, send me a DM on bluesky, I’m always interested in talking to actual competent engineers.

If the new overlay was turned on without your consent (which is what happened to me), you can turn it off again by going to User Settings → Activity Settings → Game Overlay → Enable Overlay. Be careful though, because flipping this option off has crashed the video drivers for two of my friends so far, requiring a full reboot. If you want to uninstall Discord, you can do so from Add/Remove programs, but good luck finding another chat app your friends actually want to use.


Avatar

Archive

  1. 2025
  2. 2024
  3. 2023
  4. 2022
  5. 2021
  6. 2020
  7. 2019
  8. 2018
  9. 2017
  10. 2016
  11. 2015
  12. 2014
  13. 2013
  14. 2012
  15. 2011
  16. 2010
  17. 2009