Home | History | Annotate | Download | only in gl
      1 /*
      2  * Copyright 2013 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #include "GrGLNoOpInterface.h"
      9 #include "SkMutex.h"
     10 #include "SkString.h"
     11 
     12 // the OpenGLES 2.0 spec says this must be >= 128
     13 static const GrGLint kDefaultMaxVertexUniformVectors = 128;
     14 
     15 // the OpenGLES 2.0 spec says this must be >=16
     16 static const GrGLint kDefaultMaxFragmentUniformVectors = 16;
     17 
     18 // the OpenGLES 2.0 spec says this must be >= 8
     19 static const GrGLint kDefaultMaxVertexAttribs = 8;
     20 
     21 // the OpenGLES 2.0 spec says this must be >= 8
     22 static const GrGLint kDefaultMaxVaryingVectors = 8;
     23 
     24 static const char* kExtensions[] = {
     25     "GL_ARB_framebuffer_object",
     26     "GL_ARB_blend_func_extended",
     27     "GL_ARB_timer_query",
     28     "GL_ARB_draw_buffers",
     29     "GL_ARB_occlusion_query",
     30     "GL_EXT_stencil_wrap"
     31 };
     32 
     33 namespace {
     34 const GrGLubyte* combined_extensions_string() {
     35     static SkString gExtString;
     36     static SkMutex gMutex;
     37     gMutex.acquire();
     38     if (0 == gExtString.size()) {
     39         for (size_t i = 0; i < SK_ARRAY_COUNT(kExtensions) - 1; ++i) {
     40             gExtString.append(kExtensions[i]);
     41             gExtString.append(" ");
     42         }
     43         gExtString.append(kExtensions[SK_ARRAY_COUNT(kExtensions) - 1]);
     44     }
     45     gMutex.release();
     46     return (const GrGLubyte*) gExtString.c_str();
     47 }
     48 }
     49 
     50 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program,
     51                                                         GrGLuint colorNumber,
     52                                                         const GrGLchar* name) {
     53 }
     54 
     55 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendColor(GrGLclampf red,
     56                                               GrGLclampf green,
     57                                               GrGLclampf blue,
     58                                               GrGLclampf alpha) {
     59 }
     60 
     61 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendEquation(GrGLenum mode) {
     62 }
     63 
     64 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendFunc(GrGLenum sfactor,
     65                                               GrGLenum dfactor) {
     66 }
     67 
     68 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBufferSubData(GrGLenum target,
     69                                                  GrGLintptr offset,
     70                                                  GrGLsizeiptr size,
     71                                                  const GrGLvoid* data) {
     72 }
     73 
     74 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClear(GrGLbitfield mask) {
     75 }
     76 
     77 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClearColor(GrGLclampf red,
     78                                               GrGLclampf green,
     79                                               GrGLclampf blue,
     80                                               GrGLclampf alpha) {
     81 }
     82 
     83 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClearStencil(GrGLint s) {
     84 }
     85 
     86 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLColorMask(GrGLboolean red,
     87                                              GrGLboolean green,
     88                                              GrGLboolean blue,
     89                                              GrGLboolean alpha) {
     90 }
     91 
     92 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompileShader(GrGLuint shader) {
     93 }
     94 
     95 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target,
     96                                                         GrGLint level,
     97                                                         GrGLenum internalformat,
     98                                                         GrGLsizei width,
     99                                                         GrGLsizei height,
    100                                                         GrGLint border,
    101                                                         GrGLsizei imageSize,
    102                                                         const GrGLvoid* data) {
    103 }
    104 
    105 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexSubImage2D(GrGLenum target,
    106                                                            GrGLint level,
    107                                                            GrGLint xoffset,
    108                                                            GrGLint yoffset,
    109                                                            GrGLsizei width,
    110                                                            GrGLsizei height,
    111                                                            GrGLenum format,
    112                                                            GrGLsizei imageSize,
    113                                                            const GrGLvoid* data) {
    114 }
    115 
    116 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target,
    117                                                      GrGLint level,
    118                                                      GrGLint xoffset,
    119                                                      GrGLint yoffset,
    120                                                      GrGLint x,
    121                                                      GrGLint y,
    122                                                      GrGLsizei width,
    123                                                      GrGLsizei height) {
    124 }
    125 
    126 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCullFace(GrGLenum mode) {
    127 }
    128 
    129 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDepthMask(GrGLboolean flag) {
    130 }
    131 
    132 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisable(GrGLenum cap) {
    133 }
    134 
    135 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableVertexAttribArray(GrGLuint index) {
    136 }
    137 
    138 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawArrays(GrGLenum mode,
    139                                               GrGLint first,
    140                                               GrGLsizei count) {
    141 }
    142 
    143 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawArraysInstanced(GrGLenum mode,
    144                                                        GrGLint first,
    145                                                        GrGLsizei count,
    146                                                        GrGLsizei primcount) {
    147 }
    148 
    149 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffer(GrGLenum mode) {
    150 }
    151 
    152 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffers(GrGLsizei n,
    153                                                const GrGLenum* bufs) {
    154 }
    155 
    156 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElements(GrGLenum mode,
    157                                                 GrGLsizei count,
    158                                                 GrGLenum type,
    159                                                 const GrGLvoid* indices) {
    160 }
    161 
    162 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElementsInstanced(GrGLenum mode,
    163                                                          GrGLsizei count,
    164                                                          GrGLenum type,
    165                                                          const GrGLvoid* indices,
    166                                                          GrGLsizei primcount) {
    167 }
    168 
    169 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap) {
    170 }
    171 
    172 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index) {
    173 }
    174 
    175 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEndQuery(GrGLenum target) {
    176 }
    177 
    178 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFinish() {
    179 }
    180 
    181 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFlush() {
    182 }
    183 
    184 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFrontFace(GrGLenum mode) {
    185 }
    186 
    187 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLineWidth(GrGLfloat width) {
    188 }
    189 
    190 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLinkProgram(GrGLuint program) {
    191 }
    192 
    193 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadf(GrGLenum, const GrGLfloat*) {
    194 }
    195 
    196 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadIdentity(GrGLenum) {
    197 }
    198 
    199 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLQueryCounter(GrGLuint id, GrGLenum target) {
    200 }
    201 
    202 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLReadBuffer(GrGLenum src) {
    203 }
    204 
    205 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLScissor(GrGLint x,
    206                                            GrGLint y,
    207                                            GrGLsizei width,
    208                                            GrGLsizei height) {
    209 }
    210 
    211 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLShaderSource(GrGLuint shader,
    212                                                 GrGLsizei count,
    213 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
    214                                                 const char* const * str,
    215 #else
    216                                                 const char** str,
    217 #endif
    218                                                 const GrGLint* length) {
    219 }
    220 
    221 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {
    222 }
    223 
    224 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFuncSeparate(GrGLenum face,
    225                                                        GrGLenum func,
    226                                                        GrGLint ref,
    227                                                        GrGLuint mask) {
    228 }
    229 
    230 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMask(GrGLuint mask) {
    231 }
    232 
    233 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMaskSeparate(GrGLenum face, GrGLuint mask) {
    234 }
    235 
    236 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOp(GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {
    237 }
    238 
    239 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOpSeparate(GrGLenum face,
    240                                                      GrGLenum fail,
    241                                                      GrGLenum zfail,
    242                                                      GrGLenum zpass) {
    243 }
    244 
    245 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexImage2D(GrGLenum target,
    246                                               GrGLint level,
    247                                               GrGLint internalformat,
    248                                               GrGLsizei width,
    249                                               GrGLsizei height,
    250                                               GrGLint border,
    251                                               GrGLenum format,
    252                                               GrGLenum type,
    253                                               const GrGLvoid* pixels) {
    254 }
    255 
    256 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteri(GrGLenum target,
    257                                                  GrGLenum pname,
    258                                                  GrGLint param) {
    259 }
    260 
    261 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteriv(GrGLenum target,
    262                                                   GrGLenum pname,
    263                                                   const GrGLint* params) {
    264 }
    265 
    266 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexStorage2D(GrGLenum target,
    267                                                 GrGLsizei levels,
    268                                                 GrGLenum internalformat,
    269                                                 GrGLsizei width,
    270                                                 GrGLsizei height) {
    271 }
    272 
    273 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
    274                                                       GrGLsizei numAttachments,
    275                                                       const GrGLenum* attachments) {
    276 }
    277 
    278 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
    279                                                  GrGLint level,
    280                                                  GrGLint xoffset,
    281                                                  GrGLint yoffset,
    282                                                  GrGLsizei width,
    283                                                  GrGLsizei height,
    284                                                  GrGLenum format,
    285                                                  GrGLenum type,
    286                                                  const GrGLvoid* pixels) {
    287 }
    288 
    289 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1f(GrGLint location, GrGLfloat v0) {
    290 }
    291 
    292 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1i(GrGLint location, GrGLint v0) {
    293 }
    294 
    295 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1fv(GrGLint location,
    296                                               GrGLsizei count,
    297                                               const GrGLfloat* v) {
    298 }
    299 
    300 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1iv(GrGLint location,
    301                                               GrGLsizei count,
    302                                               const GrGLint* v) {
    303 }
    304 
    305 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2f(GrGLint location, GrGLfloat v0, GrGLfloat v1) {
    306 }
    307 
    308 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2i(GrGLint location, GrGLint v0, GrGLint v1) {
    309 }
    310 
    311 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2fv(GrGLint location,
    312                                               GrGLsizei count,
    313                                               const GrGLfloat* v) {
    314 }
    315 
    316 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2iv(GrGLint location,
    317                                               GrGLsizei count,
    318                                               const GrGLint* v) {
    319 }
    320 
    321 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3f(GrGLint location,
    322                                               GrGLfloat v0,
    323                                               GrGLfloat v1,
    324                                               GrGLfloat v2) {
    325 }
    326 
    327 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3i(GrGLint location,
    328                                               GrGLint v0,
    329                                               GrGLint v1,
    330                                               GrGLint v2) {
    331 }
    332 
    333 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3fv(GrGLint location,
    334                                               GrGLsizei count,
    335                                               const GrGLfloat* v) {
    336 }
    337 
    338 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3iv(GrGLint location,
    339                                               GrGLsizei count,
    340                                               const GrGLint* v) {
    341 }
    342 
    343 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4f(GrGLint location,
    344                                               GrGLfloat v0,
    345                                               GrGLfloat v1,
    346                                               GrGLfloat v2,
    347                                               GrGLfloat v3) {
    348 }
    349 
    350 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4i(GrGLint location,
    351                                               GrGLint v0,
    352                                               GrGLint v1,
    353                                               GrGLint v2,
    354                                               GrGLint v3) {
    355 }
    356 
    357 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4fv(GrGLint location,
    358                                               GrGLsizei count,
    359                                               const GrGLfloat* v) {
    360 }
    361 
    362 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4iv(GrGLint location,
    363                                               GrGLsizei count,
    364                                               const GrGLint* v) {
    365 }
    366 
    367 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix2fv(GrGLint location,
    368                                                     GrGLsizei count,
    369                                                     GrGLboolean transpose,
    370                                                     const GrGLfloat* value) {
    371 }
    372 
    373 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix3fv(GrGLint location,
    374                                                     GrGLsizei count,
    375                                                     GrGLboolean transpose,
    376                                                     const GrGLfloat* value) {
    377 }
    378 
    379 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix4fv(GrGLint location,
    380                                                     GrGLsizei count,
    381                                                     GrGLboolean transpose,
    382                                                     const GrGLfloat* value) {
    383 }
    384 
    385  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib1f(GrGLuint indx, const GrGLfloat value) {
    386 }
    387 
    388  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib2fv(GrGLuint indx, const GrGLfloat* values) {
    389 }
    390 
    391  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib3fv(GrGLuint indx, const GrGLfloat* values) {
    392 }
    393 
    394  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) {
    395 }
    396 
    397 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribIPointer(GrGLuint indx,
    398                                                         GrGLint size,
    399                                                         GrGLenum type,
    400                                                         GrGLsizei stride,
    401                                                         const GrGLvoid* ptr) {
    402 }
    403 
    404 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribPointer(GrGLuint indx,
    405                                                        GrGLint size,
    406                                                        GrGLenum type,
    407                                                        GrGLboolean normalized,
    408                                                        GrGLsizei stride,
    409                                                        const GrGLvoid* ptr) {
    410 }
    411 
    412 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribDivisor(GrGLuint index, GrGLuint divisor) {
    413 }
    414 
    415 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLViewport(GrGLint x,
    416                                             GrGLint y,
    417                                             GrGLsizei width,
    418                                             GrGLsizei height) {
    419 }
    420 
    421   GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetFramebufferAttachmentParameteriv(GrGLenum target,
    422                                                                          GrGLenum attachment,
    423                                                                          GrGLenum pname,
    424                                                                          GrGLint* params) {
    425 }
    426 
    427 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetRenderbufferParameteriv(GrGLenum target,
    428                                                               GrGLenum pname,
    429                                                               GrGLint* params) {
    430 }
    431 
    432 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorage(GrGLenum target,
    433                                                        GrGLenum internalformat,
    434                                                        GrGLsizei width,
    435                                                        GrGLsizei height) {
    436 }
    437 
    438 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorageMultisample(GrGLenum target,
    439                                                                   GrGLsizei samples,
    440                                                                   GrGLenum internalformat,
    441                                                                   GrGLsizei width,
    442                                                                   GrGLsizei height) {
    443 }
    444 
    445 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlitFramebuffer(GrGLint srcX0,
    446                                                    GrGLint srcY0,
    447                                                    GrGLint srcX1,
    448                                                    GrGLint srcY1,
    449                                                    GrGLint dstX0,
    450                                                    GrGLint dstY0,
    451                                                    GrGLint dstX1,
    452                                                    GrGLint dstY1,
    453                                                    GrGLbitfield mask,
    454                                                    GrGLenum filter) {
    455 }
    456 
    457 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLResolveMultisampleFramebuffer() {
    458 }
    459 
    460 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocationIndexed(GrGLuint program,
    461                                                                GrGLuint colorNumber,
    462                                                                GrGLuint index,
    463                                                                const GrGLchar * name) {
    464 }
    465 
    466 GrGLenum GR_GL_FUNCTION_TYPE noOpGLCheckFramebufferStatus(GrGLenum target) {
    467 
    468     GrAlwaysAssert(GR_GL_FRAMEBUFFER == target);
    469 
    470     return GR_GL_FRAMEBUFFER_COMPLETE;
    471 }
    472 
    473 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGenIds(GrGLsizei n, GrGLuint* ids) {
    474     static int gCurrID = 1;
    475     for (int i = 0; i < n; ++i) {
    476         ids[i] = ++gCurrID;
    477    }
    478 }
    479 
    480 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDeleteIds(GrGLsizei n, const GrGLuint* ids) {
    481 }
    482 
    483 GrGLenum GR_GL_FUNCTION_TYPE noOpGLGetError() {
    484     return GR_GL_NO_ERROR;
    485 }
    486 
    487 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetIntegerv(GrGLenum pname, GrGLint* params) {
    488     // TODO: remove from Ganesh the #defines for gets we don't use.
    489     // We would like to minimize gets overall due to performance issues
    490     switch (pname) {
    491         case GR_GL_CONTEXT_PROFILE_MASK:
    492             *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
    493             break;
    494         case GR_GL_STENCIL_BITS:
    495             *params = 8;
    496             break;
    497         case GR_GL_SAMPLES:
    498             *params = 1;
    499             break;
    500         case GR_GL_FRAMEBUFFER_BINDING:
    501             *params = 0;
    502             break;
    503         case GR_GL_VIEWPORT:
    504             params[0] = 0;
    505             params[1] = 0;
    506             params[2] = 800;
    507             params[3] = 600;
    508             break;
    509         case GR_GL_MAX_TEXTURE_IMAGE_UNITS:
    510             *params = 8;
    511             break;
    512         case GR_GL_MAX_TEXTURE_COORDS:
    513             *params = 8;
    514             break;
    515         case GR_GL_MAX_VERTEX_UNIFORM_VECTORS:
    516             *params = kDefaultMaxVertexUniformVectors;
    517             break;
    518         case GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
    519             *params = kDefaultMaxFragmentUniformVectors;
    520             break;
    521         case GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
    522             *params = 16 * 4;
    523             break;
    524         case GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
    525             *params = 0;
    526             break;
    527         case GR_GL_COMPRESSED_TEXTURE_FORMATS:
    528             break;
    529         case GR_GL_MAX_TEXTURE_SIZE:
    530             *params = 8192;
    531             break;
    532         case GR_GL_MAX_RENDERBUFFER_SIZE:
    533             *params = 8192;
    534             break;
    535         case GR_GL_MAX_SAMPLES:
    536             *params = 32;
    537             break;
    538         case GR_GL_MAX_VERTEX_ATTRIBS:
    539             *params = kDefaultMaxVertexAttribs;
    540             break;
    541         case GR_GL_MAX_VARYING_VECTORS:
    542             *params = kDefaultMaxVaryingVectors;
    543             break;
    544         case GR_GL_NUM_EXTENSIONS:
    545             *params = SK_ARRAY_COUNT(kExtensions);
    546             break;
    547         default:
    548             SkFAIL("Unexpected pname to GetIntegerv");
    549    }
    550 }
    551 
    552 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetInfoLog(GrGLuint program,
    553                                               GrGLsizei bufsize,
    554                                               GrGLsizei* length,
    555                                               char* infolog) {
    556     if (length) {
    557         *length = 0;
    558    }
    559     if (bufsize > 0) {
    560         *infolog = 0;
    561    }
    562 }
    563 
    564 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program,
    565                                                         GrGLenum pname,
    566                                                         GrGLint* params) {
    567     switch (pname) {
    568         case GR_GL_LINK_STATUS:  // fallthru
    569         case GR_GL_COMPILE_STATUS:
    570             *params = GR_GL_TRUE;
    571             break;
    572         case GR_GL_INFO_LOG_LENGTH:
    573             *params = 0;
    574             break;
    575         // we don't expect any other pnames
    576         default:
    577             SkFAIL("Unexpected pname to GetProgramiv");
    578             break;
    579    }
    580 }
    581 
    582 namespace {
    583 template <typename T>
    584 void query_result(GrGLenum GLtarget, GrGLenum pname, T *params) {
    585     switch (pname) {
    586         case GR_GL_QUERY_RESULT_AVAILABLE:
    587             *params = GR_GL_TRUE;
    588             break;
    589         case GR_GL_QUERY_RESULT:
    590             *params = 0;
    591             break;
    592         default:
    593             SkFAIL("Unexpected pname passed to GetQueryObject.");
    594             break;
    595    }
    596 }
    597 }
    598 
    599 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryiv(GrGLenum GLtarget,
    600                                               GrGLenum pname,
    601                                               GrGLint *params) {
    602     switch (pname) {
    603         case GR_GL_CURRENT_QUERY:
    604             *params = 0;
    605             break;
    606         case GR_GL_QUERY_COUNTER_BITS:
    607             *params = 32;
    608             break;
    609         default:
    610             SkFAIL("Unexpected pname passed GetQueryiv.");
    611    }
    612 }
    613 
    614 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjecti64v(GrGLuint id,
    615                                                       GrGLenum pname,
    616                                                       GrGLint64 *params) {
    617     query_result(id, pname, params);
    618 }
    619 
    620 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectiv(GrGLuint id,
    621                                                     GrGLenum pname,
    622                                                     GrGLint *params) {
    623     query_result(id, pname, params);
    624 }
    625 
    626 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectui64v(GrGLuint id,
    627                                                        GrGLenum pname,
    628                                                        GrGLuint64 *params) {
    629     query_result(id, pname, params);
    630 }
    631 
    632 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectuiv(GrGLuint id,
    633                                                      GrGLenum pname,
    634                                                      GrGLuint *params) {
    635     query_result(id, pname, params);
    636 }
    637 
    638 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) {
    639     switch (name) {
    640         case GR_GL_EXTENSIONS:
    641             return combined_extensions_string();
    642         case GR_GL_VERSION:
    643             return (const GrGLubyte*)"4.0 Debug GL";
    644         case GR_GL_SHADING_LANGUAGE_VERSION:
    645             return (const GrGLubyte*)"4.20.8 Debug GLSL";
    646         case GR_GL_VENDOR:
    647             return (const GrGLubyte*)"Debug Vendor";
    648         case GR_GL_RENDERER:
    649             return (const GrGLubyte*)"The Debug (Non-)Renderer";
    650         default:
    651             SkFAIL("Unexpected name passed to GetString");
    652             return nullptr;
    653    }
    654 }
    655 
    656 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i) {
    657     switch (name) {
    658         case GR_GL_EXTENSIONS:
    659             if (static_cast<size_t>(i) <= SK_ARRAY_COUNT(kExtensions)) {
    660                 return (const GrGLubyte*) kExtensions[i];
    661             } else {
    662                 return nullptr;
    663             }
    664         default:
    665             SkFAIL("Unexpected name passed to GetStringi");
    666             return nullptr;
    667     }
    668 }
    669 
    670 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetTexLevelParameteriv(GrGLenum target,
    671                                                           GrGLint level,
    672                                                           GrGLenum pname,
    673                                                           GrGLint* params) {
    674     // we used to use this to query stuff about externally created textures,
    675     // now we just require clients to tell us everything about the texture.
    676     SkFAIL("Should never query texture parameters.");
    677 }
    678 
    679 GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const char* name) {
    680     static int gUniLocation = 0;
    681     return ++gUniLocation;
    682 }
    683 
    684 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLInsertEventMarker(GrGLsizei length, const char* marker) {
    685 }
    686 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPushGroupMarker(GrGLsizei length  , const char* marker) {
    687 }
    688 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPopGroupMarker() {
    689 }
    690