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