Skip to content
Permalink
Browse files

Fix disabling OpenGL vsync on macOS 10.14.4+ (bug #4575).

  • Loading branch information
slime73 committed Apr 11, 2019
1 parent aae4901 commit 00c824a8b0c052a5b5a98c4084f9e3f7c1af887d
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/video/cocoa/SDL_cocoaopengl.m
@@ -40,7 +40,7 @@
DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const CVTimeStamp* outputTime, CVOptionFlags flagsIn, CVOptionFlags* flagsOut, void* displayLinkContext)
{
SDLOpenGLContext *nscontext = (SDLOpenGLContext *) displayLinkContext;

/*printf("DISPLAY LINK! %u\n", (unsigned int) SDL_GetTicks()); */
const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting);
if (setting != 0) { /* nothing to do if vsync is disabled, don't even lock */
@@ -208,6 +208,7 @@ - (void)dealloc
const char *glversion;
int glversion_major;
int glversion_minor;
int interval;

if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
#if SDL_VIDEO_OPENGL_EGL
@@ -319,6 +320,10 @@ - (void)dealloc
return NULL;
}

/* vsync is handled separately by synchronizing with a display link. */
interval = 0;
[context setValues:&interval forParameter:NSOpenGLContextParameterSwapInterval];

if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) {
Cocoa_GL_DeleteContext(_this, context);
SDL_SetError("Failed making OpenGL context current");

0 comments on commit 00c824a

Please sign in to comment.