diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 9101ba86a97..5474a45ad25 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3971,7 +3971,7 @@ void fillGLAttribFuncs(WineD3D_GL_Info *gl_info) { #define PUSH1(att) attribs[nAttribs++] = (att); BOOL InitAdapters(void) { - static HMODULE mod_gl; + static HMODULE mod_gl, mod_win32gl; BOOL ret; int ps_selected_mode, vs_selected_mode; @@ -3990,10 +3990,16 @@ BOOL InitAdapters(void) { ERR("Can't load opengl32.dll!\n"); goto nogl_adapter; } + mod_win32gl = mod_gl; #else #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"); + mod_win32gl = LoadLibraryA("opengl32.dll"); + if(!mod_win32gl) { + ERR("Can't load opengl32.dll!\n"); + goto nogl_adapter; + } #endif } @@ -4011,6 +4017,12 @@ BOOL InitAdapters(void) { GL_FUNCS_GEN; #undef USE_GL_FUNC + /* Load glFinish and glFlush from opengl32.dll even if we're not using WIN32 opengl + * otherwise because we have to use winex11.drv's override + */ + glFinish = (void*)GetProcAddress(mod_win32gl, "glFinish"); + glFlush = (void*)GetProcAddress(mod_win32gl, "glFlush"); + /* For now only one default adapter */ { int iPixelFormat; diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index ac4967d4670..7f0b6408ba1 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -890,8 +890,6 @@ void (WINE_GLAPI *glEvalMesh2) (GLenum mode, GLint i1, GLint i2, GLint j1, GLint void (WINE_GLAPI *glEvalPoint1) (GLint i); void (WINE_GLAPI *glEvalPoint2) (GLint i, GLint j); void (WINE_GLAPI *glFeedbackBuffer) (GLsizei size, GLenum type, GLfloat* buffer); -void (WINE_GLAPI *glFinish) (); -void (WINE_GLAPI *glFlush) (); void (WINE_GLAPI *glFogf) (GLenum pname, GLfloat param); void (WINE_GLAPI *glFogfv) (GLenum pname, const GLfloat* params); void (WINE_GLAPI *glFogi) (GLenum pname, GLint param); @@ -1139,6 +1137,12 @@ void (WINE_GLAPI *glVertexPointer) (GLint size, GLenum type, GLsizei stride, con void (WINE_GLAPI *glViewport) (GLint x, GLint y, GLsizei width, GLsizei height); void (WINE_GLAPI *glPointParameterfv) (GLenum pname, const GLfloat *params); +/* glFinish and glFlush are always loaded from opengl32.dll, thus they always have + * __stdcall calling convention + */ +void (__stdcall *glFinish) (); +void (__stdcall *glFlush) (); + /* WGL functions */ HGLRC (WINAPI *pwglCreateContext)(HDC); BOOL (WINAPI *pwglDeleteContext)(HGLRC); @@ -1238,8 +1242,6 @@ BOOL (WINAPI *pwglShareLists)(HGLRC,HGLRC); USE_GL_FUNC(glEvalPoint1) \ USE_GL_FUNC(glEvalPoint2) \ USE_GL_FUNC(glFeedbackBuffer) \ - USE_GL_FUNC(glFinish) \ - USE_GL_FUNC(glFlush) \ USE_GL_FUNC(glFogf) \ USE_GL_FUNC(glFogfv) \ USE_GL_FUNC(glFogi) \