1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2019 Google LLC
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci *
7cb93a386Sopenharmony_ci * THIS FILE IS AUTOGENERATED
8cb93a386Sopenharmony_ci * Make edits to tools/gpu/gl/interface/templates.go or they will
9cb93a386Sopenharmony_ci * be overwritten.
10cb93a386Sopenharmony_ci */
11cb93a386Sopenharmony_ci
12cb93a386Sopenharmony_ci#include "include/gpu/gl/GrGLAssembleHelpers.h"
13cb93a386Sopenharmony_ci#include "include/gpu/gl/GrGLAssembleInterface.h"
14cb93a386Sopenharmony_ci#include "src/gpu/gl/GrGLUtil.h"
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ci#define GET_PROC(F) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F)
17cb93a386Sopenharmony_ci#define GET_PROC_SUFFIX(F, S) functions->f##F = (GrGL##F##Fn*)get(ctx, "gl" #F #S)
18cb93a386Sopenharmony_ci#define GET_PROC_LOCAL(F) GrGL##F##Fn* F = (GrGL##F##Fn*)get(ctx, "gl" #F)
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ci#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL##F = (GrEGL##F##Fn*)get(ctx, "egl" #F #S)
21cb93a386Sopenharmony_ci
22cb93a386Sopenharmony_ci#if SK_DISABLE_GL_ES_INTERFACE
23cb93a386Sopenharmony_cisk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get) {
24cb93a386Sopenharmony_ci    return nullptr;
25cb93a386Sopenharmony_ci}
26cb93a386Sopenharmony_ci#else
27cb93a386Sopenharmony_cisk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get) {
28cb93a386Sopenharmony_ci    GET_PROC_LOCAL(GetString);
29cb93a386Sopenharmony_ci    if (nullptr == GetString) {
30cb93a386Sopenharmony_ci        return nullptr;
31cb93a386Sopenharmony_ci    }
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ci    const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
34cb93a386Sopenharmony_ci    GrGLVersion glVer = GrGLGetVersionFromString(verStr);
35cb93a386Sopenharmony_ci
36cb93a386Sopenharmony_ci    if (glVer < GR_GL_VER(2,0)) {
37cb93a386Sopenharmony_ci        return nullptr;
38cb93a386Sopenharmony_ci    }
39cb93a386Sopenharmony_ci
40cb93a386Sopenharmony_ci    GET_PROC_LOCAL(GetIntegerv);
41cb93a386Sopenharmony_ci    GET_PROC_LOCAL(GetStringi);
42cb93a386Sopenharmony_ci    GrEGLQueryStringFn* queryString;
43cb93a386Sopenharmony_ci    GrEGLDisplay display;
44cb93a386Sopenharmony_ci    GrGetEGLQueryAndDisplay(&queryString, &display, ctx, get);
45cb93a386Sopenharmony_ci    GrGLExtensions extensions;
46cb93a386Sopenharmony_ci    if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
47cb93a386Sopenharmony_ci                         display)) {
48cb93a386Sopenharmony_ci        return nullptr;
49cb93a386Sopenharmony_ci    }
50cb93a386Sopenharmony_ci
51cb93a386Sopenharmony_ci    sk_sp<GrGLInterface> interface(new GrGLInterface);
52cb93a386Sopenharmony_ci    GrGLInterface::Functions* functions = &interface->fFunctions;
53cb93a386Sopenharmony_ci
54cb93a386Sopenharmony_ci    // Autogenerated content follows
55cb93a386Sopenharmony_ci    GET_PROC(ActiveTexture);
56cb93a386Sopenharmony_ci    GET_PROC(AttachShader);
57cb93a386Sopenharmony_ci    GET_PROC(BindAttribLocation);
58cb93a386Sopenharmony_ci    GET_PROC(BindBuffer);
59cb93a386Sopenharmony_ci    GET_PROC(BindTexture);
60cb93a386Sopenharmony_ci    GET_PROC(BlendColor);
61cb93a386Sopenharmony_ci    GET_PROC(BlendEquation);
62cb93a386Sopenharmony_ci    GET_PROC(BlendFunc);
63cb93a386Sopenharmony_ci    GET_PROC(BufferData);
64cb93a386Sopenharmony_ci    GET_PROC(BufferSubData);
65cb93a386Sopenharmony_ci    GET_PROC(Clear);
66cb93a386Sopenharmony_ci    GET_PROC(ClearColor);
67cb93a386Sopenharmony_ci    GET_PROC(ClearStencil);
68cb93a386Sopenharmony_ci    GET_PROC(ColorMask);
69cb93a386Sopenharmony_ci    GET_PROC(CompileShader);
70cb93a386Sopenharmony_ci    GET_PROC(CompressedTexImage2D);
71cb93a386Sopenharmony_ci    GET_PROC(CompressedTexSubImage2D);
72cb93a386Sopenharmony_ci    GET_PROC(CopyTexSubImage2D);
73cb93a386Sopenharmony_ci    GET_PROC(CreateProgram);
74cb93a386Sopenharmony_ci    GET_PROC(CreateShader);
75cb93a386Sopenharmony_ci    GET_PROC(CullFace);
76cb93a386Sopenharmony_ci    GET_PROC(DeleteBuffers);
77cb93a386Sopenharmony_ci    GET_PROC(DeleteProgram);
78cb93a386Sopenharmony_ci    GET_PROC(DeleteShader);
79cb93a386Sopenharmony_ci    GET_PROC(DeleteTextures);
80cb93a386Sopenharmony_ci    GET_PROC(DepthMask);
81cb93a386Sopenharmony_ci    GET_PROC(Disable);
82cb93a386Sopenharmony_ci    GET_PROC(DisableVertexAttribArray);
83cb93a386Sopenharmony_ci    GET_PROC(DrawArrays);
84cb93a386Sopenharmony_ci    GET_PROC(DrawElements);
85cb93a386Sopenharmony_ci    GET_PROC(Enable);
86cb93a386Sopenharmony_ci    GET_PROC(EnableVertexAttribArray);
87cb93a386Sopenharmony_ci    GET_PROC(Finish);
88cb93a386Sopenharmony_ci    GET_PROC(Flush);
89cb93a386Sopenharmony_ci    GET_PROC(FrontFace);
90cb93a386Sopenharmony_ci    GET_PROC(GenBuffers);
91cb93a386Sopenharmony_ci    GET_PROC(GenTextures);
92cb93a386Sopenharmony_ci    GET_PROC(GetBufferParameteriv);
93cb93a386Sopenharmony_ci    GET_PROC(GetError);
94cb93a386Sopenharmony_ci    GET_PROC(GetIntegerv);
95cb93a386Sopenharmony_ci    GET_PROC(GetProgramInfoLog);
96cb93a386Sopenharmony_ci    GET_PROC(GetProgramiv);
97cb93a386Sopenharmony_ci    GET_PROC(GetShaderInfoLog);
98cb93a386Sopenharmony_ci    GET_PROC(GetShaderiv);
99cb93a386Sopenharmony_ci    GET_PROC(GetString);
100cb93a386Sopenharmony_ci    GET_PROC(GetUniformLocation);
101cb93a386Sopenharmony_ci    GET_PROC(IsTexture);
102cb93a386Sopenharmony_ci    GET_PROC(LineWidth);
103cb93a386Sopenharmony_ci    GET_PROC(LinkProgram);
104cb93a386Sopenharmony_ci    GET_PROC(PixelStorei);
105cb93a386Sopenharmony_ci    GET_PROC(ReadPixels);
106cb93a386Sopenharmony_ci    GET_PROC(Scissor);
107cb93a386Sopenharmony_ci    GET_PROC(ShaderSource);
108cb93a386Sopenharmony_ci    GET_PROC(StencilFunc);
109cb93a386Sopenharmony_ci    GET_PROC(StencilFuncSeparate);
110cb93a386Sopenharmony_ci    GET_PROC(StencilMask);
111cb93a386Sopenharmony_ci    GET_PROC(StencilMaskSeparate);
112cb93a386Sopenharmony_ci    GET_PROC(StencilOp);
113cb93a386Sopenharmony_ci    GET_PROC(StencilOpSeparate);
114cb93a386Sopenharmony_ci    GET_PROC(TexImage2D);
115cb93a386Sopenharmony_ci    GET_PROC(TexParameterf);
116cb93a386Sopenharmony_ci    GET_PROC(TexParameterfv);
117cb93a386Sopenharmony_ci    GET_PROC(TexParameteri);
118cb93a386Sopenharmony_ci    GET_PROC(TexParameteriv);
119cb93a386Sopenharmony_ci    GET_PROC(TexSubImage2D);
120cb93a386Sopenharmony_ci    GET_PROC(Uniform1f);
121cb93a386Sopenharmony_ci    GET_PROC(Uniform1fv);
122cb93a386Sopenharmony_ci    GET_PROC(Uniform1i);
123cb93a386Sopenharmony_ci    GET_PROC(Uniform1iv);
124cb93a386Sopenharmony_ci    GET_PROC(Uniform2f);
125cb93a386Sopenharmony_ci    GET_PROC(Uniform2fv);
126cb93a386Sopenharmony_ci    GET_PROC(Uniform2i);
127cb93a386Sopenharmony_ci    GET_PROC(Uniform2iv);
128cb93a386Sopenharmony_ci    GET_PROC(Uniform3f);
129cb93a386Sopenharmony_ci    GET_PROC(Uniform3fv);
130cb93a386Sopenharmony_ci    GET_PROC(Uniform3i);
131cb93a386Sopenharmony_ci    GET_PROC(Uniform3iv);
132cb93a386Sopenharmony_ci    GET_PROC(Uniform4f);
133cb93a386Sopenharmony_ci    GET_PROC(Uniform4fv);
134cb93a386Sopenharmony_ci    GET_PROC(Uniform4i);
135cb93a386Sopenharmony_ci    GET_PROC(Uniform4iv);
136cb93a386Sopenharmony_ci    GET_PROC(UniformMatrix2fv);
137cb93a386Sopenharmony_ci    GET_PROC(UniformMatrix3fv);
138cb93a386Sopenharmony_ci    GET_PROC(UniformMatrix4fv);
139cb93a386Sopenharmony_ci    GET_PROC(UseProgram);
140cb93a386Sopenharmony_ci    GET_PROC(VertexAttrib1f);
141cb93a386Sopenharmony_ci    GET_PROC(VertexAttrib2fv);
142cb93a386Sopenharmony_ci    GET_PROC(VertexAttrib3fv);
143cb93a386Sopenharmony_ci    GET_PROC(VertexAttrib4fv);
144cb93a386Sopenharmony_ci    GET_PROC(VertexAttribPointer);
145cb93a386Sopenharmony_ci    GET_PROC(Viewport);
146cb93a386Sopenharmony_ci
147cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
148cb93a386Sopenharmony_ci        GET_PROC(GetStringi);
149cb93a386Sopenharmony_ci    }
150cb93a386Sopenharmony_ci
151cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,1)) {
152cb93a386Sopenharmony_ci        GET_PROC(MemoryBarrier);
153cb93a386Sopenharmony_ci    }
154cb93a386Sopenharmony_ci
155cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
156cb93a386Sopenharmony_ci        GET_PROC(BindVertexArray);
157cb93a386Sopenharmony_ci        GET_PROC(DeleteVertexArrays);
158cb93a386Sopenharmony_ci        GET_PROC(GenVertexArrays);
159cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_vertex_array_object")) {
160cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BindVertexArray, OES);
161cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DeleteVertexArrays, OES);
162cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GenVertexArrays, OES);
163cb93a386Sopenharmony_ci    }
164cb93a386Sopenharmony_ci
165cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,2)) {
166cb93a386Sopenharmony_ci        GET_PROC(PatchParameteri);
167cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_tessellation_shader")) {
168cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(PatchParameteri, OES);
169cb93a386Sopenharmony_ci    }
170cb93a386Sopenharmony_ci
171cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
172cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BindFragDataLocation, EXT);
173cb93a386Sopenharmony_ci    }
174cb93a386Sopenharmony_ci
175cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
176cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
177cb93a386Sopenharmony_ci    }
178cb93a386Sopenharmony_ci
179cb93a386Sopenharmony_ci    if (extensions.has("GL_KHR_blend_equation_advanced")) {
180cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BlendBarrier, KHR);
181cb93a386Sopenharmony_ci    } else if (extensions.has("GL_NV_blend_equation_advanced")) {
182cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BlendBarrier, NV);
183cb93a386Sopenharmony_ci    }
184cb93a386Sopenharmony_ci
185cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_clear_texture")) {
186cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ClearTexImage, EXT);
187cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ClearTexSubImage, EXT);
188cb93a386Sopenharmony_ci    }
189cb93a386Sopenharmony_ci
190cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
191cb93a386Sopenharmony_ci        GET_PROC(DrawArraysInstanced);
192cb93a386Sopenharmony_ci        GET_PROC(DrawElementsInstanced);
193cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_draw_instanced")) {
194cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
195cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
196cb93a386Sopenharmony_ci    } else if (extensions.has("GL_ANGLE_instanced_arrays")) {
197cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawArraysInstanced, ANGLE);
198cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawElementsInstanced, ANGLE);
199cb93a386Sopenharmony_ci    }
200cb93a386Sopenharmony_ci
201cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_base_instance")) {
202cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawArraysInstancedBaseInstance, EXT);
203cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawElementsInstancedBaseVertexBaseInstance, EXT);
204cb93a386Sopenharmony_ci    } else if (extensions.has("GL_ANGLE_base_vertex_base_instance")) {
205cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawArraysInstancedBaseInstance, ANGLE);
206cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DrawElementsInstancedBaseVertexBaseInstance, ANGLE);
207cb93a386Sopenharmony_ci    }
208cb93a386Sopenharmony_ci
209cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
210cb93a386Sopenharmony_ci        GET_PROC(DrawBuffers);
211cb93a386Sopenharmony_ci        GET_PROC(ReadBuffer);
212cb93a386Sopenharmony_ci    }
213cb93a386Sopenharmony_ci
214cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,1)) {
215cb93a386Sopenharmony_ci        GET_PROC(DrawArraysIndirect);
216cb93a386Sopenharmony_ci        GET_PROC(DrawElementsIndirect);
217cb93a386Sopenharmony_ci    }
218cb93a386Sopenharmony_ci
219cb93a386Sopenharmony_ci    if (extensions.has("GL_ANGLE_base_vertex_base_instance")) {
220cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MultiDrawArraysInstancedBaseInstance, ANGLE);
221cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MultiDrawElementsInstancedBaseVertexBaseInstance, ANGLE);
222cb93a386Sopenharmony_ci    }
223cb93a386Sopenharmony_ci
224cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
225cb93a386Sopenharmony_ci        GET_PROC(DrawRangeElements);
226cb93a386Sopenharmony_ci    }
227cb93a386Sopenharmony_ci
228cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,1)) {
229cb93a386Sopenharmony_ci        GET_PROC(GetMultisamplefv);
230cb93a386Sopenharmony_ci    }
231cb93a386Sopenharmony_ci
232cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,1)) {
233cb93a386Sopenharmony_ci        GET_PROC(GetTexLevelParameteriv);
234cb93a386Sopenharmony_ci    }
235cb93a386Sopenharmony_ci
236cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_multi_draw_indirect")) {
237cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MultiDrawArraysIndirect, EXT);
238cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MultiDrawElementsIndirect, EXT);
239cb93a386Sopenharmony_ci    }
240cb93a386Sopenharmony_ci
241cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,2)) {
242cb93a386Sopenharmony_ci        GET_PROC(TexBuffer);
243cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_texture_buffer")) {
244cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TexBuffer, OES);
245cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_texture_buffer")) {
246cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TexBuffer, EXT);
247cb93a386Sopenharmony_ci    }
248cb93a386Sopenharmony_ci
249cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,2)) {
250cb93a386Sopenharmony_ci        GET_PROC(TexBufferRange);
251cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_texture_buffer")) {
252cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TexBufferRange, OES);
253cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_texture_buffer")) {
254cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TexBufferRange, EXT);
255cb93a386Sopenharmony_ci    }
256cb93a386Sopenharmony_ci
257cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
258cb93a386Sopenharmony_ci        GET_PROC(TexStorage2D);
259cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_texture_storage")) {
260cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TexStorage2D, EXT);
261cb93a386Sopenharmony_ci    }
262cb93a386Sopenharmony_ci
263cb93a386Sopenharmony_ci    if (extensions.has("GL_NV_texture_barrier")) {
264cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TextureBarrier, NV);
265cb93a386Sopenharmony_ci    }
266cb93a386Sopenharmony_ci
267cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_discard_framebuffer")) {
268cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
269cb93a386Sopenharmony_ci    }
270cb93a386Sopenharmony_ci
271cb93a386Sopenharmony_ci    if (extensions.has("GL_QCOM_tiled_rendering")) {
272cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(EndTiling, QCOM);
273cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(StartTiling, QCOM);
274cb93a386Sopenharmony_ci    }
275cb93a386Sopenharmony_ci
276cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
277cb93a386Sopenharmony_ci        GET_PROC(VertexAttribDivisor);
278cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_instanced_arrays")) {
279cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(VertexAttribDivisor, EXT);
280cb93a386Sopenharmony_ci    } else if (extensions.has("GL_ANGLE_instanced_arrays")) {
281cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(VertexAttribDivisor, ANGLE);
282cb93a386Sopenharmony_ci    }
283cb93a386Sopenharmony_ci
284cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
285cb93a386Sopenharmony_ci        GET_PROC(VertexAttribIPointer);
286cb93a386Sopenharmony_ci    }
287cb93a386Sopenharmony_ci
288cb93a386Sopenharmony_ci    GET_PROC(BindFramebuffer);
289cb93a386Sopenharmony_ci    GET_PROC(BindRenderbuffer);
290cb93a386Sopenharmony_ci    GET_PROC(CheckFramebufferStatus);
291cb93a386Sopenharmony_ci    GET_PROC(DeleteFramebuffers);
292cb93a386Sopenharmony_ci    GET_PROC(DeleteRenderbuffers);
293cb93a386Sopenharmony_ci    GET_PROC(FramebufferRenderbuffer);
294cb93a386Sopenharmony_ci    GET_PROC(FramebufferTexture2D);
295cb93a386Sopenharmony_ci    GET_PROC(GenFramebuffers);
296cb93a386Sopenharmony_ci    GET_PROC(GenRenderbuffers);
297cb93a386Sopenharmony_ci    GET_PROC(GenerateMipmap);
298cb93a386Sopenharmony_ci    GET_PROC(GetFramebufferAttachmentParameteriv);
299cb93a386Sopenharmony_ci    GET_PROC(GetRenderbufferParameteriv);
300cb93a386Sopenharmony_ci    GET_PROC(RenderbufferStorage);
301cb93a386Sopenharmony_ci
302cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
303cb93a386Sopenharmony_ci        GET_PROC(BlitFramebuffer);
304cb93a386Sopenharmony_ci    } else if (extensions.has("GL_NV_framebuffer_blit")) {
305cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BlitFramebuffer, NV);
306cb93a386Sopenharmony_ci    } else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
307cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM);
308cb93a386Sopenharmony_ci    } else if (extensions.has("GL_ANGLE_framebuffer_blit")) {
309cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BlitFramebuffer, ANGLE);
310cb93a386Sopenharmony_ci    }
311cb93a386Sopenharmony_ci
312cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
313cb93a386Sopenharmony_ci        GET_PROC(RenderbufferStorageMultisample);
314cb93a386Sopenharmony_ci    } else if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
315cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(RenderbufferStorageMultisample, CHROMIUM);
316cb93a386Sopenharmony_ci    } else if (extensions.has("GL_ANGLE_framebuffer_multisample")) {
317cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(RenderbufferStorageMultisample, ANGLE);
318cb93a386Sopenharmony_ci    }
319cb93a386Sopenharmony_ci
320cb93a386Sopenharmony_ci    if (extensions.has("GL_CHROMIUM_map_sub")) {
321cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MapBufferSubData, CHROMIUM);
322cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MapTexSubImage2D, CHROMIUM);
323cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(UnmapBufferSubData, CHROMIUM);
324cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(UnmapTexSubImage2D, CHROMIUM);
325cb93a386Sopenharmony_ci    }
326cb93a386Sopenharmony_ci
327cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
328cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT);
329cb93a386Sopenharmony_ci    } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
330cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG);
331cb93a386Sopenharmony_ci    }
332cb93a386Sopenharmony_ci
333cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
334cb93a386Sopenharmony_ci        functions->fRenderbufferStorageMultisampleES2EXT =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleEXT");
335cb93a386Sopenharmony_ci    }
336cb93a386Sopenharmony_ci
337cb93a386Sopenharmony_ci    if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
338cb93a386Sopenharmony_ci        functions->fRenderbufferStorageMultisampleES2EXT =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleIMG");
339cb93a386Sopenharmony_ci    }
340cb93a386Sopenharmony_ci
341cb93a386Sopenharmony_ci    if (extensions.has("GL_APPLE_framebuffer_multisample")) {
342cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE);
343cb93a386Sopenharmony_ci        functions->fRenderbufferStorageMultisampleES2APPLE =(GrGLRenderbufferStorageMultisampleFn*)get(ctx, "glRenderbufferStorageMultisampleAPPLE");
344cb93a386Sopenharmony_ci    }
345cb93a386Sopenharmony_ci
346cb93a386Sopenharmony_ci    if (extensions.has("GL_OES_mapbuffer")) {
347cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MapBuffer, OES);
348cb93a386Sopenharmony_ci    }
349cb93a386Sopenharmony_ci
350cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
351cb93a386Sopenharmony_ci        GET_PROC(UnmapBuffer);
352cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_mapbuffer")) {
353cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(UnmapBuffer, OES);
354cb93a386Sopenharmony_ci    }
355cb93a386Sopenharmony_ci
356cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
357cb93a386Sopenharmony_ci        GET_PROC(FlushMappedBufferRange);
358cb93a386Sopenharmony_ci        GET_PROC(MapBufferRange);
359cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_map_buffer_range")) {
360cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(FlushMappedBufferRange, EXT);
361cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(MapBufferRange, EXT);
362cb93a386Sopenharmony_ci    }
363cb93a386Sopenharmony_ci
364cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_debug_marker")) {
365cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(InsertEventMarker, EXT);
366cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(PopGroupMarker, EXT);
367cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(PushGroupMarker, EXT);
368cb93a386Sopenharmony_ci    }
369cb93a386Sopenharmony_ci
370cb93a386Sopenharmony_ci    if (extensions.has("GL_CHROMIUM_framebuffer_mixed_samples")) {
371cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(CoverageModulation, CHROMIUM);
372cb93a386Sopenharmony_ci    } else if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
373cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(CoverageModulation, NV);
374cb93a386Sopenharmony_ci    }
375cb93a386Sopenharmony_ci
376cb93a386Sopenharmony_ci    if (extensions.has("GL_KHR_debug")) {
377cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DebugMessageCallback, KHR);
378cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DebugMessageControl, KHR);
379cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DebugMessageInsert, KHR);
380cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GetDebugMessageLog, KHR);
381cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ObjectLabel, KHR);
382cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(PopDebugGroup, KHR);
383cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(PushDebugGroup, KHR);
384cb93a386Sopenharmony_ci    }
385cb93a386Sopenharmony_ci
386cb93a386Sopenharmony_ci    if (extensions.has("GL_CHROMIUM_bind_uniform_location")) {
387cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BindUniformLocation, CHROMIUM);
388cb93a386Sopenharmony_ci    }
389cb93a386Sopenharmony_ci
390cb93a386Sopenharmony_ci    if (extensions.has("GL_EXT_window_rectangles")) {
391cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(WindowRectangles, EXT);
392cb93a386Sopenharmony_ci    }
393cb93a386Sopenharmony_ci
394cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
395cb93a386Sopenharmony_ci        GET_PROC(ClientWaitSync);
396cb93a386Sopenharmony_ci        GET_PROC(DeleteSync);
397cb93a386Sopenharmony_ci        GET_PROC(FenceSync);
398cb93a386Sopenharmony_ci        GET_PROC(IsSync);
399cb93a386Sopenharmony_ci        GET_PROC(WaitSync);
400cb93a386Sopenharmony_ci    } else if (extensions.has("GL_APPLE_sync")) {
401cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ClientWaitSync, APPLE);
402cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DeleteSync, APPLE);
403cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(FenceSync, APPLE);
404cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(IsSync, APPLE);
405cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(WaitSync, APPLE);
406cb93a386Sopenharmony_ci    }
407cb93a386Sopenharmony_ci
408cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
409cb93a386Sopenharmony_ci        GET_PROC(GetInternalformativ);
410cb93a386Sopenharmony_ci    }
411cb93a386Sopenharmony_ci
412cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
413cb93a386Sopenharmony_ci        GET_PROC(GetProgramBinary);
414cb93a386Sopenharmony_ci        GET_PROC(ProgramBinary);
415cb93a386Sopenharmony_ci    } else if (extensions.has("GL_OES_get_program_binary")) {
416cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GetProgramBinary, OES);
417cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(ProgramBinary, OES);
418cb93a386Sopenharmony_ci    }
419cb93a386Sopenharmony_ci
420cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
421cb93a386Sopenharmony_ci        GET_PROC(ProgramParameteri);
422cb93a386Sopenharmony_ci    }
423cb93a386Sopenharmony_ci
424cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
425cb93a386Sopenharmony_ci        GET_PROC(BindSampler);
426cb93a386Sopenharmony_ci        GET_PROC(DeleteSamplers);
427cb93a386Sopenharmony_ci        GET_PROC(GenSamplers);
428cb93a386Sopenharmony_ci        GET_PROC(SamplerParameteri);
429cb93a386Sopenharmony_ci        GET_PROC(SamplerParameteriv);
430cb93a386Sopenharmony_ci    }
431cb93a386Sopenharmony_ci
432cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
433cb93a386Sopenharmony_ci#if GR_TEST_UTILS
434cb93a386Sopenharmony_ci        GET_PROC(BeginQuery);
435cb93a386Sopenharmony_ci        GET_PROC(DeleteQueries);
436cb93a386Sopenharmony_ci        GET_PROC(EndQuery);
437cb93a386Sopenharmony_ci        GET_PROC(GenQueries);
438cb93a386Sopenharmony_ci        GET_PROC(GetQueryObjectuiv);
439cb93a386Sopenharmony_ci        GET_PROC(GetQueryiv);
440cb93a386Sopenharmony_ci#endif
441cb93a386Sopenharmony_ci    } else if (extensions.has("GL_EXT_occlusion_query_boolean")) {
442cb93a386Sopenharmony_ci#if GR_TEST_UTILS
443cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(BeginQuery, EXT);
444cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DeleteQueries, EXT);
445cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(EndQuery, EXT);
446cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GenQueries, EXT);
447cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GetQueryObjectuiv, EXT);
448cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GetQueryiv, EXT);
449cb93a386Sopenharmony_ci#endif
450cb93a386Sopenharmony_ci    }
451cb93a386Sopenharmony_ci
452cb93a386Sopenharmony_ci    if (glVer >= GR_GL_VER(3,0)) {
453cb93a386Sopenharmony_ci        GET_PROC(InvalidateFramebuffer);
454cb93a386Sopenharmony_ci        GET_PROC(InvalidateSubFramebuffer);
455cb93a386Sopenharmony_ci    }
456cb93a386Sopenharmony_ci
457cb93a386Sopenharmony_ci    GET_PROC(GetShaderPrecisionFormat);
458cb93a386Sopenharmony_ci
459cb93a386Sopenharmony_ci    if (extensions.has("GL_NV_fence")) {
460cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(DeleteFences, NV);
461cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(FinishFence, NV);
462cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(GenFences, NV);
463cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(SetFence, NV);
464cb93a386Sopenharmony_ci        GET_PROC_SUFFIX(TestFence, NV);
465cb93a386Sopenharmony_ci    }
466cb93a386Sopenharmony_ci
467cb93a386Sopenharmony_ci
468cb93a386Sopenharmony_ci    // End autogenerated content
469cb93a386Sopenharmony_ci    // TODO(kjlubick): Do we want a feature that removes the extension if it doesn't have
470cb93a386Sopenharmony_ci    // the function? This is common on some low-end GPUs.
471cb93a386Sopenharmony_ci
472cb93a386Sopenharmony_ci    if (extensions.has("GL_KHR_debug")) {
473cb93a386Sopenharmony_ci        // In general we have a policy against removing extension strings when the driver does
474cb93a386Sopenharmony_ci        // not provide function pointers for an advertised extension. However, because there is a
475cb93a386Sopenharmony_ci        // known device that advertises GL_KHR_debug but fails to provide the functions and this is
476cb93a386Sopenharmony_ci        // a debugging- only extension we've made an exception. This also can happen when using
477cb93a386Sopenharmony_ci        // APITRACE.
478cb93a386Sopenharmony_ci        if (!interface->fFunctions.fDebugMessageControl) {
479cb93a386Sopenharmony_ci            extensions.remove("GL_KHR_debug");
480cb93a386Sopenharmony_ci        }
481cb93a386Sopenharmony_ci    }
482cb93a386Sopenharmony_ci    interface->fStandard = kGLES_GrGLStandard;
483cb93a386Sopenharmony_ci    interface->fExtensions.swap(&extensions);
484cb93a386Sopenharmony_ci
485cb93a386Sopenharmony_ci    return std::move(interface);
486cb93a386Sopenharmony_ci}
487cb93a386Sopenharmony_ci#endif
488