Alexandre Julliard : opengl32: Move wglMakeContextCurrentARB to the WGL driver.

Alexandre Julliard julliard at winehq.org
Thu Jun 28 13:55:16 CDT 2012


Module: wine
Branch: master
Commit: 47fe838b152b54742e5af612ca4ad4fa1fb213e7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=47fe838b152b54742e5af612ca4ad4fa1fb213e7

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jun 28 14:49:49 2012 +0200

opengl32: Move wglMakeContextCurrentARB to the WGL driver.

---

 dlls/opengl32/wgl.c       |   23 ++++++++++++++++++++++-
 dlls/winex11.drv/opengl.c |   11 +++++------
 include/wine/gdi_driver.h |    3 ++-
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 16a76db..9761bba 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -133,6 +133,14 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
 }
 
 /***********************************************************************
+ *		wglMakeContextCurrentARB  (wrapper for the extension function returned by the driver)
+ */
+static BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
+{
+    return wgl_driver->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, hglrc );
+}
+
+/***********************************************************************
  *		wglShareLists (OPENGL32.@)
  */
 BOOL WINAPI wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
@@ -487,7 +495,20 @@ PROC WINAPI wglGetProcAddress(LPCSTR  lpszProc) {
   if (ext_ret == NULL) {
     /* If the function name starts with a 'w', it is a WGL extension */
     if(lpszProc[0] == 'w')
-      return wine_wgl.p_wglGetProcAddress(lpszProc);
+    {
+        local_func = wine_wgl.p_wglGetProcAddress( lpszProc );
+        if (local_func == (void *)1)  /* special function that needs a wrapper */
+        {
+            if (!strcmp( lpszProc, "wglMakeContextCurrentARB" ))
+                local_func = wglMakeContextCurrentARB;
+            else
+            {
+                FIXME( "wrapper missing for %s\n", lpszProc );
+                local_func = NULL;
+            }
+        }
+        return local_func;
+    }
 
     /* We are dealing with an unknown GL extension */
     WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 4c1ce9c..f99e98c 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1654,12 +1654,10 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, HGLRC hglrc)
     return ret;
 }
 
-/**
- * X11DRV_wglMakeContextCurrentARB
- *
- * For OpenGL32 wglMakeContextCurrentARB
+/***********************************************************************
+ *		glxdrv_wglMakeContextCurrentARB
  */
-static BOOL WINAPI X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
+static BOOL glxdrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc )
 {
     Wine_GLContext *ctx = (Wine_GLContext *)hglrc;
     Wine_GLContext *prev_ctx = NtCurrentTeb()->glContext;
@@ -3095,7 +3093,7 @@ static const WineGLExtension WGL_ARB_make_current_read =
   "WGL_ARB_make_current_read",
   {
     { "wglGetCurrentReadDCARB", X11DRV_wglGetCurrentReadDCARB },
-    { "wglMakeContextCurrentARB", X11DRV_wglMakeContextCurrentARB },
+    { "wglMakeContextCurrentARB", (void *)1 /* called through the glxdrv_wgl_funcs driver */ },
   }
 };
 
@@ -3604,6 +3602,7 @@ static const struct wgl_funcs glxdrv_wgl_funcs =
     glxdrv_wglCopyContext,              /* p_wglCopyContext */
     glxdrv_wglDeleteContext,            /* p_wglDeleteContext */
     glxdrv_wglGetCurrentDC,             /* p_wglGetCurrentDC */
+    glxdrv_wglMakeContextCurrentARB,    /* p_wglMakeContextCurrentARB */
     glxdrv_wglMakeCurrent,              /* p_wglMakeCurrent */
     glxdrv_wglShareLists,               /* p_wglShareLists */
 };
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 7a17d09..4f4ad94 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -203,7 +203,7 @@ struct gdi_dc_funcs
 };
 
 /* increment this when you change the DC function table */
-#define WINE_GDI_DRIVER_VERSION 33
+#define WINE_GDI_DRIVER_VERSION 34
 
 #define GDI_PRIORITY_NULL_DRV        0  /* null driver */
 #define GDI_PRIORITY_FONT_DRV      100  /* any font driver */
@@ -236,6 +236,7 @@ struct wgl_funcs
     BOOL  (*p_wglCopyContext)(HGLRC,HGLRC,UINT);
     BOOL  (*p_wglDeleteContext)(HGLRC);
     HDC   (*p_wglGetCurrentDC)(void);
+    BOOL  (*p_wglMakeContextCurrentARB)(HDC,HDC,HGLRC);
     BOOL  (*p_wglMakeCurrent)(HDC,HGLRC);
     BOOL  (*p_wglShareLists)(HGLRC,HGLRC);
 };




More information about the wine-cvs mailing list