From 4e9f6500d0e541c6aa4377499e1d23c62b13f36b Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Sun, 26 Jan 2020 15:54:59 +0900 Subject: [PATCH] [client/main] Added some code to use dedicated GPU on Windows (thanks to Hopson). --- client/source/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/source/main.cpp b/client/source/main.cpp index b7f43ff7..8b763727 100644 --- a/client/source/main.cpp +++ b/client/source/main.cpp @@ -13,6 +13,19 @@ */ #include "ClientApplication.hpp" +// Use discrete GPU by default in Windows +// from https://gist.github.com/statico/6809850727c708f08458 +// Thanks to Hopson for pointing this out +#ifdef _WIN32 +extern "C" { + // http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf + __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; + + // https://gpuopen.com/amdpowerxpressrequesthighperformance/ + __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; +} +#endif + int main(int argc, char **argv) { ClientApplication app(argc, argv); app.run();