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 StubGLDrawArrays(GLenum mode, GLint first, GLsizei count) {
    191   glDrawArrays(mode, first, count);
    192 }
    193 
    194 GLvoid StubGLDrawBuffer(GLenum mode) {
    195   glDrawBuffer(mode);
    196 }
    197 
    198 GLvoid StubGLDrawBuffers(GLsizei n, const GLenum* bufs) {
    199   glDrawBuffersARB(n, bufs);
    200 }
    201 
    202 GLvoid StubGLDrawElements(GLenum mode, GLsizei count, GLenum type,
    203                           const void* indices) {
    204   glDrawElements(mode, count, type, indices);
    205 }
    206 
    207 GLvoid StubGLEnable(GLenum cap) {
    208   glEnable(cap);
    209 }
    210 
    211 GLvoid StubGLEnableVertexAttribArray(GLuint index) {
    212   glEnableVertexAttribArray(index);
    213 }
    214 
    215 GLvoid StubGLEndQuery(GLenum target) {
    216   glEndQuery(target);
    217 }
    218 
    219 GLvoid StubGLFinish() {
    220   glFinish();
    221 }
    222 
    223 GLvoid StubGLFlush() {
    224   glFlush();
    225 }
    226 
    227 GLvoid StubGLFramebufferRenderbuffer(GLenum target, GLenum attachment,
    228                                      GLenum renderbuffertarget,
    229                                      GLuint renderbuffer) {
    230   glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget,
    231                                renderbuffer);
    232 }
    233 
    234 GLvoid StubGLFramebufferTexture2D(GLenum target, GLenum attachment,
    235                                   GLenum textarget, GLuint texture,
    236                                   GLint level) {
    237   glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
    238 }
    239 
    240 GLvoid StubGLFramebufferTexture2DMultisample(GLenum target, GLenum attachment,
    241                                   GLenum textarget, GLuint texture,
    242                                   GLint level, GLsizei samples) {
    243   glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture,
    244       level, samples);
    245 }
    246 
    247 GLvoid StubGLFrontFace(GLenum mode) {
    248   glFrontFace(mode);
    249 }
    250 
    251 GLvoid StubGLGenBuffers(GLsizei n, GLuint* buffers) {
    252   glGenBuffersARB(n, buffers);
    253 }
    254 
    255 GLvoid StubGLGenFramebuffers(GLsizei n, GLuint* framebuffers) {
    256   glGenFramebuffersEXT(n, framebuffers);
    257 }
    258 
    259 GLvoid StubGLGenQueries(GLsizei n, GLuint* ids) {
    260   glGenQueries(n, ids);
    261 }
    262 
    263 GLvoid StubGLGenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
    264   glGenRenderbuffersEXT(n, renderbuffers);
    265 }
    266 
    267 GLvoid StubGLGenTextures(GLsizei n, GLuint* textures) {
    268   glGenTextures(n, textures);
    269 }
    270 
    271 GLvoid StubGLGenVertexArrays(GLsizei n, GLuint* arrays) {
    272   glGenVertexArraysOES(n, arrays);
    273 }
    274 
    275 GLvoid StubGLGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
    276   glGetBufferParameteriv(target, pname, params);
    277 }
    278 
    279 GLvoid StubGLGetFramebufferAttachmentParameteriv(GLenum target,
    280                                                  GLenum attachment,
    281                                                  GLenum pname, GLint* params) {
    282   glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
    283 }
    284 
    285 GLenum StubGLGetError() {
    286   return glGetError();
    287 }
    288 
    289 GLvoid StubGLGetIntegerv(GLenum pname, GLint* params) {
    290   glGetIntegerv(pname, params);
    291 }
    292 
    293 GLvoid StubGLGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length,
    294                                char* infolog) {
    295   glGetProgramInfoLog(program, bufsize, length, infolog);
    296 }
    297 
    298 GLvoid StubGLGetProgramiv(GLuint program, GLenum pname, GLint* params) {
    299   glGetProgramiv(program, pname, params);
    300 }
    301 
    302 GLvoid StubGLGetRenderbufferParameteriv(GLenum target,
    303                                         GLenum pname, GLint* params) {
    304   glGetRenderbufferParameterivEXT(target, pname, params);
    305 }
    306 
    307 GLvoid StubGLGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length,
    308                               char* infolog) {
    309   glGetShaderInfoLog(shader, bufsize, length, infolog);
    310 }
    311 
    312 GLvoid StubGLGetShaderiv(GLuint shader, GLenum pname, GLint* params) {
    313   glGetShaderiv(shader, pname, params);
    314 }
    315 
    316 const GLubyte* StubGLGetString(GLenum name) {
    317   return glGetString(name);
    318 }
    319 
    320 GLvoid StubGLGetQueryiv(GLenum target, GLenum pname, GLint* params) {
    321   glGetQueryiv(target, pname, params);
    322 }
    323 
    324 GLvoid StubGLGetQueryObjecti64v(GLuint id, GLenum pname, GLint64* params) {
    325   glGetQueryObjecti64v(id, pname, params);
    326 }
    327 
    328 GLvoid StubGLGetQueryObjectiv(GLuint id, GLenum pname, GLint* params) {
    329   glGetQueryObjectiv(id, pname, params);
    330 }
    331 
    332 GLvoid StubGLGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64* params) {
    333   glGetQueryObjectui64v(id, pname, params);
    334 }
    335 
    336 GLvoid StubGLGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) {
    337   glGetQueryObjectuiv(id, pname, params);
    338 }
    339 
    340 GLvoid StubGLGetTexLevelParameteriv(GLenum target, GLint level,
    341                                     GLenum pname, GLint* params) {
    342   glGetTexLevelParameteriv(target, level, pname, params);
    343 }
    344 
    345 GLint StubGLGetUniformLocation(GLuint program, const char* name) {
    346   return glGetUniformLocation(program, name);
    347 }
    348 
    349 GLvoid StubGLLineWidth(GLfloat width) {
    350   glLineWidth(width);
    351 }
    352 
    353 GLvoid StubGLLinkProgram(GLuint program) {
    354   glLinkProgram(program);
    355 }
    356 
    357 void* StubGLMapBuffer(GLenum target, GLenum access) {
    358   return glMapBuffer(target, access);
    359 }
    360 
    361 GLvoid StubGLPixelStorei(GLenum pname, GLint param) {
    362   glPixelStorei(pname, param);
    363 }
    364 
    365 GLvoid StubGLQueryCounter(GLuint id, GLenum target) {
    366   glQueryCounter(id, target);
    367 }
    368 
    369 GLvoid StubGLReadBuffer(GLenum src) {
    370   glReadBuffer(src);
    371 }
    372 
    373 GLvoid StubGLReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
    374                         GLenum format, GLenum type, void* pixels) {
    375   glReadPixels(x, y, width, height, format, type, pixels);
    376 }
    377 
    378 GLvoid StubGLRenderbufferStorage(GLenum target, GLenum internalformat,
    379                                  GLsizei width, GLsizei height) {
    380   glRenderbufferStorageEXT(target, internalformat, width, height);
    381 }
    382 
    383 GLvoid StubGLRenderbufferStorageMultisample(GLenum target, GLsizei samples,
    384                                             GLenum internalformat,
    385                                             GLsizei width, GLsizei height) {
    386   glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width,
    387                                       height);
    388 }
    389 
    390 GLvoid StubGLScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
    391   glScissor(x, y, width, height);
    392 }
    393 
    394 GLvoid StubGLShaderSource(GLuint shader, GLsizei count, const char* const* str,
    395                           const GLint* length) {
    396   glShaderSource(shader, count, str, length);
    397 }
    398 
    399 GLvoid StubGLStencilFunc(GLenum func, GLint ref, GLuint mask) {
    400   glStencilFunc(func, ref, mask);
    401 }
    402 
    403 GLvoid StubGLStencilFuncSeparate(GLenum face, GLenum func, GLint ref,
    404                                  GLuint mask) {
    405   glStencilFuncSeparate(face, func, ref, mask);
    406 }
    407 
    408 GLvoid StubGLStencilMask(GLuint mask) {
    409   glStencilMask(mask);
    410 }
    411 
    412 GLvoid StubGLStencilMaskSeparate(GLenum face, GLuint mask) {
    413   glStencilMaskSeparate(face, mask);
    414 }
    415 
    416 GLvoid StubGLStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
    417   glStencilOp(fail, zfail, zpass);
    418 }
    419 
    420 GLvoid StubGLStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail,
    421                                GLenum zpass) {
    422   glStencilOpSeparate(face, fail, zfail, zpass);
    423 }
    424 
    425 GLvoid StubGLTexImage2D(GLenum target, GLint level, GLint internalformat,
    426                         GLsizei width, GLsizei height, GLint border,
    427                         GLenum format, GLenum type, const void* pixels) {
    428   glTexImage2D(target, level, internalformat, width, height, border, format,
    429                type, pixels);
    430 }
    431 
    432 GLvoid StubGLTexParameteri(GLenum target, GLenum pname, GLint param) {
    433   glTexParameteri(target, pname, param);
    434 }
    435 
    436 GLvoid StubGLTexParameteriv(GLenum target, GLenum pname, const GLint* params) {
    437   glTexParameteriv(target, pname, params);
    438 }
    439 
    440 GLvoid StubGLTexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat,
    441                           GLsizei width, GLsizei height) {
    442   glTexStorage2DEXT(target, levels, internalFormat, width, height);
    443 }
    444 
    445 GLvoid StubGLTexSubImage2D(GLenum target, GLint level, GLint xoffset,
    446                            GLint yoffset, GLsizei width, GLsizei height,
    447                            GLenum format, GLenum type, const void* pixels) {
    448   glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
    449                   pixels);
    450 }
    451 
    452 GLvoid StubGLUniform1f(GLint location, GLfloat v) {
    453   glUniform1i(location, v);
    454 }
    455 
    456 GLvoid StubGLUniform1i(GLint location, GLint v) {
    457   glUniform1i(location, v);
    458 }
    459 
    460 GLvoid StubGLUniform1fv(GLint location, GLsizei count, const GLfloat* v) {
    461   glUniform1fv(location, count, v);
    462 }
    463 
    464 GLvoid StubGLUniform1iv(GLint location, GLsizei count, const GLint* v) {
    465   glUniform1iv(location, count, v);
    466 }
    467 
    468 GLvoid StubGLUniform2f(GLint location, GLfloat v0, GLfloat v1) {
    469   glUniform2i(location, v0, v1);
    470 }
    471 
    472 GLvoid StubGLUniform2i(GLint location, GLint v0, GLint v1) {
    473   glUniform2i(location, v0, v1);
    474 }
    475 
    476 GLvoid StubGLUniform2fv(GLint location, GLsizei count, const GLfloat* v) {
    477   glUniform2fv(location, count, v);
    478 }
    479 
    480 GLvoid StubGLUniform2iv(GLint location, GLsizei count, const GLint* v) {
    481   glUniform2iv(location, count, v);
    482 }
    483 
    484 GLvoid StubGLUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
    485   glUniform3i(location, v0, v1, v2);
    486 }
    487 
    488 GLvoid StubGLUniform3i(GLint location, GLint v0, GLint v1, GLint v2) {
    489   glUniform3i(location, v0, v1, v2);
    490 }
    491 
    492 GLvoid StubGLUniform3fv(GLint location, GLsizei count, const GLfloat* v) {
    493   glUniform3fv(location, count, v);
    494 }
    495 
    496 GLvoid StubGLUniform3iv(GLint location, GLsizei count, const GLint* v) {
    497   glUniform3iv(location, count, v);
    498 }
    499 
    500 GLvoid StubGLUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
    501                        GLfloat v3) {
    502   glUniform4i(location, v0, v1, v2, v3);
    503 }
    504 
    505 GLvoid StubGLUniform4i(GLint location, GLint v0, GLint v1, GLint v2,
    506                        GLint v3) {
    507   glUniform4i(location, v0, v1, v2, v3);
    508 }
    509 
    510 GLvoid StubGLUniform4fv(GLint location, GLsizei count, const GLfloat* v) {
    511   glUniform4fv(location, count, v);
    512 }
    513 
    514 GLvoid StubGLUniform4iv(GLint location, GLsizei count, const GLint* v) {
    515   glUniform4iv(location, count, v);
    516 }
    517 
    518 GLvoid StubGLUniformMatrix2fv(GLint location, GLsizei count,
    519                               GLboolean transpose, const GLfloat* value) {
    520   glUniformMatrix2fv(location, count, transpose, value);
    521 }
    522 
    523 GLvoid StubGLUniformMatrix3fv(GLint location, GLsizei count,
    524                               GLboolean transpose, const GLfloat* value) {
    525   glUniformMatrix3fv(location, count, transpose, value);
    526 }
    527 
    528 GLvoid StubGLUniformMatrix4fv(GLint location, GLsizei count,
    529                               GLboolean transpose, const GLfloat* value) {
    530   glUniformMatrix4fv(location, count, transpose, value);
    531 }
    532 
    533 GLboolean StubGLUnmapBuffer(GLenum target) {
    534   return glUnmapBuffer(target);
    535 }
    536 
    537 GLvoid StubGLUseProgram(GLuint program) {
    538   glUseProgram(program);
    539 }
    540 
    541 GLvoid StubGLVertexAttrib4fv(GLuint indx, const GLfloat* values) {
    542   glVertexAttrib4fv(indx, values);
    543 }
    544 
    545 GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type,
    546                                  GLboolean normalized, GLsizei stride,
    547                                  const void* ptr) {
    548   glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
    549 }
    550 
    551 GLvoid StubGLViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
    552   glViewport(x, y, width, height);
    553 }
    554 }  // extern "C"
    555 }  // namespace
    556 
    557 namespace gfx {
    558 
    559 GrGLInterface* CreateInProcessSkiaGLBinding() {
    560   GrGLBinding binding;
    561   switch (gfx::GetGLImplementation()) {
    562     case gfx::kGLImplementationNone:
    563       NOTREACHED();
    564       return NULL;
    565     case gfx::kGLImplementationDesktopGL:
    566     case gfx::kGLImplementationAppleGL:
    567       binding = kDesktop_GrGLBinding;
    568       break;
    569     case gfx::kGLImplementationOSMesaGL:
    570       binding = kDesktop_GrGLBinding;
    571       break;
    572     case gfx::kGLImplementationEGLGLES2:
    573       binding = kES2_GrGLBinding;
    574       break;
    575     case gfx::kGLImplementationMockGL:
    576       NOTREACHED();
    577       return NULL;
    578     default:
    579       NOTREACHED();
    580       return NULL;
    581   }
    582 
    583   GrGLInterface* interface = new GrGLInterface;
    584 
    585   interface->fBindingsExported = binding;
    586   interface->fActiveTexture = StubGLActiveTexture;
    587   interface->fAttachShader = StubGLAttachShader;
    588   interface->fBeginQuery = StubGLBeginQuery;
    589   interface->fBindAttribLocation = StubGLBindAttribLocation;
    590   interface->fBindBuffer = StubGLBindBuffer;
    591   interface->fBindFragDataLocation = StubGLBindFragDataLocation;
    592   interface->fBindTexture = StubGLBindTexture;
    593   interface->fBindVertexArray = StubGLBindVertexArray;
    594   interface->fBlendColor = StubGLBlendColor;
    595   interface->fBlendFunc = StubGLBlendFunc;
    596   interface->fBufferData = StubGLBufferData;
    597   interface->fBufferSubData = StubGLBufferSubData;
    598   interface->fClear = StubGLClear;
    599   interface->fClearColor = StubGLClearColor;
    600   interface->fClearStencil = StubGLClearStencil;
    601   interface->fColorMask = StubGLColorMask;
    602   interface->fCompileShader = StubGLCompileShader;
    603   interface->fCompressedTexImage2D = StubGLCompressedTexImage2D;
    604   interface->fCopyTexSubImage2D = StubGLCopyTexSubImage2D;
    605   interface->fCreateProgram = StubGLCreateProgram;
    606   interface->fCreateShader = StubGLCreateShader;
    607   interface->fCullFace = StubGLCullFace;
    608   interface->fDeleteBuffers = StubGLDeleteBuffers;
    609   interface->fDeleteProgram = StubGLDeleteProgram;
    610   interface->fDeleteQueries = StubGLDeleteQueries;
    611   interface->fDeleteShader = StubGLDeleteShader;
    612   interface->fDeleteTextures = StubGLDeleteTextures;
    613   interface->fDeleteVertexArrays = StubGLDeleteVertexArrays;
    614   interface->fDepthMask = StubGLDepthMask;
    615   interface->fDisable = StubGLDisable;
    616   interface->fDisableVertexAttribArray = StubGLDisableVertexAttribArray;
    617   interface->fDrawArrays = StubGLDrawArrays;
    618   interface->fDrawBuffer = StubGLDrawBuffer;
    619   interface->fDrawBuffers = StubGLDrawBuffers;
    620   interface->fDrawElements = StubGLDrawElements;
    621   interface->fEnable = StubGLEnable;
    622   interface->fEnableVertexAttribArray = StubGLEnableVertexAttribArray;
    623   interface->fEndQuery = StubGLEndQuery;
    624   interface->fFinish = StubGLFinish;
    625   interface->fFlush = StubGLFlush;
    626   interface->fFrontFace = StubGLFrontFace;
    627   interface->fGenBuffers = StubGLGenBuffers;
    628   interface->fGenQueries = StubGLGenQueries;
    629   interface->fGenTextures = StubGLGenTextures;
    630   interface->fGenVertexArrays = StubGLGenVertexArrays;
    631   interface->fGetBufferParameteriv = StubGLGetBufferParameteriv;
    632   interface->fGetError = StubGLGetError;
    633   interface->fGetIntegerv = StubGLGetIntegerv;
    634   interface->fGetQueryiv = StubGLGetQueryiv;
    635   interface->fGetQueryObjecti64v = StubGLGetQueryObjecti64v;
    636   interface->fGetQueryObjectiv = StubGLGetQueryObjectiv;
    637   interface->fGetQueryObjectui64v = StubGLGetQueryObjectui64v;
    638   interface->fGetQueryObjectuiv = StubGLGetQueryObjectuiv;
    639   interface->fGetProgramInfoLog = StubGLGetProgramInfoLog;
    640   interface->fGetProgramiv = StubGLGetProgramiv;
    641   interface->fGetShaderInfoLog = StubGLGetShaderInfoLog;
    642   interface->fGetShaderiv = StubGLGetShaderiv;
    643   interface->fGetString = StubGLGetString;
    644   interface->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv;
    645   interface->fGetUniformLocation = StubGLGetUniformLocation;
    646   interface->fLineWidth = StubGLLineWidth;
    647   interface->fLinkProgram = StubGLLinkProgram;
    648   interface->fPixelStorei = StubGLPixelStorei;
    649   interface->fQueryCounter = StubGLQueryCounter;
    650   interface->fReadBuffer = StubGLReadBuffer;
    651   interface->fReadPixels = StubGLReadPixels;
    652   interface->fScissor = StubGLScissor;
    653   interface->fShaderSource = StubGLShaderSource;
    654   interface->fStencilFunc = StubGLStencilFunc;
    655   interface->fStencilFuncSeparate = StubGLStencilFuncSeparate;
    656   interface->fStencilMask = StubGLStencilMask;
    657   interface->fStencilMaskSeparate = StubGLStencilMaskSeparate;
    658   interface->fStencilOp = StubGLStencilOp;
    659   interface->fStencilOpSeparate = StubGLStencilOpSeparate;
    660   interface->fTexImage2D = StubGLTexImage2D;
    661   interface->fTexParameteri = StubGLTexParameteri;
    662   interface->fTexParameteriv = StubGLTexParameteriv;
    663   interface->fTexSubImage2D = StubGLTexSubImage2D;
    664   interface->fTexStorage2D = StubGLTexStorage2D;
    665   interface->fUniform1f = StubGLUniform1f;
    666   interface->fUniform1i = StubGLUniform1i;
    667   interface->fUniform1fv = StubGLUniform1fv;
    668   interface->fUniform1iv = StubGLUniform1iv;
    669   interface->fUniform2f = StubGLUniform2f;
    670   interface->fUniform2i = StubGLUniform2i;
    671   interface->fUniform2fv = StubGLUniform2fv;
    672   interface->fUniform2iv = StubGLUniform2iv;
    673   interface->fUniform3f = StubGLUniform3f;
    674   interface->fUniform3i = StubGLUniform3i;
    675   interface->fUniform3fv = StubGLUniform3fv;
    676   interface->fUniform3iv = StubGLUniform3iv;
    677   interface->fUniform4f = StubGLUniform4f;
    678   interface->fUniform4i = StubGLUniform4i;
    679   interface->fUniform4fv = StubGLUniform4fv;
    680   interface->fUniform4iv = StubGLUniform4iv;
    681   interface->fUniformMatrix2fv = StubGLUniformMatrix2fv;
    682   interface->fUniformMatrix3fv = StubGLUniformMatrix3fv;
    683   interface->fUniformMatrix4fv = StubGLUniformMatrix4fv;
    684   interface->fUseProgram = StubGLUseProgram;
    685   interface->fVertexAttrib4fv = StubGLVertexAttrib4fv;
    686   interface->fVertexAttribPointer = StubGLVertexAttribPointer;
    687   interface->fViewport = StubGLViewport;
    688   interface->fBindFramebuffer = StubGLBindFramebuffer;
    689   interface->fBindRenderbuffer = StubGLBindRenderbuffer;
    690   interface->fCheckFramebufferStatus = StubGLCheckFramebufferStatus;
    691   interface->fDeleteFramebuffers = StubGLDeleteFramebuffers;
    692   interface->fDeleteRenderbuffers = StubGLDeleteRenderbuffers;
    693   interface->fFramebufferRenderbuffer = StubGLFramebufferRenderbuffer;
    694   interface->fFramebufferTexture2D = StubGLFramebufferTexture2D;
    695   interface->fFramebufferTexture2DMultisample =
    696     StubGLFramebufferTexture2DMultisample;
    697   interface->fGenFramebuffers = StubGLGenFramebuffers;
    698   interface->fGenRenderbuffers = StubGLGenRenderbuffers;
    699   interface->fGetFramebufferAttachmentParameteriv =
    700     StubGLGetFramebufferAttachmentParameteriv;
    701   interface->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv;
    702   interface->fRenderbufferStorage = StubGLRenderbufferStorage;
    703   interface->fRenderbufferStorageMultisample =
    704     StubGLRenderbufferStorageMultisample;
    705   interface->fBlitFramebuffer = StubGLBlitFramebuffer;
    706   interface->fMapBuffer = StubGLMapBuffer;
    707   interface->fUnmapBuffer = StubGLUnmapBuffer;
    708   interface->fBindFragDataLocationIndexed =
    709     StubGLBindFragDataLocationIndexed;
    710   return interface;
    711 }
    712 
    713 }  // namespace gfx
    714