Module: wine Branch: master Commit: 94abcd532f1ae8e69ed8f4345d11f2ba1b3cc6d8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=94abcd532f1ae8e69ed8f4345d...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jun 27 14:38:58 2012 +0200
wined3d: Always load wgl functions from opengl32.dll.
---
dlls/wined3d/directx.c | 28 +++++++++++----------------- dlls/wined3d/wined3d_gl.h | 7 +++++-- 2 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8fe7562..f576b33 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -5374,18 +5374,25 @@ static BOOL InitAdapters(struct wined3d *wined3d) TRACE("Initializing adapters\n");
if(!mod_gl) { -#ifdef USE_WIN32_OPENGL -#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn); mod_gl = LoadLibraryA("opengl32.dll"); if(!mod_gl) { ERR("Can't load opengl32.dll!\n"); goto nogl_adapter; } + } + +#ifdef USE_WIN32_OPENGL + pwglGetProcAddress = (void*)GetProcAddress(mod_gl, "wglGetProcAddress"); +#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn); #else + /* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 instead of opengl32 */ + pwglGetProcAddress = (void*)GetProcAddress(GetModuleHandleA("gdi32.dll"), "wglGetProcAddress"); #define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn); - /* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 (glXGetProcAddress wrapper) instead of opengl32's */ - mod_gl = GetModuleHandleA("gdi32.dll"); #endif + + if(!pwglGetProcAddress) { + ERR("Unable to load wglGetProcAddress!\n"); + goto nogl_adapter; }
/* Load WGL core functions from opengl32.dll */ @@ -5393,11 +5400,6 @@ static BOOL InitAdapters(struct wined3d *wined3d) WGL_FUNCS_GEN; #undef USE_WGL_FUNC
- if(!pwglGetProcAddress) { - ERR("Unable to load wglGetProcAddress!\n"); - goto nogl_adapter; - } - /* Dynamically load all GL core functions */ GL_FUNCS_GEN; #undef USE_GL_FUNC @@ -5408,17 +5410,9 @@ 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"); - pwglGetCurrentContext = (void*)GetProcAddress(mod_gl, "wglGetCurrentContext"); - pwglGetCurrentDC = (void*)GetProcAddress(mod_gl, "wglGetCurrentDC"); - pwglShareLists = (void*)GetProcAddress(mod_gl, "wglShareLists"); #else wglFinish = (void*)pwglGetProcAddress("wglFinish"); wglFlush = (void*)pwglGetProcAddress("wglFlush"); - pwglDeleteContext = (void*)pwglGetProcAddress("wglDeleteContext"); - pwglGetCurrentContext = (void*)pwglGetProcAddress("wglGetCurrentContext"); - pwglGetCurrentDC = (void*)pwglGetProcAddress("wglGetCurrentDC"); - pwglShareLists = (void*)pwglGetProcAddress("wglShareLists"); #endif
glEnableWINE = glEnable; diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 2ffb14b..fe156d0 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -1713,8 +1713,11 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
#define WGL_FUNCS_GEN \ USE_WGL_FUNC(wglCreateContext) \ - USE_WGL_FUNC(wglGetProcAddress) \ - USE_WGL_FUNC(wglMakeCurrent) + USE_WGL_FUNC(wglDeleteContext) \ + USE_WGL_FUNC(wglGetCurrentContext) \ + USE_WGL_FUNC(wglGetCurrentDC) \ + USE_WGL_FUNC(wglMakeCurrent) \ + USE_WGL_FUNC(wglShareLists)
/* OpenGL extensions. */ enum wined3d_gl_extension