| 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 | #ifndef libGLES_CM_hpp | 
|---|
| 16 | #define libGLES_CM_hpp | 
|---|
| 17 |  | 
|---|
| 18 | #include <GLES/gl.h> | 
|---|
| 19 | #include <GLES/glext.h> | 
|---|
| 20 | #include <EGL/egl.h> | 
|---|
| 21 |  | 
|---|
| 22 | #include "Common/SharedLibrary.hpp" | 
|---|
| 23 |  | 
|---|
| 24 | namespace sw | 
|---|
| 25 | { | 
|---|
| 26 | class FrameBuffer; | 
|---|
| 27 | enum Format : unsigned char; | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | namespace egl | 
|---|
| 31 | { | 
|---|
| 32 | class Display; | 
|---|
| 33 | class Context; | 
|---|
| 34 | class Image; | 
|---|
| 35 | class Config; | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | class LibGLES_CMexports | 
|---|
| 39 | { | 
|---|
| 40 | public: | 
|---|
| 41 | LibGLES_CMexports(); | 
|---|
| 42 |  | 
|---|
| 43 | void (GL_APIENTRY *glActiveTexture)(GLenum texture); | 
|---|
| 44 | void (GL_APIENTRY *glAlphaFunc)(GLenum func, GLclampf ref); | 
|---|
| 45 | void (GL_APIENTRY *glAlphaFuncx)(GLenum func, GLclampx ref); | 
|---|
| 46 | void (GL_APIENTRY *glBindBuffer)(GLenum target, GLuint buffer); | 
|---|
| 47 | void (GL_APIENTRY *glBindFramebuffer)(GLenum target, GLuint framebuffer); | 
|---|
| 48 | void (GL_APIENTRY *glBindFramebufferOES)(GLenum target, GLuint framebuffer); | 
|---|
| 49 | void (GL_APIENTRY *glBindRenderbufferOES)(GLenum target, GLuint renderbuffer); | 
|---|
| 50 | void (GL_APIENTRY *glBindTexture)(GLenum target, GLuint texture); | 
|---|
| 51 | void (GL_APIENTRY *glBlendEquationOES)(GLenum mode); | 
|---|
| 52 | void (GL_APIENTRY *glBlendEquationSeparateOES)(GLenum modeRGB, GLenum modeAlpha); | 
|---|
| 53 | void (GL_APIENTRY *glBlendFunc)(GLenum sfactor, GLenum dfactor); | 
|---|
| 54 | void (GL_APIENTRY *glBlendFuncSeparateOES)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); | 
|---|
| 55 | void (GL_APIENTRY *glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); | 
|---|
| 56 | void (GL_APIENTRY *glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); | 
|---|
| 57 | GLenum (GL_APIENTRY *glCheckFramebufferStatusOES)(GLenum target); | 
|---|
| 58 | void (GL_APIENTRY *glClear)(GLbitfield mask); | 
|---|
| 59 | void (GL_APIENTRY *glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); | 
|---|
| 60 | void (GL_APIENTRY *glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); | 
|---|
| 61 | void (GL_APIENTRY *glClearDepthf)(GLclampf depth); | 
|---|
| 62 | void (GL_APIENTRY *glClearDepthx)(GLclampx depth); | 
|---|
| 63 | void (GL_APIENTRY *glClearStencil)(GLint s); | 
|---|
| 64 | void (GL_APIENTRY *glClientActiveTexture)(GLenum texture); | 
|---|
| 65 | void (GL_APIENTRY *glClipPlanef)(GLenum plane, const GLfloat *equation); | 
|---|
| 66 | void (GL_APIENTRY *glClipPlanex)(GLenum plane, const GLfixed *equation); | 
|---|
| 67 | void (GL_APIENTRY *glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); | 
|---|
| 68 | void (GL_APIENTRY *glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); | 
|---|
| 69 | void (GL_APIENTRY *glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); | 
|---|
| 70 | void (GL_APIENTRY *glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); | 
|---|
| 71 | void (GL_APIENTRY *glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); | 
|---|
| 72 | void (GL_APIENTRY *glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, | 
|---|
| 73 | GLint border, GLsizei imageSize, const GLvoid* data); | 
|---|
| 74 | void (GL_APIENTRY *glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, | 
|---|
| 75 | GLenum format, GLsizei imageSize, const GLvoid* data); | 
|---|
| 76 | void (GL_APIENTRY *glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); | 
|---|
| 77 | void (GL_APIENTRY *glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); | 
|---|
| 78 | void (GL_APIENTRY *glCullFace)(GLenum mode); | 
|---|
| 79 | void (GL_APIENTRY *glDeleteBuffers)(GLsizei n, const GLuint* buffers); | 
|---|
| 80 | void (GL_APIENTRY *glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers); | 
|---|
| 81 | void (GL_APIENTRY *glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers); | 
|---|
| 82 | void (GL_APIENTRY *glDeleteTextures)(GLsizei n, const GLuint* textures); | 
|---|
| 83 | void (GL_APIENTRY *glDepthFunc)(GLenum func); | 
|---|
| 84 | void (GL_APIENTRY *glDepthMask)(GLboolean flag); | 
|---|
| 85 | void (GL_APIENTRY *glDepthRangex)(GLclampx zNear, GLclampx zFar); | 
|---|
| 86 | void (GL_APIENTRY *glDepthRangef)(GLclampf zNear, GLclampf zFar); | 
|---|
| 87 | void (GL_APIENTRY *glDisable)(GLenum cap); | 
|---|
| 88 | void (GL_APIENTRY *glDisableClientState)(GLenum array); | 
|---|
| 89 | void (GL_APIENTRY *glDrawArrays)(GLenum mode, GLint first, GLsizei count); | 
|---|
| 90 | void (GL_APIENTRY *glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); | 
|---|
| 91 | void (GL_APIENTRY *glEnable)(GLenum cap); | 
|---|
| 92 | void (GL_APIENTRY *glEnableClientState)(GLenum array); | 
|---|
| 93 | void (GL_APIENTRY *glFinish)(void); | 
|---|
| 94 | void (GL_APIENTRY *glFlush)(void); | 
|---|
| 95 | void (GL_APIENTRY *glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); | 
|---|
| 96 | void (GL_APIENTRY *glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); | 
|---|
| 97 | void (GL_APIENTRY *glFogf)(GLenum pname, GLfloat param); | 
|---|
| 98 | void (GL_APIENTRY *glFogfv)(GLenum pname, const GLfloat *params); | 
|---|
| 99 | void (GL_APIENTRY *glFogx)(GLenum pname, GLfixed param); | 
|---|
| 100 | void (GL_APIENTRY *glFogxv)(GLenum pname, const GLfixed *params); | 
|---|
| 101 | void (GL_APIENTRY *glFrontFace)(GLenum mode); | 
|---|
| 102 | void (GL_APIENTRY *glFrustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); | 
|---|
| 103 | void (GL_APIENTRY *glFrustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); | 
|---|
| 104 | void (GL_APIENTRY *glGenerateMipmapOES)(GLenum target); | 
|---|
| 105 | void (GL_APIENTRY *glGenBuffers)(GLsizei n, GLuint* buffers); | 
|---|
| 106 | void (GL_APIENTRY *glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers); | 
|---|
| 107 | void (GL_APIENTRY *glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers); | 
|---|
| 108 | void (GL_APIENTRY *glGenTextures)(GLsizei n, GLuint* textures); | 
|---|
| 109 | void (GL_APIENTRY *glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params); | 
|---|
| 110 | void (GL_APIENTRY *glGetBooleanv)(GLenum pname, GLboolean* params); | 
|---|
| 111 | void (GL_APIENTRY *glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); | 
|---|
| 112 | void (GL_APIENTRY *glGetClipPlanef)(GLenum pname, GLfloat eqn[4]); | 
|---|
| 113 | void (GL_APIENTRY *glGetClipPlanex)(GLenum pname, GLfixed eqn[4]); | 
|---|
| 114 | GLenum (GL_APIENTRY *glGetError)(void); | 
|---|
| 115 | void (GL_APIENTRY *glGetFixedv)(GLenum pname, GLfixed *params); | 
|---|
| 116 | void (GL_APIENTRY *glGetFloatv)(GLenum pname, GLfloat* params); | 
|---|
| 117 | void (GL_APIENTRY *glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params); | 
|---|
| 118 | void (GL_APIENTRY *glGetIntegerv)(GLenum pname, GLint* params); | 
|---|
| 119 | void (GL_APIENTRY *glGetLightfv)(GLenum light, GLenum pname, GLfloat *params); | 
|---|
| 120 | void (GL_APIENTRY *glGetLightxv)(GLenum light, GLenum pname, GLfixed *params); | 
|---|
| 121 | void (GL_APIENTRY *glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params); | 
|---|
| 122 | void (GL_APIENTRY *glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params); | 
|---|
| 123 | void (GL_APIENTRY *glGetPointerv)(GLenum pname, GLvoid **params); | 
|---|
| 124 | const GLubyte* (GL_APIENTRY *glGetString)(GLenum name); | 
|---|
| 125 | void (GL_APIENTRY *glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); | 
|---|
| 126 | void (GL_APIENTRY *glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params); | 
|---|
| 127 | void (GL_APIENTRY *glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params); | 
|---|
| 128 | void (GL_APIENTRY *glGetTexEnviv)(GLenum env, GLenum pname, GLint *params); | 
|---|
| 129 | void (GL_APIENTRY *glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params); | 
|---|
| 130 | void (GL_APIENTRY *glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params); | 
|---|
| 131 | void (GL_APIENTRY *glHint)(GLenum target, GLenum mode); | 
|---|
| 132 | GLboolean (GL_APIENTRY *glIsBuffer)(GLuint buffer); | 
|---|
| 133 | GLboolean (GL_APIENTRY *glIsEnabled)(GLenum cap); | 
|---|
| 134 | GLboolean (GL_APIENTRY *glIsFramebufferOES)(GLuint framebuffer); | 
|---|
| 135 | GLboolean (GL_APIENTRY *glIsTexture)(GLuint texture); | 
|---|
| 136 | GLboolean (GL_APIENTRY *glIsRenderbufferOES)(GLuint renderbuffer); | 
|---|
| 137 | void (GL_APIENTRY *glLightModelf)(GLenum pname, GLfloat param); | 
|---|
| 138 | void (GL_APIENTRY *glLightModelfv)(GLenum pname, const GLfloat *params); | 
|---|
| 139 | void (GL_APIENTRY *glLightModelx)(GLenum pname, GLfixed param); | 
|---|
| 140 | void (GL_APIENTRY *glLightModelxv)(GLenum pname, const GLfixed *params); | 
|---|
| 141 | void (GL_APIENTRY *glLightf)(GLenum light, GLenum pname, GLfloat param); | 
|---|
| 142 | void (GL_APIENTRY *glLightfv)(GLenum light, GLenum pname, const GLfloat *params); | 
|---|
| 143 | void (GL_APIENTRY *glLightx)(GLenum light, GLenum pname, GLfixed param); | 
|---|
| 144 | void (GL_APIENTRY *glLightxv)(GLenum light, GLenum pname, const GLfixed *params); | 
|---|
| 145 | void (GL_APIENTRY *glLineWidth)(GLfloat width); | 
|---|
| 146 | void (GL_APIENTRY *glLineWidthx)(GLfixed width); | 
|---|
| 147 | void (GL_APIENTRY *glLoadIdentity)(void); | 
|---|
| 148 | void (GL_APIENTRY *glLoadMatrixf)(const GLfloat *m); | 
|---|
| 149 | void (GL_APIENTRY *glLoadMatrixx)(const GLfixed *m); | 
|---|
| 150 | void (GL_APIENTRY *glLogicOp)(GLenum opcode); | 
|---|
| 151 | void (GL_APIENTRY *glMaterialf)(GLenum face, GLenum pname, GLfloat param); | 
|---|
| 152 | void (GL_APIENTRY *glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params); | 
|---|
| 153 | void (GL_APIENTRY *glMaterialx)(GLenum face, GLenum pname, GLfixed param); | 
|---|
| 154 | void (GL_APIENTRY *glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params); | 
|---|
| 155 | void (GL_APIENTRY *glMatrixMode)(GLenum mode); | 
|---|
| 156 | void (GL_APIENTRY *glMultMatrixf)(const GLfloat *m); | 
|---|
| 157 | void (GL_APIENTRY *glMultMatrixx)(const GLfixed *m); | 
|---|
| 158 | void (GL_APIENTRY *glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); | 
|---|
| 159 | void (GL_APIENTRY *glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); | 
|---|
| 160 | void (GL_APIENTRY *glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz); | 
|---|
| 161 | void (GL_APIENTRY *glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz); | 
|---|
| 162 | void (GL_APIENTRY *glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); | 
|---|
| 163 | void (GL_APIENTRY *glOrthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); | 
|---|
| 164 | void (GL_APIENTRY *glOrthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); | 
|---|
| 165 | void (GL_APIENTRY *glPixelStorei)(GLenum pname, GLint param); | 
|---|
| 166 | void (GL_APIENTRY *glPointParameterf)(GLenum pname, GLfloat param); | 
|---|
| 167 | void (GL_APIENTRY *glPointParameterfv)(GLenum pname, const GLfloat *params); | 
|---|
| 168 | void (GL_APIENTRY *glPointParameterx)(GLenum pname, GLfixed param); | 
|---|
| 169 | void (GL_APIENTRY *glPointParameterxv)(GLenum pname, const GLfixed *params); | 
|---|
| 170 | void (GL_APIENTRY *glPointSize)(GLfloat size); | 
|---|
| 171 | void (GL_APIENTRY *glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer); | 
|---|
| 172 | void (GL_APIENTRY *glPointSizex)(GLfixed size); | 
|---|
| 173 | void (GL_APIENTRY *glPolygonOffset)(GLfloat factor, GLfloat units); | 
|---|
| 174 | void (GL_APIENTRY *glPolygonOffsetx)(GLfixed factor, GLfixed units); | 
|---|
| 175 | void (GL_APIENTRY *glPopMatrix)(void); | 
|---|
| 176 | void (GL_APIENTRY *glPushMatrix)(void); | 
|---|
| 177 | void (GL_APIENTRY *glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); | 
|---|
| 178 | void (GL_APIENTRY *glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); | 
|---|
| 179 | void (GL_APIENTRY *glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); | 
|---|
| 180 | void (GL_APIENTRY *glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); | 
|---|
| 181 | void (GL_APIENTRY *glSampleCoverage)(GLclampf value, GLboolean invert); | 
|---|
| 182 | void (GL_APIENTRY *glSampleCoveragex)(GLclampx value, GLboolean invert); | 
|---|
| 183 | void (GL_APIENTRY *glScalef)(GLfloat x, GLfloat y, GLfloat z); | 
|---|
| 184 | void (GL_APIENTRY *glScalex)(GLfixed x, GLfixed y, GLfixed z); | 
|---|
| 185 | void (GL_APIENTRY *glScissor)(GLint x, GLint y, GLsizei width, GLsizei height); | 
|---|
| 186 | void (GL_APIENTRY *glShadeModel)(GLenum mode); | 
|---|
| 187 | void (GL_APIENTRY *glStencilFunc)(GLenum func, GLint ref, GLuint mask); | 
|---|
| 188 | void (GL_APIENTRY *glStencilMask)(GLuint mask); | 
|---|
| 189 | void (GL_APIENTRY *glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); | 
|---|
| 190 | void (GL_APIENTRY *glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); | 
|---|
| 191 | void (GL_APIENTRY *glTexEnvf)(GLenum target, GLenum pname, GLfloat param); | 
|---|
| 192 | void (GL_APIENTRY *glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params); | 
|---|
| 193 | void (GL_APIENTRY *glTexEnvi)(GLenum target, GLenum pname, GLint param); | 
|---|
| 194 | void (GL_APIENTRY *glTexEnvx)(GLenum target, GLenum pname, GLfixed param); | 
|---|
| 195 | void (GL_APIENTRY *glTexEnviv)(GLenum target, GLenum pname, const GLint *params); | 
|---|
| 196 | void (GL_APIENTRY *glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params); | 
|---|
| 197 | void (GL_APIENTRY *glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, | 
|---|
| 198 | GLint border, GLenum format, GLenum type, const GLvoid* pixels); | 
|---|
| 199 | void (GL_APIENTRY *glTexParameterf)(GLenum target, GLenum pname, GLfloat param); | 
|---|
| 200 | void (GL_APIENTRY *glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); | 
|---|
| 201 | void (GL_APIENTRY *glTexParameteri)(GLenum target, GLenum pname, GLint param); | 
|---|
| 202 | void (GL_APIENTRY *glTexParameteriv)(GLenum target, GLenum pname, const GLint* params); | 
|---|
| 203 | void (GL_APIENTRY *glTexParameterx)(GLenum target, GLenum pname, GLfixed param); | 
|---|
| 204 | void (GL_APIENTRY *glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params); | 
|---|
| 205 | void (GL_APIENTRY *glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, | 
|---|
| 206 | GLenum format, GLenum type, const GLvoid* pixels); | 
|---|
| 207 | void (GL_APIENTRY *glTranslatef)(GLfloat x, GLfloat y, GLfloat z); | 
|---|
| 208 | void (GL_APIENTRY *glTranslatex)(GLfixed x, GLfixed y, GLfixed z); | 
|---|
| 209 | void (GL_APIENTRY *glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); | 
|---|
| 210 | void (GL_APIENTRY *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height); | 
|---|
| 211 | void (GL_APIENTRY *glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image); | 
|---|
| 212 | void (GL_APIENTRY *glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image); | 
|---|
| 213 | void (GL_APIENTRY *glDrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); | 
|---|
| 214 | void (GL_APIENTRY *glDrawTexiOES)(GLint x, GLint y, GLint z, GLint width, GLint height); | 
|---|
| 215 | void (GL_APIENTRY *glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); | 
|---|
| 216 | void (GL_APIENTRY *glDrawTexsvOES)(const GLshort *coords); | 
|---|
| 217 | void (GL_APIENTRY *glDrawTexivOES)(const GLint *coords); | 
|---|
| 218 | void (GL_APIENTRY *glDrawTexxvOES)(const GLfixed *coords); | 
|---|
| 219 | void (GL_APIENTRY *glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); | 
|---|
| 220 | void (GL_APIENTRY *glDrawTexfvOES)(const GLfloat *coords); | 
|---|
| 221 |  | 
|---|
| 222 | egl::Context *(*es1CreateContext)(egl::Display *display, const egl::Context *shareContext, const egl::Config *config); | 
|---|
| 223 | __eglMustCastToProperFunctionPointerType (*es1GetProcAddress)(const char *procname); | 
|---|
| 224 | egl::Image *(*createBackBuffer)(int width, int height, sw::Format format, int multiSampleDepth); | 
|---|
| 225 | egl::Image *(*createDepthStencil)(int width, int height, sw::Format format, int multiSampleDepth); | 
|---|
| 226 | sw::FrameBuffer *(*createFrameBuffer)(void *nativeDisplay, EGLNativeWindowType window, int width, int height); | 
|---|
| 227 | }; | 
|---|
| 228 |  | 
|---|
| 229 | class LibGLES_CM | 
|---|
| 230 | { | 
|---|
| 231 | public: | 
|---|
| 232 | LibGLES_CM() | 
|---|
| 233 | { | 
|---|
| 234 | } | 
|---|
| 235 |  | 
|---|
| 236 | ~LibGLES_CM() | 
|---|
| 237 | { | 
|---|
| 238 | freeLibrary(libGLES_CM); | 
|---|
| 239 | } | 
|---|
| 240 |  | 
|---|
| 241 | operator bool() | 
|---|
| 242 | { | 
|---|
| 243 | return loadExports() != nullptr; | 
|---|
| 244 | } | 
|---|
| 245 |  | 
|---|
| 246 | LibGLES_CMexports *operator->() | 
|---|
| 247 | { | 
|---|
| 248 | return loadExports(); | 
|---|
| 249 | } | 
|---|
| 250 |  | 
|---|
| 251 | private: | 
|---|
| 252 | LibGLES_CMexports *loadExports() | 
|---|
| 253 | { | 
|---|
| 254 | if(!loadLibraryAttempted && !libGLES_CM) | 
|---|
| 255 | { | 
|---|
| 256 | #if defined(_WIN32) | 
|---|
| 257 | #if defined(__LP64__) | 
|---|
| 258 | const char *libGLES_CM_lib[] = { "libGLES_CM.dll", "lib64GLES_CM_translator.dll"}; | 
|---|
| 259 | #else | 
|---|
| 260 | const char *libGLES_CM_lib[] = { "libGLES_CM.dll", "libGLES_CM_translator.dll"}; | 
|---|
| 261 | #endif | 
|---|
| 262 | #elif defined(__ANDROID__) | 
|---|
| 263 | const char *libGLES_CM_lib[] = { "libGLESv1_CM_swiftshader.so", "libGLESv1_CM_swiftshader.so"}; | 
|---|
| 264 | #elif defined(__linux__) | 
|---|
| 265 | #if defined(__LP64__) | 
|---|
| 266 | const char *libGLES_CM_lib[] = { "lib64GLES_CM_translator.so", "libGLES_CM.so.1", "libGLES_CM.so"}; | 
|---|
| 267 | #else | 
|---|
| 268 | const char *libGLES_CM_lib[] = { "libGLES_CM_translator.so", "libGLES_CM.so.1", "libGLES_CM.so"}; | 
|---|
| 269 | #endif | 
|---|
| 270 | #elif defined(__APPLE__) | 
|---|
| 271 | #if defined(__LP64__) | 
|---|
| 272 | const char *libGLES_CM_lib[] = { "lib64GLES_CM_translator.dylib", "libGLES_CM.dylib"}; | 
|---|
| 273 | #else | 
|---|
| 274 | const char *libGLES_CM_lib[] = { "libGLES_CM_translator.dylib", "libGLES_CM.dylib"}; | 
|---|
| 275 | #endif | 
|---|
| 276 | #elif defined(__Fuchsia__) | 
|---|
| 277 | const char *libGLES_CM_lib[] = { "libGLES_CM.so"}; | 
|---|
| 278 | #else | 
|---|
| 279 | #error "libGLES_CM::loadExports unimplemented for this platform" | 
|---|
| 280 | #endif | 
|---|
| 281 |  | 
|---|
| 282 | std::string directory = getModuleDirectory(); | 
|---|
| 283 | libGLES_CM = loadLibrary(directory, libGLES_CM_lib, "libGLES_CM_swiftshader"); | 
|---|
| 284 |  | 
|---|
| 285 | if(libGLES_CM) | 
|---|
| 286 | { | 
|---|
| 287 | auto libGLES_CM_swiftshader = (LibGLES_CMexports *(*)())getProcAddress(libGLES_CM, "libGLES_CM_swiftshader"); | 
|---|
| 288 | libGLES_CMexports = libGLES_CM_swiftshader(); | 
|---|
| 289 | } | 
|---|
| 290 |  | 
|---|
| 291 | loadLibraryAttempted = true; | 
|---|
| 292 | } | 
|---|
| 293 |  | 
|---|
| 294 | return libGLES_CMexports; | 
|---|
| 295 | } | 
|---|
| 296 |  | 
|---|
| 297 | void *libGLES_CM = nullptr; | 
|---|
| 298 | LibGLES_CMexports *libGLES_CMexports = nullptr; | 
|---|
| 299 | bool loadLibraryAttempted = false; | 
|---|
| 300 | }; | 
|---|
| 301 |  | 
|---|
| 302 | #endif   // libGLES_CM_hpp | 
|---|
| 303 |  | 
|---|