From 40c5184a90a6e14f3e49dd60daaba636308b7f83 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Thu, 3 Jan 2019 11:08:31 -0600 Subject: [PATCH] winemac: Fix implementation of the AllowVerticalSync registry setting. Signed-off-by: Ken Thomases Signed-off-by: Alexandre Julliard --- dlls/winemac.drv/opengl.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c index d83a4cea57b..c3c2bee2264 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -1539,8 +1539,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns } context->major = major; - if (allow_vsync) - InterlockedExchange(&context->update_swap_interval, TRUE); + InterlockedExchange(&context->update_swap_interval, TRUE); TRACE("created context %p/%p/%p\n", context, context->context, context->cglcontext); @@ -1742,7 +1741,9 @@ static void sync_swap_interval(struct wgl_context *context) { int interval; - if (context->draw_hwnd) + if (!allow_vsync) + interval = 0; + else if (context->draw_hwnd) { struct macdrv_win_data *data = get_win_data(context->draw_hwnd); if (data) @@ -3478,7 +3479,7 @@ static int macdrv_wglGetSwapIntervalEXT(void) release_win_data(data); if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE)) - set_swap_interval(context, value); + set_swap_interval(context, allow_vsync ? value : 0); } else { @@ -3543,8 +3544,8 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w return FALSE; } - if (allow_vsync && (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || hwnd != context->draw_hwnd)) - set_swap_interval(context, data->swap_interval); + if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || hwnd != context->draw_hwnd) + set_swap_interval(context, allow_vsync ? data->swap_interval : 0); context->draw_hwnd = hwnd; context->draw_view = data->client_cocoa_view; @@ -3569,8 +3570,7 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w return FALSE; } - if (allow_vsync && - (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer)) + if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer) set_swap_interval(context, 0); } else @@ -4115,6 +4115,9 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval) else /* pbuffer */ interval = 0; + if (!allow_vsync) + interval = 0; + InterlockedExchange(&context->update_swap_interval, FALSE); if (!set_swap_interval(context, interval)) {