diff options
author | Duck | 2020-04-10 17:12:10 +0400 |
---|---|---|
committer | Duck | 2020-04-10 17:12:10 +0400 |
commit | 08c91b2d16cbef7f4eb2607ecfea8a839fe986a5 (patch) | |
tree | 51ce7dbd603cc74178409047e4b0747b978fc68a /egl+glx.patch | |
parent | e908312c78f23cafee88fe1faa9c749e42ad7eab (diff) | |
download | aur-08c91b2d16cbef7f4eb2607ecfea8a839fe986a5.tar.gz |
pkgrel 2
Slimplified the patch
Added eglew.h
Removed wglew.h
Changed dependencies
Diffstat (limited to 'egl+glx.patch')
-rw-r--r-- | egl+glx.patch | 148 |
1 files changed, 81 insertions, 67 deletions
diff --git a/egl+glx.patch b/egl+glx.patch index 11c44c5672ae..4ff99d1ed70a 100644 --- a/egl+glx.patch +++ b/egl+glx.patch @@ -1,12 +1,13 @@ --- a/src/glew.c +++ b/src/glew.c -@@ -36,11 +36,12 @@ +@@ -36,11 +36,13 @@ #include GLEW_INCLUDE #endif +#if defined(GLEW_EGL) +# include <GL/eglew.h> +#endif ++ #if defined(GLEW_OSMESA) # define GLAPI extern # include <GL/osmesa.h> @@ -15,34 +16,65 @@ #elif defined(_WIN32) /* * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus -@@ -58,6 +59,17 @@ +@@ -57,8 +59,7 @@ + #include <stddef.h> /* For size_t */ - #if defined(GLEW_EGL) -+static GLboolean __EGL_available = GL_FALSE; -+static void (*__EGL_GLX_getProcAddress (const GLubyte *name)) (void) +-#if defined(GLEW_EGL) +-#elif defined(GLEW_REGAL) ++#if defined(GLEW_REGAL) + + /* In GLEW_REGAL mode we call direcly into the linked + libRegal.so glGetProcAddressREGAL for looking up +@@ -159,23 +160,37 @@ + * Define glewGetProcAddress. + */ + #if defined(GLEW_REGAL) +-# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name) ++# define _glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name) + #elif defined(GLEW_OSMESA) +-# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name) +-#elif defined(GLEW_EGL) +-# define glewGetProcAddress(name) eglGetProcAddress((const char *)name) ++# define _glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name) + #elif defined(_WIN32) +-# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) ++# define _glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) + #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) +-# define glewGetProcAddress(name) NSGLGetProcAddress(name) ++# define _glewGetProcAddress(name) NSGLGetProcAddress(name) + #elif defined(__sgi) || defined(__sun) || defined(__HAIKU__) +-# define glewGetProcAddress(name) dlGetProcAddress(name) ++# define _glewGetProcAddress(name) dlGetProcAddress(name) + #elif defined(__ANDROID__) +-# define glewGetProcAddress(name) NULL /* TODO */ ++# define _glewGetProcAddress(name) NULL /* TODO */ + #elif defined(__native_client__) +-# define glewGetProcAddress(name) NULL /* TODO */ ++# define _glewGetProcAddress(name) NULL /* TODO */ + #else /* __linux */ +-# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) ++# define _glewGetProcAddress(name) (*glXGetProcAddressARB)(name) ++#endif ++ ++#if defined(GLEW_EGL) ++static GLboolean _EGL_available = GL_FALSE; ++static void (*glewGetProcAddress (const GLubyte *name)) (void) +{ + void (*addr)(void); -+ if (__EGL_available == GL_TRUE) ++ if (_EGL_available) + { + addr = eglGetProcAddress((const char *)name); + if (addr) return addr; + } -+ return (*glXGetProcAddressARB)(name); ++ return _glewGetProcAddress(name); +} - #elif defined(GLEW_REGAL) ++#else ++# define glewGetProcAddress(name) _glewGetProcAddress(name) + #endif - /* In GLEW_REGAL mode we call direcly into the linked -@@ -163,7 +175,7 @@ - #elif defined(GLEW_OSMESA) - # define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name) - #elif defined(GLEW_EGL) --# define glewGetProcAddress(name) eglGetProcAddress((const char *)name) -+# define glewGetProcAddress(name) __EGL_GLX_getProcAddress(name) - #elif defined(_WIN32) - # define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) - #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) -@@ -17358,9 +17370,7 @@ + /* +@@ -17358,9 +17373,7 @@ } @@ -53,16 +85,7 @@ PFNEGLCHOOSECONFIGPROC __eglewChooseConfig = NULL; PFNEGLCOPYBUFFERSPROC __eglewCopyBuffers = NULL; -@@ -18343,20 +18353,32 @@ - - GLenum eglewInit (EGLDisplay display) - { -+ GLuint dot; - EGLint major, minor; -+ const GLubyte* version; - const GLubyte* extStart; - const GLubyte* extEnd; - PFNEGLINITIALIZEPROC initialize = NULL; +@@ -18350,8 +18363,8 @@ PFNEGLQUERYSTRINGPROC queryString = NULL; /* Load necessary entry points */ @@ -73,45 +96,22 @@ if (!initialize || !queryString) return 1; - /* query EGK version */ -- if (initialize(display, &major, &minor) != EGL_TRUE) -+ if (display == EGL_NO_DISPLAY) -+ { -+ major = 0; -+ minor = 0; -+ version = (const GLubyte*) queryString(display, EGL_VERSION); -+ dot = _glewStrCLen(version, '.'); -+ if (dot == 0) return 1; -+ major = version[dot-1]-'0'; -+ minor = version[dot+1]-'0'; -+ } -+ else if (initialize(display, &major, &minor) != EGL_TRUE) - return 1; - - EGLEW_VERSION_1_5 = ( major > 1 ) || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; -@@ -18804,6 +18826,10 @@ +@@ -18804,7 +18817,9 @@ return GLEW_OK; } -+#endif /* GLEW_EGL */ -+ -+#if defined(GLEW_OSMESA) +-#elif defined(_WIN32) ++#endif + - #elif defined(_WIN32) ++#if defined(_WIN32) PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL; -@@ -20862,13 +20888,22 @@ + +@@ -20862,13 +20877,26 @@ GLenum r; #if defined(GLEW_EGL) PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL; + EGLDisplay display; -+ getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) eglGetProcAddress("eglGetCurrentDisplay"); -+ if (getCurrentDisplay) -+ { -+ display = getCurrentDisplay(); -+ if (display != EGL_NO_DISPLAY) __EGL_available = GL_TRUE; -+ } -+ else display = EGL_NO_DISPLAY; #endif r = glewContextInit(); if ( r != 0 ) return r; @@ -119,14 +119,34 @@ - getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay"); - return eglewInit(getCurrentDisplay()); -#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__) ++ getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) eglGetProcAddress("eglGetCurrentDisplay"); ++ if (getCurrentDisplay) ++ display = getCurrentDisplay(); ++ else ++ display = EGL_NO_DISPLAY; + if (display != EGL_NO_DISPLAY) -+ return eglewInit(display); ++ { ++ r = eglewInit(display); ++ if ( r == 0 ) { ++ _EGL_available = GL_TRUE; ++ return r; ++ } ++ } +#endif +#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__) return r; #elif defined(_WIN32) return wglewInit(); -@@ -27059,7 +27094,7 @@ +@@ -26623,7 +26651,7 @@ + return ret; + } + +-#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA) ++#if defined(_WIN32) && !defined(GLEW_OSMESA) + + GLboolean GLEWAPIENTRY wglewIsSupported (const char* name) + { +@@ -27059,7 +27087,7 @@ return ret; } @@ -135,7 +155,7 @@ GLboolean glxewIsSupported (const char* name) { -@@ -27615,7 +27650,9 @@ +@@ -27615,7 +27643,9 @@ return ret; } @@ -146,9 +166,3 @@ GLboolean eglewIsSupported (const char* name) { -@@ -28578,4 +28615,4 @@ - return ret; - } - --#endif /* _WIN32 */ -+#endif /* GLEW_EGL */ |