[PATCH 1/2 v2] winemac.drv: Actually make the GL context current even if no drawables were given.

Charles Davis cdavis5x at gmail.com
Thu Feb 18 03:17:44 CST 2016


The spec for GL_ARB_framebuffer_object (and thus, OpenGL 3.x and up) is
quite clear on what happens when a context is made current with no
drawable(s). In fact, the WGL_ARB_create_context extension amends
WGL_ARB_make_current_read (as well as the base spec for wglMakeCurrent)
specifically to allow this.

Signed-off-by: Charles Davis <cdavis5x at gmail.com>
---
Try 2: Only error-exit from wglMakeContextCurrentARB() if we were given a non-null DC.

 dlls/winemac.drv/cocoa_opengl.m | 3 +++
 dlls/winemac.drv/opengl.c       | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index ec2b191..4694dfd 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -235,7 +235,10 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
         }
 
         if (context)
+        {
             [context removeFromViews:YES];
+            [context makeCurrentContext];
+        }
     }
 
     [pool release];
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index ab79a82..29dcf9d 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -3108,7 +3108,7 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w
                 (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer))
                 set_swap_interval(context, 0);
         }
-        else
+        else if (draw_hdc)
         {
             WARN("no window or pbuffer for DC\n");
             LeaveCriticalSection(&dc_pbuffers_section);
-- 
2.7.1




More information about the wine-patches mailing list