Home | History | Annotate | Download | only in gl
      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 
      9 #include "gl/GrGLAssembleInterface.h"
     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 
     16 #define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL ## F = (GrEGL ## F ## Proc) get(ctx, "egl" #F #S)
     17 
     18 sk_sp<const GrGLInterface> GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get) {
     19     GET_PROC_LOCAL(GetString);
     20     if (nullptr == GetString) {
     21         return nullptr;
     22     }
     23 
     24     const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
     25     if (nullptr == verStr) {
     26         return nullptr;
     27     }
     28 
     29     GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);
     30 
     31     if (kGLES_GrGLStandard == standard) {
     32         return GrGLMakeAssembledGLESInterface(ctx, get);
     33     } else if (kGL_GrGLStandard == standard) {
     34         return GrGLMakeAssembledGLInterface(ctx, get);
     35     }
     36     return nullptr;
     37 }
     38 
     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 
     54 sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc get) {
     55     GET_PROC_LOCAL(GetString);
     56     GET_PROC_LOCAL(GetStringi);
     57     GET_PROC_LOCAL(GetIntegerv);
     58 
     59     // GetStringi may be nullptr depending on the GL version.
     60     if (nullptr == GetString || nullptr == GetIntegerv) {
     61         return nullptr;
     62     }
     63 
     64     const char* versionString = (const char*) GetString(GR_GL_VERSION);
     65     GrGLVersion glVer = GrGLGetVersionFromString(versionString);
     66 
     67     if (glVer < GR_GL_VER(2,0) || GR_GL_INVALID_VER == glVer) {
     68         // This is our minimum for non-ES GL.
     69         return nullptr;
     70     }
     71 
     72     GrEGLQueryStringProc queryString;
     73     GrEGLDisplay display;
     74     get_egl_query_and_display(&queryString, &display, ctx, get);
     75     GrGLExtensions extensions;
     76     if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
     77                          display)) {
     78         return nullptr;
     79     }
     80 
     81     sk_sp<GrGLInterface> interface(new GrGLInterface());
     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);
     93 
     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);
     98     }
     99 
    100     GET_PROC(BlendColor);
    101     GET_PROC(BlendEquation);
    102     GET_PROC(BlendFunc);
    103     GET_PROC(BufferData);
    104     GET_PROC(BufferSubData);
    105     GET_PROC(Clear);
    106     GET_PROC(ClearColor);
    107     GET_PROC(ClearStencil);
    108     if (glVer >= GR_GL_VER(4,4) || extensions.has("GL_ARB_clear_texture")) {
    109         GET_PROC(ClearTexImage);
    110         GET_PROC(ClearTexSubImage);
    111     }
    112     GET_PROC(ColorMask);
    113     GET_PROC(CompileShader);
    114     GET_PROC(CompressedTexImage2D);
    115     GET_PROC(CompressedTexSubImage2D);
    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);
    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 
    139     if (glVer >= GR_GL_VER(4,0) || extensions.has("GL_ARB_draw_indirect")) {
    140         GET_PROC(DrawArraysIndirect);
    141         GET_PROC(DrawElementsIndirect);
    142     }
    143     GET_PROC(DrawRangeElements);
    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);
    151     GET_PROC(GetBufferParameteriv);
    152     GET_PROC(GetError);
    153     GET_PROC(GetIntegerv);
    154     if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_texture_multisample")) {
    155         GET_PROC(GetMultisamplefv);
    156     }
    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);
    174     GET_PROC(GetShaderPrecisionFormat);
    175     GET_PROC(GetTexLevelParameteriv);
    176     GET_PROC(GenQueries);
    177     GET_PROC(GenTextures);
    178     GET_PROC(GetUniformLocation);
    179     GET_PROC(IsTexture);
    180     GET_PROC(LineWidth);
    181     GET_PROC(LinkProgram);
    182     GET_PROC(MapBuffer);
    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 
    189     GET_PROC(PixelStorei);
    190     GET_PROC(PolygonMode);
    191     if (extensions.has("GL_EXT_raster_multisample")) {
    192         GET_PROC_SUFFIX(RasterSamples, EXT);
    193     }
    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);
    204     if (glVer >= GR_GL_VER(3,1)) {
    205         GET_PROC(TexBuffer);
    206     }
    207     if (glVer >= GR_GL_VER(4,3)) {
    208         GET_PROC(TexBufferRange);
    209     }
    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);
    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     }
    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);
    245     GET_PROC(VertexAttrib1f);
    246     GET_PROC(VertexAttrib2fv);
    247     GET_PROC(VertexAttrib3fv);
    248     GET_PROC(VertexAttrib4fv);
    249 
    250     if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_instanced_arrays")) {
    251         GET_PROC(VertexAttribDivisor);
    252     }
    253 
    254     if (glVer >= GR_GL_VER(3,0)) {
    255         GET_PROC(VertexAttribIPointer);
    256     }
    257 
    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);
    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);
    271     }
    272 
    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 
    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")) {
    281         GET_PROC(GenerateMipmap);
    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")) {
    297         GET_PROC_SUFFIX(GenerateMipmap, EXT);
    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         return nullptr;
    319     }
    320 
    321     if (extensions.has("GL_NV_path_rendering")) {
    322         GET_PROC_SUFFIX(MatrixLoadf, EXT);
    323         GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
    324         GET_PROC_SUFFIX(PathCommands, NV);
    325         GET_PROC_SUFFIX(PathParameteri, NV);
    326         GET_PROC_SUFFIX(PathParameterf, NV);
    327         GET_PROC_SUFFIX(GenPaths, NV);
    328         GET_PROC_SUFFIX(DeletePaths, NV);
    329         GET_PROC_SUFFIX(IsPath, NV);
    330         GET_PROC_SUFFIX(PathStencilFunc, NV);
    331         GET_PROC_SUFFIX(StencilFillPath, NV);
    332         GET_PROC_SUFFIX(StencilStrokePath, NV);
    333         GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
    334         GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
    335         GET_PROC_SUFFIX(CoverFillPath, NV);
    336         GET_PROC_SUFFIX(CoverStrokePath, NV);
    337         GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
    338         GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
    339         GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
    340         GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
    341         GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
    342         GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
    343         GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
    344     }
    345 
    346     if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
    347         GET_PROC_SUFFIX(CoverageModulation, NV);
    348     }
    349 
    350     if (extensions.has("GL_EXT_debug_marker")) {
    351         GET_PROC_SUFFIX(InsertEventMarker, EXT);
    352         GET_PROC_SUFFIX(PushGroupMarker, EXT);
    353         GET_PROC_SUFFIX(PopGroupMarker, EXT);
    354     }
    355 
    356     if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
    357         GET_PROC(InvalidateBufferData);
    358         GET_PROC(InvalidateBufferSubData);
    359         GET_PROC(InvalidateFramebuffer);
    360         GET_PROC(InvalidateSubFramebuffer);
    361         GET_PROC(InvalidateTexImage);
    362         GET_PROC(InvalidateTexSubImage);
    363     }
    364 
    365     if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_program_interface_query")) {
    366         GET_PROC(GetProgramResourceLocation);
    367     }
    368 
    369     if (extensions.has("GL_NV_bindless_texture")) {
    370         GET_PROC_SUFFIX(GetTextureHandle, NV);
    371         GET_PROC_SUFFIX(GetTextureSamplerHandle, NV);
    372         GET_PROC_SUFFIX(MakeTextureHandleResident, NV);
    373         GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV);
    374         GET_PROC_SUFFIX(GetImageHandle, NV);
    375         GET_PROC_SUFFIX(MakeImageHandleResident, NV);
    376         GET_PROC_SUFFIX(MakeImageHandleNonResident, NV);
    377         GET_PROC_SUFFIX(IsTextureHandleResident, NV);
    378         GET_PROC_SUFFIX(IsImageHandleResident, NV);
    379         GET_PROC_SUFFIX(UniformHandleui64, NV);
    380         GET_PROC_SUFFIX(UniformHandleui64v, NV);
    381         GET_PROC_SUFFIX(ProgramUniformHandleui64, NV);
    382         GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV);
    383     }
    384 
    385     if (extensions.has("GL_EXT_direct_state_access")) {
    386         GET_PROC_SUFFIX(TextureParameteri, EXT);
    387         GET_PROC_SUFFIX(TextureParameteriv, EXT);
    388         GET_PROC_SUFFIX(TextureParameterf, EXT);
    389         GET_PROC_SUFFIX(TextureParameterfv, EXT);
    390         GET_PROC_SUFFIX(TextureImage1D, EXT);
    391         GET_PROC_SUFFIX(TextureImage2D, EXT);
    392         GET_PROC_SUFFIX(TextureSubImage1D, EXT);
    393         GET_PROC_SUFFIX(TextureSubImage2D, EXT);
    394         GET_PROC_SUFFIX(CopyTextureImage1D, EXT);
    395         GET_PROC_SUFFIX(CopyTextureImage2D, EXT);
    396         GET_PROC_SUFFIX(CopyTextureSubImage1D, EXT);
    397         GET_PROC_SUFFIX(CopyTextureSubImage2D, EXT);
    398         GET_PROC_SUFFIX(GetNamedBufferParameteriv, EXT);
    399         GET_PROC_SUFFIX(GetNamedBufferPointerv, EXT);
    400         GET_PROC_SUFFIX(GetNamedBufferSubData, EXT);
    401         GET_PROC_SUFFIX(GetTextureImage, EXT);
    402         GET_PROC_SUFFIX(GetTextureParameterfv, EXT);
    403         GET_PROC_SUFFIX(GetTextureParameteriv, EXT);
    404         GET_PROC_SUFFIX(GetTextureLevelParameterfv, EXT);
    405         GET_PROC_SUFFIX(GetTextureLevelParameteriv, EXT);
    406         GET_PROC_SUFFIX(MapNamedBuffer, EXT);
    407         GET_PROC_SUFFIX(NamedBufferData, EXT);
    408         GET_PROC_SUFFIX(NamedBufferSubData, EXT);
    409         GET_PROC_SUFFIX(ProgramUniform1f, EXT);
    410         GET_PROC_SUFFIX(ProgramUniform2f, EXT);
    411         GET_PROC_SUFFIX(ProgramUniform3f, EXT);
    412         GET_PROC_SUFFIX(ProgramUniform4f, EXT);
    413         GET_PROC_SUFFIX(ProgramUniform1i, EXT);
    414         GET_PROC_SUFFIX(ProgramUniform2i, EXT);
    415         GET_PROC_SUFFIX(ProgramUniform3i, EXT);
    416         GET_PROC_SUFFIX(ProgramUniform4i, EXT);
    417         GET_PROC_SUFFIX(ProgramUniform1fv, EXT);
    418         GET_PROC_SUFFIX(ProgramUniform2fv, EXT);
    419         GET_PROC_SUFFIX(ProgramUniform3fv, EXT);
    420         GET_PROC_SUFFIX(ProgramUniform4fv, EXT);
    421         GET_PROC_SUFFIX(ProgramUniform1iv, EXT);
    422         GET_PROC_SUFFIX(ProgramUniform2iv, EXT);
    423         GET_PROC_SUFFIX(ProgramUniform3iv, EXT);
    424         GET_PROC_SUFFIX(ProgramUniform4iv, EXT);
    425         GET_PROC_SUFFIX(ProgramUniformMatrix2fv, EXT);
    426         GET_PROC_SUFFIX(ProgramUniformMatrix3fv, EXT);
    427         GET_PROC_SUFFIX(ProgramUniformMatrix4fv, EXT);
    428         GET_PROC_SUFFIX(UnmapNamedBuffer, EXT);
    429         if (glVer >= GR_GL_VER(1,2)) {
    430             GET_PROC_SUFFIX(TextureImage3D, EXT);
    431             GET_PROC_SUFFIX(TextureSubImage3D, EXT);
    432             GET_PROC_SUFFIX(CopyTextureSubImage3D, EXT);
    433             GET_PROC_SUFFIX(CompressedTextureImage3D, EXT);
    434             GET_PROC_SUFFIX(CompressedTextureImage2D, EXT);
    435             GET_PROC_SUFFIX(CompressedTextureImage1D, EXT);
    436             GET_PROC_SUFFIX(CompressedTextureSubImage3D, EXT);
    437             GET_PROC_SUFFIX(CompressedTextureSubImage2D, EXT);
    438             GET_PROC_SUFFIX(CompressedTextureSubImage1D, EXT);
    439             GET_PROC_SUFFIX(GetCompressedTextureImage, EXT);
    440         }
    441         if (glVer >= GR_GL_VER(2,1)) {
    442             GET_PROC_SUFFIX(ProgramUniformMatrix2x3fv, EXT);
    443             GET_PROC_SUFFIX(ProgramUniformMatrix3x2fv, EXT);
    444             GET_PROC_SUFFIX(ProgramUniformMatrix2x4fv, EXT);
    445             GET_PROC_SUFFIX(ProgramUniformMatrix4x2fv, EXT);
    446             GET_PROC_SUFFIX(ProgramUniformMatrix3x4fv, EXT);
    447             GET_PROC_SUFFIX(ProgramUniformMatrix4x3fv, EXT);
    448         }
    449         if (glVer >= GR_GL_VER(3,0)) {
    450             GET_PROC_SUFFIX(NamedRenderbufferStorage, EXT);
    451             GET_PROC_SUFFIX(GetNamedRenderbufferParameteriv, EXT);
    452             GET_PROC_SUFFIX(NamedRenderbufferStorageMultisample, EXT);
    453             GET_PROC_SUFFIX(CheckNamedFramebufferStatus, EXT);
    454             GET_PROC_SUFFIX(NamedFramebufferTexture1D, EXT);
    455             GET_PROC_SUFFIX(NamedFramebufferTexture2D, EXT);
    456             GET_PROC_SUFFIX(NamedFramebufferTexture3D, EXT);
    457             GET_PROC_SUFFIX(NamedFramebufferRenderbuffer, EXT);
    458             GET_PROC_SUFFIX(GetNamedFramebufferAttachmentParameteriv, EXT);
    459             GET_PROC_SUFFIX(GenerateTextureMipmap, EXT);
    460             GET_PROC_SUFFIX(FramebufferDrawBuffer, EXT);
    461             GET_PROC_SUFFIX(FramebufferDrawBuffers, EXT);
    462             GET_PROC_SUFFIX(FramebufferReadBuffer, EXT);
    463             GET_PROC_SUFFIX(GetFramebufferParameteriv, EXT);
    464             GET_PROC_SUFFIX(NamedCopyBufferSubData, EXT);
    465             GET_PROC_SUFFIX(VertexArrayVertexOffset, EXT);
    466             GET_PROC_SUFFIX(VertexArrayColorOffset, EXT);
    467             GET_PROC_SUFFIX(VertexArrayEdgeFlagOffset, EXT);
    468             GET_PROC_SUFFIX(VertexArrayIndexOffset, EXT);
    469             GET_PROC_SUFFIX(VertexArrayNormalOffset, EXT);
    470             GET_PROC_SUFFIX(VertexArrayTexCoordOffset, EXT);
    471             GET_PROC_SUFFIX(VertexArrayMultiTexCoordOffset, EXT);
    472             GET_PROC_SUFFIX(VertexArrayFogCoordOffset, EXT);
    473             GET_PROC_SUFFIX(VertexArraySecondaryColorOffset, EXT);
    474             GET_PROC_SUFFIX(VertexArrayVertexAttribOffset, EXT);
    475             GET_PROC_SUFFIX(VertexArrayVertexAttribIOffset, EXT);
    476             GET_PROC_SUFFIX(EnableVertexArray, EXT);
    477             GET_PROC_SUFFIX(DisableVertexArray, EXT);
    478             GET_PROC_SUFFIX(EnableVertexArrayAttrib, EXT);
    479             GET_PROC_SUFFIX(DisableVertexArrayAttrib, EXT);
    480             GET_PROC_SUFFIX(GetVertexArrayIntegerv, EXT);
    481             GET_PROC_SUFFIX(GetVertexArrayPointerv, EXT);
    482             GET_PROC_SUFFIX(GetVertexArrayIntegeri_v, EXT);
    483             GET_PROC_SUFFIX(GetVertexArrayPointeri_v, EXT);
    484             GET_PROC_SUFFIX(MapNamedBufferRange, EXT);
    485             GET_PROC_SUFFIX(FlushMappedNamedBufferRange, EXT);
    486         }
    487         if (glVer >= GR_GL_VER(3,1)) {
    488             GET_PROC_SUFFIX(TextureBuffer, EXT);
    489         }
    490     }
    491 
    492     if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_KHR_debug")) {
    493         // KHR_debug defines these methods to have no suffix in an OpenGL (not ES) context.
    494         GET_PROC(DebugMessageControl);
    495         GET_PROC(DebugMessageInsert);
    496         GET_PROC(DebugMessageCallback);
    497         GET_PROC(GetDebugMessageLog);
    498         GET_PROC(PushDebugGroup);
    499         GET_PROC(PopDebugGroup);
    500         GET_PROC(ObjectLabel);
    501     }
    502 
    503     if (extensions.has("GL_EXT_window_rectangles")) {
    504         GET_PROC_SUFFIX(WindowRectangles, EXT);
    505     }
    506 
    507     if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
    508         GET_EGL_PROC_SUFFIX(CreateImage, KHR);
    509         GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
    510     }
    511 
    512     if (glVer >= GR_GL_VER(4, 0) || extensions.has("GL_ARB_sample_shading")) {
    513         GET_PROC(MinSampleShading);
    514     }
    515 
    516     if (glVer >= GR_GL_VER(3, 2) || extensions.has("GL_ARB_sync")) {
    517         GET_PROC(FenceSync);
    518         GET_PROC(IsSync);
    519         GET_PROC(ClientWaitSync);
    520         GET_PROC(WaitSync);
    521         GET_PROC(DeleteSync);
    522     }
    523 
    524     if (glVer >= GR_GL_VER(4, 2) || extensions.has("GL_ARB_shader_image_load_store")) {
    525         GET_PROC(BindImageTexture);
    526         GET_PROC(MemoryBarrier);
    527     }
    528     if (glVer >= GR_GL_VER(4, 5) || extensions.has("GL_ARB_ES3_1_compatibility")) {
    529         GET_PROC(MemoryBarrierByRegion);
    530     }
    531 
    532 
    533     if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_internalformat_query")) {
    534         GET_PROC(GetInternalformativ);
    535     }
    536 
    537     if (glVer >= GR_GL_VER(4, 1)) {
    538         GET_PROC(GetProgramBinary);
    539         GET_PROC(ProgramBinary);
    540         GET_PROC(ProgramParameteri);
    541     }
    542 
    543     interface->fStandard = kGL_GrGLStandard;
    544     interface->fExtensions.swap(&extensions);
    545 
    546     return interface;
    547 }
    548 
    549 sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get) {
    550     GET_PROC_LOCAL(GetString);
    551     if (nullptr == GetString) {
    552         return nullptr;
    553     }
    554 
    555     const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
    556     GrGLVersion version = GrGLGetVersionFromString(verStr);
    557 
    558     if (version < GR_GL_VER(2,0)) {
    559         return nullptr;
    560     }
    561 
    562     GET_PROC_LOCAL(GetIntegerv);
    563     GET_PROC_LOCAL(GetStringi);
    564     GrEGLQueryStringProc queryString;
    565     GrEGLDisplay display;
    566     get_egl_query_and_display(&queryString, &display, ctx, get);
    567     GrGLExtensions extensions;
    568     if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
    569                          display)) {
    570         return nullptr;
    571     }
    572 
    573     sk_sp<GrGLInterface> interface(new GrGLInterface);
    574     GrGLInterface::Functions* functions = &interface->fFunctions;
    575 
    576     GET_PROC(ActiveTexture);
    577     GET_PROC(AttachShader);
    578     GET_PROC(BindAttribLocation);
    579     GET_PROC(BindBuffer);
    580     GET_PROC(BindTexture);
    581     GET_PROC_SUFFIX(BindVertexArray, OES);
    582 
    583     if (version >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
    584         GET_PROC_SUFFIX(BindFragDataLocation, EXT);
    585         GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
    586     }
    587 
    588     if (extensions.has("GL_KHR_blend_equation_advanced")) {
    589         GET_PROC_SUFFIX(BlendBarrier, KHR);
    590     } else if (extensions.has("GL_NV_blend_equation_advanced")) {
    591         GET_PROC_SUFFIX(BlendBarrier, NV);
    592     }
    593 
    594     GET_PROC(BlendColor);
    595     GET_PROC(BlendEquation);
    596     GET_PROC(BlendFunc);
    597     GET_PROC(BufferData);
    598     GET_PROC(BufferSubData);
    599     GET_PROC(Clear);
    600     GET_PROC(ClearColor);
    601     GET_PROC(ClearStencil);
    602     if (extensions.has("GL_EXT_clear_texture")) {
    603         GET_PROC_SUFFIX(ClearTexImage, EXT);
    604         GET_PROC_SUFFIX(ClearTexSubImage, EXT);
    605     }
    606     GET_PROC(ColorMask);
    607     GET_PROC(CompileShader);
    608     GET_PROC(CompressedTexImage2D);
    609     GET_PROC(CompressedTexSubImage2D);
    610     GET_PROC(CopyTexSubImage2D);
    611     GET_PROC(CreateProgram);
    612     GET_PROC(CreateShader);
    613     GET_PROC(CullFace);
    614     GET_PROC(DeleteBuffers);
    615     GET_PROC(DeleteProgram);
    616     GET_PROC(DeleteShader);
    617     GET_PROC(DeleteTextures);
    618     GET_PROC_SUFFIX(DeleteVertexArrays, OES);
    619     GET_PROC(DepthMask);
    620     GET_PROC(Disable);
    621     GET_PROC(DisableVertexAttribArray);
    622     GET_PROC(DrawArrays);
    623 
    624     if (version >= GR_GL_VER(3,0)) {
    625         GET_PROC(DrawArraysInstanced);
    626         GET_PROC(DrawBuffers);
    627         GET_PROC(DrawElementsInstanced);
    628     } else if (extensions.has("GL_EXT_draw_instanced")) {
    629         GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
    630         GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
    631     }
    632 
    633     if (version >= GR_GL_VER(3,1)) {
    634         GET_PROC(DrawArraysIndirect);
    635         GET_PROC(DrawElementsIndirect);
    636     }
    637 
    638     GET_PROC(DrawElements);
    639     if (version >= GR_GL_VER(3,0)) {
    640         GET_PROC(DrawRangeElements);
    641     }
    642     GET_PROC(Enable);
    643     GET_PROC(EnableVertexAttribArray);
    644     GET_PROC(Finish);
    645     GET_PROC(Flush);
    646     GET_PROC(FrontFace);
    647     GET_PROC(GenBuffers);
    648     GET_PROC(GenerateMipmap);
    649     GET_PROC(GenTextures);
    650     GET_PROC_SUFFIX(GenVertexArrays, OES);
    651     GET_PROC(GetBufferParameteriv);
    652     GET_PROC(GetError);
    653     GET_PROC(GetIntegerv);
    654 
    655     if (version >= GR_GL_VER(3,1)) {
    656         GET_PROC(GetMultisamplefv);
    657     }
    658 
    659     GET_PROC(GetProgramInfoLog);
    660     GET_PROC(GetProgramiv);
    661     GET_PROC(GetShaderInfoLog);
    662     GET_PROC(GetShaderPrecisionFormat);
    663     GET_PROC(GetShaderiv);
    664     GET_PROC(GetString);
    665     GET_PROC(GetStringi);
    666     if (version >= GR_GL_VER(3,1)) {
    667         GET_PROC(GetTexLevelParameteriv);
    668     }
    669     GET_PROC(GetUniformLocation);
    670     GET_PROC(IsTexture);
    671     GET_PROC(LineWidth);
    672     GET_PROC(LinkProgram);
    673 
    674     if (extensions.has("GL_EXT_multi_draw_indirect")) {
    675         GET_PROC_SUFFIX(MultiDrawArraysIndirect, EXT);
    676         GET_PROC_SUFFIX(MultiDrawElementsIndirect, EXT);
    677     }
    678 
    679     GET_PROC(PixelStorei);
    680 
    681     if (extensions.has("GL_EXT_raster_multisample")) {
    682         GET_PROC_SUFFIX(RasterSamples, EXT);
    683     }
    684 
    685     if (version >= GR_GL_VER(3,0)) {
    686         GET_PROC(ReadBuffer);
    687     }
    688     GET_PROC(ReadPixels);
    689     GET_PROC(Scissor);
    690     GET_PROC(ShaderSource);
    691     GET_PROC(StencilFunc);
    692     GET_PROC(StencilFuncSeparate);
    693     GET_PROC(StencilMask);
    694     GET_PROC(StencilMaskSeparate);
    695     GET_PROC(StencilOp);
    696     GET_PROC(StencilOpSeparate);
    697 
    698     if (version >= GR_GL_VER(3,2)) {
    699         GET_PROC(TexBuffer);
    700         GET_PROC(TexBufferRange);
    701     } else if (extensions.has("GL_OES_texture_buffer")) {
    702         GET_PROC_SUFFIX(TexBuffer, OES);
    703         GET_PROC_SUFFIX(TexBufferRange, OES);
    704     } else if (extensions.has("GL_EXT_texture_buffer")) {
    705         GET_PROC_SUFFIX(TexBuffer, EXT);
    706         GET_PROC_SUFFIX(TexBufferRange, EXT);
    707     }
    708 
    709     GET_PROC(TexImage2D);
    710     GET_PROC(TexParameteri);
    711     GET_PROC(TexParameteriv);
    712     GET_PROC(TexSubImage2D);
    713 
    714     if (version >= GR_GL_VER(3,0)) {
    715         GET_PROC(TexStorage2D);
    716     } else {
    717         GET_PROC_SUFFIX(TexStorage2D, EXT);
    718     }
    719 
    720     if (extensions.has("GL_NV_texture_barrier")) {
    721         GET_PROC_SUFFIX(TextureBarrier, NV);
    722     }
    723 
    724     GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
    725     GET_PROC(Uniform1f);
    726     GET_PROC(Uniform1i);
    727     GET_PROC(Uniform1fv);
    728     GET_PROC(Uniform1iv);
    729     GET_PROC(Uniform2f);
    730     GET_PROC(Uniform2i);
    731     GET_PROC(Uniform2fv);
    732     GET_PROC(Uniform2iv);
    733     GET_PROC(Uniform3f);
    734     GET_PROC(Uniform3i);
    735     GET_PROC(Uniform3fv);
    736     GET_PROC(Uniform3iv);
    737     GET_PROC(Uniform4f);
    738     GET_PROC(Uniform4i);
    739     GET_PROC(Uniform4fv);
    740     GET_PROC(Uniform4iv);
    741     GET_PROC(UniformMatrix2fv);
    742     GET_PROC(UniformMatrix3fv);
    743     GET_PROC(UniformMatrix4fv);
    744     GET_PROC(UseProgram);
    745     GET_PROC(VertexAttrib1f);
    746     GET_PROC(VertexAttrib2fv);
    747     GET_PROC(VertexAttrib3fv);
    748     GET_PROC(VertexAttrib4fv);
    749 
    750     if (version >= GR_GL_VER(3,0)) {
    751         GET_PROC(VertexAttribDivisor);
    752     } else if (extensions.has("GL_EXT_instanced_arrays")) {
    753         GET_PROC_SUFFIX(VertexAttribDivisor, EXT);
    754     }
    755 
    756     if (version >= GR_GL_VER(3,0)) {
    757         GET_PROC(VertexAttribIPointer);
    758     }
    759 
    760     GET_PROC(VertexAttribPointer);
    761     GET_PROC(Viewport);
    762     GET_PROC(BindFramebuffer);
    763     GET_PROC(BindRenderbuffer);
    764     GET_PROC(CheckFramebufferStatus);
    765     GET_PROC(DeleteFramebuffers);
    766     GET_PROC(DeleteRenderbuffers);
    767     GET_PROC(FramebufferRenderbuffer);
    768     GET_PROC(FramebufferTexture2D);
    769 
    770     if (version >= GR_GL_VER(3,0)) {
    771         GET_PROC(RenderbufferStorageMultisample);
    772         GET_PROC(BlitFramebuffer);
    773     } else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
    774         GET_PROC_SUFFIX(RenderbufferStorageMultisample, CHROMIUM);
    775         GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM);
    776     } else {
    777         if (extensions.has("GL_ANGLE_framebuffer_multisample")) {
    778             GET_PROC_SUFFIX(RenderbufferStorageMultisample, ANGLE);
    779         }
    780         if (extensions.has("GL_ANGLE_framebuffer_blit")) {
    781             GET_PROC_SUFFIX(BlitFramebuffer, ANGLE);
    782         }
    783     }
    784 
    785     if (extensions.has("GL_CHROMIUM_map_sub")) {
    786         GET_PROC_SUFFIX(MapBufferSubData, CHROMIUM);
    787         GET_PROC_SUFFIX(MapTexSubImage2D, CHROMIUM);
    788         GET_PROC_SUFFIX(UnmapBufferSubData, CHROMIUM);
    789         GET_PROC_SUFFIX(UnmapTexSubImage2D, CHROMIUM);
    790     }
    791 
    792     if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
    793         GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT);
    794         functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleEXT");
    795     } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
    796         GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG);
    797         functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleIMG");
    798     } else if (extensions.has("GL_APPLE_framebuffer_multisample")) {
    799         functions->fRenderbufferStorageMultisampleES2APPLE = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleAPPLE");
    800         GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE);
    801     }
    802 
    803     GET_PROC(GenFramebuffers);
    804     GET_PROC(GenRenderbuffers);
    805     GET_PROC(GetFramebufferAttachmentParameteriv);
    806     GET_PROC(GetRenderbufferParameteriv);
    807     GET_PROC(RenderbufferStorage);
    808 
    809     // There are several APIs for buffer mapping:
    810     // ES2 + GL_OES_mapbuffer: MapBufferOES and UnmapBufferOES
    811     // ES2 + GL_EXT_map_buffer_range: Adds MapBufferRangeEXT and FlushMappedBufferRangeEXT
    812     // ES3: MapBufferRange, FlushMappedBufferRange, and UnmapBuffer are core (so no suffix).
    813     //
    814     // MapBuffer is not part of ES3, but implementations may still report the OES versions of
    815     // MapBuffer and UnmapBuffer, per the older GL_OES_mapbuffer extension. Some implementations
    816     // let us mix the newer MapBufferRange with the older UnmapBufferOES, but we've hit others that
    817     // don't permit it. Note that in GrGLBuffer, we choose which API to use based on version and
    818     // extensions. This code is written so that we never mix OES and non-OES functions.
    819     GET_PROC_SUFFIX(MapBuffer, OES);
    820     if (version >= GR_GL_VER(3, 0)) {
    821         GET_PROC(UnmapBuffer);
    822     } else {
    823         GET_PROC_SUFFIX(UnmapBuffer, OES);
    824     }
    825 
    826     if (version >= GR_GL_VER(3,0)) {
    827         GET_PROC(MapBufferRange);
    828         GET_PROC(FlushMappedBufferRange);
    829     } else if (extensions.has("GL_EXT_map_buffer_range")) {
    830         GET_PROC_SUFFIX(MapBufferRange, EXT);
    831         GET_PROC_SUFFIX(FlushMappedBufferRange, EXT);
    832     }
    833 
    834     if (extensions.has("GL_EXT_debug_marker")) {
    835         GET_PROC_SUFFIX(InsertEventMarker, EXT);
    836         GET_PROC_SUFFIX(PushGroupMarker, EXT);
    837         GET_PROC_SUFFIX(PopGroupMarker, EXT);
    838     }
    839 
    840     GET_PROC(InvalidateFramebuffer);
    841     GET_PROC(InvalidateSubFramebuffer);
    842     GET_PROC(InvalidateBufferData);
    843     GET_PROC(InvalidateBufferSubData);
    844     GET_PROC(InvalidateTexImage);
    845     GET_PROC(InvalidateTexSubImage);
    846 
    847     if (version >= GR_GL_VER(3,1)) {
    848         GET_PROC(GetProgramResourceLocation);
    849     }
    850 
    851     if (extensions.has("GL_NV_path_rendering")) {
    852         GET_PROC_SUFFIX(MatrixLoadf, EXT);
    853         GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
    854         GET_PROC_SUFFIX(PathCommands, NV);
    855         GET_PROC_SUFFIX(PathParameteri, NV);
    856         GET_PROC_SUFFIX(PathParameterf, NV);
    857         GET_PROC_SUFFIX(GenPaths, NV);
    858         GET_PROC_SUFFIX(DeletePaths, NV);
    859         GET_PROC_SUFFIX(IsPath, NV);
    860         GET_PROC_SUFFIX(PathStencilFunc, NV);
    861         GET_PROC_SUFFIX(StencilFillPath, NV);
    862         GET_PROC_SUFFIX(StencilStrokePath, NV);
    863         GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
    864         GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
    865         GET_PROC_SUFFIX(CoverFillPath, NV);
    866         GET_PROC_SUFFIX(CoverStrokePath, NV);
    867         GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
    868         GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
    869         GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
    870         GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
    871         GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
    872         GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
    873         GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
    874     }
    875 
    876     if (extensions.has("GL_CHROMIUM_path_rendering")) {
    877         GET_PROC_SUFFIX(MatrixLoadf, CHROMIUM);
    878         GET_PROC_SUFFIX(MatrixLoadIdentity, CHROMIUM);
    879         GET_PROC_SUFFIX(PathCommands, CHROMIUM);
    880         GET_PROC_SUFFIX(PathParameteri, CHROMIUM);
    881         GET_PROC_SUFFIX(PathParameterf, CHROMIUM);
    882         GET_PROC_SUFFIX(GenPaths, CHROMIUM);
    883         GET_PROC_SUFFIX(DeletePaths, CHROMIUM);
    884         GET_PROC_SUFFIX(IsPath, CHROMIUM);
    885         GET_PROC_SUFFIX(PathStencilFunc, CHROMIUM);
    886         GET_PROC_SUFFIX(StencilFillPath, CHROMIUM);
    887         GET_PROC_SUFFIX(StencilStrokePath, CHROMIUM);
    888         GET_PROC_SUFFIX(StencilFillPathInstanced, CHROMIUM);
    889         GET_PROC_SUFFIX(StencilStrokePathInstanced, CHROMIUM);
    890         GET_PROC_SUFFIX(CoverFillPath, CHROMIUM);
    891         GET_PROC_SUFFIX(CoverStrokePath, CHROMIUM);
    892         GET_PROC_SUFFIX(CoverFillPathInstanced, CHROMIUM);
    893         GET_PROC_SUFFIX(CoverStrokePathInstanced, CHROMIUM);
    894         GET_PROC_SUFFIX(StencilThenCoverFillPath, CHROMIUM);
    895         GET_PROC_SUFFIX(StencilThenCoverStrokePath, CHROMIUM);
    896         GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, CHROMIUM);
    897         GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, CHROMIUM);
    898         GET_PROC_SUFFIX(ProgramPathFragmentInputGen, CHROMIUM);
    899         // GL_CHROMIUM_path_rendering additions:
    900         GET_PROC_SUFFIX(BindFragmentInputLocation, CHROMIUM);
    901     }
    902 
    903     if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
    904         GET_PROC_SUFFIX(CoverageModulation, NV);
    905     }
    906     if (extensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) {
    907         GET_PROC_SUFFIX(CoverageModulation, CHROMIUM);
    908     }
    909 
    910     if (extensions.has("GL_NV_bindless_texture")) {
    911         GET_PROC_SUFFIX(GetTextureHandle, NV);
    912         GET_PROC_SUFFIX(GetTextureSamplerHandle, NV);
    913         GET_PROC_SUFFIX(MakeTextureHandleResident, NV);
    914         GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV);
    915         GET_PROC_SUFFIX(GetImageHandle, NV);
    916         GET_PROC_SUFFIX(MakeImageHandleResident, NV);
    917         GET_PROC_SUFFIX(MakeImageHandleNonResident, NV);
    918         GET_PROC_SUFFIX(IsTextureHandleResident, NV);
    919         GET_PROC_SUFFIX(IsImageHandleResident, NV);
    920         GET_PROC_SUFFIX(UniformHandleui64, NV);
    921         GET_PROC_SUFFIX(UniformHandleui64v, NV);
    922         GET_PROC_SUFFIX(ProgramUniformHandleui64, NV);
    923         GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV);
    924     }
    925 
    926     if (extensions.has("GL_KHR_debug")) {
    927         GET_PROC_SUFFIX(DebugMessageControl, KHR);
    928         GET_PROC_SUFFIX(DebugMessageInsert, KHR);
    929         GET_PROC_SUFFIX(DebugMessageCallback, KHR);
    930         GET_PROC_SUFFIX(GetDebugMessageLog, KHR);
    931         GET_PROC_SUFFIX(PushDebugGroup, KHR);
    932         GET_PROC_SUFFIX(PopDebugGroup, KHR);
    933         GET_PROC_SUFFIX(ObjectLabel, KHR);
    934         // In general we have a policy against removing extension strings when the driver does
    935         // not provide function pointers for an advertised extension. However, because there is a
    936         // known device that advertises GL_KHR_debug but fails to provide the functions and this is
    937         // a debugging- only extension we've made an exception. This also can happen when using
    938         // APITRACE.
    939         if (!interface->fFunctions.fDebugMessageControl) {
    940             extensions.remove("GL_KHR_debug");
    941         }
    942     }
    943 
    944     if (extensions.has("GL_CHROMIUM_bind_uniform_location")) {
    945         GET_PROC_SUFFIX(BindUniformLocation, CHROMIUM);
    946     }
    947 
    948     if (extensions.has("GL_EXT_window_rectangles")) {
    949         GET_PROC_SUFFIX(WindowRectangles, EXT);
    950     }
    951 
    952     if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
    953         GET_EGL_PROC_SUFFIX(CreateImage, KHR);
    954         GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
    955     }
    956 
    957     if (extensions.has("GL_OES_sample_shading")) {
    958         GET_PROC_SUFFIX(MinSampleShading, OES);
    959     }
    960 
    961     if (version >= GR_GL_VER(3, 0)) {
    962         GET_PROC(FenceSync);
    963         GET_PROC(IsSync);
    964         GET_PROC(ClientWaitSync);
    965         GET_PROC(WaitSync);
    966         GET_PROC(DeleteSync);
    967     } else if (extensions.has("GL_APPLE_sync")) {
    968         GET_PROC_SUFFIX(FenceSync, APPLE);
    969         GET_PROC_SUFFIX(IsSync, APPLE);
    970         GET_PROC_SUFFIX(ClientWaitSync, APPLE);
    971         GET_PROC_SUFFIX(WaitSync, APPLE);
    972         GET_PROC_SUFFIX(DeleteSync, APPLE);
    973     }
    974 
    975     if (version >= GR_GL_VER(3, 1)) {
    976         GET_PROC(BindImageTexture);
    977         GET_PROC(MemoryBarrier);
    978         GET_PROC(MemoryBarrierByRegion);
    979     }
    980 
    981     if (version >= GR_GL_VER(3,0)) {
    982         GET_PROC(GetInternalformativ);
    983     }
    984 
    985     if (version >= GR_GL_VER(3, 0)) {
    986         GET_PROC(GetProgramBinary);
    987         GET_PROC(ProgramBinary);
    988         GET_PROC(ProgramParameteri);
    989     }
    990 
    991     interface->fStandard = kGLES_GrGLStandard;
    992     interface->fExtensions.swap(&extensions);
    993 
    994     return interface;
    995 }
    996 
    997 SK_API const GrGLInterface* GrGLAssembleInterface(void *ctx, GrGLGetProc get) {
    998     return GrGLMakeAssembledInterface(ctx, get).release();
    999 }
   1000