Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/libepoxy/dist merge libepoxy 1.5.4.



details:   https://anonhg.NetBSD.org/xsrc/rev/b250b59860bb
branches:  trunk
changeset: 10611:b250b59860bb
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Nov 02 04:46:29 2020 +0000

description:
merge libepoxy 1.5.4.

diffstat:

 external/mit/libepoxy/dist/.gitignore                            |   95 ---
 external/mit/libepoxy/dist/src/dispatch_common.c                 |  289 ++++++---
 external/mit/libepoxy/dist/src/dispatch_common.h                 |   22 +-
 external/mit/libepoxy/dist/test/egl_and_glx_different_pointers.c |  246 --------
 4 files changed, 216 insertions(+), 436 deletions(-)

diffs (truncated from 929 to 300 lines):

diff -r fe16f2373378 -r b250b59860bb external/mit/libepoxy/dist/.gitignore
--- a/external/mit/libepoxy/dist/.gitignore     Mon Nov 02 04:43:17 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r fe16f2373378 -r b250b59860bb external/mit/libepoxy/dist/src/dispatch_common.c
--- a/external/mit/libepoxy/dist/src/dispatch_common.c  Mon Nov 02 04:43:17 2020 +0000
+++ b/external/mit/libepoxy/dist/src/dispatch_common.c  Mon Nov 02 04:46:29 2020 +0000
@@ -41,7 +41,7 @@
  * \section features_sec Features
  *
  *   - Automatically initializes as new GL functions are used.
- *   - GL 4.4 core and compatibility context support.
+ *   - GL 4.6 core and compatibility context support.
  *   - GLES 1/2/3 context support.
  *   - Knows about function aliases so (e.g.) `glBufferData()` can be
  *     used with `GL_ARB_vertex_buffer_object` implementations, along
@@ -173,30 +173,33 @@
 
 #include "dispatch_common.h"
 
-#ifdef __APPLE__
+#if defined(__APPLE__)
 #define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
-#elif defined(ANDROID)
+#define OPENGL_LIB "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
+#define GLES1_LIB "libGLESv1_CM.so"
+#define GLES2_LIB "libGLESv2.so"
+#elif defined(__ANDROID__)
 #define GLX_LIB "libGLESv2.so"
-#else
-#ifdef __NetBSD__
+#elif __NetBSD__
 #define GLX_LIB "libGL.so"
-#else
-#define GLX_LIB "libGL.so.1"
-#endif
 #endif
 
 #if defined(ANDROID) || defined(__NetBSD__)
 #define EGL_LIB "libEGL.so"
 #define GLES1_LIB "libGLESv1_CM.so"
 #define GLES2_LIB "libGLESv2.so"
-#elif defined _WIN32
+#elif defined(_WIN32)
 #define EGL_LIB "libEGL.dll"
 #define GLES1_LIB "libGLES_CM.dll"
 #define GLES2_LIB "libGLESv2.dll"
+#define OPENGL_LIB "OPENGL32"
 #else
+#define GLVND_GLX_LIB "libGLX.so.1"
+#define GLX_LIB "libGL.so.1"
 #define EGL_LIB "libEGL.so.1"
 #define GLES1_LIB "libGLESv1_CM.so.1"
 #define GLES2_LIB "libGLESv2.so.2"
+#define OPENGL_LIB "libOpenGL.so.0"
 #endif
 
 #ifdef __GNUC__
@@ -230,13 +233,18 @@
     pthread_mutex_t mutex;
 #endif
 
-    /* dlopen() return value for libGL.so.1. */
+    /*
+     * dlopen() return value for the GLX API. This is libGLX.so.1 if the
+     * runtime is glvnd-enabled, else libGL.so.1
+     */
     void *glx_handle;
 
     /*
-     * dlopen() return value for OS X's GL library.
+     * dlopen() return value for the desktop GL library.
      *
-     * On linux, glx_handle is used instead.
+     * On Windows this is OPENGL32. On OSX this is classic libGL. On Linux
+     * this is either libOpenGL (if the runtime is glvnd-enabled) or
+     * classic libGL.so.1
      */
     void *gl_handle;
 
@@ -290,14 +298,13 @@
 }
 
 static bool
-get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail)
+get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool load)
 {
     if (*handle)
         return true;
 
     if (!library_initialized) {
-        fprintf(stderr,
-                "Attempting to dlopen() while in the dynamic linker.\n");
+        fputs("Attempting to dlopen() while in the dynamic linker.\n", stderr);
         abort();
     }
 
@@ -306,11 +313,15 @@
 #else
     pthread_mutex_lock(&api.mutex);
     if (!*handle) {
-        *handle = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL);
+        int flags = RTLD_LAZY | RTLD_LOCAL;
+        if (!load)
+            flags |= RTLD_NOLOAD;
+
+        *handle = dlopen(lib_name, flags);
         if (!*handle) {
             if (exit_on_fail) {
                 fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());
-                exit(1);
+                abort();
             } else {
                 (void)dlerror();
             }
@@ -323,15 +334,11 @@
 }
 
 static void *
-do_dlsym(void **handle, const char *lib_name, const char *name,
-         bool exit_on_fail)
+do_dlsym(void **handle, const char *name, bool exit_on_fail)
 {
     void *result;
     const char *error = "";
 
-    if (!get_dlopen_handle(handle, lib_name, exit_on_fail))
-        return NULL;
-
 #ifdef _WIN32
     result = GetProcAddress(*handle, name);
 #else
@@ -340,8 +347,8 @@
         error = dlerror();
 #endif
     if (!result && exit_on_fail) {
-        fprintf(stderr,"%s() not found in %s: %s\n", name, lib_name, error);
-        exit(1);
+        fprintf(stderr, "%s() not found: %s\n", name, error);
+        abort();
     }
 
     return result;
@@ -393,10 +400,10 @@
 }
 
 static int
-epoxy_internal_gl_version(int error_version)
+epoxy_internal_gl_version(GLenum version_string, int error_version)
 {
-    const char *version = (const char *)glGetString(GL_VERSION);
-    GLint major, minor;
+    const char *version = (const char *)glGetString(version_string);
+    GLint major, minor, factor;
     int scanf_count;
 
     if (!version)
@@ -411,9 +418,15 @@
     if (scanf_count != 2) {
         fprintf(stderr, "Unable to interpret GL_VERSION string: %s\n",
                 version);
-        exit(1);
+        abort();
     }
-    return 10 * major + minor;
+
+    if (minor >= 10)
+        factor = 100;
+    else
+        factor = 10;
+
+    return factor * major + minor;
 }
 
 /**
@@ -434,7 +447,7 @@
 int
 epoxy_gl_version(void)
 {
-    return epoxy_internal_gl_version(0);
+    return epoxy_internal_gl_version(GL_VERSION, 0);
 }
 
 int
@@ -443,9 +456,52 @@
     if (api.begin_count)
         return 100;
 
-    return epoxy_internal_gl_version(100);
+    return epoxy_internal_gl_version(GL_VERSION, 100);
 }
 
+/**
+ * @brief Returns the version of the GL Shading Language we are using
+ *
+ * The version is encoded as:
+ *
+ * ```
+ *
+ *   version = major * 100 + minor
+ *
+ * ```
+ *
+ * So it can be easily used for version comparisons.
+ *



Home | Main Index | Thread Index | Old Index