Enumerating all GPUs - not a question

I believe most of us came to issue with Monogame using integrated GPU by default. Most of us came to conclusion that forcing High power GPU to be set by Monogame application is… let’s say problematic. After that most of us came to conclusion that it would be nice to at least list all GPUs and inform users to set proper one through control panel. After which we found out that GraphicDevice wont let us do it (or maybe I am stupid as hell). Anyway this solution works:

Ofc it is not cross platform but it might help to some ppl.

I think GraphicsAdapter.Adapters should work.

I’ve looked into setting the GPU that should be used, but unfortunately there’s no solution for each OS + GPU vendor combination :frowning:

Should but from my experience and experience of ppl I read about on internet it doesn’t since XNA. Do you have solution for Windows + any GPU?

I remembered this incorrectly. This is the case for OpenGL, but with DX it’s easy to pick an adapter. This is currently not done, but i think it would only require a single-line change in MG

The change is to pass the underlying SharpDX Adapter of GraphicsDevice.Adapter to the CreateDevice call (in SharpDX this is the Device ctor).

To actually pick the Adapter as an MG user:

  1. Find the one you want using the GraphicsAdapter API
  2. Respond to the PreparingDeviceSettings event of GraphicsDeviceManager
  3. Set the Adapter in the GraphicsDeviceInformation of the event argument in the handler

Another thing MG does not support currently is automatically picking the best adapter. Though there is a PR up for that: Implement GraphicsDeviceManager FindBestDevice and RankDevices by KonajuGames · Pull Request #5926 · MonoGame/MonoGame · GitHub

Not sure what kind of issues there are. I haven’t touched this code in a while. If find specific problems, please open an issue on GitHub.

It GraphicsDevice.Adapter lists only currently active adapter, I will look into opening Git issue later. Thx for details btw.

1 Like