summaryrefslogtreecommitdiff
path: root/subprojects/glad
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2020-10-01 04:28:13 -0400
committerAndrew Opalach <andrew@akon.city> 2020-10-01 04:28:13 -0400
commit4c200513158ad0b974cda961deffe6192830ecae (patch)
tree110c4fde4b0d47d0a273de7f3cbe98528e8e7e9e /subprojects/glad
parentf114f3ad193313676be1de0d9388b9062a8559ab (diff)
downloadmauri-4c200513158ad0b974cda961deffe6192830ecae.tar.gz
mauri-4c200513158ad0b974cda961deffe6192830ecae.tar.bz2
mauri-4c200513158ad0b974cda961deffe6192830ecae.zip
switch to c++, add dxt5 and dxt1 handling
Diffstat (limited to 'subprojects/glad')
-rw-r--r--subprojects/glad/include/KHR/khrplatform.h2
-rw-r--r--subprojects/glad/include/glad/gl.h58
-rw-r--r--subprojects/glad/src/gl.c166
3 files changed, 221 insertions, 5 deletions
diff --git a/subprojects/glad/include/KHR/khrplatform.h b/subprojects/glad/include/KHR/khrplatform.h
index 5b55ea2..dd22d92 100644
--- a/subprojects/glad/include/KHR/khrplatform.h
+++ b/subprojects/glad/include/KHR/khrplatform.h
@@ -119,7 +119,7 @@
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC)
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
diff --git a/subprojects/glad/include/glad/gl.h b/subprojects/glad/include/glad/gl.h
index 1f083c8..a7fe964 100644
--- a/subprojects/glad/include/glad/gl.h
+++ b/subprojects/glad/include/glad/gl.h
@@ -1,5 +1,5 @@
/**
- * Loader generated by glad 2.0.0-beta on Wed May 13 00:01:36 2020
+ * Loader generated by glad 2.0.0-beta on Thu Oct 1 10:15:45 2020
*
* Generator: C/C++
* Specification: gl
@@ -11,17 +11,17 @@
* Options:
* - MX_GLOBAL = False
* - ON_DEMAND = False
- * - LOADER = False
+ * - LOADER = True
* - ALIAS = False
* - HEADER_ONLY = False
* - DEBUG = False
* - MX = False
*
* Commandline:
- * --api='gl:core=3.2' --extensions='' c
+ * --api='gl:core=3.2' --extensions='' c --loader
*
* Online:
- * http://glad.sh/#api=gl%3Acore%3D3.2&extensions=&generator=c&options=
+ * http://glad.sh/#api=gl%3Acore%3D3.2&extensions=&generator=c&options=LOADER
*
*/
@@ -53,6 +53,7 @@
#endif
#define GLAD_GL
+#define GLAD_OPTION_GL_LOADER
#ifdef __cplusplus
extern "C" {
@@ -977,70 +978,113 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#include <KHR/khrplatform.h>
+
typedef unsigned int GLenum;
+
typedef unsigned char GLboolean;
+
typedef unsigned int GLbitfield;
+
typedef void GLvoid;
+
typedef khronos_int8_t GLbyte;
+
typedef khronos_uint8_t GLubyte;
+
typedef khronos_int16_t GLshort;
+
typedef khronos_uint16_t GLushort;
+
typedef int GLint;
+
typedef unsigned int GLuint;
+
typedef khronos_int32_t GLclampx;
+
typedef int GLsizei;
+
typedef khronos_float_t GLfloat;
+
typedef khronos_float_t GLclampf;
+
typedef double GLdouble;
+
typedef double GLclampd;
+
typedef void *GLeglClientBufferEXT;
+
typedef void *GLeglImageOES;
+
typedef char GLchar;
+
typedef char GLcharARB;
+
#ifdef __APPLE__
typedef void *GLhandleARB;
#else
typedef unsigned int GLhandleARB;
#endif
+
typedef khronos_uint16_t GLhalf;
+
typedef khronos_uint16_t GLhalfARB;
+
typedef khronos_int32_t GLfixed;
+
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
typedef khronos_intptr_t GLintptr;
#else
typedef khronos_intptr_t GLintptr;
#endif
+
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
typedef khronos_intptr_t GLintptrARB;
#else
typedef khronos_intptr_t GLintptrARB;
#endif
+
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
typedef khronos_ssize_t GLsizeiptr;
#else
typedef khronos_ssize_t GLsizeiptr;
#endif
+
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
typedef khronos_ssize_t GLsizeiptrARB;
#else
typedef khronos_ssize_t GLsizeiptrARB;
#endif
+
typedef khronos_int64_t GLint64;
+
typedef khronos_int64_t GLint64EXT;
+
typedef khronos_uint64_t GLuint64;
+
typedef khronos_uint64_t GLuint64EXT;
+
typedef struct __GLsync *GLsync;
+
struct _cl_context;
+
struct _cl_event;
+
typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+
typedef unsigned short GLhalfNV;
+
typedef GLintptr GLvdpauSurfaceNV;
+
typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void);
+
#define GL_VERSION_1_0 1
GLAD_API_CALL int GLAD_GL_VERSION_1_0;
#define GL_VERSION_1_1 1
@@ -2023,6 +2067,12 @@ GLAD_API_CALL int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr);
GLAD_API_CALL int gladLoadGL( GLADloadfunc load);
+#ifdef GLAD_GL
+
+GLAD_API_CALL int gladLoaderLoadGL(void);
+GLAD_API_CALL void gladLoaderUnloadGL(void);
+
+#endif
#ifdef __cplusplus
}
diff --git a/subprojects/glad/src/gl.c b/subprojects/glad/src/gl.c
index 1fae27b..eb3e66a 100644
--- a/subprojects/glad/src/gl.c
+++ b/subprojects/glad/src/gl.c
@@ -890,6 +890,172 @@ int gladLoadGL( GLADloadfunc load) {
+#ifdef GLAD_GL
+
+#ifndef GLAD_LOADER_LIBRARY_C_
+#define GLAD_LOADER_LIBRARY_C_
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#if GLAD_PLATFORM_WIN32
+#include <windows.h>
+#else
+#include <dlfcn.h>
+#endif
+
+
+static void* glad_get_dlopen_handle(const char *lib_names[], int length) {
+ void *handle = NULL;
+ int i;
+
+ for (i = 0; i < length; ++i) {
+#if GLAD_PLATFORM_WIN32
+ #if GLAD_PLATFORM_UWP
+ size_t buffer_size = (strlen(lib_names[i]) + 1) * sizeof(WCHAR);
+ LPWSTR buffer = (LPWSTR) malloc(buffer_size);
+ if (buffer != NULL) {
+ int ret = MultiByteToWideChar(CP_ACP, 0, lib_names[i], -1, buffer, buffer_size);
+ if (ret != 0) {
+ handle = (void*) LoadPackagedLibrary(buffer, 0);
+ }
+ free((void*) buffer);
+ }
+ #else
+ handle = (void*) LoadLibraryA(lib_names[i]);
+ #endif
+#else
+ handle = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
+#endif
+ if (handle != NULL) {
+ return handle;
+ }
+ }
+
+ return NULL;
+}
+
+static void glad_close_dlopen_handle(void* handle) {
+ if (handle != NULL) {
+#if GLAD_PLATFORM_WIN32
+ FreeLibrary((HMODULE) handle);
+#else
+ dlclose(handle);
+#endif
+ }
+}
+
+static GLADapiproc glad_dlsym_handle(void* handle, const char *name) {
+ if (handle == NULL) {
+ return NULL;
+ }
+
+#if GLAD_PLATFORM_WIN32
+ return (GLADapiproc) GetProcAddress((HMODULE) handle, name);
+#else
+ return GLAD_GNUC_EXTENSION (GLADapiproc) dlsym(handle, name);
+#endif
+}
+
+#endif /* GLAD_LOADER_LIBRARY_C_ */
+
+typedef void* (GLAD_API_PTR *GLADglprocaddrfunc)(const char*);
+struct _glad_gl_userptr {
+ void *handle;
+ GLADglprocaddrfunc gl_get_proc_address_ptr;
+};
+
+static GLADapiproc glad_gl_get_proc(void *vuserptr, const char *name) {
+ struct _glad_gl_userptr userptr = *(struct _glad_gl_userptr*) vuserptr;
+ GLADapiproc result = NULL;
+
+ if(userptr.gl_get_proc_address_ptr != NULL) {
+ result = GLAD_GNUC_EXTENSION (GLADapiproc) userptr.gl_get_proc_address_ptr(name);
+ }
+ if(result == NULL) {
+ result = glad_dlsym_handle(userptr.handle, name);
+ }
+
+ return result;
+}
+
+static void* _gl_handle = NULL;
+
+static void* glad_gl_dlopen_handle(void) {
+#if GLAD_PLATFORM_APPLE
+ static const char *NAMES[] = {
+ "../Frameworks/OpenGL.framework/OpenGL",
+ "/Library/Frameworks/OpenGL.framework/OpenGL",
+ "/System/Library/Frameworks/OpenGL.framework/OpenGL",
+ "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
+ };
+#elif GLAD_PLATFORM_WIN32
+ static const char *NAMES[] = {"opengl32.dll"};
+#else
+ static const char *NAMES[] = {
+ #if defined(__CYGWIN__)
+ "libGL-1.so",
+ #endif
+ "libGL.so.1",
+ "libGL.so"
+ };
+#endif
+
+ if (_gl_handle == NULL) {
+ _gl_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
+ }
+
+ return _gl_handle;
+}
+
+static struct _glad_gl_userptr glad_gl_build_userptr(void *handle) {
+ struct _glad_gl_userptr userptr;
+
+ userptr.handle = handle;
+#if GLAD_PLATFORM_APPLE || defined(__HAIKU__)
+ userptr.gl_get_proc_address_ptr = NULL;
+#elif GLAD_PLATFORM_WIN32
+ userptr.gl_get_proc_address_ptr =
+ (GLADglprocaddrfunc) glad_dlsym_handle(handle, "wglGetProcAddress");
+#else
+ userptr.gl_get_proc_address_ptr =
+ (GLADglprocaddrfunc) glad_dlsym_handle(handle, "glXGetProcAddressARB");
+#endif
+
+ return userptr;
+}
+
+int gladLoaderLoadGL(void) {
+ int version = 0;
+ void *handle;
+ int did_load = 0;
+ struct _glad_gl_userptr userptr;
+
+ did_load = _gl_handle == NULL;
+ handle = glad_gl_dlopen_handle();
+ if (handle) {
+ userptr = glad_gl_build_userptr(handle);
+
+ version = gladLoadGLUserPtr(glad_gl_get_proc, &userptr);
+
+ if (did_load) {
+ gladLoaderUnloadGL();
+ }
+ }
+
+ return version;
+}
+
+
+
+void gladLoaderUnloadGL(void) {
+ if (_gl_handle != NULL) {
+ glad_close_dlopen_handle(_gl_handle);
+ _gl_handle = NULL;
+ }
+}
+
+#endif /* GLAD_GL */
#ifdef __cplusplus
}