SFML community forums

Help => Window => Topic started by: ghost231 on October 11, 2020, 10:43:27 am

Title: Automatic Graphics Switching
Post by: ghost231 on October 11, 2020, 10:43:27 am
I have a 2019 Mac book Pro with an Intel Integrated GPU and a dedicated AMD GPU. MacOS has a feature called Automatic Graphics Switching which switches between GPUs to save power.

If I create an SFML Window with Automatic Graphics Switching turned on, the screen hitches for about half a second and sometimes flashes black before the window is displayed. It also closes very slowly. There are no problems while it is running, but opening and closing causes the entire system and background applications to lag for a second. In addition, window.setMouseCursorVisible(false) does not work when the feature is turned on. Turning off Automatic Graphics Switching fixes the problem.

Can you manually set which GPU the windows uses, or is there some other workaround to not have to manually turn off the feature in Settings?
Title: Re: Automatic Graphics Switching
Post by: eXpl0it3r on October 14, 2020, 10:57:46 am
There's the GpuPreference #define that is used to encourage the system to use the discrete graphics card, as one usually wants, due to better graphics support, but I'm not even sure if this has an effect on macOS...
Other than that, I'm not sure if there's even a way to define the mode, as this seems mostly defined from the OS itself.
You could try and use something like gSwitch (https://codyschrank.github.io/gSwitch/) to better handle the enabling/disabling of the discrete graphics card.