From 4e5eb884ed482c9be21e290622d85c4b7798d69a Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Thu, 6 Jul 2023 01:38:20 +0300 Subject: [PATCH] Ask Windows to give us a dGPU instead of an iGPU --- src/emulator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/emulator.cpp b/src/emulator.cpp index 76a10698..d675e66f 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -1,5 +1,15 @@ #include "emulator.hpp" +#ifdef _WIN32 +#include + +// Gently ask to use the discrete Nvidia/AMD GPU if possible instead of integrated graphics +extern "C" { +_declspec(dllexport) DWORD NvOptimusEnablement = 1; +_declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 1; +} +#endif + Emulator::Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory, gl), memory(cpu.getTicksRef()) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) { Helpers::panic("Failed to initialize SDL2");