diff --git a/src/bgfx.cpp b/src/bgfx.cpp index c4e53f8d0..b5404bb10 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -5078,7 +5078,7 @@ namespace bgfx } } // namespace bgfx -#if BX_PLATFORM_WINDOWS +#if BGFX_CONFIG_PREFER_DISCRETE_GPU extern "C" { // When laptop setup has integrated and discrete GPU, following driver workarounds will @@ -5094,7 +5094,7 @@ extern "C" // __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = UINT32_C(1); } -#endif // BX_PLATFORM_WINDOWS +#endif // BGFX_CONFIG_PREFER_DISCRETE_GPU #define BGFX_TEXTURE_FORMAT_BIMG(_fmt) \ BX_STATIC_ASSERT(uint32_t(bgfx::TextureFormat::_fmt) == uint32_t(bimg::TextureFormat::_fmt) ) diff --git a/src/config.h b/src/config.h index 941100240..79eb896dd 100644 --- a/src/config.h +++ b/src/config.h @@ -361,4 +361,10 @@ BX_STATIC_ASSERT(bx::isPowerOf2(BGFX_CONFIG_MAX_VIEWS), "BGFX_CONFIG_MAX_VIEWS m # define BGFX_CONFIG_MAX_BACK_BUFFERS 4 #endif // BGFX_CONFIG_MAX_BACK_BUFFERS +#ifndef BGFX_CONFIG_PREFER_DISCRETE_GPU +// On laptops with integrated and discrete GPU, prefer selection of discrete GPU. +// nVidia and AMD, on Windows only. +# define BGFX_CONFIG_PREFER_DISCRETE_GPU BX_PLATFORM_WINDOWS +#endif // BGFX_CONFIG_PREFER_DISCRETE_GPU + #endif // BGFX_CONFIG_H_HEADER_GUARD