commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | |
bsalomon | 062bd86 | 2016-03-31 10:22:20 -0700 | [diff] [blame] | 9 | #include "gl/GrGLAssembleInterface.h" |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 10 | #include "GrGLUtil.h" |
| 11 | |
| 12 | #define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F) |
| 13 | #define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F #S) |
| 14 | #define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl" #F) |
| 15 | |
bsalomon | 7ea33f5 | 2015-11-22 14:51:00 -0800 | [diff] [blame] | 16 | #define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL ## F = (GrEGL ## F ## Proc) get(ctx, "egl" #F #S) |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 17 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 18 | const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) { |
| 19 | GET_PROC_LOCAL(GetString); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 20 | if (nullptr == GetString) { |
| 21 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION)); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 25 | if (nullptr == verStr) { |
| 26 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | GrGLStandard standard = GrGLGetStandardInUseFromString(verStr); |
| 30 | |
| 31 | if (kGLES_GrGLStandard == standard) { |
| 32 | return GrGLAssembleGLESInterface(ctx, get); |
| 33 | } else if (kGL_GrGLStandard == standard) { |
| 34 | return GrGLAssembleGLInterface(ctx, get); |
| 35 | } |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 36 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 37 | } |
| 38 | |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 39 | static void get_egl_query_and_display(GrEGLQueryStringProc* queryString, GrEGLDisplay* display, |
| 40 | void* ctx, GrGLGetProc get) { |
| 41 | *queryString = (GrEGLQueryStringProc) get(ctx, "eglQueryString"); |
| 42 | *display = GR_EGL_NO_DISPLAY; |
| 43 | if (*queryString) { |
| 44 | GrEGLGetCurrentDisplayProc getCurrentDisplay = |
| 45 | (GrEGLGetCurrentDisplayProc) get(ctx, "eglGetCurrentDisplay"); |
| 46 | if (getCurrentDisplay) { |
| 47 | *display = getCurrentDisplay(); |
| 48 | } else { |
| 49 | *queryString = nullptr; |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 54 | const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { |
| 55 | GET_PROC_LOCAL(GetString); |
| 56 | GET_PROC_LOCAL(GetStringi); |
| 57 | GET_PROC_LOCAL(GetIntegerv); |
| 58 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 59 | // GetStringi may be nullptr depending on the GL version. |
| 60 | if (nullptr == GetString || nullptr == GetIntegerv) { |
| 61 | return nullptr; |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | const char* versionString = (const char*) GetString(GR_GL_VERSION); |
| 65 | GrGLVersion glVer = GrGLGetVersionFromString(versionString); |
| 66 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 67 | if (glVer < GR_GL_VER(2,0) || GR_GL_INVALID_VER == glVer) { |
| 68 | // This is our minimum for non-ES GL. |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 69 | return nullptr; |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 70 | } |
| 71 | |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 72 | GrEGLQueryStringProc queryString; |
| 73 | GrEGLDisplay display; |
| 74 | get_egl_query_and_display(&queryString, &display, ctx, get); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 75 | GrGLExtensions extensions; |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 76 | if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString, |
| 77 | display)) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 78 | return nullptr; |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 79 | } |
| 80 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 81 | GrGLInterface* interface = new GrGLInterface(); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 82 | GrGLInterface::Functions* functions = &interface->fFunctions; |
| 83 | |
| 84 | GET_PROC(ActiveTexture); |
| 85 | GET_PROC(AttachShader); |
| 86 | GET_PROC(BindAttribLocation); |
| 87 | GET_PROC(BindBuffer); |
| 88 | if (glVer >= GR_GL_VER(3,0)) { |
| 89 | GET_PROC(BindFragDataLocation); |
| 90 | } |
| 91 | GET_PROC(BeginQuery); |
| 92 | GET_PROC(BindTexture); |
tomhudson | 2575f31 | 2015-04-21 14:16:53 -0700 | [diff] [blame] | 93 | |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 94 | if (extensions.has("GL_KHR_blend_equation_advanced")) { |
| 95 | GET_PROC_SUFFIX(BlendBarrier, KHR); |
| 96 | } else if (extensions.has("GL_NV_blend_equation_advanced")) { |
| 97 | GET_PROC_SUFFIX(BlendBarrier, NV); |
tomhudson | 2575f31 | 2015-04-21 14:16:53 -0700 | [diff] [blame] | 98 | } |
| 99 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 100 | GET_PROC(BlendColor); |
| 101 | GET_PROC(BlendEquation); |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 102 | GET_PROC(BlendFunc); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 103 | GET_PROC(BufferData); |
| 104 | GET_PROC(BufferSubData); |
| 105 | GET_PROC(Clear); |
| 106 | GET_PROC(ClearColor); |
| 107 | GET_PROC(ClearStencil); |
Brian Salomon | d17b4a6 | 2017-05-23 16:53:47 -0400 | [diff] [blame] | 108 | if (glVer >= GR_GL_VER(4,4) || extensions.has("GL_ARB_clear_texture")) { |
| 109 | GET_PROC(ClearTexImage); |
| 110 | GET_PROC(ClearTexSubImage); |
| 111 | } |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 112 | GET_PROC(ColorMask); |
| 113 | GET_PROC(CompileShader); |
| 114 | GET_PROC(CompressedTexImage2D); |
krajcevski | 37d20f7 | 2014-06-11 10:38:47 -0700 | [diff] [blame] | 115 | GET_PROC(CompressedTexSubImage2D); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 116 | GET_PROC(CopyTexSubImage2D); |
| 117 | GET_PROC(CreateProgram); |
| 118 | GET_PROC(CreateShader); |
| 119 | GET_PROC(CullFace); |
| 120 | GET_PROC(DeleteBuffers); |
| 121 | GET_PROC(DeleteProgram); |
| 122 | GET_PROC(DeleteQueries); |
| 123 | GET_PROC(DeleteShader); |
| 124 | GET_PROC(DeleteTextures); |
| 125 | GET_PROC(DepthMask); |
| 126 | GET_PROC(Disable); |
| 127 | GET_PROC(DisableVertexAttribArray); |
| 128 | GET_PROC(DrawArrays); |
| 129 | GET_PROC(DrawBuffer); |
| 130 | GET_PROC(DrawBuffers); |
| 131 | GET_PROC(DrawElements); |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 132 | |
| 133 | if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced") || |
| 134 | extensions.has("GL_EXT_draw_instanced")) { |
| 135 | GET_PROC(DrawArraysInstanced); |
| 136 | GET_PROC(DrawElementsInstanced); |
| 137 | } |
| 138 | |
csmartdalton | 5cebf8c | 2016-06-03 08:28:47 -0700 | [diff] [blame] | 139 | if (glVer >= GR_GL_VER(4,0) || extensions.has("GL_ARB_draw_indirect")) { |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 140 | GET_PROC(DrawArraysIndirect); |
| 141 | GET_PROC(DrawElementsIndirect); |
| 142 | } |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 143 | GET_PROC(DrawRangeElements); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 144 | GET_PROC(Enable); |
| 145 | GET_PROC(EnableVertexAttribArray); |
| 146 | GET_PROC(EndQuery); |
| 147 | GET_PROC(Finish); |
| 148 | GET_PROC(Flush); |
| 149 | GET_PROC(FrontFace); |
| 150 | GET_PROC(GenBuffers); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 151 | GET_PROC(GetBufferParameteriv); |
| 152 | GET_PROC(GetError); |
| 153 | GET_PROC(GetIntegerv); |
cdalton | eb79eea | 2016-02-26 10:39:34 -0800 | [diff] [blame] | 154 | if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_texture_multisample")) { |
| 155 | GET_PROC(GetMultisamplefv); |
| 156 | } |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 157 | GET_PROC(GetQueryObjectiv); |
| 158 | GET_PROC(GetQueryObjectuiv); |
| 159 | if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { |
| 160 | GET_PROC(GetQueryObjecti64v); |
| 161 | GET_PROC(GetQueryObjectui64v); |
| 162 | GET_PROC(QueryCounter); |
| 163 | } else if (extensions.has("GL_EXT_timer_query")) { |
| 164 | GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); |
| 165 | GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); |
| 166 | } |
| 167 | GET_PROC(GetQueryiv); |
| 168 | GET_PROC(GetProgramInfoLog); |
| 169 | GET_PROC(GetProgramiv); |
| 170 | GET_PROC(GetShaderInfoLog); |
| 171 | GET_PROC(GetShaderiv); |
| 172 | GET_PROC(GetString); |
| 173 | GET_PROC(GetStringi); |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 174 | GET_PROC(GetShaderPrecisionFormat); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 175 | GET_PROC(GetTexLevelParameteriv); |
| 176 | GET_PROC(GenQueries); |
| 177 | GET_PROC(GenTextures); |
| 178 | GET_PROC(GetUniformLocation); |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame] | 179 | GET_PROC(IsTexture); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 180 | GET_PROC(LineWidth); |
| 181 | GET_PROC(LinkProgram); |
| 182 | GET_PROC(MapBuffer); |
csmartdalton | 5cebf8c | 2016-06-03 08:28:47 -0700 | [diff] [blame] | 183 | |
| 184 | if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_multi_draw_indirect")) { |
| 185 | GET_PROC(MultiDrawArraysIndirect); |
| 186 | GET_PROC(MultiDrawElementsIndirect); |
| 187 | } |
| 188 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 189 | GET_PROC(PixelStorei); |
Jim Van Verth | 609e7cc | 2017-03-30 14:28:08 -0400 | [diff] [blame] | 190 | GET_PROC(PolygonMode); |
cdalton | 0edea2c | 2015-05-21 08:27:44 -0700 | [diff] [blame] | 191 | if (extensions.has("GL_EXT_raster_multisample")) { |
| 192 | GET_PROC_SUFFIX(RasterSamples, EXT); |
| 193 | } |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 194 | GET_PROC(ReadBuffer); |
| 195 | GET_PROC(ReadPixels); |
| 196 | GET_PROC(Scissor); |
| 197 | GET_PROC(ShaderSource); |
| 198 | GET_PROC(StencilFunc); |
| 199 | GET_PROC(StencilFuncSeparate); |
| 200 | GET_PROC(StencilMask); |
| 201 | GET_PROC(StencilMaskSeparate); |
| 202 | GET_PROC(StencilOp); |
| 203 | GET_PROC(StencilOpSeparate); |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 204 | if (glVer >= GR_GL_VER(3,1)) { |
| 205 | GET_PROC(TexBuffer); |
| 206 | } |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 207 | if (glVer >= GR_GL_VER(4,3)) { |
| 208 | GET_PROC(TexBufferRange); |
| 209 | } |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 210 | GET_PROC(TexImage2D); |
| 211 | GET_PROC(TexParameteri); |
| 212 | GET_PROC(TexParameteriv); |
| 213 | if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { |
| 214 | GET_PROC(TexStorage2D); |
| 215 | } else if (extensions.has("GL_EXT_texture_storage")) { |
| 216 | GET_PROC_SUFFIX(TexStorage2D, EXT); |
| 217 | } |
| 218 | GET_PROC(TexSubImage2D); |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 219 | if (glVer >= GR_GL_VER(4,5) || extensions.has("GL_ARB_texture_barrier")) { |
| 220 | GET_PROC(TextureBarrier); |
| 221 | } else if (extensions.has("GL_NV_texture_barrier")) { |
| 222 | GET_PROC_SUFFIX(TextureBarrier, NV); |
| 223 | } |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 224 | GET_PROC(Uniform1f); |
| 225 | GET_PROC(Uniform1i); |
| 226 | GET_PROC(Uniform1fv); |
| 227 | GET_PROC(Uniform1iv); |
| 228 | GET_PROC(Uniform2f); |
| 229 | GET_PROC(Uniform2i); |
| 230 | GET_PROC(Uniform2fv); |
| 231 | GET_PROC(Uniform2iv); |
| 232 | GET_PROC(Uniform3f); |
| 233 | GET_PROC(Uniform3i); |
| 234 | GET_PROC(Uniform3fv); |
| 235 | GET_PROC(Uniform3iv); |
| 236 | GET_PROC(Uniform4f); |
| 237 | GET_PROC(Uniform4i); |
| 238 | GET_PROC(Uniform4fv); |
| 239 | GET_PROC(Uniform4iv); |
| 240 | GET_PROC(UniformMatrix2fv); |
| 241 | GET_PROC(UniformMatrix3fv); |
| 242 | GET_PROC(UniformMatrix4fv); |
| 243 | GET_PROC(UnmapBuffer); |
| 244 | GET_PROC(UseProgram); |
egdaniel | 27c1521 | 2014-10-24 15:00:50 -0700 | [diff] [blame] | 245 | GET_PROC(VertexAttrib1f); |
| 246 | GET_PROC(VertexAttrib2fv); |
| 247 | GET_PROC(VertexAttrib3fv); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 248 | GET_PROC(VertexAttrib4fv); |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 249 | |
| 250 | if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_instanced_arrays")) { |
| 251 | GET_PROC(VertexAttribDivisor); |
| 252 | } |
| 253 | |
cdalton | 793dc26 | 2016-02-08 10:11:47 -0800 | [diff] [blame] | 254 | if (glVer >= GR_GL_VER(3,0)) { |
| 255 | GET_PROC(VertexAttribIPointer); |
| 256 | } |
| 257 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 258 | GET_PROC(VertexAttribPointer); |
| 259 | GET_PROC(Viewport); |
| 260 | GET_PROC(BindFragDataLocationIndexed); |
| 261 | |
| 262 | if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) { |
| 263 | // no ARB suffix for GL_ARB_vertex_array_object |
| 264 | GET_PROC(BindVertexArray); |
| 265 | GET_PROC(GenVertexArrays); |
| 266 | GET_PROC(DeleteVertexArrays); |
tomhudson | 612e926 | 2014-11-24 11:22:36 -0800 | [diff] [blame] | 267 | } else if (extensions.has("GL_APPLE_vertex_array_object")) { |
| 268 | GET_PROC_SUFFIX(BindVertexArray, APPLE); |
| 269 | GET_PROC_SUFFIX(GenVertexArrays, APPLE); |
| 270 | GET_PROC_SUFFIX(DeleteVertexArrays, APPLE); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 271 | } |
| 272 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 273 | if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_map_buffer_range")) { |
| 274 | GET_PROC(MapBufferRange); |
| 275 | GET_PROC(FlushMappedBufferRange); |
| 276 | } |
| 277 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 278 | // First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since |
| 279 | // GL_ARB_framebuffer_object doesn't use ARB suffix.) |
| 280 | if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) { |
Brian Salomon | 85f58b5 | 2017-01-20 16:34:15 -0500 | [diff] [blame] | 281 | GET_PROC(GenerateMipmap); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 282 | GET_PROC(GenFramebuffers); |
| 283 | GET_PROC(GetFramebufferAttachmentParameteriv); |
| 284 | GET_PROC(GetRenderbufferParameteriv); |
| 285 | GET_PROC(BindFramebuffer); |
| 286 | GET_PROC(FramebufferTexture2D); |
| 287 | GET_PROC(CheckFramebufferStatus); |
| 288 | GET_PROC(DeleteFramebuffers); |
| 289 | GET_PROC(RenderbufferStorage); |
| 290 | GET_PROC(GenRenderbuffers); |
| 291 | GET_PROC(DeleteRenderbuffers); |
| 292 | GET_PROC(FramebufferRenderbuffer); |
| 293 | GET_PROC(BindRenderbuffer); |
| 294 | GET_PROC(RenderbufferStorageMultisample); |
| 295 | GET_PROC(BlitFramebuffer); |
| 296 | } else if (extensions.has("GL_EXT_framebuffer_object")) { |
Brian Salomon | 85f58b5 | 2017-01-20 16:34:15 -0500 | [diff] [blame] | 297 | GET_PROC_SUFFIX(GenerateMipmap, EXT); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 298 | GET_PROC_SUFFIX(GenFramebuffers, EXT); |
| 299 | GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT); |
| 300 | GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT); |
| 301 | GET_PROC_SUFFIX(BindFramebuffer, EXT); |
| 302 | GET_PROC_SUFFIX(FramebufferTexture2D, EXT); |
| 303 | GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); |
| 304 | GET_PROC_SUFFIX(DeleteFramebuffers, EXT); |
| 305 | GET_PROC_SUFFIX(RenderbufferStorage, EXT); |
| 306 | GET_PROC_SUFFIX(GenRenderbuffers, EXT); |
| 307 | GET_PROC_SUFFIX(DeleteRenderbuffers, EXT); |
| 308 | GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT); |
| 309 | GET_PROC_SUFFIX(BindRenderbuffer, EXT); |
| 310 | if (extensions.has("GL_EXT_framebuffer_multisample")) { |
| 311 | GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT); |
| 312 | } |
| 313 | if (extensions.has("GL_EXT_framebuffer_blit")) { |
| 314 | GET_PROC_SUFFIX(BlitFramebuffer, EXT); |
| 315 | } |
| 316 | } else { |
| 317 | // we must have FBOs |
| 318 | delete interface; |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 319 | return nullptr; |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | if (extensions.has("GL_NV_path_rendering")) { |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 323 | GET_PROC_SUFFIX(MatrixLoadf, EXT); |
| 324 | GET_PROC_SUFFIX(MatrixLoadIdentity, EXT); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 325 | GET_PROC_SUFFIX(PathCommands, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 326 | GET_PROC_SUFFIX(PathParameteri, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 327 | GET_PROC_SUFFIX(PathParameterf, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 328 | GET_PROC_SUFFIX(GenPaths, NV); |
| 329 | GET_PROC_SUFFIX(DeletePaths, NV); |
cdalton | 8dd90cb | 2014-07-17 09:28:36 -0700 | [diff] [blame] | 330 | GET_PROC_SUFFIX(IsPath, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 331 | GET_PROC_SUFFIX(PathStencilFunc, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 332 | GET_PROC_SUFFIX(StencilFillPath, NV); |
| 333 | GET_PROC_SUFFIX(StencilStrokePath, NV); |
| 334 | GET_PROC_SUFFIX(StencilFillPathInstanced, NV); |
| 335 | GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 336 | GET_PROC_SUFFIX(CoverFillPath, NV); |
| 337 | GET_PROC_SUFFIX(CoverStrokePath, NV); |
| 338 | GET_PROC_SUFFIX(CoverFillPathInstanced, NV); |
| 339 | GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); |
cdalton | c8f5204 | 2014-07-29 15:25:51 -0700 | [diff] [blame] | 340 | GET_PROC_SUFFIX(StencilThenCoverFillPath, NV); |
| 341 | GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV); |
| 342 | GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV); |
| 343 | GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV); |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 344 | GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 345 | } |
| 346 | |
vbuzinov | 08b4d29 | 2015-04-01 06:29:49 -0700 | [diff] [blame] | 347 | if (extensions.has("GL_NV_framebuffer_mixed_samples")) { |
| 348 | GET_PROC_SUFFIX(CoverageModulation, NV); |
| 349 | } |
| 350 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 351 | if (extensions.has("GL_EXT_debug_marker")) { |
| 352 | GET_PROC_SUFFIX(InsertEventMarker, EXT); |
| 353 | GET_PROC_SUFFIX(PushGroupMarker, EXT); |
| 354 | GET_PROC_SUFFIX(PopGroupMarker, EXT); |
| 355 | } |
| 356 | |
| 357 | if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) { |
| 358 | GET_PROC(InvalidateBufferData); |
| 359 | GET_PROC(InvalidateBufferSubData); |
| 360 | GET_PROC(InvalidateFramebuffer); |
| 361 | GET_PROC(InvalidateSubFramebuffer); |
| 362 | GET_PROC(InvalidateTexImage); |
| 363 | GET_PROC(InvalidateTexSubImage); |
| 364 | } |
| 365 | |
kkinnunen | 32b9a3b | 2014-07-02 22:56:35 -0700 | [diff] [blame] | 366 | if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_program_interface_query")) { |
| 367 | GET_PROC(GetProgramResourceLocation); |
| 368 | } |
| 369 | |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 370 | if (extensions.has("GL_NV_bindless_texture")) { |
| 371 | GET_PROC_SUFFIX(GetTextureHandle, NV); |
| 372 | GET_PROC_SUFFIX(GetTextureSamplerHandle, NV); |
| 373 | GET_PROC_SUFFIX(MakeTextureHandleResident, NV); |
| 374 | GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV); |
| 375 | GET_PROC_SUFFIX(GetImageHandle, NV); |
| 376 | GET_PROC_SUFFIX(MakeImageHandleResident, NV); |
| 377 | GET_PROC_SUFFIX(MakeImageHandleNonResident, NV); |
| 378 | GET_PROC_SUFFIX(IsTextureHandleResident, NV); |
| 379 | GET_PROC_SUFFIX(IsImageHandleResident, NV); |
| 380 | GET_PROC_SUFFIX(UniformHandleui64, NV); |
| 381 | GET_PROC_SUFFIX(UniformHandleui64v, NV); |
| 382 | GET_PROC_SUFFIX(ProgramUniformHandleui64, NV); |
| 383 | GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV); |
| 384 | } |
| 385 | |
| 386 | if (extensions.has("GL_EXT_direct_state_access")) { |
| 387 | GET_PROC_SUFFIX(TextureParameteri, EXT); |
| 388 | GET_PROC_SUFFIX(TextureParameteriv, EXT); |
| 389 | GET_PROC_SUFFIX(TextureParameterf, EXT); |
| 390 | GET_PROC_SUFFIX(TextureParameterfv, EXT); |
| 391 | GET_PROC_SUFFIX(TextureImage1D, EXT); |
| 392 | GET_PROC_SUFFIX(TextureImage2D, EXT); |
| 393 | GET_PROC_SUFFIX(TextureSubImage1D, EXT); |
| 394 | GET_PROC_SUFFIX(TextureSubImage2D, EXT); |
| 395 | GET_PROC_SUFFIX(CopyTextureImage1D, EXT); |
| 396 | GET_PROC_SUFFIX(CopyTextureImage2D, EXT); |
| 397 | GET_PROC_SUFFIX(CopyTextureSubImage1D, EXT); |
| 398 | GET_PROC_SUFFIX(CopyTextureSubImage2D, EXT); |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 399 | GET_PROC_SUFFIX(GetNamedBufferParameteriv, EXT); |
| 400 | GET_PROC_SUFFIX(GetNamedBufferPointerv, EXT); |
| 401 | GET_PROC_SUFFIX(GetNamedBufferSubData, EXT); |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 402 | GET_PROC_SUFFIX(GetTextureImage, EXT); |
| 403 | GET_PROC_SUFFIX(GetTextureParameterfv, EXT); |
| 404 | GET_PROC_SUFFIX(GetTextureParameteriv, EXT); |
| 405 | GET_PROC_SUFFIX(GetTextureLevelParameterfv, EXT); |
| 406 | GET_PROC_SUFFIX(GetTextureLevelParameteriv, EXT); |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 407 | GET_PROC_SUFFIX(MapNamedBuffer, EXT); |
| 408 | GET_PROC_SUFFIX(NamedBufferData, EXT); |
| 409 | GET_PROC_SUFFIX(NamedBufferSubData, EXT); |
| 410 | GET_PROC_SUFFIX(ProgramUniform1f, EXT); |
| 411 | GET_PROC_SUFFIX(ProgramUniform2f, EXT); |
| 412 | GET_PROC_SUFFIX(ProgramUniform3f, EXT); |
| 413 | GET_PROC_SUFFIX(ProgramUniform4f, EXT); |
| 414 | GET_PROC_SUFFIX(ProgramUniform1i, EXT); |
| 415 | GET_PROC_SUFFIX(ProgramUniform2i, EXT); |
| 416 | GET_PROC_SUFFIX(ProgramUniform3i, EXT); |
| 417 | GET_PROC_SUFFIX(ProgramUniform4i, EXT); |
| 418 | GET_PROC_SUFFIX(ProgramUniform1fv, EXT); |
| 419 | GET_PROC_SUFFIX(ProgramUniform2fv, EXT); |
| 420 | GET_PROC_SUFFIX(ProgramUniform3fv, EXT); |
| 421 | GET_PROC_SUFFIX(ProgramUniform4fv, EXT); |
| 422 | GET_PROC_SUFFIX(ProgramUniform1iv, EXT); |
| 423 | GET_PROC_SUFFIX(ProgramUniform2iv, EXT); |
| 424 | GET_PROC_SUFFIX(ProgramUniform3iv, EXT); |
| 425 | GET_PROC_SUFFIX(ProgramUniform4iv, EXT); |
| 426 | GET_PROC_SUFFIX(ProgramUniformMatrix2fv, EXT); |
| 427 | GET_PROC_SUFFIX(ProgramUniformMatrix3fv, EXT); |
| 428 | GET_PROC_SUFFIX(ProgramUniformMatrix4fv, EXT); |
| 429 | GET_PROC_SUFFIX(UnmapNamedBuffer, EXT); |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 430 | if (glVer >= GR_GL_VER(1,2)) { |
| 431 | GET_PROC_SUFFIX(TextureImage3D, EXT); |
| 432 | GET_PROC_SUFFIX(TextureSubImage3D, EXT); |
| 433 | GET_PROC_SUFFIX(CopyTextureSubImage3D, EXT); |
| 434 | GET_PROC_SUFFIX(CompressedTextureImage3D, EXT); |
| 435 | GET_PROC_SUFFIX(CompressedTextureImage2D, EXT); |
| 436 | GET_PROC_SUFFIX(CompressedTextureImage1D, EXT); |
| 437 | GET_PROC_SUFFIX(CompressedTextureSubImage3D, EXT); |
| 438 | GET_PROC_SUFFIX(CompressedTextureSubImage2D, EXT); |
| 439 | GET_PROC_SUFFIX(CompressedTextureSubImage1D, EXT); |
| 440 | GET_PROC_SUFFIX(GetCompressedTextureImage, EXT); |
| 441 | } |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 442 | if (glVer >= GR_GL_VER(2,1)) { |
| 443 | GET_PROC_SUFFIX(ProgramUniformMatrix2x3fv, EXT); |
| 444 | GET_PROC_SUFFIX(ProgramUniformMatrix3x2fv, EXT); |
| 445 | GET_PROC_SUFFIX(ProgramUniformMatrix2x4fv, EXT); |
| 446 | GET_PROC_SUFFIX(ProgramUniformMatrix4x2fv, EXT); |
| 447 | GET_PROC_SUFFIX(ProgramUniformMatrix3x4fv, EXT); |
| 448 | GET_PROC_SUFFIX(ProgramUniformMatrix4x3fv, EXT); |
| 449 | } |
| 450 | if (glVer >= GR_GL_VER(3,0)) { |
| 451 | GET_PROC_SUFFIX(NamedRenderbufferStorage, EXT); |
| 452 | GET_PROC_SUFFIX(GetNamedRenderbufferParameteriv, EXT); |
| 453 | GET_PROC_SUFFIX(NamedRenderbufferStorageMultisample, EXT); |
| 454 | GET_PROC_SUFFIX(CheckNamedFramebufferStatus, EXT); |
| 455 | GET_PROC_SUFFIX(NamedFramebufferTexture1D, EXT); |
| 456 | GET_PROC_SUFFIX(NamedFramebufferTexture2D, EXT); |
| 457 | GET_PROC_SUFFIX(NamedFramebufferTexture3D, EXT); |
| 458 | GET_PROC_SUFFIX(NamedFramebufferRenderbuffer, EXT); |
| 459 | GET_PROC_SUFFIX(GetNamedFramebufferAttachmentParameteriv, EXT); |
| 460 | GET_PROC_SUFFIX(GenerateTextureMipmap, EXT); |
| 461 | GET_PROC_SUFFIX(FramebufferDrawBuffer, EXT); |
| 462 | GET_PROC_SUFFIX(FramebufferDrawBuffers, EXT); |
| 463 | GET_PROC_SUFFIX(FramebufferReadBuffer, EXT); |
| 464 | GET_PROC_SUFFIX(GetFramebufferParameteriv, EXT); |
| 465 | GET_PROC_SUFFIX(NamedCopyBufferSubData, EXT); |
| 466 | GET_PROC_SUFFIX(VertexArrayVertexOffset, EXT); |
| 467 | GET_PROC_SUFFIX(VertexArrayColorOffset, EXT); |
| 468 | GET_PROC_SUFFIX(VertexArrayEdgeFlagOffset, EXT); |
| 469 | GET_PROC_SUFFIX(VertexArrayIndexOffset, EXT); |
| 470 | GET_PROC_SUFFIX(VertexArrayNormalOffset, EXT); |
| 471 | GET_PROC_SUFFIX(VertexArrayTexCoordOffset, EXT); |
| 472 | GET_PROC_SUFFIX(VertexArrayMultiTexCoordOffset, EXT); |
| 473 | GET_PROC_SUFFIX(VertexArrayFogCoordOffset, EXT); |
| 474 | GET_PROC_SUFFIX(VertexArraySecondaryColorOffset, EXT); |
| 475 | GET_PROC_SUFFIX(VertexArrayVertexAttribOffset, EXT); |
| 476 | GET_PROC_SUFFIX(VertexArrayVertexAttribIOffset, EXT); |
| 477 | GET_PROC_SUFFIX(EnableVertexArray, EXT); |
| 478 | GET_PROC_SUFFIX(DisableVertexArray, EXT); |
| 479 | GET_PROC_SUFFIX(EnableVertexArrayAttrib, EXT); |
| 480 | GET_PROC_SUFFIX(DisableVertexArrayAttrib, EXT); |
| 481 | GET_PROC_SUFFIX(GetVertexArrayIntegerv, EXT); |
| 482 | GET_PROC_SUFFIX(GetVertexArrayPointerv, EXT); |
| 483 | GET_PROC_SUFFIX(GetVertexArrayIntegeri_v, EXT); |
| 484 | GET_PROC_SUFFIX(GetVertexArrayPointeri_v, EXT); |
| 485 | GET_PROC_SUFFIX(MapNamedBufferRange, EXT); |
| 486 | GET_PROC_SUFFIX(FlushMappedNamedBufferRange, EXT); |
| 487 | } |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 488 | if (glVer >= GR_GL_VER(3,1)) { |
| 489 | GET_PROC_SUFFIX(TextureBuffer, EXT); |
| 490 | } |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 491 | } |
| 492 | |
| 493 | if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_KHR_debug")) { |
| 494 | // KHR_debug defines these methods to have no suffix in an OpenGL (not ES) context. |
| 495 | GET_PROC(DebugMessageControl); |
| 496 | GET_PROC(DebugMessageInsert); |
| 497 | GET_PROC(DebugMessageCallback); |
| 498 | GET_PROC(GetDebugMessageLog); |
| 499 | GET_PROC(PushDebugGroup); |
| 500 | GET_PROC(PopDebugGroup); |
| 501 | GET_PROC(ObjectLabel); |
| 502 | } |
| 503 | |
csmartdalton | 9bc1187 | 2016-08-09 12:42:47 -0700 | [diff] [blame] | 504 | if (extensions.has("GL_EXT_window_rectangles")) { |
| 505 | GET_PROC_SUFFIX(WindowRectangles, EXT); |
| 506 | } |
| 507 | |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 508 | if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) { |
| 509 | GET_EGL_PROC_SUFFIX(CreateImage, KHR); |
| 510 | GET_EGL_PROC_SUFFIX(DestroyImage, KHR); |
| 511 | } |
| 512 | |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 513 | if (glVer >= GR_GL_VER(4, 0) || extensions.has("GL_ARB_sample_shading")) { |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 514 | GET_PROC(MinSampleShading); |
| 515 | } |
| 516 | |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 517 | if (glVer >= GR_GL_VER(3, 2) || extensions.has("GL_ARB_sync")) { |
| 518 | GET_PROC(FenceSync); |
Greg Daniel | dba7e7c | 2017-07-20 15:47:30 -0400 | [diff] [blame] | 519 | GET_PROC(IsSync); |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 520 | GET_PROC(ClientWaitSync); |
Greg Daniel | 6be3523 | 2017-03-01 17:01:09 -0500 | [diff] [blame] | 521 | GET_PROC(WaitSync); |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 522 | GET_PROC(DeleteSync); |
| 523 | } |
| 524 | |
Brian Salomon | 0b63ceb | 2016-11-15 12:36:29 -0500 | [diff] [blame] | 525 | if (glVer >= GR_GL_VER(4, 2) || extensions.has("GL_ARB_shader_image_load_store")) { |
| 526 | GET_PROC(BindImageTexture); |
| 527 | GET_PROC(MemoryBarrier); |
| 528 | } |
| 529 | if (glVer >= GR_GL_VER(4, 5) || extensions.has("GL_ARB_ES3_1_compatibility")) { |
| 530 | GET_PROC(MemoryBarrierByRegion); |
| 531 | } |
| 532 | |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 533 | |
| 534 | if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_internalformat_query")) { |
| 535 | GET_PROC(GetInternalformativ); |
| 536 | } |
| 537 | |
commit-bot@chromium.org | 9add5dc | 2014-04-29 20:06:22 +0000 | [diff] [blame] | 538 | interface->fStandard = kGL_GrGLStandard; |
| 539 | interface->fExtensions.swap(&extensions); |
| 540 | |
| 541 | return interface; |
| 542 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 543 | |
| 544 | const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { |
| 545 | GET_PROC_LOCAL(GetString); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 546 | if (nullptr == GetString) { |
| 547 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 548 | } |
| 549 | |
| 550 | const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION)); |
| 551 | GrGLVersion version = GrGLGetVersionFromString(verStr); |
| 552 | |
| 553 | if (version < GR_GL_VER(2,0)) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 554 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | GET_PROC_LOCAL(GetIntegerv); |
| 558 | GET_PROC_LOCAL(GetStringi); |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 559 | GrEGLQueryStringProc queryString; |
| 560 | GrEGLDisplay display; |
| 561 | get_egl_query_and_display(&queryString, &display, ctx, get); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 562 | GrGLExtensions extensions; |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 563 | if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString, |
| 564 | display)) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 565 | return nullptr; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 566 | } |
| 567 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 568 | GrGLInterface* interface = new GrGLInterface; |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 569 | GrGLInterface::Functions* functions = &interface->fFunctions; |
| 570 | |
| 571 | GET_PROC(ActiveTexture); |
| 572 | GET_PROC(AttachShader); |
| 573 | GET_PROC(BindAttribLocation); |
| 574 | GET_PROC(BindBuffer); |
| 575 | GET_PROC(BindTexture); |
| 576 | GET_PROC_SUFFIX(BindVertexArray, OES); |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 577 | |
kkinnunen | d94708e | 2015-07-30 22:47:04 -0700 | [diff] [blame] | 578 | if (version >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) { |
| 579 | GET_PROC_SUFFIX(BindFragDataLocation, EXT); |
| 580 | GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT); |
| 581 | } |
| 582 | |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 583 | if (extensions.has("GL_KHR_blend_equation_advanced")) { |
| 584 | GET_PROC_SUFFIX(BlendBarrier, KHR); |
| 585 | } else if (extensions.has("GL_NV_blend_equation_advanced")) { |
| 586 | GET_PROC_SUFFIX(BlendBarrier, NV); |
| 587 | } |
| 588 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 589 | GET_PROC(BlendColor); |
cdalton | bae6f6c | 2015-04-22 10:39:03 -0700 | [diff] [blame] | 590 | GET_PROC(BlendEquation); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 591 | GET_PROC(BlendFunc); |
| 592 | GET_PROC(BufferData); |
| 593 | GET_PROC(BufferSubData); |
| 594 | GET_PROC(Clear); |
| 595 | GET_PROC(ClearColor); |
| 596 | GET_PROC(ClearStencil); |
Brian Salomon | d17b4a6 | 2017-05-23 16:53:47 -0400 | [diff] [blame] | 597 | if (extensions.has("GL_EXT_clear_texture")) { |
| 598 | GET_PROC_SUFFIX(ClearTexImage, EXT); |
| 599 | GET_PROC_SUFFIX(ClearTexSubImage, EXT); |
| 600 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 601 | GET_PROC(ColorMask); |
| 602 | GET_PROC(CompileShader); |
| 603 | GET_PROC(CompressedTexImage2D); |
| 604 | GET_PROC(CompressedTexSubImage2D); |
| 605 | GET_PROC(CopyTexSubImage2D); |
| 606 | GET_PROC(CreateProgram); |
| 607 | GET_PROC(CreateShader); |
| 608 | GET_PROC(CullFace); |
| 609 | GET_PROC(DeleteBuffers); |
| 610 | GET_PROC(DeleteProgram); |
| 611 | GET_PROC(DeleteShader); |
| 612 | GET_PROC(DeleteTextures); |
| 613 | GET_PROC_SUFFIX(DeleteVertexArrays, OES); |
| 614 | GET_PROC(DepthMask); |
| 615 | GET_PROC(Disable); |
| 616 | GET_PROC(DisableVertexAttribArray); |
| 617 | GET_PROC(DrawArrays); |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 618 | |
| 619 | if (version >= GR_GL_VER(3,0)) { |
| 620 | GET_PROC(DrawArraysInstanced); |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 621 | GET_PROC(DrawBuffers); |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 622 | GET_PROC(DrawElementsInstanced); |
| 623 | } else if (extensions.has("GL_EXT_draw_instanced")) { |
| 624 | GET_PROC_SUFFIX(DrawArraysInstanced, EXT); |
| 625 | GET_PROC_SUFFIX(DrawElementsInstanced, EXT); |
| 626 | } |
| 627 | |
| 628 | if (version >= GR_GL_VER(3,1)) { |
| 629 | GET_PROC(DrawArraysIndirect); |
| 630 | GET_PROC(DrawElementsIndirect); |
| 631 | } |
| 632 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 633 | GET_PROC(DrawElements); |
bsalomon | fc9527a | 2016-08-29 09:18:39 -0700 | [diff] [blame] | 634 | if (version >= GR_GL_VER(3,0)) { |
| 635 | GET_PROC(DrawRangeElements); |
| 636 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 637 | GET_PROC(Enable); |
| 638 | GET_PROC(EnableVertexAttribArray); |
| 639 | GET_PROC(Finish); |
| 640 | GET_PROC(Flush); |
| 641 | GET_PROC(FrontFace); |
| 642 | GET_PROC(GenBuffers); |
| 643 | GET_PROC(GenerateMipmap); |
| 644 | GET_PROC(GenTextures); |
| 645 | GET_PROC_SUFFIX(GenVertexArrays, OES); |
| 646 | GET_PROC(GetBufferParameteriv); |
| 647 | GET_PROC(GetError); |
| 648 | GET_PROC(GetIntegerv); |
cdalton | eb79eea | 2016-02-26 10:39:34 -0800 | [diff] [blame] | 649 | |
| 650 | if (version >= GR_GL_VER(3,1)) { |
| 651 | GET_PROC(GetMultisamplefv); |
| 652 | } |
| 653 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 654 | GET_PROC(GetProgramInfoLog); |
| 655 | GET_PROC(GetProgramiv); |
| 656 | GET_PROC(GetShaderInfoLog); |
bsalomon | ee64d6e | 2014-12-03 10:46:08 -0800 | [diff] [blame] | 657 | GET_PROC(GetShaderPrecisionFormat); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 658 | GET_PROC(GetShaderiv); |
| 659 | GET_PROC(GetString); |
| 660 | GET_PROC(GetStringi); |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 661 | if (version >= GR_GL_VER(3,1)) { |
| 662 | GET_PROC(GetTexLevelParameteriv); |
| 663 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 664 | GET_PROC(GetUniformLocation); |
bsalomon | 6dc6f5f | 2015-06-18 09:12:16 -0700 | [diff] [blame] | 665 | GET_PROC(IsTexture); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 666 | GET_PROC(LineWidth); |
| 667 | GET_PROC(LinkProgram); |
csmartdalton | 5cebf8c | 2016-06-03 08:28:47 -0700 | [diff] [blame] | 668 | |
| 669 | if (extensions.has("GL_EXT_multi_draw_indirect")) { |
| 670 | GET_PROC_SUFFIX(MultiDrawArraysIndirect, EXT); |
| 671 | GET_PROC_SUFFIX(MultiDrawElementsIndirect, EXT); |
| 672 | } |
| 673 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 674 | GET_PROC(PixelStorei); |
cdalton | 0edea2c | 2015-05-21 08:27:44 -0700 | [diff] [blame] | 675 | |
| 676 | if (extensions.has("GL_EXT_raster_multisample")) { |
| 677 | GET_PROC_SUFFIX(RasterSamples, EXT); |
| 678 | } |
| 679 | |
Brian Salomon | 15b2509 | 2017-05-08 11:10:53 -0400 | [diff] [blame] | 680 | if (version >= GR_GL_VER(3,0)) { |
| 681 | GET_PROC(ReadBuffer); |
| 682 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 683 | GET_PROC(ReadPixels); |
| 684 | GET_PROC(Scissor); |
| 685 | GET_PROC(ShaderSource); |
| 686 | GET_PROC(StencilFunc); |
| 687 | GET_PROC(StencilFuncSeparate); |
| 688 | GET_PROC(StencilMask); |
| 689 | GET_PROC(StencilMaskSeparate); |
| 690 | GET_PROC(StencilOp); |
| 691 | GET_PROC(StencilOpSeparate); |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 692 | |
| 693 | if (version >= GR_GL_VER(3,2)) { |
| 694 | GET_PROC(TexBuffer); |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 695 | GET_PROC(TexBufferRange); |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 696 | } else if (extensions.has("GL_OES_texture_buffer")) { |
| 697 | GET_PROC_SUFFIX(TexBuffer, OES); |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 698 | GET_PROC_SUFFIX(TexBufferRange, OES); |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 699 | } else if (extensions.has("GL_EXT_texture_buffer")) { |
| 700 | GET_PROC_SUFFIX(TexBuffer, EXT); |
cdalton | f8a6ce8 | 2016-04-11 13:02:05 -0700 | [diff] [blame] | 701 | GET_PROC_SUFFIX(TexBufferRange, EXT); |
cdalton | c04ce67 | 2016-03-11 14:07:38 -0800 | [diff] [blame] | 702 | } |
| 703 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 704 | GET_PROC(TexImage2D); |
| 705 | GET_PROC(TexParameteri); |
| 706 | GET_PROC(TexParameteriv); |
| 707 | GET_PROC(TexSubImage2D); |
| 708 | |
| 709 | if (version >= GR_GL_VER(3,0)) { |
| 710 | GET_PROC(TexStorage2D); |
| 711 | } else { |
| 712 | GET_PROC_SUFFIX(TexStorage2D, EXT); |
| 713 | } |
| 714 | |
cdalton | fd4167d | 2015-04-21 11:45:56 -0700 | [diff] [blame] | 715 | if (extensions.has("GL_NV_texture_barrier")) { |
| 716 | GET_PROC_SUFFIX(TextureBarrier, NV); |
| 717 | } |
| 718 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 719 | GET_PROC_SUFFIX(DiscardFramebuffer, EXT); |
| 720 | GET_PROC(Uniform1f); |
| 721 | GET_PROC(Uniform1i); |
| 722 | GET_PROC(Uniform1fv); |
| 723 | GET_PROC(Uniform1iv); |
| 724 | GET_PROC(Uniform2f); |
| 725 | GET_PROC(Uniform2i); |
| 726 | GET_PROC(Uniform2fv); |
| 727 | GET_PROC(Uniform2iv); |
| 728 | GET_PROC(Uniform3f); |
| 729 | GET_PROC(Uniform3i); |
| 730 | GET_PROC(Uniform3fv); |
| 731 | GET_PROC(Uniform3iv); |
| 732 | GET_PROC(Uniform4f); |
| 733 | GET_PROC(Uniform4i); |
| 734 | GET_PROC(Uniform4fv); |
| 735 | GET_PROC(Uniform4iv); |
| 736 | GET_PROC(UniformMatrix2fv); |
| 737 | GET_PROC(UniformMatrix3fv); |
| 738 | GET_PROC(UniformMatrix4fv); |
| 739 | GET_PROC(UseProgram); |
egdaniel | 27c1521 | 2014-10-24 15:00:50 -0700 | [diff] [blame] | 740 | GET_PROC(VertexAttrib1f); |
| 741 | GET_PROC(VertexAttrib2fv); |
| 742 | GET_PROC(VertexAttrib3fv); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 743 | GET_PROC(VertexAttrib4fv); |
cdalton | 06604b9 | 2016-02-05 10:09:51 -0800 | [diff] [blame] | 744 | |
| 745 | if (version >= GR_GL_VER(3,0)) { |
| 746 | GET_PROC(VertexAttribDivisor); |
| 747 | } else if (extensions.has("GL_EXT_instanced_arrays")) { |
| 748 | GET_PROC_SUFFIX(VertexAttribDivisor, EXT); |
| 749 | } |
| 750 | |
cdalton | 793dc26 | 2016-02-08 10:11:47 -0800 | [diff] [blame] | 751 | if (version >= GR_GL_VER(3,0)) { |
| 752 | GET_PROC(VertexAttribIPointer); |
| 753 | } |
| 754 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 755 | GET_PROC(VertexAttribPointer); |
| 756 | GET_PROC(Viewport); |
| 757 | GET_PROC(BindFramebuffer); |
| 758 | GET_PROC(BindRenderbuffer); |
| 759 | GET_PROC(CheckFramebufferStatus); |
| 760 | GET_PROC(DeleteFramebuffers); |
| 761 | GET_PROC(DeleteRenderbuffers); |
| 762 | GET_PROC(FramebufferRenderbuffer); |
| 763 | GET_PROC(FramebufferTexture2D); |
| 764 | |
Brian Salomon | c5eceb0 | 2016-10-18 10:21:43 -0400 | [diff] [blame] | 765 | if (version >= GR_GL_VER(3,0)) { |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 766 | GET_PROC(RenderbufferStorageMultisample); |
| 767 | GET_PROC(BlitFramebuffer); |
Brian Salomon | c5eceb0 | 2016-10-18 10:21:43 -0400 | [diff] [blame] | 768 | } else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) { |
| 769 | GET_PROC_SUFFIX(RenderbufferStorageMultisample, CHROMIUM); |
| 770 | GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM); |
| 771 | } else { |
| 772 | if (extensions.has("GL_ANGLE_framebuffer_multisample")) { |
| 773 | GET_PROC_SUFFIX(RenderbufferStorageMultisample, ANGLE); |
| 774 | } |
| 775 | if (extensions.has("GL_ANGLE_framebuffer_blit")) { |
| 776 | GET_PROC_SUFFIX(BlitFramebuffer, ANGLE); |
| 777 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 778 | } |
| 779 | |
hendrikw | 1ae488f | 2015-07-22 09:30:08 -0700 | [diff] [blame] | 780 | if (extensions.has("GL_CHROMIUM_map_sub")) { |
| 781 | GET_PROC_SUFFIX(MapBufferSubData, CHROMIUM); |
| 782 | GET_PROC_SUFFIX(MapTexSubImage2D, CHROMIUM); |
| 783 | GET_PROC_SUFFIX(UnmapBufferSubData, CHROMIUM); |
| 784 | GET_PROC_SUFFIX(UnmapTexSubImage2D, CHROMIUM); |
| 785 | } |
| 786 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 787 | if (extensions.has("GL_EXT_multisampled_render_to_texture")) { |
| 788 | GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT); |
| 789 | functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleEXT"); |
| 790 | } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) { |
| 791 | GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG); |
| 792 | functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleIMG"); |
| 793 | } else if (extensions.has("GL_APPLE_framebuffer_multisample")) { |
| 794 | functions->fRenderbufferStorageMultisampleES2APPLE = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleAPPLE"); |
| 795 | GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE); |
| 796 | } |
| 797 | |
| 798 | GET_PROC(GenFramebuffers); |
| 799 | GET_PROC(GenRenderbuffers); |
| 800 | GET_PROC(GetFramebufferAttachmentParameteriv); |
| 801 | GET_PROC(GetRenderbufferParameteriv); |
| 802 | GET_PROC(RenderbufferStorage); |
| 803 | |
Brian Osman | 8d4a5c7 | 2017-09-20 15:53:55 -0400 | [diff] [blame] | 804 | // There are several APIs for buffer mapping: |
| 805 | // ES2 + GL_OES_mapbuffer: MapBufferOES and UnmapBufferOES |
| 806 | // ES2 + GL_EXT_map_buffer_range: Adds MapBufferRangeEXT and FlushMappedBufferRangeEXT |
| 807 | // ES3: MapBufferRange, FlushMappedBufferRange, and UnmapBuffer are core (so no suffix). |
| 808 | // |
| 809 | // MapBuffer is not part of ES3, but implementations may still report the OES versions of |
| 810 | // MapBuffer and UnmapBuffer, per the older GL_OES_mapbuffer extension. Some implementations |
| 811 | // let us mix the newer MapBufferRange with the older UnmapBufferOES, but we've hit others that |
| 812 | // don't permit it. Note that in GrGLBuffer, we choose which API to use based on version and |
| 813 | // extensions. This code is written so that we never mix OES and non-OES functions. |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 814 | GET_PROC_SUFFIX(MapBuffer, OES); |
Brian Osman | 8d4a5c7 | 2017-09-20 15:53:55 -0400 | [diff] [blame] | 815 | if (version >= GR_GL_VER(3, 0)) { |
| 816 | GET_PROC(UnmapBuffer); |
| 817 | } else { |
| 818 | GET_PROC_SUFFIX(UnmapBuffer, OES); |
| 819 | } |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 820 | |
| 821 | if (version >= GR_GL_VER(3,0)) { |
| 822 | GET_PROC(MapBufferRange); |
| 823 | GET_PROC(FlushMappedBufferRange); |
| 824 | } else if (extensions.has("GL_EXT_map_buffer_range")) { |
| 825 | GET_PROC_SUFFIX(MapBufferRange, EXT); |
| 826 | GET_PROC_SUFFIX(FlushMappedBufferRange, EXT); |
| 827 | } |
| 828 | |
| 829 | if (extensions.has("GL_EXT_debug_marker")) { |
Brian Salomon | 7a1f09c | 2017-01-26 09:16:02 -0500 | [diff] [blame] | 830 | GET_PROC_SUFFIX(InsertEventMarker, EXT); |
| 831 | GET_PROC_SUFFIX(PushGroupMarker, EXT); |
| 832 | GET_PROC_SUFFIX(PopGroupMarker, EXT); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | GET_PROC(InvalidateFramebuffer); |
| 836 | GET_PROC(InvalidateSubFramebuffer); |
| 837 | GET_PROC(InvalidateBufferData); |
| 838 | GET_PROC(InvalidateBufferSubData); |
| 839 | GET_PROC(InvalidateTexImage); |
| 840 | GET_PROC(InvalidateTexSubImage); |
| 841 | |
| 842 | if (version >= GR_GL_VER(3,1)) { |
| 843 | GET_PROC(GetProgramResourceLocation); |
| 844 | } |
| 845 | |
| 846 | if (extensions.has("GL_NV_path_rendering")) { |
| 847 | GET_PROC_SUFFIX(MatrixLoadf, EXT); |
| 848 | GET_PROC_SUFFIX(MatrixLoadIdentity, EXT); |
| 849 | GET_PROC_SUFFIX(PathCommands, NV); |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 850 | GET_PROC_SUFFIX(PathParameteri, NV); |
| 851 | GET_PROC_SUFFIX(PathParameterf, NV); |
| 852 | GET_PROC_SUFFIX(GenPaths, NV); |
| 853 | GET_PROC_SUFFIX(DeletePaths, NV); |
| 854 | GET_PROC_SUFFIX(IsPath, NV); |
| 855 | GET_PROC_SUFFIX(PathStencilFunc, NV); |
| 856 | GET_PROC_SUFFIX(StencilFillPath, NV); |
| 857 | GET_PROC_SUFFIX(StencilStrokePath, NV); |
| 858 | GET_PROC_SUFFIX(StencilFillPathInstanced, NV); |
| 859 | GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); |
| 860 | GET_PROC_SUFFIX(CoverFillPath, NV); |
| 861 | GET_PROC_SUFFIX(CoverStrokePath, NV); |
| 862 | GET_PROC_SUFFIX(CoverFillPathInstanced, NV); |
| 863 | GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); |
| 864 | GET_PROC_SUFFIX(StencilThenCoverFillPath, NV); |
| 865 | GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV); |
| 866 | GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV); |
| 867 | GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV); |
| 868 | GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); |
| 869 | } |
| 870 | |
kkinnunen | 2ca29c0 | 2015-12-09 22:58:34 -0800 | [diff] [blame] | 871 | if (extensions.has("GL_CHROMIUM_path_rendering")) { |
| 872 | GET_PROC_SUFFIX(MatrixLoadf, CHROMIUM); |
| 873 | GET_PROC_SUFFIX(MatrixLoadIdentity, CHROMIUM); |
| 874 | GET_PROC_SUFFIX(PathCommands, CHROMIUM); |
| 875 | GET_PROC_SUFFIX(PathParameteri, CHROMIUM); |
| 876 | GET_PROC_SUFFIX(PathParameterf, CHROMIUM); |
| 877 | GET_PROC_SUFFIX(GenPaths, CHROMIUM); |
| 878 | GET_PROC_SUFFIX(DeletePaths, CHROMIUM); |
| 879 | GET_PROC_SUFFIX(IsPath, CHROMIUM); |
| 880 | GET_PROC_SUFFIX(PathStencilFunc, CHROMIUM); |
| 881 | GET_PROC_SUFFIX(StencilFillPath, CHROMIUM); |
| 882 | GET_PROC_SUFFIX(StencilStrokePath, CHROMIUM); |
| 883 | GET_PROC_SUFFIX(StencilFillPathInstanced, CHROMIUM); |
| 884 | GET_PROC_SUFFIX(StencilStrokePathInstanced, CHROMIUM); |
| 885 | GET_PROC_SUFFIX(CoverFillPath, CHROMIUM); |
| 886 | GET_PROC_SUFFIX(CoverStrokePath, CHROMIUM); |
| 887 | GET_PROC_SUFFIX(CoverFillPathInstanced, CHROMIUM); |
| 888 | GET_PROC_SUFFIX(CoverStrokePathInstanced, CHROMIUM); |
| 889 | GET_PROC_SUFFIX(StencilThenCoverFillPath, CHROMIUM); |
| 890 | GET_PROC_SUFFIX(StencilThenCoverStrokePath, CHROMIUM); |
| 891 | GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, CHROMIUM); |
| 892 | GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, CHROMIUM); |
| 893 | GET_PROC_SUFFIX(ProgramPathFragmentInputGen, CHROMIUM); |
| 894 | // GL_CHROMIUM_path_rendering additions: |
| 895 | GET_PROC_SUFFIX(BindFragmentInputLocation, CHROMIUM); |
| 896 | } |
| 897 | |
vbuzinov | 08b4d29 | 2015-04-01 06:29:49 -0700 | [diff] [blame] | 898 | if (extensions.has("GL_NV_framebuffer_mixed_samples")) { |
| 899 | GET_PROC_SUFFIX(CoverageModulation, NV); |
| 900 | } |
kkinnunen | ea40943 | 2015-12-10 01:21:59 -0800 | [diff] [blame] | 901 | if (extensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) { |
| 902 | GET_PROC_SUFFIX(CoverageModulation, CHROMIUM); |
| 903 | } |
vbuzinov | 08b4d29 | 2015-04-01 06:29:49 -0700 | [diff] [blame] | 904 | |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 905 | if (extensions.has("GL_NV_bindless_texture")) { |
| 906 | GET_PROC_SUFFIX(GetTextureHandle, NV); |
| 907 | GET_PROC_SUFFIX(GetTextureSamplerHandle, NV); |
| 908 | GET_PROC_SUFFIX(MakeTextureHandleResident, NV); |
| 909 | GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV); |
| 910 | GET_PROC_SUFFIX(GetImageHandle, NV); |
| 911 | GET_PROC_SUFFIX(MakeImageHandleResident, NV); |
| 912 | GET_PROC_SUFFIX(MakeImageHandleNonResident, NV); |
| 913 | GET_PROC_SUFFIX(IsTextureHandleResident, NV); |
| 914 | GET_PROC_SUFFIX(IsImageHandleResident, NV); |
| 915 | GET_PROC_SUFFIX(UniformHandleui64, NV); |
| 916 | GET_PROC_SUFFIX(UniformHandleui64v, NV); |
| 917 | GET_PROC_SUFFIX(ProgramUniformHandleui64, NV); |
| 918 | GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV); |
| 919 | } |
| 920 | |
| 921 | if (extensions.has("GL_KHR_debug")) { |
| 922 | GET_PROC_SUFFIX(DebugMessageControl, KHR); |
| 923 | GET_PROC_SUFFIX(DebugMessageInsert, KHR); |
| 924 | GET_PROC_SUFFIX(DebugMessageCallback, KHR); |
| 925 | GET_PROC_SUFFIX(GetDebugMessageLog, KHR); |
| 926 | GET_PROC_SUFFIX(PushDebugGroup, KHR); |
| 927 | GET_PROC_SUFFIX(PopDebugGroup, KHR); |
| 928 | GET_PROC_SUFFIX(ObjectLabel, KHR); |
bsalomon | db9f664 | 2015-10-02 08:34:28 -0700 | [diff] [blame] | 929 | // In general we have a policy against removing extension strings when the driver does |
| 930 | // not provide function pointers for an advertised extension. However, because there is a |
| 931 | // known device that advertises GL_KHR_debug but fails to provide the functions and this is |
| 932 | // a debugging- only extension we've made an exception. This also can happen when using |
| 933 | // APITRACE. |
| 934 | if (!interface->fFunctions.fDebugMessageControl) { |
| 935 | extensions.remove("GL_KHR_debug"); |
| 936 | } |
cdalton | 626e1ff | 2015-06-12 13:56:46 -0700 | [diff] [blame] | 937 | } |
| 938 | |
kkinnunen | 0adfffb | 2015-10-13 12:58:37 -0700 | [diff] [blame] | 939 | if (extensions.has("GL_CHROMIUM_bind_uniform_location")) { |
| 940 | GET_PROC_SUFFIX(BindUniformLocation, CHROMIUM); |
| 941 | } |
| 942 | |
csmartdalton | 9bc1187 | 2016-08-09 12:42:47 -0700 | [diff] [blame] | 943 | if (extensions.has("GL_EXT_window_rectangles")) { |
| 944 | GET_PROC_SUFFIX(WindowRectangles, EXT); |
| 945 | } |
| 946 | |
bsalomon | b1a32ad | 2015-11-16 06:48:44 -0800 | [diff] [blame] | 947 | if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) { |
| 948 | GET_EGL_PROC_SUFFIX(CreateImage, KHR); |
| 949 | GET_EGL_PROC_SUFFIX(DestroyImage, KHR); |
| 950 | } |
| 951 | |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 952 | if (extensions.has("GL_OES_sample_shading")) { |
| 953 | GET_PROC_SUFFIX(MinSampleShading, OES); |
| 954 | } |
| 955 | |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 956 | if (version >= GR_GL_VER(3, 0)) { |
| 957 | GET_PROC(FenceSync); |
Greg Daniel | dba7e7c | 2017-07-20 15:47:30 -0400 | [diff] [blame] | 958 | GET_PROC(IsSync); |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 959 | GET_PROC(ClientWaitSync); |
Greg Daniel | 6be3523 | 2017-03-01 17:01:09 -0500 | [diff] [blame] | 960 | GET_PROC(WaitSync); |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 961 | GET_PROC(DeleteSync); |
Brian Osman | 93a2346 | 2017-06-21 15:13:39 -0400 | [diff] [blame] | 962 | } else if (extensions.has("GL_APPLE_sync")) { |
| 963 | GET_PROC_SUFFIX(FenceSync, APPLE); |
Greg Daniel | dba7e7c | 2017-07-20 15:47:30 -0400 | [diff] [blame] | 964 | GET_PROC_SUFFIX(IsSync, APPLE); |
Brian Osman | 93a2346 | 2017-06-21 15:13:39 -0400 | [diff] [blame] | 965 | GET_PROC_SUFFIX(ClientWaitSync, APPLE); |
| 966 | GET_PROC_SUFFIX(WaitSync, APPLE); |
| 967 | GET_PROC_SUFFIX(DeleteSync, APPLE); |
jvanverth | 84741b3 | 2016-09-30 08:39:02 -0700 | [diff] [blame] | 968 | } |
| 969 | |
Brian Salomon | 0b63ceb | 2016-11-15 12:36:29 -0500 | [diff] [blame] | 970 | if (version >= GR_GL_VER(3, 1)) { |
| 971 | GET_PROC(BindImageTexture); |
| 972 | GET_PROC(MemoryBarrier); |
| 973 | GET_PROC(MemoryBarrierByRegion); |
| 974 | } |
| 975 | |
Greg Daniel | 81e7bf8 | 2017-07-19 14:47:42 -0400 | [diff] [blame] | 976 | if (version >= GR_GL_VER(3,0)) { |
| 977 | GET_PROC(GetInternalformativ); |
| 978 | } |
| 979 | |
bsalomon | a721c81 | 2014-08-26 11:35:23 -0700 | [diff] [blame] | 980 | interface->fStandard = kGLES_GrGLStandard; |
| 981 | interface->fExtensions.swap(&extensions); |
| 982 | |
| 983 | return interface; |
| 984 | } |