From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 13 +++++-- dlls/opengl32/make_opengl | 1 + dlls/opengl32/unix_thunks.c | 1 + dlls/win32u/opengl.c | 70 ++++++++++++++++++++++++++++++++++++ include/wine/opengl_driver.h | 10 +++++- 5 files changed, 91 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 0a9d37f94d7..353fbc1948d 100644 --- a/configure.ac +++ b/configure.ac @@ -983,7 +983,6 @@ case $host_os in WINE_TRY_CFLAGS([-fPIC -Wl,--export-dynamic],[WINELOADER_LDFLAGS="-Wl,--export-dynamic"]) WINEPRELOADER_LDFLAGS="-static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7d400000"
- WINE_CHECK_SONAME(EGL,eglGetProcAddress) WINE_CHECK_SONAME(GLESv2,glFlush)
if test "x$exec_prefix" = xNONE @@ -1213,6 +1212,16 @@ WINE_ERROR_WITH(pthread,[test "x$ac_cv_func_pthread_create" != xyes -a "x$PTHREA [pthread ${notice_platform}development files not found. Wine cannot support threads without libpthread.])
+dnl **** Check for EGL **** + +if test "x$with_opengl" != "xno" +then + WINE_PACKAGE_FLAGS(EGL,[egl],[-lEGL],,, + [WINE_CHECK_SONAME(EGL,eglGetProcAddress,,,[$EGL_LIBS])]) + WINE_NOTICE_WITH(opengl, [test -z "$ac_cv_lib_soname_EGL"], + [EGL ${notice_platform}development files not found]) +fi + dnl **** Check for X11 ****
AC_PATH_X @@ -1401,8 +1410,6 @@ then AC_CHECK_LIB(xkbregistry,rxkb_context_new,[:],[XKBREGISTRY_LIBS=""],[$XKBREGISTRY_LIBS])]) if test "x$with_opengl" != "xno" then - WINE_PACKAGE_FLAGS(EGL,[egl],[-lEGL],,, - [WINE_CHECK_SONAME(EGL,eglGetProcAddress,,,[$EGL_LIBS])]) WINE_PACKAGE_FLAGS(WAYLAND_EGL,[wayland-egl],,,, [AC_CHECK_HEADER([wayland-egl.h], [AC_CHECK_LIB(wayland-egl,wl_egl_window_create, diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index fa4983384a5..8f6d825f42e 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -1224,6 +1224,7 @@ print OUT "#if 0\n"; print OUT "#pragma makedep unix\n"; print OUT "#endif\n\n";
+print OUT "#include <config.h>\n"; print OUT "#include <stdarg.h>\n"; print OUT "#include <stddef.h>\n\n";
diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 26f89bfc1eb..0f0154f9e17 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -4,6 +4,7 @@ #pragma makedep unix #endif
+#include <config.h> #include <stdarg.h> #include <stddef.h>
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 7b3910c5ab4..f0cca3b06b4 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -173,6 +173,74 @@ static void register_extension( char *list, size_t size, const char *name ) } }
+#ifdef SONAME_LIBEGL + +static BOOL egl_init(void) +{ + struct opengl_funcs *funcs = &display_funcs; + const char *extensions; + + if (!(funcs->egl_handle = dlopen( SONAME_LIBEGL, RTLD_NOW | RTLD_GLOBAL ))) + { + ERR( "Failed to load %s: %s\n", SONAME_LIBEGL, dlerror() ); + goto failed; + } + +#define LOAD_FUNCPTR( name ) \ + if (!(funcs->p_##name = dlsym( funcs->egl_handle, #name ))) \ + { \ + ERR( "Failed to find EGL function %s\n", #name ); \ + goto failed; \ + } + LOAD_FUNCPTR( eglGetProcAddress ); + LOAD_FUNCPTR( eglQueryString ); +#undef LOAD_FUNCPTR + + if (!(extensions = funcs->p_eglQueryString( EGL_NO_DISPLAY, EGL_EXTENSIONS ))) + { + ERR( "Failed to find client extensions\n" ); + goto failed; + } + TRACE( "EGL client extensions:\n" ); + dump_extensions( extensions ); + +#define CHECK_EXTENSION( ext ) \ + if (!has_extension( extensions, #ext )) \ + { \ + ERR( "Failed to find required extension %s\n", #ext ); \ + goto failed; \ + } + CHECK_EXTENSION( EGL_KHR_client_get_all_proc_addresses ); + CHECK_EXTENSION( EGL_EXT_platform_base ); +#undef CHECK_EXTENSION + +#define USE_GL_FUNC( func ) \ + if (!funcs->p_##func && !(funcs->p_##func = (void *)funcs->p_eglGetProcAddress( #func ))) \ + { \ + ERR( "Failed to load symbol %s\n", #func ); \ + goto failed; \ + } + ALL_EGL_FUNCS +#undef USE_GL_FUNC + + return TRUE; + +failed: + dlclose( display_funcs.egl_handle ); + display_funcs.egl_handle = NULL; + return FALSE; +} + +#else /* SONAME_LIBEGL */ + +static BOOL egl_init(void) +{ + WARN( "EGL support not compiled in!\n" ); + return FALSE; +} + +#endif /* SONAME_LIBEGL */ + #ifdef SONAME_LIBOSMESA
#define OSMESA_COLOR_INDEX GL_COLOR_INDEX @@ -1350,6 +1418,8 @@ static void display_funcs_init(void) { UINT status;
+ if (egl_init()) TRACE( "Initialized EGL library\n" ); + if ((status = user_driver->pOpenGLInit( WINE_OPENGL_DRIVER_VERSION, &display_funcs, &display_driver_funcs ))) WARN( "Failed to initialize the driver OpenGL functions, status %#x\n", status );
diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index e87085da7b6..32ef8010e27 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -60,8 +60,14 @@ struct wgl_pixel_format
#ifdef WINE_UNIX_LIB
+#ifdef HAVE_EGL_EGL_H +#define EGL_EGLEXT_PROTOTYPES +#include <EGL/egl.h> +#include <EGL/eglext.h> +#endif /* HAVE_EGL_EGL_H */ + /* Wine internal opengl driver version, needs to be bumped upon opengl_funcs changes. */ -#define WINE_OPENGL_DRIVER_VERSION 32 +#define WINE_OPENGL_DRIVER_VERSION 33
struct wgl_context; struct wgl_pbuffer; @@ -109,6 +115,8 @@ struct opengl_funcs ALL_GL_FUNCS ALL_GL_EXT_FUNCS #undef USE_GL_FUNC + + void *egl_handle; };
/* interface between win32u and the user drivers */