forked from Dav1dde/glad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c: include loader based on API not specification, renamed callback API.
- Loading branch information
Showing
11 changed files
with
117 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifdef GLAD_GLES1 | ||
|
||
typedef void* (APIENTRYP GLAD_GLES1_PFNGETPROCADDRESSPROC_PRIVATE)(const char*); | ||
struct _glad_gles1_userptr { | ||
void *handle; | ||
GLAD_GLES1_PFNGETPROCADDRESSPROC_PRIVATE get_proc_address_ptr; | ||
}; | ||
|
||
|
||
static void* glad_gles1_get_proc(const char* name, void *vuserptr) { | ||
struct _glad_gles1_userptr userptr = *(struct _glad_gles1_userptr) vuserptr; | ||
void* result = NULL; | ||
|
||
/* dlsym first, since some implementations don't return function pointers for core functions */ | ||
result = (void*) glad_dlsym_handle(userptr.handle, name); | ||
if (result == NULL) { | ||
result = (void*) userptr.get_proc_address_ptr(name); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
int gladLoadGLES1InternalLoader() { | ||
#ifdef __APPLE__ | ||
static const char *NAMES[] = {"libGLESv1_CM.dylib"}; | ||
#elif defined _WIN32 | ||
static const char *NAMES[] = {"GLESv1_CM.dll", "libGLESv1_CM", "libGLES_CM.dll"}; | ||
#else | ||
static const char *NAMES[] = {"ibGLESv1_CM.so.1", "ibGLESv1_CM.so", "libGLES_CM.so.1"}; | ||
#endif | ||
|
||
int version = 0; | ||
void *handle; | ||
struct _glad_gles1_userptr userptr; | ||
|
||
handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0])); | ||
if (handle) { | ||
userptr.handle = handle; | ||
userptr.get_proc_address_ptr = eglGetProcAddress; | ||
|
||
version = gladLoadGLES2((GLADloadproc) glad_gles1_get_proc, &userptr); | ||
|
||
glad_close_dlopen_handle(handle); | ||
} | ||
|
||
return version; | ||
} | ||
#endif /* GLAD_GLES1 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifdef GLAD_GLES1 | ||
#ifndef __egl_h_ | ||
#error "gles1 loader requires egl.h, include egl.h (<glad/egl.h>) before including the loader." | ||
#endif | ||
|
||
GLAPI int gladLoadGLES1InternalLoader(); | ||
|
||
#endif /* GLAD_GLES1 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifdef GLAD_GLES2 | ||
|
||
typedef void* (APIENTRYP GLAD_GLES2_PFNGETPROCADDRESSPROC_PRIVATE)(const char*); | ||
struct _glad_gles2_userptr { | ||
void *handle; | ||
GLAD_GLES2_PFNGETPROCADDRESSPROC_PRIVATE get_proc_address_ptr; | ||
}; | ||
|
||
|
||
static void* glad_gles2_get_proc(const char* name, void *vuserptr) { | ||
struct _glad_gles2_userptr userptr = *(struct _glad_gles2_userptr) vuserptr; | ||
void* result = NULL; | ||
|
||
/* dlsym first, since some implementations don't return function pointers for core functions */ | ||
result = (void*) glad_dlsym_handle(userptr.handle, name); | ||
if (result == NULL) { | ||
result = (void*) userptr.get_proc_address_ptr(name); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
int gladLoadGLES2InternalLoader() { | ||
#ifdef __APPLE__ | ||
static const char *NAMES[] = {"libGLESv2.dylib"}; | ||
#elif defined _WIN32 | ||
static const char *NAMES[] = {"GLESv2.dll", "libGLESv2.dll"}; | ||
#else | ||
static const char *NAMES[] = {"libGLESv2.so.2", "libGLESv2.so"}; | ||
#endif | ||
|
||
int version = 0; | ||
void *handle; | ||
struct _glad_gles_userptr userptr; | ||
|
||
handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0])); | ||
if (handle) { | ||
userptr.handle = handle; | ||
userptr.get_proc_address_ptr = eglGetProcAddress; | ||
|
||
version = gladLoadGLES2((GLADloadproc) glad_gles2_get_proc, &userptr); | ||
|
||
glad_close_dlopen_handle(handle); | ||
} | ||
|
||
return version; | ||
} | ||
#endif /* GLAD_GLES2 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifdef GLAD_GLES2 | ||
#ifndef __egl_h_ | ||
#error "gles2 loader requires egl.h, include egl.h (<glad/egl.h>) before including the loader." | ||
#endif | ||
|
||
GLAPI int gladLoadGLES2InternalLoader(); | ||
|
||
#endif /* GLAD_GLES2 */ | ||
|
Empty file.
Empty file.