# Correct method for choosing the user's video cards?

My game uses DirectX 10, and I'm having a problem where users are reporting that my game isn't picking up on their graphics card. Instead it prefers to run on their integrated Intel card, ruining performance. It's possible that this is related to Windows 8. It could also be related to mobile cards.

Until now, I've been creating the DirectX 10 device with no adapter specified (as I've seen in all the examples/demos so far), to allow DirectX to choose its own adapter. Apparently I'm going to have to change that.

I already have a function which runs through all of the available adapters, and chooses the one with the highest amount of dedicated memory. That works great for correcting the problem, but is it correct in general?

Unfortunately, I cannot rely on the card having valid video output (i.e: a monitor hooked up) as the machines affected by this problem report no outputs for the desired card.

What algorithm can I use to properly choose which adapter to use with DirectX?

## 3 Answers

Selecting the adapter with the highest available dedicated memory might work in a lot of cases, but in some cases a GPU with less processing power might have more dedicated memory, and your game will still run on the "wrong" adapter.

This brings me to a counter-question, what is the right adapter? The one with the most computational power? The one with the most memory? The one where the main display is attached to? The one that consumes the least power? All these questions probably have different answers per user. Someone using a laptop might prefer long battery life over better graphics. Someone might prefer playing on his secondary monitor (e.g. a TV) instead.

Therefore, lots of games let the user decide what GPU they want to use. Most GPU manufacturers have control panels where the preferred GPU (even per application) can be chosen. Some games have a startup dialog that allows the user to explicitly select the preferred GPU. This startup dialog is often only shown on the first run or after crashes, so it can also act as a nice recovery tool.

• Ultimately I think this is what I have to do. I'm still missing something important here - other games seem to pick the right adapter while mine fails to - but I think the best thing to do right now is just give players control. – Raptormeat Aug 5 '14 at 8:27
• @Raptormeat: the drivers usually include "profiles" that they use to select the default device for the application for known games, which is one reason other games behave as expected but yours does not. There's also hacks like stackoverflow.com/questions/10535950/… but that only works for NVIDIA (and other GPU vendors do not have equivalents). – Sean Middleditch Aug 6 '14 at 1:36
• Another approach is to run a few representative frames (use Flush and a dummy target instead of Present on a swap chain) on each and pick whichever completes the fastest as the default. You should still allow users to pick, though, since they may opt to sacrifice framerate to get better battery life. – MooseBoys Aug 26 '14 at 0:37

I would allow the player to choose which video card to use, i.e. through a drop down list in the options menu. You can use the GPU with the highest detected VRAM, clock speed, etc. as a sane default. You could go further and prompt the player to choose between "high performance" and "power saving" (chooses the lowest-spec card) for the default when the game is first started up, and then let them be more specific with their choice in the options menu.

This is a simple solution that also won't annoy the player if it chooses the undesired video card, as it is easy enough for them to change it if it picked the wrong one.

If you are picking the adapter based on the one with the most memory, you may be having trouble accurately detecting the amount of memory used by Intel HD Graphics. Intel HD Graphics has access to two banks of memory; one dedicated and one shared with the CPU. The size of the two banks are reflected in the DXGI_ADAPTER_DESC structure as DedicatedVideoMemory and SharedSystemMemory. For purposes of comparison with other adapters, you might use just the dedicated bank or you might use both.

Intel has a GPU detect sample that also shows how to measure both banks of memory.