OLD | NEW |
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/GrGLExtensions.h" | 7 #include "gl/GrGLExtensions.h" |
8 #include "gl/GrGLInterface.h" | 8 #include "gl/GrGLInterface.h" |
9 | 9 |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
11 #define GL_GLEXT_PROTOTYPES | 11 #define GL_GLEXT_PROTOTYPES |
12 #endif | 12 #endif |
13 | 13 |
14 #include <GLES2/gl2.h> | 14 #include <GLES2/gl2.h> |
15 #include <GLES2/gl2ext.h> | 15 #include <GLES2/gl2ext.h> |
16 | 16 |
17 #include <EGL/egl.h> | 17 #include <EGL/egl.h> |
18 | 18 |
19 const GrGLInterface* GrGLCreateNativeInterface() { | 19 const GrGLInterface* GrGLCreateNativeInterface() { |
20 static SkAutoTUnref<GrGLInterface> glInterface; | 20 static SkAutoTUnref<GrGLInterface> glInterface; |
21 if (!glInterface.get()) { | 21 if (!glInterface.get()) { |
22 GrGLExtensions extensions; | 22 GrGLExtensions extensions; |
23 if (!extensions.init(kES_GrGLBinding, glGetString, NULL, glGetIntegerv))
{ | 23 GrGLGetStringiProc getStringi; |
| 24 #if GL_ES_VERSION_3_0 |
| 25 getStringi = glGetStringi; |
| 26 #else |
| 27 getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi"); |
| 28 #endif |
| 29 |
| 30 if (!extensions.init(kES_GrGLBinding, glGetString, getStringi, glGetInte
gerv)) { |
24 return NULL; | 31 return NULL; |
25 } | 32 } |
26 GrGLInterface* interface = new GrGLInterface; | 33 GrGLInterface* interface = new GrGLInterface; |
27 glInterface.reset(interface); | 34 glInterface.reset(interface); |
28 interface->fBindingsExported = kES_GrGLBinding; | 35 interface->fBindingsExported = kES_GrGLBinding; |
29 interface->fActiveTexture = glActiveTexture; | 36 interface->fActiveTexture = glActiveTexture; |
30 interface->fAttachShader = glAttachShader; | 37 interface->fAttachShader = glAttachShader; |
31 interface->fBindAttribLocation = glBindAttribLocation; | 38 interface->fBindAttribLocation = glBindAttribLocation; |
32 interface->fBindBuffer = glBindBuffer; | 39 interface->fBindBuffer = glBindBuffer; |
33 interface->fBindTexture = glBindTexture; | 40 interface->fBindTexture = glBindTexture; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 interface->fGenTextures = glGenTextures; | 73 interface->fGenTextures = glGenTextures; |
67 interface->fGenVertexArrays = glGenVertexArraysOES; | 74 interface->fGenVertexArrays = glGenVertexArraysOES; |
68 interface->fGetBufferParameteriv = glGetBufferParameteriv; | 75 interface->fGetBufferParameteriv = glGetBufferParameteriv; |
69 interface->fGetError = glGetError; | 76 interface->fGetError = glGetError; |
70 interface->fGetIntegerv = glGetIntegerv; | 77 interface->fGetIntegerv = glGetIntegerv; |
71 interface->fGetProgramInfoLog = glGetProgramInfoLog; | 78 interface->fGetProgramInfoLog = glGetProgramInfoLog; |
72 interface->fGetProgramiv = glGetProgramiv; | 79 interface->fGetProgramiv = glGetProgramiv; |
73 interface->fGetShaderInfoLog = glGetShaderInfoLog; | 80 interface->fGetShaderInfoLog = glGetShaderInfoLog; |
74 interface->fGetShaderiv = glGetShaderiv; | 81 interface->fGetShaderiv = glGetShaderiv; |
75 interface->fGetString = glGetString; | 82 interface->fGetString = glGetString; |
| 83 interface->fGetStringi = getStringi; // located above |
76 interface->fGetUniformLocation = glGetUniformLocation; | 84 interface->fGetUniformLocation = glGetUniformLocation; |
77 interface->fLineWidth = glLineWidth; | 85 interface->fLineWidth = glLineWidth; |
78 interface->fLinkProgram = glLinkProgram; | 86 interface->fLinkProgram = glLinkProgram; |
79 interface->fPixelStorei = glPixelStorei; | 87 interface->fPixelStorei = glPixelStorei; |
80 interface->fReadPixels = glReadPixels; | 88 interface->fReadPixels = glReadPixels; |
81 interface->fScissor = glScissor; | 89 interface->fScissor = glScissor; |
82 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE | 90 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE |
83 interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource; | 91 interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource; |
84 #else | 92 #else |
85 interface->fShaderSource = glShaderSource; | 93 interface->fShaderSource = glShaderSource; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 interface->fMapBuffer = glMapBufferOES; | 168 interface->fMapBuffer = glMapBufferOES; |
161 interface->fUnmapBuffer = glUnmapBufferOES; | 169 interface->fUnmapBuffer = glUnmapBufferOES; |
162 #else | 170 #else |
163 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff
erOES"); | 171 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff
erOES"); |
164 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm
apBufferOES"); | 172 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm
apBufferOES"); |
165 #endif | 173 #endif |
166 } | 174 } |
167 glInterface.get()->ref(); | 175 glInterface.get()->ref(); |
168 return glInterface.get(); | 176 return glInterface.get(); |
169 } | 177 } |
OLD | NEW |