mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Cocoa: Allow opting in to graphics switching on macOS
This commit is contained in:
parent
70f8d1fd3d
commit
9ee2070c59
@ -767,6 +767,11 @@ extern "C" {
|
||||
* Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
|
||||
*/
|
||||
#define GLFW_DOUBLEBUFFER 0x00021010
|
||||
/*! @brief Graphics switching hint.
|
||||
*
|
||||
* Graphics switching [hint](@ref GLFW_ALLOW_GRAPHICS_SWITCHING).
|
||||
*/
|
||||
#define GLFW_ALLOW_GRAPHICS_SWITCHING 0x00021011
|
||||
/*! @brief Context client API hint and attribute.
|
||||
*
|
||||
* Context client API [hint](@ref GLFW_CLIENT_API_hint) and
|
||||
|
@ -321,6 +321,7 @@ struct _GLFWfbconfig
|
||||
int samples;
|
||||
GLFWbool sRGB;
|
||||
GLFWbool doublebuffer;
|
||||
GLFWbool graphicsSwitching;
|
||||
uintptr_t handle;
|
||||
};
|
||||
|
||||
|
@ -231,6 +231,9 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
if (fbconfig->doublebuffer)
|
||||
ADD_ATTR(kCGLPFADoubleBuffer);
|
||||
|
||||
if (fbconfig->graphicsSwitching)
|
||||
ADD_ATTR(kCGLPFASupportsAutomaticGraphicsSwitching);
|
||||
|
||||
if (fbconfig->samples != GLFW_DONT_CARE)
|
||||
{
|
||||
if (fbconfig->samples == 0)
|
||||
|
@ -263,6 +263,7 @@ void glfwDefaultWindowHints(void)
|
||||
_glfw.hints.framebuffer.depthBits = 24;
|
||||
_glfw.hints.framebuffer.stencilBits = 8;
|
||||
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
|
||||
_glfw.hints.framebuffer.graphicsSwitching = GLFW_FALSE;
|
||||
|
||||
// The default is to select the highest available refresh rate
|
||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||
@ -316,6 +317,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
case GLFW_DOUBLEBUFFER:
|
||||
_glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
break;
|
||||
case GLFW_ALLOW_GRAPHICS_SWITCHING:
|
||||
_glfw.hints.framebuffer.graphicsSwitching = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
break;
|
||||
case GLFW_SAMPLES:
|
||||
_glfw.hints.framebuffer.samples = value;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user