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

Charles Davis cdavis5x at gmail.com
Thu Feb 18 18:40:54 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 3: Pull DC checks into their own if block, as suggested by Ken. (This also makes wglMakeContextCurrentARB fail, as it should, if a read DC but no draw DC was given.)

 dlls/winemac.drv/cocoa_opengl.m | 3 +++
 dlls/winemac.drv/opengl.c       | 8 +++++++-
 2 files changed, 10 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..f0c7048 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -3057,7 +3057,13 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w
         return TRUE;
     }
 
-    if ((hwnd = WindowFromDC(draw_hdc)))
+    if (!draw_hdc && !read_hdc)
+    {
+        context->draw_hwnd = NULL;
+        context->draw_view = NULL;
+        context->draw_pbuffer = NULL;
+    }
+    else if ((hwnd = WindowFromDC(draw_hdc)))
     {
         if (!(data = get_win_data(hwnd)))
         {
-- 
2.7.1




More information about the wine-patches mailing list