Added NvOptimusEnablement.

This commit is contained in:
Camilla Berglund 2013-08-07 18:07:33 +02:00
parent a024e61bf8
commit 735bc2d815
4 changed files with 21 additions and 0 deletions

View File

@ -18,6 +18,7 @@ option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
if (WIN32)
option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" OFF)
option(GLFW_USE_OPTIMUS_HPG "Force use of high-performance GPU on Optimus systems" OFF)
endif()
if (APPLE)
@ -159,6 +160,9 @@ if (_GLFW_WIN32)
if (GLFW_USE_DWM_SWAP_INTERVAL)
set(_GLFW_USE_DWM_SWAP_INTERVAL 1)
endif()
if (GLFW_USE_OPTIMUS_HPG)
set(_GLFW_USE_OPTIMUS_HPG 1)
endif()
endif()
#--------------------------------------------------------------------

View File

@ -173,6 +173,10 @@ static library version of the Visual C++ runtime library.
when DWM compositing is enabled. This can lead to severe jitter and is not
usually recommended.
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
symbol, which forces the use of the high-performance GPU on nVidia Optimus
systems.
#### EGL specific options
@ -204,6 +208,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
- Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero
- [Win32] Added `_GLFW_USE_DWM_SWAP_INTERVAL` for forcing the swap interval
to be set even when DWM compositing is enabled
- [Win32] Added support for forcing the use of the high-performance GPU
on nVidia Optimus systems
- [Win32] Bugfix: The clipboard string was not freed on terminate
- [Win32] Bugfix: Entry points for OpenGL 1.0 and 1.1 functions were not
returned by `glfwGetProcAddress`

View File

@ -55,6 +55,8 @@
#cmakedefine _GLFW_NO_DLOAD_WINMM
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status
#cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL
// Define this to 1 to force use of high-performance GPU on Optimus systems
#cmakedefine _GLFW_USE_OPTIMUS_HPG
// Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS

View File

@ -36,6 +36,15 @@
#endif // __BORLANDC__
#if 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
//
GLFWAPI DWORD NvOptimusEnablement = 0x00000001;
#endif // _GLFW_USE_OPTIMUS_HPG
#if defined(_GLFW_BUILD_DLL)
// GLFW DLL entry point