switched to new glad2
This commit is contained in:
@@ -3,6 +3,23 @@
|
||||
#include <string.h>
|
||||
#include <glad/egl.h>
|
||||
|
||||
#ifndef GLAD_IMPL_UTIL_C_
|
||||
#define GLAD_IMPL_UTIL_C_
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
#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
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf_s
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf
|
||||
#endif
|
||||
|
||||
#endif /* GLAD_IMPL_UTIL_C_ */
|
||||
|
||||
|
||||
int GLAD_EGL_VERSION_1_0;
|
||||
int GLAD_EGL_VERSION_1_1;
|
||||
@@ -10,177 +27,175 @@ int GLAD_EGL_VERSION_1_2;
|
||||
int GLAD_EGL_VERSION_1_3;
|
||||
int GLAD_EGL_VERSION_1_4;
|
||||
int GLAD_EGL_VERSION_1_5;
|
||||
int GLAD_EGL_EXT_device_base;
|
||||
int GLAD_EGL_EXT_platform_device;
|
||||
int GLAD_EGL_EXT_platform_base;
|
||||
int GLAD_EGL_NV_device_cuda;
|
||||
int GLAD_EGL_EXT_device_enumeration;
|
||||
int GLAD_EGL_EXT_device_query;
|
||||
int GLAD_EGL_EXT_platform_base;
|
||||
int GLAD_EGL_EXT_platform_device;
|
||||
int GLAD_EGL_EXT_device_base;
|
||||
int GLAD_EGL_NV_cuda_event;
|
||||
int GLAD_EGL_NV_device_cuda;
|
||||
|
||||
|
||||
PFNEGLWAITNATIVEPROC glad_eglWaitNative;
|
||||
PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
|
||||
PFNEGLQUERYSTRINGPROC glad_eglQueryString;
|
||||
PFNEGLINITIALIZEPROC glad_eglInitialize;
|
||||
|
||||
PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
|
||||
PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
|
||||
PFNEGLGETERRORPROC glad_eglGetError;
|
||||
PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
|
||||
PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
|
||||
PFNEGLQUERYAPIPROC glad_eglQueryAPI;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
|
||||
PFNEGLQUERYDISPLAYATTRIBKHRPROC glad_eglQueryDisplayAttribKHR;
|
||||
PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
|
||||
PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
|
||||
PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
|
||||
PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
|
||||
PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
|
||||
PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
|
||||
PFNEGLBINDAPIPROC glad_eglBindAPI;
|
||||
PFNEGLWAITNATIVEPROC glad_eglWaitNative;
|
||||
PFNEGLTERMINATEPROC glad_eglTerminate;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
|
||||
PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
|
||||
PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
|
||||
PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
|
||||
PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
|
||||
PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
|
||||
PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
|
||||
PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
|
||||
PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
|
||||
PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
|
||||
PFNEGLQUERYSTRINGPROC glad_eglQueryString;
|
||||
PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
|
||||
PFNEGLWAITSYNCPROC glad_eglWaitSync;
|
||||
PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
|
||||
PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
|
||||
PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
|
||||
PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
|
||||
PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
|
||||
PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
|
||||
PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
|
||||
PFNEGLINITIALIZEPROC glad_eglInitialize;
|
||||
PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
|
||||
PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
|
||||
PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
|
||||
PFNEGLCREATESYNCPROC glad_eglCreateSync;
|
||||
PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
|
||||
PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
|
||||
PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
|
||||
PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
|
||||
PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
|
||||
PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
|
||||
PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
|
||||
PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
|
||||
PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
|
||||
PFNEGLGETERRORPROC glad_eglGetError;
|
||||
PFNEGLWAITSYNCPROC glad_eglWaitSync;
|
||||
PFNEGLWAITGLPROC glad_eglWaitGL;
|
||||
PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
|
||||
PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
|
||||
PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
|
||||
PFNEGLBINDAPIPROC glad_eglBindAPI;
|
||||
PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
|
||||
PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
|
||||
PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
|
||||
PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
|
||||
PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
|
||||
PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
|
||||
PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
|
||||
PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
|
||||
PFNEGLWAITCLIENTPROC glad_eglWaitClient;
|
||||
PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
|
||||
PFNEGLTERMINATEPROC glad_eglTerminate;
|
||||
PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
|
||||
PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
|
||||
PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
|
||||
PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
|
||||
PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
|
||||
PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
|
||||
PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
|
||||
PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
|
||||
PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
|
||||
PFNEGLQUERYAPIPROC glad_eglQueryAPI;
|
||||
PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
|
||||
PFNEGLWAITGLPROC glad_eglWaitGL;
|
||||
PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
|
||||
PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
|
||||
PFNEGLWAITCLIENTPROC glad_eglWaitClient;
|
||||
PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
|
||||
|
||||
static void load_EGL_VERSION_1_0(GLADloadproc load, void* userptr) {
|
||||
|
||||
static void load_EGL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_VERSION_1_0) return;
|
||||
glad_eglWaitNative = (PFNEGLWAITNATIVEPROC)load("eglWaitNative", userptr);
|
||||
glad_eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC)load("eglCreateWindowSurface", userptr);
|
||||
glad_eglQueryString = (PFNEGLQUERYSTRINGPROC)load("eglQueryString", userptr);
|
||||
glad_eglInitialize = (PFNEGLINITIALIZEPROC)load("eglInitialize", userptr);
|
||||
glad_eglQueryContext = (PFNEGLQUERYCONTEXTPROC)load("eglQueryContext", userptr);
|
||||
glad_eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)load("eglGetCurrentSurface", userptr);
|
||||
glad_eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)load("eglChooseConfig", userptr);
|
||||
glad_eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC)load("eglCreatePixmapSurface", userptr);
|
||||
glad_eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC)load("eglGetConfigAttrib", userptr);
|
||||
glad_eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC)load("eglCreatePbufferSurface", userptr);
|
||||
glad_eglMakeCurrent = (PFNEGLMAKECURRENTPROC)load("eglMakeCurrent", userptr);
|
||||
glad_eglGetError = (PFNEGLGETERRORPROC)load("eglGetError", userptr);
|
||||
glad_eglWaitGL = (PFNEGLWAITGLPROC)load("eglWaitGL", userptr);
|
||||
glad_eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC)load("eglGetProcAddress", userptr);
|
||||
glad_eglCreateContext = (PFNEGLCREATECONTEXTPROC)load("eglCreateContext", userptr);
|
||||
glad_eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC)load("eglDestroyContext", userptr);
|
||||
glad_eglGetConfigs = (PFNEGLGETCONFIGSPROC)load("eglGetConfigs", userptr);
|
||||
glad_eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC)load("eglCopyBuffers", userptr);
|
||||
glad_eglGetDisplay = (PFNEGLGETDISPLAYPROC)load("eglGetDisplay", userptr);
|
||||
glad_eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)load("eglGetCurrentDisplay", userptr);
|
||||
glad_eglQuerySurface = (PFNEGLQUERYSURFACEPROC)load("eglQuerySurface", userptr);
|
||||
glad_eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC)load("eglSwapBuffers", userptr);
|
||||
glad_eglTerminate = (PFNEGLTERMINATEPROC)load("eglTerminate", userptr);
|
||||
glad_eglDestroySurface = (PFNEGLDESTROYSURFACEPROC)load("eglDestroySurface", userptr);
|
||||
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(GLADloadproc load, void* userptr) {
|
||||
static void load_EGL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_VERSION_1_1) return;
|
||||
glad_eglSwapInterval = (PFNEGLSWAPINTERVALPROC)load("eglSwapInterval", userptr);
|
||||
glad_eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC)load("eglSurfaceAttrib", userptr);
|
||||
glad_eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC)load("eglReleaseTexImage", userptr);
|
||||
glad_eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC)load("eglBindTexImage", userptr);
|
||||
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(GLADloadproc load, void* userptr) {
|
||||
static void load_EGL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_VERSION_1_2) return;
|
||||
glad_eglBindAPI = (PFNEGLBINDAPIPROC)load("eglBindAPI", userptr);
|
||||
glad_eglWaitClient = (PFNEGLWAITCLIENTPROC)load("eglWaitClient", userptr);
|
||||
glad_eglReleaseThread = (PFNEGLRELEASETHREADPROC)load("eglReleaseThread", userptr);
|
||||
glad_eglQueryAPI = (PFNEGLQUERYAPIPROC)load("eglQueryAPI", userptr);
|
||||
glad_eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)load("eglCreatePbufferFromClientBuffer", userptr);
|
||||
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_3(GLADloadproc load, void* userptr) {
|
||||
}
|
||||
static void load_EGL_VERSION_1_4(GLADloadproc load, void* userptr) {
|
||||
static void load_EGL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_VERSION_1_4) return;
|
||||
glad_eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)load("eglGetCurrentContext", userptr);
|
||||
eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC) load("eglGetCurrentContext", userptr);
|
||||
}
|
||||
static void load_EGL_VERSION_1_5(GLADloadproc load, void* userptr) {
|
||||
static void load_EGL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_VERSION_1_5) return;
|
||||
glad_eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)load("eglCreatePlatformWindowSurface", userptr);
|
||||
glad_eglWaitSync = (PFNEGLWAITSYNCPROC)load("eglWaitSync", userptr);
|
||||
glad_eglCreateImage = (PFNEGLCREATEIMAGEPROC)load("eglCreateImage", userptr);
|
||||
glad_eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)load("eglDestroyImage", userptr);
|
||||
glad_eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC)load("eglGetPlatformDisplay", userptr);
|
||||
glad_eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)load("eglClientWaitSync", userptr);
|
||||
glad_eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)load("eglCreatePlatformPixmapSurface", userptr);
|
||||
glad_eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC)load("eglGetSyncAttrib", userptr);
|
||||
glad_eglDestroySync = (PFNEGLDESTROYSYNCPROC)load("eglDestroySync", userptr);
|
||||
glad_eglCreateSync = (PFNEGLCREATESYNCPROC)load("eglCreateSync", userptr);
|
||||
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_device_base(GLADloadproc load, void* userptr) {
|
||||
if(!GLAD_EGL_EXT_device_base) return;
|
||||
glad_eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
|
||||
glad_eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
|
||||
glad_eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
|
||||
glad_eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_device_enumeration(GLADloadproc load, void* userptr) {
|
||||
if(!GLAD_EGL_EXT_device_enumeration) return;
|
||||
glad_eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_device_query(GLADloadproc load, void* userptr) {
|
||||
if(!GLAD_EGL_EXT_device_query) return;
|
||||
glad_eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
|
||||
glad_eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
|
||||
glad_eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_platform_base(GLADloadproc load, void* userptr) {
|
||||
static void load_EGL_EXT_platform_base( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_EGL_EXT_platform_base) return;
|
||||
glad_eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)load("eglCreatePlatformPixmapSurfaceEXT", userptr);
|
||||
glad_eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)load("eglGetPlatformDisplayEXT", userptr);
|
||||
glad_eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)load("eglCreatePlatformWindowSurfaceEXT", userptr);
|
||||
eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) load("eglCreatePlatformWindowSurfaceEXT", userptr);
|
||||
eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC) load("eglGetPlatformDisplayEXT", userptr);
|
||||
eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) load("eglCreatePlatformPixmapSurfaceEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_platform_device(GLADloadproc load, void* 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_NV_cuda_event(GLADloadproc load, void* 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_NV_device_cuda(GLADloadproc load, void* 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);
|
||||
|
||||
return extensions != NULL;
|
||||
}
|
||||
|
||||
static int has_ext(const char *extensions, const char *name) {
|
||||
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, extensions);
|
||||
loc = strstr(extensions, ext);
|
||||
if(loc == NULL) {
|
||||
return 0;
|
||||
}
|
||||
terminator = loc + strlen(extensions);
|
||||
terminator = loc + strlen(ext);
|
||||
if((loc == extensions || *(loc - 1) == ' ') &&
|
||||
(*terminator == ' ' || *terminator == '\0')) {
|
||||
return 1;
|
||||
@@ -189,17 +204,21 @@ static int has_ext(const char *extensions, const char *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;
|
||||
|
||||
GLAD_EGL_EXT_device_base = has_ext(extensions, "EGL_EXT_device_base");
|
||||
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_platform_base = has_ext(extensions, "EGL_EXT_platform_base");
|
||||
GLAD_EGL_EXT_platform_device = has_ext(extensions, "EGL_EXT_platform_device");
|
||||
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_NV_device_cuda = has_ext(extensions, "EGL_NV_device_cuda");
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -228,11 +247,7 @@ static int find_coreEGL(EGLDisplay display) {
|
||||
major = 1;
|
||||
minor = 0;
|
||||
} else {
|
||||
#ifdef _MSC_VER
|
||||
sscanf_s(version, "%d.%d", &major, &minor);
|
||||
#else
|
||||
sscanf(version, "%d.%d", &major, &minor);
|
||||
#endif
|
||||
GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
|
||||
}
|
||||
|
||||
GLAD_EGL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||
@@ -242,15 +257,15 @@ static int find_coreEGL(EGLDisplay display) {
|
||||
GLAD_EGL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||
GLAD_EGL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
|
||||
|
||||
return major * 10 + minor;
|
||||
return GLAD_MAKE_VERSION(major, minor);
|
||||
}
|
||||
|
||||
int gladLoadEGL(EGLDisplay display, GLADloadproc load, void* userptr) {
|
||||
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);
|
||||
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);
|
||||
@@ -258,39 +273,32 @@ int gladLoadEGL(EGLDisplay display, GLADloadproc load, void* userptr) {
|
||||
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_3(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_device_base(load, userptr);
|
||||
load_EGL_EXT_platform_base(load, userptr);
|
||||
load_EGL_EXT_device_enumeration(load, userptr);
|
||||
load_EGL_EXT_device_query(load, userptr);
|
||||
load_EGL_EXT_platform_base(load, userptr);
|
||||
load_EGL_EXT_platform_device(load, userptr);
|
||||
load_EGL_NV_cuda_event(load, userptr);
|
||||
load_EGL_NV_device_cuda(load, userptr);
|
||||
load_EGL_EXT_device_base(load, userptr);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
static void* glad_egl_get_proc_from_userptr(const char* name, void *userptr) {
|
||||
return ((void* (*)(const char *name))userptr)(name);
|
||||
}
|
||||
|
||||
int gladLoadEGLSimple(EGLDisplay display, GLADsimpleloadproc load) {
|
||||
return gladLoadEGL(display, glad_egl_get_proc_from_userptr, (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_
|
||||
#define __glad_loader_library_c_
|
||||
#ifndef GLAD_LOADER_LIBRARY_C_
|
||||
#define GLAD_LOADER_LIBRARY_C_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
@@ -298,12 +306,24 @@ int gladLoadEGLSimple(EGLDisplay display, GLADsimpleloadproc load) {
|
||||
|
||||
|
||||
static void* glad_get_dlopen_handle(const char *lib_names[], int length) {
|
||||
void *handle = NULL;
|
||||
int i;
|
||||
void *handle;
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
#ifdef _WIN32
|
||||
handle = LoadLibraryA(lib_names[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
|
||||
@@ -317,7 +337,7 @@ static void* glad_get_dlopen_handle(const char *lib_names[], int length) {
|
||||
|
||||
static void glad_close_dlopen_handle(void* handle) {
|
||||
if (handle != NULL) {
|
||||
#ifdef _WIN32
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
FreeLibrary((HMODULE) handle);
|
||||
#else
|
||||
dlclose(handle);
|
||||
@@ -325,32 +345,32 @@ static void glad_close_dlopen_handle(void* handle) {
|
||||
}
|
||||
}
|
||||
|
||||
static void* glad_dlsym_handle(void* handle, const char *name) {
|
||||
static GLADapiproc glad_dlsym_handle(void* handle, const char *name) {
|
||||
if (handle == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
return (void*) GetProcAddress((HMODULE) handle, name);
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
return (GLADapiproc) GetProcAddress((HMODULE) handle, name);
|
||||
#else
|
||||
return dlsym(handle, name);
|
||||
return GLAD_GNUC_EXTENSION (GLADapiproc) dlsym(handle, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __glad_loader_library_c_ */
|
||||
typedef __eglMustCastToProperFunctionPointerType (APIENTRYP GLAD_EGL_PFNGETPROCADDRESSPROC_PRIVATE)(const char*);
|
||||
#endif /* GLAD_LOADER_LIBRARY_C_ */
|
||||
|
||||
struct _glad_egl_userptr {
|
||||
void *handle;
|
||||
GLAD_EGL_PFNGETPROCADDRESSPROC_PRIVATE get_proc_address_ptr;
|
||||
PFNEGLGETPROCADDRESSPROC get_proc_address_ptr;
|
||||
};
|
||||
|
||||
static void* glad_egl_get_proc(const char* name, void *vuserptr) {
|
||||
static GLADapiproc glad_egl_get_proc(const char* name, void *vuserptr) {
|
||||
struct _glad_egl_userptr userptr = *(struct _glad_egl_userptr*) vuserptr;
|
||||
void* result = NULL;
|
||||
GLADapiproc result = NULL;
|
||||
|
||||
result = (void*) glad_dlsym_handle(userptr.handle, name);
|
||||
result = glad_dlsym_handle(userptr.handle, name);
|
||||
if (result == NULL) {
|
||||
result = (void*) userptr.get_proc_address_ptr(name);
|
||||
result = GLAD_GNUC_EXTENSION (GLADapiproc) userptr.get_proc_address_ptr(name);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -358,10 +378,10 @@ static void* glad_egl_get_proc(const char* name, void *vuserptr) {
|
||||
|
||||
static void* _egl_handle = NULL;
|
||||
|
||||
int gladLoadEGLInternalLoader(EGLDisplay display) {
|
||||
int gladLoaderLoadEGL(EGLDisplay display) {
|
||||
#ifdef __APPLE__
|
||||
static const char *NAMES[] = {"libEGL.dylib"};
|
||||
#elif defined _WIN32
|
||||
#elif GLAD_PLATFORM_WIN32
|
||||
static const char *NAMES[] = {"libEGL.dll", "EGL.dll"};
|
||||
#else
|
||||
static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"};
|
||||
@@ -378,9 +398,9 @@ int gladLoadEGLInternalLoader(EGLDisplay display) {
|
||||
|
||||
if (_egl_handle != NULL) {
|
||||
userptr.handle = _egl_handle;
|
||||
userptr.get_proc_address_ptr = (GLAD_EGL_PFNGETPROCADDRESSPROC_PRIVATE) glad_dlsym_handle(_egl_handle, "eglGetProcAddress");
|
||||
userptr.get_proc_address_ptr = (PFNEGLGETPROCADDRESSPROC) glad_dlsym_handle(_egl_handle, "eglGetProcAddress");
|
||||
if (userptr.get_proc_address_ptr != NULL) {
|
||||
version = gladLoadEGL(display, (GLADloadproc) glad_egl_get_proc, &userptr);
|
||||
version = gladLoadEGLUserPtr(display, glad_egl_get_proc, &userptr);
|
||||
}
|
||||
|
||||
if (!version && did_load) {
|
||||
@@ -392,11 +412,11 @@ int gladLoadEGLInternalLoader(EGLDisplay display) {
|
||||
return version;
|
||||
}
|
||||
|
||||
void gladUnloadEGLInternalLoader() {
|
||||
void gladLoaderUnloadEGL() {
|
||||
if (_egl_handle != NULL) {
|
||||
glad_close_dlopen_handle(_egl_handle);
|
||||
_egl_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GLAD_EGL */
|
||||
#endif /* GLAD_EGL */
|
||||
|
||||
Reference in New Issue
Block a user