[PATCH] Wined3D: Avoid loading opengl32.dll=0A=

Stefan Doesinger stefan at codeweavers.com
Sun Nov 23 12:43:15 CST 2008


=0A=
This confuses applications like Steam, which hook d3d9 and opengl=0A=
functions. It sees that the application uses opengl32, but it=0A=
doesn't realize that d3d9 is wrapped to opengl. Thus it starts=0A=
messing around with wined3d's wgl context. It usually tries to=0A=
draw geometry with the context, but cannot deal with some of the=0A=
obscure extensions we have activated.=0A=
---=0A=
 dlls/wined3d/directx.c |   16 ++++++++--------=0A=
 1 files changed, 8 insertions(+), 8 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c=0A=
index c3a35a4..2f21144 100644=0A=
--- a/dlls/wined3d/directx.c=0A=
+++ b/dlls/wined3d/directx.c=0A=
@@ -4173,7 +4173,7 @@ void fillGLAttribFuncs(WineD3D_GL_Info *gl_info) {=0A=
 =0A=
 #define PUSH1(att)        attribs[nAttribs++] =3D (att);=0A=
 BOOL InitAdapters(void) {=0A=
-    static HMODULE mod_gl, mod_win32gl;=0A=
+    static HMODULE mod_gl;=0A=
     BOOL ret;=0A=
     int ps_selected_mode, vs_selected_mode;=0A=
 =0A=
@@ -4197,11 +4197,6 @@ BOOL InitAdapters(void) {=0A=
 #define USE_GL_FUNC(pfn) pfn =3D (void*)pwglGetProcAddress(#pfn);=0A=
         /* To bypass the opengl32 thunks load wglGetProcAddress from =
gdi32 (glXGetProcAddress wrapper) instead of opengl32's */=0A=
         mod_gl =3D GetModuleHandleA("gdi32.dll");=0A=
-        mod_win32gl =3D LoadLibraryA("opengl32.dll");=0A=
-        if(!mod_win32gl) {=0A=
-            ERR("Can't load opengl32.dll!\n");=0A=
-            goto nogl_adapter;=0A=
-        }=0A=
 #endif=0A=
     }=0A=
 =0A=
@@ -4222,8 +4217,13 @@ BOOL InitAdapters(void) {=0A=
     /* Load glFinish and glFlush from opengl32.dll even if we're not =
using WIN32 opengl=0A=
      * otherwise because we have to use winex11.drv's override=0A=
      */=0A=
-    glFinish =3D (void*)GetProcAddress(mod_win32gl, "glFinish");=0A=
-    glFlush =3D (void*)GetProcAddress(mod_win32gl, "glFlush");=0A=
+#ifdef USE_WIN32_OPENGL=0A=
+    glFinish =3D (void*)GetProcAddress(mod_gl, "glFinish");=0A=
+    glFlush =3D (void*)GetProcAddress(mod_gl, "glFlush");=0A=
+#else=0A=
+    glFinish =3D (void*)pwglGetProcAddress("wglFinish");=0A=
+    glFlush =3D (void*)pwglGetProcAddress("wglFlush");=0A=
+#endif=0A=
 =0A=
     /* For now only one default adapter */=0A=
     {=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_0042_01C95040.1F4849D0--




More information about the wine-patches mailing list