Forcing Machine to Use Dedicated Graphics Card?
The easiest way from C++ to ensure that the dedicated graphics card is used instead of chipset switchable graphics under Windows is to export the following symbols (MSVC sample code):
Enable dedicated graphics for NVIDIA:
extern "C"
{
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
}
Enable dedicated graphics for AMD Radeon:
extern "C"
{
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
Caveat: If the user has created a profile for the application to use integrated chipset, then these will not work.
I am unsure if this would work similarly under Linux / MacOS (unlikely).
Does it use NVidia dedicated graphics? AFAIK, the process of automatically switching from integrated to dedicated is based on application profiles. Your application is not in the driver's list of known 3D applications, and therefore the user has to manually switch to the dedicated GPU.
Try changing the executable name of your application to something the driver looks for. For example "Doom3.exe". If that works, then you've found your problem.
If that didn't help, try following the instructions in this video on how to make the driver insert your application in its list of 3D apps:
http://www.frequency.com/video/how-to-whitelist-game-with-nvidias/24814032
But the above is only for verifying if this is indeed your problem. For an actual solution to this, you should check with the graphics drivers vendors (AMD and NVidia) on the best way to insert a profile for your application into their lists. NVidia provides NVAPI and AMD has ADL and AGS. They're definitely worth a study.