Alexandre Julliard : winex11: Move wglCopyContext and wglDeleteContext to the internal OpenGL extension functions .

Alexandre Julliard julliard at winehq.org
Mon Jun 25 13:24:12 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 25 12:21:18 2012 +0200

winex11: Move wglCopyContext and wglDeleteContext to the internal OpenGL extension functions.

---

 dlls/opengl32/wgl.c       |   22 ++++++++++++++++------
 dlls/wined3d/directx.c    |    2 ++
 dlls/wined3d/wined3d_gl.h |    1 -
 dlls/winex11.drv/opengl.c |   16 ++++++++--------
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index ca3fee2..a3b5319 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -49,8 +49,6 @@ static struct
 {
     PROC  (WINAPI *p_wglGetProcAddress)(LPCSTR  lpszProc);
     BOOL  (WINAPI *p_SetPixelFormat)(HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
-    BOOL  (WINAPI *p_wglCopyContext)(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
-    BOOL  (WINAPI *p_wglDeleteContext)(HGLRC hglrc);
     BOOL  (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
     HDC   (WINAPI *p_wglGetCurrentDC)(void);
     HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
@@ -60,6 +58,8 @@ static struct
     INT   (WINAPI *p_GetPixelFormat)(HDC hdc);
 
     /* internal WGL functions */
+    BOOL  (WINAPI *p_wglCopyContext)(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
+    BOOL  (WINAPI *p_wglDeleteContext)(HGLRC hglrc);
     void  (WINAPI *p_wglGetIntegerv)(GLenum pname, GLint* params);
     void  (WINAPI *p_wglFinish)(void);
     void  (WINAPI *p_wglFlush)(void);
@@ -104,7 +104,12 @@ BOOL WINAPI wglSetPixelFormat( HDC hdc, INT iPixelFormat,
  */
 BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
 {
-  return wine_wgl.p_wglCopyContext(hglrcSrc, hglrcDst, mask);
+    if (!hglrcSrc || !hglrcDst)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    return wine_wgl.p_wglCopyContext(hglrcSrc, hglrcDst, mask);
 }
 
 /***********************************************************************
@@ -112,7 +117,12 @@ BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
  */
 BOOL WINAPI wglDeleteContext(HGLRC hglrc)
 {
-  return wine_wgl.p_wglDeleteContext(hglrc);
+    if (!hglrc)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    return wine_wgl.p_wglDeleteContext(hglrc);
 }
 
 /***********************************************************************
@@ -921,8 +931,6 @@ static BOOL process_attach(void)
 
   wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
   wine_wgl.p_SetPixelFormat = (void *)GetProcAddress(mod_gdi32, "SetPixelFormat");
-  wine_wgl.p_wglCopyContext = (void *)GetProcAddress(mod_gdi32, "wglCopyContext");
-  wine_wgl.p_wglDeleteContext = (void *)GetProcAddress(mod_gdi32, "wglDeleteContext");
   wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
   wine_wgl.p_wglGetCurrentDC = (void *)GetProcAddress(mod_gdi32, "wglGetCurrentDC");
   wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
@@ -932,6 +940,8 @@ static BOOL process_attach(void)
   wine_wgl.p_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
 
   /* internal WGL functions */
+  wine_wgl.p_wglCopyContext = (void *)wine_wgl.p_wglGetProcAddress("wglCopyContext");
+  wine_wgl.p_wglDeleteContext = (void *)wine_wgl.p_wglGetProcAddress("wglDeleteContext");
   wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
   wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish");
   wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush");
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 3e178db7..0647ae3 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -5359,10 +5359,12 @@ static BOOL InitAdapters(struct wined3d *wined3d)
 #ifdef USE_WIN32_OPENGL
     wglFinish = (void*)GetProcAddress(mod_gl, "glFinish");
     wglFlush = (void*)GetProcAddress(mod_gl, "glFlush");
+    pwglDeleteContext = (void*)GetProcAddress(mod_gl, "wglDeleteContext");
     pwglShareLists = (void*)GetProcAddress(mod_gl, "wglShareLists");
 #else
     wglFinish = (void*)pwglGetProcAddress("wglFinish");
     wglFlush = (void*)pwglGetProcAddress("wglFlush");
+    pwglDeleteContext = (void*)pwglGetProcAddress("wglDeleteContext");
     pwglShareLists = (void*)pwglGetProcAddress("wglShareLists");
 #endif
 
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index ee4a133..fa39de5 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -1713,7 +1713,6 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
 
 #define WGL_FUNCS_GEN \
     USE_WGL_FUNC(wglCreateContext) \
-    USE_WGL_FUNC(wglDeleteContext) \
     USE_WGL_FUNC(wglGetCurrentContext) \
     USE_WGL_FUNC(wglGetCurrentDC) \
     USE_WGL_FUNC(wglGetProcAddress) \
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 61f1791..62802b85 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1624,11 +1624,11 @@ static BOOL glxdrv_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORM
 }
 
 /**
- * glxdrv_wglCopyContext
+ * X11DRV_wglCopyContext
  *
  * For OpenGL32 wglCopyContext.
  */
-static BOOL glxdrv_wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
+static BOOL WINAPI X11DRV_wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
 {
     Wine_GLContext *src = (Wine_GLContext*)hglrcSrc;
     Wine_GLContext *dst = (Wine_GLContext*)hglrcDst;
@@ -1688,18 +1688,16 @@ static HGLRC glxdrv_wglCreateContext(PHYSDEV dev)
 }
 
 /**
- * glxdrv_wglDeleteContext
+ * X11DRV_wglDeleteContext
  *
  * For OpenGL32 wglDeleteContext.
  */
-static BOOL glxdrv_wglDeleteContext(HGLRC hglrc)
+static BOOL WINAPI X11DRV_wglDeleteContext(HGLRC hglrc)
 {
     Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
 
     TRACE("(%p)\n", hglrc);
 
-    if (!has_opengl()) return 0;
-
     if (!is_valid_context(ctx))
     {
         WARN("Error deleting context !\n");
@@ -3251,6 +3249,8 @@ static const WineGLExtension WGL_internal_functions =
 {
   "",
   {
+    { "wglCopyContext", X11DRV_wglCopyContext },
+    { "wglDeleteContext", X11DRV_wglDeleteContext },
     { "wglGetIntegerv", X11DRV_wglGetIntegerv },
     { "wglFinish", X11DRV_wglFinish },
     { "wglFlush", X11DRV_wglFlush },
@@ -3755,10 +3755,10 @@ static const struct gdi_dc_funcs glxdrv_funcs =
     glxdrv_SwapBuffers,                 /* pSwapBuffers */
     NULL,                               /* pUnrealizePalette */
     NULL,                               /* pWidenPath */
-    glxdrv_wglCopyContext,              /* pwglCopyContext */
+    NULL,                               /* pwglCopyContext */
     glxdrv_wglCreateContext,            /* pwglCreateContext */
     glxdrv_wglCreateContextAttribsARB,  /* pwglCreateContextAttribsARB */
-    glxdrv_wglDeleteContext,            /* pwglDeleteContext */
+    NULL,                               /* pwglDeleteContext */
     glxdrv_wglGetProcAddress,           /* pwglGetProcAddress */
     glxdrv_wglMakeContextCurrentARB,    /* pwglMakeContextCurrentARB */
     glxdrv_wglMakeCurrent,              /* pwglMakeCurrent */




More information about the wine-cvs mailing list