OSDN Git Service

f2bd0b78f959cc0e4868a106a618fd840386be55
[android-x86/external-swiftshader.git] / src / OpenGL / libGLES_CM / main.cpp
1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // main.cpp: DLL entry point and management of thread-local data.
16
17 #include "main.h"
18
19 #include "libGLES_CM.hpp"
20 #include "Framebuffer.h"
21 #include "common/Surface.hpp"
22 #include "Common/Thread.hpp"
23 #include "Common/SharedLibrary.hpp"
24 #include "common/debug.h"
25
26 #include <GLES/glext.h>
27
28 #if !defined(_MSC_VER)
29 #define CONSTRUCTOR __attribute__((constructor))
30 #define DESTRUCTOR __attribute__((destructor))
31 #else
32 #define CONSTRUCTOR
33 #define DESTRUCTOR
34 #endif
35
36 static void glAttachThread()
37 {
38         TRACE("()");
39 }
40
41 static void glDetachThread()
42 {
43         TRACE("()");
44 }
45
46 CONSTRUCTOR static void glAttachProcess()
47 {
48         TRACE("()");
49
50         glAttachThread();
51 }
52
53 DESTRUCTOR static void glDetachProcess()
54 {
55         TRACE("()");
56
57         glDetachThread();
58 }
59
60 #if defined(_WIN32)
61 extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
62 {
63         switch(reason)
64         {
65         case DLL_PROCESS_ATTACH:
66                 glAttachProcess();
67                 break;
68         case DLL_THREAD_ATTACH:
69                 glAttachThread();
70                 break;
71         case DLL_THREAD_DETACH:
72                 glDetachThread();
73                 break;
74         case DLL_PROCESS_DETACH:
75                 glDetachProcess();
76                 break;
77         default:
78                 break;
79         }
80
81         return TRUE;
82 }
83 #endif
84
85 namespace es1
86 {
87 es1::Context *getContext()
88 {
89         egl::Context *context = libEGL->clientGetCurrentContext();
90
91         if(context && context->getClientVersion() == 1)
92         {
93                 return static_cast<es1::Context*>(context);
94         }
95
96         return nullptr;
97 }
98
99 Device *getDevice()
100 {
101         Context *context = getContext();
102
103         return context ? context->getDevice() : nullptr;
104 }
105
106 // Records an error code
107 void error(GLenum errorCode)
108 {
109         es1::Context *context = es1::getContext();
110
111         if(context)
112         {
113                 switch(errorCode)
114                 {
115                 case GL_INVALID_ENUM:
116                         context->recordInvalidEnum();
117                         TRACE("\t! Error generated: invalid enum\n");
118                         break;
119                 case GL_INVALID_VALUE:
120                         context->recordInvalidValue();
121                         TRACE("\t! Error generated: invalid value\n");
122                         break;
123                 case GL_INVALID_OPERATION:
124                         context->recordInvalidOperation();
125                         TRACE("\t! Error generated: invalid operation\n");
126                         break;
127                 case GL_OUT_OF_MEMORY:
128                         context->recordOutOfMemory();
129                         TRACE("\t! Error generated: out of memory\n");
130                         break;
131                 case GL_INVALID_FRAMEBUFFER_OPERATION_OES:
132                         context->recordInvalidFramebufferOperation();
133                         TRACE("\t! Error generated: invalid framebuffer operation\n");
134                         break;
135                 case GL_STACK_OVERFLOW:
136                         context->recordMatrixStackOverflow();
137                         TRACE("\t! Error generated: matrix stack overflow\n");
138                         break;
139                 case GL_STACK_UNDERFLOW:
140                         context->recordMatrixStackUnderflow();
141                         TRACE("\t! Error generated: matrix stack underflow\n");
142                         break;
143                 default: UNREACHABLE(errorCode);
144                 }
145         }
146 }
147 }
148
149 namespace es1
150 {
151 void ActiveTexture(GLenum texture);
152 void AlphaFunc(GLenum func, GLclampf ref);
153 void AlphaFuncx(GLenum func, GLclampx ref);
154 void BindBuffer(GLenum target, GLuint buffer);
155 void BindFramebuffer(GLenum target, GLuint framebuffer);
156 void BindFramebufferOES(GLenum target, GLuint framebuffer);
157 void BindRenderbufferOES(GLenum target, GLuint renderbuffer);
158 void BindTexture(GLenum target, GLuint texture);
159 void BlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha);
160 void BlendEquationOES(GLenum mode);
161 void BlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha);
162 void BlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
163 void BlendFunc(GLenum sfactor, GLenum dfactor);
164 void BlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
165 void BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
166 void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
167 GLenum CheckFramebufferStatusOES(GLenum target);
168 void Clear(GLbitfield mask);
169 void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
170 void ClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
171 void ClearDepthf(GLclampf depth);
172 void ClearDepthx(GLclampx depth);
173 void ClearStencil(GLint s);
174 void ClientActiveTexture(GLenum texture);
175 void ClipPlanef(GLenum plane, const GLfloat *equation);
176 void ClipPlanex(GLenum plane, const GLfixed *equation);
177 void Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
178 void Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
179 void Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
180 void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
181 void ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
182 void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
183                           GLint border, GLsizei imageSize, const GLvoid* data);
184 void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
185                              GLenum format, GLsizei imageSize, const GLvoid* data);
186 void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
187 void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
188 void CullFace(GLenum mode);
189 void DeleteBuffers(GLsizei n, const GLuint* buffers);
190 void DeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers);
191 void DeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers);
192 void DeleteTextures(GLsizei n, const GLuint* textures);
193 void DepthFunc(GLenum func);
194 void DepthMask(GLboolean flag);
195 void DepthRangex(GLclampx zNear, GLclampx zFar);
196 void DepthRangef(GLclampf zNear, GLclampf zFar);
197 void Disable(GLenum cap);
198 void DisableClientState(GLenum array);
199 void DrawArrays(GLenum mode, GLint first, GLsizei count);
200 void DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
201 void Enable(GLenum cap);
202 void EnableClientState(GLenum array);
203 void Finish(void);
204 void Flush(void);
205 void FramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
206 void FramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
207 void Fogf(GLenum pname, GLfloat param);
208 void Fogfv(GLenum pname, const GLfloat *params);
209 void Fogx(GLenum pname, GLfixed param);
210 void Fogxv(GLenum pname, const GLfixed *params);
211 void FrontFace(GLenum mode);
212 void Frustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
213 void Frustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
214 void GenerateMipmapOES(GLenum target);
215 void GenBuffers(GLsizei n, GLuint* buffers);
216 void GenFramebuffersOES(GLsizei n, GLuint* framebuffers);
217 void GenRenderbuffersOES(GLsizei n, GLuint* renderbuffers);
218 void GenTextures(GLsizei n, GLuint* textures);
219 void GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params);
220 void GetBooleanv(GLenum pname, GLboolean* params);
221 void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
222 void GetClipPlanef(GLenum pname, GLfloat eqn[4]);
223 void GetClipPlanex(GLenum pname, GLfixed eqn[4]);
224 GLenum GetError(void);
225 void GetFixedv(GLenum pname, GLfixed *params);
226 void GetFloatv(GLenum pname, GLfloat* params);
227 void GetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params);
228 void GetIntegerv(GLenum pname, GLint* params);
229 void GetLightfv(GLenum light, GLenum pname, GLfloat *params);
230 void GetLightxv(GLenum light, GLenum pname, GLfixed *params);
231 void GetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
232 void GetMaterialxv(GLenum face, GLenum pname, GLfixed *params);
233 void GetPointerv(GLenum pname, GLvoid **params);
234 const GLubyte* GetString(GLenum name);
235 void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
236 void GetTexParameteriv(GLenum target, GLenum pname, GLint* params);
237 void GetTexEnvfv(GLenum env, GLenum pname, GLfloat *params);
238 void GetTexEnviv(GLenum env, GLenum pname, GLint *params);
239 void GetTexEnvxv(GLenum env, GLenum pname, GLfixed *params);
240 void GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params);
241 void Hint(GLenum target, GLenum mode);
242 GLboolean IsBuffer(GLuint buffer);
243 GLboolean IsEnabled(GLenum cap);
244 GLboolean IsFramebufferOES(GLuint framebuffer);
245 GLboolean IsTexture(GLuint texture);
246 GLboolean IsRenderbufferOES(GLuint renderbuffer);
247 void LightModelf(GLenum pname, GLfloat param);
248 void LightModelfv(GLenum pname, const GLfloat *params);
249 void LightModelx(GLenum pname, GLfixed param);
250 void LightModelxv(GLenum pname, const GLfixed *params);
251 void Lightf(GLenum light, GLenum pname, GLfloat param);
252 void Lightfv(GLenum light, GLenum pname, const GLfloat *params);
253 void Lightx(GLenum light, GLenum pname, GLfixed param);
254 void Lightxv(GLenum light, GLenum pname, const GLfixed *params);
255 void LineWidth(GLfloat width);
256 void LineWidthx(GLfixed width);
257 void LoadIdentity(void);
258 void LoadMatrixf(const GLfloat *m);
259 void LoadMatrixx(const GLfixed *m);
260 void LogicOp(GLenum opcode);
261 void Materialf(GLenum face, GLenum pname, GLfloat param);
262 void Materialfv(GLenum face, GLenum pname, const GLfloat *params);
263 void Materialx(GLenum face, GLenum pname, GLfixed param);
264 void Materialxv(GLenum face, GLenum pname, const GLfixed *params);
265 void MatrixMode(GLenum mode);
266 void MultMatrixf(const GLfloat *m);
267 void MultMatrixx(const GLfixed *m);
268 void MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
269 void MultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
270 void Normal3f(GLfloat nx, GLfloat ny, GLfloat nz);
271 void Normal3x(GLfixed nx, GLfixed ny, GLfixed nz);
272 void NormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer);
273 void Orthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
274 void Orthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
275 void PixelStorei(GLenum pname, GLint param);
276 void PointParameterf(GLenum pname, GLfloat param);
277 void PointParameterfv(GLenum pname, const GLfloat *params);
278 void PointParameterx(GLenum pname, GLfixed param);
279 void PointParameterxv(GLenum pname, const GLfixed *params);
280 void PointSize(GLfloat size);
281 void PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer);
282 void PointSizex(GLfixed size);
283 void PolygonOffset(GLfloat factor, GLfloat units);
284 void PolygonOffsetx(GLfixed factor, GLfixed units);
285 void PopMatrix(void);
286 void PushMatrix(void);
287 void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
288 void RenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
289 void Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
290 void Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
291 void SampleCoverage(GLclampf value, GLboolean invert);
292 void SampleCoveragex(GLclampx value, GLboolean invert);
293 void Scalef(GLfloat x, GLfloat y, GLfloat z);
294 void Scalex(GLfixed x, GLfixed y, GLfixed z);
295 void Scissor(GLint x, GLint y, GLsizei width, GLsizei height);
296 void ShadeModel(GLenum mode);
297 void StencilFunc(GLenum func, GLint ref, GLuint mask);
298 void StencilMask(GLuint mask);
299 void StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
300 void TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
301 void TexEnvf(GLenum target, GLenum pname, GLfloat param);
302 void TexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
303 void TexEnvi(GLenum target, GLenum pname, GLint param);
304 void TexEnvx(GLenum target, GLenum pname, GLfixed param);
305 void TexEnviv(GLenum target, GLenum pname, const GLint *params);
306 void TexEnvxv(GLenum target, GLenum pname, const GLfixed *params);
307 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
308                 GLint border, GLenum format, GLenum type, const GLvoid* pixels);
309 void TexParameterf(GLenum target, GLenum pname, GLfloat param);
310 void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
311 void TexParameteri(GLenum target, GLenum pname, GLint param);
312 void TexParameteriv(GLenum target, GLenum pname, const GLint* params);
313 void TexParameterx(GLenum target, GLenum pname, GLfixed param);
314 void TexParameterxv(GLenum target, GLenum pname, const GLfixed *params);
315 void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
316                    GLenum format, GLenum type, const GLvoid* pixels);
317 void Translatef(GLfloat x, GLfloat y, GLfloat z);
318 void Translatex(GLfixed x, GLfixed y, GLfixed z);
319 void VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
320 void Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
321 void EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
322 void EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
323 void DrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
324 void DrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height);
325 void DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
326 void DrawTexsvOES(const GLshort *coords);
327 void DrawTexivOES(const GLint *coords);
328 void DrawTexxvOES(const GLfixed *coords);
329 void DrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
330 void DrawTexfvOES(const GLfloat *coords);
331 }
332
333 egl::Context *es1CreateContext(egl::Display *display, const egl::Context *shareContext, const egl::Config *config);
334 extern "C" __eglMustCastToProperFunctionPointerType es1GetProcAddress(const char *procname);
335 egl::Image *createBackBuffer(int width, int height, sw::Format format, int multiSampleDepth);
336 egl::Image *createDepthStencil(int width, int height, sw::Format format, int multiSampleDepth);
337 sw::FrameBuffer *createFrameBuffer(void *nativeDisplay, EGLNativeWindowType window, int width, int height);
338
339 extern "C"
340 {
341 EGLAPI EGLint EGLAPIENTRY eglGetError(void)
342 {
343         return libEGL->eglGetError();
344 }
345
346 EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
347 {
348         return libEGL->eglGetDisplay(display_id);
349 }
350
351 EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
352 {
353         return libEGL->eglInitialize(dpy, major, minor);
354 }
355
356 EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
357 {
358         return libEGL->eglTerminate(dpy);
359 }
360
361 EGLAPI const char *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
362 {
363         return libEGL->eglQueryString(dpy, name);
364 }
365
366 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
367 {
368         return libEGL->eglGetConfigs(dpy, configs, config_size, num_config);
369 }
370
371 EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
372 {
373         return libEGL->eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
374 }
375
376 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
377 {
378         return libEGL->eglGetConfigAttrib(dpy, config, attribute, value);
379 }
380
381 EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list)
382 {
383         return libEGL->eglCreateWindowSurface(dpy, config, window, attrib_list);
384 }
385
386 EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
387 {
388         return libEGL->eglCreatePbufferSurface(dpy, config, attrib_list);
389 }
390
391 EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
392 {
393         return libEGL->eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
394 }
395
396 EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
397 {
398         return libEGL->eglDestroySurface(dpy, surface);
399 }
400
401 EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
402 {
403         return libEGL->eglQuerySurface(dpy, surface, attribute, value);
404 }
405
406 EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
407 {
408         return libEGL->eglBindAPI(api);
409 }
410
411 EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void)
412 {
413         return libEGL->eglQueryAPI();
414 }
415
416 EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void)
417 {
418         return libEGL->eglWaitClient();
419 }
420
421 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void)
422 {
423         return libEGL->eglReleaseThread();
424 }
425
426 EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
427 {
428         return libEGL->eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
429 }
430
431 EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
432 {
433         return libEGL->eglSurfaceAttrib(dpy, surface, attribute, value);
434 }
435
436 EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
437 {
438         return libEGL->eglBindTexImage(dpy, surface, buffer);
439 }
440
441 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
442 {
443         return libEGL->eglReleaseTexImage(dpy, surface, buffer);
444 }
445
446 EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
447 {
448         return libEGL->eglSwapInterval(dpy, interval);
449 }
450
451 EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
452 {
453         return libEGL->eglCreateContext(dpy, config, share_context, attrib_list);
454 }
455
456 EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
457 {
458         return libEGL->eglDestroyContext(dpy, ctx);
459 }
460
461 EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
462 {
463         return libEGL->eglMakeCurrent(dpy, draw, read, ctx);
464 }
465
466 EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void)
467 {
468         return libEGL->eglGetCurrentContext();
469 }
470
471 EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
472 {
473         return libEGL->eglGetCurrentSurface(readdraw);
474 }
475
476 EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
477 {
478         return libEGL->eglGetCurrentDisplay();
479 }
480
481 EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
482 {
483         return libEGL->eglQueryContext(dpy, ctx, attribute, value);
484 }
485
486 EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void)
487 {
488         return libEGL->eglWaitGL();
489 }
490
491 EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
492 {
493         return libEGL->eglWaitNative(engine);
494 }
495
496 EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
497 {
498         return libEGL->eglSwapBuffers(dpy, surface);
499 }
500
501 EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
502 {
503         return libEGL->eglCopyBuffers(dpy, surface, target);
504 }
505
506 EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
507 {
508         return libEGL->eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
509 }
510
511 EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
512 {
513         return libEGL->eglDestroyImageKHR(dpy, image);
514 }
515
516 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
517 {
518         return libEGL->eglGetProcAddress(procname);
519 }
520
521 EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
522 {
523         return libEGL->eglCreateSyncKHR(dpy, type, attrib_list);
524 }
525
526 EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
527 {
528         return libEGL->eglDestroySyncKHR(dpy, sync);
529 }
530
531 EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
532 {
533         return libEGL->eglClientWaitSyncKHR(dpy, sync, flags, timeout);
534 }
535
536 EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
537 {
538         return libEGL->eglGetSyncAttribKHR(dpy, sync, attribute, value);
539 }
540
541 GL_API void GL_APIENTRY glActiveTexture(GLenum texture)
542 {
543         return es1::ActiveTexture(texture);
544 }
545
546 GL_API void GL_APIENTRY glAlphaFunc(GLenum func, GLclampf ref)
547 {
548         return es1::AlphaFunc(func, ref);
549 }
550
551 GL_API void GL_APIENTRY glAlphaFuncx(GLenum func, GLclampx ref)
552 {
553         return es1::AlphaFuncx(func, ref);
554 }
555
556 GL_API void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
557 {
558         return es1::BindBuffer(target, buffer);
559 }
560
561 GL_API void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
562 {
563         return es1::BindFramebuffer(target, framebuffer);
564 }
565
566 GL_API void GL_APIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer)
567 {
568         return es1::BindFramebufferOES(target, framebuffer);
569 }
570
571 GL_API void GL_APIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
572 {
573         return es1::BindRenderbufferOES(target, renderbuffer);
574 }
575
576 GL_API void GL_APIENTRY glBindTexture(GLenum target, GLuint texture)
577 {
578         return es1::BindTexture(target, texture);
579 }
580
581 GL_API void GL_APIENTRY glBlendEquationOES(GLenum mode)
582 {
583         return es1::BlendEquationSeparateOES(mode, mode);
584 }
585
586 GL_API void GL_APIENTRY glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
587 {
588         return es1::BlendEquationSeparateOES(modeRGB, modeAlpha);
589 }
590
591 GL_API void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
592 {
593         return es1::BlendFuncSeparateOES(sfactor, dfactor, sfactor, dfactor);
594 }
595
596 GL_API void GL_APIENTRY glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
597 {
598         return es1::BlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
599 }
600
601 GL_API void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
602 {
603         return es1::BufferData(target, size, data, usage);
604 }
605
606 GL_API void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
607 {
608         return es1::BufferSubData(target, offset, size, data);
609 }
610
611 GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES(GLenum target)
612 {
613         return es1::CheckFramebufferStatusOES(target);
614 }
615
616 GL_API void GL_APIENTRY glClear(GLbitfield mask)
617 {
618         return es1::Clear(mask);
619 }
620
621 GL_API void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
622 {
623         return es1::ClearColor(red, green, blue, alpha);
624 }
625
626 GL_API void GL_APIENTRY glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
627 {
628         return es1::ClearColorx(red, green, blue, alpha);
629 }
630
631 GL_API void GL_APIENTRY glClearDepthf(GLclampf depth)
632 {
633         return es1::ClearDepthf(depth);
634 }
635
636 GL_API void GL_APIENTRY glClearDepthx(GLclampx depth)
637 {
638         return es1::ClearDepthx(depth);
639 }
640
641 GL_API void GL_APIENTRY glClearStencil(GLint s)
642 {
643         return es1::ClearStencil(s);
644 }
645
646 GL_API void GL_APIENTRY glClientActiveTexture(GLenum texture)
647 {
648         return es1::ClientActiveTexture(texture);
649 }
650
651 GL_API void GL_APIENTRY glClipPlanef(GLenum plane, const GLfloat *equation)
652 {
653         return es1::ClipPlanef(plane, equation);
654 }
655
656 GL_API void GL_APIENTRY glClipPlanex(GLenum plane, const GLfixed *equation)
657 {
658         return es1::ClipPlanex(plane, equation);
659 }
660
661 GL_API void GL_APIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
662 {
663         return es1::Color4f(red, green, blue, alpha);
664 }
665
666 GL_API void GL_APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
667 {
668         return es1::Color4ub(red, green, blue, alpha);
669 }
670
671 GL_API void GL_APIENTRY glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
672 {
673         return es1::Color4x(red, green, blue, alpha);
674 }
675
676 GL_API void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
677 {
678         return es1::ColorMask(red, green, blue, alpha);
679 }
680
681 GL_API void GL_APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
682 {
683         return es1::ColorPointer(size, type, stride, pointer);
684 }
685
686 GL_API void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
687                                                GLint border, GLsizei imageSize, const GLvoid* data)
688 {
689         return es1::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
690 }
691
692 GL_API void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
693                                                   GLenum format, GLsizei imageSize, const GLvoid* data)
694 {
695         return es1::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
696 }
697
698 GL_API void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
699 {
700         return es1::CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
701 }
702
703 GL_API void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
704 {
705         return es1::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
706 }
707
708 GL_API void GL_APIENTRY glCullFace(GLenum mode)
709 {
710         return es1::CullFace(mode);
711 }
712
713 GL_API void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers)
714 {
715         return es1::DeleteBuffers(n, buffers);
716 }
717
718 GL_API void GL_APIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
719 {
720         return es1::DeleteFramebuffersOES(n, framebuffers);
721 }
722
723 GL_API void GL_APIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
724 {
725         return es1::DeleteRenderbuffersOES(n, renderbuffers);
726 }
727
728 GL_API void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures)
729 {
730         return es1::DeleteTextures(n, textures);
731 }
732
733 GL_API void GL_APIENTRY glDepthFunc(GLenum func)
734 {
735         return es1::DepthFunc(func);
736 }
737
738 GL_API void GL_APIENTRY glDepthMask(GLboolean flag)
739 {
740         return es1::DepthMask(flag);
741 }
742
743 GL_API void GL_APIENTRY glDepthRangex(GLclampx zNear, GLclampx zFar)
744 {
745         return es1::DepthRangex(zNear, zFar);
746 }
747
748 GL_API void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar)
749 {
750         return es1::DepthRangef(zNear, zFar);
751 }
752
753 GL_API void GL_APIENTRY glDisable(GLenum cap)
754 {
755         return es1::Disable(cap);
756 }
757
758 GL_API void GL_APIENTRY glDisableClientState(GLenum array)
759 {
760         return es1::DisableClientState(array);
761 }
762
763 GL_API void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
764 {
765         return es1::DrawArrays(mode, first, count);
766 }
767
768 GL_API void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
769 {
770         return es1::DrawElements(mode, count, type, indices);
771 }
772
773 GL_API void GL_APIENTRY glEnable(GLenum cap)
774 {
775         return es1::Enable(cap);
776 }
777
778 GL_API void GL_APIENTRY glEnableClientState(GLenum array)
779 {
780         return es1::EnableClientState(array);
781 }
782
783 GL_API void GL_APIENTRY glFinish(void)
784 {
785         return es1::Finish();
786 }
787
788 GL_API void GL_APIENTRY glFlush(void)
789 {
790         return es1::Flush();
791 }
792
793 GL_API void GL_APIENTRY glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
794 {
795         return es1::FramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
796 }
797
798 GL_API void GL_APIENTRY glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
799 {
800         return es1::FramebufferTexture2DOES(target, attachment, textarget, texture, level);
801 }
802
803 GL_API void GL_APIENTRY glFogf(GLenum pname, GLfloat param)
804 {
805         return es1::Fogf(pname, param);
806 }
807
808 GL_API void GL_APIENTRY glFogfv(GLenum pname, const GLfloat *params)
809 {
810         return es1::Fogfv(pname, params);
811 }
812
813 GL_API void GL_APIENTRY glFogx(GLenum pname, GLfixed param)
814 {
815         return es1::Fogx(pname, param);
816 }
817
818 GL_API void GL_APIENTRY glFogxv(GLenum pname, const GLfixed *params)
819 {
820         return es1::Fogxv(pname, params);
821 }
822
823 GL_API void GL_APIENTRY glFrontFace(GLenum mode)
824 {
825         return es1::FrontFace(mode);
826 }
827
828 GL_API void GL_APIENTRY glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
829 {
830         return es1::Frustumf(left, right, bottom, top, zNear, zFar);
831 }
832
833 GL_API void GL_APIENTRY glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
834 {
835         return es1::Frustumx(left, right, bottom, top, zNear, zFar);
836 }
837
838 GL_API void GL_APIENTRY glGenerateMipmapOES(GLenum target)
839 {
840         return es1::GenerateMipmapOES(target);
841 }
842
843 GL_API void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers)
844 {
845         return es1::GenBuffers(n, buffers);
846 }
847
848 GL_API void GL_APIENTRY glGenFramebuffersOES(GLsizei n, GLuint* framebuffers)
849 {
850         return es1::GenFramebuffersOES(n, framebuffers);
851 }
852
853 GL_API void GL_APIENTRY glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
854 {
855         return es1::GenRenderbuffersOES(n, renderbuffers);
856 }
857
858 GL_API void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures)
859 {
860         return es1::GenTextures(n, textures);
861 }
862
863 GL_API void GL_APIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
864 {
865         return es1::GetRenderbufferParameterivOES(target, pname, params);
866 }
867
868 GL_API void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params)
869 {
870         return es1::GetBooleanv(pname, params);
871 }
872
873 GL_API void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
874 {
875         return es1::GetBufferParameteriv(target, pname, params);
876 }
877
878 GL_API void GL_APIENTRY glGetClipPlanef(GLenum pname, GLfloat eqn[4])
879 {
880         return es1::GetClipPlanef(pname, eqn);
881 }
882
883 GL_API void GL_APIENTRY glGetClipPlanex(GLenum pname, GLfixed eqn[4])
884 {
885         return es1::GetClipPlanex(pname, eqn);
886 }
887
888 GL_API GLenum GL_APIENTRY glGetError(void)
889 {
890         return es1::GetError();
891 }
892
893 GL_API void GL_APIENTRY glGetFixedv(GLenum pname, GLfixed *params)
894 {
895         return es1::GetFixedv(pname, params);
896 }
897
898 GL_API void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params)
899 {
900         return es1::GetFloatv(pname, params);
901 }
902
903 GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params)
904 {
905         return es1::GetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
906 }
907
908 GL_API void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params)
909 {
910         return es1::GetIntegerv(pname, params);
911 }
912
913 GL_API void GL_APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
914 {
915         return es1::GetLightfv(light, pname, params);
916 }
917
918 GL_API void GL_APIENTRY glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
919 {
920         return es1::GetLightxv(light, pname, params);
921 }
922
923 GL_API void GL_APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
924 {
925         return es1::GetMaterialfv(face, pname, params);
926 }
927
928 GL_API void GL_APIENTRY glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
929 {
930         return es1::GetMaterialxv(face, pname, params);
931 }
932
933 GL_API void GL_APIENTRY glGetPointerv(GLenum pname, GLvoid **params)
934 {
935         return es1::GetPointerv(pname, params);
936 }
937
938 GL_API const GLubyte* GL_APIENTRY glGetString(GLenum name)
939 {
940         return es1::GetString(name);
941 }
942
943 GL_API void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
944 {
945         return es1::GetTexParameterfv(target, pname, params);
946 }
947
948 GL_API void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
949 {
950         return es1::GetTexParameteriv(target, pname, params);
951 }
952
953 GL_API void GL_APIENTRY glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
954 {
955         return es1::GetTexEnvfv(env, pname, params);
956 }
957
958 GL_API void GL_APIENTRY glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
959 {
960         return es1::GetTexEnviv(env, pname, params);
961 }
962
963 GL_API void GL_APIENTRY glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params)
964 {
965         return es1::GetTexEnvxv(env, pname, params);
966 }
967
968 GL_API void GL_APIENTRY glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
969 {
970         return es1::GetTexParameterxv(target, pname, params);
971 }
972
973 GL_API void GL_APIENTRY glHint(GLenum target, GLenum mode)
974 {
975         return es1::Hint(target, mode);
976 }
977
978 GL_API GLboolean GL_APIENTRY glIsBuffer(GLuint buffer)
979 {
980         return es1::IsBuffer(buffer);
981 }
982
983 GL_API GLboolean GL_APIENTRY glIsEnabled(GLenum cap)
984 {
985         return es1::IsEnabled(cap);
986 }
987
988 GL_API GLboolean GL_APIENTRY glIsFramebufferOES(GLuint framebuffer)
989 {
990         return es1::IsFramebufferOES(framebuffer);
991 }
992
993 GL_API GLboolean GL_APIENTRY glIsTexture(GLuint texture)
994 {
995         return es1::IsTexture(texture);
996 }
997
998 GL_API GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer)
999 {
1000         return es1::IsRenderbufferOES(renderbuffer);
1001 }
1002
1003 GL_API void GL_APIENTRY glLightModelf(GLenum pname, GLfloat param)
1004 {
1005         return es1::LightModelf(pname, param);
1006 }
1007
1008 GL_API void GL_APIENTRY glLightModelfv(GLenum pname, const GLfloat *params)
1009 {
1010         return es1::LightModelfv(pname, params);
1011 }
1012
1013 GL_API void GL_APIENTRY glLightModelx(GLenum pname, GLfixed param)
1014 {
1015         return es1::LightModelx(pname, param);
1016 }
1017
1018 GL_API void GL_APIENTRY glLightModelxv(GLenum pname, const GLfixed *params)
1019 {
1020         return es1::LightModelxv(pname, params);
1021 }
1022
1023 GL_API void GL_APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param)
1024 {
1025         return es1::Lightf(light, pname, param);
1026 }
1027
1028 GL_API void GL_APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
1029 {
1030         return es1::Lightfv(light, pname, params);
1031 }
1032
1033 GL_API void GL_APIENTRY glLightx(GLenum light, GLenum pname, GLfixed param)
1034 {
1035         return es1::Lightx(light, pname, param);
1036 }
1037
1038 GL_API void GL_APIENTRY glLightxv(GLenum light, GLenum pname, const GLfixed *params)
1039 {
1040         return es1::Lightxv(light, pname, params);
1041 }
1042
1043 GL_API void GL_APIENTRY glLineWidth(GLfloat width)
1044 {
1045         return es1::LineWidth(width);
1046 }
1047
1048 GL_API void GL_APIENTRY glLineWidthx(GLfixed width)
1049 {
1050         return es1::LineWidthx(width);
1051 }
1052
1053 GL_API void GL_APIENTRY glLoadIdentity(void)
1054 {
1055         return es1::LoadIdentity();
1056 }
1057
1058 GL_API void GL_APIENTRY glLoadMatrixf(const GLfloat *m)
1059 {
1060         return es1::LoadMatrixf(m);
1061 }
1062
1063 GL_API void GL_APIENTRY glLoadMatrixx(const GLfixed *m)
1064 {
1065         return es1::LoadMatrixx(m);
1066 }
1067
1068 GL_API void GL_APIENTRY glLogicOp(GLenum opcode)
1069 {
1070         return es1::LogicOp(opcode);
1071 }
1072
1073 GL_API void GL_APIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param)
1074 {
1075         return es1::Materialf(face, pname, param);
1076 }
1077
1078 GL_API void GL_APIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
1079 {
1080         return es1::Materialfv(face, pname, params);
1081 }
1082
1083 GL_API void GL_APIENTRY glMaterialx(GLenum face, GLenum pname, GLfixed param)
1084 {
1085         return es1::Materialx(face, pname, param);
1086 }
1087
1088 GL_API void GL_APIENTRY glMaterialxv(GLenum face, GLenum pname, const GLfixed *params)
1089 {
1090         return es1::Materialxv(face, pname, params);
1091 }
1092
1093 GL_API void GL_APIENTRY glMatrixMode(GLenum mode)
1094 {
1095         return es1::MatrixMode(mode);
1096 }
1097
1098 GL_API void GL_APIENTRY glMultMatrixf(const GLfloat *m)
1099 {
1100         return es1::MultMatrixf(m);
1101 }
1102
1103 GL_API void GL_APIENTRY glMultMatrixx(const GLfixed *m)
1104 {
1105         return es1::MultMatrixx(m);
1106 }
1107
1108 GL_API void GL_APIENTRY glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
1109 {
1110         return es1::MultiTexCoord4f(target, s, t, r, q);
1111 }
1112
1113 GL_API void GL_APIENTRY glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
1114 {
1115         return es1::MultiTexCoord4x(target, s, t, r, q);
1116 }
1117
1118 GL_API void GL_APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
1119 {
1120         return es1::Normal3f(nx, ny, nz);
1121 }
1122
1123 GL_API void GL_APIENTRY glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
1124 {
1125         return es1::Normal3x(nx, ny, nz);
1126 }
1127
1128 GL_API void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
1129 {
1130         return es1::NormalPointer(type, stride, pointer);
1131 }
1132
1133 GL_API void GL_APIENTRY glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
1134 {
1135         return es1::Orthof(left, right, bottom, top, zNear, zFar);
1136 }
1137
1138 GL_API void GL_APIENTRY glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
1139 {
1140         return es1::Orthox(left, right, bottom, top, zNear, zFar);
1141 }
1142
1143 GL_API void GL_APIENTRY glPixelStorei(GLenum pname, GLint param)
1144 {
1145         return es1::PixelStorei(pname, param);
1146 }
1147
1148 GL_API void GL_APIENTRY glPointParameterf(GLenum pname, GLfloat param)
1149 {
1150         return es1::PointParameterf(pname, param);
1151 }
1152
1153 GL_API void GL_APIENTRY glPointParameterfv(GLenum pname, const GLfloat *params)
1154 {
1155         return es1::PointParameterfv(pname, params);
1156 }
1157
1158 GL_API void GL_APIENTRY glPointParameterx(GLenum pname, GLfixed param)
1159 {
1160         return es1::PointParameterx(pname, param);
1161 }
1162
1163 GL_API void GL_APIENTRY glPointParameterxv(GLenum pname, const GLfixed *params)
1164 {
1165         return es1::PointParameterxv(pname, params);
1166 }
1167
1168 GL_API void GL_APIENTRY glPointSize(GLfloat size)
1169 {
1170         return es1::PointSize(size);
1171 }
1172
1173 GL_API void GL_APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer)
1174 {
1175         return es1::PointSizePointerOES(type, stride, pointer);
1176 }
1177
1178 GL_API void GL_APIENTRY glPointSizex(GLfixed size)
1179 {
1180         return es1::PointSizex(size);
1181 }
1182
1183 GL_API void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
1184 {
1185         return es1::PolygonOffset(factor, units);
1186 }
1187
1188 GL_API void GL_APIENTRY glPolygonOffsetx(GLfixed factor, GLfixed units)
1189 {
1190         return es1::PolygonOffsetx(factor, units);
1191 }
1192
1193 GL_API void GL_APIENTRY glPopMatrix(void)
1194 {
1195         return es1::PopMatrix();
1196 }
1197
1198 GL_API void GL_APIENTRY glPushMatrix(void)
1199 {
1200         return es1::PushMatrix();
1201 }
1202
1203 GL_API void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
1204 {
1205         return es1::ReadPixels(x, y, width, height, format, type, pixels);
1206 }
1207
1208 GL_API void GL_APIENTRY glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
1209 {
1210         return es1::RenderbufferStorageOES(target, internalformat, width, height);
1211 }
1212
1213 GL_API void GL_APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1214 {
1215         return es1::Rotatef(angle, x, y, z);
1216 }
1217
1218 GL_API void GL_APIENTRY glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1219 {
1220         return es1::Rotatex(angle, x, y, z);
1221 }
1222
1223 GL_API void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert)
1224 {
1225         return es1::SampleCoverage(value, invert);
1226 }
1227
1228 GL_API void GL_APIENTRY glSampleCoveragex(GLclampx value, GLboolean invert)
1229 {
1230         return es1::SampleCoveragex(value, invert);
1231 }
1232
1233 GL_API void GL_APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
1234 {
1235         return es1::Scalef(x, y, z);
1236 }
1237
1238 GL_API void GL_APIENTRY glScalex(GLfixed x, GLfixed y, GLfixed z)
1239 {
1240         return es1::Scalex(x, y, z);
1241 }
1242
1243 GL_API void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
1244 {
1245         return es1::Scissor(x, y, width, height);
1246 }
1247
1248 GL_API void GL_APIENTRY glShadeModel(GLenum mode)
1249 {
1250         return es1::ShadeModel(mode);
1251 }
1252
1253 GL_API void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
1254 {
1255         return es1::StencilFunc(func, ref, mask);
1256 }
1257
1258 GL_API void GL_APIENTRY glStencilMask(GLuint mask)
1259 {
1260         return es1::StencilMask(mask);
1261 }
1262
1263 GL_API void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
1264 {
1265         return es1::StencilOp(fail, zfail, zpass);
1266 }
1267
1268 GL_API void GL_APIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
1269 {
1270         return es1::TexCoordPointer(size, type, stride, pointer);
1271 }
1272
1273 GL_API void GL_APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param)
1274 {
1275         return es1::TexEnvf(target, pname, param);
1276 }
1277
1278 GL_API void GL_APIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
1279 {
1280         return es1::TexEnvfv(target, pname, params);
1281 }
1282
1283 GL_API void GL_APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param)
1284 {
1285         return es1::TexEnvi(target, pname, param);
1286 }
1287
1288 GL_API void GL_APIENTRY glTexEnvx(GLenum target, GLenum pname, GLfixed param)
1289 {
1290         return es1::TexEnvx(target, pname, param);
1291 }
1292
1293 GL_API void GL_APIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params)
1294 {
1295         return es1::TexEnviv(target, pname, params);
1296 }
1297
1298 GL_API void GL_APIENTRY glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
1299 {
1300         return es1::TexEnvxv(target, pname, params);
1301 }
1302
1303 GL_API void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
1304                                      GLint border, GLenum format, GLenum type, const GLvoid* pixels)
1305 {
1306         return es1::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
1307 }
1308
1309 GL_API void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
1310 {
1311         return es1::TexParameterf(target, pname, param);
1312 }
1313
1314 GL_API void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
1315 {
1316         return es1::TexParameterfv(target, pname, params);
1317 }
1318
1319 GL_API void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
1320 {
1321         return es1::TexParameteri(target, pname, param);
1322 }
1323
1324 GL_API void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
1325 {
1326         return es1::TexParameteriv(target, pname, params);
1327 }
1328
1329 GL_API void GL_APIENTRY glTexParameterx(GLenum target, GLenum pname, GLfixed param)
1330 {
1331         return es1::TexParameterx(target, pname, param);
1332 }
1333
1334 GL_API void GL_APIENTRY glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
1335 {
1336         return es1::TexParameterxv(target, pname, params);
1337 }
1338
1339 GL_API void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
1340                                         GLenum format, GLenum type, const GLvoid* pixels)
1341 {
1342         return es1::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1343 }
1344
1345 GL_API void GL_APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
1346 {
1347         return es1::Translatef(x, y, z);
1348 }
1349
1350 GL_API void GL_APIENTRY glTranslatex(GLfixed x, GLfixed y, GLfixed z)
1351 {
1352         return es1::Translatex(x, y, z);
1353 }
1354
1355 GL_API void GL_APIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
1356 {
1357         return es1::VertexPointer(size, type, stride, pointer);
1358 }
1359
1360 GL_API void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1361 {
1362         return es1::Viewport(x, y, width, height);
1363 }
1364
1365 GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
1366 {
1367         return es1::EGLImageTargetTexture2DOES(target, image);
1368 }
1369
1370 GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
1371 {
1372         return es1::EGLImageTargetRenderbufferStorageOES(target, image);
1373 }
1374
1375 GL_API void GL_APIENTRY glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
1376 {
1377         return es1::DrawTexsOES(x,y, z, width, height);
1378 }
1379
1380 GL_API void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
1381 {
1382         return es1::DrawTexiOES(x,y, z, width, height);
1383 }
1384
1385 GL_API void GL_APIENTRY glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
1386 {
1387         return es1::DrawTexxOES(x,y, z, width, height);
1388 }
1389
1390 GL_API void GL_APIENTRY glDrawTexsvOES(const GLshort *coords)
1391 {
1392         return es1::DrawTexsvOES(coords);
1393 }
1394
1395 GL_API void GL_APIENTRY glDrawTexivOES(const GLint *coords)
1396 {
1397         return es1::DrawTexivOES(coords);
1398 }
1399
1400 GL_API void GL_APIENTRY glDrawTexxvOES(const GLfixed *coords)
1401 {
1402         return es1::DrawTexxvOES(coords);
1403 }
1404
1405 GL_API void GL_APIENTRY glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
1406 {
1407         return es1::DrawTexfOES(x, y, z, width, height);
1408 }
1409
1410 GL_API void GL_APIENTRY glDrawTexfvOES(const GLfloat *coords)
1411 {
1412         return es1::DrawTexfvOES(coords);
1413 }
1414
1415 void GL_APIENTRY Register(const char *licenseKey)
1416 {
1417         // Nothing to do, SwiftShader is open-source
1418 }
1419 }
1420
1421 LibGLES_CMexports::LibGLES_CMexports()
1422 {
1423         this->glActiveTexture = es1::ActiveTexture;
1424         this->glAlphaFunc = es1::AlphaFunc;
1425         this->glAlphaFuncx = es1::AlphaFuncx;
1426         this->glBindBuffer = es1::BindBuffer;
1427         this->glBindFramebuffer = es1::BindFramebuffer;
1428         this->glBindFramebufferOES = es1::BindFramebufferOES;
1429         this->glBindRenderbufferOES = es1::BindRenderbufferOES;
1430         this->glBindTexture = es1::BindTexture;
1431         this->glBlendEquationSeparateOES = es1::BlendEquationSeparateOES;
1432         this->glBlendEquationOES = es1::BlendEquationOES;
1433         this->glBlendEquationSeparateOES = es1::BlendEquationSeparateOES;
1434         this->glBlendFuncSeparateOES = es1::BlendFuncSeparateOES;
1435         this->glBlendFunc = es1::BlendFunc;
1436         this->glBlendFuncSeparateOES = es1::BlendFuncSeparateOES;
1437         this->glBufferData = es1::BufferData;
1438         this->glBufferSubData = es1::BufferSubData;
1439         this->glCheckFramebufferStatusOES = es1::CheckFramebufferStatusOES;
1440         this->glClear = es1::Clear;
1441         this->glClearColor = es1::ClearColor;
1442         this->glClearColorx = es1::ClearColorx;
1443         this->glClearDepthf = es1::ClearDepthf;
1444         this->glClearDepthx = es1::ClearDepthx;
1445         this->glClearStencil = es1::ClearStencil;
1446         this->glClientActiveTexture = es1::ClientActiveTexture;
1447         this->glClipPlanef = es1::ClipPlanef;
1448         this->glClipPlanex = es1::ClipPlanex;
1449         this->glColor4f = es1::Color4f;
1450         this->glColor4ub = es1::Color4ub;
1451         this->glColor4x = es1::Color4x;
1452         this->glColorMask = es1::ColorMask;
1453         this->glColorPointer = es1::ColorPointer;
1454         this->glCompressedTexImage2D = es1::CompressedTexImage2D;
1455         this->glCompressedTexSubImage2D = es1::CompressedTexSubImage2D;
1456         this->glCopyTexImage2D = es1::CopyTexImage2D;
1457         this->glCopyTexSubImage2D = es1::CopyTexSubImage2D;
1458         this->glCullFace = es1::CullFace;
1459         this->glDeleteBuffers = es1::DeleteBuffers;
1460         this->glDeleteFramebuffersOES = es1::DeleteFramebuffersOES;
1461         this->glDeleteRenderbuffersOES = es1::DeleteRenderbuffersOES;
1462         this->glDeleteTextures = es1::DeleteTextures;
1463         this->glDepthFunc = es1::DepthFunc;
1464         this->glDepthMask = es1::DepthMask;
1465         this->glDepthRangex = es1::DepthRangex;
1466         this->glDepthRangef = es1::DepthRangef;
1467         this->glDisable = es1::Disable;
1468         this->glDisableClientState = es1::DisableClientState;
1469         this->glDrawArrays = es1::DrawArrays;
1470         this->glDrawElements = es1::DrawElements;
1471         this->glEnable = es1::Enable;
1472         this->glEnableClientState = es1::EnableClientState;
1473         this->glFinish = es1::Finish;
1474         this->glFlush = es1::Flush;
1475         this->glFramebufferRenderbufferOES = es1::FramebufferRenderbufferOES;
1476         this->glFramebufferTexture2DOES = es1::FramebufferTexture2DOES;
1477         this->glFogf = es1::Fogf;
1478         this->glFogfv = es1::Fogfv;
1479         this->glFogx = es1::Fogx;
1480         this->glFogxv = es1::Fogxv;
1481         this->glFrontFace = es1::FrontFace;
1482         this->glFrustumf = es1::Frustumf;
1483         this->glFrustumx = es1::Frustumx;
1484         this->glGenerateMipmapOES = es1::GenerateMipmapOES;
1485         this->glGenBuffers = es1::GenBuffers;
1486         this->glGenFramebuffersOES = es1::GenFramebuffersOES;
1487         this->glGenRenderbuffersOES = es1::GenRenderbuffersOES;
1488         this->glGenTextures = es1::GenTextures;
1489         this->glGetRenderbufferParameterivOES = es1::GetRenderbufferParameterivOES;
1490         this->glGetBooleanv = es1::GetBooleanv;
1491         this->glGetBufferParameteriv = es1::GetBufferParameteriv;
1492         this->glGetClipPlanef = es1::GetClipPlanef;
1493         this->glGetClipPlanex = es1::GetClipPlanex;
1494         this->glGetError = es1::GetError;
1495         this->glGetFixedv = es1::GetFixedv;
1496         this->glGetFloatv = es1::GetFloatv;
1497         this->glGetFramebufferAttachmentParameterivOES = es1::GetFramebufferAttachmentParameterivOES;
1498         this->glGetIntegerv = es1::GetIntegerv;
1499         this->glGetLightfv = es1::GetLightfv;
1500         this->glGetLightxv = es1::GetLightxv;
1501         this->glGetMaterialfv = es1::GetMaterialfv;
1502         this->glGetMaterialxv = es1::GetMaterialxv;
1503         this->glGetPointerv = es1::GetPointerv;
1504         this->glGetString = es1::GetString;
1505         this->glGetTexParameterfv = es1::GetTexParameterfv;
1506         this->glGetTexParameteriv = es1::GetTexParameteriv;
1507         this->glGetTexEnvfv = es1::GetTexEnvfv;
1508         this->glGetTexEnviv = es1::GetTexEnviv;
1509         this->glGetTexEnvxv = es1::GetTexEnvxv;
1510         this->glGetTexParameterxv = es1::GetTexParameterxv;
1511         this->glHint = es1::Hint;
1512         this->glIsBuffer = es1::IsBuffer;
1513         this->glIsEnabled = es1::IsEnabled;
1514         this->glIsFramebufferOES = es1::IsFramebufferOES;
1515         this->glIsTexture = es1::IsTexture;
1516         this->glIsRenderbufferOES = es1::IsRenderbufferOES;
1517         this->glLightModelf = es1::LightModelf;
1518         this->glLightModelfv = es1::LightModelfv;
1519         this->glLightModelx = es1::LightModelx;
1520         this->glLightModelxv = es1::LightModelxv;
1521         this->glLightf = es1::Lightf;
1522         this->glLightfv = es1::Lightfv;
1523         this->glLightx = es1::Lightx;
1524         this->glLightxv = es1::Lightxv;
1525         this->glLineWidth = es1::LineWidth;
1526         this->glLineWidthx = es1::LineWidthx;
1527         this->glLoadIdentity = es1::LoadIdentity;
1528         this->glLoadMatrixf = es1::LoadMatrixf;
1529         this->glLoadMatrixx = es1::LoadMatrixx;
1530         this->glLogicOp = es1::LogicOp;
1531         this->glMaterialf = es1::Materialf;
1532         this->glMaterialfv = es1::Materialfv;
1533         this->glMaterialx = es1::Materialx;
1534         this->glMaterialxv = es1::Materialxv;
1535         this->glMatrixMode = es1::MatrixMode;
1536         this->glMultMatrixf = es1::MultMatrixf;
1537         this->glMultMatrixx = es1::MultMatrixx;
1538         this->glMultiTexCoord4f = es1::MultiTexCoord4f;
1539         this->glMultiTexCoord4x = es1::MultiTexCoord4x;
1540         this->glNormal3f = es1::Normal3f;
1541         this->glNormal3x = es1::Normal3x;
1542         this->glNormalPointer = es1::NormalPointer;
1543         this->glOrthof = es1::Orthof;
1544         this->glOrthox = es1::Orthox;
1545         this->glPixelStorei = es1::PixelStorei;
1546         this->glPointParameterf = es1::PointParameterf;
1547         this->glPointParameterfv = es1::PointParameterfv;
1548         this->glPointParameterx = es1::PointParameterx;
1549         this->glPointParameterxv = es1::PointParameterxv;
1550         this->glPointSize = es1::PointSize;
1551         this->glPointSizePointerOES = es1::PointSizePointerOES;
1552         this->glPointSizex = es1::PointSizex;
1553         this->glPolygonOffset = es1::PolygonOffset;
1554         this->glPolygonOffsetx = es1::PolygonOffsetx;
1555         this->glPopMatrix = es1::PopMatrix;
1556         this->glPushMatrix = es1::PushMatrix;
1557         this->glReadPixels = es1::ReadPixels;
1558         this->glRenderbufferStorageOES = es1::RenderbufferStorageOES;
1559         this->glRotatef = es1::Rotatef;
1560         this->glRotatex = es1::Rotatex;
1561         this->glSampleCoverage = es1::SampleCoverage;
1562         this->glSampleCoveragex = es1::SampleCoveragex;
1563         this->glScalef = es1::Scalef;
1564         this->glScalex = es1::Scalex;
1565         this->glScissor = es1::Scissor;
1566         this->glShadeModel = es1::ShadeModel;
1567         this->glStencilFunc = es1::StencilFunc;
1568         this->glStencilMask = es1::StencilMask;
1569         this->glStencilOp = es1::StencilOp;
1570         this->glTexCoordPointer = es1::TexCoordPointer;
1571         this->glTexEnvf = es1::TexEnvf;
1572         this->glTexEnvfv = es1::TexEnvfv;
1573         this->glTexEnvi = es1::TexEnvi;
1574         this->glTexEnvx = es1::TexEnvx;
1575         this->glTexEnviv = es1::TexEnviv;
1576         this->glTexEnvxv = es1::TexEnvxv;
1577         this->glTexImage2D = es1::TexImage2D;
1578         this->glTexParameterf = es1::TexParameterf;
1579         this->glTexParameterfv = es1::TexParameterfv;
1580         this->glTexParameteri = es1::TexParameteri;
1581         this->glTexParameteriv = es1::TexParameteriv;
1582         this->glTexParameterx = es1::TexParameterx;
1583         this->glTexParameterxv = es1::TexParameterxv;
1584         this->glTexSubImage2D = es1::TexSubImage2D;
1585         this->glTranslatef = es1::Translatef;
1586         this->glTranslatex = es1::Translatex;
1587         this->glVertexPointer = es1::VertexPointer;
1588         this->glViewport = es1::Viewport;
1589         this->glEGLImageTargetTexture2DOES = es1::EGLImageTargetTexture2DOES;
1590         this->glEGLImageTargetRenderbufferStorageOES = es1::EGLImageTargetRenderbufferStorageOES;
1591         this->glDrawTexsOES = es1::DrawTexsOES;
1592         this->glDrawTexiOES = es1::DrawTexiOES;
1593         this->glDrawTexxOES = es1::DrawTexxOES;
1594         this->glDrawTexsvOES = es1::DrawTexsvOES;
1595         this->glDrawTexivOES = es1::DrawTexivOES;
1596         this->glDrawTexxvOES = es1::DrawTexxvOES;
1597         this->glDrawTexfOES = es1::DrawTexfOES;
1598         this->glDrawTexfvOES = es1::DrawTexfvOES;
1599
1600         this->es1CreateContext = ::es1CreateContext;
1601         this->es1GetProcAddress = ::es1GetProcAddress;
1602         this->createBackBuffer = ::createBackBuffer;
1603         this->createDepthStencil = ::createDepthStencil;
1604         this->createFrameBuffer = ::createFrameBuffer;
1605 }
1606
1607 extern "C" GL_API LibGLES_CMexports *libGLES_CM_swiftshader()
1608 {
1609         static LibGLES_CMexports libGLES_CM;
1610         return &libGLES_CM;
1611 }
1612
1613 LibEGL libEGL;