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/GrGLInterface.h" | 7 #include "gl/GrGLInterface.h" |
8 | 8 |
9 #ifndef GL_GLEXT_PROTOTYPES | 9 #ifndef GL_GLEXT_PROTOTYPES |
10 #define GL_GLEXT_PROTOTYPES | 10 #define GL_GLEXT_PROTOTYPES |
11 #endif | 11 #endif |
12 | 12 |
13 #include <GLES2/gl2.h> | 13 #include <GLES2/gl2.h> |
14 #include <GLES2/gl2ext.h> | 14 #include <GLES2/gl2ext.h> |
15 | 15 |
16 #include <EGL/egl.h> | 16 #include <EGL/egl.h> |
17 | 17 |
18 const GrGLInterface* GrGLCreateNativeInterface() { | 18 const GrGLInterface* GrGLCreateNativeInterface() { |
19 static SkAutoTUnref<GrGLInterface> glInterface; | 19 static SkAutoTUnref<GrGLInterface> glInterface; |
20 if (!glInterface.get()) { | 20 if (!glInterface.get()) { |
21 GrGLInterface* interface = new GrGLInterface; | 21 GrGLInterface* interface = new GrGLInterface; |
22 glInterface.reset(interface); | 22 glInterface.reset(interface); |
23 interface->fBindingsExported = kES2_GrGLBinding; | 23 interface->fBindingsExported = kES2_GrGLBinding; |
24 interface->fActiveTexture = glActiveTexture; | 24 interface->fActiveTexture = glActiveTexture; |
25 interface->fAttachShader = glAttachShader; | 25 interface->fAttachShader = glAttachShader; |
26 interface->fBindAttribLocation = glBindAttribLocation; | 26 interface->fBindAttribLocation = glBindAttribLocation; |
27 interface->fBindBuffer = glBindBuffer; | 27 interface->fBindBuffer = glBindBuffer; |
28 interface->fBindTexture = glBindTexture; | 28 interface->fBindTexture = glBindTexture; |
| 29 interface->fBindVertexArray = glBindVertexArrayOES; |
29 interface->fBlendColor = glBlendColor; | 30 interface->fBlendColor = glBlendColor; |
30 interface->fBlendFunc = glBlendFunc; | 31 interface->fBlendFunc = glBlendFunc; |
31 interface->fBufferData = glBufferData; | 32 interface->fBufferData = glBufferData; |
32 interface->fBufferSubData = glBufferSubData; | 33 interface->fBufferSubData = glBufferSubData; |
33 interface->fClear = glClear; | 34 interface->fClear = glClear; |
34 interface->fClearColor = glClearColor; | 35 interface->fClearColor = glClearColor; |
35 interface->fClearStencil = glClearStencil; | 36 interface->fClearStencil = glClearStencil; |
36 interface->fColorMask = glColorMask; | 37 interface->fColorMask = glColorMask; |
37 interface->fCompileShader = glCompileShader; | 38 interface->fCompileShader = glCompileShader; |
38 interface->fCompressedTexImage2D = glCompressedTexImage2D; | 39 interface->fCompressedTexImage2D = glCompressedTexImage2D; |
39 interface->fCreateProgram = glCreateProgram; | 40 interface->fCreateProgram = glCreateProgram; |
40 interface->fCreateShader = glCreateShader; | 41 interface->fCreateShader = glCreateShader; |
41 interface->fCullFace = glCullFace; | 42 interface->fCullFace = glCullFace; |
42 interface->fDeleteBuffers = glDeleteBuffers; | 43 interface->fDeleteBuffers = glDeleteBuffers; |
43 interface->fDeleteProgram = glDeleteProgram; | 44 interface->fDeleteProgram = glDeleteProgram; |
44 interface->fDeleteShader = glDeleteShader; | 45 interface->fDeleteShader = glDeleteShader; |
45 interface->fDeleteTextures = glDeleteTextures; | 46 interface->fDeleteTextures = glDeleteTextures; |
| 47 interface->fDeleteVertexArrays = glDeleteVertexArraysOES; |
46 interface->fDepthMask = glDepthMask; | 48 interface->fDepthMask = glDepthMask; |
47 interface->fDisable = glDisable; | 49 interface->fDisable = glDisable; |
48 interface->fDisableVertexAttribArray = glDisableVertexAttribArray; | 50 interface->fDisableVertexAttribArray = glDisableVertexAttribArray; |
49 interface->fDrawArrays = glDrawArrays; | 51 interface->fDrawArrays = glDrawArrays; |
50 interface->fDrawElements = glDrawElements; | 52 interface->fDrawElements = glDrawElements; |
51 interface->fEnable = glEnable; | 53 interface->fEnable = glEnable; |
52 interface->fEnableVertexAttribArray = glEnableVertexAttribArray; | 54 interface->fEnableVertexAttribArray = glEnableVertexAttribArray; |
53 interface->fFinish = glFinish; | 55 interface->fFinish = glFinish; |
54 interface->fFlush = glFlush; | 56 interface->fFlush = glFlush; |
55 interface->fFrontFace = glFrontFace; | 57 interface->fFrontFace = glFrontFace; |
56 interface->fGenBuffers = glGenBuffers; | 58 interface->fGenBuffers = glGenBuffers; |
57 interface->fGenTextures = glGenTextures; | 59 interface->fGenTextures = glGenTextures; |
| 60 interface->fGenVertexArrays = glGenVertexArraysOES; |
58 interface->fGetBufferParameteriv = glGetBufferParameteriv; | 61 interface->fGetBufferParameteriv = glGetBufferParameteriv; |
59 interface->fGetError = glGetError; | 62 interface->fGetError = glGetError; |
60 interface->fGetIntegerv = glGetIntegerv; | 63 interface->fGetIntegerv = glGetIntegerv; |
61 interface->fGetProgramInfoLog = glGetProgramInfoLog; | 64 interface->fGetProgramInfoLog = glGetProgramInfoLog; |
62 interface->fGetProgramiv = glGetProgramiv; | 65 interface->fGetProgramiv = glGetProgramiv; |
63 interface->fGetShaderInfoLog = glGetShaderInfoLog; | 66 interface->fGetShaderInfoLog = glGetShaderInfoLog; |
64 interface->fGetShaderiv = glGetShaderiv; | 67 interface->fGetShaderiv = glGetShaderiv; |
65 interface->fGetString = glGetString; | 68 interface->fGetString = glGetString; |
66 interface->fGetUniformLocation = glGetUniformLocation; | 69 interface->fGetUniformLocation = glGetUniformLocation; |
67 interface->fLineWidth = glLineWidth; | 70 interface->fLineWidth = glLineWidth; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 interface->fMapBuffer = glMapBufferOES; | 133 interface->fMapBuffer = glMapBufferOES; |
131 interface->fUnmapBuffer = glUnmapBufferOES; | 134 interface->fUnmapBuffer = glUnmapBufferOES; |
132 #else | 135 #else |
133 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff
erOES"); | 136 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff
erOES"); |
134 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm
apBufferOES"); | 137 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm
apBufferOES"); |
135 #endif | 138 #endif |
136 } | 139 } |
137 glInterface.get()->ref(); | 140 glInterface.get()->ref(); |
138 return glInterface.get(); | 141 return glInterface.get(); |
139 } | 142 } |
OLD | NEW |