From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/opengl.c | 16 ++++++++++++++++ include/wine/opengl_driver.h | 1 + 2 files changed, 17 insertions(+)
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index ecd95c8c553..4192a8c406c 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1635,10 +1635,26 @@ static BOOL opengl_init( struct opengl_funcs *funcs ) { funcs->opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW | RTLD_GLOBAL ); if (!funcs->opengl_handle) WARN( "Failed to load %s: %s\n", SONAME_LIBGL, dlerror() ); + else funcs->p_glXGetProcAddress = dlsym( funcs->opengl_handle, "glXGetProcAddress" ); } #endif + if (!funcs->p_glXGetProcAddress) return !!funcs->opengl_handle; + +#define USE_GL_FUNC( func ) \ + if (!(funcs->p_##func = (void *)funcs->p_glXGetProcAddress( (GLubyte *)#func ))) \ + { \ + ERR( "Failed to load symbol %s\n", #func ); \ + goto failed; \ + } + ALL_GLX_FUNCS +#undef USE_GL_FUNC
return !!funcs->opengl_handle; + +failed: + dlclose( funcs->opengl_handle ); + funcs->opengl_handle = NULL; + return FALSE; }
static void init_opengl_funcs( struct opengl_funcs *funcs, const struct opengl_driver_funcs *driver_funcs ) diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 29e1085c30c..5d2daf39dc1 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -106,6 +106,7 @@ struct opengl_funcs BOOL (*p_wglSetPixelFormatWINE)( HDC hdc, int format ); BOOL (*p_wglSwapIntervalEXT)( int interval ); #define USE_GL_FUNC(x) PFN_##x p_##x; + ALL_GLX_FUNCS ALL_EGL_FUNCS ALL_GL_FUNCS ALL_GL_EXT_FUNCS