OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "gl/GrGLInterface.h" | 10 #include "gl/GrGLInterface.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (!glInterface.get()) { | 37 if (!glInterface.get()) { |
38 GrGLInterface* interface = new GrGLInterface; | 38 GrGLInterface* interface = new GrGLInterface; |
39 glInterface.reset(interface); | 39 glInterface.reset(interface); |
40 interface->fBindingsExported = kES2_GrGLBinding; | 40 interface->fBindingsExported = kES2_GrGLBinding; |
41 | 41 |
42 GR_GET_PROC(GrGLActiveTextureProc, ActiveTexture); | 42 GR_GET_PROC(GrGLActiveTextureProc, ActiveTexture); |
43 GR_GET_PROC(GrGLAttachShaderProc, AttachShader); | 43 GR_GET_PROC(GrGLAttachShaderProc, AttachShader); |
44 GR_GET_PROC(GrGLBindAttribLocationProc, BindAttribLocation); | 44 GR_GET_PROC(GrGLBindAttribLocationProc, BindAttribLocation); |
45 GR_GET_PROC(GrGLBindBufferProc, BindBuffer); | 45 GR_GET_PROC(GrGLBindBufferProc, BindBuffer); |
46 GR_GET_PROC(GrGLBindTextureProc, BindTexture); | 46 GR_GET_PROC(GrGLBindTextureProc, BindTexture); |
| 47 interface->fBindVertexArray = |
| 48 (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES"); |
47 GR_GET_PROC(GrGLBlendColorProc, BlendColor); | 49 GR_GET_PROC(GrGLBlendColorProc, BlendColor); |
48 GR_GET_PROC(GrGLBlendFuncProc, BlendFunc); | 50 GR_GET_PROC(GrGLBlendFuncProc, BlendFunc); |
49 GR_GET_PROC(GrGLBufferDataProc, BufferData); | 51 GR_GET_PROC(GrGLBufferDataProc, BufferData); |
50 GR_GET_PROC(GrGLBufferSubDataProc, BufferSubData); | 52 GR_GET_PROC(GrGLBufferSubDataProc, BufferSubData); |
51 GR_GET_PROC(GrGLClearProc, Clear); | 53 GR_GET_PROC(GrGLClearProc, Clear); |
52 GR_GET_PROC(GrGLClearColorProc, ClearColor); | 54 GR_GET_PROC(GrGLClearColorProc, ClearColor); |
53 GR_GET_PROC(GrGLClearStencilProc, ClearStencil); | 55 GR_GET_PROC(GrGLClearStencilProc, ClearStencil); |
54 GR_GET_PROC(GrGLColorMaskProc, ColorMask); | 56 GR_GET_PROC(GrGLColorMaskProc, ColorMask); |
55 GR_GET_PROC(GrGLCompileShaderProc, CompileShader); | 57 GR_GET_PROC(GrGLCompileShaderProc, CompileShader); |
56 GR_GET_PROC(GrGLCompressedTexImage2DProc, CompressedTexImage2D); | 58 GR_GET_PROC(GrGLCompressedTexImage2DProc, CompressedTexImage2D); |
57 GR_GET_PROC(GrGLCreateProgramProc, CreateProgram); | 59 GR_GET_PROC(GrGLCreateProgramProc, CreateProgram); |
58 GR_GET_PROC(GrGLCreateShaderProc, CreateShader); | 60 GR_GET_PROC(GrGLCreateShaderProc, CreateShader); |
59 GR_GET_PROC(GrGLCullFaceProc, CullFace); | 61 GR_GET_PROC(GrGLCullFaceProc, CullFace); |
60 GR_GET_PROC(GrGLDeleteBuffersProc, DeleteBuffers); | 62 GR_GET_PROC(GrGLDeleteBuffersProc, DeleteBuffers); |
61 GR_GET_PROC(GrGLDeleteProgramProc, DeleteProgram); | 63 GR_GET_PROC(GrGLDeleteProgramProc, DeleteProgram); |
62 GR_GET_PROC(GrGLDeleteShaderProc, DeleteShader); | 64 GR_GET_PROC(GrGLDeleteShaderProc, DeleteShader); |
63 GR_GET_PROC(GrGLDeleteTexturesProc, DeleteTextures); | 65 GR_GET_PROC(GrGLDeleteTexturesProc, DeleteTextures); |
| 66 interface->fDeleteVertexArrays = |
| 67 (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays
OES"); |
64 GR_GET_PROC(GrGLDepthMaskProc, DepthMask); | 68 GR_GET_PROC(GrGLDepthMaskProc, DepthMask); |
65 GR_GET_PROC(GrGLDisableProc, Disable); | 69 GR_GET_PROC(GrGLDisableProc, Disable); |
66 GR_GET_PROC(GrGLDisableVertexAttribArrayProc, DisableVertexAttribArray); | 70 GR_GET_PROC(GrGLDisableVertexAttribArrayProc, DisableVertexAttribArray); |
67 GR_GET_PROC(GrGLDrawArraysProc, DrawArrays); | 71 GR_GET_PROC(GrGLDrawArraysProc, DrawArrays); |
68 GR_GET_PROC(GrGLDrawElementsProc, DrawElements); | 72 GR_GET_PROC(GrGLDrawElementsProc, DrawElements); |
69 GR_GET_PROC(GrGLEnableProc, Enable); | 73 GR_GET_PROC(GrGLEnableProc, Enable); |
70 GR_GET_PROC(GrGLEnableVertexAttribArrayProc, EnableVertexAttribArray); | 74 GR_GET_PROC(GrGLEnableVertexAttribArrayProc, EnableVertexAttribArray); |
71 GR_GET_PROC(GrGLFinishProc, Finish); | 75 GR_GET_PROC(GrGLFinishProc, Finish); |
72 GR_GET_PROC(GrGLFlushProc, Flush); | 76 GR_GET_PROC(GrGLFlushProc, Flush); |
73 GR_GET_PROC(GrGLFrontFaceProc, FrontFace); | 77 GR_GET_PROC(GrGLFrontFaceProc, FrontFace); |
74 GR_GET_PROC(GrGLGenBuffersProc, GenBuffers); | 78 GR_GET_PROC(GrGLGenBuffersProc, GenBuffers); |
75 GR_GET_PROC(GrGLGenTexturesProc, GenTextures); | 79 GR_GET_PROC(GrGLGenTexturesProc, GenTextures); |
| 80 interface->fGenVertexArrays = |
| 81 (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES"); |
76 GR_GET_PROC(GrGLGetBufferParameterivProc, GetBufferParameteriv); | 82 GR_GET_PROC(GrGLGetBufferParameterivProc, GetBufferParameteriv); |
77 GR_GET_PROC(GrGLGetErrorProc, GetError); | 83 GR_GET_PROC(GrGLGetErrorProc, GetError); |
78 GR_GET_PROC(GrGLGetIntegervProc, GetIntegerv); | 84 GR_GET_PROC(GrGLGetIntegervProc, GetIntegerv); |
79 GR_GET_PROC(GrGLGetProgramInfoLogProc, GetProgramInfoLog); | 85 GR_GET_PROC(GrGLGetProgramInfoLogProc, GetProgramInfoLog); |
80 GR_GET_PROC(GrGLGetProgramivProc, GetProgramiv); | 86 GR_GET_PROC(GrGLGetProgramivProc, GetProgramiv); |
81 GR_GET_PROC(GrGLGetShaderInfoLogProc, GetShaderInfoLog); | 87 GR_GET_PROC(GrGLGetShaderInfoLogProc, GetShaderInfoLog); |
82 GR_GET_PROC(GrGLGetShaderivProc, GetShaderiv); | 88 GR_GET_PROC(GrGLGetShaderivProc, GetShaderiv); |
83 GR_GET_PROC(GrGLGetStringProc, GetString); | 89 GR_GET_PROC(GrGLGetStringProc, GetString); |
84 GR_GET_PROC(GrGLGetUniformLocationProc, GetUniformLocation); | 90 GR_GET_PROC(GrGLGetUniformLocationProc, GetUniformLocation); |
85 GR_GET_PROC(GrGLLineWidthProc, LineWidth); | 91 GR_GET_PROC(GrGLLineWidthProc, LineWidth); |
86 GR_GET_PROC(GrGLLinkProgramProc, LinkProgram); | 92 GR_GET_PROC(GrGLLinkProgramProc, LinkProgram); |
87 GR_GET_PROC(GrGLPixelStoreiProc, PixelStorei); | 93 GR_GET_PROC(GrGLPixelStoreiProc, PixelStorei); |
88 GR_GET_PROC(GrGLReadPixelsProc, ReadPixels); | 94 GR_GET_PROC(GrGLReadPixelsProc, ReadPixels); |
89 GR_GET_PROC(GrGLScissorProc, Scissor); | 95 GR_GET_PROC(GrGLScissorProc, Scissor); |
90 GR_GET_PROC(GrGLShaderSourceProc, ShaderSource); | 96 GR_GET_PROC(GrGLShaderSourceProc, ShaderSource); |
91 GR_GET_PROC(GrGLStencilFuncProc, StencilFunc); | 97 GR_GET_PROC(GrGLStencilFuncProc, StencilFunc); |
92 GR_GET_PROC(GrGLStencilFuncSeparateProc, StencilFuncSeparate); | 98 GR_GET_PROC(GrGLStencilFuncSeparateProc, StencilFuncSeparate); |
93 GR_GET_PROC(GrGLStencilMaskProc, StencilMask); | 99 GR_GET_PROC(GrGLStencilMaskProc, StencilMask); |
94 GR_GET_PROC(GrGLStencilMaskSeparateProc, StencilMaskSeparate); | 100 GR_GET_PROC(GrGLStencilMaskSeparateProc, StencilMaskSeparate); |
95 GR_GET_PROC(GrGLStencilOpProc, StencilOp); | 101 GR_GET_PROC(GrGLStencilOpProc, StencilOp); |
96 GR_GET_PROC(GrGLStencilOpSeparateProc, StencilOpSeparate); | 102 GR_GET_PROC(GrGLStencilOpSeparateProc, StencilOpSeparate); |
97 GR_GET_PROC(GrGLTexImage2DProc, TexImage2D); | 103 GR_GET_PROC(GrGLTexImage2DProc, TexImage2D); |
98 GR_GET_PROC(GrGLTexParameteriProc, TexParameteri); | 104 GR_GET_PROC(GrGLTexParameteriProc, TexParameteri); |
99 GR_GET_PROC(GrGLTexParameterivProc, TexParameteriv); | 105 GR_GET_PROC(GrGLTexParameterivProc, TexParameteriv); |
100 GR_GET_PROC(GrGLTexSubImage2DProc, TexSubImage2D); | 106 GR_GET_PROC(GrGLTexSubImage2DProc, TexSubImage2D); |
101 #if GL_ARB_texture_storage | 107 #if GL_ARB_texture_storage |
102 GR_GET_PROC(GrGLTexStorage2DProc, TexStorage2D); | 108 GR_GET_PROC(GrGLTexStorage2DProc, TexStorage2D); |
103 #elif GL_EXT_texture_storage | 109 #elif GL_EXT_texture_storage |
104 interface->fTexStorage2D = (GrGLTexStorage2DProc) | 110 interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glT
exStorage2DEXT"); |
105 GetProcAddress(ghANGLELib, | |
106 "glTexStorage2DEXT"); | |
107 #endif | 111 #endif |
108 GR_GET_PROC(GrGLUniform1fProc, Uniform1f); | 112 GR_GET_PROC(GrGLUniform1fProc, Uniform1f); |
109 GR_GET_PROC(GrGLUniform1iProc, Uniform1i); | 113 GR_GET_PROC(GrGLUniform1iProc, Uniform1i); |
110 GR_GET_PROC(GrGLUniform1fvProc, Uniform1fv); | 114 GR_GET_PROC(GrGLUniform1fvProc, Uniform1fv); |
111 GR_GET_PROC(GrGLUniform1ivProc, Uniform1iv); | 115 GR_GET_PROC(GrGLUniform1ivProc, Uniform1iv); |
112 | 116 |
113 GR_GET_PROC(GrGLUniform2fProc, Uniform2f); | 117 GR_GET_PROC(GrGLUniform2fProc, Uniform2f); |
114 GR_GET_PROC(GrGLUniform2iProc, Uniform2i); | 118 GR_GET_PROC(GrGLUniform2iProc, Uniform2i); |
115 GR_GET_PROC(GrGLUniform2fvProc, Uniform2fv); | 119 GR_GET_PROC(GrGLUniform2fvProc, Uniform2fv); |
116 GR_GET_PROC(GrGLUniform2ivProc, Uniform2iv); | 120 GR_GET_PROC(GrGLUniform2ivProc, Uniform2iv); |
(...skipping 23 matching lines...) Expand all Loading... |
140 GR_GET_PROC(GrGLFramebufferRenderbufferProc, FramebufferRenderbuffer); | 144 GR_GET_PROC(GrGLFramebufferRenderbufferProc, FramebufferRenderbuffer); |
141 GR_GET_PROC(GrGLFramebufferTexture2DProc, FramebufferTexture2D); | 145 GR_GET_PROC(GrGLFramebufferTexture2DProc, FramebufferTexture2D); |
142 GR_GET_PROC(GrGLGenFramebuffersProc, GenFramebuffers); | 146 GR_GET_PROC(GrGLGenFramebuffersProc, GenFramebuffers); |
143 GR_GET_PROC(GrGLGenRenderbuffersProc, GenRenderbuffers); | 147 GR_GET_PROC(GrGLGenRenderbuffersProc, GenRenderbuffers); |
144 GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc, | 148 GR_GET_PROC(GrGLGetFramebufferAttachmentParameterivProc, |
145 GetFramebufferAttachmentParameteriv); | 149 GetFramebufferAttachmentParameteriv); |
146 GR_GET_PROC(GrGLGetRenderbufferParameterivProc, | 150 GR_GET_PROC(GrGLGetRenderbufferParameterivProc, |
147 GetRenderbufferParameteriv); | 151 GetRenderbufferParameteriv); |
148 GR_GET_PROC(GrGLRenderbufferStorageProc, RenderbufferStorage); | 152 GR_GET_PROC(GrGLRenderbufferStorageProc, RenderbufferStorage); |
149 | 153 |
150 interface->fMapBuffer = (PFNGLMAPBUFFEROESPROC) eglGetProcAddress("glMap
BufferOES"); | 154 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuff
erOES"); |
151 interface->fUnmapBuffer = (PFNGLUNMAPBUFFEROESPROC) eglGetProcAddress("g
lUnmapBufferOES"); | 155 interface->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnm
apBufferOES"); |
152 } | 156 } |
153 glInterface.get()->ref(); | 157 glInterface.get()->ref(); |
154 return glInterface.get(); | 158 return glInterface.get(); |
155 } | 159 } |
OLD | NEW |