db-move: moved adwaita-icon-theme from [testing] to [extra] (any)
[arch-packages.git] / glew / trunk / egl+glx.patch
blob634690164aab4abf92c52f69f2d8419dc1774655
1 --- a/src/glew.c
2 +++ b/src/glew.c
3 @@ -36,11 +36,13 @@
4 # include GLEW_INCLUDE
5 #endif
7 +#if defined(GLEW_EGL)
8 +# include <GL/eglew.h>
9 +#endif
11 #if defined(GLEW_OSMESA)
12 # define GLAPI extern
13 # include <GL/osmesa.h>
14 -#elif defined(GLEW_EGL)
15 -# include <GL/eglew.h>
16 #elif defined(_WIN32)
18 * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus
19 @@ -57,8 +59,7 @@
21 #include <stddef.h> /* For size_t */
23 -#if defined(GLEW_EGL)
24 -#elif defined(GLEW_REGAL)
25 +#if defined(GLEW_REGAL)
27 /* In GLEW_REGAL mode we call direcly into the linked
28 libRegal.so glGetProcAddressREGAL for looking up
29 @@ -159,23 +160,37 @@
30 * Define glewGetProcAddress.
32 #if defined(GLEW_REGAL)
33 -# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
34 +# define _glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
35 #elif defined(GLEW_OSMESA)
36 -# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
37 -#elif defined(GLEW_EGL)
38 -# define glewGetProcAddress(name) eglGetProcAddress((const char *)name)
39 +# define _glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
40 #elif defined(_WIN32)
41 -# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
42 +# define _glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
43 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
44 -# define glewGetProcAddress(name) NSGLGetProcAddress(name)
45 +# define _glewGetProcAddress(name) NSGLGetProcAddress(name)
46 #elif defined(__sgi) || defined(__sun) || defined(__HAIKU__)
47 -# define glewGetProcAddress(name) dlGetProcAddress(name)
48 +# define _glewGetProcAddress(name) dlGetProcAddress(name)
49 #elif defined(__ANDROID__)
50 -# define glewGetProcAddress(name) NULL /* TODO */
51 +# define _glewGetProcAddress(name) NULL /* TODO */
52 #elif defined(__native_client__)
53 -# define glewGetProcAddress(name) NULL /* TODO */
54 +# define _glewGetProcAddress(name) NULL /* TODO */
55 #else /* __linux */
56 -# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
57 +# define _glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
58 +#endif
60 +#if defined(GLEW_EGL)
61 +static GLboolean _EGL_available = GL_FALSE;
62 +static void (*glewGetProcAddress (const GLubyte *name)) (void)
64 + void (*addr)(void);
65 + if (_EGL_available)
66 + {
67 + addr = eglGetProcAddress((const char *)name);
68 + if (addr) return addr;
69 + }
70 + return _glewGetProcAddress(name);
72 +#else
73 +# define glewGetProcAddress(name) _glewGetProcAddress(name)
74 #endif
77 @@ -19297,9 +19312,7 @@
81 -#if defined(GLEW_OSMESA)
83 -#elif defined(GLEW_EGL)
84 +#if defined(GLEW_EGL)
86 PFNEGLCHOOSECONFIGPROC __eglewChooseConfig = NULL;
87 PFNEGLCOPYBUFFERSPROC __eglewCopyBuffers = NULL;
88 @@ -20490,8 +20503,8 @@
89 PFNEGLQUERYSTRINGPROC queryString = NULL;
91 /* Load necessary entry points */
92 - initialize = (PFNEGLINITIALIZEPROC) glewGetProcAddress("eglInitialize");
93 - queryString = (PFNEGLQUERYSTRINGPROC) glewGetProcAddress("eglQueryString");
94 + initialize = (PFNEGLINITIALIZEPROC) eglGetProcAddress("eglInitialize");
95 + queryString = (PFNEGLQUERYSTRINGPROC) eglGetProcAddress("eglQueryString");
96 if (!initialize || !queryString)
97 return 1;
99 @@ -21029,7 +21042,9 @@
100 return GLEW_OK;
103 -#elif defined(_WIN32)
104 +#endif
106 +#if defined(_WIN32)
108 PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL;
110 @@ -23105,13 +23120,26 @@
111 GLenum r;
112 #if defined(GLEW_EGL)
113 PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL;
114 + EGLDisplay display;
115 #endif
116 r = glewContextInit();
117 if ( r != 0 ) return r;
118 #if defined(GLEW_EGL)
119 - getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay");
120 - return eglewInit(getCurrentDisplay());
121 -#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
122 + getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) eglGetProcAddress("eglGetCurrentDisplay");
123 + if (getCurrentDisplay)
124 + display = getCurrentDisplay();
125 + else
126 + display = EGL_NO_DISPLAY;
127 + if (display != EGL_NO_DISPLAY)
129 + r = eglewInit(display);
130 + if ( r == 0 ) {
131 + _EGL_available = GL_TRUE;
132 + return r;
135 +#endif
136 +#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
137 return r;
138 #elif defined(_WIN32)
139 return wglewInit();
140 @@ -29785,7 +29813,7 @@
141 return ret;
144 -#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA)
145 +#if defined(_WIN32) && !defined(GLEW_OSMESA)
147 GLboolean GLEWAPIENTRY wglewIsSupported (const char* name)
149 @@ -30228,7 +30256,7 @@
150 return ret;
153 -#elif !defined(GLEW_OSMESA) && !defined(GLEW_EGL) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
154 +#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
156 GLboolean glxewIsSupported (const char* name)
158 @@ -30805,7 +30833,9 @@
159 return ret;
162 -#elif defined(GLEW_EGL)
163 +#endif
165 +#if defined(GLEW_EGL)
167 GLboolean eglewIsSupported (const char* name)