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 libGLESv2_hpp |
16 | #define libGLESv2_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 | class ClientBuffer; |
37 | } |
38 | |
39 | class LibGLESv2exports |
40 | { |
41 | public: |
42 | LibGLESv2exports(); |
43 | |
44 | void (GL_APIENTRY *glActiveTexture)(GLenum texture); |
45 | void (GL_APIENTRY *glAttachShader)(GLuint program, GLuint shader); |
46 | void (GL_APIENTRY *glBeginQueryEXT)(GLenum target, GLuint name); |
47 | void (GL_APIENTRY *glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name); |
48 | void (GL_APIENTRY *glBindBuffer)(GLenum target, GLuint buffer); |
49 | void (GL_APIENTRY *glBindFramebuffer)(GLenum target, GLuint framebuffer); |
50 | void (GL_APIENTRY *glBindRenderbuffer)(GLenum target, GLuint renderbuffer); |
51 | void (GL_APIENTRY *glBindTexture)(GLenum target, GLuint texture); |
52 | void (GL_APIENTRY *glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
53 | void (GL_APIENTRY *glBlendEquation)(GLenum mode); |
54 | void (GL_APIENTRY *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); |
55 | void (GL_APIENTRY *glBlendFunc)(GLenum sfactor, GLenum dfactor); |
56 | void (GL_APIENTRY *glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); |
57 | void (GL_APIENTRY *glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); |
58 | void (GL_APIENTRY *glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); |
59 | GLenum (GL_APIENTRY *glCheckFramebufferStatus)(GLenum target); |
60 | void (GL_APIENTRY *glClear)(GLbitfield mask); |
61 | void (GL_APIENTRY *glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
62 | void (GL_APIENTRY *glClearDepthf)(GLclampf depth); |
63 | void (GL_APIENTRY *glClearStencil)(GLint s); |
64 | void (GL_APIENTRY *glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); |
65 | void (GL_APIENTRY *glCompileShader)(GLuint shader); |
66 | void (GL_APIENTRY *glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, |
67 | GLint border, GLsizei imageSize, const GLvoid* data); |
68 | void (GL_APIENTRY *glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
69 | GLenum format, GLsizei imageSize, const GLvoid* data); |
70 | void (GL_APIENTRY *glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); |
71 | void (GL_APIENTRY *glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
72 | GLuint (GL_APIENTRY *glCreateProgram)(void); |
73 | GLuint (GL_APIENTRY *glCreateShader)(GLenum type); |
74 | void (GL_APIENTRY *glCullFace)(GLenum mode); |
75 | void (GL_APIENTRY *glDeleteBuffers)(GLsizei n, const GLuint* buffers); |
76 | void (GL_APIENTRY *glDeleteFencesNV)(GLsizei n, const GLuint* fences); |
77 | void (GL_APIENTRY *glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); |
78 | void (GL_APIENTRY *glDeleteProgram)(GLuint program); |
79 | void (GL_APIENTRY *glDeleteQueriesEXT)(GLsizei n, const GLuint *ids); |
80 | void (GL_APIENTRY *glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); |
81 | void (GL_APIENTRY *glDeleteShader)(GLuint shader); |
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 *glDepthRangef)(GLclampf zNear, GLclampf zFar); |
86 | void (GL_APIENTRY *glDetachShader)(GLuint program, GLuint shader); |
87 | void (GL_APIENTRY *glDisable)(GLenum cap); |
88 | void (GL_APIENTRY *glDisableVertexAttribArray)(GLuint index); |
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 *glDrawArraysInstancedEXT)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); |
92 | void (GL_APIENTRY *glDrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount); |
93 | void (GL_APIENTRY *glVertexAttribDivisorEXT)(GLuint index, GLuint divisor); |
94 | void (GL_APIENTRY *glDrawArraysInstancedANGLE)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); |
95 | void (GL_APIENTRY *glDrawElementsInstancedANGLE)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount); |
96 | void (GL_APIENTRY *glVertexAttribDivisorANGLE)(GLuint index, GLuint divisor); |
97 | void (GL_APIENTRY *glEnable)(GLenum cap); |
98 | void (GL_APIENTRY *glEnableVertexAttribArray)(GLuint index); |
99 | void (GL_APIENTRY *glEndQueryEXT)(GLenum target); |
100 | void (GL_APIENTRY *glFinishFenceNV)(GLuint fence); |
101 | void (GL_APIENTRY *glFinish)(void); |
102 | void (GL_APIENTRY *glFlush)(void); |
103 | void (GL_APIENTRY *glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); |
104 | void (GL_APIENTRY *glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); |
105 | void (GL_APIENTRY *glFrontFace)(GLenum mode); |
106 | void (GL_APIENTRY *glGenBuffers)(GLsizei n, GLuint* buffers); |
107 | void (GL_APIENTRY *glGenerateMipmap)(GLenum target); |
108 | void (GL_APIENTRY *glGenFencesNV)(GLsizei n, GLuint* fences); |
109 | void (GL_APIENTRY *glGenFramebuffers)(GLsizei n, GLuint* framebuffers); |
110 | void (GL_APIENTRY *glGenQueriesEXT)(GLsizei n, GLuint* ids); |
111 | void (GL_APIENTRY *glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers); |
112 | void (GL_APIENTRY *glGenTextures)(GLsizei n, GLuint* textures); |
113 | void (GL_APIENTRY *glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); |
114 | void (GL_APIENTRY *glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); |
115 | void (GL_APIENTRY *glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); |
116 | int (GL_APIENTRY *glGetAttribLocation)(GLuint program, const GLchar* name); |
117 | void (GL_APIENTRY *glGetBooleanv)(GLenum pname, GLboolean* params); |
118 | void (GL_APIENTRY *glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); |
119 | GLenum (GL_APIENTRY *glGetError)(void); |
120 | void (GL_APIENTRY *glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params); |
121 | void (GL_APIENTRY *glGetFloatv)(GLenum pname, GLfloat* params); |
122 | void (GL_APIENTRY *glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); |
123 | GLenum (GL_APIENTRY *glGetGraphicsResetStatusEXT)(void); |
124 | void (GL_APIENTRY *glGetIntegerv)(GLenum pname, GLint* params); |
125 | void (GL_APIENTRY *glGetProgramiv)(GLuint program, GLenum pname, GLint* params); |
126 | void (GL_APIENTRY *glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); |
127 | void (GL_APIENTRY *glGetQueryivEXT)(GLenum target, GLenum pname, GLint *params); |
128 | void (GL_APIENTRY *glGetQueryObjectuivEXT)(GLuint name, GLenum pname, GLuint *params); |
129 | void (GL_APIENTRY *glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); |
130 | void (GL_APIENTRY *glGetShaderiv)(GLuint shader, GLenum pname, GLint* params); |
131 | void (GL_APIENTRY *glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); |
132 | void (GL_APIENTRY *glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); |
133 | void (GL_APIENTRY *glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); |
134 | const GLubyte* (GL_APIENTRY *glGetString)(GLenum name); |
135 | void (GL_APIENTRY *glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); |
136 | void (GL_APIENTRY *glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params); |
137 | void (GL_APIENTRY *glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, GLfloat* params); |
138 | void (GL_APIENTRY *glGetUniformfv)(GLuint program, GLint location, GLfloat* params); |
139 | void (GL_APIENTRY *glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint* params); |
140 | void (GL_APIENTRY *glGetUniformiv)(GLuint program, GLint location, GLint* params); |
141 | int (GL_APIENTRY *glGetUniformLocation)(GLuint program, const GLchar* name); |
142 | void (GL_APIENTRY *glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); |
143 | void (GL_APIENTRY *glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); |
144 | void (GL_APIENTRY *glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer); |
145 | void (GL_APIENTRY *glHint)(GLenum target, GLenum mode); |
146 | GLboolean (GL_APIENTRY *glIsBuffer)(GLuint buffer); |
147 | GLboolean (GL_APIENTRY *glIsEnabled)(GLenum cap); |
148 | GLboolean (GL_APIENTRY *glIsFenceNV)(GLuint fence); |
149 | GLboolean (GL_APIENTRY *glIsFramebuffer)(GLuint framebuffer); |
150 | GLboolean (GL_APIENTRY *glIsProgram)(GLuint program); |
151 | GLboolean (GL_APIENTRY *glIsQueryEXT)(GLuint name); |
152 | GLboolean (GL_APIENTRY *glIsRenderbuffer)(GLuint renderbuffer); |
153 | GLboolean (GL_APIENTRY *glIsShader)(GLuint shader); |
154 | GLboolean (GL_APIENTRY *glIsTexture)(GLuint texture); |
155 | void (GL_APIENTRY *glLineWidth)(GLfloat width); |
156 | void (GL_APIENTRY *glLinkProgram)(GLuint program); |
157 | void (GL_APIENTRY *glPixelStorei)(GLenum pname, GLint param); |
158 | void (GL_APIENTRY *glPolygonOffset)(GLfloat factor, GLfloat units); |
159 | void (GL_APIENTRY *glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, |
160 | GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); |
161 | void (GL_APIENTRY *glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); |
162 | void (GL_APIENTRY *glReleaseShaderCompiler)(void); |
163 | void (GL_APIENTRY *glRenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); |
164 | void (GL_APIENTRY *glRenderbufferStorageMultisampleANGLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); |
165 | void (GL_APIENTRY *glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); |
166 | void (GL_APIENTRY *glSampleCoverage)(GLclampf value, GLboolean invert); |
167 | void (GL_APIENTRY *glSetFenceNV)(GLuint fence, GLenum condition); |
168 | void (GL_APIENTRY *glScissor)(GLint x, GLint y, GLsizei width, GLsizei height); |
169 | void (GL_APIENTRY *glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); |
170 | void (GL_APIENTRY *glShaderSource)(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length); |
171 | void (GL_APIENTRY *glStencilFunc)(GLenum func, GLint ref, GLuint mask); |
172 | void (GL_APIENTRY *glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); |
173 | void (GL_APIENTRY *glStencilMask)(GLuint mask); |
174 | void (GL_APIENTRY *glStencilMaskSeparate)(GLenum face, GLuint mask); |
175 | void (GL_APIENTRY *glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); |
176 | void (GL_APIENTRY *glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); |
177 | GLboolean (GL_APIENTRY *glTestFenceNV)(GLuint fence); |
178 | void (GL_APIENTRY *glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, |
179 | GLint border, GLenum format, GLenum type, const GLvoid* pixels); |
180 | void (GL_APIENTRY *glTexParameterf)(GLenum target, GLenum pname, GLfloat param); |
181 | void (GL_APIENTRY *glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); |
182 | void (GL_APIENTRY *glTexParameteri)(GLenum target, GLenum pname, GLint param); |
183 | void (GL_APIENTRY *glTexParameteriv)(GLenum target, GLenum pname, const GLint* params); |
184 | void (GL_APIENTRY *glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
185 | GLenum format, GLenum type, const GLvoid* pixels); |
186 | void (GL_APIENTRY *glUniform1f)(GLint location, GLfloat x); |
187 | void (GL_APIENTRY *glUniform1fv)(GLint location, GLsizei count, const GLfloat* v); |
188 | void (GL_APIENTRY *glUniform1i)(GLint location, GLint x); |
189 | void (GL_APIENTRY *glUniform1iv)(GLint location, GLsizei count, const GLint* v); |
190 | void (GL_APIENTRY *glUniform2f)(GLint location, GLfloat x, GLfloat y); |
191 | void (GL_APIENTRY *glUniform2fv)(GLint location, GLsizei count, const GLfloat* v); |
192 | void (GL_APIENTRY *glUniform2i)(GLint location, GLint x, GLint y); |
193 | void (GL_APIENTRY *glUniform2iv)(GLint location, GLsizei count, const GLint* v); |
194 | void (GL_APIENTRY *glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); |
195 | void (GL_APIENTRY *glUniform3fv)(GLint location, GLsizei count, const GLfloat* v); |
196 | void (GL_APIENTRY *glUniform3i)(GLint location, GLint x, GLint y, GLint z); |
197 | void (GL_APIENTRY *glUniform3iv)(GLint location, GLsizei count, const GLint* v); |
198 | void (GL_APIENTRY *glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
199 | void (GL_APIENTRY *glUniform4fv)(GLint location, GLsizei count, const GLfloat* v); |
200 | void (GL_APIENTRY *glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); |
201 | void (GL_APIENTRY *glUniform4iv)(GLint location, GLsizei count, const GLint* v); |
202 | void (GL_APIENTRY *glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); |
203 | void (GL_APIENTRY *glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); |
204 | void (GL_APIENTRY *glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); |
205 | void (GL_APIENTRY *glUseProgram)(GLuint program); |
206 | void (GL_APIENTRY *glValidateProgram)(GLuint program); |
207 | void (GL_APIENTRY *glVertexAttrib1f)(GLuint index, GLfloat x); |
208 | void (GL_APIENTRY *glVertexAttrib1fv)(GLuint index, const GLfloat* values); |
209 | void (GL_APIENTRY *glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y); |
210 | void (GL_APIENTRY *glVertexAttrib2fv)(GLuint index, const GLfloat* values); |
211 | void (GL_APIENTRY *glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z); |
212 | void (GL_APIENTRY *glVertexAttrib3fv)(GLuint index, const GLfloat* values); |
213 | void (GL_APIENTRY *glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
214 | void (GL_APIENTRY *glVertexAttrib4fv)(GLuint index, const GLfloat* values); |
215 | void (GL_APIENTRY *glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); |
216 | void (GL_APIENTRY *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height); |
217 | void (GL_APIENTRY *glBlitFramebufferNV)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); |
218 | void (GL_APIENTRY *glBlitFramebufferANGLE)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
219 | GLbitfield mask, GLenum filter); |
220 | void (GL_APIENTRY *glTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, |
221 | GLint border, GLenum format, GLenum type, const GLvoid* pixels); |
222 | void (GL_APIENTRY *glTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); |
223 | void (GL_APIENTRY *glCopyTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
224 | void (GL_APIENTRY *glCompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); |
225 | void (GL_APIENTRY *glCompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); |
226 | void (GL_APIENTRY *glFramebufferTexture3DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); |
227 | void (GL_APIENTRY *glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image); |
228 | void (GL_APIENTRY *glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image); |
229 | GLboolean (GL_APIENTRY *glIsRenderbufferOES)(GLuint renderbuffer); |
230 | void (GL_APIENTRY *glBindRenderbufferOES)(GLenum target, GLuint renderbuffer); |
231 | void (GL_APIENTRY *glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers); |
232 | void (GL_APIENTRY *glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers); |
233 | void (GL_APIENTRY *glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); |
234 | void (GL_APIENTRY *glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params); |
235 | GLboolean (GL_APIENTRY *glIsFramebufferOES)(GLuint framebuffer); |
236 | void (GL_APIENTRY *glBindFramebufferOES)(GLenum target, GLuint framebuffer); |
237 | void (GL_APIENTRY *glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers); |
238 | void (GL_APIENTRY *glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers); |
239 | GLenum (GL_APIENTRY *glCheckFramebufferStatusOES)(GLenum target); |
240 | void (GL_APIENTRY *glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); |
241 | void (GL_APIENTRY *glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); |
242 | void (GL_APIENTRY *glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params); |
243 | void (GL_APIENTRY *glGenerateMipmapOES)(GLenum target); |
244 | void (GL_APIENTRY *glDrawBuffersEXT)(GLsizei n, const GLenum *bufs); |
245 | |
246 | egl::Context *(*es2CreateContext)(egl::Display *display, const egl::Context *shareContext, const egl::Config *config); |
247 | __eglMustCastToProperFunctionPointerType (*es2GetProcAddress)(const char *procname); |
248 | egl::Image *(*createBackBuffer)(int width, int height, sw::Format format, int multiSampleDepth); |
249 | egl::Image *(*createBackBufferFromClientBuffer)(const egl::ClientBuffer& clientBuffer); |
250 | egl::Image *(*createDepthStencil)(int width, int height, sw::Format format, int multiSampleDepth); |
251 | sw::FrameBuffer *(*createFrameBuffer)(void *nativeDisplay, EGLNativeWindowType window, int width, int height); |
252 | }; |
253 | |
254 | class LibGLESv2 |
255 | { |
256 | public: |
257 | LibGLESv2() |
258 | { |
259 | } |
260 | |
261 | ~LibGLESv2() |
262 | { |
263 | freeLibrary(libGLESv2); |
264 | } |
265 | |
266 | operator bool() |
267 | { |
268 | return loadExports() != nullptr; |
269 | } |
270 | |
271 | LibGLESv2exports *operator->() |
272 | { |
273 | return loadExports(); |
274 | } |
275 | |
276 | private: |
277 | LibGLESv2exports *loadExports() |
278 | { |
279 | if(!loadLibraryAttempted && !libGLESv2) |
280 | { |
281 | #if defined(_WIN32) |
282 | #if defined(__LP64__) |
283 | const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dll" , "libGLESv2.dll" , "lib64GLES_V2_translator.dll" }; |
284 | #else |
285 | const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dll" , "libGLESv2.dll" , "libGLES_V2_translator.dll" }; |
286 | #endif |
287 | #elif defined(__ANDROID__) |
288 | const char *libGLESv2_lib[] = {"libGLESv2_swiftshader.so" , "libGLESv2_swiftshader.so" }; |
289 | #elif defined(__linux__) |
290 | #if defined(__LP64__) |
291 | const char *libGLESv2_lib[] = {"lib64GLES_V2_translator.so" , "libGLESv2.so.2" , "libGLESv2.so" }; |
292 | #else |
293 | const char *libGLESv2_lib[] = {"libGLES_V2_translator.so" , "libGLESv2.so.2" , "libGLESv2.so" }; |
294 | #endif |
295 | #elif defined(__APPLE__) |
296 | #if defined(__LP64__) |
297 | const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dylib" , "lib64GLES_V2_translator.dylib" , "libGLESv2.dylib" }; |
298 | #else |
299 | const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dylib" , "libGLES_V2_translator.dylib" , "libGLESv2.dylib" }; |
300 | #endif |
301 | #elif defined(__Fuchsia__) |
302 | const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.so" , "libGLESv2.so" }; |
303 | #else |
304 | #error "libGLESv2::loadExports unimplemented for this platform" |
305 | #endif |
306 | |
307 | std::string directory = getModuleDirectory(); |
308 | libGLESv2 = loadLibrary(directory, libGLESv2_lib, "libGLESv2_swiftshader" ); |
309 | |
310 | if(libGLESv2) |
311 | { |
312 | auto libGLESv2_swiftshader = (LibGLESv2exports *(*)())getProcAddress(libGLESv2, "libGLESv2_swiftshader" ); |
313 | libGLESv2exports = libGLESv2_swiftshader(); |
314 | } |
315 | |
316 | loadLibraryAttempted = true; |
317 | } |
318 | |
319 | return libGLESv2exports; |
320 | } |
321 | |
322 | void *libGLESv2 = nullptr; |
323 | LibGLESv2exports *libGLESv2exports = nullptr; |
324 | bool loadLibraryAttempted = false; |
325 | }; |
326 | |
327 | #endif // libGLESv2_hpp |
328 | |