diff options
Diffstat (limited to 'src/porting.cpp')
-rw-r--r-- | src/porting.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/porting.cpp b/src/porting.cpp index 4c87bddee..caf9e9be3 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <algorithm> #include <shlwapi.h> #include <shellapi.h> + #include <mmsystem.h> #endif #if !defined(_WIN32) #include <unistd.h> @@ -69,6 +70,15 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <cstdarg> #include <cstdio> +#if !defined(SERVER) && defined(_WIN32) +// On Windows export some driver-specific variables to encourage Minetest to be +// executed on the discrete GPU in case of systems with two. Portability is fun. +extern "C" { + __declspec(dllexport) DWORD NvOptimusEnablement = 1; + __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 1; +} +#endif + namespace porting { @@ -766,6 +776,9 @@ bool open_directory(const std::string &path) inline double get_perf_freq() { + // Also use this opportunity to enable high-res timers + timeBeginPeriod(1); + LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); return freq.QuadPart; |