From 64dc397d5386fc8a19ebfd104cdfcdd58616beee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 6 May 2017 16:45:49 -0700 Subject: [PATCH] Added nVidia Optimus, and AMD PowerXpress workarounds. --- src/bgfx.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index d54d45035..4a495895c 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -3922,6 +3922,20 @@ error: } } // namespace bgfx +#if BX_PLATFORM_WINDOWS +extern "C" +{ + // When laptop setup has integrated and discrete GPU, following driver workarounds will + // select discrete GPU: + + // Reference: https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm + __declspec(dllexport) uint32_t NvOptimusEnablement = UINT32_C(1); + + // Reference: http://gpuopen.com/amdpowerxpressrequesthighperformance/ + __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = UINT32_C(1); +} +#endif // BX_PLATFORM_WINDOWS + #define BGFX_TEXTURE_FORMAT_BIMG(_fmt) \ BX_STATIC_ASSERT(uint32_t(bgfx::TextureFormat::_fmt) == uint32_t(bimg::TextureFormat::_fmt) )