Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -51,7 +51,7 @@
#endif
#ifndef EGLAPIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#endif
#define EGLAPIENTRYP EGLAPIENTRY*
@@ -73,42 +73,42 @@
#endif
#include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
typedef HWND EGLNativeWindowType;
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
typedef int EGLNativeDisplayType;
typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#elif defined(WL_EGL_PLATFORM)
typedef struct wl_display *EGLNativeDisplayType;
typedef struct wl_egl_pixmap *EGLNativePixmapType;
typedef struct wl_egl_window *EGLNativeWindowType;
typedef struct wl_display *EGLNativeDisplayType;
typedef struct wl_egl_pixmap *EGLNativePixmapType;
typedef struct wl_egl_window *EGLNativeWindowType;
#elif defined(__GBM__)
typedef struct gbm_device *EGLNativeDisplayType;
typedef struct gbm_bo *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
typedef struct gbm_device *EGLNativeDisplayType;
typedef struct gbm_bo *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
#elif defined(__ANDROID__) || defined(ANDROID)
struct ANativeWindow;
struct egl_native_pixmap_t;
typedef struct ANativeWindow* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
typedef struct ANativeWindow* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
#elif defined(__unix__) || defined(__APPLE__)
#if defined(MESA_EGL_NO_X11_HEADERS)
typedef void *EGLNativeDisplayType;
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
@@ -119,16 +119,16 @@ typedef khronos_uintptr_t EGLNativeWindowType;
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#endif /* MESA_EGL_NO_X11_HEADERS */
#elif __HAIKU__
#include <kernel/image.h>
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
#else
#error "Platform not recognized"
@@ -136,9 +136,8 @@ typedef khronos_uintptr_t EGLNativeWindowType;
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
typedef EGLNativeDisplayType NativeDisplayType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
/* Define EGLint. This must be a signed integral type large enough to contain
* all legal attribute names and values passed into and out of EGL, whether
@@ -149,12 +148,11 @@ typedef EGLNativeWindowType NativeWindowType;
*/
typedef khronos_int32_t EGLint;
/* C++ / C typecast macros for special EGL handle values */
#if defined(__cplusplus)
#define EGL_CAST(type, value) (static_cast<type>(value))
#else
#define EGL_CAST(type, value) ((type) (value))
#define EGL_CAST(type, value) ((type)(value))
#endif
#endif /* __eglplatform_h */

View File

@@ -98,13 +98,13 @@
* This precedes the return type of the function in the function prototype.
*/
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#define KHRONOS_APICALL __declspec(dllimport)
#elif defined(__SYMBIAN32__)
#define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
@@ -114,10 +114,10 @@
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
/* Win32 but not WinCE */
#define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
@@ -125,7 +125,7 @@
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#if defined(__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
@@ -136,69 +136,68 @@
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
#elif defined(__VMS) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
@@ -206,23 +205,22 @@ typedef unsigned int khronos_uint32_t;
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
@@ -230,22 +228,22 @@ typedef unsigned short int khronos_uint16_t;
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
@@ -258,8 +256,8 @@ typedef float khronos_float_t;
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
@@ -275,10 +273,11 @@ typedef khronos_int64_t khronos_stime_nanoseconds_t;
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
typedef enum
{
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

View File

@@ -7,7 +7,7 @@
#define GLAD_IMPL_UTIL_C_
#if _MSC_VER >= 1400
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy_s(dest, len, source, len-1);
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy_s(dest, len, source, len - 1);
#else
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy(dest, source, len);
#endif
@@ -20,7 +20,6 @@
#endif /* GLAD_IMPL_UTIL_C_ */
int GLAD_EGL_VERSION_1_0;
int GLAD_EGL_VERSION_1_1;
int GLAD_EGL_VERSION_1_2;
@@ -35,8 +34,6 @@ int GLAD_EGL_EXT_device_query;
int GLAD_EGL_EXT_device_base;
int GLAD_EGL_NV_cuda_event;
PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
PFNEGLGETERRORPROC glad_eglGetError;
@@ -90,206 +87,229 @@ PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
PFNEGLWAITCLIENTPROC glad_eglWaitClient;
PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
static void load_EGL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_VERSION_1_0) return;
eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC) load("eglCreatePbufferSurface", userptr);
eglGetError = (PFNEGLGETERRORPROC) load("eglGetError", userptr);
eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC) load("eglGetProcAddress", userptr);
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) load("eglGetCurrentDisplay", userptr);
eglQueryContext = (PFNEGLQUERYCONTEXTPROC) load("eglQueryContext", userptr);
eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC) load("eglSwapBuffers", userptr);
eglCreateContext = (PFNEGLCREATECONTEXTPROC) load("eglCreateContext", userptr);
eglChooseConfig = (PFNEGLCHOOSECONFIGPROC) load("eglChooseConfig", userptr);
eglWaitNative = (PFNEGLWAITNATIVEPROC) load("eglWaitNative", userptr);
eglTerminate = (PFNEGLTERMINATEPROC) load("eglTerminate", userptr);
eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC) load("eglCopyBuffers", userptr);
eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC) load("eglGetConfigAttrib", userptr);
eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC) load("eglGetCurrentSurface", userptr);
eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC) load("eglCreatePixmapSurface", userptr);
eglGetDisplay = (PFNEGLGETDISPLAYPROC) load("eglGetDisplay", userptr);
eglQueryString = (PFNEGLQUERYSTRINGPROC) load("eglQueryString", userptr);
eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC) load("eglDestroyContext", userptr);
eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC) load("eglCreateWindowSurface", userptr);
eglInitialize = (PFNEGLINITIALIZEPROC) load("eglInitialize", userptr);
eglDestroySurface = (PFNEGLDESTROYSURFACEPROC) load("eglDestroySurface", userptr);
eglMakeCurrent = (PFNEGLMAKECURRENTPROC) load("eglMakeCurrent", userptr);
eglWaitGL = (PFNEGLWAITGLPROC) load("eglWaitGL", userptr);
eglQuerySurface = (PFNEGLQUERYSURFACEPROC) load("eglQuerySurface", userptr);
eglGetConfigs = (PFNEGLGETCONFIGSPROC) load("eglGetConfigs", userptr);
static void load_EGL_VERSION_1_0(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_VERSION_1_0) return;
eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC)load("eglCreatePbufferSurface", userptr);
eglGetError = (PFNEGLGETERRORPROC)load("eglGetError", userptr);
eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC)load("eglGetProcAddress", userptr);
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)load("eglGetCurrentDisplay", userptr);
eglQueryContext = (PFNEGLQUERYCONTEXTPROC)load("eglQueryContext", userptr);
eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC)load("eglSwapBuffers", userptr);
eglCreateContext = (PFNEGLCREATECONTEXTPROC)load("eglCreateContext", userptr);
eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)load("eglChooseConfig", userptr);
eglWaitNative = (PFNEGLWAITNATIVEPROC)load("eglWaitNative", userptr);
eglTerminate = (PFNEGLTERMINATEPROC)load("eglTerminate", userptr);
eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC)load("eglCopyBuffers", userptr);
eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC)load("eglGetConfigAttrib", userptr);
eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)load("eglGetCurrentSurface", userptr);
eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC)load("eglCreatePixmapSurface", userptr);
eglGetDisplay = (PFNEGLGETDISPLAYPROC)load("eglGetDisplay", userptr);
eglQueryString = (PFNEGLQUERYSTRINGPROC)load("eglQueryString", userptr);
eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC)load("eglDestroyContext", userptr);
eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC)load("eglCreateWindowSurface", userptr);
eglInitialize = (PFNEGLINITIALIZEPROC)load("eglInitialize", userptr);
eglDestroySurface = (PFNEGLDESTROYSURFACEPROC)load("eglDestroySurface", userptr);
eglMakeCurrent = (PFNEGLMAKECURRENTPROC)load("eglMakeCurrent", userptr);
eglWaitGL = (PFNEGLWAITGLPROC)load("eglWaitGL", userptr);
eglQuerySurface = (PFNEGLQUERYSURFACEPROC)load("eglQuerySurface", userptr);
eglGetConfigs = (PFNEGLGETCONFIGSPROC)load("eglGetConfigs", userptr);
}
static void load_EGL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_VERSION_1_1) return;
eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC) load("eglReleaseTexImage", userptr);
eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC) load("eglSurfaceAttrib", userptr);
eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC) load("eglBindTexImage", userptr);
eglSwapInterval = (PFNEGLSWAPINTERVALPROC) load("eglSwapInterval", userptr);
static void load_EGL_VERSION_1_1(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_VERSION_1_1) return;
eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC)load("eglReleaseTexImage", userptr);
eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC)load("eglSurfaceAttrib", userptr);
eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC)load("eglBindTexImage", userptr);
eglSwapInterval = (PFNEGLSWAPINTERVALPROC)load("eglSwapInterval", userptr);
}
static void load_EGL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_VERSION_1_2) return;
eglBindAPI = (PFNEGLBINDAPIPROC) load("eglBindAPI", userptr);
eglQueryAPI = (PFNEGLQUERYAPIPROC) load("eglQueryAPI", userptr);
eglWaitClient = (PFNEGLWAITCLIENTPROC) load("eglWaitClient", userptr);
eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) load("eglCreatePbufferFromClientBuffer", userptr);
eglReleaseThread = (PFNEGLRELEASETHREADPROC) load("eglReleaseThread", userptr);
static void load_EGL_VERSION_1_2(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_VERSION_1_2) return;
eglBindAPI = (PFNEGLBINDAPIPROC)load("eglBindAPI", userptr);
eglQueryAPI = (PFNEGLQUERYAPIPROC)load("eglQueryAPI", userptr);
eglWaitClient = (PFNEGLWAITCLIENTPROC)load("eglWaitClient", userptr);
eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)load("eglCreatePbufferFromClientBuffer", userptr);
eglReleaseThread = (PFNEGLRELEASETHREADPROC)load("eglReleaseThread", userptr);
}
static void load_EGL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_VERSION_1_4) return;
eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC) load("eglGetCurrentContext", userptr);
static void load_EGL_VERSION_1_4(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_VERSION_1_4) return;
eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)load("eglGetCurrentContext", userptr);
}
static void load_EGL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_VERSION_1_5) return;
eglDestroySync = (PFNEGLDESTROYSYNCPROC) load("eglDestroySync", userptr);
eglCreateImage = (PFNEGLCREATEIMAGEPROC) load("eglCreateImage", userptr);
eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC) load("eglGetPlatformDisplay", userptr);
eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) load("eglDestroyImage", userptr);
eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC) load("eglClientWaitSync", userptr);
eglWaitSync = (PFNEGLWAITSYNCPROC) load("eglWaitSync", userptr);
eglCreateSync = (PFNEGLCREATESYNCPROC) load("eglCreateSync", userptr);
eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC) load("eglGetSyncAttrib", userptr);
eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) load("eglCreatePlatformWindowSurface", userptr);
eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) load("eglCreatePlatformPixmapSurface", userptr);
static void load_EGL_VERSION_1_5(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_VERSION_1_5) return;
eglDestroySync = (PFNEGLDESTROYSYNCPROC)load("eglDestroySync", userptr);
eglCreateImage = (PFNEGLCREATEIMAGEPROC)load("eglCreateImage", userptr);
eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC)load("eglGetPlatformDisplay", userptr);
eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)load("eglDestroyImage", userptr);
eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)load("eglClientWaitSync", userptr);
eglWaitSync = (PFNEGLWAITSYNCPROC)load("eglWaitSync", userptr);
eglCreateSync = (PFNEGLCREATESYNCPROC)load("eglCreateSync", userptr);
eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC)load("eglGetSyncAttrib", userptr);
eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)load("eglCreatePlatformWindowSurface", userptr);
eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)load("eglCreatePlatformPixmapSurface", userptr);
}
static void load_EGL_EXT_platform_base( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_EXT_platform_base) return;
eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) load("eglCreatePlatformWindowSurfaceEXT", userptr);
eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC) load("eglGetPlatformDisplayEXT", userptr);
eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) load("eglCreatePlatformPixmapSurfaceEXT", userptr);
static void load_EGL_EXT_platform_base(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_EXT_platform_base) return;
eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)load("eglCreatePlatformWindowSurfaceEXT", userptr);
eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)load("eglGetPlatformDisplayEXT", userptr);
eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)load("eglCreatePlatformPixmapSurfaceEXT", userptr);
}
static void load_EGL_EXT_device_enumeration( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_EXT_device_enumeration) return;
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC) load("eglQueryDevicesEXT", userptr);
static void load_EGL_EXT_device_enumeration(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_EXT_device_enumeration) return;
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
}
static void load_EGL_EXT_device_query( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_EXT_device_query) return;
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC) load("eglQueryDisplayAttribEXT", userptr);
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC) load("eglQueryDeviceStringEXT", userptr);
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC) load("eglQueryDeviceAttribEXT", userptr);
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC) load("eglQueryDisplayAttribKHR", userptr);
static void load_EGL_EXT_device_query(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_EXT_device_query) return;
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC)load("eglQueryDisplayAttribKHR", userptr);
}
static void load_EGL_EXT_device_base( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_EGL_EXT_device_base) return;
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC) load("eglQueryDisplayAttribEXT", userptr);
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC) load("eglQueryDevicesEXT", userptr);
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC) load("eglQueryDeviceStringEXT", userptr);
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC) load("eglQueryDeviceAttribEXT", userptr);
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC) load("eglQueryDisplayAttribKHR", userptr);
static void load_EGL_EXT_device_base(GLADuserptrloadfunc load, void *userptr)
{
if (!GLAD_EGL_EXT_device_base) return;
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC)load("eglQueryDisplayAttribKHR", userptr);
}
static int get_exts(EGLDisplay display, const char **extensions)
{
*extensions = eglQueryString(display, EGL_EXTENSIONS);
static int get_exts(EGLDisplay display, const char **extensions) {
*extensions = eglQueryString(display, EGL_EXTENSIONS);
return extensions != NULL;
return extensions != NULL;
}
static int has_ext(const char *extensions, const char *ext) {
const char *loc;
const char *terminator;
if(extensions == NULL) {
return 0;
}
while(1) {
loc = strstr(extensions, ext);
if(loc == NULL) {
return 0;
}
terminator = loc + strlen(ext);
if((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0')) {
return 1;
}
extensions = terminator;
}
static int has_ext(const char *extensions, const char *ext)
{
const char *loc;
const char *terminator;
if (extensions == NULL)
{
return 0;
}
while (1)
{
loc = strstr(extensions, ext);
if (loc == NULL)
{
return 0;
}
terminator = loc + strlen(ext);
if ((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0'))
{
return 1;
}
extensions = terminator;
}
}
static GLADapiproc glad_egl_get_proc_from_userptr(const char *name, void *userptr) {
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
static GLADapiproc glad_egl_get_proc_from_userptr(const char *name, void *userptr)
{
return (GLAD_GNUC_EXTENSION(GLADapiproc(*)(const char *name)) userptr)(name);
}
static int find_extensionsEGL(EGLDisplay display) {
const char *extensions;
if (!get_exts(display, &extensions)) return 0;
static int find_extensionsEGL(EGLDisplay display)
{
const char *extensions;
if (!get_exts(display, &extensions)) return 0;
GLAD_EGL_EXT_platform_device = has_ext(extensions, "EGL_EXT_platform_device");
GLAD_EGL_EXT_platform_base = has_ext(extensions, "EGL_EXT_platform_base");
GLAD_EGL_NV_device_cuda = has_ext(extensions, "EGL_NV_device_cuda");
GLAD_EGL_EXT_device_enumeration = has_ext(extensions, "EGL_EXT_device_enumeration");
GLAD_EGL_EXT_device_query = has_ext(extensions, "EGL_EXT_device_query");
GLAD_EGL_EXT_device_base = has_ext(extensions, "EGL_EXT_device_base");
GLAD_EGL_NV_cuda_event = has_ext(extensions, "EGL_NV_cuda_event");
GLAD_EGL_EXT_platform_device = has_ext(extensions, "EGL_EXT_platform_device");
GLAD_EGL_EXT_platform_base = has_ext(extensions, "EGL_EXT_platform_base");
GLAD_EGL_NV_device_cuda = has_ext(extensions, "EGL_NV_device_cuda");
GLAD_EGL_EXT_device_enumeration = has_ext(extensions, "EGL_EXT_device_enumeration");
GLAD_EGL_EXT_device_query = has_ext(extensions, "EGL_EXT_device_query");
GLAD_EGL_EXT_device_base = has_ext(extensions, "EGL_EXT_device_base");
GLAD_EGL_NV_cuda_event = has_ext(extensions, "EGL_NV_cuda_event");
return 1;
return 1;
}
static int find_coreEGL(EGLDisplay display) {
int major, minor;
const char *version;
static int find_coreEGL(EGLDisplay display)
{
int major, minor;
const char *version;
if (display == NULL) {
display = EGL_NO_DISPLAY; /* this is usually NULL, better safe than sorry */
}
if (display == EGL_NO_DISPLAY) {
display = eglGetCurrentDisplay();
}
if (display == EGL_NO_DISPLAY) {
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
}
if (display == EGL_NO_DISPLAY) {
return 0;
}
if (display == NULL)
{
display = EGL_NO_DISPLAY; /* this is usually NULL, better safe than sorry */
}
if (display == EGL_NO_DISPLAY)
{
display = eglGetCurrentDisplay();
}
if (display == EGL_NO_DISPLAY)
{
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
}
if (display == EGL_NO_DISPLAY)
{
return 0;
}
version = eglQueryString(display, EGL_VERSION);
(void) eglGetError();
version = eglQueryString(display, EGL_VERSION);
(void)eglGetError();
if (version == NULL) {
major = 1;
minor = 0;
} else {
GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
}
if (version == NULL)
{
major = 1;
minor = 0;
}
else
{
GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
}
GLAD_EGL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_EGL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
GLAD_EGL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
GLAD_EGL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
GLAD_EGL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
GLAD_EGL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
GLAD_EGL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_EGL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
GLAD_EGL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
GLAD_EGL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
GLAD_EGL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
GLAD_EGL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
return GLAD_MAKE_VERSION(major, minor);
return GLAD_MAKE_VERSION(major, minor);
}
int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void* userptr) {
int version;
eglGetDisplay = (PFNEGLGETDISPLAYPROC) load("eglGetDisplay", userptr);
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) load("eglGetCurrentDisplay", userptr);
eglQueryString = (PFNEGLQUERYSTRINGPROC) load("eglQueryString", userptr);
eglGetError = (PFNEGLGETERRORPROC) load("eglGetError", userptr);
if (eglGetDisplay == NULL || eglGetCurrentDisplay == NULL || eglQueryString == NULL || eglGetError == NULL) return 0;
int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr)
{
int version;
eglGetDisplay = (PFNEGLGETDISPLAYPROC)load("eglGetDisplay", userptr);
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)load("eglGetCurrentDisplay", userptr);
eglQueryString = (PFNEGLQUERYSTRINGPROC)load("eglQueryString", userptr);
eglGetError = (PFNEGLGETERRORPROC)load("eglGetError", userptr);
if (eglGetDisplay == NULL || eglGetCurrentDisplay == NULL || eglQueryString == NULL || eglGetError == NULL) return 0;
version = find_coreEGL(display);
if (!version) return 0;
load_EGL_VERSION_1_0(load, userptr);
load_EGL_VERSION_1_1(load, userptr);
load_EGL_VERSION_1_2(load, userptr);
load_EGL_VERSION_1_4(load, userptr);
load_EGL_VERSION_1_5(load, userptr);
version = find_coreEGL(display);
if (!version) return 0;
load_EGL_VERSION_1_0(load, userptr);
load_EGL_VERSION_1_1(load, userptr);
load_EGL_VERSION_1_2(load, userptr);
load_EGL_VERSION_1_4(load, userptr);
load_EGL_VERSION_1_5(load, userptr);
if (!find_extensionsEGL(display)) return 0;
load_EGL_EXT_platform_base(load, userptr);
load_EGL_EXT_device_enumeration(load, userptr);
load_EGL_EXT_device_query(load, userptr);
load_EGL_EXT_device_base(load, userptr);
if (!find_extensionsEGL(display)) return 0;
load_EGL_EXT_platform_base(load, userptr);
load_EGL_EXT_device_enumeration(load, userptr);
load_EGL_EXT_device_query(load, userptr);
load_EGL_EXT_device_base(load, userptr);
return version;
return version;
}
int gladLoadEGL(EGLDisplay display, GLADloadfunc load) {
return gladLoadEGLUserPtr(display, glad_egl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
int gladLoadEGL(EGLDisplay display, GLADloadfunc load)
{
return gladLoadEGLUserPtr(display, glad_egl_get_proc_from_userptr, GLAD_GNUC_EXTENSION(void *) load);
}
#ifdef GLAD_EGL
#ifndef GLAD_LOADER_LIBRARY_C_
@@ -304,119 +324,137 @@ int gladLoadEGL(EGLDisplay display, GLADloadfunc load) {
#include <dlfcn.h>
#endif
static void *glad_get_dlopen_handle(const char *lib_names[], int length)
{
void *handle = NULL;
int i;
static void* glad_get_dlopen_handle(const char *lib_names[], int length) {
void *handle = NULL;
int i;
for (i = 0; i < length; ++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
#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 = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
handle = (void *)LoadLibraryA(lib_names[i]);
#endif
if (handle != NULL) {
return handle;
}
}
#else
handle = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
#endif
if (handle != NULL)
{
return handle;
}
}
return NULL;
return NULL;
}
static void glad_close_dlopen_handle(void* handle) {
if (handle != NULL) {
static void glad_close_dlopen_handle(void *handle)
{
if (handle != NULL)
{
#if GLAD_PLATFORM_WIN32
FreeLibrary((HMODULE) handle);
FreeLibrary((HMODULE)handle);
#else
dlclose(handle);
dlclose(handle);
#endif
}
}
}
static GLADapiproc glad_dlsym_handle(void* handle, const char *name) {
if (handle == NULL) {
return NULL;
}
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);
return (GLADapiproc)GetProcAddress((HMODULE)handle, name);
#else
return GLAD_GNUC_EXTENSION (GLADapiproc) dlsym(handle, name);
return GLAD_GNUC_EXTENSION(GLADapiproc) dlsym(handle, name);
#endif
}
#endif /* GLAD_LOADER_LIBRARY_C_ */
struct _glad_egl_userptr {
void *handle;
PFNEGLGETPROCADDRESSPROC get_proc_address_ptr;
struct _glad_egl_userptr
{
void *handle;
PFNEGLGETPROCADDRESSPROC get_proc_address_ptr;
};
static GLADapiproc glad_egl_get_proc(const char* name, void *vuserptr) {
struct _glad_egl_userptr userptr = *(struct _glad_egl_userptr*) vuserptr;
GLADapiproc result = NULL;
static GLADapiproc glad_egl_get_proc(const char *name, void *vuserptr)
{
struct _glad_egl_userptr userptr = *(struct _glad_egl_userptr *)vuserptr;
GLADapiproc result = NULL;
result = glad_dlsym_handle(userptr.handle, name);
if (result == NULL) {
result = GLAD_GNUC_EXTENSION (GLADapiproc) userptr.get_proc_address_ptr(name);
}
result = glad_dlsym_handle(userptr.handle, name);
if (result == NULL)
{
result = GLAD_GNUC_EXTENSION(GLADapiproc) userptr.get_proc_address_ptr(name);
}
return result;
return result;
}
static void* _egl_handle = NULL;
static void *_egl_handle = NULL;
int gladLoaderLoadEGL(EGLDisplay display) {
int gladLoaderLoadEGL(EGLDisplay display)
{
#ifdef __APPLE__
static const char *NAMES[] = {"libEGL.dylib"};
static const char *NAMES[] = {"libEGL.dylib"};
#elif GLAD_PLATFORM_WIN32
static const char *NAMES[] = {"libEGL.dll", "EGL.dll"};
static const char *NAMES[] = {"libEGL.dll", "EGL.dll"};
#else
static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"};
static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"};
#endif
int version = 0;
int did_load = 0;
struct _glad_egl_userptr userptr;
int version = 0;
int did_load = 0;
struct _glad_egl_userptr userptr;
if (_egl_handle == NULL) {
_egl_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
did_load = _egl_handle != NULL;
}
if (_egl_handle == NULL)
{
_egl_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
did_load = _egl_handle != NULL;
}
if (_egl_handle != NULL) {
userptr.handle = _egl_handle;
userptr.get_proc_address_ptr = (PFNEGLGETPROCADDRESSPROC) glad_dlsym_handle(_egl_handle, "eglGetProcAddress");
if (userptr.get_proc_address_ptr != NULL) {
version = gladLoadEGLUserPtr(display, glad_egl_get_proc, &userptr);
}
if (_egl_handle != NULL)
{
userptr.handle = _egl_handle;
userptr.get_proc_address_ptr = (PFNEGLGETPROCADDRESSPROC)glad_dlsym_handle(_egl_handle, "eglGetProcAddress");
if (userptr.get_proc_address_ptr != NULL)
{
version = gladLoadEGLUserPtr(display, glad_egl_get_proc, &userptr);
}
if (!version && did_load) {
glad_close_dlopen_handle(_egl_handle);
_egl_handle = NULL;
}
}
if (!version && did_load)
{
glad_close_dlopen_handle(_egl_handle);
_egl_handle = NULL;
}
}
return version;
return version;
}
void gladLoaderUnloadEGL() {
if (_egl_handle != NULL) {
glad_close_dlopen_handle(_egl_handle);
_egl_handle = NULL;
}
void gladLoaderUnloadEGL()
{
if (_egl_handle != NULL)
{
glad_close_dlopen_handle(_egl_handle);
_egl_handle = NULL;
}
}
#endif /* GLAD_EGL */

File diff suppressed because it is too large Load Diff

View File

@@ -27,99 +27,97 @@
#ifndef GLAD_EGL_H_
#define GLAD_EGL_H_
#define GLAD_EGL
#define GLAD_OPTION_EGL_LOADER
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
#ifndef GLAD_PLATFORM_H_
#define GLAD_PLATFORM_H_
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)
#define GLAD_PLATFORM_WIN32 1
#define GLAD_PLATFORM_WIN32 1
#else
#define GLAD_PLATFORM_WIN32 0
#define GLAD_PLATFORM_WIN32 0
#endif
#ifndef GLAD_PLATFORM_UWP
#if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
#ifdef __has_include
#if __has_include(<winapifamily.h>)
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
#endif
#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
#endif
#endif
#ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
#include <winapifamily.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define GLAD_PLATFORM_UWP 1
#endif
#endif
#ifndef GLAD_PLATFORM_UWP
#if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
#ifdef __has_include
#if __has_include(<winapifamily.h>)
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
#endif
#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
#endif
#endif
#ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
#include <winapifamily.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define GLAD_PLATFORM_UWP 1
#endif
#endif
#ifndef GLAD_PLATFORM_UWP
#define GLAD_PLATFORM_UWP 0
#endif
#define GLAD_PLATFORM_UWP 0
#endif
#endif
#ifdef __GNUC__
#define GLAD_GNUC_EXTENSION __extension__
#define GLAD_GNUC_EXTENSION __extension__
#else
#define GLAD_GNUC_EXTENSION
#define GLAD_GNUC_EXTENSION
#endif
#ifndef GLAD_API_CALL
#if defined(GLAD_API_CALL_EXPORT)
#if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
#if defined(GLAD_API_CALL_EXPORT_BUILD)
#if defined(__GNUC__)
#define GLAD_API_CALL __attribute__ ((dllexport)) extern
#else
#define GLAD_API_CALL __declspec(dllexport) extern
#endif
#else
#if defined(__GNUC__)
#define GLAD_API_CALL __attribute__ ((dllimport)) extern
#else
#define GLAD_API_CALL __declspec(dllimport) extern
#endif
#endif
#elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
#define GLAD_API_CALL __attribute__ ((visibility ("default"))) extern
#else
#define GLAD_API_CALL extern
#endif
#else
#define GLAD_API_CALL extern
#endif
#if defined(GLAD_API_CALL_EXPORT)
#if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
#if defined(GLAD_API_CALL_EXPORT_BUILD)
#if defined(__GNUC__)
#define GLAD_API_CALL __attribute__((dllexport)) extern
#else
#define GLAD_API_CALL __declspec(dllexport) extern
#endif
#else
#if defined(__GNUC__)
#define GLAD_API_CALL __attribute__((dllimport)) extern
#else
#define GLAD_API_CALL __declspec(dllimport) extern
#endif
#endif
#elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
#define GLAD_API_CALL __attribute__((visibility("default"))) extern
#else
#define GLAD_API_CALL extern
#endif
#else
#define GLAD_API_CALL extern
#endif
#endif
#ifdef APIENTRY
#define GLAD_API_PTR APIENTRY
#define GLAD_API_PTR APIENTRY
#elif GLAD_PLATFORM_WIN32
#define GLAD_API_PTR __stdcall
#define GLAD_API_PTR __stdcall
#else
#define GLAD_API_PTR
#define GLAD_API_PTR
#endif
#define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
#define GLAD_VERSION_MAJOR(version) (version / 10000)
#define GLAD_VERSION_MINOR(version) (version % 10000)
typedef void (*GLADapiproc)(void);
typedef void (*GLADapiproc)(void);
typedef GLADapiproc (*GLADloadfunc)(const char *name);
typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr);
typedef GLADapiproc (*GLADloadfunc)(const char *name);
typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr);
typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
#endif /* GLAD_PLATFORM_H_ */
@@ -173,7 +171,7 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define EGL_VG_ALPHA_FORMAT 0x3088
#define EGL_RENDER_BUFFER 0x3086
#define EGL_VG_COLORSPACE 0x3087
#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
#define EGL_NO_CONTEXT EGL_CAST(EGLContext, 0)
#define EGL_OPENGL_API 0x30A2
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
#define EGL_LUMINANCE_BUFFER 0x308F
@@ -183,8 +181,8 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define EGL_BAD_ACCESS 0x3002
#define EGL_OPENGL_ES2_BIT 0x0004
#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay, 0)
#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT, 0)
#define EGL_BAD_CONFIG 0x3005
#define EGL_NO_TEXTURE 0x305C
#define EGL_LARGEST_PBUFFER 0x3058
@@ -201,10 +199,10 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define EGL_COLORSPACE EGL_VG_COLORSPACE
#define EGL_SYNC_CUDA_EVENT_NV 0x323C
#define EGL_OPENVG_IMAGE 0x3096
#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
#define EGL_NO_IMAGE EGL_CAST(EGLImage, 0)
#define EGL_TEXTURE_TARGET 0x3081
#define EGL_CORE_NATIVE_ENGINE 0x305B
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType, 0)
#define EGL_SIGNALED 0x30F2
#define EGL_GL_COLORSPACE 0x309D
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
@@ -250,13 +248,13 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define EGL_SYNC_STATUS 0x30F1
#define EGL_TRUE 1
#define EGL_TIMEOUT_EXPIRED 0x30F5
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
#define EGL_NO_SURFACE EGL_CAST(EGLSurface, 0)
#define EGL_RED_SIZE 0x3024
#define EGL_TEXTURE_RGBA 0x305E
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
#define EGL_UNKNOWN EGL_CAST(EGLint, -1)
#define EGL_SUCCESS 0x3000
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
@@ -290,267 +288,251 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
#define EGL_CLIENT_APIS 0x308D
#define EGL_GL_TEXTURE_LEVEL 0x30BC
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
#define EGL_NO_SYNC EGL_CAST(EGLSync, 0)
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
#define EGL_DONT_CARE EGL_CAST(EGLint, -1)
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
#define EGL_GL_COLORSPACE_SRGB EGL_COLORSPACE_sRGB
#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
#include <KHR/khrplatform.h>
#include <EGL/eglplatform.h>
struct AHardwareBuffer;
struct AHardwareBuffer;
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef intptr_t EGLAttribKHR;
typedef intptr_t EGLAttrib;
typedef void *EGLClientBuffer;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDeviceEXT;
typedef void *EGLDisplay;
typedef void *EGLImage;
typedef void *EGLImageKHR;
typedef void *EGLLabelKHR;
typedef void *EGLObjectKHR;
typedef void *EGLOutputLayerEXT;
typedef void *EGLOutputPortEXT;
typedef void *EGLStreamKHR;
typedef void *EGLSurface;
typedef void *EGLSync;
typedef void *EGLSyncKHR;
typedef void *EGLSyncNV;
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
typedef khronos_utime_nanoseconds_t EGLTime;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
typedef khronos_utime_nanoseconds_t EGLuint64NV;
typedef khronos_uint64_t EGLuint64KHR;
typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
typedef int EGLNativeFileDescriptorKHR;
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
struct EGLClientPixmapHI {
void *pData;
EGLint iWidth;
EGLint iHeight;
EGLint iStride;
};
typedef void (GLAD_API_PTR *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef intptr_t EGLAttribKHR;
typedef intptr_t EGLAttrib;
typedef void *EGLClientBuffer;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDeviceEXT;
typedef void *EGLDisplay;
typedef void *EGLImage;
typedef void *EGLImageKHR;
typedef void *EGLLabelKHR;
typedef void *EGLObjectKHR;
typedef void *EGLOutputLayerEXT;
typedef void *EGLOutputPortEXT;
typedef void *EGLStreamKHR;
typedef void *EGLSurface;
typedef void *EGLSync;
typedef void *EGLSyncKHR;
typedef void *EGLSyncNV;
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
typedef khronos_utime_nanoseconds_t EGLTime;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
typedef khronos_utime_nanoseconds_t EGLuint64NV;
typedef khronos_uint64_t EGLuint64KHR;
typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
typedef int EGLNativeFileDescriptorKHR;
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFuncANDROID)(const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID)(const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
struct EGLClientPixmapHI
{
void *pData;
EGLint iWidth;
EGLint iHeight;
EGLint iStride;
};
typedef void(GLAD_API_PTR *EGLDEBUGPROCKHR)(EGLenum error, const char *command, EGLint messageType, EGLLabelKHR threadLabel, EGLLabelKHR objectLabel, const char *message);
#define EGL_VERSION_1_0 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_0;
GLAD_API_CALL int GLAD_EGL_VERSION_1_0;
#define EGL_VERSION_1_1 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_1;
GLAD_API_CALL int GLAD_EGL_VERSION_1_1;
#define EGL_VERSION_1_2 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_2;
GLAD_API_CALL int GLAD_EGL_VERSION_1_2;
#define EGL_VERSION_1_3 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_3;
GLAD_API_CALL int GLAD_EGL_VERSION_1_3;
#define EGL_VERSION_1_4 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_4;
GLAD_API_CALL int GLAD_EGL_VERSION_1_4;
#define EGL_VERSION_1_5 1
GLAD_API_CALL int GLAD_EGL_VERSION_1_5;
GLAD_API_CALL int GLAD_EGL_VERSION_1_5;
#define EGL_EXT_platform_device 1
GLAD_API_CALL int GLAD_EGL_EXT_platform_device;
GLAD_API_CALL int GLAD_EGL_EXT_platform_device;
#define EGL_EXT_platform_base 1
GLAD_API_CALL int GLAD_EGL_EXT_platform_base;
GLAD_API_CALL int GLAD_EGL_EXT_platform_base;
#define EGL_NV_device_cuda 1
GLAD_API_CALL int GLAD_EGL_NV_device_cuda;
GLAD_API_CALL int GLAD_EGL_NV_device_cuda;
#define EGL_EXT_device_enumeration 1
GLAD_API_CALL int GLAD_EGL_EXT_device_enumeration;
GLAD_API_CALL int GLAD_EGL_EXT_device_enumeration;
#define EGL_EXT_device_query 1
GLAD_API_CALL int GLAD_EGL_EXT_device_query;
GLAD_API_CALL int GLAD_EGL_EXT_device_query;
#define EGL_EXT_device_base 1
GLAD_API_CALL int GLAD_EGL_EXT_device_base;
GLAD_API_CALL int GLAD_EGL_EXT_device_base;
#define EGL_NV_cuda_event 1
GLAD_API_CALL int GLAD_EGL_NV_cuda_event;
GLAD_API_CALL int GLAD_EGL_NV_cuda_event;
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDEVICESEXTPROC)(EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLint(GLAD_API_PTR *PFNEGLGETERRORPROC)(void);
typedef __eglMustCastToProperFunctionPointerType(GLAD_API_PTR *PFNEGLGETPROCADDRESSPROC)(const char *procname);
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETCURRENTDISPLAYPROC)(void);
typedef EGLenum(GLAD_API_PTR *PFNEGLQUERYAPIPROC)(void);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBKHRPROC)(EGLDisplay dpy, EGLint name, EGLAttrib *value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYSYNCPROC)(EGLDisplay dpy, EGLSync sync);
typedef EGLImage(GLAD_API_PTR *PFNEGLCREATEIMAGEPROC)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
typedef EGLContext(GLAD_API_PTR *PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLBINDAPIPROC)(EGLenum api);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITNATIVEPROC)(EGLint engine);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLTERMINATEPROC)(EGLDisplay dpy);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLRELEASETHREADPROC)(void);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
typedef EGLSurface(GLAD_API_PTR *PFNEGLGETCURRENTSURFACEPROC)(EGLint readdraw);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLCOPYBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void *native_display, const EGLint *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDEVICEATTRIBEXTPROC)(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLBINDTEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYPROC)(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
typedef const char *(GLAD_API_PTR *PFNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
typedef EGLint(GLAD_API_PTR *PFNEGLCLIENTWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYIMAGEPROC)(EGLDisplay dpy, EGLImage image);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLRELEASETEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBEXTPROC)(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
typedef const char *(GLAD_API_PTR *PFNEGLQUERYDEVICESTRINGEXTPROC)(EGLDeviceEXT device, EGLint name);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
typedef EGLContext(GLAD_API_PTR *PFNEGLGETCURRENTCONTEXTPROC)(void);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
typedef EGLSync(GLAD_API_PTR *PFNEGLCREATESYNCPROC)(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETSYNCATTRIBPROC)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSURFACEATTRIBPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITGLPROC)(void);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETCONFIGSPROC)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITCLIENTPROC)(void);
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDEVICESEXTPROC)(EGLint max_devices, EGLDeviceEXT * devices, EGLint * num_devices);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay dpy, EGLConfig config, const EGLint * attrib_list);
typedef EGLint (GLAD_API_PTR *PFNEGLGETERRORPROC)(void);
typedef __eglMustCastToProperFunctionPointerType (GLAD_API_PTR *PFNEGLGETPROCADDRESSPROC)(const char * procname);
typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETCURRENTDISPLAYPROC)(void);
typedef EGLenum (GLAD_API_PTR *PFNEGLQUERYAPIPROC)(void);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBKHRPROC)(EGLDisplay dpy, EGLint name, EGLAttrib * value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYSYNCPROC)(EGLDisplay dpy, EGLSync sync);
typedef EGLImage (GLAD_API_PTR *PFNEGLCREATEIMAGEPROC)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint * value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
typedef EGLContext (GLAD_API_PTR *PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint * attrib_list, EGLConfig * configs, EGLint config_size, EGLint * num_config);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLBINDAPIPROC)(EGLenum api);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITNATIVEPROC)(EGLint engine);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLTERMINATEPROC)(EGLDisplay dpy);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLint * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLRELEASETHREADPROC)(void);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value);
typedef EGLSurface (GLAD_API_PTR *PFNEGLGETCURRENTSURFACEPROC)(EGLint readdraw);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLCOPYBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void * native_display, const EGLint * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDEVICEATTRIBEXTPROC)(EGLDeviceEXT device, EGLint attribute, EGLAttrib * value);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLBINDTEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYPROC)(EGLenum platform, void * native_display, const EGLAttrib * attrib_list);
typedef EGLDisplay (GLAD_API_PTR *PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
typedef const char * (GLAD_API_PTR *PFNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
typedef EGLint (GLAD_API_PTR *PFNEGLCLIENTWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYIMAGEPROC)(EGLDisplay dpy, EGLImage image);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLRELEASETEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBEXTPROC)(EGLDisplay dpy, EGLint attribute, EGLAttrib * value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
typedef const char * (GLAD_API_PTR *PFNEGLQUERYDEVICESTRINGEXTPROC)(EGLDeviceEXT device, EGLint name);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list);
typedef EGLContext (GLAD_API_PTR *PFNEGLGETCURRENTCONTEXTPROC)(void);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint * major, EGLint * minor);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLint * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
typedef EGLSync (GLAD_API_PTR *PFNEGLCREATESYNCPROC)(EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETSYNCATTRIBPROC)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLSURFACEATTRIBPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITGLPROC)(void);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLQUERYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint * value);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLGETCONFIGSPROC)(EGLDisplay dpy, EGLConfig * configs, EGLint config_size, EGLint * num_config);
typedef EGLBoolean (GLAD_API_PTR *PFNEGLWAITCLIENTPROC)(void);
typedef EGLSurface (GLAD_API_PTR *PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint * attrib_list);
GLAD_API_CALL PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
GLAD_API_CALL PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
#define eglQueryDevicesEXT glad_eglQueryDevicesEXT
GLAD_API_CALL PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
GLAD_API_CALL PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
#define eglCreatePbufferSurface glad_eglCreatePbufferSurface
GLAD_API_CALL PFNEGLGETERRORPROC glad_eglGetError;
GLAD_API_CALL PFNEGLGETERRORPROC glad_eglGetError;
#define eglGetError glad_eglGetError
GLAD_API_CALL PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
GLAD_API_CALL PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
#define eglGetProcAddress glad_eglGetProcAddress
GLAD_API_CALL PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
GLAD_API_CALL PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
#define eglGetCurrentDisplay glad_eglGetCurrentDisplay
GLAD_API_CALL PFNEGLQUERYAPIPROC glad_eglQueryAPI;
GLAD_API_CALL PFNEGLQUERYAPIPROC glad_eglQueryAPI;
#define eglQueryAPI glad_eglQueryAPI
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
#define eglCreatePlatformPixmapSurface glad_eglCreatePlatformPixmapSurface
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBKHRPROC glad_eglQueryDisplayAttribKHR;
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBKHRPROC glad_eglQueryDisplayAttribKHR;
#define eglQueryDisplayAttribKHR glad_eglQueryDisplayAttribKHR
GLAD_API_CALL PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
GLAD_API_CALL PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
#define eglDestroySync glad_eglDestroySync
GLAD_API_CALL PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
GLAD_API_CALL PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
#define eglCreateImage glad_eglCreateImage
GLAD_API_CALL PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
GLAD_API_CALL PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
#define eglQueryContext glad_eglQueryContext
GLAD_API_CALL PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
GLAD_API_CALL PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
#define eglSwapBuffers glad_eglSwapBuffers
GLAD_API_CALL PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
GLAD_API_CALL PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
#define eglCreateContext glad_eglCreateContext
GLAD_API_CALL PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
GLAD_API_CALL PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
#define eglChooseConfig glad_eglChooseConfig
GLAD_API_CALL PFNEGLBINDAPIPROC glad_eglBindAPI;
GLAD_API_CALL PFNEGLBINDAPIPROC glad_eglBindAPI;
#define eglBindAPI glad_eglBindAPI
GLAD_API_CALL PFNEGLWAITNATIVEPROC glad_eglWaitNative;
GLAD_API_CALL PFNEGLWAITNATIVEPROC glad_eglWaitNative;
#define eglWaitNative glad_eglWaitNative
GLAD_API_CALL PFNEGLTERMINATEPROC glad_eglTerminate;
GLAD_API_CALL PFNEGLTERMINATEPROC glad_eglTerminate;
#define eglTerminate glad_eglTerminate
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
#define eglCreatePlatformPixmapSurfaceEXT glad_eglCreatePlatformPixmapSurfaceEXT
GLAD_API_CALL PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
GLAD_API_CALL PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
#define eglReleaseThread glad_eglReleaseThread
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
#define eglCreatePlatformWindowSurface glad_eglCreatePlatformWindowSurface
GLAD_API_CALL PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
GLAD_API_CALL PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
#define eglGetConfigAttrib glad_eglGetConfigAttrib
GLAD_API_CALL PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
GLAD_API_CALL PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
#define eglGetCurrentSurface glad_eglGetCurrentSurface
GLAD_API_CALL PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
GLAD_API_CALL PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
#define eglCopyBuffers glad_eglCopyBuffers
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
#define eglGetPlatformDisplayEXT glad_eglGetPlatformDisplayEXT
GLAD_API_CALL PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
GLAD_API_CALL PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
#define eglQueryDeviceAttribEXT glad_eglQueryDeviceAttribEXT
GLAD_API_CALL PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
GLAD_API_CALL PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
#define eglCreatePixmapSurface glad_eglCreatePixmapSurface
GLAD_API_CALL PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
GLAD_API_CALL PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
#define eglBindTexImage glad_eglBindTexImage
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
#define eglGetPlatformDisplay glad_eglGetPlatformDisplay
GLAD_API_CALL PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
GLAD_API_CALL PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
#define eglGetDisplay glad_eglGetDisplay
GLAD_API_CALL PFNEGLQUERYSTRINGPROC glad_eglQueryString;
GLAD_API_CALL PFNEGLQUERYSTRINGPROC glad_eglQueryString;
#define eglQueryString glad_eglQueryString
GLAD_API_CALL PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
GLAD_API_CALL PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
#define eglClientWaitSync glad_eglClientWaitSync
GLAD_API_CALL PFNEGLWAITSYNCPROC glad_eglWaitSync;
GLAD_API_CALL PFNEGLWAITSYNCPROC glad_eglWaitSync;
#define eglWaitSync glad_eglWaitSync
GLAD_API_CALL PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
GLAD_API_CALL PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
#define eglDestroyImage glad_eglDestroyImage
GLAD_API_CALL PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
GLAD_API_CALL PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
#define eglReleaseTexImage glad_eglReleaseTexImage
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
#define eglQueryDisplayAttribEXT glad_eglQueryDisplayAttribEXT
GLAD_API_CALL PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
GLAD_API_CALL PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
#define eglDestroyContext glad_eglDestroyContext
GLAD_API_CALL PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
GLAD_API_CALL PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
#define eglQueryDeviceStringEXT glad_eglQueryDeviceStringEXT
GLAD_API_CALL PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
GLAD_API_CALL PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
#define eglCreateWindowSurface glad_eglCreateWindowSurface
GLAD_API_CALL PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
GLAD_API_CALL PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
#define eglGetCurrentContext glad_eglGetCurrentContext
GLAD_API_CALL PFNEGLINITIALIZEPROC glad_eglInitialize;
GLAD_API_CALL PFNEGLINITIALIZEPROC glad_eglInitialize;
#define eglInitialize glad_eglInitialize
GLAD_API_CALL PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
GLAD_API_CALL PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
#define eglDestroySurface glad_eglDestroySurface
GLAD_API_CALL PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
GLAD_API_CALL PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
#define eglMakeCurrent glad_eglMakeCurrent
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
#define eglCreatePlatformWindowSurfaceEXT glad_eglCreatePlatformWindowSurfaceEXT
GLAD_API_CALL PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
GLAD_API_CALL PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
#define eglSwapInterval glad_eglSwapInterval
GLAD_API_CALL PFNEGLCREATESYNCPROC glad_eglCreateSync;
GLAD_API_CALL PFNEGLCREATESYNCPROC glad_eglCreateSync;
#define eglCreateSync glad_eglCreateSync
GLAD_API_CALL PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
GLAD_API_CALL PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
#define eglGetSyncAttrib glad_eglGetSyncAttrib
GLAD_API_CALL PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
GLAD_API_CALL PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
#define eglSurfaceAttrib glad_eglSurfaceAttrib
GLAD_API_CALL PFNEGLWAITGLPROC glad_eglWaitGL;
GLAD_API_CALL PFNEGLWAITGLPROC glad_eglWaitGL;
#define eglWaitGL glad_eglWaitGL
GLAD_API_CALL PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
GLAD_API_CALL PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
#define eglQuerySurface glad_eglQuerySurface
GLAD_API_CALL PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
GLAD_API_CALL PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
#define eglGetConfigs glad_eglGetConfigs
GLAD_API_CALL PFNEGLWAITCLIENTPROC glad_eglWaitClient;
GLAD_API_CALL PFNEGLWAITCLIENTPROC glad_eglWaitClient;
#define eglWaitClient glad_eglWaitClient
GLAD_API_CALL PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
GLAD_API_CALL PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
#define eglCreatePbufferFromClientBuffer glad_eglCreatePbufferFromClientBuffer
GLAD_API_CALL int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr);
GLAD_API_CALL int gladLoadEGL(EGLDisplay display, GLADloadfunc load);
GLAD_API_CALL int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr);
GLAD_API_CALL int gladLoadEGL(EGLDisplay display, GLADloadfunc load);
#ifdef GLAD_EGL
GLAD_API_CALL int gladLoaderLoadEGL(EGLDisplay display);
GLAD_API_CALL int gladLoaderLoadEGL(EGLDisplay display);
GLAD_API_CALL void gladLoaderUnloadEGL(void);
GLAD_API_CALL void gladLoaderUnloadEGL(void);
#endif
#ifdef __cplusplus

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,43 +7,43 @@
#define inline __inline
#endif
#define LINMATH_H_DEFINE_VEC(n) \
typedef float vec##n[n]; \
static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \
{ \
int i; \
for(i=0; i<n; ++i) \
r[i] = a[i] + b[i]; \
} \
static inline void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \
{ \
int i; \
for(i=0; i<n; ++i) \
r[i] = a[i] - b[i]; \
} \
static inline void vec##n##_scale(vec##n r, vec##n const v, float const s) \
{ \
int i; \
for(i=0; i<n; ++i) \
r[i] = v[i] * s; \
} \
static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \
{ \
float p = 0.; \
int i; \
for(i=0; i<n; ++i) \
p += b[i]*a[i]; \
return p; \
} \
static inline float vec##n##_len(vec##n const v) \
{ \
return (float) sqrt(vec##n##_mul_inner(v,v)); \
} \
static inline void vec##n##_norm(vec##n r, vec##n const v) \
{ \
float k = 1.f / vec##n##_len(v); \
vec##n##_scale(r, v, k); \
}
#define LINMATH_H_DEFINE_VEC(n) \
typedef float vec##n[n]; \
static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \
{ \
int i; \
for (i = 0; i < n; ++i) \
r[i] = a[i] + b[i]; \
} \
static inline void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \
{ \
int i; \
for (i = 0; i < n; ++i) \
r[i] = a[i] - b[i]; \
} \
static inline void vec##n##_scale(vec##n r, vec##n const v, float const s) \
{ \
int i; \
for (i = 0; i < n; ++i) \
r[i] = v[i] * s; \
} \
static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \
{ \
float p = 0.; \
int i; \
for (i = 0; i < n; ++i) \
p += b[i] * a[i]; \
return p; \
} \
static inline float vec##n##_len(vec##n const v) \
{ \
return (float)sqrt(vec##n##_mul_inner(v, v)); \
} \
static inline void vec##n##_norm(vec##n r, vec##n const v) \
{ \
float k = 1.f / vec##n##_len(v); \
vec##n##_scale(r, v, k); \
}
LINMATH_H_DEFINE_VEC(2)
LINMATH_H_DEFINE_VEC(3)
@@ -51,85 +51,85 @@ LINMATH_H_DEFINE_VEC(4)
static inline void vec3_mul_cross(vec3 r, vec3 const a, vec3 const b)
{
r[0] = a[1]*b[2] - a[2]*b[1];
r[1] = a[2]*b[0] - a[0]*b[2];
r[2] = a[0]*b[1] - a[1]*b[0];
r[0] = a[1] * b[2] - a[2] * b[1];
r[1] = a[2] * b[0] - a[0] * b[2];
r[2] = a[0] * b[1] - a[1] * b[0];
}
static inline void vec3_reflect(vec3 r, vec3 const v, vec3 const n)
{
float p = 2.f*vec3_mul_inner(v, n);
float p = 2.f * vec3_mul_inner(v, n);
int i;
for(i=0;i<3;++i)
r[i] = v[i] - p*n[i];
for (i = 0; i < 3; ++i)
r[i] = v[i] - p * n[i];
}
static inline void vec4_mul_cross(vec4 r, vec4 a, vec4 b)
{
r[0] = a[1]*b[2] - a[2]*b[1];
r[1] = a[2]*b[0] - a[0]*b[2];
r[2] = a[0]*b[1] - a[1]*b[0];
r[0] = a[1] * b[2] - a[2] * b[1];
r[1] = a[2] * b[0] - a[0] * b[2];
r[2] = a[0] * b[1] - a[1] * b[0];
r[3] = 1.f;
}
static inline void vec4_reflect(vec4 r, vec4 v, vec4 n)
{
float p = 2.f*vec4_mul_inner(v, n);
float p = 2.f * vec4_mul_inner(v, n);
int i;
for(i=0;i<4;++i)
r[i] = v[i] - p*n[i];
for (i = 0; i < 4; ++i)
r[i] = v[i] - p * n[i];
}
typedef vec4 mat4x4[4];
static inline void mat4x4_identity(mat4x4 M)
{
int i, j;
for(i=0; i<4; ++i)
for(j=0; j<4; ++j)
M[i][j] = i==j ? 1.f : 0.f;
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
M[i][j] = i == j ? 1.f : 0.f;
}
static inline void mat4x4_dup(mat4x4 M, mat4x4 N)
{
int i, j;
for(i=0; i<4; ++i)
for(j=0; j<4; ++j)
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
M[i][j] = N[i][j];
}
static inline void mat4x4_row(vec4 r, mat4x4 M, int i)
{
int k;
for(k=0; k<4; ++k)
for (k = 0; k < 4; ++k)
r[k] = M[k][i];
}
static inline void mat4x4_col(vec4 r, mat4x4 M, int i)
{
int k;
for(k=0; k<4; ++k)
for (k = 0; k < 4; ++k)
r[k] = M[i][k];
}
static inline void mat4x4_transpose(mat4x4 M, mat4x4 N)
{
int i, j;
for(j=0; j<4; ++j)
for(i=0; i<4; ++i)
for (j = 0; j < 4; ++j)
for (i = 0; i < 4; ++i)
M[i][j] = N[j][i];
}
static inline void mat4x4_add(mat4x4 M, mat4x4 a, mat4x4 b)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
vec4_add(M[i], a[i], b[i]);
}
static inline void mat4x4_sub(mat4x4 M, mat4x4 a, mat4x4 b)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
vec4_sub(M[i], a[i], b[i]);
}
static inline void mat4x4_scale(mat4x4 M, mat4x4 a, float k)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
vec4_scale(M[i], a[i], k);
}
static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, float z)
@@ -138,7 +138,8 @@ static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, floa
vec4_scale(M[0], a[0], x);
vec4_scale(M[1], a[1], y);
vec4_scale(M[2], a[2], z);
for(i = 0; i < 4; ++i) {
for (i = 0; i < 4; ++i)
{
M[3][i] = a[3][i];
}
}
@@ -146,19 +147,22 @@ static inline void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
{
mat4x4 temp;
int k, r, c;
for(c=0; c<4; ++c) for(r=0; r<4; ++r) {
temp[c][r] = 0.f;
for(k=0; k<4; ++k)
temp[c][r] += a[k][r] * b[c][k];
}
for (c = 0; c < 4; ++c)
for (r = 0; r < 4; ++r)
{
temp[c][r] = 0.f;
for (k = 0; k < 4; ++k)
temp[c][r] += a[k][r] * b[c][k];
}
mat4x4_dup(M, temp);
}
static inline void mat4x4_mul_vec4(vec4 r, mat4x4 M, vec4 v)
{
int i, j;
for(j=0; j<4; ++j) {
for (j = 0; j < 4; ++j)
{
r[j] = 0.f;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
r[j] += M[i][j] * v[i];
}
}
@@ -174,7 +178,8 @@ static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z
vec4 t = {x, y, z, 0};
vec4 r;
int i;
for (i = 0; i < 4; ++i) {
for (i = 0; i < 4; ++i)
{
mat4x4_row(r, M, i);
M[3][i] += vec4_mul_inner(r, t);
}
@@ -182,8 +187,9 @@ static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z
static inline void mat4x4_from_vec3_mul_outer(mat4x4 M, vec3 a, vec3 b)
{
int i, j;
for(i=0; i<4; ++i) for(j=0; j<4; ++j)
M[i][j] = i<3 && j<3 ? a[i] * b[j] : 0.f;
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
M[i][j] = i < 3 && j < 3 ? a[i] * b[j] : 0.f;
}
static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z, float angle)
{
@@ -191,17 +197,18 @@ static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z,
float c = cosf(angle);
vec3 u = {x, y, z};
if(vec3_len(u) > 1e-4) {
if (vec3_len(u) > 1e-4)
{
mat4x4 T, C, S = {{0}};
vec3_norm(u, u);
mat4x4_from_vec3_mul_outer(T, u, u);
S[1][2] = u[0];
S[1][2] = u[0];
S[2][1] = -u[0];
S[2][0] = u[1];
S[2][0] = u[1];
S[0][2] = -u[1];
S[0][1] = u[2];
S[0][1] = u[2];
S[1][0] = -u[2];
mat4x4_scale(S, S, s);
@@ -216,7 +223,9 @@ static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z,
T[3][3] = 1.;
mat4x4_mul(R, M, T);
} else {
}
else
{
mat4x4_dup(R, M);
}
}
@@ -226,10 +235,9 @@ static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle)
float c = cosf(angle);
mat4x4 R = {
{1.f, 0.f, 0.f, 0.f},
{0.f, c, s, 0.f},
{0.f, -s, c, 0.f},
{0.f, 0.f, 0.f, 1.f}
};
{0.f, c, s, 0.f},
{0.f, -s, c, 0.f},
{0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle)
@@ -237,11 +245,10 @@ static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle)
float s = sinf(angle);
float c = cosf(angle);
mat4x4 R = {
{ c, 0.f, s, 0.f},
{ 0.f, 1.f, 0.f, 0.f},
{ -s, 0.f, c, 0.f},
{ 0.f, 0.f, 0.f, 1.f}
};
{c, 0.f, s, 0.f},
{0.f, 1.f, 0.f, 0.f},
{-s, 0.f, c, 0.f},
{0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
@@ -249,11 +256,10 @@ static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
float s = sinf(angle);
float c = cosf(angle);
mat4x4 R = {
{ c, s, 0.f, 0.f},
{ -s, c, 0.f, 0.f},
{ 0.f, 0.f, 1.f, 0.f},
{ 0.f, 0.f, 0.f, 1.f}
};
{c, s, 0.f, 0.f},
{-s, c, 0.f, 0.f},
{0.f, 0.f, 1.f, 0.f},
{0.f, 0.f, 0.f, 1.f}};
mat4x4_mul(Q, M, R);
}
static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
@@ -261,42 +267,42 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
float idet;
float s[6];
float c[6];
s[0] = M[0][0]*M[1][1] - M[1][0]*M[0][1];
s[1] = M[0][0]*M[1][2] - M[1][0]*M[0][2];
s[2] = M[0][0]*M[1][3] - M[1][0]*M[0][3];
s[3] = M[0][1]*M[1][2] - M[1][1]*M[0][2];
s[4] = M[0][1]*M[1][3] - M[1][1]*M[0][3];
s[5] = M[0][2]*M[1][3] - M[1][2]*M[0][3];
s[0] = M[0][0] * M[1][1] - M[1][0] * M[0][1];
s[1] = M[0][0] * M[1][2] - M[1][0] * M[0][2];
s[2] = M[0][0] * M[1][3] - M[1][0] * M[0][3];
s[3] = M[0][1] * M[1][2] - M[1][1] * M[0][2];
s[4] = M[0][1] * M[1][3] - M[1][1] * M[0][3];
s[5] = M[0][2] * M[1][3] - M[1][2] * M[0][3];
c[0] = M[2][0]*M[3][1] - M[3][0]*M[2][1];
c[1] = M[2][0]*M[3][2] - M[3][0]*M[2][2];
c[2] = M[2][0]*M[3][3] - M[3][0]*M[2][3];
c[3] = M[2][1]*M[3][2] - M[3][1]*M[2][2];
c[4] = M[2][1]*M[3][3] - M[3][1]*M[2][3];
c[5] = M[2][2]*M[3][3] - M[3][2]*M[2][3];
c[0] = M[2][0] * M[3][1] - M[3][0] * M[2][1];
c[1] = M[2][0] * M[3][2] - M[3][0] * M[2][2];
c[2] = M[2][0] * M[3][3] - M[3][0] * M[2][3];
c[3] = M[2][1] * M[3][2] - M[3][1] * M[2][2];
c[4] = M[2][1] * M[3][3] - M[3][1] * M[2][3];
c[5] = M[2][2] * M[3][3] - M[3][2] * M[2][3];
/* Assumes it is invertible */
idet = 1.0f/( s[0]*c[5]-s[1]*c[4]+s[2]*c[3]+s[3]*c[2]-s[4]*c[1]+s[5]*c[0] );
idet = 1.0f / (s[0] * c[5] - s[1] * c[4] + s[2] * c[3] + s[3] * c[2] - s[4] * c[1] + s[5] * c[0]);
T[0][0] = ( M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet;
T[0][0] = (M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet;
T[0][1] = (-M[0][1] * c[5] + M[0][2] * c[4] - M[0][3] * c[3]) * idet;
T[0][2] = ( M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet;
T[0][2] = (M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet;
T[0][3] = (-M[2][1] * s[5] + M[2][2] * s[4] - M[2][3] * s[3]) * idet;
T[1][0] = (-M[1][0] * c[5] + M[1][2] * c[2] - M[1][3] * c[1]) * idet;
T[1][1] = ( M[0][0] * c[5] - M[0][2] * c[2] + M[0][3] * c[1]) * idet;
T[1][1] = (M[0][0] * c[5] - M[0][2] * c[2] + M[0][3] * c[1]) * idet;
T[1][2] = (-M[3][0] * s[5] + M[3][2] * s[2] - M[3][3] * s[1]) * idet;
T[1][3] = ( M[2][0] * s[5] - M[2][2] * s[2] + M[2][3] * s[1]) * idet;
T[1][3] = (M[2][0] * s[5] - M[2][2] * s[2] + M[2][3] * s[1]) * idet;
T[2][0] = ( M[1][0] * c[4] - M[1][1] * c[2] + M[1][3] * c[0]) * idet;
T[2][0] = (M[1][0] * c[4] - M[1][1] * c[2] + M[1][3] * c[0]) * idet;
T[2][1] = (-M[0][0] * c[4] + M[0][1] * c[2] - M[0][3] * c[0]) * idet;
T[2][2] = ( M[3][0] * s[4] - M[3][1] * s[2] + M[3][3] * s[0]) * idet;
T[2][2] = (M[3][0] * s[4] - M[3][1] * s[2] + M[3][3] * s[0]) * idet;
T[2][3] = (-M[2][0] * s[4] + M[2][1] * s[2] - M[2][3] * s[0]) * idet;
T[3][0] = (-M[1][0] * c[3] + M[1][1] * c[1] - M[1][2] * c[0]) * idet;
T[3][1] = ( M[0][0] * c[3] - M[0][1] * c[1] + M[0][2] * c[0]) * idet;
T[3][1] = (M[0][0] * c[3] - M[0][1] * c[1] + M[0][2] * c[0]) * idet;
T[3][2] = (-M[3][0] * s[3] + M[3][1] * s[1] - M[3][2] * s[0]) * idet;
T[3][3] = ( M[2][0] * s[3] - M[2][1] * s[1] + M[2][2] * s[0]) * idet;
T[3][3] = (M[2][0] * s[3] - M[2][1] * s[1] + M[2][2] * s[0]) * idet;
}
static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
{
@@ -324,41 +330,41 @@ static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f)
{
M[0][0] = 2.f*n/(r-l);
M[0][0] = 2.f * n / (r - l);
M[0][1] = M[0][2] = M[0][3] = 0.f;
M[1][1] = 2.f*n/(t-b);
M[1][1] = 2.f * n / (t - b);
M[1][0] = M[1][2] = M[1][3] = 0.f;
M[2][0] = (r+l)/(r-l);
M[2][1] = (t+b)/(t-b);
M[2][2] = -(f+n)/(f-n);
M[2][0] = (r + l) / (r - l);
M[2][1] = (t + b) / (t - b);
M[2][2] = -(f + n) / (f - n);
M[2][3] = -1.f;
M[3][2] = -2.f*(f*n)/(f-n);
M[3][2] = -2.f * (f * n) / (f - n);
M[3][0] = M[3][1] = M[3][3] = 0.f;
}
static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
{
M[0][0] = 2.f/(r-l);
M[0][0] = 2.f / (r - l);
M[0][1] = M[0][2] = M[0][3] = 0.f;
M[1][1] = 2.f/(t-b);
M[1][1] = 2.f / (t - b);
M[1][0] = M[1][2] = M[1][3] = 0.f;
M[2][2] = -2.f/(f-n);
M[2][2] = -2.f / (f - n);
M[2][0] = M[2][1] = M[2][3] = 0.f;
M[3][0] = -(r+l)/(r-l);
M[3][1] = -(t+b)/(t-b);
M[3][2] = -(f+n)/(f-n);
M[3][0] = -(r + l) / (r - l);
M[3][1] = -(t + b) / (t - b);
M[3][2] = -(f + n) / (f - n);
M[3][3] = 1.f;
}
static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f)
{
/* NOTE: Degrees are an unhandy unit to work with.
* linmath.h uses radians for everything! */
float const a = 1.f / (float) tan(y_fov / 2.f);
float const a = 1.f / (float)tan(y_fov / 2.f);
m[0][0] = a / aspect;
m[0][1] = 0.f;
@@ -400,25 +406,25 @@ static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
vec3_mul_cross(t, s, f);
m[0][0] = s[0];
m[0][1] = t[0];
m[0][0] = s[0];
m[0][1] = t[0];
m[0][2] = -f[0];
m[0][3] = 0.f;
m[0][3] = 0.f;
m[1][0] = s[1];
m[1][1] = t[1];
m[1][0] = s[1];
m[1][1] = t[1];
m[1][2] = -f[1];
m[1][3] = 0.f;
m[1][3] = 0.f;
m[2][0] = s[2];
m[2][1] = t[2];
m[2][0] = s[2];
m[2][1] = t[2];
m[2][2] = -f[2];
m[2][3] = 0.f;
m[2][3] = 0.f;
m[3][0] = 0.f;
m[3][1] = 0.f;
m[3][2] = 0.f;
m[3][3] = 1.f;
m[3][0] = 0.f;
m[3][1] = 0.f;
m[3][2] = 0.f;
m[3][3] = 1.f;
mat4x4_translate_in_place(m, -eye[0], -eye[1], -eye[2]);
}
@@ -432,13 +438,13 @@ static inline void quat_identity(quat q)
static inline void quat_add(quat r, quat a, quat b)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
r[i] = a[i] + b[i];
}
static inline void quat_sub(quat r, quat a, quat b)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
r[i] = a[i] - b[i];
}
static inline void quat_mul(quat r, quat p, quat q)
@@ -449,41 +455,42 @@ static inline void quat_mul(quat r, quat p, quat q)
vec3_add(r, r, w);
vec3_scale(w, q, p[3]);
vec3_add(r, r, w);
r[3] = p[3]*q[3] - vec3_mul_inner(p, q);
r[3] = p[3] * q[3] - vec3_mul_inner(p, q);
}
static inline void quat_scale(quat r, quat v, float s)
{
int i;
for(i=0; i<4; ++i)
for (i = 0; i < 4; ++i)
r[i] = v[i] * s;
}
static inline float quat_inner_product(quat a, quat b)
{
float p = 0.f;
int i;
for(i=0; i<4; ++i)
p += b[i]*a[i];
for (i = 0; i < 4; ++i)
p += b[i] * a[i];
return p;
}
static inline void quat_conj(quat r, quat q)
{
int i;
for(i=0; i<3; ++i)
for (i = 0; i < 3; ++i)
r[i] = -q[i];
r[3] = q[3];
}
static inline void quat_rotate(quat r, float angle, vec3 axis) {
static inline void quat_rotate(quat r, float angle, vec3 axis)
{
int i;
vec3 v;
vec3_scale(v, axis, sinf(angle / 2));
for(i=0; i<3; ++i)
for (i = 0; i < 3; ++i)
r[i] = v[i];
r[3] = cosf(angle / 2);
}
#define quat_norm vec4_norm
static inline void quat_mul_vec3(vec3 r, quat q, vec3 v)
{
/*
/*
* Method by Fabian 'ryg' Giessen (of Farbrausch)
t = 2 * cross(q.xyz, v)
v' = v + q.w * t + cross(q.xyz, t)
@@ -506,23 +513,23 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q)
float b = q[0];
float c = q[1];
float d = q[2];
float a2 = a*a;
float b2 = b*b;
float c2 = c*c;
float d2 = d*d;
float a2 = a * a;
float b2 = b * b;
float c2 = c * c;
float d2 = d * d;
M[0][0] = a2 + b2 - c2 - d2;
M[0][1] = 2.f*(b*c + a*d);
M[0][2] = 2.f*(b*d - a*c);
M[0][1] = 2.f * (b * c + a * d);
M[0][2] = 2.f * (b * d - a * c);
M[0][3] = 0.f;
M[1][0] = 2*(b*c - a*d);
M[1][0] = 2 * (b * c - a * d);
M[1][1] = a2 - b2 + c2 - d2;
M[1][2] = 2.f*(c*d + a*b);
M[1][2] = 2.f * (c * d + a * b);
M[1][3] = 0.f;
M[2][0] = 2.f*(b*d + a*c);
M[2][1] = 2.f*(c*d - a*b);
M[2][0] = 2.f * (b * d + a * c);
M[2][1] = 2.f * (c * d - a * b);
M[2][2] = a2 - b2 - c2 + d2;
M[2][3] = 0.f;
@@ -532,8 +539,8 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q)
static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q)
{
/* XXX: The way this is written only works for othogonal matrices. */
/* TODO: Take care of non-orthogonal case. */
/* XXX: The way this is written only works for othogonal matrices. */
/* TODO: Take care of non-orthogonal case. */
quat_mul_vec3(R[0], q, M[0]);
quat_mul_vec3(R[1], q, M[1]);
quat_mul_vec3(R[2], q, M[2]);
@@ -543,32 +550,34 @@ static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q)
}
static inline void quat_from_mat4x4(quat q, mat4x4 M)
{
float r=0.f;
float r = 0.f;
int i;
int perm[] = { 0, 1, 2, 0, 1 };
int perm[] = {0, 1, 2, 0, 1};
int *p = perm;
for(i = 0; i<3; i++) {
for (i = 0; i < 3; i++)
{
float m = M[i][i];
if( m < r )
if (m < r)
continue;
m = r;
p = &perm[i];
}
r = (float) sqrt(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]] );
r = (float)sqrt(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]]);
if(r < 1e-6) {
if (r < 1e-6)
{
q[0] = 1.f;
q[1] = q[2] = q[3] = 0.f;
return;
}
q[0] = r/2.f;
q[1] = (M[p[0]][p[1]] - M[p[1]][p[0]])/(2.f*r);
q[2] = (M[p[2]][p[0]] - M[p[0]][p[2]])/(2.f*r);
q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]])/(2.f*r);
q[0] = r / 2.f;
q[1] = (M[p[0]][p[1]] - M[p[1]][p[0]]) / (2.f * r);
q[2] = (M[p[2]][p[0]] - M[p[0]][p[2]]) / (2.f * r);
q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]]) / (2.f * r);
}
#endif