Skip to content

Instantly share code, notes, and snippets.

View ThanosFisherman's full-sized avatar

Thanos Psaridis ThanosFisherman

View GitHub Profile
@ThanosFisherman
ThanosFisherman / gpu.cpp
Created October 30, 2024 22:06 — forked from statico/gpu.cpp
Trick to tell AMD and Nvidia drivers to use the most powerful GPU instead of a lower-performance (such as integrated) GPU
#ifdef _WIN32
// Use discrete GPU by default.
extern "C" {
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
// http://developer.amd.com/community/blog/2015/10/02/amd-enduro-system-for-developers/
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif