summaryrefslogtreecommitdiff
path: root/src/dispatch_common.c
Commit message (Collapse)AuthorAgeFilesLines
* fix error: use of undeclared identifier 'OPENGL_LIB'Caolán McNamara2021-10-201-0/+4
| | | | | at epoxy/src/dispatch_common.c:690 in LibreOffice android build with libepoxy-1.5.9
* Allow libopengl.so to be used when GLX_LIB is missingJohn Bates2021-07-021-3/+13
| | | | | | | | | | | | | | | 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 <emil.velikov@collabora.com>
* Revert "If glvnd library found, do not use libGL.so in epoxy_load_gl"Emmanuele Bassi2021-05-211-6/+3
| | | | | | | | | Commit dbfa4b20 has introduced a string of regressions in the X server and KWin. This reverts commit dbfa4b209c0712b67dfeb8366c2ebe8503063b52. See: #252
* Revert "Do not overwrite glx_handle in epoxy_load_gl if GLX library is ↵Emmanuele Bassi2021-05-211-2/+1
| | | | | | loaded already" This reverts commit 4994c48172e94ca81c000597e0abc0ea0e682b3c.
* Do not overwrite glx_handle in epoxy_load_gl if GLX library is loaded alreadypull-229-altYaroslav Isakov2021-01-201-1/+2
| | | | | | Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* If glvnd library found, do not use libGL.so in epoxy_load_glYaroslav Isakov2021-01-201-3/+6
| | | | | | | | | | 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 <ajax@redhat.com> Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Fix return value of shading language for GLES2.glslesEric Anholt2020-04-201-10/+5
| | | | | | | 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.
* dispatch_common: fix conditional compilationZhao Zhili2018-07-161-2/+2
|
* dispatch: Fix GLES3 symbol lookupAdam Jackson2018-07-061-1/+1
| | | | | Looking for a symbol named "libGLESv2.so.2" is probably not going to work very well.
* Use the appropriate symbols on __APPLE__Emmanuele Bassi2018-05-291-13/+18
| | | | | | | | | | 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
* Use abort() instead of exit(1)Emmanuele Bassi2018-05-171-3/+3
| | | | | | 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.
* dispatch: Load EGL/GLX provider lib from epoxy_has_{egl,glx}()Adam Jackson2018-05-011-18/+18
| | | | | | | | | 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 <ajax@redhat.com>
* dispatch: Stop implicitly loading libraries from do_dlsymAdam Jackson2018-05-011-32/+55
| | | | | | | 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 <ajax@redhat.com>
* dispatch: Be even gentler about probing for GLXAdam Jackson2018-04-301-34/+7
| | | | | | | | | | | | | | | | | 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 <ajax@redhat.com>
* dispatch: Query the EGL context version when bootstrapping on GLESAdam Jackson2018-04-301-10/+10
| | | | | | | | | | | | | | 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 <ajax@redhat.com>
* dispatch: assert, not errx, when we have no contextAdam Jackson2018-04-121-1/+1
| | | | | | errx() calls exit(), you'd rather get a backtrace. Signed-off-by: Adam Jackson <ajax@redhat.com>
* Trival misc. typo fixesluz.paz2018-03-051-1/+1
|
* Support encoding minor versions bigger than 10Emmanuele Bassi2018-02-241-3/+9
| | | | | | | | | | | 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.
* Fix epoxy_internal_gl_version()Emmanuele Bassi2018-02-241-1/+1
| | | | The glGetString() function takes a GLenum, so we should too.
* Do not use OPENGL_LIB on AndroidEmmanuele Bassi2018-02-231-0/+2
| | | | | | | | 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
* Document epoxy_set_resolver_failure_handler()Emmanuele Bassi2018-02-231-0/+7
|
* Add epoxy_glsl_version()Emmanuele Bassi2018-02-231-4/+29
| | | | | | | | 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
* docs: Update the supported GL version to 4.6Emmanuele Bassi2018-02-231-1/+1
|
* Merge pull request #143 from ikeydoherty/comp-warningsEmmanuele Bassi2018-02-231-2/+1
|\ | | | | Fix printf family usage
| * Only use printf family when passing argumentsIkey Doherty2017-10-191-2/+1
| | | | | | | | | | | | | | 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>
* | Check __ANDROID__ define when guarding Android codeRobert Bragg2018-01-181-3/+3
|/ | | | | | 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.
* Merge pull request #136 from Lyude/pull/epoxy_ext_in_strEmmanuele Bassi2017-10-191-0/+18
|\ | | | | Expose epoxy_extension_in_string() in public headers
| * Expose epoxy_extension_in_string() in public headersLyude Paul2017-08-241-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix pointer mismatch bug on Windows 10. danem2017-10-131-1/+1
| | | | | | We must explicitly cast to void**
* | Merge pull request #131 from nwnk/nonfatal-resolve-handlerEmmanuele Bassi2017-09-111-0/+18
|\ \ | | | | | | RFC: Add epoxy_set_resolver_failure_handler()
| * | Add epoxy_set_resolver_failure_handler()Adam Jackson2017-07-141-0/+18
| |/ | | | | | | Signed-off-by: Adam Jackson <ajax@redhat.com>
* | dispatch: Fix the libOpenGL sonameAdam Jackson2017-09-071-1/+1
|/ | | | Brown-paper-bag-for: Adam Jackson <ajax@redhat.com>
* dispatch: Be more paranoid about detecting GLX or notAdam Jackson2017-07-121-1/+10
| | | | | | | | | | | | | | | | | | | | | | | 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>
* dispatch: Use epoxy_conservative_glx_dlsym when probing GLXAdam Jackson2017-07-121-13/+13
| | | | | | This path should also only load libGLX.so if possible. Signed-off-by: Adam Jackson <ajax@redhat.com>
* dispatch: Don't reference glvnd #defines on non-glvnd systemsAdam Jackson2017-07-121-0/+2
| | | | | | | Broke the build on OSX, oops. Resolves: https://github.com/anholt/libepoxy/issues/132 Signed-off-by: Adam Jackson <ajax@redhat.com>
* dispatch: Learn about glvndAdam Jackson2017-06-161-5/+26
| | | | | | | | | | glvnd has the rather nice property that GLX and (desktop) GL are available in separate libraries. As an example this would allow an EGL app to use desktop GL without any X11 libraries. Fix up our dlopens to prefer the glvnd libraries if available and fall back to the old ABI if not. Signed-off-by: Adam Jackson <ajax@redhat.com>
* epoxy_internal_has_gl_extension, epoxy_egl_version: add some missing ↵Gianfranco Costamagna2017-04-241-1/+8
| | | | | | | | nullpointer checks from https://bugzilla.redhat.com/show_bug.cgi?id=1395366 Related commit: b3b8bd9af7bf1fcfe544fd131f4d4f0d117ae7bc Fix "epoxy_glx_version" to handle the case when GLX is not active on the display. Patch is tweak from the original version posted by Tom Horsley
* Add conservative functions for checking platform symbolsEmmanuele Bassi2017-02-031-2/+14
| | | | | | | | | | When checking whether GLX or EGL are available on the system, we don't want to use the internal API that forces an exit() on missing libraries and symbols — as that would defeat the point. Instead, we should have safe functions to call internally that simply return a NULL pointer, so we can bail out ourselves in a controlled fashion.
* Write the API referenceEmmanuele Bassi2017-02-031-12/+106
| | | | | Now that we have Doxygen generating it, we should fill out the API reference for Epoxy.
* Improve consistency of the symbol visibilityEmmanuele Bassi2017-01-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | To avoid a symbols file on Windows, Epoxy annotates all the publicly visible symbols directly in the source, but uses the default symbol visibility everywhere else. This means that only some symbols are annotated as `EPOXY_IMPORTEXPORT`, and generally only on Windows. Additionally, Epoxy has a private 'PUBLIC' pre-processor macro for internal use, which duplicates the `EPOXY_IMPORTEXPORT` but contains more logic to detect GCC, in case we're building with GCC on Windows. This would be enough, except that EGL is also available on Windows, which means we'd have to annotate the exported `epoxy_*` API inside epoxy/egl.h as well. At that point, though, we should probably avoid any confusion, and adopt a single symbol visibility policy across the board. This requires some surgery of the generated and common dispatch sources, but cuts down the overall complexity: - there is only one annotation, `EPOXY_PUBLIC`, used everywhere - the annotation detection is done at Epoxy configuration time - only annotated symbols are public, on every platform - annotated symbols are immediately visible from the header
* Do not call errx() on platforms without itEmmanuele Bassi2017-01-251-1/+1
| | | | Like, say, Windows.
* Use EGL to retrieve pointers if availableEmmanuele Bassi2017-01-251-16/+20
| | | | | | EGL is available on different platforms, so we should favor it, if available. This also allows us to decouple EGL from GLX, and use the former without the latter being compiled in.
* Use the appropriate GLES library name for WindowsYaron Cohen-Tal2017-01-251-0/+4
| | | | | | Shared libraries on Windows use `.dll` for the extension, not `.so`. Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* egl: Fix the query for the current context's APIAdam Jackson2017-01-181-22/+6
| | | | | | | | | Binding an API does not change the type of the current context. Even if it did, EGL 1.5 treats EGL_OPENGL_API and EGL_OPENGLES_API as identical for this purpose. If you want to know properties of the current context, query it. Signed-off-by: Adam Jackson <ajax@redhat.com>
* Avoid C99 declaration after statementEmmanuele Bassi2016-12-071-2/+3
| | | | The rest of the library is C89-only, so we should keep it that way.
* Check for NULL extensions stringYaron Cohen-Tal2016-12-071-0/+2
| | | | | | | | | | | | Some X server not supporting any OpenGL feature, glXQueryExtensionsString will return NULL and causes the function to fail. Thanks to Emmanuel Stapf (manus@eiffel.com) for the original patch. This was verified running an application on macOS while the X server was running on Windows Xming 7.5.0.10 Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Revert all changes since 8bbc0d40Emmanuele Bassi2016-12-071-73/+132
| | | | | | | | | | | | | | | Most of the changes that happened after commit 8bbc0d40 broke epoxy pretty much irreparably because of the CMake build and the attempt at making libepoxy a static library that can be copy-pasted into another project without generating files. Since all the commits are entangled, and are full of unrelated changes, we cannot simply do a localized set of reverts; instead, we need to hit the reset button. From this point forward, we're going to improve libepoxy's build while attempting to keep the existing build system working. This may mean reinstating the CMake build system at a later date.
* Fox some X server not supporting any OpenGL feature, glXQueryExtensionsStringYaron Cohen-Tal2016-07-291-0/+2
| | | | | | | will return NULL and causes the function to fail. Thanx to Emmanuel Stapf (manus@eiffel.com) for the original patch. This was verified running an application on macOS while the X server was running on Windows Xming 7.5.0.10
* Make "epoxy_current_context_is_egl" visible.Yaron Cohen-Tal2015-10-311-3/+1
|
* Fix "epoxy_egl_get_current_gl_context_api" to use "eglQueryContext" with ↵Yaron Cohen-Tal2015-10-311-25/+7
| | | | "EGL_CONTEXT_CLIENT_TYPE" as "attribute".