From 8daa3c2e0021925c17490d18bb9cbe092adb0dde Mon Sep 17 00:00:00 2001 From: Shalen Bennett <70249609+doctashay@users.noreply.github.com> Date: Sun, 31 Jul 2022 11:32:22 -0600 Subject: [PATCH] Automatically switch to dedicated GPU in OpenGOAL runtime (#1715) * Automatically switch to dedicated GPU for runtime Some machines with dual-GPUs cannot properly detect OpenGOAL as a high-performance application and properly utilize the dedicated GPU. This sets a flag for both Radeon and NVIDIA GPUs to always use the high performance GPU when available. I do not have a dual-GPU machine to test this on, but this should just work out of the box. * clang-format One day I will understand clang --- game/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game/main.cpp b/game/main.cpp index 40df7eb7c1..1abc6ceb2b 100644 --- a/game/main.cpp +++ b/game/main.cpp @@ -17,6 +17,13 @@ #include "game/discord.h" +#ifdef _WIN32 +extern "C" { +__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; +__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; +} +#endif + // Discord RPC extern int64_t gStartTime;