Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp

Issue 254713006: Common GrGLInterface OpenGL setup function. (Closed) Base URL: https://skia.googlesource.com/skia.git@grgl
Patch Set: Address additional comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLAssembleInterface.cpp ('k') | src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc 1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc
2 2
3 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #include "gl/GrGLInterface.h"
8 #include "gl/GrGLAssembleInterface.h"
7 #include "gl/GrGLExtensions.h" 9 #include "gl/GrGLExtensions.h"
8 #include "gl/GrGLInterface.h"
9 #include "gl/GrGLUtil.h" 10 #include "gl/GrGLUtil.h"
10 11
11 #ifndef GL_GLEXT_PROTOTYPES 12 #ifndef GL_GLEXT_PROTOTYPES
12 #define GL_GLEXT_PROTOTYPES 13 #define GL_GLEXT_PROTOTYPES
13 #endif 14 #endif
14 15
15 #include <GLES2/gl2.h> 16 #include <GLES2/gl2.h>
16 #include <GLES2/gl2ext.h> 17 #include <GLES2/gl2ext.h>
17 18
18 #include <EGL/egl.h> 19 #include <EGL/egl.h>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eg lGetProcAddress("glInvalidateSubFramebuffer"); 212 functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eg lGetProcAddress("glInvalidateSubFramebuffer");
212 #endif 213 #endif
213 functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProc Address("glInvalidateBufferData"); 214 functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProc Address("glInvalidateBufferData");
214 functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglG etProcAddress("glInvalidateBufferSubData"); 215 functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglG etProcAddress("glInvalidateBufferSubData");
215 functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddr ess("glInvalidateTexImage"); 216 functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddr ess("glInvalidateTexImage");
216 functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetPr ocAddress("glInvalidateTexSubImage"); 217 functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetPr ocAddress("glInvalidateTexSubImage");
217 218
218 return interface; 219 return interface;
219 } 220 }
220 221
221 static GrGLInterface* create_desktop_interface(GrGLVersion version, 222 static GrGLFuncPtr android_get_gl_proc(void* ctx, const char name[]) {
222 const GrGLExtensions& extensions) { 223 SkASSERT(NULL == ctx);
223 // Currently this assumes a 4.4 context or later. Supporting lower GL versio ns would require 224 return eglGetProcAddress(name);
224 // getting suffixed versions of pointers for supported extensions. 225 }
225 if (version < GR_GL_VER(4,4)) {
226 return NULL;
227 }
228 226
229 GrGLInterface* interface = SkNEW(GrGLInterface); 227 static const GrGLInterface* create_desktop_interface() {
230 interface->fStandard = kGL_GrGLStandard; 228 return GrGLAssembleGLInterface(NULL, android_get_gl_proc);
231 GrGLInterface::Functions* functions = &interface->fFunctions;
232
233 functions->fActiveTexture = (GrGLActiveTextureProc) eglGetProcAddress("glAct iveTexture");
234 functions->fAttachShader = (GrGLAttachShaderProc) eglGetProcAddress("glAttac hShader");
235 functions->fBeginQuery = (GrGLBeginQueryProc) eglGetProcAddress("glBeginQuer y");
236 functions->fBindAttribLocation = (GrGLBindAttribLocationProc) eglGetProcAddr ess("glBindAttribLocation");
237 functions->fBindBuffer = (GrGLBindBufferProc) eglGetProcAddress("glBindBuffe r");
238 functions->fBindFragDataLocation = (GrGLBindFragDataLocationProc) eglGetProc Address("glBindFragDataLocation");
239 functions->fBindFragDataLocationIndexed = (GrGLBindFragDataLocationIndexedPr oc) eglGetProcAddress("glBindFragDataLocationIndexed");
240 functions->fBindFramebuffer = (GrGLBindFramebufferProc) eglGetProcAddress("g lBindFramebuffer");
241 functions->fBindRenderbuffer = (GrGLBindRenderbufferProc) eglGetProcAddress( "glBindRenderbuffer");
242 functions->fBindTexture = (GrGLBindTextureProc) eglGetProcAddress("glBindTex ture");
243 functions->fBindVertexArray = (GrGLBindVertexArrayProc) eglGetProcAddress("g lBindVertexArray");
244 functions->fBlendColor = (GrGLBlendColorProc) eglGetProcAddress("glBlendColo r");
245 functions->fBlendFunc = (GrGLBlendFuncProc) eglGetProcAddress("glBlendFunc") ;
246 functions->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("g lBlitFramebuffer");
247 functions->fBufferData = (GrGLBufferDataProc) eglGetProcAddress("glBufferDat a");
248 functions->fBufferSubData = (GrGLBufferSubDataProc) eglGetProcAddress("glBuf ferSubData");
249 functions->fCheckFramebufferStatus = (GrGLCheckFramebufferStatusProc) eglGet ProcAddress("glCheckFramebufferStatus");
250 functions->fClear = (GrGLClearProc) eglGetProcAddress("glClear");
251 functions->fClearColor = (GrGLClearColorProc) eglGetProcAddress("glClearColo r");
252 functions->fClearStencil = (GrGLClearStencilProc) eglGetProcAddress("glClear Stencil");
253 functions->fColorMask = (GrGLColorMaskProc) eglGetProcAddress("glColorMask") ;
254 functions->fCompileShader = (GrGLCompileShaderProc) eglGetProcAddress("glCom pileShader");
255 functions->fCompressedTexImage2D = (GrGLCompressedTexImage2DProc) eglGetProc Address("glCompressedTexImage2D");
256 functions->fCopyTexSubImage2D = (GrGLCopyTexSubImage2DProc) eglGetProcAddres s("glCopyTexSubImage2D");
257 functions->fCreateProgram = (GrGLCreateProgramProc) eglGetProcAddress("glCre ateProgram");
258 functions->fCreateShader = (GrGLCreateShaderProc) eglGetProcAddress("glCreat eShader");
259 functions->fCullFace = (GrGLCullFaceProc) eglGetProcAddress("glCullFace");
260 functions->fDeleteBuffers = (GrGLDeleteBuffersProc) eglGetProcAddress("glDel eteBuffers");
261 functions->fDeleteFramebuffers = (GrGLDeleteFramebuffersProc) eglGetProcAddr ess("glDeleteFramebuffers");
262 functions->fDeleteProgram = (GrGLDeleteProgramProc) eglGetProcAddress("glDel eteProgram");
263 functions->fDeleteQueries = (GrGLDeleteQueriesProc) eglGetProcAddress("glDel eteQueries");
264 functions->fDeleteRenderbuffers = (GrGLDeleteRenderbuffersProc) eglGetProcAd dress("glDeleteRenderbuffers");
265 functions->fDeleteShader = (GrGLDeleteShaderProc) eglGetProcAddress("glDelet eShader");
266 functions->fDeleteTextures = (GrGLDeleteTexturesProc) eglGetProcAddress("glD eleteTextures");
267 functions->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddr ess("glDeleteVertexArrays");
268 functions->fDepthMask = (GrGLDepthMaskProc) eglGetProcAddress("glDepthMask") ;
269 functions->fDisable = (GrGLDisableProc) eglGetProcAddress("glDisable");
270 functions->fDisableVertexAttribArray = (GrGLDisableVertexAttribArrayProc) eg lGetProcAddress("glDisableVertexAttribArray");
271 functions->fDrawArrays = (GrGLDrawArraysProc) eglGetProcAddress("glDrawArray s");
272 functions->fDrawBuffer = (GrGLDrawBufferProc) eglGetProcAddress("glDrawBuffe r");
273 functions->fDrawBuffers = (GrGLDrawBuffersProc) eglGetProcAddress("glDrawBuf fers");
274 functions->fDrawElements = (GrGLDrawElementsProc) eglGetProcAddress("glDrawE lements");
275 functions->fEnable = (GrGLEnableProc) eglGetProcAddress("glEnable");
276 functions->fEnableVertexAttribArray = (GrGLEnableVertexAttribArrayProc) eglG etProcAddress("glEnableVertexAttribArray");
277 functions->fEndQuery = (GrGLEndQueryProc) eglGetProcAddress("glEndQuery");
278 functions->fFinish = (GrGLFinishProc) eglGetProcAddress("glFinish");
279 functions->fFlush = (GrGLFlushProc) eglGetProcAddress("glFlush");
280 functions->fFramebufferRenderbuffer = (GrGLFramebufferRenderbufferProc) eglG etProcAddress("glFramebufferRenderbuffer");
281 functions->fFramebufferTexture2D = (GrGLFramebufferTexture2DProc) eglGetProc Address("glFramebufferTexture2D");
282 functions->fFrontFace = (GrGLFrontFaceProc) eglGetProcAddress("glFrontFace") ;
283 functions->fGenBuffers = (GrGLGenBuffersProc) eglGetProcAddress("glGenBuffer s");
284 functions->fGenFramebuffers = (GrGLGenFramebuffersProc) eglGetProcAddress("g lGenFramebuffers");
285 functions->fGenerateMipmap = (GrGLGenerateMipmapProc) eglGetProcAddress("glG enerateMipmap");
286 functions->fGenQueries = (GrGLGenQueriesProc) eglGetProcAddress("glGenQuerie s");
287 functions->fGenRenderbuffers = (GrGLGenRenderbuffersProc) eglGetProcAddress( "glGenRenderbuffers");
288 functions->fGenTextures = (GrGLGenTexturesProc) eglGetProcAddress("glGenText ures");
289 functions->fGenVertexArrays = (GrGLGenVertexArraysProc) eglGetProcAddress("g lGenVertexArrays");
290 functions->fGetBufferParameteriv = (GrGLGetBufferParameterivProc) eglGetProc Address("glGetBufferParameteriv");
291 functions->fGetError = (GrGLGetErrorProc) eglGetProcAddress("glGetError");
292 functions->fGetFramebufferAttachmentParameteriv = (GrGLGetFramebufferAttachm entParameterivProc) eglGetProcAddress("glGetFramebufferAttachmentParameteriv");
293 functions->fGetIntegerv = (GrGLGetIntegervProc) eglGetProcAddress("glGetInte gerv");
294 functions->fGetQueryObjecti64v = (GrGLGetQueryObjecti64vProc) eglGetProcAddr ess("glGetQueryObjecti64v");
295 functions->fGetQueryObjectiv = (GrGLGetQueryObjectivProc) eglGetProcAddress( "glGetQueryObjectiv");
296 functions->fGetQueryObjectui64v = (GrGLGetQueryObjectui64vProc) eglGetProcAd dress("glGetQueryObjectui64v");
297 functions->fGetQueryObjectuiv = (GrGLGetQueryObjectuivProc) eglGetProcAddres s("glGetQueryObjectuiv");
298 functions->fGetQueryiv = (GrGLGetQueryivProc) eglGetProcAddress("glGetQueryi v");
299 functions->fGetProgramInfoLog = (GrGLGetProgramInfoLogProc) eglGetProcAddres s("glGetProgramInfoLog");
300 functions->fGetProgramiv = (GrGLGetProgramivProc) eglGetProcAddress("glGetPr ogramiv");
301 functions->fGetRenderbufferParameteriv = (GrGLGetRenderbufferParameterivProc ) eglGetProcAddress("glGetRenderbufferParameteriv");
302 functions->fGetShaderInfoLog = (GrGLGetShaderInfoLogProc) eglGetProcAddress( "glGetShaderInfoLog");
303 functions->fGetShaderiv = (GrGLGetShaderivProc) eglGetProcAddress("glGetShad eriv");
304 functions->fGetString = (GrGLGetStringProc) eglGetProcAddress("glGetString") ;
305 functions->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetString i");
306 functions->fGetTexLevelParameteriv = (GrGLGetTexLevelParameterivProc) eglGet ProcAddress("glGetTexLevelParameteriv");
307 functions->fGetUniformLocation = (GrGLGetUniformLocationProc) eglGetProcAddr ess("glGetUniformLocation");
308 functions->fLineWidth = (GrGLLineWidthProc) eglGetProcAddress("glLineWidth") ;
309 functions->fLinkProgram = (GrGLLinkProgramProc) eglGetProcAddress("glLinkPro gram");
310 functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuffer") ;
311 if (extensions.has("GL_EXT_direct_state_access")) {
312 functions->fMatrixLoadf = (GrGLMatrixLoadfProc) eglGetProcAddress("glMat rixLoadfEXT");
313 functions->fMatrixLoadIdentity = (GrGLMatrixLoadIdentityProc) eglGetProc Address("glMatrixLoadIdentityEXT");
314 }
315 functions->fPixelStorei = (GrGLPixelStoreiProc) eglGetProcAddress("glPixelSt orei");
316 functions->fQueryCounter = (GrGLQueryCounterProc) eglGetProcAddress("glQuery Counter");
317 functions->fReadBuffer = (GrGLReadBufferProc) eglGetProcAddress("glReadBuffe r");
318 functions->fReadPixels = (GrGLReadPixelsProc) eglGetProcAddress("glReadPixel s");
319 functions->fRenderbufferStorage = (GrGLRenderbufferStorageProc) eglGetProcAd dress("glRenderbufferStorage");
320 functions->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMultisa mpleProc) eglGetProcAddress("glRenderbufferStorageMultisample");
321 functions->fScissor = (GrGLScissorProc) eglGetProcAddress("glScissor");
322 functions->fShaderSource = (GrGLShaderSourceProc) eglGetProcAddress("glShade rSource");
323 functions->fStencilFunc = (GrGLStencilFuncProc) eglGetProcAddress("glStencil Func");
324 functions->fStencilFuncSeparate = (GrGLStencilFuncSeparateProc) eglGetProcAd dress("glStencilFuncSeparate");
325 functions->fStencilMask = (GrGLStencilMaskProc) eglGetProcAddress("glStencil Mask");
326 functions->fStencilMaskSeparate = (GrGLStencilMaskSeparateProc) eglGetProcAd dress("glStencilMaskSeparate");
327 functions->fStencilOp = (GrGLStencilOpProc) eglGetProcAddress("glStencilOp") ;
328 functions->fStencilOpSeparate = (GrGLStencilOpSeparateProc) eglGetProcAddres s("glStencilOpSeparate");
329 functions->fTexImage2D = (GrGLTexImage2DProc) eglGetProcAddress("glTexImage2 D");
330 functions->fTexParameteri = (GrGLTexParameteriProc) eglGetProcAddress("glTex Parameteri");
331 functions->fTexParameteriv = (GrGLTexParameterivProc) eglGetProcAddress("glT exParameteriv");
332 functions->fTexSubImage2D = (GrGLTexSubImage2DProc) eglGetProcAddress("glTex SubImage2D");
333 functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexSt orage2D");
334 functions->fUniform1f = (GrGLUniform1fProc) eglGetProcAddress("glUniform1f") ;
335 functions->fUniform1i = (GrGLUniform1iProc) eglGetProcAddress("glUniform1i") ;
336 functions->fUniform1fv = (GrGLUniform1fvProc) eglGetProcAddress("glUniform1f v");
337 functions->fUniform1iv = (GrGLUniform1ivProc) eglGetProcAddress("glUniform1i v");
338 functions->fUniform2f = (GrGLUniform2fProc) eglGetProcAddress("glUniform2f") ;
339 functions->fUniform2i = (GrGLUniform2iProc) eglGetProcAddress("glUniform2i") ;
340 functions->fUniform2fv = (GrGLUniform2fvProc) eglGetProcAddress("glUniform2f v");
341 functions->fUniform2iv = (GrGLUniform2ivProc) eglGetProcAddress("glUniform2i v");
342 functions->fUniform3f = (GrGLUniform3fProc) eglGetProcAddress("glUniform3f") ;
343 functions->fUniform3i = (GrGLUniform3iProc) eglGetProcAddress("glUniform3i") ;
344 functions->fUniform3fv = (GrGLUniform3fvProc) eglGetProcAddress("glUniform3f v");
345 functions->fUniform3iv = (GrGLUniform3ivProc) eglGetProcAddress("glUniform3i v");
346 functions->fUniform4f = (GrGLUniform4fProc) eglGetProcAddress("glUniform4f") ;
347 functions->fUniform4i = (GrGLUniform4iProc) eglGetProcAddress("glUniform4i") ;
348 functions->fUniform4fv = (GrGLUniform4fvProc) eglGetProcAddress("glUniform4f v");
349 functions->fUniform4iv = (GrGLUniform4ivProc) eglGetProcAddress("glUniform4i v");
350 functions->fUniformMatrix2fv = (GrGLUniformMatrix2fvProc) eglGetProcAddress( "glUniformMatrix2fv");
351 functions->fUniformMatrix3fv = (GrGLUniformMatrix3fvProc) eglGetProcAddress( "glUniformMatrix3fv");
352 functions->fUniformMatrix4fv = (GrGLUniformMatrix4fvProc) eglGetProcAddress( "glUniformMatrix4fv");
353 functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBu ffer");
354 functions->fUseProgram = (GrGLUseProgramProc) eglGetProcAddress("glUseProgra m");
355 functions->fVertexAttrib4fv = (GrGLVertexAttrib4fvProc) eglGetProcAddress("g lVertexAttrib4fv");
356 functions->fVertexAttribPointer = (GrGLVertexAttribPointerProc) eglGetProcAd dress("glVertexAttribPointer");
357 functions->fViewport = (GrGLViewportProc) eglGetProcAddress("glViewport");
358
359 if (extensions.has("GL_NV_path_rendering")) {
360 functions->fPathCommands = (GrGLPathCommandsProc) eglGetProcAddress("glP athCommandsNV");
361 functions->fPathCoords = (GrGLPathCoordsProc) eglGetProcAddress("glPathC oordsNV");
362 functions->fPathSubCommands = (GrGLPathSubCommandsProc) eglGetProcAddres s("glPathSubCommandsNV");
363 functions->fPathSubCoords = (GrGLPathSubCoordsProc) eglGetProcAddress("g lPathSubCoordsNV");
364 functions->fPathString = (GrGLPathStringProc) eglGetProcAddress("glPathS tringNV");
365 functions->fPathGlyphs = (GrGLPathGlyphsProc) eglGetProcAddress("glPathG lyphsNV");
366 functions->fPathGlyphRange = (GrGLPathGlyphRangeProc) eglGetProcAddress( "glPathGlyphRangeNV");
367 functions->fWeightPaths = (GrGLWeightPathsProc) eglGetProcAddress("glWei ghtPathsNV");
368 functions->fCopyPath = (GrGLCopyPathProc) eglGetProcAddress("glCopyPathN V");
369 functions->fInterpolatePaths = (GrGLInterpolatePathsProc) eglGetProcAddr ess("glInterpolatePathsNV");
370 functions->fTransformPath = (GrGLTransformPathProc) eglGetProcAddress("g lTransformPathNV");
371 functions->fPathParameteriv = (GrGLPathParameterivProc) eglGetProcAddres s("glPathParameterivNV");
372 functions->fPathParameteri = (GrGLPathParameteriProc) eglGetProcAddress( "glPathParameteriNV");
373 functions->fPathParameterfv = (GrGLPathParameterfvProc) eglGetProcAddres s("glPathParameterfvNV");
374 functions->fPathParameterf = (GrGLPathParameterfProc) eglGetProcAddress( "glPathParameterfNV");
375 functions->fPathDashArray = (GrGLPathDashArrayProc) eglGetProcAddress("g lPathDashArrayNV");
376 functions->fGenPaths = (GrGLGenPathsProc) eglGetProcAddress("glGenPathsN V");
377 functions->fDeletePaths = (GrGLDeletePathsProc) eglGetProcAddress("glDel etePathsNV");
378 functions->fIsPath = (GrGLIsPathProc) eglGetProcAddress("glIsPathNV");
379 functions->fPathStencilFunc = (GrGLPathStencilFuncProc) eglGetProcAddres s("glPathStencilFuncNV");
380 functions->fPathStencilDepthOffset = (GrGLPathStencilDepthOffsetProc) eg lGetProcAddress("glPathStencilDepthOffsetNV");
381 functions->fStencilFillPath = (GrGLStencilFillPathProc) eglGetProcAddres s("glStencilFillPathNV");
382 functions->fStencilStrokePath = (GrGLStencilStrokePathProc) eglGetProcAd dress("glStencilStrokePathNV");
383 functions->fStencilFillPathInstanced = (GrGLStencilFillPathInstancedProc ) eglGetProcAddress("glStencilFillPathInstancedNV");
384 functions->fStencilStrokePathInstanced = (GrGLStencilStrokePathInstanced Proc) eglGetProcAddress("glStencilStrokePathInstancedNV");
385 functions->fPathCoverDepthFunc = (GrGLPathCoverDepthFuncProc) eglGetProc Address("glPathCoverDepthFuncNV");
386 functions->fPathColorGen = (GrGLPathColorGenProc) eglGetProcAddress("glP athColorGenNV");
387 functions->fPathTexGen = (GrGLPathTexGenProc) eglGetProcAddress("glPathT exGenNV");
388 functions->fPathFogGen = (GrGLPathFogGenProc) eglGetProcAddress("glPathF ogGenNV");
389 functions->fCoverFillPath = (GrGLCoverFillPathProc) eglGetProcAddress("g lCoverFillPathNV");
390 functions->fCoverStrokePath = (GrGLCoverStrokePathProc) eglGetProcAddres s("glCoverStrokePathNV");
391 functions->fCoverFillPathInstanced = (GrGLCoverFillPathInstancedProc) eg lGetProcAddress("glCoverFillPathInstancedNV");
392 functions->fCoverStrokePathInstanced = (GrGLCoverStrokePathInstancedProc ) eglGetProcAddress("glCoverStrokePathInstancedNV");
393 functions->fGetPathParameteriv = (GrGLGetPathParameterivProc) eglGetProc Address("glGetPathParameterivNV");
394 functions->fGetPathParameterfv = (GrGLGetPathParameterfvProc) eglGetProc Address("glGetPathParameterfvNV");
395 functions->fGetPathCommands = (GrGLGetPathCommandsProc) eglGetProcAddres s("glGetPathCommandsNV");
396 functions->fGetPathCoords = (GrGLGetPathCoordsProc) eglGetProcAddress("g lGetPathCoordsNV");
397 functions->fGetPathDashArray = (GrGLGetPathDashArrayProc) eglGetProcAddr ess("glGetPathDashArrayNV");
398 functions->fGetPathMetrics = (GrGLGetPathMetricsProc) eglGetProcAddress( "glGetPathMetricsNV");
399 functions->fGetPathMetricRange = (GrGLGetPathMetricRangeProc) eglGetProc Address("glGetPathMetricRangeNV");
400 functions->fGetPathSpacing = (GrGLGetPathSpacingProc) eglGetProcAddress( "glGetPathSpacingNV");
401 functions->fGetPathColorGeniv = (GrGLGetPathColorGenivProc) eglGetProcAd dress("glGetPathColorGenivNV");
402 functions->fGetPathColorGenfv = (GrGLGetPathColorGenfvProc) eglGetProcAd dress("glGetPathColorGenfvNV");
403 functions->fGetPathTexGeniv = (GrGLGetPathTexGenivProc) eglGetProcAddres s("glGetPathTexGenivNV");
404 functions->fGetPathTexGenfv = (GrGLGetPathTexGenfvProc) eglGetProcAddres s("glGetPathTexGenfvNV");
405 functions->fIsPointInFillPath = (GrGLIsPointInFillPathProc) eglGetProcAd dress("glIsPointInFillPathNV");
406 functions->fIsPointInStrokePath = (GrGLIsPointInStrokePathProc) eglGetPr ocAddress("glIsPointInStrokePathNV");
407 functions->fGetPathLength = (GrGLGetPathLengthProc) eglGetProcAddress("g lGetPathLengthNV");
408 functions->fPointAlongPath = (GrGLPointAlongPathProc) eglGetProcAddress( "glPointAlongPathNV");
409 }
410
411 if (extensions.has("GL_EXT_debug_marker")) {
412 functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAd dress("glInsertEventMarkerEXT");
413 functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddr ess("glPushGroupMarkerEXT");
414 functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress( "glPopGroupMarkerEXT");
415 }
416
417 functions->fInvalidateBufferData = (GrGLInvalidateBufferDataProc) eglGetProc Address("glInvalidateBufferData");
418 functions->fInvalidateBufferSubData = (GrGLInvalidateBufferSubDataProc) eglG etProcAddress("glInvalidateBufferSubData");
419 functions->fInvalidateFramebuffer = (GrGLInvalidateFramebufferProc) eglGetPr ocAddress("glInvalidateFramebuffer");
420 functions->fInvalidateSubFramebuffer = (GrGLInvalidateSubFramebufferProc) eg lGetProcAddress("glInvalidateSubFramebuffer");
421 functions->fInvalidateTexImage = (GrGLInvalidateTexImageProc) eglGetProcAddr ess("glInvalidateTexImage");
422 functions->fInvalidateTexSubImage = (GrGLInvalidateTexSubImageProc) eglGetPr ocAddress("glInvalidateTexSubImage");
423
424 return interface;
425 } 229 }
426 230
427 const GrGLInterface* GrGLCreateNativeInterface() { 231 const GrGLInterface* GrGLCreateNativeInterface() {
428 232
429 GrGLGetStringiProc getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGe tStringi");
430
431 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION )); 233 const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION ));
432 GrGLVersion version = GrGLGetVersionFromString(verStr);
433 GrGLStandard standard = GrGLGetStandardInUseFromString(verStr); 234 GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);
434 235
435 GrGLExtensions extensions; 236 if (kGLES_GrGLStandard == standard) {
436 if (!extensions.init(standard, glGetString, getStringi, glGetIntegerv)) { 237 GrGLVersion version = GrGLGetVersionFromString(verStr);
437 return NULL; 238 GrGLExtensions extensions;
239 GrGLGetStringiProc getStringi = (GrGLGetStringiProc) eglGetProcAddress(" glGetStringi");
240 if (!extensions.init(standard, glGetString, getStringi, glGetIntegerv)) {
241 return NULL;
242 }
243 GrGLInterface* interface = create_es_interface(version, &extensions);
244
245 if (NULL != interface) {
246 interface->fExtensions.swap(&extensions);
247 }
248
249 return interface;
250 } else if (kGL_GrGLStandard == standard) {
251 return create_desktop_interface();
438 } 252 }
439 253
440 GrGLInterface* interface = NULL; 254 return NULL;
441 if (kGLES_GrGLStandard == standard) {
442 interface = create_es_interface(version, &extensions);
443 } else if (kGL_GrGLStandard == standard) {
444 interface = create_desktop_interface(version, extensions);
445 }
446
447 if (NULL != interface) {
448 interface->fExtensions.swap(&extensions);
449 }
450
451 return interface;
452 } 255 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLAssembleInterface.cpp ('k') | src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698