Louis Lenders : opengl32: Use wrappers for wglCreateContext and wglMakeCurrent instead of directly forwarding to gdi32 .

Alexandre Julliard julliard at winehq.org
Wed Nov 2 14:23:37 CDT 2011


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

Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date:   Sun Oct 30 22:13:34 2011 +0100

opengl32: Use wrappers for wglCreateContext and wglMakeCurrent instead of directly forwarding to gdi32.

---

 dlls/opengl32/opengl32.spec |    4 ++--
 dlls/opengl32/wgl.c         |   37 +++++++++++++++++++++++++++----------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/dlls/opengl32/opengl32.spec b/dlls/opengl32/opengl32.spec
index 9bd232f..3fcaa3c 100644
--- a/dlls/opengl32/opengl32.spec
+++ b/dlls/opengl32/opengl32.spec
@@ -336,7 +336,7 @@
 @  stdcall glViewport( long long long long ) wine_glViewport
 @  stdcall wglChoosePixelFormat(long ptr) gdi32.ChoosePixelFormat
 @  stdcall wglCopyContext(long long long) gdi32.wglCopyContext
-@  stdcall wglCreateContext(long) gdi32.wglCreateContext
+@  stdcall wglCreateContext(long)
 @  stdcall wglCreateLayerContext(long long)
 @  stdcall wglDeleteContext(long) gdi32.wglDeleteContext
 @  stdcall wglDescribeLayerPlane(long long long long ptr)
@@ -347,7 +347,7 @@
 @  stdcall wglGetLayerPaletteEntries(long long long long ptr)
 @  stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
 @  stdcall wglGetProcAddress(str)
-@  stdcall wglMakeCurrent(long long) gdi32.wglMakeCurrent
+@  stdcall wglMakeCurrent(long long)
 @  stdcall wglRealizeLayerPalette(long long long)
 @  stdcall wglSetLayerPaletteEntries(long long long long ptr)
 @  stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index cd60eb2..74f3d88 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -45,16 +45,15 @@
 WINE_DEFAULT_DEBUG_CHANNEL(wgl);
 WINE_DECLARE_DEBUG_CHANNEL(opengl);
 
-typedef struct wine_wgl_s {
-    PROC WINAPI  (*p_wglGetProcAddress)(LPCSTR  lpszProc);
-
-    void WINAPI  (*p_wglGetIntegerv)(GLenum pname, GLint* params);
-    void WINAPI  (*p_wglFinish)(void);
-    void WINAPI  (*p_wglFlush)(void);
-} wine_wgl_t;
-
-/** global wgl object */
-static wine_wgl_t wine_wgl;
+static struct
+{
+    PROC  (WINAPI *p_wglGetProcAddress)(LPCSTR  lpszProc);
+    BOOL  (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
+    HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
+    void  (WINAPI *p_wglGetIntegerv)(GLenum pname, GLint* params);
+    void  (WINAPI *p_wglFinish)(void);
+    void  (WINAPI *p_wglFlush)(void);
+} wine_wgl;
 
 #ifdef SONAME_LIBGLU
 #define MAKE_FUNCPTR(f) static typeof(f) * p##f;
@@ -117,6 +116,22 @@ void enter_gl(void)
 const GLubyte * WINAPI wine_glGetString( GLenum name );
 
 /***********************************************************************
+ *		wglMakeCurrent (OPENGL32.@)
+ */
+BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
+{
+  return wine_wgl.p_wglMakeCurrent(hdc, hglrc);
+}
+
+/***********************************************************************
+ *		wglCreateContext (OPENGL32.@)
+ */
+HGLRC WINAPI wglCreateContext(HDC hdc)
+{
+  return wine_wgl.p_wglCreateContext(hdc);
+}
+
+/***********************************************************************
  *		wglCreateLayerContext (OPENGL32.@)
  */
 HGLRC WINAPI wglCreateLayerContext(HDC hdc,
@@ -720,6 +735,8 @@ static BOOL process_attach(void)
   wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod_x11, "wine_tsx11_unlock" );
 
   wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
+  wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
+  wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
 
   /* Interal WGL function */
   wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");




More information about the wine-cvs mailing list