OLD | NEW |
---|---|
1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc | |
2 | 1 |
3 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 /* |
4 // Use of this source code is governed by a BSD-style license that can be | 3 * Copyright 2014 Google Inc. |
5 // found in the LICENSE file. | 4 * |
6 | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | |
7 */ | |
7 #include "gl/GrGLInterface.h" | 8 #include "gl/GrGLInterface.h" |
8 #include "gl/GrGLAssembleInterface.h" | 9 #include "gl/GrGLAssembleInterface.h" |
9 #include "gl/GrGLExtensions.h" | |
10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
11 | 11 |
12 #ifndef GL_GLEXT_PROTOTYPES | 12 #include <EGL/egl.h> |
13 #define GL_GLEXT_PROTOTYPES | |
14 #endif | |
15 | |
16 #include <GLES2/gl2.h> | 13 #include <GLES2/gl2.h> |
17 #include <GLES2/gl2ext.h> | |
18 | |
19 #include <EGL/egl.h> | |
20 | |
21 #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) | |
22 #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, " gl" #F #S) | |
23 #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl " #F) | |
24 | |
25 #define GET_LINKED(F) functions->f ## F = gl ## F | |
26 #define GET_LINKED_SUFFIX(F, S) functions->f ## F = gl ## F ##S | |
27 | |
28 #include "gl/GrGLAssembleGLESInterface.h" | |
29 | 14 |
30 static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) { | 15 static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) { |
31 SkASSERT(NULL == ctx); | 16 SkASSERT(NULL == ctx); |
robertphillips
2014/08/26 18:12:12
Yuck!
| |
17 // Some older drivers on Android have busted eglGetProcAdddress Functions th at | |
18 // will return the wrong pointer for built in GLES2 functions. This set of f unctions | |
19 // was generated on a Xoom by finding mismatches between the function pulled in via gl2.h and | |
20 // the address returned by eglGetProcAddress. | |
21 if (0 == strcmp("glActiveTexture", name)) { | |
22 return (GrGLFuncPtr) glActiveTexture; | |
23 } else if (0 == strcmp("glAttachShader", name)) { | |
24 return (GrGLFuncPtr) glAttachShader; | |
25 } else if (0 == strcmp("glBindAttribLocation", name)) { | |
26 return (GrGLFuncPtr) glBindAttribLocation; | |
27 } else if (0 == strcmp("glBindBuffer", name)) { | |
28 return (GrGLFuncPtr) glBindBuffer; | |
29 } else if (0 == strcmp("glBindTexture", name)) { | |
30 return (GrGLFuncPtr) glBindTexture; | |
31 } else if (0 == strcmp("glBlendColor", name)) { | |
32 return (GrGLFuncPtr) glBlendColor; | |
33 } else if (0 == strcmp("glBlendFunc", name)) { | |
34 return (GrGLFuncPtr) glBlendFunc; | |
35 } else if (0 == strcmp("glBufferData", name)) { | |
36 return (GrGLFuncPtr) glBufferData; | |
37 } else if (0 == strcmp("glBufferSubData", name)) { | |
38 return (GrGLFuncPtr) glBufferSubData; | |
39 } else if (0 == strcmp("glClear", name)) { | |
40 return (GrGLFuncPtr) glClear; | |
41 } else if (0 == strcmp("glClearColor", name)) { | |
42 return (GrGLFuncPtr) glClearColor; | |
43 } else if (0 == strcmp("glClearStencil", name)) { | |
44 return (GrGLFuncPtr) glClearStencil; | |
45 } else if (0 == strcmp("glColorMask", name)) { | |
46 return (GrGLFuncPtr) glColorMask; | |
47 } else if (0 == strcmp("glCompileShader", name)) { | |
48 return (GrGLFuncPtr) glCompileShader; | |
49 } else if (0 == strcmp("glCompressedTexImage2D", name)) { | |
50 return (GrGLFuncPtr) glCompressedTexImage2D; | |
51 } else if (0 == strcmp("glCompressedTexSubImage2D", name)) { | |
52 return (GrGLFuncPtr) glCompressedTexSubImage2D; | |
53 } else if (0 == strcmp("glCopyTexSubImage2D", name)) { | |
54 return (GrGLFuncPtr) glCopyTexSubImage2D; | |
55 } else if (0 == strcmp("glCreateProgram", name)) { | |
56 return (GrGLFuncPtr) glCreateProgram; | |
57 } else if (0 == strcmp("glCreateShader", name)) { | |
58 return (GrGLFuncPtr) glCreateShader; | |
59 } else if (0 == strcmp("glCullFace", name)) { | |
60 return (GrGLFuncPtr) glCullFace; | |
61 } else if (0 == strcmp("glDeleteBuffers", name)) { | |
62 return (GrGLFuncPtr) glDeleteBuffers; | |
63 } else if (0 == strcmp("glDeleteProgram", name)) { | |
64 return (GrGLFuncPtr) glDeleteProgram; | |
65 } else if (0 == strcmp("glDeleteShader", name)) { | |
66 return (GrGLFuncPtr) glDeleteShader; | |
67 } else if (0 == strcmp("glDeleteTextures", name)) { | |
68 return (GrGLFuncPtr) glDeleteTextures; | |
69 } else if (0 == strcmp("glDepthMask", name)) { | |
70 return (GrGLFuncPtr) glDepthMask; | |
71 } else if (0 == strcmp("glDisable", name)) { | |
72 return (GrGLFuncPtr) glDisable; | |
73 } else if (0 == strcmp("glDisableVertexAttribArray", name)) { | |
74 return (GrGLFuncPtr) glDisableVertexAttribArray; | |
75 } else if (0 == strcmp("glDrawArrays", name)) { | |
76 return (GrGLFuncPtr) glDrawArrays; | |
77 } else if (0 == strcmp("glDrawElements", name)) { | |
78 return (GrGLFuncPtr) glDrawElements; | |
79 } else if (0 == strcmp("glEnable", name)) { | |
80 return (GrGLFuncPtr) glEnable; | |
81 } else if (0 == strcmp("glEnableVertexAttribArray", name)) { | |
82 return (GrGLFuncPtr) glEnableVertexAttribArray; | |
83 } else if (0 == strcmp("glFinish", name)) { | |
84 return (GrGLFuncPtr) glFinish; | |
85 } else if (0 == strcmp("glFlush", name)) { | |
86 return (GrGLFuncPtr) glFlush; | |
87 } else if (0 == strcmp("glFrontFace", name)) { | |
88 return (GrGLFuncPtr) glFrontFace; | |
89 } else if (0 == strcmp("glGenBuffers", name)) { | |
90 return (GrGLFuncPtr) glGenBuffers; | |
91 } else if (0 == strcmp("glGenerateMipmap", name)) { | |
92 return (GrGLFuncPtr) glGenerateMipmap; | |
93 } else if (0 == strcmp("glGenTextures", name)) { | |
94 return (GrGLFuncPtr) glGenTextures; | |
95 } else if (0 == strcmp("glGetBufferParameteriv", name)) { | |
96 return (GrGLFuncPtr) glGetBufferParameteriv; | |
97 } else if (0 == strcmp("glGetError", name)) { | |
98 return (GrGLFuncPtr) glGetError; | |
99 } else if (0 == strcmp("glGetIntegerv", name)) { | |
100 return (GrGLFuncPtr) glGetIntegerv; | |
101 } else if (0 == strcmp("glGetProgramInfoLog", name)) { | |
102 return (GrGLFuncPtr) glGetProgramInfoLog; | |
103 } else if (0 == strcmp("glGetProgramiv", name)) { | |
104 return (GrGLFuncPtr) glGetProgramiv; | |
105 } else if (0 == strcmp("glGetShaderInfoLog", name)) { | |
106 return (GrGLFuncPtr) glGetShaderInfoLog; | |
107 } else if (0 == strcmp("glGetShaderiv", name)) { | |
108 return (GrGLFuncPtr) glGetShaderiv; | |
109 } else if (0 == strcmp("glGetString", name)) { | |
110 return (GrGLFuncPtr) glGetString; | |
111 } else if (0 == strcmp("glGetUniformLocation", name)) { | |
112 return (GrGLFuncPtr) glGetUniformLocation; | |
113 } else if (0 == strcmp("glLineWidth", name)) { | |
114 return (GrGLFuncPtr) glLineWidth; | |
115 } else if (0 == strcmp("glLinkProgram", name)) { | |
116 return (GrGLFuncPtr) glLinkProgram; | |
117 } else if (0 == strcmp("glPixelStorei", name)) { | |
118 return (GrGLFuncPtr) glPixelStorei; | |
119 } else if (0 == strcmp("glReadPixels", name)) { | |
120 return (GrGLFuncPtr) glReadPixels; | |
121 } else if (0 == strcmp("glScissor", name)) { | |
122 return (GrGLFuncPtr) glScissor; | |
123 } else if (0 == strcmp("glShaderSource", name)) { | |
124 return (GrGLFuncPtr) glShaderSource; | |
125 } else if (0 == strcmp("glStencilFunc", name)) { | |
126 return (GrGLFuncPtr) glStencilFunc; | |
127 } else if (0 == strcmp("glStencilFuncSeparate", name)) { | |
128 return (GrGLFuncPtr) glStencilFuncSeparate; | |
129 } else if (0 == strcmp("glStencilMask", name)) { | |
130 return (GrGLFuncPtr) glStencilMask; | |
131 } else if (0 == strcmp("glStencilMaskSeparate", name)) { | |
132 return (GrGLFuncPtr) glStencilMaskSeparate; | |
133 } else if (0 == strcmp("glStencilOp", name)) { | |
134 return (GrGLFuncPtr) glStencilOp; | |
135 } else if (0 == strcmp("glStencilOpSeparate", name)) { | |
136 return (GrGLFuncPtr) glStencilOpSeparate; | |
137 } else if (0 == strcmp("glTexImage2D", name)) { | |
138 return (GrGLFuncPtr) glTexImage2D; | |
139 } else if (0 == strcmp("glTexParameteri", name)) { | |
140 return (GrGLFuncPtr) glTexParameteri; | |
141 } else if (0 == strcmp("glTexParameteriv", name)) { | |
142 return (GrGLFuncPtr) glTexParameteriv; | |
143 } else if (0 == strcmp("glTexSubImage2D", name)) { | |
144 return (GrGLFuncPtr) glTexSubImage2D; | |
145 } else if (0 == strcmp("glUniform1f", name)) { | |
146 return (GrGLFuncPtr) glUniform1f; | |
147 } else if (0 == strcmp("glUniform1i", name)) { | |
148 return (GrGLFuncPtr) glUniform1i; | |
149 } else if (0 == strcmp("glUniform1fv", name)) { | |
150 return (GrGLFuncPtr) glUniform1fv; | |
151 } else if (0 == strcmp("glUniform1iv", name)) { | |
152 return (GrGLFuncPtr) glUniform1iv; | |
153 } else if (0 == strcmp("glUniform2f", name)) { | |
154 return (GrGLFuncPtr) glUniform2f; | |
155 } else if (0 == strcmp("glUniform2i", name)) { | |
156 return (GrGLFuncPtr) glUniform2i; | |
157 } else if (0 == strcmp("glUniform2fv", name)) { | |
158 return (GrGLFuncPtr) glUniform2fv; | |
159 } else if (0 == strcmp("glUniform2iv", name)) { | |
160 return (GrGLFuncPtr) glUniform2iv; | |
161 } else if (0 == strcmp("glUniform3f", name)) { | |
162 return (GrGLFuncPtr) glUniform3f; | |
163 } else if (0 == strcmp("glUniform3i", name)) { | |
164 return (GrGLFuncPtr) glUniform3i; | |
165 } else if (0 == strcmp("glUniform3fv", name)) { | |
166 return (GrGLFuncPtr) glUniform3fv; | |
167 } else if (0 == strcmp("glUniform3iv", name)) { | |
168 return (GrGLFuncPtr) glUniform3iv; | |
169 } else if (0 == strcmp("glUniform4f", name)) { | |
170 return (GrGLFuncPtr) glUniform4f; | |
171 } else if (0 == strcmp("glUniform4i", name)) { | |
172 return (GrGLFuncPtr) glUniform4i; | |
173 } else if (0 == strcmp("glUniform4fv", name)) { | |
174 return (GrGLFuncPtr) glUniform4fv; | |
175 } else if (0 == strcmp("glUniform4iv", name)) { | |
176 return (GrGLFuncPtr) glUniform4iv; | |
177 } else if (0 == strcmp("glUniformMatrix2fv", name)) { | |
178 return (GrGLFuncPtr) glUniformMatrix2fv; | |
179 } else if (0 == strcmp("glUniformMatrix3fv", name)) { | |
180 return (GrGLFuncPtr) glUniformMatrix3fv; | |
181 } else if (0 == strcmp("glUniformMatrix4fv", name)) { | |
182 return (GrGLFuncPtr) glUniformMatrix4fv; | |
183 } else if (0 == strcmp("glUseProgram", name)) { | |
184 return (GrGLFuncPtr) glUseProgram; | |
185 } else if (0 == strcmp("glVertexAttrib4fv", name)) { | |
186 return (GrGLFuncPtr) glVertexAttrib4fv; | |
187 } else if (0 == strcmp("glVertexAttribPointer", name)) { | |
188 return (GrGLFuncPtr) glVertexAttribPointer; | |
189 } else if (0 == strcmp("glViewport", name)) { | |
190 return (GrGLFuncPtr) glViewport; | |
191 } else if (0 == strcmp("glBindFramebuffer", name)) { | |
192 return (GrGLFuncPtr) glBindFramebuffer; | |
193 } else if (0 == strcmp("glBindRenderbuffer", name)) { | |
194 return (GrGLFuncPtr) glBindRenderbuffer; | |
195 } else if (0 == strcmp("glCheckFramebufferStatus", name)) { | |
196 return (GrGLFuncPtr) glCheckFramebufferStatus; | |
197 } else if (0 == strcmp("glDeleteFramebuffers", name)) { | |
198 return (GrGLFuncPtr) glDeleteFramebuffers; | |
199 } else if (0 == strcmp("glDeleteRenderbuffers", name)) { | |
200 return (GrGLFuncPtr) glDeleteRenderbuffers; | |
201 } else if (0 == strcmp("glFramebufferRenderbuffer", name)) { | |
202 return (GrGLFuncPtr) glFramebufferRenderbuffer; | |
203 } else if (0 == strcmp("glFramebufferTexture2D", name)) { | |
204 return (GrGLFuncPtr) glFramebufferTexture2D; | |
205 } else if (0 == strcmp("glGenFramebuffers", name)) { | |
206 return (GrGLFuncPtr) glGenFramebuffers; | |
207 } else if (0 == strcmp("glGenRenderbuffers", name)) { | |
208 return (GrGLFuncPtr) glGenRenderbuffers; | |
209 } else if (0 == strcmp("glGetFramebufferAttachmentParameteriv", name)) { | |
210 return (GrGLFuncPtr) glGetFramebufferAttachmentParameteriv; | |
211 } else if (0 == strcmp("glGetRenderbufferParameteriv", name)) { | |
212 return (GrGLFuncPtr) glGetRenderbufferParameteriv; | |
213 } else if (0 == strcmp("glRenderbufferStorage", name)) { | |
214 return (GrGLFuncPtr) glRenderbufferStorage; | |
215 } else if (0 == strcmp("glActiveTexture", name)) { | |
216 return (GrGLFuncPtr) glActiveTexture; | |
217 } else if (0 == strcmp("glAttachShader", name)) { | |
218 return (GrGLFuncPtr) glAttachShader; | |
219 } else if (0 == strcmp("glBindAttribLocation", name)) { | |
220 return (GrGLFuncPtr) glBindAttribLocation; | |
221 } else if (0 == strcmp("glBindBuffer", name)) { | |
222 return (GrGLFuncPtr) glBindBuffer; | |
223 } else if (0 == strcmp("glBindTexture", name)) { | |
224 return (GrGLFuncPtr) glBindTexture; | |
225 } else if (0 == strcmp("glBlendColor", name)) { | |
226 return (GrGLFuncPtr) glBlendColor; | |
227 } else if (0 == strcmp("glBlendFunc", name)) { | |
228 return (GrGLFuncPtr) glBlendFunc; | |
229 } else if (0 == strcmp("glBufferData", name)) { | |
230 return (GrGLFuncPtr) glBufferData; | |
231 } else if (0 == strcmp("glBufferSubData", name)) { | |
232 return (GrGLFuncPtr) glBufferSubData; | |
233 } else if (0 == strcmp("glClear", name)) { | |
234 return (GrGLFuncPtr) glClear; | |
235 } else if (0 == strcmp("glClearColor", name)) { | |
236 return (GrGLFuncPtr) glClearColor; | |
237 } else if (0 == strcmp("glClearStencil", name)) { | |
238 return (GrGLFuncPtr) glClearStencil; | |
239 } else if (0 == strcmp("glColorMask", name)) { | |
240 return (GrGLFuncPtr) glColorMask; | |
241 } else if (0 == strcmp("glCompileShader", name)) { | |
242 return (GrGLFuncPtr) glCompileShader; | |
243 } else if (0 == strcmp("glCompressedTexImage2D", name)) { | |
244 return (GrGLFuncPtr) glCompressedTexImage2D; | |
245 } else if (0 == strcmp("glCompressedTexSubImage2D", name)) { | |
246 return (GrGLFuncPtr) glCompressedTexSubImage2D; | |
247 } else if (0 == strcmp("glCopyTexSubImage2D", name)) { | |
248 return (GrGLFuncPtr) glCopyTexSubImage2D; | |
249 } else if (0 == strcmp("glCreateProgram", name)) { | |
250 return (GrGLFuncPtr) glCreateProgram; | |
251 } else if (0 == strcmp("glCreateShader", name)) { | |
252 return (GrGLFuncPtr) glCreateShader; | |
253 } else if (0 == strcmp("glCullFace", name)) { | |
254 return (GrGLFuncPtr) glCullFace; | |
255 } else if (0 == strcmp("glDeleteBuffers", name)) { | |
256 return (GrGLFuncPtr) glDeleteBuffers; | |
257 } else if (0 == strcmp("glDeleteProgram", name)) { | |
258 return (GrGLFuncPtr) glDeleteProgram; | |
259 } else if (0 == strcmp("glDeleteShader", name)) { | |
260 return (GrGLFuncPtr) glDeleteShader; | |
261 } else if (0 == strcmp("glDeleteTextures", name)) { | |
262 return (GrGLFuncPtr) glDeleteTextures; | |
263 } else if (0 == strcmp("glDepthMask", name)) { | |
264 return (GrGLFuncPtr) glDepthMask; | |
265 } else if (0 == strcmp("glDisable", name)) { | |
266 return (GrGLFuncPtr) glDisable; | |
267 } else if (0 == strcmp("glDisableVertexAttribArray", name)) { | |
268 return (GrGLFuncPtr) glDisableVertexAttribArray; | |
269 } else if (0 == strcmp("glDrawArrays", name)) { | |
270 return (GrGLFuncPtr) glDrawArrays; | |
271 } else if (0 == strcmp("glDrawElements", name)) { | |
272 return (GrGLFuncPtr) glDrawElements; | |
273 } else if (0 == strcmp("glEnable", name)) { | |
274 return (GrGLFuncPtr) glEnable; | |
275 } else if (0 == strcmp("glEnableVertexAttribArray", name)) { | |
276 return (GrGLFuncPtr) glEnableVertexAttribArray; | |
277 } else if (0 == strcmp("glFinish", name)) { | |
278 return (GrGLFuncPtr) glFinish; | |
279 } else if (0 == strcmp("glFlush", name)) { | |
280 return (GrGLFuncPtr) glFlush; | |
281 } else if (0 == strcmp("glFrontFace", name)) { | |
282 return (GrGLFuncPtr) glFrontFace; | |
283 } else if (0 == strcmp("glGenBuffers", name)) { | |
284 return (GrGLFuncPtr) glGenBuffers; | |
285 } else if (0 == strcmp("glGenerateMipmap", name)) { | |
286 return (GrGLFuncPtr) glGenerateMipmap; | |
287 } else if (0 == strcmp("glGenTextures", name)) { | |
288 return (GrGLFuncPtr) glGenTextures; | |
289 } else if (0 == strcmp("glGetBufferParameteriv", name)) { | |
290 return (GrGLFuncPtr) glGetBufferParameteriv; | |
291 } else if (0 == strcmp("glGetError", name)) { | |
292 return (GrGLFuncPtr) glGetError; | |
293 } else if (0 == strcmp("glGetIntegerv", name)) { | |
294 return (GrGLFuncPtr) glGetIntegerv; | |
295 } else if (0 == strcmp("glGetProgramInfoLog", name)) { | |
296 return (GrGLFuncPtr) glGetProgramInfoLog; | |
297 } else if (0 == strcmp("glGetProgramiv", name)) { | |
298 return (GrGLFuncPtr) glGetProgramiv; | |
299 } else if (0 == strcmp("glGetShaderInfoLog", name)) { | |
300 return (GrGLFuncPtr) glGetShaderInfoLog; | |
301 } else if (0 == strcmp("glGetShaderiv", name)) { | |
302 return (GrGLFuncPtr) glGetShaderiv; | |
303 } else if (0 == strcmp("glGetString", name)) { | |
304 return (GrGLFuncPtr) glGetString; | |
305 } else if (0 == strcmp("glGetUniformLocation", name)) { | |
306 return (GrGLFuncPtr) glGetUniformLocation; | |
307 } else if (0 == strcmp("glLineWidth", name)) { | |
308 return (GrGLFuncPtr) glLineWidth; | |
309 } else if (0 == strcmp("glLinkProgram", name)) { | |
310 return (GrGLFuncPtr) glLinkProgram; | |
311 } else if (0 == strcmp("glPixelStorei", name)) { | |
312 return (GrGLFuncPtr) glPixelStorei; | |
313 } else if (0 == strcmp("glReadPixels", name)) { | |
314 return (GrGLFuncPtr) glReadPixels; | |
315 } else if (0 == strcmp("glScissor", name)) { | |
316 return (GrGLFuncPtr) glScissor; | |
317 } else if (0 == strcmp("glShaderSource", name)) { | |
318 return (GrGLFuncPtr) glShaderSource; | |
319 } else if (0 == strcmp("glStencilFunc", name)) { | |
320 return (GrGLFuncPtr) glStencilFunc; | |
321 } else if (0 == strcmp("glStencilFuncSeparate", name)) { | |
322 return (GrGLFuncPtr) glStencilFuncSeparate; | |
323 } else if (0 == strcmp("glStencilMask", name)) { | |
324 return (GrGLFuncPtr) glStencilMask; | |
325 } else if (0 == strcmp("glStencilMaskSeparate", name)) { | |
326 return (GrGLFuncPtr) glStencilMaskSeparate; | |
327 } else if (0 == strcmp("glStencilOp", name)) { | |
328 return (GrGLFuncPtr) glStencilOp; | |
329 } else if (0 == strcmp("glStencilOpSeparate", name)) { | |
330 return (GrGLFuncPtr) glStencilOpSeparate; | |
331 } else if (0 == strcmp("glTexImage2D", name)) { | |
332 return (GrGLFuncPtr) glTexImage2D; | |
333 } else if (0 == strcmp("glTexParameteri", name)) { | |
334 return (GrGLFuncPtr) glTexParameteri; | |
335 } else if (0 == strcmp("glTexParameteriv", name)) { | |
336 return (GrGLFuncPtr) glTexParameteriv; | |
337 } else if (0 == strcmp("glTexSubImage2D", name)) { | |
338 return (GrGLFuncPtr) glTexSubImage2D; | |
339 } else if (0 == strcmp("glUniform1f", name)) { | |
340 return (GrGLFuncPtr) glUniform1f; | |
341 } else if (0 == strcmp("glUniform1i", name)) { | |
342 return (GrGLFuncPtr) glUniform1i; | |
343 } else if (0 == strcmp("glUniform1fv", name)) { | |
344 return (GrGLFuncPtr) glUniform1fv; | |
345 } else if (0 == strcmp("glUniform1iv", name)) { | |
346 return (GrGLFuncPtr) glUniform1iv; | |
347 } else if (0 == strcmp("glUniform2f", name)) { | |
348 return (GrGLFuncPtr) glUniform2f; | |
349 } else if (0 == strcmp("glUniform2i", name)) { | |
350 return (GrGLFuncPtr) glUniform2i; | |
351 } else if (0 == strcmp("glUniform2fv", name)) { | |
352 return (GrGLFuncPtr) glUniform2fv; | |
353 } else if (0 == strcmp("glUniform2iv", name)) { | |
354 return (GrGLFuncPtr) glUniform2iv; | |
355 } else if (0 == strcmp("glUniform3f", name)) { | |
356 return (GrGLFuncPtr) glUniform3f; | |
357 } else if (0 == strcmp("glUniform3i", name)) { | |
358 return (GrGLFuncPtr) glUniform3i; | |
359 } else if (0 == strcmp("glUniform3fv", name)) { | |
360 return (GrGLFuncPtr) glUniform3fv; | |
361 } else if (0 == strcmp("glUniform3iv", name)) { | |
362 return (GrGLFuncPtr) glUniform3iv; | |
363 } else if (0 == strcmp("glUniform4f", name)) { | |
364 return (GrGLFuncPtr) glUniform4f; | |
365 } else if (0 == strcmp("glUniform4i", name)) { | |
366 return (GrGLFuncPtr) glUniform4i; | |
367 } else if (0 == strcmp("glUniform4fv", name)) { | |
368 return (GrGLFuncPtr) glUniform4fv; | |
369 } else if (0 == strcmp("glUniform4iv", name)) { | |
370 return (GrGLFuncPtr) glUniform4iv; | |
371 } else if (0 == strcmp("glUniformMatrix2fv", name)) { | |
372 return (GrGLFuncPtr) glUniformMatrix2fv; | |
373 } else if (0 == strcmp("glUniformMatrix3fv", name)) { | |
374 return (GrGLFuncPtr) glUniformMatrix3fv; | |
375 } else if (0 == strcmp("glUniformMatrix4fv", name)) { | |
376 return (GrGLFuncPtr) glUniformMatrix4fv; | |
377 } else if (0 == strcmp("glUseProgram", name)) { | |
378 return (GrGLFuncPtr) glUseProgram; | |
379 } else if (0 == strcmp("glVertexAttrib4fv", name)) { | |
380 return (GrGLFuncPtr) glVertexAttrib4fv; | |
381 } else if (0 == strcmp("glVertexAttribPointer", name)) { | |
382 return (GrGLFuncPtr) glVertexAttribPointer; | |
383 } else if (0 == strcmp("glViewport", name)) { | |
384 return (GrGLFuncPtr) glViewport; | |
385 } else if (0 == strcmp("glBindFramebuffer", name)) { | |
386 return (GrGLFuncPtr) glBindFramebuffer; | |
387 } else if (0 == strcmp("glBindRenderbuffer", name)) { | |
388 return (GrGLFuncPtr) glBindRenderbuffer; | |
389 } else if (0 == strcmp("glCheckFramebufferStatus", name)) { | |
390 return (GrGLFuncPtr) glCheckFramebufferStatus; | |
391 } else if (0 == strcmp("glDeleteFramebuffers", name)) { | |
392 return (GrGLFuncPtr) glDeleteFramebuffers; | |
393 } else if (0 == strcmp("glDeleteRenderbuffers", name)) { | |
394 return (GrGLFuncPtr) glDeleteRenderbuffers; | |
395 } else if (0 == strcmp("glFramebufferRenderbuffer", name)) { | |
396 return (GrGLFuncPtr) glFramebufferRenderbuffer; | |
397 } else if (0 == strcmp("glFramebufferTexture2D", name)) { | |
398 return (GrGLFuncPtr) glFramebufferTexture2D; | |
399 } else if (0 == strcmp("glGenFramebuffers", name)) { | |
400 return (GrGLFuncPtr) glGenFramebuffers; | |
401 } else if (0 == strcmp("glGenRenderbuffers", name)) { | |
402 return (GrGLFuncPtr) glGenRenderbuffers; | |
403 } else if (0 == strcmp("glGetFramebufferAttachmentParameteriv", name)) { | |
404 return (GrGLFuncPtr) glGetFramebufferAttachmentParameteriv; | |
405 } else if (0 == strcmp("glGetRenderbufferParameteriv", name)) { | |
406 return (GrGLFuncPtr) glGetRenderbufferParameteriv; | |
407 } else if (0 == strcmp("glRenderbufferStorage", name)) { | |
408 return (GrGLFuncPtr) glRenderbufferStorage; | |
409 } | |
32 return eglGetProcAddress(name); | 410 return eglGetProcAddress(name); |
33 } | 411 } |
34 | 412 |
35 const GrGLInterface* GrGLCreateNativeInterface() { | 413 const GrGLInterface* GrGLCreateNativeInterface() { |
36 | 414 return GrGLAssembleInterface(NULL, android_get_gl_proc); |
37 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION )); | |
38 GrGLStandard standard = GrGLGetStandardInUseFromString(verStr); | |
39 | |
40 if (kGLES_GrGLStandard == standard) { | |
41 return GrGLAssembleGLESInterface(NULL, android_get_gl_proc); | |
42 } else if (kGL_GrGLStandard == standard) { | |
43 return GrGLAssembleGLInterface(NULL, android_get_gl_proc); | |
44 } | |
45 | |
46 return NULL; | |
47 } | 415 } |
OLD | NEW |