mirror of https://github.com/encounter/SDL.git
Fix disabling OpenGL vsync on macOS 10.14.4+ (bug #4575).
This commit is contained in:
parent
aae49015da
commit
00c824a8b0
|
@ -40,7 +40,7 @@ static CVReturn
|
|||
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 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
|||
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 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue