wined3d: Always load wgl functions from opengl32.dll.

This commit is contained in:
Alexandre Julliard 2012-06-27 14:38:58 +02:00
parent 6207d9642c
commit 94abcd532f
2 changed files with 16 additions and 19 deletions

View File

@ -5374,18 +5374,25 @@ static BOOL InitAdapters(struct wined3d *wined3d)
TRACE("Initializing adapters\n"); TRACE("Initializing adapters\n");
if(!mod_gl) { if(!mod_gl) {
#ifdef USE_WIN32_OPENGL
#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn);
mod_gl = LoadLibraryA("opengl32.dll"); mod_gl = LoadLibraryA("opengl32.dll");
if(!mod_gl) { if(!mod_gl) {
ERR("Can't load opengl32.dll!\n"); ERR("Can't load opengl32.dll!\n");
goto nogl_adapter; 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 #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); #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 #endif
if(!pwglGetProcAddress) {
ERR("Unable to load wglGetProcAddress!\n");
goto nogl_adapter;
} }
/* Load WGL core functions from opengl32.dll */ /* Load WGL core functions from opengl32.dll */
@ -5393,11 +5400,6 @@ static BOOL InitAdapters(struct wined3d *wined3d)
WGL_FUNCS_GEN; WGL_FUNCS_GEN;
#undef USE_WGL_FUNC #undef USE_WGL_FUNC
if(!pwglGetProcAddress) {
ERR("Unable to load wglGetProcAddress!\n");
goto nogl_adapter;
}
/* Dynamically load all GL core functions */ /* Dynamically load all GL core functions */
GL_FUNCS_GEN; GL_FUNCS_GEN;
#undef USE_GL_FUNC #undef USE_GL_FUNC
@ -5408,17 +5410,9 @@ static BOOL InitAdapters(struct wined3d *wined3d)
#ifdef USE_WIN32_OPENGL #ifdef USE_WIN32_OPENGL
wglFinish = (void*)GetProcAddress(mod_gl, "glFinish"); wglFinish = (void*)GetProcAddress(mod_gl, "glFinish");
wglFlush = (void*)GetProcAddress(mod_gl, "glFlush"); 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 #else
wglFinish = (void*)pwglGetProcAddress("wglFinish"); wglFinish = (void*)pwglGetProcAddress("wglFinish");
wglFlush = (void*)pwglGetProcAddress("wglFlush"); wglFlush = (void*)pwglGetProcAddress("wglFlush");
pwglDeleteContext = (void*)pwglGetProcAddress("wglDeleteContext");
pwglGetCurrentContext = (void*)pwglGetProcAddress("wglGetCurrentContext");
pwglGetCurrentDC = (void*)pwglGetProcAddress("wglGetCurrentDC");
pwglShareLists = (void*)pwglGetProcAddress("wglShareLists");
#endif #endif
glEnableWINE = glEnable; glEnableWINE = glEnable;

View File

@ -1713,8 +1713,11 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
#define WGL_FUNCS_GEN \ #define WGL_FUNCS_GEN \
USE_WGL_FUNC(wglCreateContext) \ USE_WGL_FUNC(wglCreateContext) \
USE_WGL_FUNC(wglGetProcAddress) \ USE_WGL_FUNC(wglDeleteContext) \
USE_WGL_FUNC(wglMakeCurrent) USE_WGL_FUNC(wglGetCurrentContext) \
USE_WGL_FUNC(wglGetCurrentDC) \
USE_WGL_FUNC(wglMakeCurrent) \
USE_WGL_FUNC(wglShareLists)
/* OpenGL extensions. */ /* OpenGL extensions. */
enum wined3d_gl_extension enum wined3d_gl_extension