[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: WGL: fix wglGetProcAddress bug
From:       "Roderick Colenbrander" <thunderbird2k () gmx ! net>
Date:       2006-12-28 0:34:27
Message-ID: 20061228003427.19890 () gmx ! net
[Download RAW message or body]

Vitaly just pointed out that the previous version added some extra spaces. This one fixes that.

Roderick

> Hi,
> 
> This patch fixes a nasty wglGetProcAddress bug. In case the name of an
> unknown GL extension (one which is not in wine yet) was passed to
> wglGetProcAddress it was assumed that it was a WGL extension.
> 
> WGL extensions are in the end looked up in winex11.drv. The
> wglGetProcAddress function in winex11.drv can return WGL extensions but it can also
> return native GL functions. This ability is used in order to fill the opengl32
> thunks (win32 GL -> native GL).
> 
> The problem was that unknown extensions were also passed to the
> winex11.drv code. This resulted that code to look up a native GL functions (the
> winex11.drv code returns wgl extensions if the function name starts with 'wgl'
> and else it calls glXGetProcAddress).
> 
> In the end this patch makes sure that only functions which start with a
> 'w' are passed to the winex11.drv code in the other cases a warning is
> printed that the function wasn't found.
> 
> Regards,
> Roderick Colenbrander

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

["wgl_ext.patch" (text/x-patch)]

Index: dlls/opengl32/wgl.c
===================================================================
RCS file: /home/wine/wine/dlls/opengl32/wgl.c,v
retrieving revision 1.114
diff -u -r1.114 wgl.c
--- dlls/opengl32/wgl.c	12 Dec 2006 20:30:35 -0000	1.114
+++ dlls/opengl32/wgl.c	28 Dec 2006 00:04:38 -0000
@@ -223,6 +223,9 @@
 
   TRACE("(%s)\n", lpszProc);
 
+  if(lpszProc == NULL);
+    return NULL;
+
   /* First, look if it's not already defined in the 'standard' OpenGL functions */
   if ((local_func = GetProcAddress(opengl32_handle, lpszProc)) != NULL) {
     TRACE(" found function in 'standard' OpenGL functions (%p)\n", local_func);
@@ -234,10 +237,14 @@
   ext_ret = (const OpenGL_extension *) bsearch(&ext, extension_registry,
 					 extension_registry_size, sizeof(OpenGL_extension), compar);
 
-  /* If nothing was found, we are looking for a WGL extension */
+  /* If nothing was found, we are looking for a WGL extension or an unknown GL extension. */
   if (ext_ret == NULL) {
-    WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
-    return wine_wgl.p_wglGetProcAddress(lpszProc);
+    /* If the function name starts with a w it is a WGL extension */
+    if(lpszProc[0] == 'w')
+      return wine_wgl.p_wglGetProcAddress(lpszProc);
+
+    /* We are dealing with an unknown GL extension. */
+    WARN("Extension '%s' not defined in opengl32.dll's function table!\n", lpszProc);
   } else { /* We are looking for an OpenGL extension */
 
     /* Check if the GL extension required by the function is available */




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic