Motherboard Integrated Video
Motherboard video is very misleading. The chips have names like “Radeon” and “GeForce” that we have come to associate with speed, but these chips are an order of magnitude slower than real video cards. Programming for these chips requires special consideration.
Many computers nowadays have two video chips: the integrated motherboard video chip and a dedicated video card. The operating system is responsible for automatically switching the application to the appropriate card. If it is selecting the integrated chip, the application may run excessively slow. It is important to detect if this is the case and instruct the user to configure their operating system to select the appropriate video card.
The following code can be used to determine which GPU is in use:
print(base.win.gsg.driver_vendor)
print(base.win.gsg.driver_renderer)
Forcing Use of Discrete GPU on Windows
On Windows, it is possible to force the NVIDIA and AMD graphics drivers to automatically select the high-peformance dedicated graphics card, by compiling special symbols into the main executable.
While developing, the main executable is python.exe
, which does not set
these symbols. But when building an application,
build_apps can automatically add these special symbols. Simply add this
option to the build_apps options block in setup.py:
'prefer_discrete_gpu': True,
Forcing Use of Discrete GPU on Linux
On Linux, some drivers can be told to use the discrete GPU by setting
DRI_PRIME=1
in the environment. However, this is not considered reliable at
this time, so it is not done by Panda3D automatically. It is suggested to
document this as a possibility for your end-users or add an option for this
setting that can be disabled.
When distributing a .desktop file, it is also possible to add the following key to the file:
PrefersNonDefaultGPU=true