patch_enable_both_gl_and_gles.diff 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. diff --git a/thirdparty/glad/gl.c b/thirdparty/glad/gl.c
  2. index a0b59dbbfb..9f10f6544a 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. -static void* _glad_GL_loader_handle = NULL;
  9. +static void* _glad_gles_loader_handle = NULL;
  10. static void* glad_gl_dlopen_handle(void) {
  11. #if GLAD_PLATFORM_APPLE
  12. @@ -2497,11 +2497,11 @@ static void* glad_gl_dlopen_handle(void) {
  13. };
  14. #endif
  15. - if (_glad_GL_loader_handle == NULL) {
  16. - _glad_GL_loader_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
  17. + if (_glad_gles_loader_handle == NULL) {
  18. + _glad_gles_loader_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
  19. }
  20. - return _glad_GL_loader_handle;
  21. + return _glad_gles_loader_handle;
  22. }
  23. static struct _glad_gl_userptr glad_gl_build_userptr(void *handle) {
  24. @@ -2527,7 +2527,7 @@ int gladLoaderLoadGL(void) {
  25. int did_load = 0;
  26. struct _glad_gl_userptr userptr;
  27. - did_load = _glad_GL_loader_handle == NULL;
  28. + did_load = _glad_gles_loader_handle == NULL;
  29. handle = glad_gl_dlopen_handle();
  30. if (handle) {
  31. userptr = glad_gl_build_userptr(handle);
  32. @@ -2545,9 +2545,9 @@ int gladLoaderLoadGL(void) {
  33. void gladLoaderUnloadGL(void) {
  34. - if (_glad_GL_loader_handle != NULL) {
  35. - glad_close_dlopen_handle(_glad_GL_loader_handle);
  36. - _glad_GL_loader_handle = NULL;
  37. + if (_glad_gles_loader_handle != NULL) {
  38. + glad_close_dlopen_handle(_glad_gles_loader_handle);
  39. + _glad_gles_loader_handle = NULL;
  40. }
  41. }
  42. diff --git a/thirdparty/glad/glad/gl.h b/thirdparty/glad/glad/gl.h
  43. index 905c16aeed..f3cb7d8cb5 100644
  44. --- a/thirdparty/glad/glad/gl.h
  45. +++ b/thirdparty/glad/glad/gl.h
  46. @@ -67,6 +67,7 @@
  47. #endif
  48. #define GLAD_GL
  49. +#define GLAD_GLES2
  50. #define GLAD_OPTION_GL_LOADER
  51. #ifdef __cplusplus