Debian Codegraph @

thirdparty/glad/patches/0001-enable-both-gl-and-gles.patch

raw
1 diff --git a/thirdparty/glad/gl.c b/thirdparty/glad/gl.c
2 index e8cc5ff1d9..ee0cc188fc 100644
3 --- a/thirdparty/glad/gl.c
4 +++ b/thirdparty/glad/gl.c
5 @@ -2475,7 +2475,7 @@ static GLADapiproc glad_gl_get_proc(void *vuserptr, const char *name) {
6 return result;
7 }
8
9 -static void* _glad_GL_loader_handle = NULL;
10 +static void* _glad_gles_loader_handle = NULL;
11
12 static void* glad_gl_dlopen_handle(void) {
13 #if GLAD_PLATFORM_APPLE
14 @@ -2497,11 +2497,11 @@ static void* glad_gl_dlopen_handle(void) {
15 };
16 #endif
17
18 - if (_glad_GL_loader_handle == NULL) {
19 - _glad_GL_loader_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
20 + if (_glad_gles_loader_handle == NULL) {
21 + _glad_gles_loader_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
22 }
23
24 - return _glad_GL_loader_handle;
25 + return _glad_gles_loader_handle;
26 }
27
28 static struct _glad_gl_userptr glad_gl_build_userptr(void *handle) {
29 @@ -2527,7 +2527,7 @@ int gladLoaderLoadGL(void) {
30 int did_load = 0;
31 struct _glad_gl_userptr userptr;
32
33 - did_load = _glad_GL_loader_handle == NULL;
34 + did_load = _glad_gles_loader_handle == NULL;
35 handle = glad_gl_dlopen_handle();
36 if (handle) {
37 userptr = glad_gl_build_userptr(handle);
38 @@ -2545,9 +2545,9 @@ int gladLoaderLoadGL(void) {
39
40
41 void gladLoaderUnloadGL(void) {
42 - if (_glad_GL_loader_handle != NULL) {
43 - glad_close_dlopen_handle(_glad_GL_loader_handle);
44 - _glad_GL_loader_handle = NULL;
45 + if (_glad_gles_loader_handle != NULL) {
46 + glad_close_dlopen_handle(_glad_gles_loader_handle);
47 + _glad_gles_loader_handle = NULL;
48 }
49 }
50
51 diff --git a/thirdparty/glad/glad/gl.h b/thirdparty/glad/glad/gl.h
52 index 7f77d6a13f..307ea4dbb8 100644
53 --- a/thirdparty/glad/glad/gl.h
54 +++ b/thirdparty/glad/glad/gl.h
55 @@ -67,6 +67,7 @@
56 #endif
57
58 #define GLAD_GL
59 +#define GLAD_GLES2
60 #define GLAD_OPTION_GL_LOADER
61
62 #ifdef __cplusplus