Windows fullscreen DPI scaling

I’ve been working on our fullscreen windows on the Windows 10 OS, and have found that the ChaingeDisplaySettings() feature always works with the actual real pixel resolution. Unfortunately, CreateWindowEx does not, which makes things kind of funny. For example:

  • I change the screen resolution to 800x600.
  • The DPI scaling is set to 125%.
  • To cover the screen, I have to create a window that is sized 1000x750,
  • Now I am working with a swap chain that has 67% more pixels.
  • As a result, our application runs slower when the DPI scaling is increased, even though the same screen resolution is used. and the result looks exactly the same. More pixels are being rendered and the the image is being compressed down to the screen resolution.

What is the correct way to deal with this? I ran some tests on DOOM 2016 and it seems like id found a way to solve this, because I did not see any difference in performance when I changed the DPI scaling.

IIRC, you just mark your app as DPI aware in compatibility props, and pixels become pixels again. Then your app becomes responsible for using the DPI value (or ignore it), instead of windows doing it for you by scaling.

1 Like

Okay, I found this manifest file, compiled it into the program, and it seems to make the problem go away. (Calling SetProcessDPIAware() was not sufficient.)

<?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
    </application>
  </compatibility>

  <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <asmv3:windowsSettings
         xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>True/PM</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>

</asmv1:assembly>
1 Like