Hello all,
I’ve just released the demo of my game. You can find the details in this thread: https://community.monogame.net/t/warsphere/19243
I want to share my solution to the problem of Windows, in case of switchable graphics cards, assigning the power-saving GPU to the game, which is not powerful enough to run the game actually.
The main error report I receive from users is the game crashing on startup (while a lot of textures are being loaded into VRAM). It turns out all the machines affected are gaming laptops with Switchable graphics. The problem seems to be that the power saving GPU is assigned to the game, rather than the high performance GPU.
The exception thrown is SharpDX Exception containing the message:
HRESULT: [0x887A0005], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.
Under Windows 10, once the user goes to graphics settings and assigns the high performance GPU to the game, the issue is resolved very often. But most people don’t know that, and specifically the error message of a suspended GPU device instance doesn’t really help.
I’ve also found out that in Windows 10 you can actually set a registry key in order to assign the high performance GPU to an application:
In “HKEY_CURRENT_USER\SOFTWARE\Microsoft\DirectX\UserGpuPreferences” you can add a key value, containing the application exe path as the name and for value you set: GpuPreference=2;
This is the same thing as if the user would do it manually through graphics settings.
Now, first I thought about setting this key always when the application starts up… However, what if a user actually wants to use its power saving GPU? This would be very annoying then for the user.
What I ended up now is the following dialog, which is shown whenever a SharpDX Exception is caught while loading Textures into VRAM:
If the user clicks the button: “Setup High Performance GPU for WarSphere automatically” it will then set the according registry key and restart the game.
The rest of the dialog is some self help instructions.
Is it pretty? - no. But its the best solution I’ve found.
Hope this helps others. If you have thoughts about it or found different more elegant solutions yourself, I’m happy to hear it