Thursday, December 29, 2022

The importance of reading documentation

Linux has a few great tools that allow people to game easier with better performance.

One of these very important tools is a program called gamescope. Gamescope does some very complex things, but to keep it easy for a layman, it runs your game and lies to it about how big your computer screen is. You can run a game in a normal window, instead of in fullscreen, and gamescope will tell the game that your computer is actually only a resolution of 1280x720, but output to a window the size of 1920x1080. This allows for a couple of interesting gaming hacks for better performance.

The main performance boost granted by gamescope is that it allows you to apply AMD FSR upscaling to any game. This is possible because the game thinks it is running in exclusive fullscreen, so FSR is able to treat the window as the screen and apply upscaling to it, so your game can run at a lower resolution but render out at a higher one. It also allows any game no matter how old to apply a framerate limiter as gamescope is able to lie about the refresh rate of the screen as well.

It is important to read the documentation though, as I used to think I was using gamescope on my system to help with performance, but found one very important requirement - you must run your game in fullscreen mode or else nothing will take effect. I run all of my programs in windowed mode so I can multitask easier while I play, and many games nowadays default to fullscreen-windowed instead of exclusive fullscreen, which was preventing gamescope from helping with performance. Only after a quick debugging session last night and some reading this morning did I rediscover this very important requirement. You will know gamescope is working because when you set your game to exclusive-fullscreen, the max offered (or only offered) fullscreen resolution should be your configured virtual nested resolution.

The second useful tool is mangohud, which displays frametimes and system info on top of any game (as long as it uses Vulkan). One very important note I found after reading the documentation is that: if you are using gamescope and mangohud, you must run gamescope first, and then use gamescope to run mangohud, and then use mangohud to run your game, like so:

$ gamescope ${gamescope_options} -- mangohud -- "$@"

If you do not apply things in this order, mangohud will cause gamescope to crash on startup. Also, do not use the gamescope option --steam outside of Steam, or else weird things will happen. You have been warned.

Using both of these tools together helps a system that is performance limited by its hardware use software to side step these constraints and gives a longer lifespan to the system. How fun, thanks Linux (and Valve)!

More code and stuff later next week.

Stay tuned!

========================
Follow pyamsoft around the Web for updates and announcements about the newest applications!
Like what I do?

Send me an email at: pyam.soft@gmail.com
Or find me online at: https://pyamsoft.blogspot.com

Follow my Facebook Page
Check out my code on GitHub
=========================