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.
Instead of iterating over the list of compiler flags, we should use the
get_supported_arguments() method of the compiler object, which does it
for us — and maybe, in the future, will be optimised to do the checks in
parallel.
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
Epoxy should provide a function that returns the version of the GL
shading language in use, in the same vein as it allows to get the
version of GL.
Closes: #145
The `enable-` prefix is an Autotool-ism; idiomatic naming for Meson
projects should just use the name of the option, and rely on the type
to convey meaning, especially because Meson does not have `disable`
aliases that avoid the explicit `enable-foo=no` cases.
Epoxy can be compiled with GLX and X11 native resources on EGL. We can
disable the former, but the latter is always built in when enabling EGL
support.
Some platforms do not support X11 at all, so we need a way to disable
X11 when configuring Epoxy.
If the system we're building Epoxy on has GL and EGL pkg-config modules,
then we should add them to the Requires.private field of the pkg-config
file.
The Requires.private field does not contribute to the linker flags
generated by pkg-config, unless we're doing a static build; it does,
however, contribute to the compiler flags generated by pkg-config, which
means that platforms that specify ad hoc compiler flags for their GL and
EGL implementations via pkg-config will be able to propagate them
through Epoxy.
Closes: #139
Instead of using a template file, and filling in the blanks, we can use
the Meson pkgconfig module to generate the pkg-config file mostly from
the library object itself — including dependencies and flags.
The template file remains in tree for the Autotools build.
The common EGL testing code uses XOpenDisplay(), which means we need to
explicitly include the Xlib.h header file, instead of relying on
something else stringing it along.
We currently run CI on Linux only, given that the macOS builders in
Travis are always fairly overwhelmed; thus, there's no need to
complicate the Travis script with a conditional that is always going to
be true.
Add libOpenGL to the list of libraries we'll intercept. This is harmless
if glvnd is not available as the dlopen(libOpenGL.so) will fail, but
without this we can't intercept glGetString, which the
egl_and_glx_different_pointers_glx test needs to be able to do.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Both gcc and clang define __ANDROID__ but not ANDROID when targeting Android so
at least with the Meson build, and an NDK r16 toolchain, testing on
Android failed without this change.
This avoids any unnecessary allocations when simply passing static strings
to be printed onto stderr, and uses the simpler fputs mechanism.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This mutes compiler warnings for `dlwrap.c` by ensuring we actually check
the return status of the `asprintf` call. At this point in the test suite
our possible failure here is only memory, so we'll abort.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
The EGL_EXT_device_query extension introduces the
eglQueryDeviceStringEXT() function, which can be used with an
EGLDeviceEXT enumeration to receive an OpenGL extension string
containing all of the device extensions supported by it. From the
EGL_EXT_device_query spec's amendments to section "3.2 Devices" after
"3.1 Errors":
const char *eglQueryDeviceStringEXT(EGLDeviceEXT device,
EGLint name);
returns a pointer to a static, zero-terminated string describing
some aspect of the specified EGLDeviceEXT. <name> must be
EGL_EXTENSIONS.
Since OpenGL extension parsing is rather simple, and we could always run
into additional cases similar to this one in the future, we expose the
shared epoxy_extension_in_string() function in libepoxy's public headers
so that users can save themselves the hassle of having to write their
own extension parser.
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
This code attempts not to dlopen anything if it can find the appropriate
winsys symbols in the global namespace. That's nice. However we normally
do dlopen(RTLD_LOCAL) when we open lib{GLX,EGL} so those symbols will
_not_ in fact be in the global namespace. The code also prefers checking
GLX to EGL, which means even if we initialize EGL through epoxy, and
even if we're using glvnd, we'll still dlopen libGL the first time we
hit epoxy_is_desktop_gl().
There's a couple of ways to skin this cat, let's take the easy one. If
either-but-not-both of the glx or egl handles in the global API state
are initialized, then we know we're already in one or the other. If
neither or both are initialized, then the current heuristic should work
fine.
Note that epoxy_is_desktop_gl() is only bothering to check for GLX to
work around PowerVR's broken GLES. One suspects a better way to do that
would be to check GL_VENDOR or GL_RENDERER and avoid probing the window
system at all.
Signed-off-by: Adam Jackson <ajax@redhat.com>
The EGL API update from d11104f2b5 introduced a dependency on the
EGL_CAST() macro, provided by an updated eglplatform.h. Given that we
don't provide eglplatform.h, add a fallback definition for if we're
building against Mesa 17.0.x or similar.
https://bugs.gentoo.org/show_bug.cgi?id=623926