summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/libepoxy/.dir-locals.el6
-rw-r--r--dist/libepoxy/.gitignore95
-rwxr-xr-xdist/libepoxy/autogen.sh14
-rw-r--r--dist/libepoxy/src/dispatch_common.c107
-rw-r--r--dist/libepoxy/test/.gitignore24
-rw-r--r--dist/libepoxy/test/glx_alias_prefer_same_name.c93
6 files changed, 71 insertions, 268 deletions
diff --git a/dist/libepoxy/.dir-locals.el b/dist/libepoxy/.dir-locals.el
deleted file mode 100644
index 7f3eee2dc..000000000
--- a/dist/libepoxy/.dir-locals.el
+++ /dev/null
@@ -1,6 +0,0 @@
-((nil
- (indent-tabs-mode . nil)
- (tab-width . 8)
- (c-basic-offset . 4)
- )
- )
diff --git a/dist/libepoxy/.gitignore b/dist/libepoxy/.gitignore
deleted file mode 100644
index 2dc1c0545..000000000
--- a/dist/libepoxy/.gitignore
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# X.Org module default exclusion patterns
-# The next section if for module specific patterns
-#
-# Do not edit the following section
-# GNU Build System (Autotools)
-aclocal.m4
-autom4te.cache/
-autoscan.log
-ChangeLog
-compile
-config.guess
-config.h
-config.h.in
-config.log
-config-ml.in
-config.py
-config.status
-config.status.lineno
-config.sub
-configure
-configure.scan
-depcomp
-.deps/
-INSTALL
-install-sh
-.libs/
-libtool
-libtool.m4
-ltmain.sh
-lt~obsolete.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-Makefile
-Makefile.in
-mdate-sh
-missing
-mkinstalldirs
-*.pc
-py-compile
-stamp-h?
-symlink-tree
-texinfo.tex
-ylwrap
-src/sna/git_version.h
-src/sna/brw/brw_test
-
-# Do not edit the following section
-# Edit Compile Debug Document Distribute
-*~
-*.[0-9]
-*.[0-9]x
-*.bak
-*.bin
-core
-*.dll
-*.exe
-*-ISO*.bdf
-*-JIS*.bdf
-*-KOI8*.bdf
-*.kld
-*.ko
-*.ko.cmd
-*.lai
-*.l[oa]
-*.[oa]
-*.obj
-*.patch
-*.so
-*.pcf.gz
-*.pdb
-*.tar.bz2
-*.tar.gz
-#
-# Add & Override patterns for gldispatch
-#
-# Edit the following section as needed
-# For example, !report.pc overrides *.pc. See 'man gitignore'
-#
-configure.lineno
-.dirstamp
-test-driver
-
-gl_generated_dispatch.c
-gl_generated.h
-
-glx_generated_dispatch.c
-glx_generated.h
-
-egl_generated_dispatch.c
-egl_generated.h
-
-wgl_generated_dispatch.c
-wgl_generated.h
diff --git a/dist/libepoxy/autogen.sh b/dist/libepoxy/autogen.sh
deleted file mode 100755
index fc34bd55c..000000000
--- a/dist/libepoxy/autogen.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /bin/sh
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-ORIGDIR=`pwd`
-cd $srcdir
-
-autoreconf -v --install || exit 1
-cd $ORIGDIR || exit $?
-
-if test -z "$NOCONFIGURE"; then
- $srcdir/configure "$@"
-fi
diff --git a/dist/libepoxy/src/dispatch_common.c b/dist/libepoxy/src/dispatch_common.c
index 4fdfacf16..8869e630d 100644
--- a/dist/libepoxy/src/dispatch_common.c
+++ b/dist/libepoxy/src/dispatch_common.c
@@ -104,16 +104,42 @@
#ifdef __APPLE__
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
+#elif defined(ANDROID)
+#define GLX_LIB "libGLESv2.so"
#elif defined(__OpenBSD__)
#define GLX_LIB "libGL.so"
-#define EGL_LIB "libEGL.so"
-#define GLESV1_LIB "libGLESv1_CM.so"
-#define GLESV2_LIB "libGLESv2.so"
#else
#define GLX_LIB "libGL.so.1"
+#endif
+
+#if defined(ANDROID) || defined(__OpenBSD__)
+#define EGL_LIB "libEGL.so"
+#define GLES1_LIB "libGLESv1_CM.so"
+#define GLES2_LIB "libGLESv2.so"
+#else
#define EGL_LIB "libEGL.so.1"
-#define GLESV1_LIB "libGLESv1_CM.so.1"
-#define GLESV2_LIB "libGLESv2.so.2"
+#define GLES1_LIB "libGLESv1_CM.so.1"
+#define GLES2_LIB "libGLESv2.so.2"
+#endif
+
+#ifdef __GNUC__
+#define CONSTRUCT(_func) static void _func (void) __attribute__((constructor));
+#define DESTRUCT(_func) static void _func (void) __attribute__((destructor));
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+#define CONSTRUCT(_func) \
+ static void _func(void); \
+ static int _func ## _wrapper(void) { _func(); return 0; } \
+ __pragma(section(".CRT$XCU",read)) \
+ __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define DESTRUCT(_func) \
+ static void _func(void); \
+ static int _func ## _constructor(void) { atexit (_func); return 0; } \
+ __pragma(section(".CRT$XCU",read)) \
+ __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#else
+#error "You will need constructor support for your compiler"
#endif
struct api {
@@ -161,18 +187,21 @@ struct api {
static struct api api = {
#ifndef _WIN32
.mutex = PTHREAD_MUTEX_INITIALIZER,
+#else
+ 0,
#endif
};
static bool library_initialized;
+static bool epoxy_current_context_is_glx(void);
+
#if PLATFORM_HAS_EGL
static EGLenum
epoxy_egl_get_current_gl_context_api(void);
#endif
-static void
-library_init(void) __attribute__((constructor));
+CONSTRUCT (library_init)
static void
library_init(void)
@@ -244,6 +273,24 @@ epoxy_is_desktop_gl(void)
const char *es_prefix = "OpenGL ES";
const char *version;
+#if PLATFORM_HAS_EGL
+ /* PowerVR's OpenGL ES implementation (and perhaps other) don't
+ * comply with the standard, which states that
+ * "glGetString(GL_VERSION)" should return a string starting with
+ * "OpenGL ES". Therefore, to distinguish desktop OpenGL from
+ * OpenGL ES, we must also check the context type through EGL (we
+ * can do that as PowerVR is only usable through EGL).
+ */
+ if (!epoxy_current_context_is_glx()) {
+ switch (epoxy_egl_get_current_gl_context_api()) {
+ case EGL_OPENGL_API: return true;
+ case EGL_OPENGL_ES_API: return false;
+ case EGL_NONE:
+ default: break;
+ }
+ }
+#endif
+
if (api.begin_count)
return true;
@@ -290,7 +337,7 @@ epoxy_gl_version(void)
return epoxy_internal_gl_version(0);
}
-PUBLIC int
+int
epoxy_conservative_gl_version(void)
{
if (api.begin_count)
@@ -327,12 +374,13 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
return epoxy_extension_in_string(exts, ext);
} else {
int num_extensions;
+ int i;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
if (num_extensions == 0)
return invalid_op_mode;
- for (int i = 0; i < num_extensions; i++) {
+ for (i = 0; i < num_extensions; i++) {
const char *gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i);
if (strcmp(ext, gl_ext) == 0)
return true;
@@ -373,7 +421,7 @@ epoxy_current_context_is_glx(void)
sym = dlsym(NULL, "eglGetCurrentContext");
if (sym) {
if (epoxy_egl_get_current_gl_context_api() != EGL_NONE)
- return true;
+ return false;
} else {
(void)dlerror();
}
@@ -454,7 +502,7 @@ epoxy_gles1_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
- return do_dlsym(&api.gles1_handle, GLESV1_LIB, name, true);
+ return do_dlsym(&api.gles1_handle, GLES1_LIB, name, true);
}
}
@@ -464,7 +512,7 @@ epoxy_gles2_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
- return do_dlsym(&api.gles2_handle, GLESV2_LIB, name, true);
+ return do_dlsym(&api.gles2_handle, GLES2_LIB, name, true);
}
}
@@ -484,7 +532,7 @@ epoxy_gles3_dlsym(const char *name)
if (epoxy_current_context_is_glx()) {
return epoxy_get_proc_address(name);
} else {
- void *func = do_dlsym(&api.gles2_handle, GLESV2_LIB, name, false);
+ void *func = do_dlsym(&api.gles2_handle, GLES2_LIB, name, false);
if (func)
return func;
@@ -501,7 +549,13 @@ void *
epoxy_get_core_proc_address(const char *name, int core_version)
{
#ifdef _WIN32
- int core_symbol_support = 10;
+ int core_symbol_support = 11;
+#elif defined(ANDROID)
+ /**
+ * All symbols must be resolved through eglGetProcAddress
+ * on Android
+ */
+ int core_symbol_support = 0;
#else
int core_symbol_support = 12;
#endif
@@ -583,7 +637,7 @@ epoxy_get_bootstrap_proc_address(const char *name)
* us. Try the GLES2 implementation first, and fall back
* to GLES1 otherwise.
*/
- get_dlopen_handle(&api.gles2_handle, GLESV2_LIB, false);
+ get_dlopen_handle(&api.gles2_handle, GLES2_LIB, false);
if (api.gles2_handle)
return epoxy_gles2_dlsym(name);
else
@@ -623,26 +677,7 @@ epoxy_get_proc_address(const char *name)
#endif
}
-void
-epoxy_print_failure_reasons(const char *name,
- const char **provider_names,
- const int *providers)
-{
- int i;
-
- fprintf(stderr, "No provider of %s found. Requires one of:\n", name);
-
- for (i = 0; providers[i] != 0; i++)
- fprintf(stderr, " %s\n",
- provider_names[providers[i]]);
-
- if (providers[0] == 0) {
- fprintf(stderr, " No known providers. This is likely a bug "
- "in libepoxy code generation\n");
- }
-}
-
-WRAPPER_VISIBILITY void
+WRAPPER_VISIBILITY (void)
WRAPPER(epoxy_glBegin)(GLenum primtype)
{
#ifdef _WIN32
@@ -656,7 +691,7 @@ WRAPPER(epoxy_glBegin)(GLenum primtype)
epoxy_glBegin_unwrapped(primtype);
}
-WRAPPER_VISIBILITY void
+WRAPPER_VISIBILITY (void)
WRAPPER(epoxy_glEnd)(void)
{
epoxy_glEnd_unwrapped();
diff --git a/dist/libepoxy/test/.gitignore b/dist/libepoxy/test/.gitignore
deleted file mode 100644
index 78919f368..000000000
--- a/dist/libepoxy/test/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-egl_and_glx_different_pointers_egl
-egl_and_glx_different_pointers_egl_glx
-egl_and_glx_different_pointers_glx
-egl_has_extension_nocontext
-egl_gl
-egl_gles1_without_glx
-egl_gles2_without_glx
-glx_alias_prefer_same_name
-glx_beginend
-glx_gles2
-glx_glxgetprocaddress_nocontext
-glx_has_extension_nocontext
-glx_public_api
-glx_public_api_core
-glx_shared_znow
-glx_static
-headerguards
-khronos_typedefs
-miscdefines
-wgl_core_and_exts
-wgl_usefontbitmaps
-wgl_usefontbitmaps_unicode
-*.log
-*.trs
diff --git a/dist/libepoxy/test/glx_alias_prefer_same_name.c b/dist/libepoxy/test/glx_alias_prefer_same_name.c
deleted file mode 100644
index e28db8ee6..000000000
--- a/dist/libepoxy/test/glx_alias_prefer_same_name.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright © 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-/**
- * @file glx_gles2.c
- *
- * Catches a bug where a GLES2 context using
- * GLX_EXT_create_context_es2_profile would try to find the symbols in
- * libGLESv2.so.2 instead of libGL.so.1.
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include <err.h>
-#include "epoxy/gl.h"
-#include "epoxy/glx.h"
-#include <X11/Xlib.h>
-
-#include "glx_common.h"
-
-static Display *dpy;
-
-static int last_call;
-
-#define CORE_FUNC_VAL 100
-#define EXT_FUNC_VAL 101
-
-void
-override_GL_glBindTexture(GLenum target, GLenum texture);
-void
-override_GL_glBindTextureEXT(GLenum target, GLenum texture);
-
-void
-override_GL_glBindTexture(GLenum target)
-{
- last_call = CORE_FUNC_VAL;
-}
-
-void
-override_GL_glBindTexture(GLenum target)
-{
- last_call = EXT_FUNC_VAL;
-}
-
-int
-main(int argc, char **argv)
-{
- bool pass = true;
- XVisualInfo *vis;
- Window win;
- GLXContext ctx;
- GLXFBConfig config;
- int context_attribs[] = {
- GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
- GLX_CONTEXT_MINOR_VERSION_ARB, 0,
- 0
- };
- GLuint shader;
-
- dpy = get_display_or_skip();
- make_glx_context_current_or_skip(dpy);
-
- if (!epoxy_has_gl_extension(dpy, 0, "GLX_EXT_texture_object"))
- errx(77, "Test requires GLX_EXT_texture_object");
-
- glBindTexture(GL_TEXTURE_2D, 1);
- pass = pass && last_call == CORE_VAL;
- glBindTextureEXT(GL_TEXTURE_2D, 1);
- pass = pass && last_call == EXT_VAL;
-
- return pass != true;
-}