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