Home | History | Annotate | Download | only in gl
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 
      6 #include "ui/gl/gl_bindings_skia_in_process.h"
      7 
      8 #include "base/logging.h"
      9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
     10 #include "ui/gl/gl_bindings.h"
     11 #include "ui/gl/gl_implementation.h"
     12 
     13 namespace {
     14 
     15 extern "C" {
     16 // The following stub functions are required because the glXXX routines exported
     17 // via gl_bindings.h use call-type GL_BINDING_CALL, which on Windows is stdcall.
     18 // Skia has been built such that its GrGLInterface GL pointers are __cdecl.
     19 
     20 GLvoid StubGLActiveTexture(GLenum texture) {
     21   glActiveTexture(texture);
     22 }
     23 
     24 GLvoid StubGLAttachShader(GLuint program, GLuint shader) {
     25   glAttachShader(program, shader);
     26 }
     27 
     28 GLvoid StubGLBeginQuery(GLenum target, GLuint id) {
     29   glBeginQuery(target, id);
     30 }
     31 
     32 GLvoid StubGLBindAttribLocation(GLuint program, GLuint index,
     33                                 const char* name) {
     34   glBindAttribLocation(program, index, name);
     35 }
     36 
     37 GLvoid StubGLBindBuffer(GLenum target, GLuint buffer) {
     38   glBindBuffer(target, buffer);
     39 }
     40 
     41 GLvoid StubGLBindFragDataLocation(GLuint program, GLuint colorNumber,
     42                                   const GLchar * name) {
     43   glBindFragDataLocation(program, colorNumber, name);
     44 }
     45 
     46 GLvoid StubGLBindFragDataLocationIndexed(GLuint program, GLuint colorNumber,
     47                                          GLuint index, const GLchar * name) {
     48   glBindFragDataLocationIndexed(program, colorNumber, index, name);
     49 }
     50 
     51 GLvoid StubGLBindFramebuffer(GLenum target, GLuint framebuffer) {
     52   glBindFramebufferEXT(target, framebuffer);
     53 }
     54 
     55 GLvoid StubGLBindRenderbuffer(GLenum target, GLuint renderbuffer) {
     56   glBindRenderbufferEXT(target, renderbuffer);
     57 }
     58 
     59 GLvoid StubGLBindTexture(GLenum target, GLuint texture) {
     60   glBindTexture(target, texture);
     61 }
     62 
     63 GLvoid StubGLBindVertexArray(GLuint array) {
     64   glBindVertexArrayOES(array);
     65 }
     66 
     67 GLvoid StubGLBlendColor(GLclampf red, GLclampf green, GLclampf blue,
     68                         GLclampf alpha) {
     69   glBlendColor(red, green, blue, alpha);
     70 }
     71 
     72 GLvoid StubGLBlendFunc(GLenum sfactor, GLenum dfactor) {
     73   glBlendFunc(sfactor, dfactor);
     74 }
     75 
     76 GLvoid StubGLBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
     77                              GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
     78                              GLbitfield mask, GLenum filter) {
     79   glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
     80                        mask, filter);
     81 }
     82 
     83 GLvoid StubGLBufferData(GLenum target, GLsizeiptr size, const void* data,
     84                         GLenum usage) {
     85   glBufferData(target, size, data, usage);
     86 }
     87 
     88 GLvoid StubGLBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
     89                            const void* data) {
     90   glBufferSubData(target, offset, size, data);
     91 }
     92 
     93 GLenum StubGLCheckFramebufferStatus(GLenum target) {
     94   return glCheckFramebufferStatusEXT(target);
     95 }
     96 
     97 GLvoid StubGLClear(GLbitfield mask) {
     98   glClear(mask);
     99 }
    100 
    101 GLvoid StubGLClearColor(GLclampf red, GLclampf green, GLclampf blue,
    102                         GLclampf alpha) {
    103   glClearColor(red, green, blue, alpha);
    104 }
    105 
    106 GLvoid StubGLClearStencil(GLint s) {
    107   glClearStencil(s);
    108 }
    109 
    110 GLvoid StubGLColorMask(GLboolean red, GLboolean green, GLboolean blue,
    111                        GLboolean alpha) {
    112   glColorMask(red, green, blue, alpha);
    113 }
    114 
    115 GLvoid StubGLCompileShader(GLuint shader) {
    116   glCompileShader(shader);
    117 }
    118 
    119 GLvoid StubGLCompressedTexImage2D(GLenum target, GLint level,
    120                                   GLenum internalformat, GLsizei width,
    121                                   GLsizei height, GLint border,
    122                                   GLsizei imageSize, const void* data) {
    123   glCompressedTexImage2D(target, level, internalformat, width, height, border,
    124                          imageSize, data);
    125 }
    126 
    127 GLvoid StubGLCopyTexSubImage2D(GLenum target, GLint level,
    128                                GLint xoffset, GLint yoffset,
    129                                GLint x, GLint y,
    130                                GLsizei width, GLsizei height) {
    131   glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
    132 }
    133 
    134 GLuint StubGLCreateProgram(void) {
    135   return glCreateProgram();
    136 }
    137 
    138 GLuint StubGLCreateShader(GLenum type) {
    139   return glCreateShader(type);
    140 }
    141 
    142 GLvoid StubGLCullFace(GLenum mode) {
    143   glCullFace(mode);
    144 }
    145 
    146 GLvoid StubGLDeleteBuffers(GLsizei n, const GLuint* buffers) {
    147   glDeleteBuffersARB(n, buffers);
    148 }
    149 
    150 GLvoid StubGLDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
    151   glDeleteFramebuffersEXT(n, framebuffers);
    152 }
    153 
    154 GLvoid StubGLDeleteQueries(GLsizei n, const GLuint* ids) {
    155   glDeleteQueries(n, ids);
    156 }
    157 
    158 GLvoid StubGLDeleteProgram(GLuint program) {
    159   glDeleteProgram(program);
    160 }
    161 
    162 GLvoid StubGLDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
    163   glDeleteRenderbuffersEXT(n, renderbuffers);
    164 }
    165 
    166 GLvoid StubGLDeleteShader(GLuint shader) {
    167   glDeleteShader(shader);
    168 }
    169 
    170 GLvoid StubGLDeleteTextures(GLsizei n, const GLuint* textures) {
    171   glDeleteTextures(n, textures);
    172 }
    173 
    174 GLvoid StubGLDeleteVertexArrays(GLsizei n, const GLuint* arrays) {
    175   glDeleteVertexArraysOES(n, arrays);
    176 }
    177 
    178 GLvoid StubGLDepthMask(GLboolean flag) {
    179   glDepthMask(flag);
    180 }
    181 
    182 GLvoid StubGLDisable(GLenum cap) {
    183   glDisable(cap);
    184 }
    185 
    186 GLvoid StubGLDisableVertexAttribArray(GLuint index) {
    187   glDisableVertexAttribArray(index);
    188 }
    189 
    190 GLvoid StubGLDiscardFramebuffer(GLenum target, GLsizei numAttachments,
    191                                 const GLenum *attachments) {
    192   glDiscardFramebufferEXT(target, numAttachments, attachments);
    193 }
    194 
    195 GLvoid StubGLDrawArrays(GLenum mode, GLint first, GLsizei count) {
    196   glDrawArrays(mode, first, count);
    197 }
    198 
    199 GLvoid StubGLDrawBuffer(GLenum mode) {
    200   glDrawBuffer(mode);
    201 }
    202 
    203 GLvoid StubGLDrawBuffers(GLsizei n, const GLenum* bufs) {
    204   glDrawBuffersARB(n, bufs);
    205 }
    206 
    207 GLvoid StubGLDrawElements(GLenum mode, GLsizei count, GLenum type,
    208                           const void* indices) {
    209   glDrawElements(mode, count, type, indices);
    210 }
    211 
    212 GLvoid StubGLEnable(GLenum cap) {
    213   glEnable(cap);
    214 }
    215 
    216 GLvoid StubGLEnableVertexAttribArray(GLuint index) {
    217   glEnableVertexAttribArray(index);
    218 }
    219 
    220 GLvoid StubGLEndQuery(GLenum target) {
    221   glEndQuery(target);
    222 }
    223 
    224 GLvoid StubGLFinish() {
    225   glFinish();
    226 }
    227 
    228 GLvoid StubGLFlush() {
    229   glFlush();
    230 }
    231 
    232 GLvoid StubGLFramebufferRenderbuffer(GLenum target, GLenum attachment,
    233                                      GLenum renderbuffertarget,
    234                                      GLuint renderbuffer) {
    235   glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget,
    236                                renderbuffer);
    237 }
    238 
    239 GLvoid StubGLFramebufferTexture2D(GLenum target, GLenum attachment,
    240                                   GLenum textarget, GLuint texture,
    241                                   GLint level) {
    242   glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
    243 }
    244 
    245 GLvoid StubGLFramebufferTexture2DMultisample(GLenum target, GLenum attachment,
    246                                   GLenum textarget, GLuint texture,
    247                                   GLint level, GLsizei samples) {
    248   glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture,
    249       level, samples);
    250 }
    251 
    252 GLvoid StubGLFrontFace(GLenum mode) {
    253   glFrontFace(mode);
    254 }
    255 
    256 GLvoid StubGLGenBuffers(GLsizei n, GLuint* buffers) {
    257   glGenBuffersARB(n, buffers);
    258 }
    259 
    260 GLvoid StubGLGenFramebuffers(GLsizei n, GLuint* framebuffers) {
    261   glGenFramebuffersEXT(n, framebuffers);
    262 }
    263 
    264 GLvoid StubGLGenQueries(GLsizei n, GLuint* ids) {
    265   glGenQueries(n, ids);
    266 }
    267 
    268 GLvoid StubGLGenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
    269   glGenRenderbuffersEXT(n, renderbuffers);
    270 }
    271 
    272 GLvoid StubGLGenTextures(GLsizei n, GLuint* textures) {
    273   glGenTextures(n, textures);
    274 }
    275 
    276 GLvoid StubGLGenVertexArrays(GLsizei n, GLuint* arrays) {
    277   glGenVertexArraysOES(n, arrays);
    278 }
    279 
    280 GLvoid StubGLGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
    281   glGetBufferParameteriv(target, pname, params);
    282 }
    283 
    284 GLvoid StubGLGetFramebufferAttachmentParameteriv(GLenum target,
    285                                                  GLenum attachment,
    286                                                  GLenum pname, GLint* params) {
    287   glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
    288 }
    289 
    290 GLenum StubGLGetError() {
    291   return glGetError();
    292 }
    293 
    294 GLvoid StubGLGetIntegerv(GLenum pname, GLint* params) {
    295   glGetIntegerv(pname, params);
    296 }
    297 
    298 GLvoid StubGLGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length,
    299                                char* infolog) {
    300   glGetProgramInfoLog(program, bufsize, length, infolog);
    301 }
    302 
    303 GLvoid StubGLGetProgramiv(GLuint program, GLenum pname, GLint* params) {
    304   glGetProgramiv(program, pname, params);
    305 }
    306 
    307 GLvoid StubGLGetRenderbufferParameteriv(GLenum target,
    308                                         GLenum pname, GLint* params) {
    309   glGetRenderbufferParameterivEXT(target, pname, params);
    310 }
    311 
    312 GLvoid StubGLGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length,
    313                               char* infolog) {
    314   glGetShaderInfoLog(shader, bufsize, length, infolog);
    315 }
    316 
    317 GLvoid StubGLGetShaderiv(GLuint shader, GLenum pname, GLint* params) {
    318   glGetShaderiv(shader, pname, params);
    319 }
    320 
    321 const GLubyte* StubGLGetString(GLenum name) {
    322   return glGetString(name);
    323 }
    324 
    325 GLvoid StubGLGetQueryiv(GLenum target, GLenum pname, GLint* params) {
    326   glGetQueryiv(target, pname, params);
    327 }
    328 
    329 GLvoid StubGLGetQueryObjecti64v(GLuint id, GLenum pname, GLint64* params) {
    330   glGetQueryObjecti64v(id, pname, params);
    331 }
    332 
    333 GLvoid StubGLGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) {
    334   glGetQueryObjectiv(id, pname, params);
    335 }
    336 
    337 GLvoid StubGLGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64* params) {
    338   glGetQueryObjectui64v(id, pname, params);
    339 }
    340 
    341 GLvoid StubGLGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) {
    342   glGetQueryObjectuiv(id, pname, params);
    343 }
    344 
    345 GLvoid StubGLGetTexLevelParameteriv(GLenum target, GLint level,
    346                                     GLenum pname, GLint* params) {
    347   glGetTexLevelParameteriv(target, level, pname, params);
    348 }
    349 
    350 GLint StubGLGetUniformLocation(GLuint program, const char* name) {
    351   return glGetUniformLocation(program, name);
    352 }
    353 
    354 GLvoid StubGLInsertEventMarker(GLsizei length, const char* marker) {
    355   glInsertEventMarkerEXT(length, marker);
    356 }
    357 
    358 GLvoid StubGLLineWidth(GLfloat width) {
    359   glLineWidth(width);
    360 }
    361 
    362 GLvoid StubGLLinkProgram(GLuint program) {
    363   glLinkProgram(program);
    364 }
    365 
    366 void* StubGLMapBuffer(GLenum target, GLenum access) {
    367   return glMapBuffer(target, access);
    368 }
    369 
    370 GLvoid StubGLPixelStorei(GLenum pname, GLint param) {
    371   glPixelStorei(pname, param);
    372 }
    373 
    374 GLvoid StubGLPopGroupMarker() {
    375   glPopGroupMarkerEXT();
    376 }
    377 
    378 GLvoid StubGLPushGroupMarker(GLsizei length, const char* marker) {
    379   glPushGroupMarkerEXT(length, marker);
    380 }
    381 
    382 GLvoid StubGLQueryCounter(GLuint id, GLenum target) {
    383   glQueryCounter(id, target);
    384 }
    385 
    386 GLvoid StubGLReadBuffer(GLenum src) {
    387   glReadBuffer(src);
    388 }
    389 
    390 GLvoid StubGLReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
    391                         GLenum format, GLenum type, void* pixels) {
    392   glReadPixels(x, y, width, height, format, type, pixels);
    393 }
    394 
    395 GLvoid StubGLRenderbufferStorage(GLenum target, GLenum internalformat,
    396                                  GLsizei width, GLsizei height) {
    397   glRenderbufferStorageEXT(target, internalformat, width, height);
    398 }
    399 
    400 GLvoid StubGLRenderbufferStorageMultisample(GLenum target, GLsizei samples,
    401                                             GLenum internalformat,
    402                                             GLsizei width, GLsizei height) {
    403   glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width,
    404                                       height);
    405 }
    406 
    407 GLvoid StubGLScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
    408   glScissor(x, y, width, height);
    409 }
    410 
    411 GLvoid StubGLShaderSource(GLuint shader, GLsizei count, const char* const* str,
    412                           const GLint* length) {
    413   glShaderSource(shader, count, str, length);
    414 }
    415 
    416 GLvoid StubGLStencilFunc(GLenum func, GLint ref, GLuint mask) {
    417   glStencilFunc(func, ref, mask);
    418 }
    419 
    420 GLvoid StubGLStencilFuncSeparate(GLenum face, GLenum func, GLint ref,
    421                                  GLuint mask) {
    422   glStencilFuncSeparate(face, func, ref, mask);
    423 }
    424 
    425 GLvoid StubGLStencilMask(GLuint mask) {
    426   glStencilMask(mask);
    427 }
    428 
    429 GLvoid StubGLStencilMaskSeparate(GLenum face, GLuint mask) {
    430   glStencilMaskSeparate(face, mask);
    431 }
    432 
    433 GLvoid StubGLStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
    434   glStencilOp(fail, zfail, zpass);
    435 }
    436 
    437 GLvoid StubGLStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail,
    438                                GLenum zpass) {
    439   glStencilOpSeparate(face, fail, zfail, zpass);
    440 }
    441 
    442 GLvoid StubGLTexImage2D(GLenum target, GLint level, GLint internalformat,
    443                         GLsizei width, GLsizei height, GLint border,
    444                         GLenum format, GLenum type, const void* pixels) {
    445   glTexImage2D(target, level, internalformat, width, height, border, format,
    446                type, pixels);
    447 }
    448 
    449 GLvoid StubGLTexParameteri(GLenum target, GLenum pname, GLint param) {
    450   glTexParameteri(target, pname, param);
    451 }
    452 
    453 GLvoid StubGLTexParameteriv(GLenum target, GLenum pname, const GLint* params) {
    454   glTexParameteriv(target, pname, params);
    455 }
    456 
    457 GLvoid StubGLTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat,
    458                           GLsizei width, GLsizei height) {
    459   glTexStorage2DEXT(target, levels, internalFormat, width, height);
    460 }
    461 
    462 GLvoid StubGLTexSubImage2D(GLenum target, GLint level, GLint xoffset,
    463                            GLint yoffset, GLsizei width, GLsizei height,
    464                            GLenum format, GLenum type, const void* pixels) {
    465   glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
    466                   pixels);
    467 }
    468 
    469 GLvoid StubGLUniform1f(GLint location, GLfloat v) {
    470   glUniform1i(location, v);
    471 }
    472 
    473 GLvoid StubGLUniform1i(GLint location, GLint v) {
    474   glUniform1i(location, v);
    475 }
    476 
    477 GLvoid StubGLUniform1fv(GLint location, GLsizei count, const GLfloat* v) {
    478   glUniform1fv(location, count, v);
    479 }
    480 
    481 GLvoid StubGLUniform1iv(GLint location, GLsizei count, const GLint* v) {
    482   glUniform1iv(location, count, v);
    483 }
    484 
    485 GLvoid StubGLUniform2f(GLint location, GLfloat v0, GLfloat v1) {
    486   glUniform2i(location, v0, v1);
    487 }
    488 
    489 GLvoid StubGLUniform2i(GLint location, GLint v0, GLint v1) {
    490   glUniform2i(location, v0, v1);
    491 }
    492 
    493 GLvoid StubGLUniform2fv(GLint location, GLsizei count, const GLfloat* v) {
    494   glUniform2fv(location, count, v);
    495 }
    496 
    497 GLvoid StubGLUniform2iv(GLint location, GLsizei count, const GLint* v) {
    498   glUniform2iv(location, count, v);
    499 }
    500 
    501 GLvoid StubGLUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
    502   glUniform3i(location, v0, v1, v2);
    503 }
    504 
    505 GLvoid StubGLUniform3i(GLint location, GLint v0, GLint v1, GLint v2) {
    506   glUniform3i(location, v0, v1, v2);
    507 }
    508 
    509 GLvoid StubGLUniform3fv(GLint location, GLsizei count, const GLfloat* v) {
    510   glUniform3fv(location, count, v);
    511 }
    512 
    513 GLvoid StubGLUniform3iv(GLint location, GLsizei count, const GLint* v) {
    514   glUniform3iv(location, count, v);
    515 }
    516 
    517 GLvoid StubGLUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
    518                        GLfloat v3) {
    519   glUniform4i(location, v0, v1, v2, v3);
    520 }
    521 
    522 GLvoid StubGLUniform4i(GLint location, GLint v0, GLint v1, GLint v2,
    523                        GLint v3) {
    524   glUniform4i(location, v0, v1, v2, v3);
    525 }
    526 
    527 GLvoid StubGLUniform4fv(GLint location, GLsizei count, const GLfloat* v) {
    528   glUniform4fv(location, count, v);
    529 }
    530 
    531 GLvoid StubGLUniform4iv(GLint location, GLsizei count, const GLint* v) {
    532   glUniform4iv(location, count, v);
    533 }
    534 
    535 GLvoid StubGLUniformMatrix2fv(GLint location, GLsizei count,
    536                               GLboolean transpose, const GLfloat* value) {
    537   glUniformMatrix2fv(location, count, transpose, value);
    538 }
    539 
    540 GLvoid StubGLUniformMatrix3fv(GLint location, GLsizei count,
    541                               GLboolean transpose, const GLfloat* value) {
    542   glUniformMatrix3fv(location, count, transpose, value);
    543 }
    544 
    545 GLvoid StubGLUniformMatrix4fv(GLint location, GLsizei count,
    546                               GLboolean transpose, const GLfloat* value) {
    547   glUniformMatrix4fv(location, count, transpose, value);
    548 }
    549 
    550 GLboolean StubGLUnmapBuffer(GLenum target) {
    551   return glUnmapBuffer(target);
    552 }
    553 
    554 GLvoid StubGLUseProgram(GLuint program) {
    555   glUseProgram(program);
    556 }
    557 
    558 GLvoid StubGLVertexAttrib4fv(GLuint indx, const GLfloat* values) {
    559   glVertexAttrib4fv(indx, values);
    560 }
    561 
    562 GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type,
    563                                  GLboolean normalized, GLsizei stride,
    564                                  const void* ptr) {
    565   glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
    566 }
    567 
    568 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
    569   glViewport(x, y, width, height);
    570 }
    571 }  // extern "C"
    572 }  // namespace
    573 
    574 namespace gfx {
    575 
    576 GrGLInterface* CreateInProcessSkiaGLBinding() {
    577   GrGLStandard standard;
    578   switch (gfx::GetGLImplementation()) {
    579     case gfx::kGLImplementationNone:
    580       NOTREACHED();
    581       return NULL;
    582     case gfx::kGLImplementationDesktopGL:
    583     case gfx::kGLImplementationAppleGL:
    584       standard = kGL_GrGLStandard;
    585       break;
    586     case gfx::kGLImplementationOSMesaGL:
    587       standard = kGL_GrGLStandard;
    588       break;
    589     case gfx::kGLImplementationEGLGLES2:
    590       standard = kGLES_GrGLStandard;
    591       break;
    592     case gfx::kGLImplementationMockGL:
    593       NOTREACHED();
    594       return NULL;
    595     default:
    596       NOTREACHED();
    597       return NULL;
    598   }
    599 
    600   GrGLInterface* interface = new GrGLInterface;
    601   interface->fStandard = standard;
    602   interface->fExtensions.init(standard,
    603                               StubGLGetString,
    604                               NULL,
    605                               StubGLGetIntegerv);
    606 
    607   GrGLInterface::Functions* functions = &interface->fFunctions;
    608   functions->fActiveTexture = StubGLActiveTexture;
    609   functions->fAttachShader = StubGLAttachShader;
    610   functions->fBeginQuery = StubGLBeginQuery;
    611   functions->fBindAttribLocation = StubGLBindAttribLocation;
    612   functions->fBindBuffer = StubGLBindBuffer;
    613   functions->fBindFragDataLocation = StubGLBindFragDataLocation;
    614   functions->fBindTexture = StubGLBindTexture;
    615   functions->fBindVertexArray = StubGLBindVertexArray;
    616   functions->fBlendColor = StubGLBlendColor;
    617   functions->fBlendFunc = StubGLBlendFunc;
    618   functions->fBufferData = StubGLBufferData;
    619   functions->fBufferSubData = StubGLBufferSubData;
    620   functions->fClear = StubGLClear;
    621   functions->fClearColor = StubGLClearColor;
    622   functions->fClearStencil = StubGLClearStencil;
    623   functions->fColorMask = StubGLColorMask;
    624   functions->fCompileShader = StubGLCompileShader;
    625   functions->fCompressedTexImage2D = StubGLCompressedTexImage2D;
    626   functions->fCopyTexSubImage2D = StubGLCopyTexSubImage2D;
    627   functions->fCreateProgram = StubGLCreateProgram;
    628   functions->fCreateShader = StubGLCreateShader;
    629   functions->fCullFace = StubGLCullFace;
    630   functions->fDeleteBuffers = StubGLDeleteBuffers;
    631   functions->fDeleteProgram = StubGLDeleteProgram;
    632   functions->fDeleteQueries = StubGLDeleteQueries;
    633   functions->fDeleteShader = StubGLDeleteShader;
    634   functions->fDeleteTextures = StubGLDeleteTextures;
    635   functions->fDeleteVertexArrays = StubGLDeleteVertexArrays;
    636   functions->fDepthMask = StubGLDepthMask;
    637   functions->fDisable = StubGLDisable;
    638   functions->fDisableVertexAttribArray = StubGLDisableVertexAttribArray;
    639   functions->fDiscardFramebuffer = StubGLDiscardFramebuffer;
    640   functions->fDrawArrays = StubGLDrawArrays;
    641   functions->fDrawBuffer = StubGLDrawBuffer;
    642   functions->fDrawBuffers = StubGLDrawBuffers;
    643   functions->fDrawElements = StubGLDrawElements;
    644   functions->fEnable = StubGLEnable;
    645   functions->fEnableVertexAttribArray = StubGLEnableVertexAttribArray;
    646   functions->fEndQuery = StubGLEndQuery;
    647   functions->fFinish = StubGLFinish;
    648   functions->fFlush = StubGLFlush;
    649   functions->fFrontFace = StubGLFrontFace;
    650   functions->fGenBuffers = StubGLGenBuffers;
    651   functions->fGenQueries = StubGLGenQueries;
    652   functions->fGenTextures = StubGLGenTextures;
    653   functions->fGenVertexArrays = StubGLGenVertexArrays;
    654   functions->fGetBufferParameteriv = StubGLGetBufferParameteriv;
    655   functions->fGetError = StubGLGetError;
    656   functions->fGetIntegerv = StubGLGetIntegerv;
    657   functions->fGetQueryiv = StubGLGetQueryiv;
    658   functions->fGetQueryObjecti64v = StubGLGetQueryObjecti64v;
    659   functions->fGetQueryObjectiv = StubGLGetQueryObjectiv;
    660   functions->fGetQueryObjectui64v = StubGLGetQueryObjectui64v;
    661   functions->fGetQueryObjectuiv = StubGLGetQueryObjectuiv;
    662   functions->fGetProgramInfoLog = StubGLGetProgramInfoLog;
    663   functions->fGetProgramiv = StubGLGetProgramiv;
    664   functions->fGetShaderInfoLog = StubGLGetShaderInfoLog;
    665   functions->fGetShaderiv = StubGLGetShaderiv;
    666   functions->fGetString = StubGLGetString;
    667   functions->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv;
    668   functions->fGetUniformLocation = StubGLGetUniformLocation;
    669   functions->fInsertEventMarker = StubGLInsertEventMarker;
    670   functions->fLineWidth = StubGLLineWidth;
    671   functions->fLinkProgram = StubGLLinkProgram;
    672   functions->fPixelStorei = StubGLPixelStorei;
    673   functions->fPopGroupMarker = StubGLPopGroupMarker;
    674   functions->fPushGroupMarker = StubGLPushGroupMarker;
    675   functions->fQueryCounter = StubGLQueryCounter;
    676   functions->fReadBuffer = StubGLReadBuffer;
    677   functions->fReadPixels = StubGLReadPixels;
    678   functions->fScissor = StubGLScissor;
    679   functions->fShaderSource = StubGLShaderSource;
    680   functions->fStencilFunc = StubGLStencilFunc;
    681   functions->fStencilFuncSeparate = StubGLStencilFuncSeparate;
    682   functions->fStencilMask = StubGLStencilMask;
    683   functions->fStencilMaskSeparate = StubGLStencilMaskSeparate;
    684   functions->fStencilOp = StubGLStencilOp;
    685   functions->fStencilOpSeparate = StubGLStencilOpSeparate;
    686   functions->fTexImage2D = StubGLTexImage2D;
    687   functions->fTexParameteri = StubGLTexParameteri;
    688   functions->fTexParameteriv = StubGLTexParameteriv;
    689   functions->fTexSubImage2D = StubGLTexSubImage2D;
    690   functions->fTexStorage2D = StubGLTexStorage2D;
    691   functions->fUniform1f = StubGLUniform1f;
    692   functions->fUniform1i = StubGLUniform1i;
    693   functions->fUniform1fv = StubGLUniform1fv;
    694   functions->fUniform1iv = StubGLUniform1iv;
    695   functions->fUniform2f = StubGLUniform2f;
    696   functions->fUniform2i = StubGLUniform2i;
    697   functions->fUniform2fv = StubGLUniform2fv;
    698   functions->fUniform2iv = StubGLUniform2iv;
    699   functions->fUniform3f = StubGLUniform3f;
    700   functions->fUniform3i = StubGLUniform3i;
    701   functions->fUniform3fv = StubGLUniform3fv;
    702   functions->fUniform3iv = StubGLUniform3iv;
    703   functions->fUniform4f = StubGLUniform4f;
    704   functions->fUniform4i = StubGLUniform4i;
    705   functions->fUniform4fv = StubGLUniform4fv;
    706   functions->fUniform4iv = StubGLUniform4iv;
    707   functions->fUniformMatrix2fv = StubGLUniformMatrix2fv;
    708   functions->fUniformMatrix3fv = StubGLUniformMatrix3fv;
    709   functions->fUniformMatrix4fv = StubGLUniformMatrix4fv;
    710   functions->fUseProgram = StubGLUseProgram;
    711   functions->fVertexAttrib4fv = StubGLVertexAttrib4fv;
    712   functions->fVertexAttribPointer = StubGLVertexAttribPointer;
    713   functions->fViewport = StubGLViewport;
    714   functions->fBindFramebuffer = StubGLBindFramebuffer;
    715   functions->fBindRenderbuffer = StubGLBindRenderbuffer;
    716   functions->fCheckFramebufferStatus = StubGLCheckFramebufferStatus;
    717   functions->fDeleteFramebuffers = StubGLDeleteFramebuffers;
    718   functions->fDeleteRenderbuffers = StubGLDeleteRenderbuffers;
    719   functions->fFramebufferRenderbuffer = StubGLFramebufferRenderbuffer;
    720   functions->fFramebufferTexture2D = StubGLFramebufferTexture2D;
    721   functions->fFramebufferTexture2DMultisample =
    722     StubGLFramebufferTexture2DMultisample;
    723   functions->fGenFramebuffers = StubGLGenFramebuffers;
    724   functions->fGenRenderbuffers = StubGLGenRenderbuffers;
    725   functions->fGetFramebufferAttachmentParameteriv =
    726     StubGLGetFramebufferAttachmentParameteriv;
    727   functions->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv;
    728   functions->fRenderbufferStorage = StubGLRenderbufferStorage;
    729   functions->fRenderbufferStorageMultisample =
    730     StubGLRenderbufferStorageMultisample;
    731   functions->fBlitFramebuffer = StubGLBlitFramebuffer;
    732   functions->fMapBuffer = StubGLMapBuffer;
    733   functions->fUnmapBuffer = StubGLUnmapBuffer;
    734   functions->fBindFragDataLocationIndexed =
    735     StubGLBindFragDataLocationIndexed;
    736 
    737   return interface;
    738 }
    739 
    740 }  // namespace gfx
    741