Commit Graph
268 Commits
Author SHA1 Message Date
osy 3acbed0507 Add EGL ANGLE extensions header 2026-02-22 21:21:28 -08:00
Emmanuele Bassi e98617e62e Merge pull request #285 from lb90/check-egl-support-at-runtime
Check for EGL support at runtime before calling into EGL functions
2024-11-11 14:34:08 +00:00
Emmanuele Bassi f13c13c11c Merge pull request #259 from lanodan/bugfix/opengl_glvnd
meson.build: Fallback from libGL to libOpenGL when GLX is disabled
2024-07-02 13:05:18 +02:00
Luca Bacci 1a2ad512d4 Check for EGL support at runtime before calling into egl functions 2023-03-23 18:31:52 +01:00
Nirbheek Chauhan ec0fb1850b meson: Override dependency to improve usage as a subproject
With this change, libepoxy can be consumed as a subproject without
making any changes to the build files of a project. All you need to do
is provide a wrap file with a `[provide]` section:

https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section

This is also necessary because otherwise projects need to hard-code
the subproject name, which might be `libepoxy` when using `wrap-git` or
`libepoxy-1.5.10` when using `wrap-file` (to build from a release
tarball). This can cause conflicts between different subprojects that
consume libepoxy differently.

Other projects like glib, cairo, pango, etc already do this.
2022-12-18 09:33:20 +05:30
Alex Richardson 9bf4788455 Add the right include paths for EGL and X11 headers
Libepoxy currently depends on all headers living under the same prefix.
This is not necessarily true: X11 headers can live in a separate prefix,
for instance under /opt/X11. This is also the case when cross-compiling to
a platform that sets up the build environment in non-standard ways.

We could add `x11_dep` and `egl_dep` to the libepoxy target dependencies,
but that could potentially add spurious linker flags and cause libepoxy to
depend on libraries it will dlopen() during normal operations.

To avoid that case, we use a partial_dep() object from Meson, and we limit
the dependency to compiler flags and inclusion paths.
2022-02-16 19:37:01 +00:00
Caolán McNamara 063c1df279 fix error: use of undeclared identifier 'OPENGL_LIB'
at epoxy/src/dispatch_common.c:690 in LibreOffice android build with
libepoxy-1.5.9
2021-10-20 11:09:09 +01:00
Haelwenn (lanodan) Monnier 702a0e6639 meson.build: Fallback from libGL to libOpenGL when GLX is disabled 2021-08-31 00:44:03 +02:00
John Bates 7975061f6b Allow libopengl.so to be used when GLX_LIB is missing
This maintains compatibility with previous behavior of
always using GLX_LIB if it is found. The only change is
when there is no GLX_LIB.

Previous behavior when no GLX_LIB:
- abort.

New behavior when no GLX_LIB:
- Try to load libOpenGL.so as gl_handle (glx_handle remains NULL).
- Else, abort.

Reviewed-by: Emil Velikov <[email protected]>
2021-07-02 11:57:17 -07:00
Emmanuele Bassi 622ca393c3 Revert "If glvnd library found, do not use libGL.so in epoxy_load_gl"
Commit dbfa4b20 has introduced a string of regressions in the X server
and KWin.

This reverts commit dbfa4b209c.

See: #252
2021-05-21 15:35:41 +01:00
Emmanuele Bassi c2148eb019 Revert "Do not overwrite glx_handle in epoxy_load_gl if GLX library is loaded already"
This reverts commit 4994c48172.
2021-05-21 15:35:35 +01:00
Emmanuele Bassi 1403303e77 Remove redeclaration of khronos_uintptr_t
The type is being redeclared because I didn't see the original
declaration when I wrote 144cbc9325.

Fixes: #249
2021-04-30 12:15:25 +01:00
Emmanuele Bassi 0a304d1a25 Merge pull request #247 from anholt/win64-khr-types
Support Win64 pointer-sized types
2021-04-19 15:46:30 +01:00
Emmanuele Bassi 144cbc9325 Support Win64 pointer-sized types
Since we're generating stub types from khrplatform.h because we can't
include it reliably, we'll have to deal with some of the fallout of the
Win64 types.

Fixes: #246
2021-03-21 19:02:58 +00:00
Aleksandr d0b319e27b gen_dispatch.py: close output files
Fixes https://github.com/anholt/libepoxy/issues/242
2021-03-06 09:11:44 +06:00
Emmanuele Bassi de08cf3479 Merge pull request #238 from anholt/pull-229-alt
Fix some bugs in loading OpenGL/GLX/EGL libraries
2021-01-20 15:18:00 +00:00
Xavier Claessens 950b9f5b25 meson: Set same variables in declare_dependency() as in pkgconfig
GTK currently fails to detect if epoxy has been built with EGL on
Windows when epoxy is a subproject. To fix that it needs to get that
information from the dependency variables.

This requires Meson >=0.54.0 for setting variables in
declare_dependency().
2021-01-20 08:09:14 -05:00
Yaroslav Isakov 4994c48172 Do not overwrite glx_handle in epoxy_load_gl if GLX library is loaded already
Reviewed-by: Adam Jackson <[email protected]>

Signed-off-by: Emmanuele Bassi <[email protected]>
2021-01-20 12:23:43 +00:00
Yaroslav Isakov dbfa4b209c If glvnd library found, do not use libGL.so in epoxy_load_gl
Without additional check, even if libOpenGL was loaded, libGL.so will
be loaded as well, and used both in gl_handle and glx_handle, so
libglvnd libraries will not be used.

Reviewed-by: Adam Jackson <[email protected]>

Signed-off-by: Emmanuele Bassi <[email protected]>
2021-01-20 12:18:57 +00:00
Emmanuele Bassi f91fb0a0b6 Use Meson's darwin_versions argument
Instead of tweaking the linker flags ourselves. This allows Meson to do
the right thing, and pass the arguments only where needed.
2020-07-21 19:37:51 +01:00
Eric Anholt 1e0b063dbd Fix return value of shading language for GLES2.
Throughout the mesa project we've been using 100 for GLES2's shading
language.  It was pretty clearly the intent here, but the clever
inline detection of "am I parsing a GLSL version or a GL version
string" forgot about GLSL 1.0.x, and thus returned 10.
2020-04-20 13:01:08 -07:00
Emmanuele Bassi 6b09a8bc48 Use EGL_NO_X11 to disable X11 headers
MESA_EGL_NO_X11_HEADERS has been deprecated, and libglvnd only supports
EGL_NO_X11.

Fixes: #214
2020-01-14 11:37:58 +00:00
Eric Anholt 3ff32faa18 Remove the autotools build system.
Meson has been out for a long time, is faster, and is simpler.
2019-11-26 15:07:43 +00:00
Emmanuele Bassi 7baa918b3f Remove Python 2 support
Python 2 is going to reach EOL in January 2020, and most platforms have
already moved to Python 3.
2019-11-14 15:10:01 +00:00
Eric Anholt 8573dbcee3 Reuse the enum_strings in looking for extension providers.
Shaves another 14k off the binary:

1114236	  56800	    160	1171196	 11defc	providernames.so
1099948	  56800	    160	1156908	 11a72c	enumstrings.so

Fixes #202
2019-06-25 18:29:34 -04:00
Eric Anholt 4b4cd1d768 Drop "GL extension" and "GLX extension" and such from the debug output.
Saves 7k of text from the binary.  You can already tell what kind of
extension it is from the prefix on the extension name anyway.

1121212	  56800	    160	1178172	 11fa3c	master.so
1114236	  56800	    160	1171196	 11defc	providernames.so
2019-06-25 18:29:34 -04:00
Eric Anholt 7ce1896dcc Make the provider enums have a PROVIDER_ prefix
This will distinguish them from the exposed extension presence
2019-06-25 18:29:34 -04:00
Emmanuele Bassi bf531d1042 build: Drop conditional use of get_supported_link_arguments()
Meson complains even in the face of a version check.
2018-10-04 18:07:34 +02:00
Zhao Zhili 119f06f823 dispatch_common: fix conditional compilation 2018-07-16 12:51:48 +08:00
Adam Jackson 2edc497374 dispatch: Fix GLES3 symbol lookup
Looking for a symbol named "libGLESv2.so.2" is probably not going to
work very well.
2018-07-06 13:36:29 -04:00
Emmanuele Bassi 8c3d371187 Use the appropriate symbols on __APPLE__
When building on macOS we don't have access to EGL, and GLX support is
conditional.

We should ensure we're using the appropriate paths depending on the
platform, and protect our use of macros to avoid undefined symbols.

Closes: #176
2018-05-29 22:58:41 +01:00
Emmanuele Bassi 350a98a308 Disable EGL on macOS
EGL is not available on macOS, except through Objective C.
2018-05-29 22:47:40 +01:00
Adam Jackson 707f50e680 dispatch: Try harder to avoid calling the resolver
Our caller may load (eg) epoxy_glAlphaFunc, which is a function pointer,
and then call through that value multiple times. Until the caller
re-examines the value of that function pointer, which is a copy
relocation in the executable, repeated calls mean repeated work
resolving the GL function.

We can't make the caller reinspect the variable, but the resolver
function can avoid doing redundant work.

Fixes: anholt/libepoxy#171
Signed-off-by: Adam Jackson <[email protected]>
2018-05-17 12:03:33 -04:00
Emmanuele Bassi c00c889e62 Use -Bsymbolic-functions instead of -Bsymbolic
Epoxy updates the function pointers in order to avoid calling the
resolver multiple times, but with -Bsymbolic we're going to update the
copy inside libepoxy, instead of the relocated copy in the code using
libepoxy. This leads to libepoxy constantly querying the function
resolver code instead of just once.

We still want to avoid intra-library relocations for our functions,
but we need to live with them for our global function pointers.

See issue #171
2018-05-17 12:02:42 -04:00
Emmanuele Bassi 791b28c186 Use abort() instead of exit(1)
We want to consistently handle exceptions for the internal state checks;
calling `exit()` does not allow us to attach a debugger and get a proper
trace.
2018-05-17 12:02:42 -04:00
Adam Jackson 90db0069b4 dispatch: Load EGL/GLX provider lib from epoxy_has_{egl,glx}()
Now that we're being conservative about probing libraries, these
entrypoints would not succeed unless the caller had already dlopened
stuff themselves, or had explicitly linked against the provider library.
Both of those are exactly not what we want.

Signed-off-by: Adam Jackson <[email protected]>
2018-05-01 11:50:30 -04:00
Adam Jackson 53ae0bbffe dispatch: Stop implicitly loading libraries from do_dlsym
Mostly this is to get all the calls to get_dlopen_handle nicely isolated
so they're easier to reason about.

Signed-off-by: Adam Jackson <[email protected]>
2018-05-01 11:20:30 -04:00
Adam Jackson a33623dca7 dispatch: Be even gentler about probing for GLX
dlsym(NULL) can only see (symbols in) libraries that are loaded
RTLD_GLOBAL, but our dlopen()s are RTLD_LOCAL and probably so was the
one the app did if it did one. So use RTLD_NOLOAD to probe for the
library even if it's LOCAL, iff the lookup is non-fatal.

Having done that, don't ever load any libraries on this path. We only
perform this check while resolving rendering API functions, and the
window system resolution paths already load the appropriate library if
they need to. Since you have to have gone through a winsys to get a
context, and our resolvers only run when a function is _called_, this
would only introduce a failure mode if you tried to call a function
without a context bound.

Signed-off-by: Adam Jackson <[email protected]>
2018-04-30 15:38:01 -04:00
Adam Jackson b5a4b16799 dispatch: Query the EGL context version when bootstrapping on GLES
We're about to change our dlopen paths to do RTLD_NOLOAD more
aggressively. The issue then is we can create an EGL GLES context
without libGLES* ever being loaded. test/egl_gles2_without_glx will fail
in such a world: the first gentle probe for libGLESv2 will fail, then
the less-gentle probe for libGLESv1_CM will be shot down by the test,
and we exit.

Fortunately by the time we've gotten to this point the context exists,
so we can query its version via EGL instead.

Signed-off-by: Adam Jackson <[email protected]>
2018-04-30 15:33:42 -04:00
Emmanuele Bassi 610203a1a4 meson: Fix the -z,relro flag
We're missing a dash.
2018-04-25 18:50:28 +01:00
Emmanuele Bassi af76cd235d meson: Conditionally test for linker flags
Meson 0.46 introduced a function to check for linker flags passed to the
compiler; since the version is really brand new, I don't want to bump
the dependency on Meson just yet, so we're going to conditionally use
get_supported_link_arguments() only if we're building with Meson 0.46 or
later.
2018-04-25 11:37:44 +01:00
Adam Jackson f7486f7753 dispatch: assert, not errx, when we have no context
errx() calls exit(), you'd rather get a backtrace.

Signed-off-by: Adam Jackson <[email protected]>
2018-04-12 11:04:10 -04:00
Emmanuele Bassi 500f522d47 Merge pull request #156 from tschoonj/fix-gl-pkgconfig-macos
meson: do not add gl to pkg-config file on macOS
2018-03-12 12:18:54 +00:00
Emmanuele Bassi 2189bc0d9b Merge pull request #159 from luzpaz/misc-typos
Trival misc. typo fixes
2018-03-12 12:18:25 +00:00
Ross Burton f9098b0c18 autotools: check for dlvsym
As per the previous commit, instead of assuming that Apple doesn't have dlvsym
but everywhere else does, actually check for dlvsym() existing as that function
is glibc-specific.
2018-03-12 12:02:08 +00:00
luz.paz d60b923d46 Trival misc. typo fixes 2018-03-05 06:08:53 -05:00
Tom Schoonjans dc5e092584 meson: do not add gl to pkg-config file on macOS
Even though meson will find the dependency gl on macOS, this does not mean that
there is a pkg-config file for it, as meson does not use pkg-config to
establish its presence. It should therefore not be added to
the libepoxy pkg-config file as a (private) requirement.
2018-03-04 10:40:55 +00:00
Emmanuele Bassi e1ffd32d83 Support encoding minor versions bigger than 10
The GL version minor numbers haven't hit 10, yet, but if they do we're
going to get non-sensical encoded versions when calling
epoxy_gl_version(), like we're getting right now, with the GLSL version
numbers.

If the minor number is larger than the multiplication factor used for
the major number, we should bump up the factor to the next order of
magnitude.
2018-02-24 14:03:06 +00:00
Emmanuele Bassi 60bb7672c1 Fix epoxy_internal_gl_version()
The glGetString() function takes a GLenum, so we should too.
2018-02-24 13:39:16 +00:00
Emmanuele Bassi f6d2b1f6ad Do not use OPENGL_LIB on Android
When building on Android we end up in the Linux branch of the symbol
loading logic, but the __ANDROID__ conditional does not have the
OPENGL_LIB symbol defined, and that breaks the build.

Closes: #152
2018-02-23 20:01:36 +00:00