macOS: Fix v-sync to monitor refresh rate no longer working under Mojave.

Mojave broke the technique GLFW used to use for v-sync. Changed to use
CVDisplayLink, fix comes from: https://github.com/glfw/glfw/pull/1417
This commit is contained in:
Kovid Goyal
2019-02-17 11:39:49 +05:30
parent fe3a432845
commit 104e213934
3 changed files with 59 additions and 4 deletions

7
glfw/nsgl_context.h vendored
View File

@@ -27,6 +27,8 @@
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl
#import <CoreVideo/CoreVideo.h>
#include <stdatomic.h>
// NSGL-specific per-context data
//
@@ -34,6 +36,10 @@ typedef struct _GLFWcontextNSGL
{
id pixelFormat;
id object;
CVDisplayLinkRef displayLink;
atomic_int swapInterval;
int swapIntervalsPassed;
id swapIntervalCond;
} _GLFWcontextNSGL;
@@ -53,4 +59,3 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContextNSGL(_GLFWwindow* window);