Multiple Graphics Adapters
Some machines, most commonly laptops, contain multiple graphics adapters. Selecting the correct adapter can be more complicated than you might think. When we released the 4.1 update some users noticed a severe decrease in performance. It turned out we were selecting the wrong adapter in some situations on Windows 8. Read further if you want the technical details and a workaround. If you just want to get it fixed you should download the QFE.
When we released UnrealEngine4 to everyone that is willing to spend $19 we knew we quickly get a lot of testing on all kinds of hardware. Some users reported bad performance and we found multiple causes. Here we want to talk about Unreal Engine specifics so we remove where the user has a slow graphic card and/or a slow CPU, low memory or other hardware issues like running on battery. We also would like to skip general performance comparisons with other engines, shipped games or other techniques. We will continue to optimize the engine and adapt to the wide range of hardware out there. Many design decisions we do today cost more performance but offer other benefits like better quality or lower performance cost when used extensively (e.g. deferred shading is slower for the single light case but with complex geometry and many lights itâs much more efficient).
NVIDIA Optimus
We found that in some cases the users had multiple graphics cards and the system picked the wrong one. The engine is optimized for high end visuals so the right one would be the fastest one. Many laptops have multiple graphics card and by default an application gets the more energy efficient but slower one. In some cases this choice can be adjusted in the windows graphics card settings. We already applied a hint (NVIDIA Optimus specific) to the system that out application should be considered high performance and it should pick the faster card. This hint wasnât fully working and that was fixed in Unreal Engine 4.1. If the user explicitly overrides this behavior in the driver we cannot do anything about it. In that case the user wants to save battery or energy and has to accept a slower frame rate. The specified hint needs to be put into each executable so itâs possible a different engine executable doesnât show the same behavior. We also have ways of compiling the engine in different ways and all that can affect the result. Note that Optimus seems to hide the second adapter. In cases where we see multiple adapters we have to apply a different solution (see next paragraph).
More information on Optimus: NVIDIA Optimus Programming Guide | NVIDIA Developer
Multiple graphics card adapters
Not every machine that has multiple graphics cards uses the NVIDIA Optimus system. In that case we would like to pick the faster card. How to pick the faster card? We could run a benchmark. A complex system (that could fail) would need to developed, the user would have to wait, we would store the result to avoid waiting the next time and we would have to detect when hardware changes to run it again. Simpler is to implement a good heuristic. We would like to detect the integrated (on board) graphics cards and rather use a second dedicated (slot) graphics card as they are usually faster. For Unreal Engine 4.1 we implemented that heuristic and it worked fine on the machine we tested. After release some users reported severe performance loss and some cases have been caused by his heuristic. If the user had multiple adapters it avoided Intel and picked the next one. Turns out on Windows 8 there is a software rendering adapter that is enumerated after the Intel hardware one. That one is way slower and therefore not a good choice.
We improved the heuristic and the changes are currently being tested or might have been released already. The software device can explicitly detected though a specific ID and it has no display outputs. We also improved the heuristic to also look for a NVIDIA or AMD graphic card.
How to check if Unreal Engine runs on the wrong adapter
Looking at the latest log file (Saved/Logs) you can see if it picked the wrong adapter:
Found D3D11 adapter 0: Intel(R) HD Graphics Family
Adapter has 0MB of dedicated video memory, 0MB of dedicated system
memory, and 1792MB of shared system memory
Found D3D11 adapter 1: Microsoft Basic Render Driver
Adapter has 0MB of dedicated video memory, 0MB of dedicated system
memory, and 256MB of shared system memory
LogD3D11RHI: Chosen D3D11 Adapter Id = 0
How to override the adapter choice / workaround the wrong decision
For most low level features in Unreal Engine we use console variables to give user control. For this feature the console variable is called âr.GraphicsAdapterâ. You can type the console variable name into the OutputLog or in the game console to get itâs current value and the help using âr.GraphicsAdapter ?â. This is the console variable help:
User request to pick a specific graphics adapter
(e.g. when using a integrated graphics card with a descrete one)
At the moment this only works on Direct3D 11.
-2: Take the first one that fulfills the criteria
-1: Favour non integrated because there are usually faster (default)
0: Adpater #0
1: Adpater #1, âŚ
You cannot change this setting at runtime like most other console variables but you can add a line to the file consolevariables.ini:
r.GraphicsAdapter = -2
Note that to set a console variable there you have to add a â=â. Donât add any characters in front of it. The â;â you might see there is to comment the line so that is has no effect.
You can check if your change had effect looking at the log again. You can type the console variable name into the OutputLog or in the game console to get its current value.
How about giving the user a choice
Someone that can change an ini file already gets the choice - however itâs not easy to discover. The system could ask the user but that can go wrong as well. We will continue to improve our system, maybe using a benchmark or ask the user but we also would like to develop a good system that can make the decision for the less knowledgeable user. Sorry if that caused trouble and thanks for letting us know so we can quickly fix the issue.