blob: dbc54adbe494315176a3ad327d461766d96b563e [file] [log] [blame]
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +00001
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10#include "GrGLAssembleInterface.h"
11#include "GrGLUtil.h"
12
13#define GET_PROC(F) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F)
14#define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F #S)
15#define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl" #F)
16
bsalomon7ea33f52015-11-22 14:51:00 -080017#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL ## F = (GrEGL ## F ## Proc) get(ctx, "egl" #F #S)
bsalomonb1a32ad2015-11-16 06:48:44 -080018
bsalomona721c812014-08-26 11:35:23 -070019const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
20 GET_PROC_LOCAL(GetString);
halcanary96fcdcc2015-08-27 07:41:13 -070021 if (nullptr == GetString) {
22 return nullptr;
bsalomona721c812014-08-26 11:35:23 -070023 }
24
25 const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
halcanary96fcdcc2015-08-27 07:41:13 -070026 if (nullptr == verStr) {
27 return nullptr;
bsalomona721c812014-08-26 11:35:23 -070028 }
29
30 GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);
31
32 if (kGLES_GrGLStandard == standard) {
33 return GrGLAssembleGLESInterface(ctx, get);
34 } else if (kGL_GrGLStandard == standard) {
35 return GrGLAssembleGLInterface(ctx, get);
36 }
halcanary96fcdcc2015-08-27 07:41:13 -070037 return nullptr;
bsalomona721c812014-08-26 11:35:23 -070038}
39
bsalomonb1a32ad2015-11-16 06:48:44 -080040static void get_egl_query_and_display(GrEGLQueryStringProc* queryString, GrEGLDisplay* display,
41 void* ctx, GrGLGetProc get) {
42 *queryString = (GrEGLQueryStringProc) get(ctx, "eglQueryString");
43 *display = GR_EGL_NO_DISPLAY;
44 if (*queryString) {
45 GrEGLGetCurrentDisplayProc getCurrentDisplay =
46 (GrEGLGetCurrentDisplayProc) get(ctx, "eglGetCurrentDisplay");
47 if (getCurrentDisplay) {
48 *display = getCurrentDisplay();
49 } else {
50 *queryString = nullptr;
51 }
52 }
53}
54
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000055const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
56 GET_PROC_LOCAL(GetString);
57 GET_PROC_LOCAL(GetStringi);
58 GET_PROC_LOCAL(GetIntegerv);
59
halcanary96fcdcc2015-08-27 07:41:13 -070060 // GetStringi may be nullptr depending on the GL version.
61 if (nullptr == GetString || nullptr == GetIntegerv) {
62 return nullptr;
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000063 }
64
65 const char* versionString = (const char*) GetString(GR_GL_VERSION);
66 GrGLVersion glVer = GrGLGetVersionFromString(versionString);
67
commit-bot@chromium.orgf4e67e32014-04-30 01:26:04 +000068 if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) {
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000069 // We must have array and element_array buffer objects.
halcanary96fcdcc2015-08-27 07:41:13 -070070 return nullptr;
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000071 }
72
bsalomonb1a32ad2015-11-16 06:48:44 -080073 GrEGLQueryStringProc queryString;
74 GrEGLDisplay display;
75 get_egl_query_and_display(&queryString, &display, ctx, get);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000076 GrGLExtensions extensions;
bsalomonb1a32ad2015-11-16 06:48:44 -080077 if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
78 display)) {
halcanary96fcdcc2015-08-27 07:41:13 -070079 return nullptr;
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000080 }
81
halcanary385fe4d2015-08-26 13:07:48 -070082 GrGLInterface* interface = new GrGLInterface();
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +000083 GrGLInterface::Functions* functions = &interface->fFunctions;
84
85 GET_PROC(ActiveTexture);
86 GET_PROC(AttachShader);
87 GET_PROC(BindAttribLocation);
88 GET_PROC(BindBuffer);
89 if (glVer >= GR_GL_VER(3,0)) {
90 GET_PROC(BindFragDataLocation);
91 }
92 GET_PROC(BeginQuery);
93 GET_PROC(BindTexture);
tomhudson2575f312015-04-21 14:16:53 -070094
cdaltonbae6f6c2015-04-22 10:39:03 -070095 if (extensions.has("GL_KHR_blend_equation_advanced")) {
96 GET_PROC_SUFFIX(BlendBarrier, KHR);
97 } else if (extensions.has("GL_NV_blend_equation_advanced")) {
98 GET_PROC_SUFFIX(BlendBarrier, NV);
tomhudson2575f312015-04-21 14:16:53 -070099 }
100
cdaltonbae6f6c2015-04-22 10:39:03 -0700101 if (glVer >= GR_GL_VER(1,4) ||
102 extensions.has("GL_ARB_imaging")) {
103 GET_PROC(BlendColor);
104 } else if (extensions.has("GL_EXT_blend_color")) {
105 GET_PROC_SUFFIX(BlendColor, EXT);
106 }
107
108 if (glVer >= GR_GL_VER(1,4) ||
109 extensions.has("GL_ARB_imaging")) {
110 GET_PROC(BlendEquation);
111 } else if (extensions.has("GL_EXT_blend_subtract")) {
112 GET_PROC_SUFFIX(BlendEquation, EXT);
113 }
114
115 GET_PROC(BlendFunc);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000116 GET_PROC(BufferData);
117 GET_PROC(BufferSubData);
118 GET_PROC(Clear);
119 GET_PROC(ClearColor);
120 GET_PROC(ClearStencil);
121 GET_PROC(ColorMask);
122 GET_PROC(CompileShader);
123 GET_PROC(CompressedTexImage2D);
krajcevski37d20f72014-06-11 10:38:47 -0700124 GET_PROC(CompressedTexSubImage2D);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000125 GET_PROC(CopyTexSubImage2D);
126 GET_PROC(CreateProgram);
127 GET_PROC(CreateShader);
128 GET_PROC(CullFace);
129 GET_PROC(DeleteBuffers);
130 GET_PROC(DeleteProgram);
131 GET_PROC(DeleteQueries);
132 GET_PROC(DeleteShader);
133 GET_PROC(DeleteTextures);
134 GET_PROC(DepthMask);
135 GET_PROC(Disable);
136 GET_PROC(DisableVertexAttribArray);
137 GET_PROC(DrawArrays);
138 GET_PROC(DrawBuffer);
139 GET_PROC(DrawBuffers);
140 GET_PROC(DrawElements);
141 GET_PROC(Enable);
142 GET_PROC(EnableVertexAttribArray);
143 GET_PROC(EndQuery);
144 GET_PROC(Finish);
145 GET_PROC(Flush);
146 GET_PROC(FrontFace);
147 GET_PROC(GenBuffers);
148 GET_PROC(GenerateMipmap);
149 GET_PROC(GetBufferParameteriv);
150 GET_PROC(GetError);
151 GET_PROC(GetIntegerv);
152 GET_PROC(GetQueryObjectiv);
153 GET_PROC(GetQueryObjectuiv);
154 if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
155 GET_PROC(GetQueryObjecti64v);
156 GET_PROC(GetQueryObjectui64v);
157 GET_PROC(QueryCounter);
158 } else if (extensions.has("GL_EXT_timer_query")) {
159 GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
160 GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
161 }
162 GET_PROC(GetQueryiv);
163 GET_PROC(GetProgramInfoLog);
164 GET_PROC(GetProgramiv);
165 GET_PROC(GetShaderInfoLog);
166 GET_PROC(GetShaderiv);
167 GET_PROC(GetString);
168 GET_PROC(GetStringi);
bsalomonee64d6e2014-12-03 10:46:08 -0800169 GET_PROC(GetShaderPrecisionFormat);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000170 GET_PROC(GetTexLevelParameteriv);
171 GET_PROC(GenQueries);
172 GET_PROC(GenTextures);
173 GET_PROC(GetUniformLocation);
bsalomon6dc6f5f2015-06-18 09:12:16 -0700174 GET_PROC(IsTexture);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000175 GET_PROC(LineWidth);
176 GET_PROC(LinkProgram);
177 GET_PROC(MapBuffer);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000178 GET_PROC(PixelStorei);
cdalton0edea2c2015-05-21 08:27:44 -0700179 if (extensions.has("GL_EXT_raster_multisample")) {
180 GET_PROC_SUFFIX(RasterSamples, EXT);
181 }
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000182 GET_PROC(ReadBuffer);
183 GET_PROC(ReadPixels);
184 GET_PROC(Scissor);
185 GET_PROC(ShaderSource);
186 GET_PROC(StencilFunc);
187 GET_PROC(StencilFuncSeparate);
188 GET_PROC(StencilMask);
189 GET_PROC(StencilMaskSeparate);
190 GET_PROC(StencilOp);
191 GET_PROC(StencilOpSeparate);
192 GET_PROC(TexImage2D);
193 GET_PROC(TexParameteri);
194 GET_PROC(TexParameteriv);
195 if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) {
196 GET_PROC(TexStorage2D);
197 } else if (extensions.has("GL_EXT_texture_storage")) {
198 GET_PROC_SUFFIX(TexStorage2D, EXT);
199 }
200 GET_PROC(TexSubImage2D);
cdaltonfd4167d2015-04-21 11:45:56 -0700201 if (glVer >= GR_GL_VER(4,5) || extensions.has("GL_ARB_texture_barrier")) {
202 GET_PROC(TextureBarrier);
203 } else if (extensions.has("GL_NV_texture_barrier")) {
204 GET_PROC_SUFFIX(TextureBarrier, NV);
205 }
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000206 GET_PROC(Uniform1f);
207 GET_PROC(Uniform1i);
208 GET_PROC(Uniform1fv);
209 GET_PROC(Uniform1iv);
210 GET_PROC(Uniform2f);
211 GET_PROC(Uniform2i);
212 GET_PROC(Uniform2fv);
213 GET_PROC(Uniform2iv);
214 GET_PROC(Uniform3f);
215 GET_PROC(Uniform3i);
216 GET_PROC(Uniform3fv);
217 GET_PROC(Uniform3iv);
218 GET_PROC(Uniform4f);
219 GET_PROC(Uniform4i);
220 GET_PROC(Uniform4fv);
221 GET_PROC(Uniform4iv);
222 GET_PROC(UniformMatrix2fv);
223 GET_PROC(UniformMatrix3fv);
224 GET_PROC(UniformMatrix4fv);
225 GET_PROC(UnmapBuffer);
226 GET_PROC(UseProgram);
egdaniel27c15212014-10-24 15:00:50 -0700227 GET_PROC(VertexAttrib1f);
228 GET_PROC(VertexAttrib2fv);
229 GET_PROC(VertexAttrib3fv);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000230 GET_PROC(VertexAttrib4fv);
231 GET_PROC(VertexAttribPointer);
232 GET_PROC(Viewport);
233 GET_PROC(BindFragDataLocationIndexed);
234
235 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object")) {
236 // no ARB suffix for GL_ARB_vertex_array_object
237 GET_PROC(BindVertexArray);
238 GET_PROC(GenVertexArrays);
239 GET_PROC(DeleteVertexArrays);
tomhudson612e9262014-11-24 11:22:36 -0800240 } else if (extensions.has("GL_APPLE_vertex_array_object")) {
241 GET_PROC_SUFFIX(BindVertexArray, APPLE);
242 GET_PROC_SUFFIX(GenVertexArrays, APPLE);
243 GET_PROC_SUFFIX(DeleteVertexArrays, APPLE);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000244 }
245
commit-bot@chromium.org160b4782014-05-05 12:32:37 +0000246 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_map_buffer_range")) {
247 GET_PROC(MapBufferRange);
248 GET_PROC(FlushMappedBufferRange);
249 }
250
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000251 // First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
252 // GL_ARB_framebuffer_object doesn't use ARB suffix.)
253 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) {
254 GET_PROC(GenFramebuffers);
255 GET_PROC(GetFramebufferAttachmentParameteriv);
256 GET_PROC(GetRenderbufferParameteriv);
257 GET_PROC(BindFramebuffer);
258 GET_PROC(FramebufferTexture2D);
259 GET_PROC(CheckFramebufferStatus);
260 GET_PROC(DeleteFramebuffers);
261 GET_PROC(RenderbufferStorage);
262 GET_PROC(GenRenderbuffers);
263 GET_PROC(DeleteRenderbuffers);
264 GET_PROC(FramebufferRenderbuffer);
265 GET_PROC(BindRenderbuffer);
266 GET_PROC(RenderbufferStorageMultisample);
267 GET_PROC(BlitFramebuffer);
268 } else if (extensions.has("GL_EXT_framebuffer_object")) {
269 GET_PROC_SUFFIX(GenFramebuffers, EXT);
270 GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
271 GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
272 GET_PROC_SUFFIX(BindFramebuffer, EXT);
273 GET_PROC_SUFFIX(FramebufferTexture2D, EXT);
274 GET_PROC_SUFFIX(CheckFramebufferStatus, EXT);
275 GET_PROC_SUFFIX(DeleteFramebuffers, EXT);
276 GET_PROC_SUFFIX(RenderbufferStorage, EXT);
277 GET_PROC_SUFFIX(GenRenderbuffers, EXT);
278 GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
279 GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
280 GET_PROC_SUFFIX(BindRenderbuffer, EXT);
281 if (extensions.has("GL_EXT_framebuffer_multisample")) {
282 GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
283 }
284 if (extensions.has("GL_EXT_framebuffer_blit")) {
285 GET_PROC_SUFFIX(BlitFramebuffer, EXT);
286 }
287 } else {
288 // we must have FBOs
289 delete interface;
halcanary96fcdcc2015-08-27 07:41:13 -0700290 return nullptr;
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000291 }
292
293 if (extensions.has("GL_NV_path_rendering")) {
cdalton626e1ff2015-06-12 13:56:46 -0700294 GET_PROC_SUFFIX(MatrixLoadf, EXT);
295 GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000296 GET_PROC_SUFFIX(PathCommands, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000297 GET_PROC_SUFFIX(PathParameteri, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000298 GET_PROC_SUFFIX(PathParameterf, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000299 GET_PROC_SUFFIX(GenPaths, NV);
300 GET_PROC_SUFFIX(DeletePaths, NV);
cdalton8dd90cb2014-07-17 09:28:36 -0700301 GET_PROC_SUFFIX(IsPath, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000302 GET_PROC_SUFFIX(PathStencilFunc, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000303 GET_PROC_SUFFIX(StencilFillPath, NV);
304 GET_PROC_SUFFIX(StencilStrokePath, NV);
305 GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
306 GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000307 GET_PROC_SUFFIX(CoverFillPath, NV);
308 GET_PROC_SUFFIX(CoverStrokePath, NV);
309 GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
310 GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
cdaltonc8f52042014-07-29 15:25:51 -0700311 GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
312 GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
313 GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
314 GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
kkinnunen32b9a3b2014-07-02 22:56:35 -0700315 GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000316 }
317
vbuzinov08b4d292015-04-01 06:29:49 -0700318 if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
319 GET_PROC_SUFFIX(CoverageModulation, NV);
320 }
321
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000322 if (extensions.has("GL_EXT_debug_marker")) {
323 GET_PROC_SUFFIX(InsertEventMarker, EXT);
324 GET_PROC_SUFFIX(PushGroupMarker, EXT);
325 GET_PROC_SUFFIX(PopGroupMarker, EXT);
326 }
327
328 if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_invalidate_subdata")) {
329 GET_PROC(InvalidateBufferData);
330 GET_PROC(InvalidateBufferSubData);
331 GET_PROC(InvalidateFramebuffer);
332 GET_PROC(InvalidateSubFramebuffer);
333 GET_PROC(InvalidateTexImage);
334 GET_PROC(InvalidateTexSubImage);
335 }
336
kkinnunen32b9a3b2014-07-02 22:56:35 -0700337 if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_ARB_program_interface_query")) {
338 GET_PROC(GetProgramResourceLocation);
339 }
340
hendrikwb3f16362015-10-19 06:13:55 -0700341 if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced") ||
342 extensions.has("GL_EXT_draw_instanced")) {
cdalton626e1ff2015-06-12 13:56:46 -0700343 GET_PROC(DrawArraysInstanced);
344 GET_PROC(DrawElementsInstanced);
345 }
346
347 if (glVer >= GR_GL_VER(3,2) || extensions.has("GL_ARB_instanced_arrays")) {
348 GET_PROC(VertexAttribDivisor);
349 }
350
351 if (extensions.has("GL_NV_bindless_texture")) {
352 GET_PROC_SUFFIX(GetTextureHandle, NV);
353 GET_PROC_SUFFIX(GetTextureSamplerHandle, NV);
354 GET_PROC_SUFFIX(MakeTextureHandleResident, NV);
355 GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV);
356 GET_PROC_SUFFIX(GetImageHandle, NV);
357 GET_PROC_SUFFIX(MakeImageHandleResident, NV);
358 GET_PROC_SUFFIX(MakeImageHandleNonResident, NV);
359 GET_PROC_SUFFIX(IsTextureHandleResident, NV);
360 GET_PROC_SUFFIX(IsImageHandleResident, NV);
361 GET_PROC_SUFFIX(UniformHandleui64, NV);
362 GET_PROC_SUFFIX(UniformHandleui64v, NV);
363 GET_PROC_SUFFIX(ProgramUniformHandleui64, NV);
364 GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV);
365 }
366
367 if (extensions.has("GL_EXT_direct_state_access")) {
368 GET_PROC_SUFFIX(TextureParameteri, EXT);
369 GET_PROC_SUFFIX(TextureParameteriv, EXT);
370 GET_PROC_SUFFIX(TextureParameterf, EXT);
371 GET_PROC_SUFFIX(TextureParameterfv, EXT);
372 GET_PROC_SUFFIX(TextureImage1D, EXT);
373 GET_PROC_SUFFIX(TextureImage2D, EXT);
374 GET_PROC_SUFFIX(TextureSubImage1D, EXT);
375 GET_PROC_SUFFIX(TextureSubImage2D, EXT);
376 GET_PROC_SUFFIX(CopyTextureImage1D, EXT);
377 GET_PROC_SUFFIX(CopyTextureImage2D, EXT);
378 GET_PROC_SUFFIX(CopyTextureSubImage1D, EXT);
379 GET_PROC_SUFFIX(CopyTextureSubImage2D, EXT);
380 GET_PROC_SUFFIX(GetTextureImage, EXT);
381 GET_PROC_SUFFIX(GetTextureParameterfv, EXT);
382 GET_PROC_SUFFIX(GetTextureParameteriv, EXT);
383 GET_PROC_SUFFIX(GetTextureLevelParameterfv, EXT);
384 GET_PROC_SUFFIX(GetTextureLevelParameteriv, EXT);
385 if (glVer >= GR_GL_VER(1,2)) {
386 GET_PROC_SUFFIX(TextureImage3D, EXT);
387 GET_PROC_SUFFIX(TextureSubImage3D, EXT);
388 GET_PROC_SUFFIX(CopyTextureSubImage3D, EXT);
389 GET_PROC_SUFFIX(CompressedTextureImage3D, EXT);
390 GET_PROC_SUFFIX(CompressedTextureImage2D, EXT);
391 GET_PROC_SUFFIX(CompressedTextureImage1D, EXT);
392 GET_PROC_SUFFIX(CompressedTextureSubImage3D, EXT);
393 GET_PROC_SUFFIX(CompressedTextureSubImage2D, EXT);
394 GET_PROC_SUFFIX(CompressedTextureSubImage1D, EXT);
395 GET_PROC_SUFFIX(GetCompressedTextureImage, EXT);
396 }
397 if (glVer >= GR_GL_VER(1,5)) {
398 GET_PROC_SUFFIX(NamedBufferData, EXT);
399 GET_PROC_SUFFIX(NamedBufferSubData, EXT);
400 GET_PROC_SUFFIX(MapNamedBuffer, EXT);
401 GET_PROC_SUFFIX(UnmapNamedBuffer, EXT);
402 GET_PROC_SUFFIX(GetNamedBufferParameteriv, EXT);
403 GET_PROC_SUFFIX(GetNamedBufferPointerv, EXT);
404 GET_PROC_SUFFIX(GetNamedBufferSubData, EXT);
405 }
406 if (glVer >= GR_GL_VER(2,0)) {
407 GET_PROC_SUFFIX(ProgramUniform1f, EXT);
408 GET_PROC_SUFFIX(ProgramUniform2f, EXT);
409 GET_PROC_SUFFIX(ProgramUniform3f, EXT);
410 GET_PROC_SUFFIX(ProgramUniform4f, EXT);
411 GET_PROC_SUFFIX(ProgramUniform1i, EXT);
412 GET_PROC_SUFFIX(ProgramUniform2i, EXT);
413 GET_PROC_SUFFIX(ProgramUniform3i, EXT);
414 GET_PROC_SUFFIX(ProgramUniform4i, EXT);
415 GET_PROC_SUFFIX(ProgramUniform1fv, EXT);
416 GET_PROC_SUFFIX(ProgramUniform2fv, EXT);
417 GET_PROC_SUFFIX(ProgramUniform3fv, EXT);
418 GET_PROC_SUFFIX(ProgramUniform4fv, EXT);
419 GET_PROC_SUFFIX(ProgramUniform1iv, EXT);
420 GET_PROC_SUFFIX(ProgramUniform2iv, EXT);
421 GET_PROC_SUFFIX(ProgramUniform3iv, EXT);
422 GET_PROC_SUFFIX(ProgramUniform4iv, EXT);
423 GET_PROC_SUFFIX(ProgramUniformMatrix2fv, EXT);
424 GET_PROC_SUFFIX(ProgramUniformMatrix3fv, EXT);
425 GET_PROC_SUFFIX(ProgramUniformMatrix4fv, EXT);
426 }
427 if (glVer >= GR_GL_VER(2,1)) {
428 GET_PROC_SUFFIX(ProgramUniformMatrix2x3fv, EXT);
429 GET_PROC_SUFFIX(ProgramUniformMatrix3x2fv, EXT);
430 GET_PROC_SUFFIX(ProgramUniformMatrix2x4fv, EXT);
431 GET_PROC_SUFFIX(ProgramUniformMatrix4x2fv, EXT);
432 GET_PROC_SUFFIX(ProgramUniformMatrix3x4fv, EXT);
433 GET_PROC_SUFFIX(ProgramUniformMatrix4x3fv, EXT);
434 }
435 if (glVer >= GR_GL_VER(3,0)) {
436 GET_PROC_SUFFIX(NamedRenderbufferStorage, EXT);
437 GET_PROC_SUFFIX(GetNamedRenderbufferParameteriv, EXT);
438 GET_PROC_SUFFIX(NamedRenderbufferStorageMultisample, EXT);
439 GET_PROC_SUFFIX(CheckNamedFramebufferStatus, EXT);
440 GET_PROC_SUFFIX(NamedFramebufferTexture1D, EXT);
441 GET_PROC_SUFFIX(NamedFramebufferTexture2D, EXT);
442 GET_PROC_SUFFIX(NamedFramebufferTexture3D, EXT);
443 GET_PROC_SUFFIX(NamedFramebufferRenderbuffer, EXT);
444 GET_PROC_SUFFIX(GetNamedFramebufferAttachmentParameteriv, EXT);
445 GET_PROC_SUFFIX(GenerateTextureMipmap, EXT);
446 GET_PROC_SUFFIX(FramebufferDrawBuffer, EXT);
447 GET_PROC_SUFFIX(FramebufferDrawBuffers, EXT);
448 GET_PROC_SUFFIX(FramebufferReadBuffer, EXT);
449 GET_PROC_SUFFIX(GetFramebufferParameteriv, EXT);
450 GET_PROC_SUFFIX(NamedCopyBufferSubData, EXT);
451 GET_PROC_SUFFIX(VertexArrayVertexOffset, EXT);
452 GET_PROC_SUFFIX(VertexArrayColorOffset, EXT);
453 GET_PROC_SUFFIX(VertexArrayEdgeFlagOffset, EXT);
454 GET_PROC_SUFFIX(VertexArrayIndexOffset, EXT);
455 GET_PROC_SUFFIX(VertexArrayNormalOffset, EXT);
456 GET_PROC_SUFFIX(VertexArrayTexCoordOffset, EXT);
457 GET_PROC_SUFFIX(VertexArrayMultiTexCoordOffset, EXT);
458 GET_PROC_SUFFIX(VertexArrayFogCoordOffset, EXT);
459 GET_PROC_SUFFIX(VertexArraySecondaryColorOffset, EXT);
460 GET_PROC_SUFFIX(VertexArrayVertexAttribOffset, EXT);
461 GET_PROC_SUFFIX(VertexArrayVertexAttribIOffset, EXT);
462 GET_PROC_SUFFIX(EnableVertexArray, EXT);
463 GET_PROC_SUFFIX(DisableVertexArray, EXT);
464 GET_PROC_SUFFIX(EnableVertexArrayAttrib, EXT);
465 GET_PROC_SUFFIX(DisableVertexArrayAttrib, EXT);
466 GET_PROC_SUFFIX(GetVertexArrayIntegerv, EXT);
467 GET_PROC_SUFFIX(GetVertexArrayPointerv, EXT);
468 GET_PROC_SUFFIX(GetVertexArrayIntegeri_v, EXT);
469 GET_PROC_SUFFIX(GetVertexArrayPointeri_v, EXT);
470 GET_PROC_SUFFIX(MapNamedBufferRange, EXT);
471 GET_PROC_SUFFIX(FlushMappedNamedBufferRange, EXT);
472 }
473 }
474
475 if (glVer >= GR_GL_VER(4,3) || extensions.has("GL_KHR_debug")) {
476 // KHR_debug defines these methods to have no suffix in an OpenGL (not ES) context.
477 GET_PROC(DebugMessageControl);
478 GET_PROC(DebugMessageInsert);
479 GET_PROC(DebugMessageCallback);
480 GET_PROC(GetDebugMessageLog);
481 GET_PROC(PushDebugGroup);
482 GET_PROC(PopDebugGroup);
483 GET_PROC(ObjectLabel);
484 }
485
bsalomonb1a32ad2015-11-16 06:48:44 -0800486 if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
487 GET_EGL_PROC_SUFFIX(CreateImage, KHR);
488 GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
489 }
490
commit-bot@chromium.org9add5dc2014-04-29 20:06:22 +0000491 interface->fStandard = kGL_GrGLStandard;
492 interface->fExtensions.swap(&extensions);
493
494 return interface;
495}
bsalomona721c812014-08-26 11:35:23 -0700496
497const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
498 GET_PROC_LOCAL(GetString);
halcanary96fcdcc2015-08-27 07:41:13 -0700499 if (nullptr == GetString) {
500 return nullptr;
bsalomona721c812014-08-26 11:35:23 -0700501 }
502
503 const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
504 GrGLVersion version = GrGLGetVersionFromString(verStr);
505
506 if (version < GR_GL_VER(2,0)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700507 return nullptr;
bsalomona721c812014-08-26 11:35:23 -0700508 }
509
510 GET_PROC_LOCAL(GetIntegerv);
511 GET_PROC_LOCAL(GetStringi);
bsalomonb1a32ad2015-11-16 06:48:44 -0800512 GrEGLQueryStringProc queryString;
513 GrEGLDisplay display;
514 get_egl_query_and_display(&queryString, &display, ctx, get);
bsalomona721c812014-08-26 11:35:23 -0700515 GrGLExtensions extensions;
bsalomonb1a32ad2015-11-16 06:48:44 -0800516 if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
517 display)) {
halcanary96fcdcc2015-08-27 07:41:13 -0700518 return nullptr;
bsalomona721c812014-08-26 11:35:23 -0700519 }
520
halcanary385fe4d2015-08-26 13:07:48 -0700521 GrGLInterface* interface = new GrGLInterface;
bsalomona721c812014-08-26 11:35:23 -0700522 GrGLInterface::Functions* functions = &interface->fFunctions;
523
524 GET_PROC(ActiveTexture);
525 GET_PROC(AttachShader);
526 GET_PROC(BindAttribLocation);
527 GET_PROC(BindBuffer);
528 GET_PROC(BindTexture);
529 GET_PROC_SUFFIX(BindVertexArray, OES);
cdaltonbae6f6c2015-04-22 10:39:03 -0700530
kkinnunend94708e2015-07-30 22:47:04 -0700531 if (version >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
532 GET_PROC_SUFFIX(BindFragDataLocation, EXT);
533 GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
534 }
535
cdaltonbae6f6c2015-04-22 10:39:03 -0700536 if (extensions.has("GL_KHR_blend_equation_advanced")) {
537 GET_PROC_SUFFIX(BlendBarrier, KHR);
538 } else if (extensions.has("GL_NV_blend_equation_advanced")) {
539 GET_PROC_SUFFIX(BlendBarrier, NV);
540 }
541
bsalomona721c812014-08-26 11:35:23 -0700542 GET_PROC(BlendColor);
cdaltonbae6f6c2015-04-22 10:39:03 -0700543 GET_PROC(BlendEquation);
bsalomona721c812014-08-26 11:35:23 -0700544 GET_PROC(BlendFunc);
545 GET_PROC(BufferData);
546 GET_PROC(BufferSubData);
547 GET_PROC(Clear);
548 GET_PROC(ClearColor);
549 GET_PROC(ClearStencil);
550 GET_PROC(ColorMask);
551 GET_PROC(CompileShader);
552 GET_PROC(CompressedTexImage2D);
553 GET_PROC(CompressedTexSubImage2D);
554 GET_PROC(CopyTexSubImage2D);
555 GET_PROC(CreateProgram);
556 GET_PROC(CreateShader);
557 GET_PROC(CullFace);
558 GET_PROC(DeleteBuffers);
559 GET_PROC(DeleteProgram);
560 GET_PROC(DeleteShader);
561 GET_PROC(DeleteTextures);
562 GET_PROC_SUFFIX(DeleteVertexArrays, OES);
563 GET_PROC(DepthMask);
564 GET_PROC(Disable);
565 GET_PROC(DisableVertexAttribArray);
566 GET_PROC(DrawArrays);
567 GET_PROC(DrawElements);
568 GET_PROC(Enable);
569 GET_PROC(EnableVertexAttribArray);
570 GET_PROC(Finish);
571 GET_PROC(Flush);
572 GET_PROC(FrontFace);
573 GET_PROC(GenBuffers);
574 GET_PROC(GenerateMipmap);
575 GET_PROC(GenTextures);
576 GET_PROC_SUFFIX(GenVertexArrays, OES);
577 GET_PROC(GetBufferParameteriv);
578 GET_PROC(GetError);
579 GET_PROC(GetIntegerv);
580 GET_PROC(GetProgramInfoLog);
581 GET_PROC(GetProgramiv);
582 GET_PROC(GetShaderInfoLog);
bsalomonee64d6e2014-12-03 10:46:08 -0800583 GET_PROC(GetShaderPrecisionFormat);
bsalomona721c812014-08-26 11:35:23 -0700584 GET_PROC(GetShaderiv);
585 GET_PROC(GetString);
586 GET_PROC(GetStringi);
587 GET_PROC(GetUniformLocation);
bsalomon6dc6f5f2015-06-18 09:12:16 -0700588 GET_PROC(IsTexture);
bsalomona721c812014-08-26 11:35:23 -0700589 GET_PROC(LineWidth);
590 GET_PROC(LinkProgram);
591 GET_PROC(PixelStorei);
cdalton0edea2c2015-05-21 08:27:44 -0700592
593 if (extensions.has("GL_EXT_raster_multisample")) {
594 GET_PROC_SUFFIX(RasterSamples, EXT);
595 }
596
bsalomona721c812014-08-26 11:35:23 -0700597 GET_PROC(ReadPixels);
598 GET_PROC(Scissor);
599 GET_PROC(ShaderSource);
600 GET_PROC(StencilFunc);
601 GET_PROC(StencilFuncSeparate);
602 GET_PROC(StencilMask);
603 GET_PROC(StencilMaskSeparate);
604 GET_PROC(StencilOp);
605 GET_PROC(StencilOpSeparate);
606 GET_PROC(TexImage2D);
607 GET_PROC(TexParameteri);
608 GET_PROC(TexParameteriv);
609 GET_PROC(TexSubImage2D);
610
611 if (version >= GR_GL_VER(3,0)) {
612 GET_PROC(TexStorage2D);
613 } else {
614 GET_PROC_SUFFIX(TexStorage2D, EXT);
615 }
616
cdaltonfd4167d2015-04-21 11:45:56 -0700617 if (extensions.has("GL_NV_texture_barrier")) {
618 GET_PROC_SUFFIX(TextureBarrier, NV);
619 }
620
bsalomona721c812014-08-26 11:35:23 -0700621 GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
622 GET_PROC(Uniform1f);
623 GET_PROC(Uniform1i);
624 GET_PROC(Uniform1fv);
625 GET_PROC(Uniform1iv);
626 GET_PROC(Uniform2f);
627 GET_PROC(Uniform2i);
628 GET_PROC(Uniform2fv);
629 GET_PROC(Uniform2iv);
630 GET_PROC(Uniform3f);
631 GET_PROC(Uniform3i);
632 GET_PROC(Uniform3fv);
633 GET_PROC(Uniform3iv);
634 GET_PROC(Uniform4f);
635 GET_PROC(Uniform4i);
636 GET_PROC(Uniform4fv);
637 GET_PROC(Uniform4iv);
638 GET_PROC(UniformMatrix2fv);
639 GET_PROC(UniformMatrix3fv);
640 GET_PROC(UniformMatrix4fv);
641 GET_PROC(UseProgram);
egdaniel27c15212014-10-24 15:00:50 -0700642 GET_PROC(VertexAttrib1f);
643 GET_PROC(VertexAttrib2fv);
644 GET_PROC(VertexAttrib3fv);
bsalomona721c812014-08-26 11:35:23 -0700645 GET_PROC(VertexAttrib4fv);
646 GET_PROC(VertexAttribPointer);
647 GET_PROC(Viewport);
648 GET_PROC(BindFramebuffer);
649 GET_PROC(BindRenderbuffer);
650 GET_PROC(CheckFramebufferStatus);
651 GET_PROC(DeleteFramebuffers);
652 GET_PROC(DeleteRenderbuffers);
653 GET_PROC(FramebufferRenderbuffer);
654 GET_PROC(FramebufferTexture2D);
655
hendrikw1ae488f2015-07-22 09:30:08 -0700656 if (extensions.has("GL_CHROMIUM_framebuffer_multisample")) {
657 GET_PROC_SUFFIX(RenderbufferStorageMultisample, CHROMIUM);
658 GET_PROC_SUFFIX(BlitFramebuffer, CHROMIUM);
659 } else if (version >= GR_GL_VER(3,0)) {
bsalomona721c812014-08-26 11:35:23 -0700660 GET_PROC(RenderbufferStorageMultisample);
661 GET_PROC(BlitFramebuffer);
662 }
663
hendrikw1ae488f2015-07-22 09:30:08 -0700664 if (extensions.has("GL_CHROMIUM_map_sub")) {
665 GET_PROC_SUFFIX(MapBufferSubData, CHROMIUM);
666 GET_PROC_SUFFIX(MapTexSubImage2D, CHROMIUM);
667 GET_PROC_SUFFIX(UnmapBufferSubData, CHROMIUM);
668 GET_PROC_SUFFIX(UnmapTexSubImage2D, CHROMIUM);
669 }
670
bsalomona721c812014-08-26 11:35:23 -0700671 if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
672 GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT);
673 functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleEXT");
674 } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
675 GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG);
676 functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleIMG");
677 } else if (extensions.has("GL_APPLE_framebuffer_multisample")) {
678 functions->fRenderbufferStorageMultisampleES2APPLE = (GrGLRenderbufferStorageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleAPPLE");
679 GET_PROC_SUFFIX(ResolveMultisampleFramebuffer, APPLE);
680 }
681
682 GET_PROC(GenFramebuffers);
683 GET_PROC(GenRenderbuffers);
684 GET_PROC(GetFramebufferAttachmentParameteriv);
685 GET_PROC(GetRenderbufferParameteriv);
686 GET_PROC(RenderbufferStorage);
687
688 GET_PROC_SUFFIX(MapBuffer, OES);
689 GET_PROC_SUFFIX(UnmapBuffer, OES);
690
691 if (version >= GR_GL_VER(3,0)) {
692 GET_PROC(MapBufferRange);
693 GET_PROC(FlushMappedBufferRange);
694 } else if (extensions.has("GL_EXT_map_buffer_range")) {
695 GET_PROC_SUFFIX(MapBufferRange, EXT);
696 GET_PROC_SUFFIX(FlushMappedBufferRange, EXT);
697 }
698
699 if (extensions.has("GL_EXT_debug_marker")) {
700 GET_PROC(InsertEventMarker);
701 GET_PROC(PushGroupMarker);
702 GET_PROC(PopGroupMarker);
703 // The below check is here because a device has been found that has the extension string but
halcanary96fcdcc2015-08-27 07:41:13 -0700704 // returns nullptr from the eglGetProcAddress for the functions
705 if (nullptr == functions->fInsertEventMarker ||
706 nullptr == functions->fPushGroupMarker ||
707 nullptr == functions->fPopGroupMarker) {
bsalomona721c812014-08-26 11:35:23 -0700708 extensions.remove("GL_EXT_debug_marker");
709 }
710 }
711
712 GET_PROC(InvalidateFramebuffer);
713 GET_PROC(InvalidateSubFramebuffer);
714 GET_PROC(InvalidateBufferData);
715 GET_PROC(InvalidateBufferSubData);
716 GET_PROC(InvalidateTexImage);
717 GET_PROC(InvalidateTexSubImage);
718
719 if (version >= GR_GL_VER(3,1)) {
720 GET_PROC(GetProgramResourceLocation);
721 }
722
723 if (extensions.has("GL_NV_path_rendering")) {
724 GET_PROC_SUFFIX(MatrixLoadf, EXT);
725 GET_PROC_SUFFIX(MatrixLoadIdentity, EXT);
726 GET_PROC_SUFFIX(PathCommands, NV);
bsalomona721c812014-08-26 11:35:23 -0700727 GET_PROC_SUFFIX(PathParameteri, NV);
728 GET_PROC_SUFFIX(PathParameterf, NV);
729 GET_PROC_SUFFIX(GenPaths, NV);
730 GET_PROC_SUFFIX(DeletePaths, NV);
731 GET_PROC_SUFFIX(IsPath, NV);
732 GET_PROC_SUFFIX(PathStencilFunc, NV);
733 GET_PROC_SUFFIX(StencilFillPath, NV);
734 GET_PROC_SUFFIX(StencilStrokePath, NV);
735 GET_PROC_SUFFIX(StencilFillPathInstanced, NV);
736 GET_PROC_SUFFIX(StencilStrokePathInstanced, NV);
737 GET_PROC_SUFFIX(CoverFillPath, NV);
738 GET_PROC_SUFFIX(CoverStrokePath, NV);
739 GET_PROC_SUFFIX(CoverFillPathInstanced, NV);
740 GET_PROC_SUFFIX(CoverStrokePathInstanced, NV);
741 GET_PROC_SUFFIX(StencilThenCoverFillPath, NV);
742 GET_PROC_SUFFIX(StencilThenCoverStrokePath, NV);
743 GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV);
744 GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV);
745 GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV);
746 }
747
vbuzinov08b4d292015-04-01 06:29:49 -0700748 if (extensions.has("GL_NV_framebuffer_mixed_samples")) {
749 GET_PROC_SUFFIX(CoverageModulation, NV);
750 }
751
cdalton626e1ff2015-06-12 13:56:46 -0700752 if (version >= GR_GL_VER(3,0) || extensions.has("GL_EXT_draw_instanced")) {
753 GET_PROC(DrawArraysInstanced);
754 GET_PROC(DrawElementsInstanced);
755 }
756
757 if (version >= GR_GL_VER(3,0) || extensions.has("GL_EXT_instanced_arrays")) {
758 GET_PROC(VertexAttribDivisor);
759 }
760
761 if (extensions.has("GL_NV_bindless_texture")) {
762 GET_PROC_SUFFIX(GetTextureHandle, NV);
763 GET_PROC_SUFFIX(GetTextureSamplerHandle, NV);
764 GET_PROC_SUFFIX(MakeTextureHandleResident, NV);
765 GET_PROC_SUFFIX(MakeTextureHandleNonResident, NV);
766 GET_PROC_SUFFIX(GetImageHandle, NV);
767 GET_PROC_SUFFIX(MakeImageHandleResident, NV);
768 GET_PROC_SUFFIX(MakeImageHandleNonResident, NV);
769 GET_PROC_SUFFIX(IsTextureHandleResident, NV);
770 GET_PROC_SUFFIX(IsImageHandleResident, NV);
771 GET_PROC_SUFFIX(UniformHandleui64, NV);
772 GET_PROC_SUFFIX(UniformHandleui64v, NV);
773 GET_PROC_SUFFIX(ProgramUniformHandleui64, NV);
774 GET_PROC_SUFFIX(ProgramUniformHandleui64v, NV);
775 }
776
777 if (extensions.has("GL_KHR_debug")) {
778 GET_PROC_SUFFIX(DebugMessageControl, KHR);
779 GET_PROC_SUFFIX(DebugMessageInsert, KHR);
780 GET_PROC_SUFFIX(DebugMessageCallback, KHR);
781 GET_PROC_SUFFIX(GetDebugMessageLog, KHR);
782 GET_PROC_SUFFIX(PushDebugGroup, KHR);
783 GET_PROC_SUFFIX(PopDebugGroup, KHR);
784 GET_PROC_SUFFIX(ObjectLabel, KHR);
bsalomondb9f6642015-10-02 08:34:28 -0700785 // In general we have a policy against removing extension strings when the driver does
786 // not provide function pointers for an advertised extension. However, because there is a
787 // known device that advertises GL_KHR_debug but fails to provide the functions and this is
788 // a debugging- only extension we've made an exception. This also can happen when using
789 // APITRACE.
790 if (!interface->fFunctions.fDebugMessageControl) {
791 extensions.remove("GL_KHR_debug");
792 }
cdalton626e1ff2015-06-12 13:56:46 -0700793 }
794
kkinnunen0adfffb2015-10-13 12:58:37 -0700795 if (extensions.has("GL_CHROMIUM_bind_uniform_location")) {
796 GET_PROC_SUFFIX(BindUniformLocation, CHROMIUM);
797 }
798
bsalomonb1a32ad2015-11-16 06:48:44 -0800799 if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
800 GET_EGL_PROC_SUFFIX(CreateImage, KHR);
801 GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
802 }
803
bsalomona721c812014-08-26 11:35:23 -0700804 interface->fStandard = kGLES_GrGLStandard;
805 interface->fExtensions.swap(&extensions);
806
807 return interface;
808}