Added support for AMD PowerXpress override.

Generalized _GLFW_USE_OPTIMUS_HPG to _GLFW_USE_HYBRID_HPG to reflect the
change.

Fixes #520.
This commit is contained in:
Camilla Berglund 2015-05-29 13:08:12 +02:00
parent 0fa909a889
commit 6d5753c548
5 changed files with 23 additions and 14 deletions

View File

@ -26,7 +26,7 @@ option(GLFW_INSTALL "Generate installation target" ON)
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
if (WIN32)
option(GLFW_USE_OPTIMUS_HPG "Force use of high-performance GPU on Optimus systems" OFF)
option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF)
endif()
if (APPLE)
@ -235,8 +235,8 @@ if (_GLFW_WIN32)
list(APPEND glfw_PKG_LIBS "-lgdi32")
if (GLFW_USE_OPTIMUS_HPG)
set(_GLFW_USE_OPTIMUS_HPG 1)
if (GLFW_USE_HYBRID_HPG)
set(_GLFW_USE_HYBRID_HPG 1)
endif()
endif()

View File

@ -63,6 +63,8 @@ GLFW bundles a number of dependencies in the `deps/` directory.
## Changelog
- Minimum required CMake version updated to 2.8.12
- Renamed hybrid GPU override compile-time option to `_GLFW_USE_HYBRID_HPG` and
added support for AMD PowerXpress systems
- Bugfix: Initialization failed on headless systems
- Bugfix: The cached current context could get out of sync
- [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync

View File

@ -221,11 +221,11 @@ DLL version of the Visual C++ library is used. It is recommended to set this to
`ON`, as this keeps the executable smaller and benefits from security and bug
fix updates of the Visual C++ runtime.
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
symbol, which forces the use of the high-performance GPU on Nvidia Optimus
systems. This symbol needs to be exported by the EXE to be detected by the
driver, so the override will not work if GLFW is built as a DLL. See _Enabling
High Performance Graphics Rendering on Optimus Systems_ for more details.
`GLFW_USE_HYBRID_HPG` determines whether to export the `NvOptimusEnablement` and
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
high-performance GPU on Nvidia Optimus and AMD PowerXpress systems. These symbols
need to be exported by the EXE to be detected by the driver, so the override
will not work if GLFW is built as a DLL.
@subsubsection compile_options_egl EGL specific CMake options

View File

@ -57,8 +57,8 @@
// Define this to 1 if building as a shared library / dynamic library / DLL
#cmakedefine _GLFW_BUILD_DLL
// Define this to 1 to force use of high-performance GPU on Optimus systems
#cmakedefine _GLFW_USE_OPTIMUS_HPG
// Define this to 1 to force use of high-performance GPU on hybrid systems
#cmakedefine _GLFW_USE_HYBRID_HPG
// Define this to 1 if the XInput X11 extension is available
#cmakedefine _GLFW_HAS_XINPUT

View File

@ -31,14 +31,21 @@
#include <malloc.h>
#if defined(_GLFW_USE_OPTIMUS_HPG)
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
// Applications exporting this symbol with this value will be automatically
// directed to the high-performance GPU on Nvidia Optimus systems
// directed to the high-performance GPU on Nvidia Optimus systems with
// up-to-date drivers
//
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
__declspec(dllexport) DWORD NvOptimusEnablement = 1;
#endif // _GLFW_USE_OPTIMUS_HPG
// Applications exporting this symbol with this value will be automatically
// directed to the high-performance GPU on AMD PowerXpress systems with
// up-to-date drivers
//
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif // _GLFW_USE_HYBRID_HPG
#if defined(_GLFW_BUILD_DLL)