From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/opengl.c | 47 +++++++++++------------------------ 1 file changed, 14 insertions(+), 33 deletions(-)
diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c index b8b673f398a..18d304c2754 100644 --- a/dlls/winewayland.drv/opengl.c +++ b/dlls/winewayland.drv/opengl.c @@ -1155,19 +1155,12 @@ static void describe_pixel_format(EGLConfig config, struct wgl_pixel_format *fmt #undef SET_ATTRIB_ARB }
-static BOOL has_opengl(void); - static void wayland_get_pixel_formats(struct wgl_pixel_format *formats, UINT max_formats, UINT *num_formats, UINT *num_onscreen_formats) { UINT i;
- if (!has_opengl()) - { - *num_formats = *num_onscreen_formats = 0; - return; - } if (formats) { for (i = 0; i < min(max_formats, num_egl_configs); ++i) @@ -1320,15 +1313,25 @@ static BOOL init_egl_configs(void) return TRUE; }
-static void init_opengl(void) +/********************************************************************** + * WAYLAND_wine_get_wgl_driver + */ +struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version) { EGLint egl_version[2]; const char *egl_client_exts, *egl_exts;
+ if (version != WINE_WGL_DRIVER_VERSION) + { + ERR("Version mismatch, opengl32 wants %u but driver has %u\n", + version, WINE_WGL_DRIVER_VERSION); + return NULL; + } + if (!(egl_handle = dlopen(SONAME_LIBEGL, RTLD_NOW|RTLD_GLOBAL))) { ERR("Failed to load %s: %s\n", SONAME_LIBEGL, dlerror()); - return; + return NULL; }
#define LOAD_FUNCPTR_DLSYM(func) \ @@ -1403,19 +1406,12 @@ static void init_opengl(void)
if (!init_opengl_funcs()) goto err; if (!init_egl_configs()) goto err; - - return; + return &opengl_funcs;
err: dlclose(egl_handle); egl_handle = NULL; -} - -static BOOL has_opengl(void) -{ - static pthread_once_t init_once = PTHREAD_ONCE_INIT; - - return !pthread_once(&init_once, init_opengl) && egl_handle; + return NULL; }
static struct opengl_funcs opengl_funcs = @@ -1434,21 +1430,6 @@ static struct opengl_funcs opengl_funcs = } };
-/********************************************************************** - * WAYLAND_wine_get_wgl_driver - */ -struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version) -{ - if (version != WINE_WGL_DRIVER_VERSION) - { - ERR("Version mismatch, opengl32 wants %u but driver has %u\n", - version, WINE_WGL_DRIVER_VERSION); - return NULL; - } - if (!has_opengl()) return NULL; - return &opengl_funcs; -} - /********************************************************************** * wayland_destroy_gl_drawable */