Home | History | Annotate | Download | only in src
      1 /*
      2  ** Copyright 2011, The Android Open Source Project
      3  **
      4  ** Licensed under the Apache License, Version 2.0 (the "License");
      5  ** you may not use this file except in compliance with the License.
      6  ** You may obtain a copy of the License at
      7  **
      8  **     http://www.apache.org/licenses/LICENSE-2.0
      9  **
     10  ** Unless required by applicable law or agreed to in writing, software
     11  ** distributed under the License is distributed on an "AS IS" BASIS,
     12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  ** See the License for the specific language governing permissions and
     14  ** limitations under the License.
     15  */
     16 
     17 // auto generated by generate_api_cpp.py
     18 
     19 #include <utils/Debug.h>
     20 
     21 #include "src/header.h"
     22 #include "src/api.h"
     23 
     24 template<typename T> static int ToInt(const T & t)
     25 {
     26     COMPILE_TIME_ASSERT_FUNCTION_SCOPE(sizeof(T) == sizeof(int));
     27     return (int &)t;
     28 }
     29 
     30 void Debug_glActiveTexture(GLenum texture)
     31 {
     32     glesv2debugger::Message msg;
     33     struct : public FunctionCall {
     34         GLenum texture;
     35 
     36         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
     37             _c->glActiveTexture(texture);
     38             return 0;
     39         }
     40     } caller;
     41     caller.texture = texture;
     42 
     43     msg.set_arg0(texture);
     44 
     45     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glActiveTexture);
     46 }
     47 
     48 void Debug_glAttachShader(GLuint program, GLuint shader)
     49 {
     50     glesv2debugger::Message msg;
     51     struct : public FunctionCall {
     52         GLuint program;
     53         GLuint shader;
     54 
     55         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
     56             _c->glAttachShader(program, shader);
     57             return 0;
     58         }
     59     } caller;
     60     caller.program = program;
     61     caller.shader = shader;
     62 
     63     msg.set_arg0(program);
     64     msg.set_arg1(shader);
     65 
     66     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glAttachShader);
     67 }
     68 
     69 void Debug_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
     70 {
     71     glesv2debugger::Message msg;
     72     struct : public FunctionCall {
     73         GLuint program;
     74         GLuint index;
     75         const GLchar* name;
     76 
     77         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
     78             _c->glBindAttribLocation(program, index, name);
     79             return 0;
     80         }
     81     } caller;
     82     caller.program = program;
     83     caller.index = index;
     84     caller.name = name;
     85 
     86     msg.set_arg0(program);
     87     msg.set_arg1(index);
     88     msg.set_arg2(ToInt(name));
     89 
     90     // FIXME: check for pointer usage
     91     msg.mutable_data()->assign(reinterpret_cast<const char *>(name), strlen(name) * sizeof(GLchar));
     92     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBindAttribLocation);
     93 }
     94 
     95 void Debug_glBindBuffer(GLenum target, GLuint buffer)
     96 {
     97     glesv2debugger::Message msg;
     98     struct : public FunctionCall {
     99         GLenum target;
    100         GLuint buffer;
    101 
    102         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    103             _c->glBindBuffer(target, buffer);
    104             getDbgContextThreadSpecific()->glBindBuffer(target, buffer);
    105             return 0;
    106         }
    107     } caller;
    108     caller.target = target;
    109     caller.buffer = buffer;
    110 
    111     msg.set_arg0(target);
    112     msg.set_arg1(buffer);
    113 
    114     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBindBuffer);
    115 }
    116 
    117 void Debug_glBindFramebuffer(GLenum target, GLuint framebuffer)
    118 {
    119     glesv2debugger::Message msg;
    120     struct : public FunctionCall {
    121         GLenum target;
    122         GLuint framebuffer;
    123 
    124         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    125             _c->glBindFramebuffer(target, framebuffer);
    126             return 0;
    127         }
    128     } caller;
    129     caller.target = target;
    130     caller.framebuffer = framebuffer;
    131 
    132     msg.set_arg0(target);
    133     msg.set_arg1(framebuffer);
    134 
    135     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBindFramebuffer);
    136 }
    137 
    138 void Debug_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
    139 {
    140     glesv2debugger::Message msg;
    141     struct : public FunctionCall {
    142         GLenum target;
    143         GLuint renderbuffer;
    144 
    145         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    146             _c->glBindRenderbuffer(target, renderbuffer);
    147             return 0;
    148         }
    149     } caller;
    150     caller.target = target;
    151     caller.renderbuffer = renderbuffer;
    152 
    153     msg.set_arg0(target);
    154     msg.set_arg1(renderbuffer);
    155 
    156     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBindRenderbuffer);
    157 }
    158 
    159 void Debug_glBindTexture(GLenum target, GLuint texture)
    160 {
    161     glesv2debugger::Message msg;
    162     struct : public FunctionCall {
    163         GLenum target;
    164         GLuint texture;
    165 
    166         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    167             _c->glBindTexture(target, texture);
    168             return 0;
    169         }
    170     } caller;
    171     caller.target = target;
    172     caller.texture = texture;
    173 
    174     msg.set_arg0(target);
    175     msg.set_arg1(texture);
    176 
    177     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBindTexture);
    178 }
    179 
    180 void Debug_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    181 {
    182     glesv2debugger::Message msg;
    183     struct : public FunctionCall {
    184         GLclampf red;
    185         GLclampf green;
    186         GLclampf blue;
    187         GLclampf alpha;
    188 
    189         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    190             _c->glBlendColor(red, green, blue, alpha);
    191             return 0;
    192         }
    193     } caller;
    194     caller.red = red;
    195     caller.green = green;
    196     caller.blue = blue;
    197     caller.alpha = alpha;
    198 
    199     msg.set_arg0(ToInt(red));
    200     msg.set_arg1(ToInt(green));
    201     msg.set_arg2(ToInt(blue));
    202     msg.set_arg3(ToInt(alpha));
    203 
    204     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBlendColor);
    205 }
    206 
    207 void Debug_glBlendEquation( GLenum mode )
    208 {
    209     glesv2debugger::Message msg;
    210     struct : public FunctionCall {
    211         GLenum mode;
    212 
    213         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    214             _c->glBlendEquation(mode);
    215             return 0;
    216         }
    217     } caller;
    218     caller.mode = mode;
    219 
    220     msg.set_arg0(mode);
    221 
    222     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBlendEquation);
    223 }
    224 
    225 void Debug_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
    226 {
    227     glesv2debugger::Message msg;
    228     struct : public FunctionCall {
    229         GLenum modeRGB;
    230         GLenum modeAlpha;
    231 
    232         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    233             _c->glBlendEquationSeparate(modeRGB, modeAlpha);
    234             return 0;
    235         }
    236     } caller;
    237     caller.modeRGB = modeRGB;
    238     caller.modeAlpha = modeAlpha;
    239 
    240     msg.set_arg0(modeRGB);
    241     msg.set_arg1(modeAlpha);
    242 
    243     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBlendEquationSeparate);
    244 }
    245 
    246 void Debug_glBlendFunc(GLenum sfactor, GLenum dfactor)
    247 {
    248     glesv2debugger::Message msg;
    249     struct : public FunctionCall {
    250         GLenum sfactor;
    251         GLenum dfactor;
    252 
    253         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    254             _c->glBlendFunc(sfactor, dfactor);
    255             return 0;
    256         }
    257     } caller;
    258     caller.sfactor = sfactor;
    259     caller.dfactor = dfactor;
    260 
    261     msg.set_arg0(sfactor);
    262     msg.set_arg1(dfactor);
    263 
    264     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBlendFunc);
    265 }
    266 
    267 void Debug_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
    268 {
    269     glesv2debugger::Message msg;
    270     struct : public FunctionCall {
    271         GLenum srcRGB;
    272         GLenum dstRGB;
    273         GLenum srcAlpha;
    274         GLenum dstAlpha;
    275 
    276         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    277             _c->glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    278             return 0;
    279         }
    280     } caller;
    281     caller.srcRGB = srcRGB;
    282     caller.dstRGB = dstRGB;
    283     caller.srcAlpha = srcAlpha;
    284     caller.dstAlpha = dstAlpha;
    285 
    286     msg.set_arg0(srcRGB);
    287     msg.set_arg1(dstRGB);
    288     msg.set_arg2(srcAlpha);
    289     msg.set_arg3(dstAlpha);
    290 
    291     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBlendFuncSeparate);
    292 }
    293 
    294 void Debug_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
    295 {
    296     glesv2debugger::Message msg;
    297     struct : public FunctionCall {
    298         GLenum target;
    299         GLsizeiptr size;
    300         const GLvoid* data;
    301         GLenum usage;
    302 
    303         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    304             _c->glBufferData(target, size, data, usage);
    305             getDbgContextThreadSpecific()->glBufferData(target, size, data, usage);
    306             return 0;
    307         }
    308     } caller;
    309     caller.target = target;
    310     caller.size = size;
    311     caller.data = data;
    312     caller.usage = usage;
    313 
    314     msg.set_arg0(target);
    315     msg.set_arg1(size);
    316     msg.set_arg2(ToInt(data));
    317     msg.set_arg3(usage);
    318 
    319     // FIXME: check for pointer usage
    320     msg.mutable_data()->assign(reinterpret_cast<const char *>(data), size * sizeof(char));
    321     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBufferData);
    322 }
    323 
    324 void Debug_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
    325 {
    326     glesv2debugger::Message msg;
    327     struct : public FunctionCall {
    328         GLenum target;
    329         GLintptr offset;
    330         GLsizeiptr size;
    331         const GLvoid* data;
    332 
    333         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    334             _c->glBufferSubData(target, offset, size, data);
    335             getDbgContextThreadSpecific()->glBufferSubData(target, offset, size, data);
    336             return 0;
    337         }
    338     } caller;
    339     caller.target = target;
    340     caller.offset = offset;
    341     caller.size = size;
    342     caller.data = data;
    343 
    344     msg.set_arg0(target);
    345     msg.set_arg1(offset);
    346     msg.set_arg2(size);
    347     msg.set_arg3(ToInt(data));
    348 
    349     // FIXME: check for pointer usage
    350     msg.mutable_data()->assign(reinterpret_cast<const char *>(data), size * sizeof(char));
    351     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glBufferSubData);
    352 }
    353 
    354 GLenum Debug_glCheckFramebufferStatus(GLenum target)
    355 {
    356     glesv2debugger::Message msg;
    357     struct : public FunctionCall {
    358         GLenum target;
    359 
    360         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    361             const int * ret = reinterpret_cast<const int *>(_c->glCheckFramebufferStatus(target));
    362             msg.set_ret(ToInt(ret));
    363             return ret;
    364         }
    365     } caller;
    366     caller.target = target;
    367 
    368     msg.set_arg0(target);
    369 
    370     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCheckFramebufferStatus);
    371     return reinterpret_cast<GLenum>(ret);
    372 }
    373 
    374 void Debug_glClear(GLbitfield mask)
    375 {
    376     glesv2debugger::Message msg;
    377     struct : public FunctionCall {
    378         GLbitfield mask;
    379 
    380         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    381             _c->glClear(mask);
    382             return 0;
    383         }
    384     } caller;
    385     caller.mask = mask;
    386 
    387     msg.set_arg0(mask);
    388 
    389     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glClear);
    390 }
    391 
    392 void Debug_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    393 {
    394     glesv2debugger::Message msg;
    395     struct : public FunctionCall {
    396         GLclampf red;
    397         GLclampf green;
    398         GLclampf blue;
    399         GLclampf alpha;
    400 
    401         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    402             _c->glClearColor(red, green, blue, alpha);
    403             return 0;
    404         }
    405     } caller;
    406     caller.red = red;
    407     caller.green = green;
    408     caller.blue = blue;
    409     caller.alpha = alpha;
    410 
    411     msg.set_arg0(ToInt(red));
    412     msg.set_arg1(ToInt(green));
    413     msg.set_arg2(ToInt(blue));
    414     msg.set_arg3(ToInt(alpha));
    415 
    416     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glClearColor);
    417 }
    418 
    419 void Debug_glClearDepthf(GLclampf depth)
    420 {
    421     glesv2debugger::Message msg;
    422     struct : public FunctionCall {
    423         GLclampf depth;
    424 
    425         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    426             _c->glClearDepthf(depth);
    427             return 0;
    428         }
    429     } caller;
    430     caller.depth = depth;
    431 
    432     msg.set_arg0(ToInt(depth));
    433 
    434     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glClearDepthf);
    435 }
    436 
    437 void Debug_glClearStencil(GLint s)
    438 {
    439     glesv2debugger::Message msg;
    440     struct : public FunctionCall {
    441         GLint s;
    442 
    443         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    444             _c->glClearStencil(s);
    445             return 0;
    446         }
    447     } caller;
    448     caller.s = s;
    449 
    450     msg.set_arg0(s);
    451 
    452     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glClearStencil);
    453 }
    454 
    455 void Debug_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
    456 {
    457     glesv2debugger::Message msg;
    458     struct : public FunctionCall {
    459         GLboolean red;
    460         GLboolean green;
    461         GLboolean blue;
    462         GLboolean alpha;
    463 
    464         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    465             _c->glColorMask(red, green, blue, alpha);
    466             return 0;
    467         }
    468     } caller;
    469     caller.red = red;
    470     caller.green = green;
    471     caller.blue = blue;
    472     caller.alpha = alpha;
    473 
    474     msg.set_arg0(red);
    475     msg.set_arg1(green);
    476     msg.set_arg2(blue);
    477     msg.set_arg3(alpha);
    478 
    479     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glColorMask);
    480 }
    481 
    482 void Debug_glCompileShader(GLuint shader)
    483 {
    484     glesv2debugger::Message msg;
    485     struct : public FunctionCall {
    486         GLuint shader;
    487 
    488         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    489             _c->glCompileShader(shader);
    490             return 0;
    491         }
    492     } caller;
    493     caller.shader = shader;
    494 
    495     msg.set_arg0(shader);
    496 
    497     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCompileShader);
    498 }
    499 
    500 // FIXME: this function has pointers, it should be hand written
    501 void Debug_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
    502 {
    503     glesv2debugger::Message msg;
    504     struct : public FunctionCall {
    505         GLenum target;
    506         GLint level;
    507         GLenum internalformat;
    508         GLsizei width;
    509         GLsizei height;
    510         GLint border;
    511         GLsizei imageSize;
    512         const GLvoid* data;
    513 
    514         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    515             _c->glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
    516             return 0;
    517         }
    518     } caller;
    519     caller.target = target;
    520     caller.level = level;
    521     caller.internalformat = internalformat;
    522     caller.width = width;
    523     caller.height = height;
    524     caller.border = border;
    525     caller.imageSize = imageSize;
    526     caller.data = data;
    527 
    528     msg.set_arg0(target);
    529     msg.set_arg1(level);
    530     msg.set_arg2(internalformat);
    531     msg.set_arg3(width);
    532     msg.set_arg4(height);
    533     msg.set_arg5(border);
    534     msg.set_arg6(imageSize);
    535     msg.set_arg7(ToInt(data));
    536 
    537     // FIXME: check for pointer usage
    538     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCompressedTexImage2D);
    539 }
    540 
    541 // FIXME: this function has pointers, it should be hand written
    542 void Debug_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
    543 {
    544     glesv2debugger::Message msg;
    545     struct : public FunctionCall {
    546         GLenum target;
    547         GLint level;
    548         GLint xoffset;
    549         GLint yoffset;
    550         GLsizei width;
    551         GLsizei height;
    552         GLenum format;
    553         GLsizei imageSize;
    554         const GLvoid* data;
    555 
    556         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    557             _c->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
    558             return 0;
    559         }
    560     } caller;
    561     caller.target = target;
    562     caller.level = level;
    563     caller.xoffset = xoffset;
    564     caller.yoffset = yoffset;
    565     caller.width = width;
    566     caller.height = height;
    567     caller.format = format;
    568     caller.imageSize = imageSize;
    569     caller.data = data;
    570 
    571     msg.set_arg0(target);
    572     msg.set_arg1(level);
    573     msg.set_arg2(xoffset);
    574     msg.set_arg3(yoffset);
    575     msg.set_arg4(width);
    576     msg.set_arg5(height);
    577     msg.set_arg6(format);
    578     msg.set_arg7(imageSize);
    579     msg.set_arg8(ToInt(data));
    580 
    581     // FIXME: check for pointer usage
    582     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCompressedTexSubImage2D);
    583 }
    584 
    585 void Debug_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
    586 {
    587     glesv2debugger::Message msg;
    588     struct : public FunctionCall {
    589         GLenum target;
    590         GLint level;
    591         GLenum internalformat;
    592         GLint x;
    593         GLint y;
    594         GLsizei width;
    595         GLsizei height;
    596         GLint border;
    597 
    598         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    599             _c->glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
    600 #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexImage2D
    601             EXTEND_AFTER_CALL_Debug_glCopyTexImage2D;
    602 #endif
    603             return 0;
    604         }
    605     } caller;
    606     caller.target = target;
    607     caller.level = level;
    608     caller.internalformat = internalformat;
    609     caller.x = x;
    610     caller.y = y;
    611     caller.width = width;
    612     caller.height = height;
    613     caller.border = border;
    614 
    615     msg.set_arg0(target);
    616     msg.set_arg1(level);
    617     msg.set_arg2(internalformat);
    618     msg.set_arg3(x);
    619     msg.set_arg4(y);
    620     msg.set_arg5(width);
    621     msg.set_arg6(height);
    622     msg.set_arg7(border);
    623 
    624 #ifdef EXTEND_Debug_glCopyTexImage2D
    625     EXTEND_Debug_glCopyTexImage2D;
    626 #endif
    627     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexImage2D);
    628 }
    629 
    630 void Debug_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
    631 {
    632     glesv2debugger::Message msg;
    633     struct : public FunctionCall {
    634         GLenum target;
    635         GLint level;
    636         GLint xoffset;
    637         GLint yoffset;
    638         GLint x;
    639         GLint y;
    640         GLsizei width;
    641         GLsizei height;
    642 
    643         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    644             _c->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
    645 #ifdef EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D
    646             EXTEND_AFTER_CALL_Debug_glCopyTexSubImage2D;
    647 #endif
    648             return 0;
    649         }
    650     } caller;
    651     caller.target = target;
    652     caller.level = level;
    653     caller.xoffset = xoffset;
    654     caller.yoffset = yoffset;
    655     caller.x = x;
    656     caller.y = y;
    657     caller.width = width;
    658     caller.height = height;
    659 
    660     msg.set_arg0(target);
    661     msg.set_arg1(level);
    662     msg.set_arg2(xoffset);
    663     msg.set_arg3(yoffset);
    664     msg.set_arg4(x);
    665     msg.set_arg5(y);
    666     msg.set_arg6(width);
    667     msg.set_arg7(height);
    668 
    669 #ifdef EXTEND_Debug_glCopyTexSubImage2D
    670     EXTEND_Debug_glCopyTexSubImage2D;
    671 #endif
    672     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCopyTexSubImage2D);
    673 }
    674 
    675 GLuint Debug_glCreateProgram(void)
    676 {
    677     glesv2debugger::Message msg;
    678     struct : public FunctionCall {
    679 
    680         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    681             const int * ret = reinterpret_cast<const int *>(_c->glCreateProgram());
    682             msg.set_ret(ToInt(ret));
    683             return ret;
    684         }
    685     } caller;
    686 
    687 
    688     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCreateProgram);
    689     return reinterpret_cast<GLuint>(ret);
    690 }
    691 
    692 GLuint Debug_glCreateShader(GLenum type)
    693 {
    694     glesv2debugger::Message msg;
    695     struct : public FunctionCall {
    696         GLenum type;
    697 
    698         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    699             const int * ret = reinterpret_cast<const int *>(_c->glCreateShader(type));
    700             msg.set_ret(ToInt(ret));
    701             return ret;
    702         }
    703     } caller;
    704     caller.type = type;
    705 
    706     msg.set_arg0(type);
    707 
    708     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCreateShader);
    709     return reinterpret_cast<GLuint>(ret);
    710 }
    711 
    712 void Debug_glCullFace(GLenum mode)
    713 {
    714     glesv2debugger::Message msg;
    715     struct : public FunctionCall {
    716         GLenum mode;
    717 
    718         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    719             _c->glCullFace(mode);
    720             return 0;
    721         }
    722     } caller;
    723     caller.mode = mode;
    724 
    725     msg.set_arg0(mode);
    726 
    727     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glCullFace);
    728 }
    729 
    730 void Debug_glDeleteBuffers(GLsizei n, const GLuint* buffers)
    731 {
    732     glesv2debugger::Message msg;
    733     struct : public FunctionCall {
    734         GLsizei n;
    735         const GLuint* buffers;
    736 
    737         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    738             _c->glDeleteBuffers(n, buffers);
    739             getDbgContextThreadSpecific()->glDeleteBuffers(n, buffers);
    740             return 0;
    741         }
    742     } caller;
    743     caller.n = n;
    744     caller.buffers = buffers;
    745 
    746     msg.set_arg0(n);
    747     msg.set_arg1(ToInt(buffers));
    748 
    749     // FIXME: check for pointer usage
    750     msg.mutable_data()->assign(reinterpret_cast<const char *>(buffers), n * sizeof(GLuint));
    751     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteBuffers);
    752 }
    753 
    754 void Debug_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
    755 {
    756     glesv2debugger::Message msg;
    757     struct : public FunctionCall {
    758         GLsizei n;
    759         const GLuint* framebuffers;
    760 
    761         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    762             _c->glDeleteFramebuffers(n, framebuffers);
    763             return 0;
    764         }
    765     } caller;
    766     caller.n = n;
    767     caller.framebuffers = framebuffers;
    768 
    769     msg.set_arg0(n);
    770     msg.set_arg1(ToInt(framebuffers));
    771 
    772     // FIXME: check for pointer usage
    773     msg.mutable_data()->assign(reinterpret_cast<const char *>(framebuffers), n * sizeof(GLuint));
    774     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteFramebuffers);
    775 }
    776 
    777 void Debug_glDeleteProgram(GLuint program)
    778 {
    779     glesv2debugger::Message msg;
    780     struct : public FunctionCall {
    781         GLuint program;
    782 
    783         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    784             _c->glDeleteProgram(program);
    785             return 0;
    786         }
    787     } caller;
    788     caller.program = program;
    789 
    790     msg.set_arg0(program);
    791 
    792     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteProgram);
    793 }
    794 
    795 void Debug_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
    796 {
    797     glesv2debugger::Message msg;
    798     struct : public FunctionCall {
    799         GLsizei n;
    800         const GLuint* renderbuffers;
    801 
    802         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    803             _c->glDeleteRenderbuffers(n, renderbuffers);
    804             return 0;
    805         }
    806     } caller;
    807     caller.n = n;
    808     caller.renderbuffers = renderbuffers;
    809 
    810     msg.set_arg0(n);
    811     msg.set_arg1(ToInt(renderbuffers));
    812 
    813     // FIXME: check for pointer usage
    814     msg.mutable_data()->assign(reinterpret_cast<const char *>(renderbuffers), n * sizeof(GLuint));
    815     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteRenderbuffers);
    816 }
    817 
    818 void Debug_glDeleteShader(GLuint shader)
    819 {
    820     glesv2debugger::Message msg;
    821     struct : public FunctionCall {
    822         GLuint shader;
    823 
    824         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    825             _c->glDeleteShader(shader);
    826             return 0;
    827         }
    828     } caller;
    829     caller.shader = shader;
    830 
    831     msg.set_arg0(shader);
    832 
    833     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteShader);
    834 }
    835 
    836 void Debug_glDeleteTextures(GLsizei n, const GLuint* textures)
    837 {
    838     glesv2debugger::Message msg;
    839     struct : public FunctionCall {
    840         GLsizei n;
    841         const GLuint* textures;
    842 
    843         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    844             _c->glDeleteTextures(n, textures);
    845             return 0;
    846         }
    847     } caller;
    848     caller.n = n;
    849     caller.textures = textures;
    850 
    851     msg.set_arg0(n);
    852     msg.set_arg1(ToInt(textures));
    853 
    854     // FIXME: check for pointer usage
    855     msg.mutable_data()->assign(reinterpret_cast<const char *>(textures), n * sizeof(GLuint));
    856     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDeleteTextures);
    857 }
    858 
    859 void Debug_glDepthFunc(GLenum func)
    860 {
    861     glesv2debugger::Message msg;
    862     struct : public FunctionCall {
    863         GLenum func;
    864 
    865         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    866             _c->glDepthFunc(func);
    867             return 0;
    868         }
    869     } caller;
    870     caller.func = func;
    871 
    872     msg.set_arg0(func);
    873 
    874     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDepthFunc);
    875 }
    876 
    877 void Debug_glDepthMask(GLboolean flag)
    878 {
    879     glesv2debugger::Message msg;
    880     struct : public FunctionCall {
    881         GLboolean flag;
    882 
    883         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    884             _c->glDepthMask(flag);
    885             return 0;
    886         }
    887     } caller;
    888     caller.flag = flag;
    889 
    890     msg.set_arg0(flag);
    891 
    892     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDepthMask);
    893 }
    894 
    895 void Debug_glDepthRangef(GLclampf zNear, GLclampf zFar)
    896 {
    897     glesv2debugger::Message msg;
    898     struct : public FunctionCall {
    899         GLclampf zNear;
    900         GLclampf zFar;
    901 
    902         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    903             _c->glDepthRangef(zNear, zFar);
    904             return 0;
    905         }
    906     } caller;
    907     caller.zNear = zNear;
    908     caller.zFar = zFar;
    909 
    910     msg.set_arg0(ToInt(zNear));
    911     msg.set_arg1(ToInt(zFar));
    912 
    913     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDepthRangef);
    914 }
    915 
    916 void Debug_glDetachShader(GLuint program, GLuint shader)
    917 {
    918     glesv2debugger::Message msg;
    919     struct : public FunctionCall {
    920         GLuint program;
    921         GLuint shader;
    922 
    923         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    924             _c->glDetachShader(program, shader);
    925             return 0;
    926         }
    927     } caller;
    928     caller.program = program;
    929     caller.shader = shader;
    930 
    931     msg.set_arg0(program);
    932     msg.set_arg1(shader);
    933 
    934     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDetachShader);
    935 }
    936 
    937 void Debug_glDisable(GLenum cap)
    938 {
    939     glesv2debugger::Message msg;
    940     struct : public FunctionCall {
    941         GLenum cap;
    942 
    943         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    944             _c->glDisable(cap);
    945             return 0;
    946         }
    947     } caller;
    948     caller.cap = cap;
    949 
    950     msg.set_arg0(cap);
    951 
    952     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDisable);
    953 }
    954 
    955 void Debug_glDisableVertexAttribArray(GLuint index)
    956 {
    957     glesv2debugger::Message msg;
    958     struct : public FunctionCall {
    959         GLuint index;
    960 
    961         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    962             _c->glDisableVertexAttribArray(index);
    963             getDbgContextThreadSpecific()->glDisableVertexAttribArray(index);
    964             return 0;
    965         }
    966     } caller;
    967     caller.index = index;
    968 
    969     msg.set_arg0(index);
    970 
    971     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glDisableVertexAttribArray);
    972 }
    973 
    974 void Debug_glEnable(GLenum cap)
    975 {
    976     glesv2debugger::Message msg;
    977     struct : public FunctionCall {
    978         GLenum cap;
    979 
    980         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    981             _c->glEnable(cap);
    982             return 0;
    983         }
    984     } caller;
    985     caller.cap = cap;
    986 
    987     msg.set_arg0(cap);
    988 
    989     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glEnable);
    990 }
    991 
    992 void Debug_glEnableVertexAttribArray(GLuint index)
    993 {
    994     glesv2debugger::Message msg;
    995     struct : public FunctionCall {
    996         GLuint index;
    997 
    998         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
    999             _c->glEnableVertexAttribArray(index);
   1000             getDbgContextThreadSpecific()->glEnableVertexAttribArray(index);
   1001             return 0;
   1002         }
   1003     } caller;
   1004     caller.index = index;
   1005 
   1006     msg.set_arg0(index);
   1007 
   1008     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glEnableVertexAttribArray);
   1009 }
   1010 
   1011 void Debug_glFinish(void)
   1012 {
   1013     glesv2debugger::Message msg;
   1014     struct : public FunctionCall {
   1015 
   1016         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1017             _c->glFinish();
   1018             return 0;
   1019         }
   1020     } caller;
   1021 
   1022 
   1023     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glFinish);
   1024 }
   1025 
   1026 void Debug_glFlush(void)
   1027 {
   1028     glesv2debugger::Message msg;
   1029     struct : public FunctionCall {
   1030 
   1031         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1032             _c->glFlush();
   1033             return 0;
   1034         }
   1035     } caller;
   1036 
   1037 
   1038     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glFlush);
   1039 }
   1040 
   1041 void Debug_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
   1042 {
   1043     glesv2debugger::Message msg;
   1044     struct : public FunctionCall {
   1045         GLenum target;
   1046         GLenum attachment;
   1047         GLenum renderbuffertarget;
   1048         GLuint renderbuffer;
   1049 
   1050         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1051             _c->glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
   1052             return 0;
   1053         }
   1054     } caller;
   1055     caller.target = target;
   1056     caller.attachment = attachment;
   1057     caller.renderbuffertarget = renderbuffertarget;
   1058     caller.renderbuffer = renderbuffer;
   1059 
   1060     msg.set_arg0(target);
   1061     msg.set_arg1(attachment);
   1062     msg.set_arg2(renderbuffertarget);
   1063     msg.set_arg3(renderbuffer);
   1064 
   1065     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glFramebufferRenderbuffer);
   1066 }
   1067 
   1068 void Debug_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
   1069 {
   1070     glesv2debugger::Message msg;
   1071     struct : public FunctionCall {
   1072         GLenum target;
   1073         GLenum attachment;
   1074         GLenum textarget;
   1075         GLuint texture;
   1076         GLint level;
   1077 
   1078         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1079             _c->glFramebufferTexture2D(target, attachment, textarget, texture, level);
   1080             return 0;
   1081         }
   1082     } caller;
   1083     caller.target = target;
   1084     caller.attachment = attachment;
   1085     caller.textarget = textarget;
   1086     caller.texture = texture;
   1087     caller.level = level;
   1088 
   1089     msg.set_arg0(target);
   1090     msg.set_arg1(attachment);
   1091     msg.set_arg2(textarget);
   1092     msg.set_arg3(texture);
   1093     msg.set_arg4(level);
   1094 
   1095     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glFramebufferTexture2D);
   1096 }
   1097 
   1098 void Debug_glFrontFace(GLenum mode)
   1099 {
   1100     glesv2debugger::Message msg;
   1101     struct : public FunctionCall {
   1102         GLenum mode;
   1103 
   1104         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1105             _c->glFrontFace(mode);
   1106             return 0;
   1107         }
   1108     } caller;
   1109     caller.mode = mode;
   1110 
   1111     msg.set_arg0(mode);
   1112 
   1113     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glFrontFace);
   1114 }
   1115 
   1116 void Debug_glGenBuffers(GLsizei n, GLuint* buffers)
   1117 {
   1118     glesv2debugger::Message msg;
   1119     struct : public FunctionCall {
   1120         GLsizei n;
   1121         GLuint* buffers;
   1122 
   1123         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1124             nsecs_t c0 = systemTime(timeMode);
   1125             _c->glGenBuffers(n, buffers);
   1126             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1127             msg.mutable_data()->assign(reinterpret_cast<const char *>(buffers), n * sizeof(GLuint));
   1128             return 0;
   1129         }
   1130     } caller;
   1131     caller.n = n;
   1132     caller.buffers = buffers;
   1133 
   1134     msg.set_arg0(n);
   1135     msg.set_arg1(ToInt(buffers));
   1136 
   1137     // FIXME: check for pointer usage
   1138     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGenBuffers);
   1139 }
   1140 
   1141 void Debug_glGenerateMipmap(GLenum target)
   1142 {
   1143     glesv2debugger::Message msg;
   1144     struct : public FunctionCall {
   1145         GLenum target;
   1146 
   1147         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1148             _c->glGenerateMipmap(target);
   1149             return 0;
   1150         }
   1151     } caller;
   1152     caller.target = target;
   1153 
   1154     msg.set_arg0(target);
   1155 
   1156     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGenerateMipmap);
   1157 }
   1158 
   1159 void Debug_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
   1160 {
   1161     glesv2debugger::Message msg;
   1162     struct : public FunctionCall {
   1163         GLsizei n;
   1164         GLuint* framebuffers;
   1165 
   1166         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1167             nsecs_t c0 = systemTime(timeMode);
   1168             _c->glGenFramebuffers(n, framebuffers);
   1169             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1170             msg.mutable_data()->assign(reinterpret_cast<const char *>(framebuffers), n * sizeof(GLuint));
   1171             return 0;
   1172         }
   1173     } caller;
   1174     caller.n = n;
   1175     caller.framebuffers = framebuffers;
   1176 
   1177     msg.set_arg0(n);
   1178     msg.set_arg1(ToInt(framebuffers));
   1179 
   1180     // FIXME: check for pointer usage
   1181     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGenFramebuffers);
   1182 }
   1183 
   1184 void Debug_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
   1185 {
   1186     glesv2debugger::Message msg;
   1187     struct : public FunctionCall {
   1188         GLsizei n;
   1189         GLuint* renderbuffers;
   1190 
   1191         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1192             nsecs_t c0 = systemTime(timeMode);
   1193             _c->glGenRenderbuffers(n, renderbuffers);
   1194             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1195             msg.mutable_data()->assign(reinterpret_cast<const char *>(renderbuffers), n * sizeof(GLuint));
   1196             return 0;
   1197         }
   1198     } caller;
   1199     caller.n = n;
   1200     caller.renderbuffers = renderbuffers;
   1201 
   1202     msg.set_arg0(n);
   1203     msg.set_arg1(ToInt(renderbuffers));
   1204 
   1205     // FIXME: check for pointer usage
   1206     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGenRenderbuffers);
   1207 }
   1208 
   1209 void Debug_glGenTextures(GLsizei n, GLuint* textures)
   1210 {
   1211     glesv2debugger::Message msg;
   1212     struct : public FunctionCall {
   1213         GLsizei n;
   1214         GLuint* textures;
   1215 
   1216         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1217             nsecs_t c0 = systemTime(timeMode);
   1218             _c->glGenTextures(n, textures);
   1219             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1220             msg.mutable_data()->assign(reinterpret_cast<const char *>(textures), n * sizeof(GLuint));
   1221             return 0;
   1222         }
   1223     } caller;
   1224     caller.n = n;
   1225     caller.textures = textures;
   1226 
   1227     msg.set_arg0(n);
   1228     msg.set_arg1(ToInt(textures));
   1229 
   1230     // FIXME: check for pointer usage
   1231     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGenTextures);
   1232 }
   1233 
   1234 // FIXME: this function has pointers, it should be hand written
   1235 void Debug_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
   1236 {
   1237     glesv2debugger::Message msg;
   1238     struct : public FunctionCall {
   1239         GLuint program;
   1240         GLuint index;
   1241         GLsizei bufsize;
   1242         GLsizei* length;
   1243         GLint* size;
   1244         GLenum* type;
   1245         GLchar* name;
   1246 
   1247         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1248             _c->glGetActiveAttrib(program, index, bufsize, length, size, type, name);
   1249             return 0;
   1250         }
   1251     } caller;
   1252     caller.program = program;
   1253     caller.index = index;
   1254     caller.bufsize = bufsize;
   1255     caller.length = length;
   1256     caller.size = size;
   1257     caller.type = type;
   1258     caller.name = name;
   1259 
   1260     msg.set_arg0(program);
   1261     msg.set_arg1(index);
   1262     msg.set_arg2(bufsize);
   1263     msg.set_arg3(ToInt(length));
   1264     msg.set_arg4(ToInt(size));
   1265     msg.set_arg5(ToInt(type));
   1266     msg.set_arg6(ToInt(name));
   1267 
   1268     // FIXME: check for pointer usage
   1269     msg.mutable_data()->assign(reinterpret_cast<const char *>(name), strlen(name) * sizeof(GLchar));
   1270     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetActiveAttrib);
   1271 }
   1272 
   1273 // FIXME: this function has pointers, it should be hand written
   1274 void Debug_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
   1275 {
   1276     glesv2debugger::Message msg;
   1277     struct : public FunctionCall {
   1278         GLuint program;
   1279         GLuint index;
   1280         GLsizei bufsize;
   1281         GLsizei* length;
   1282         GLint* size;
   1283         GLenum* type;
   1284         GLchar* name;
   1285 
   1286         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1287             _c->glGetActiveUniform(program, index, bufsize, length, size, type, name);
   1288             return 0;
   1289         }
   1290     } caller;
   1291     caller.program = program;
   1292     caller.index = index;
   1293     caller.bufsize = bufsize;
   1294     caller.length = length;
   1295     caller.size = size;
   1296     caller.type = type;
   1297     caller.name = name;
   1298 
   1299     msg.set_arg0(program);
   1300     msg.set_arg1(index);
   1301     msg.set_arg2(bufsize);
   1302     msg.set_arg3(ToInt(length));
   1303     msg.set_arg4(ToInt(size));
   1304     msg.set_arg5(ToInt(type));
   1305     msg.set_arg6(ToInt(name));
   1306 
   1307     // FIXME: check for pointer usage
   1308     msg.mutable_data()->assign(reinterpret_cast<const char *>(name), strlen(name) * sizeof(GLchar));
   1309     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetActiveUniform);
   1310 }
   1311 
   1312 // FIXME: this function has pointers, it should be hand written
   1313 void Debug_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
   1314 {
   1315     glesv2debugger::Message msg;
   1316     struct : public FunctionCall {
   1317         GLuint program;
   1318         GLsizei maxcount;
   1319         GLsizei* count;
   1320         GLuint* shaders;
   1321 
   1322         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1323             _c->glGetAttachedShaders(program, maxcount, count, shaders);
   1324             return 0;
   1325         }
   1326     } caller;
   1327     caller.program = program;
   1328     caller.maxcount = maxcount;
   1329     caller.count = count;
   1330     caller.shaders = shaders;
   1331 
   1332     msg.set_arg0(program);
   1333     msg.set_arg1(maxcount);
   1334     msg.set_arg2(ToInt(count));
   1335     msg.set_arg3(ToInt(shaders));
   1336 
   1337     // FIXME: check for pointer usage
   1338     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetAttachedShaders);
   1339 }
   1340 
   1341 int Debug_glGetAttribLocation(GLuint program, const GLchar* name)
   1342 {
   1343     glesv2debugger::Message msg;
   1344     struct : public FunctionCall {
   1345         GLuint program;
   1346         const GLchar* name;
   1347 
   1348         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1349             const int * ret = reinterpret_cast<const int *>(_c->glGetAttribLocation(program, name));
   1350             msg.set_ret(ToInt(ret));
   1351             return ret;
   1352         }
   1353     } caller;
   1354     caller.program = program;
   1355     caller.name = name;
   1356 
   1357     msg.set_arg0(program);
   1358     msg.set_arg1(ToInt(name));
   1359 
   1360     // FIXME: check for pointer usage
   1361     msg.mutable_data()->assign(reinterpret_cast<const char *>(name), strlen(name) * sizeof(GLchar));
   1362     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetAttribLocation);
   1363     return reinterpret_cast<int>(ret);
   1364 }
   1365 
   1366 // FIXME: this function has pointers, it should be hand written
   1367 void Debug_glGetBooleanv(GLenum pname, GLboolean* params)
   1368 {
   1369     glesv2debugger::Message msg;
   1370     struct : public FunctionCall {
   1371         GLenum pname;
   1372         GLboolean* params;
   1373 
   1374         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1375             _c->glGetBooleanv(pname, params);
   1376             return 0;
   1377         }
   1378     } caller;
   1379     caller.pname = pname;
   1380     caller.params = params;
   1381 
   1382     msg.set_arg0(pname);
   1383     msg.set_arg1(ToInt(params));
   1384 
   1385     // FIXME: check for pointer usage
   1386     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetBooleanv);
   1387 }
   1388 
   1389 // FIXME: this function has pointers, it should be hand written
   1390 void Debug_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
   1391 {
   1392     glesv2debugger::Message msg;
   1393     struct : public FunctionCall {
   1394         GLenum target;
   1395         GLenum pname;
   1396         GLint* params;
   1397 
   1398         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1399             _c->glGetBufferParameteriv(target, pname, params);
   1400             return 0;
   1401         }
   1402     } caller;
   1403     caller.target = target;
   1404     caller.pname = pname;
   1405     caller.params = params;
   1406 
   1407     msg.set_arg0(target);
   1408     msg.set_arg1(pname);
   1409     msg.set_arg2(ToInt(params));
   1410 
   1411     // FIXME: check for pointer usage
   1412     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetBufferParameteriv);
   1413 }
   1414 
   1415 GLenum Debug_glGetError(void)
   1416 {
   1417     glesv2debugger::Message msg;
   1418     struct : public FunctionCall {
   1419 
   1420         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1421             const int * ret = reinterpret_cast<const int *>(_c->glGetError());
   1422             msg.set_ret(ToInt(ret));
   1423             return ret;
   1424         }
   1425     } caller;
   1426 
   1427 
   1428     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetError);
   1429     return reinterpret_cast<GLenum>(ret);
   1430 }
   1431 
   1432 // FIXME: this function has pointers, it should be hand written
   1433 void Debug_glGetFloatv(GLenum pname, GLfloat* params)
   1434 {
   1435     glesv2debugger::Message msg;
   1436     struct : public FunctionCall {
   1437         GLenum pname;
   1438         GLfloat* params;
   1439 
   1440         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1441             _c->glGetFloatv(pname, params);
   1442             return 0;
   1443         }
   1444     } caller;
   1445     caller.pname = pname;
   1446     caller.params = params;
   1447 
   1448     msg.set_arg0(pname);
   1449     msg.set_arg1(ToInt(params));
   1450 
   1451     // FIXME: check for pointer usage
   1452     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetFloatv);
   1453 }
   1454 
   1455 // FIXME: this function has pointers, it should be hand written
   1456 void Debug_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
   1457 {
   1458     glesv2debugger::Message msg;
   1459     struct : public FunctionCall {
   1460         GLenum target;
   1461         GLenum attachment;
   1462         GLenum pname;
   1463         GLint* params;
   1464 
   1465         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1466             _c->glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
   1467             return 0;
   1468         }
   1469     } caller;
   1470     caller.target = target;
   1471     caller.attachment = attachment;
   1472     caller.pname = pname;
   1473     caller.params = params;
   1474 
   1475     msg.set_arg0(target);
   1476     msg.set_arg1(attachment);
   1477     msg.set_arg2(pname);
   1478     msg.set_arg3(ToInt(params));
   1479 
   1480     // FIXME: check for pointer usage
   1481     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetFramebufferAttachmentParameteriv);
   1482 }
   1483 
   1484 // FIXME: this function has pointers, it should be hand written
   1485 void Debug_glGetIntegerv(GLenum pname, GLint* params)
   1486 {
   1487     glesv2debugger::Message msg;
   1488     struct : public FunctionCall {
   1489         GLenum pname;
   1490         GLint* params;
   1491 
   1492         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1493             _c->glGetIntegerv(pname, params);
   1494             return 0;
   1495         }
   1496     } caller;
   1497     caller.pname = pname;
   1498     caller.params = params;
   1499 
   1500     msg.set_arg0(pname);
   1501     msg.set_arg1(ToInt(params));
   1502 
   1503     // FIXME: check for pointer usage
   1504     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetIntegerv);
   1505 }
   1506 
   1507 void Debug_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
   1508 {
   1509     glesv2debugger::Message msg;
   1510     struct : public FunctionCall {
   1511         GLuint program;
   1512         GLenum pname;
   1513         GLint* params;
   1514 
   1515         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1516             nsecs_t c0 = systemTime(timeMode);
   1517             _c->glGetProgramiv(program, pname, params);
   1518             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1519             msg.mutable_data()->assign(reinterpret_cast<const char *>(params), 1 * sizeof(GLint));
   1520             return 0;
   1521         }
   1522     } caller;
   1523     caller.program = program;
   1524     caller.pname = pname;
   1525     caller.params = params;
   1526 
   1527     msg.set_arg0(program);
   1528     msg.set_arg1(pname);
   1529     msg.set_arg2(ToInt(params));
   1530 
   1531     // FIXME: check for pointer usage
   1532     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetProgramiv);
   1533 }
   1534 
   1535 // FIXME: this function has pointers, it should be hand written
   1536 void Debug_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
   1537 {
   1538     glesv2debugger::Message msg;
   1539     struct : public FunctionCall {
   1540         GLuint program;
   1541         GLsizei bufsize;
   1542         GLsizei* length;
   1543         GLchar* infolog;
   1544 
   1545         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1546             nsecs_t c0 = systemTime(timeMode);
   1547             _c->glGetProgramInfoLog(program, bufsize, length, infolog);
   1548             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1549             msg.mutable_data()->assign(reinterpret_cast<const char *>(infolog), strlen(infolog) * sizeof(GLchar));
   1550             return 0;
   1551         }
   1552     } caller;
   1553     caller.program = program;
   1554     caller.bufsize = bufsize;
   1555     caller.length = length;
   1556     caller.infolog = infolog;
   1557 
   1558     msg.set_arg0(program);
   1559     msg.set_arg1(bufsize);
   1560     msg.set_arg2(ToInt(length));
   1561     msg.set_arg3(ToInt(infolog));
   1562 
   1563     // FIXME: check for pointer usage
   1564     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetProgramInfoLog);
   1565 }
   1566 
   1567 // FIXME: this function has pointers, it should be hand written
   1568 void Debug_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
   1569 {
   1570     glesv2debugger::Message msg;
   1571     struct : public FunctionCall {
   1572         GLenum target;
   1573         GLenum pname;
   1574         GLint* params;
   1575 
   1576         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1577             _c->glGetRenderbufferParameteriv(target, pname, params);
   1578             return 0;
   1579         }
   1580     } caller;
   1581     caller.target = target;
   1582     caller.pname = pname;
   1583     caller.params = params;
   1584 
   1585     msg.set_arg0(target);
   1586     msg.set_arg1(pname);
   1587     msg.set_arg2(ToInt(params));
   1588 
   1589     // FIXME: check for pointer usage
   1590     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetRenderbufferParameteriv);
   1591 }
   1592 
   1593 void Debug_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
   1594 {
   1595     glesv2debugger::Message msg;
   1596     struct : public FunctionCall {
   1597         GLuint shader;
   1598         GLenum pname;
   1599         GLint* params;
   1600 
   1601         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1602             nsecs_t c0 = systemTime(timeMode);
   1603             _c->glGetShaderiv(shader, pname, params);
   1604             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1605             msg.mutable_data()->assign(reinterpret_cast<const char *>(params), 1 * sizeof(GLint));
   1606             return 0;
   1607         }
   1608     } caller;
   1609     caller.shader = shader;
   1610     caller.pname = pname;
   1611     caller.params = params;
   1612 
   1613     msg.set_arg0(shader);
   1614     msg.set_arg1(pname);
   1615     msg.set_arg2(ToInt(params));
   1616 
   1617     // FIXME: check for pointer usage
   1618     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetShaderiv);
   1619 }
   1620 
   1621 // FIXME: this function has pointers, it should be hand written
   1622 void Debug_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
   1623 {
   1624     glesv2debugger::Message msg;
   1625     struct : public FunctionCall {
   1626         GLuint shader;
   1627         GLsizei bufsize;
   1628         GLsizei* length;
   1629         GLchar* infolog;
   1630 
   1631         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1632             nsecs_t c0 = systemTime(timeMode);
   1633             _c->glGetShaderInfoLog(shader, bufsize, length, infolog);
   1634             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1635             msg.mutable_data()->assign(reinterpret_cast<const char *>(infolog), strlen(infolog) * sizeof(GLchar));
   1636             return 0;
   1637         }
   1638     } caller;
   1639     caller.shader = shader;
   1640     caller.bufsize = bufsize;
   1641     caller.length = length;
   1642     caller.infolog = infolog;
   1643 
   1644     msg.set_arg0(shader);
   1645     msg.set_arg1(bufsize);
   1646     msg.set_arg2(ToInt(length));
   1647     msg.set_arg3(ToInt(infolog));
   1648 
   1649     // FIXME: check for pointer usage
   1650     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetShaderInfoLog);
   1651 }
   1652 
   1653 // FIXME: this function has pointers, it should be hand written
   1654 void Debug_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
   1655 {
   1656     glesv2debugger::Message msg;
   1657     struct : public FunctionCall {
   1658         GLenum shadertype;
   1659         GLenum precisiontype;
   1660         GLint* range;
   1661         GLint* precision;
   1662 
   1663         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1664             _c->glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
   1665             return 0;
   1666         }
   1667     } caller;
   1668     caller.shadertype = shadertype;
   1669     caller.precisiontype = precisiontype;
   1670     caller.range = range;
   1671     caller.precision = precision;
   1672 
   1673     msg.set_arg0(shadertype);
   1674     msg.set_arg1(precisiontype);
   1675     msg.set_arg2(ToInt(range));
   1676     msg.set_arg3(ToInt(precision));
   1677 
   1678     // FIXME: check for pointer usage
   1679     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetShaderPrecisionFormat);
   1680 }
   1681 
   1682 // FIXME: this function has pointers, it should be hand written
   1683 void Debug_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
   1684 {
   1685     glesv2debugger::Message msg;
   1686     struct : public FunctionCall {
   1687         GLuint shader;
   1688         GLsizei bufsize;
   1689         GLsizei* length;
   1690         GLchar* source;
   1691 
   1692         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1693             nsecs_t c0 = systemTime(timeMode);
   1694             _c->glGetShaderSource(shader, bufsize, length, source);
   1695             msg.set_time((systemTime(timeMode) - c0) * 1e-6f);
   1696             msg.mutable_data()->assign(reinterpret_cast<const char *>(source), strlen(source) * sizeof(GLchar));
   1697             return 0;
   1698         }
   1699     } caller;
   1700     caller.shader = shader;
   1701     caller.bufsize = bufsize;
   1702     caller.length = length;
   1703     caller.source = source;
   1704 
   1705     msg.set_arg0(shader);
   1706     msg.set_arg1(bufsize);
   1707     msg.set_arg2(ToInt(length));
   1708     msg.set_arg3(ToInt(source));
   1709 
   1710     // FIXME: check for pointer usage
   1711     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetShaderSource);
   1712 }
   1713 
   1714 // FIXME: this function has pointers, it should be hand written
   1715 const GLubyte* Debug_glGetString(GLenum name)
   1716 {
   1717     glesv2debugger::Message msg;
   1718     struct : public FunctionCall {
   1719         GLenum name;
   1720 
   1721         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1722             const int * ret = reinterpret_cast<const int *>(_c->glGetString(name));
   1723             msg.set_ret(ToInt(ret));
   1724             return ret;
   1725         }
   1726     } caller;
   1727     caller.name = name;
   1728 
   1729     msg.set_arg0(name);
   1730 
   1731     // FIXME: check for pointer usage
   1732     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetString);
   1733     return reinterpret_cast<const GLubyte*>(ret);
   1734 }
   1735 
   1736 // FIXME: this function has pointers, it should be hand written
   1737 void Debug_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
   1738 {
   1739     glesv2debugger::Message msg;
   1740     struct : public FunctionCall {
   1741         GLenum target;
   1742         GLenum pname;
   1743         GLfloat* params;
   1744 
   1745         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1746             _c->glGetTexParameterfv(target, pname, params);
   1747             return 0;
   1748         }
   1749     } caller;
   1750     caller.target = target;
   1751     caller.pname = pname;
   1752     caller.params = params;
   1753 
   1754     msg.set_arg0(target);
   1755     msg.set_arg1(pname);
   1756     msg.set_arg2(ToInt(params));
   1757 
   1758     // FIXME: check for pointer usage
   1759     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetTexParameterfv);
   1760 }
   1761 
   1762 // FIXME: this function has pointers, it should be hand written
   1763 void Debug_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
   1764 {
   1765     glesv2debugger::Message msg;
   1766     struct : public FunctionCall {
   1767         GLenum target;
   1768         GLenum pname;
   1769         GLint* params;
   1770 
   1771         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1772             _c->glGetTexParameteriv(target, pname, params);
   1773             return 0;
   1774         }
   1775     } caller;
   1776     caller.target = target;
   1777     caller.pname = pname;
   1778     caller.params = params;
   1779 
   1780     msg.set_arg0(target);
   1781     msg.set_arg1(pname);
   1782     msg.set_arg2(ToInt(params));
   1783 
   1784     // FIXME: check for pointer usage
   1785     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetTexParameteriv);
   1786 }
   1787 
   1788 // FIXME: this function has pointers, it should be hand written
   1789 void Debug_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
   1790 {
   1791     glesv2debugger::Message msg;
   1792     struct : public FunctionCall {
   1793         GLuint program;
   1794         GLint location;
   1795         GLfloat* params;
   1796 
   1797         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1798             _c->glGetUniformfv(program, location, params);
   1799             return 0;
   1800         }
   1801     } caller;
   1802     caller.program = program;
   1803     caller.location = location;
   1804     caller.params = params;
   1805 
   1806     msg.set_arg0(program);
   1807     msg.set_arg1(location);
   1808     msg.set_arg2(ToInt(params));
   1809 
   1810     // FIXME: check for pointer usage
   1811     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetUniformfv);
   1812 }
   1813 
   1814 // FIXME: this function has pointers, it should be hand written
   1815 void Debug_glGetUniformiv(GLuint program, GLint location, GLint* params)
   1816 {
   1817     glesv2debugger::Message msg;
   1818     struct : public FunctionCall {
   1819         GLuint program;
   1820         GLint location;
   1821         GLint* params;
   1822 
   1823         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1824             _c->glGetUniformiv(program, location, params);
   1825             return 0;
   1826         }
   1827     } caller;
   1828     caller.program = program;
   1829     caller.location = location;
   1830     caller.params = params;
   1831 
   1832     msg.set_arg0(program);
   1833     msg.set_arg1(location);
   1834     msg.set_arg2(ToInt(params));
   1835 
   1836     // FIXME: check for pointer usage
   1837     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetUniformiv);
   1838 }
   1839 
   1840 int Debug_glGetUniformLocation(GLuint program, const GLchar* name)
   1841 {
   1842     glesv2debugger::Message msg;
   1843     struct : public FunctionCall {
   1844         GLuint program;
   1845         const GLchar* name;
   1846 
   1847         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1848             const int * ret = reinterpret_cast<const int *>(_c->glGetUniformLocation(program, name));
   1849             msg.set_ret(ToInt(ret));
   1850             return ret;
   1851         }
   1852     } caller;
   1853     caller.program = program;
   1854     caller.name = name;
   1855 
   1856     msg.set_arg0(program);
   1857     msg.set_arg1(ToInt(name));
   1858 
   1859     // FIXME: check for pointer usage
   1860     msg.mutable_data()->assign(reinterpret_cast<const char *>(name), strlen(name) * sizeof(GLchar));
   1861     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetUniformLocation);
   1862     return reinterpret_cast<int>(ret);
   1863 }
   1864 
   1865 // FIXME: this function has pointers, it should be hand written
   1866 void Debug_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
   1867 {
   1868     glesv2debugger::Message msg;
   1869     struct : public FunctionCall {
   1870         GLuint index;
   1871         GLenum pname;
   1872         GLfloat* params;
   1873 
   1874         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1875             _c->glGetVertexAttribfv(index, pname, params);
   1876             return 0;
   1877         }
   1878     } caller;
   1879     caller.index = index;
   1880     caller.pname = pname;
   1881     caller.params = params;
   1882 
   1883     msg.set_arg0(index);
   1884     msg.set_arg1(pname);
   1885     msg.set_arg2(ToInt(params));
   1886 
   1887     // FIXME: check for pointer usage
   1888     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetVertexAttribfv);
   1889 }
   1890 
   1891 // FIXME: this function has pointers, it should be hand written
   1892 void Debug_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
   1893 {
   1894     glesv2debugger::Message msg;
   1895     struct : public FunctionCall {
   1896         GLuint index;
   1897         GLenum pname;
   1898         GLint* params;
   1899 
   1900         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1901             _c->glGetVertexAttribiv(index, pname, params);
   1902             return 0;
   1903         }
   1904     } caller;
   1905     caller.index = index;
   1906     caller.pname = pname;
   1907     caller.params = params;
   1908 
   1909     msg.set_arg0(index);
   1910     msg.set_arg1(pname);
   1911     msg.set_arg2(ToInt(params));
   1912 
   1913     // FIXME: check for pointer usage
   1914     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetVertexAttribiv);
   1915 }
   1916 
   1917 // FIXME: this function has pointers, it should be hand written
   1918 void Debug_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
   1919 {
   1920     glesv2debugger::Message msg;
   1921     struct : public FunctionCall {
   1922         GLuint index;
   1923         GLenum pname;
   1924         GLvoid** pointer;
   1925 
   1926         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1927             _c->glGetVertexAttribPointerv(index, pname, pointer);
   1928             return 0;
   1929         }
   1930     } caller;
   1931     caller.index = index;
   1932     caller.pname = pname;
   1933     caller.pointer = pointer;
   1934 
   1935     msg.set_arg0(index);
   1936     msg.set_arg1(pname);
   1937     msg.set_arg2(ToInt(pointer));
   1938 
   1939     // FIXME: check for pointer usage
   1940     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glGetVertexAttribPointerv);
   1941 }
   1942 
   1943 void Debug_glHint(GLenum target, GLenum mode)
   1944 {
   1945     glesv2debugger::Message msg;
   1946     struct : public FunctionCall {
   1947         GLenum target;
   1948         GLenum mode;
   1949 
   1950         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1951             _c->glHint(target, mode);
   1952             return 0;
   1953         }
   1954     } caller;
   1955     caller.target = target;
   1956     caller.mode = mode;
   1957 
   1958     msg.set_arg0(target);
   1959     msg.set_arg1(mode);
   1960 
   1961     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glHint);
   1962 }
   1963 
   1964 GLboolean Debug_glIsBuffer(GLuint buffer)
   1965 {
   1966     glesv2debugger::Message msg;
   1967     struct : public FunctionCall {
   1968         GLuint buffer;
   1969 
   1970         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1971             const int * ret = reinterpret_cast<const int *>(_c->glIsBuffer(buffer));
   1972             msg.set_ret(ToInt(ret));
   1973             return ret;
   1974         }
   1975     } caller;
   1976     caller.buffer = buffer;
   1977 
   1978     msg.set_arg0(buffer);
   1979 
   1980     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsBuffer);
   1981     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   1982 }
   1983 
   1984 GLboolean Debug_glIsEnabled(GLenum cap)
   1985 {
   1986     glesv2debugger::Message msg;
   1987     struct : public FunctionCall {
   1988         GLenum cap;
   1989 
   1990         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   1991             const int * ret = reinterpret_cast<const int *>(_c->glIsEnabled(cap));
   1992             msg.set_ret(ToInt(ret));
   1993             return ret;
   1994         }
   1995     } caller;
   1996     caller.cap = cap;
   1997 
   1998     msg.set_arg0(cap);
   1999 
   2000     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsEnabled);
   2001     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2002 }
   2003 
   2004 GLboolean Debug_glIsFramebuffer(GLuint framebuffer)
   2005 {
   2006     glesv2debugger::Message msg;
   2007     struct : public FunctionCall {
   2008         GLuint framebuffer;
   2009 
   2010         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2011             const int * ret = reinterpret_cast<const int *>(_c->glIsFramebuffer(framebuffer));
   2012             msg.set_ret(ToInt(ret));
   2013             return ret;
   2014         }
   2015     } caller;
   2016     caller.framebuffer = framebuffer;
   2017 
   2018     msg.set_arg0(framebuffer);
   2019 
   2020     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsFramebuffer);
   2021     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2022 }
   2023 
   2024 GLboolean Debug_glIsProgram(GLuint program)
   2025 {
   2026     glesv2debugger::Message msg;
   2027     struct : public FunctionCall {
   2028         GLuint program;
   2029 
   2030         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2031             const int * ret = reinterpret_cast<const int *>(_c->glIsProgram(program));
   2032             msg.set_ret(ToInt(ret));
   2033             return ret;
   2034         }
   2035     } caller;
   2036     caller.program = program;
   2037 
   2038     msg.set_arg0(program);
   2039 
   2040     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsProgram);
   2041     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2042 }
   2043 
   2044 GLboolean Debug_glIsRenderbuffer(GLuint renderbuffer)
   2045 {
   2046     glesv2debugger::Message msg;
   2047     struct : public FunctionCall {
   2048         GLuint renderbuffer;
   2049 
   2050         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2051             const int * ret = reinterpret_cast<const int *>(_c->glIsRenderbuffer(renderbuffer));
   2052             msg.set_ret(ToInt(ret));
   2053             return ret;
   2054         }
   2055     } caller;
   2056     caller.renderbuffer = renderbuffer;
   2057 
   2058     msg.set_arg0(renderbuffer);
   2059 
   2060     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsRenderbuffer);
   2061     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2062 }
   2063 
   2064 GLboolean Debug_glIsShader(GLuint shader)
   2065 {
   2066     glesv2debugger::Message msg;
   2067     struct : public FunctionCall {
   2068         GLuint shader;
   2069 
   2070         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2071             const int * ret = reinterpret_cast<const int *>(_c->glIsShader(shader));
   2072             msg.set_ret(ToInt(ret));
   2073             return ret;
   2074         }
   2075     } caller;
   2076     caller.shader = shader;
   2077 
   2078     msg.set_arg0(shader);
   2079 
   2080     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsShader);
   2081     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2082 }
   2083 
   2084 GLboolean Debug_glIsTexture(GLuint texture)
   2085 {
   2086     glesv2debugger::Message msg;
   2087     struct : public FunctionCall {
   2088         GLuint texture;
   2089 
   2090         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2091             const int * ret = reinterpret_cast<const int *>(_c->glIsTexture(texture));
   2092             msg.set_ret(ToInt(ret));
   2093             return ret;
   2094         }
   2095     } caller;
   2096     caller.texture = texture;
   2097 
   2098     msg.set_arg0(texture);
   2099 
   2100     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glIsTexture);
   2101     return static_cast<GLboolean>(reinterpret_cast<int>(ret));
   2102 }
   2103 
   2104 void Debug_glLineWidth(GLfloat width)
   2105 {
   2106     glesv2debugger::Message msg;
   2107     struct : public FunctionCall {
   2108         GLfloat width;
   2109 
   2110         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2111             _c->glLineWidth(width);
   2112             return 0;
   2113         }
   2114     } caller;
   2115     caller.width = width;
   2116 
   2117     msg.set_arg0(ToInt(width));
   2118 
   2119     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glLineWidth);
   2120 }
   2121 
   2122 void Debug_glLinkProgram(GLuint program)
   2123 {
   2124     glesv2debugger::Message msg;
   2125     struct : public FunctionCall {
   2126         GLuint program;
   2127 
   2128         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2129             _c->glLinkProgram(program);
   2130             return 0;
   2131         }
   2132     } caller;
   2133     caller.program = program;
   2134 
   2135     msg.set_arg0(program);
   2136 
   2137     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glLinkProgram);
   2138 }
   2139 
   2140 void Debug_glPixelStorei(GLenum pname, GLint param)
   2141 {
   2142     glesv2debugger::Message msg;
   2143     struct : public FunctionCall {
   2144         GLenum pname;
   2145         GLint param;
   2146 
   2147         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2148             _c->glPixelStorei(pname, param);
   2149             return 0;
   2150         }
   2151     } caller;
   2152     caller.pname = pname;
   2153     caller.param = param;
   2154 
   2155     msg.set_arg0(pname);
   2156     msg.set_arg1(param);
   2157 
   2158     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glPixelStorei);
   2159 }
   2160 
   2161 void Debug_glPolygonOffset(GLfloat factor, GLfloat units)
   2162 {
   2163     glesv2debugger::Message msg;
   2164     struct : public FunctionCall {
   2165         GLfloat factor;
   2166         GLfloat units;
   2167 
   2168         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2169             _c->glPolygonOffset(factor, units);
   2170             return 0;
   2171         }
   2172     } caller;
   2173     caller.factor = factor;
   2174     caller.units = units;
   2175 
   2176     msg.set_arg0(ToInt(factor));
   2177     msg.set_arg1(ToInt(units));
   2178 
   2179     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glPolygonOffset);
   2180 }
   2181 
   2182 void Debug_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
   2183 {
   2184     glesv2debugger::Message msg;
   2185     struct : public FunctionCall {
   2186         GLint x;
   2187         GLint y;
   2188         GLsizei width;
   2189         GLsizei height;
   2190         GLenum format;
   2191         GLenum type;
   2192         GLvoid* pixels;
   2193 
   2194         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2195             _c->glReadPixels(x, y, width, height, format, type, pixels);
   2196 #ifdef EXTEND_AFTER_CALL_Debug_glReadPixels
   2197             EXTEND_AFTER_CALL_Debug_glReadPixels;
   2198 #endif
   2199             return 0;
   2200         }
   2201     } caller;
   2202     caller.x = x;
   2203     caller.y = y;
   2204     caller.width = width;
   2205     caller.height = height;
   2206     caller.format = format;
   2207     caller.type = type;
   2208     caller.pixels = pixels;
   2209 
   2210     msg.set_arg0(x);
   2211     msg.set_arg1(y);
   2212     msg.set_arg2(width);
   2213     msg.set_arg3(height);
   2214     msg.set_arg4(format);
   2215     msg.set_arg5(type);
   2216     msg.set_arg6(ToInt(pixels));
   2217 
   2218     // FIXME: check for pointer usage
   2219 #ifdef EXTEND_Debug_glReadPixels
   2220     EXTEND_Debug_glReadPixels;
   2221 #endif
   2222     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glReadPixels);
   2223 }
   2224 
   2225 void Debug_glReleaseShaderCompiler(void)
   2226 {
   2227     glesv2debugger::Message msg;
   2228     struct : public FunctionCall {
   2229 
   2230         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2231             _c->glReleaseShaderCompiler();
   2232             return 0;
   2233         }
   2234     } caller;
   2235 
   2236 
   2237     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glReleaseShaderCompiler);
   2238 }
   2239 
   2240 void Debug_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
   2241 {
   2242     glesv2debugger::Message msg;
   2243     struct : public FunctionCall {
   2244         GLenum target;
   2245         GLenum internalformat;
   2246         GLsizei width;
   2247         GLsizei height;
   2248 
   2249         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2250             _c->glRenderbufferStorage(target, internalformat, width, height);
   2251             return 0;
   2252         }
   2253     } caller;
   2254     caller.target = target;
   2255     caller.internalformat = internalformat;
   2256     caller.width = width;
   2257     caller.height = height;
   2258 
   2259     msg.set_arg0(target);
   2260     msg.set_arg1(internalformat);
   2261     msg.set_arg2(width);
   2262     msg.set_arg3(height);
   2263 
   2264     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glRenderbufferStorage);
   2265 }
   2266 
   2267 void Debug_glSampleCoverage(GLclampf value, GLboolean invert)
   2268 {
   2269     glesv2debugger::Message msg;
   2270     struct : public FunctionCall {
   2271         GLclampf value;
   2272         GLboolean invert;
   2273 
   2274         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2275             _c->glSampleCoverage(value, invert);
   2276             return 0;
   2277         }
   2278     } caller;
   2279     caller.value = value;
   2280     caller.invert = invert;
   2281 
   2282     msg.set_arg0(ToInt(value));
   2283     msg.set_arg1(invert);
   2284 
   2285     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glSampleCoverage);
   2286 }
   2287 
   2288 void Debug_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
   2289 {
   2290     glesv2debugger::Message msg;
   2291     struct : public FunctionCall {
   2292         GLint x;
   2293         GLint y;
   2294         GLsizei width;
   2295         GLsizei height;
   2296 
   2297         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2298             _c->glScissor(x, y, width, height);
   2299             return 0;
   2300         }
   2301     } caller;
   2302     caller.x = x;
   2303     caller.y = y;
   2304     caller.width = width;
   2305     caller.height = height;
   2306 
   2307     msg.set_arg0(x);
   2308     msg.set_arg1(y);
   2309     msg.set_arg2(width);
   2310     msg.set_arg3(height);
   2311 
   2312     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glScissor);
   2313 }
   2314 
   2315 // FIXME: this function has pointers, it should be hand written
   2316 void Debug_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
   2317 {
   2318     glesv2debugger::Message msg;
   2319     struct : public FunctionCall {
   2320         GLsizei n;
   2321         const GLuint* shaders;
   2322         GLenum binaryformat;
   2323         const GLvoid* binary;
   2324         GLsizei length;
   2325 
   2326         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2327             _c->glShaderBinary(n, shaders, binaryformat, binary, length);
   2328             return 0;
   2329         }
   2330     } caller;
   2331     caller.n = n;
   2332     caller.shaders = shaders;
   2333     caller.binaryformat = binaryformat;
   2334     caller.binary = binary;
   2335     caller.length = length;
   2336 
   2337     msg.set_arg0(n);
   2338     msg.set_arg1(ToInt(shaders));
   2339     msg.set_arg2(binaryformat);
   2340     msg.set_arg3(ToInt(binary));
   2341     msg.set_arg4(length);
   2342 
   2343     // FIXME: check for pointer usage
   2344     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glShaderBinary);
   2345 }
   2346 
   2347 void Debug_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
   2348 {
   2349     glesv2debugger::Message msg;
   2350     struct : public FunctionCall {
   2351         GLuint shader;
   2352         GLsizei count;
   2353         const GLchar** string;
   2354         const GLint* length;
   2355 
   2356         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2357             _c->glShaderSource(shader, count, string, length);
   2358 #ifdef EXTEND_AFTER_CALL_Debug_glShaderSource
   2359             EXTEND_AFTER_CALL_Debug_glShaderSource;
   2360 #endif
   2361             return 0;
   2362         }
   2363     } caller;
   2364     caller.shader = shader;
   2365     caller.count = count;
   2366     caller.string = string;
   2367     caller.length = length;
   2368 
   2369     msg.set_arg0(shader);
   2370     msg.set_arg1(count);
   2371     msg.set_arg2(ToInt(string));
   2372     msg.set_arg3(ToInt(length));
   2373 
   2374     // FIXME: check for pointer usage
   2375 #ifdef EXTEND_Debug_glShaderSource
   2376     EXTEND_Debug_glShaderSource;
   2377 #endif
   2378     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glShaderSource);
   2379 }
   2380 
   2381 void Debug_glStencilFunc(GLenum func, GLint ref, GLuint mask)
   2382 {
   2383     glesv2debugger::Message msg;
   2384     struct : public FunctionCall {
   2385         GLenum func;
   2386         GLint ref;
   2387         GLuint mask;
   2388 
   2389         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2390             _c->glStencilFunc(func, ref, mask);
   2391             return 0;
   2392         }
   2393     } caller;
   2394     caller.func = func;
   2395     caller.ref = ref;
   2396     caller.mask = mask;
   2397 
   2398     msg.set_arg0(func);
   2399     msg.set_arg1(ref);
   2400     msg.set_arg2(mask);
   2401 
   2402     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilFunc);
   2403 }
   2404 
   2405 void Debug_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
   2406 {
   2407     glesv2debugger::Message msg;
   2408     struct : public FunctionCall {
   2409         GLenum face;
   2410         GLenum func;
   2411         GLint ref;
   2412         GLuint mask;
   2413 
   2414         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2415             _c->glStencilFuncSeparate(face, func, ref, mask);
   2416             return 0;
   2417         }
   2418     } caller;
   2419     caller.face = face;
   2420     caller.func = func;
   2421     caller.ref = ref;
   2422     caller.mask = mask;
   2423 
   2424     msg.set_arg0(face);
   2425     msg.set_arg1(func);
   2426     msg.set_arg2(ref);
   2427     msg.set_arg3(mask);
   2428 
   2429     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilFuncSeparate);
   2430 }
   2431 
   2432 void Debug_glStencilMask(GLuint mask)
   2433 {
   2434     glesv2debugger::Message msg;
   2435     struct : public FunctionCall {
   2436         GLuint mask;
   2437 
   2438         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2439             _c->glStencilMask(mask);
   2440             return 0;
   2441         }
   2442     } caller;
   2443     caller.mask = mask;
   2444 
   2445     msg.set_arg0(mask);
   2446 
   2447     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilMask);
   2448 }
   2449 
   2450 void Debug_glStencilMaskSeparate(GLenum face, GLuint mask)
   2451 {
   2452     glesv2debugger::Message msg;
   2453     struct : public FunctionCall {
   2454         GLenum face;
   2455         GLuint mask;
   2456 
   2457         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2458             _c->glStencilMaskSeparate(face, mask);
   2459             return 0;
   2460         }
   2461     } caller;
   2462     caller.face = face;
   2463     caller.mask = mask;
   2464 
   2465     msg.set_arg0(face);
   2466     msg.set_arg1(mask);
   2467 
   2468     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilMaskSeparate);
   2469 }
   2470 
   2471 void Debug_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
   2472 {
   2473     glesv2debugger::Message msg;
   2474     struct : public FunctionCall {
   2475         GLenum fail;
   2476         GLenum zfail;
   2477         GLenum zpass;
   2478 
   2479         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2480             _c->glStencilOp(fail, zfail, zpass);
   2481             return 0;
   2482         }
   2483     } caller;
   2484     caller.fail = fail;
   2485     caller.zfail = zfail;
   2486     caller.zpass = zpass;
   2487 
   2488     msg.set_arg0(fail);
   2489     msg.set_arg1(zfail);
   2490     msg.set_arg2(zpass);
   2491 
   2492     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilOp);
   2493 }
   2494 
   2495 void Debug_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
   2496 {
   2497     glesv2debugger::Message msg;
   2498     struct : public FunctionCall {
   2499         GLenum face;
   2500         GLenum fail;
   2501         GLenum zfail;
   2502         GLenum zpass;
   2503 
   2504         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2505             _c->glStencilOpSeparate(face, fail, zfail, zpass);
   2506             return 0;
   2507         }
   2508     } caller;
   2509     caller.face = face;
   2510     caller.fail = fail;
   2511     caller.zfail = zfail;
   2512     caller.zpass = zpass;
   2513 
   2514     msg.set_arg0(face);
   2515     msg.set_arg1(fail);
   2516     msg.set_arg2(zfail);
   2517     msg.set_arg3(zpass);
   2518 
   2519     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glStencilOpSeparate);
   2520 }
   2521 
   2522 void Debug_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
   2523 {
   2524     glesv2debugger::Message msg;
   2525     struct : public FunctionCall {
   2526         GLenum target;
   2527         GLint level;
   2528         GLint internalformat;
   2529         GLsizei width;
   2530         GLsizei height;
   2531         GLint border;
   2532         GLenum format;
   2533         GLenum type;
   2534         const GLvoid* pixels;
   2535 
   2536         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2537             _c->glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
   2538 #ifdef EXTEND_AFTER_CALL_Debug_glTexImage2D
   2539             EXTEND_AFTER_CALL_Debug_glTexImage2D;
   2540 #endif
   2541             return 0;
   2542         }
   2543     } caller;
   2544     caller.target = target;
   2545     caller.level = level;
   2546     caller.internalformat = internalformat;
   2547     caller.width = width;
   2548     caller.height = height;
   2549     caller.border = border;
   2550     caller.format = format;
   2551     caller.type = type;
   2552     caller.pixels = pixels;
   2553 
   2554     msg.set_arg0(target);
   2555     msg.set_arg1(level);
   2556     msg.set_arg2(internalformat);
   2557     msg.set_arg3(width);
   2558     msg.set_arg4(height);
   2559     msg.set_arg5(border);
   2560     msg.set_arg6(format);
   2561     msg.set_arg7(type);
   2562     msg.set_arg8(ToInt(pixels));
   2563 
   2564     // FIXME: check for pointer usage
   2565 #ifdef EXTEND_Debug_glTexImage2D
   2566     EXTEND_Debug_glTexImage2D;
   2567 #endif
   2568     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexImage2D);
   2569 }
   2570 
   2571 void Debug_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
   2572 {
   2573     glesv2debugger::Message msg;
   2574     struct : public FunctionCall {
   2575         GLenum target;
   2576         GLenum pname;
   2577         GLfloat param;
   2578 
   2579         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2580             _c->glTexParameterf(target, pname, param);
   2581             return 0;
   2582         }
   2583     } caller;
   2584     caller.target = target;
   2585     caller.pname = pname;
   2586     caller.param = param;
   2587 
   2588     msg.set_arg0(target);
   2589     msg.set_arg1(pname);
   2590     msg.set_arg2(ToInt(param));
   2591 
   2592     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexParameterf);
   2593 }
   2594 
   2595 // FIXME: this function has pointers, it should be hand written
   2596 void Debug_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
   2597 {
   2598     glesv2debugger::Message msg;
   2599     struct : public FunctionCall {
   2600         GLenum target;
   2601         GLenum pname;
   2602         const GLfloat* params;
   2603 
   2604         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2605             _c->glTexParameterfv(target, pname, params);
   2606             return 0;
   2607         }
   2608     } caller;
   2609     caller.target = target;
   2610     caller.pname = pname;
   2611     caller.params = params;
   2612 
   2613     msg.set_arg0(target);
   2614     msg.set_arg1(pname);
   2615     msg.set_arg2(ToInt(params));
   2616 
   2617     // FIXME: check for pointer usage
   2618     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexParameterfv);
   2619 }
   2620 
   2621 void Debug_glTexParameteri(GLenum target, GLenum pname, GLint param)
   2622 {
   2623     glesv2debugger::Message msg;
   2624     struct : public FunctionCall {
   2625         GLenum target;
   2626         GLenum pname;
   2627         GLint param;
   2628 
   2629         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2630             _c->glTexParameteri(target, pname, param);
   2631             return 0;
   2632         }
   2633     } caller;
   2634     caller.target = target;
   2635     caller.pname = pname;
   2636     caller.param = param;
   2637 
   2638     msg.set_arg0(target);
   2639     msg.set_arg1(pname);
   2640     msg.set_arg2(param);
   2641 
   2642     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexParameteri);
   2643 }
   2644 
   2645 // FIXME: this function has pointers, it should be hand written
   2646 void Debug_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
   2647 {
   2648     glesv2debugger::Message msg;
   2649     struct : public FunctionCall {
   2650         GLenum target;
   2651         GLenum pname;
   2652         const GLint* params;
   2653 
   2654         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2655             _c->glTexParameteriv(target, pname, params);
   2656             return 0;
   2657         }
   2658     } caller;
   2659     caller.target = target;
   2660     caller.pname = pname;
   2661     caller.params = params;
   2662 
   2663     msg.set_arg0(target);
   2664     msg.set_arg1(pname);
   2665     msg.set_arg2(ToInt(params));
   2666 
   2667     // FIXME: check for pointer usage
   2668     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexParameteriv);
   2669 }
   2670 
   2671 void Debug_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
   2672 {
   2673     glesv2debugger::Message msg;
   2674     struct : public FunctionCall {
   2675         GLenum target;
   2676         GLint level;
   2677         GLint xoffset;
   2678         GLint yoffset;
   2679         GLsizei width;
   2680         GLsizei height;
   2681         GLenum format;
   2682         GLenum type;
   2683         const GLvoid* pixels;
   2684 
   2685         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2686             _c->glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
   2687 #ifdef EXTEND_AFTER_CALL_Debug_glTexSubImage2D
   2688             EXTEND_AFTER_CALL_Debug_glTexSubImage2D;
   2689 #endif
   2690             return 0;
   2691         }
   2692     } caller;
   2693     caller.target = target;
   2694     caller.level = level;
   2695     caller.xoffset = xoffset;
   2696     caller.yoffset = yoffset;
   2697     caller.width = width;
   2698     caller.height = height;
   2699     caller.format = format;
   2700     caller.type = type;
   2701     caller.pixels = pixels;
   2702 
   2703     msg.set_arg0(target);
   2704     msg.set_arg1(level);
   2705     msg.set_arg2(xoffset);
   2706     msg.set_arg3(yoffset);
   2707     msg.set_arg4(width);
   2708     msg.set_arg5(height);
   2709     msg.set_arg6(format);
   2710     msg.set_arg7(type);
   2711     msg.set_arg8(ToInt(pixels));
   2712 
   2713     // FIXME: check for pointer usage
   2714 #ifdef EXTEND_Debug_glTexSubImage2D
   2715     EXTEND_Debug_glTexSubImage2D;
   2716 #endif
   2717     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glTexSubImage2D);
   2718 }
   2719 
   2720 void Debug_glUniform1f(GLint location, GLfloat x)
   2721 {
   2722     glesv2debugger::Message msg;
   2723     struct : public FunctionCall {
   2724         GLint location;
   2725         GLfloat x;
   2726 
   2727         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2728             _c->glUniform1f(location, x);
   2729             return 0;
   2730         }
   2731     } caller;
   2732     caller.location = location;
   2733     caller.x = x;
   2734 
   2735     msg.set_arg0(location);
   2736     msg.set_arg1(ToInt(x));
   2737 
   2738     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform1f);
   2739 }
   2740 
   2741 void Debug_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
   2742 {
   2743     glesv2debugger::Message msg;
   2744     struct : public FunctionCall {
   2745         GLint location;
   2746         GLsizei count;
   2747         const GLfloat* v;
   2748 
   2749         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2750             _c->glUniform1fv(location, count, v);
   2751             return 0;
   2752         }
   2753     } caller;
   2754     caller.location = location;
   2755     caller.count = count;
   2756     caller.v = v;
   2757 
   2758     msg.set_arg0(location);
   2759     msg.set_arg1(count);
   2760     msg.set_arg2(ToInt(v));
   2761 
   2762     // FIXME: check for pointer usage
   2763     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 1*count * sizeof(GLfloat));
   2764     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform1fv);
   2765 }
   2766 
   2767 void Debug_glUniform1i(GLint location, GLint x)
   2768 {
   2769     glesv2debugger::Message msg;
   2770     struct : public FunctionCall {
   2771         GLint location;
   2772         GLint x;
   2773 
   2774         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2775             _c->glUniform1i(location, x);
   2776             return 0;
   2777         }
   2778     } caller;
   2779     caller.location = location;
   2780     caller.x = x;
   2781 
   2782     msg.set_arg0(location);
   2783     msg.set_arg1(x);
   2784 
   2785     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform1i);
   2786 }
   2787 
   2788 void Debug_glUniform1iv(GLint location, GLsizei count, const GLint* v)
   2789 {
   2790     glesv2debugger::Message msg;
   2791     struct : public FunctionCall {
   2792         GLint location;
   2793         GLsizei count;
   2794         const GLint* v;
   2795 
   2796         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2797             _c->glUniform1iv(location, count, v);
   2798             return 0;
   2799         }
   2800     } caller;
   2801     caller.location = location;
   2802     caller.count = count;
   2803     caller.v = v;
   2804 
   2805     msg.set_arg0(location);
   2806     msg.set_arg1(count);
   2807     msg.set_arg2(ToInt(v));
   2808 
   2809     // FIXME: check for pointer usage
   2810     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 1*count * sizeof(GLint));
   2811     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform1iv);
   2812 }
   2813 
   2814 void Debug_glUniform2f(GLint location, GLfloat x, GLfloat y)
   2815 {
   2816     glesv2debugger::Message msg;
   2817     struct : public FunctionCall {
   2818         GLint location;
   2819         GLfloat x;
   2820         GLfloat y;
   2821 
   2822         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2823             _c->glUniform2f(location, x, y);
   2824             return 0;
   2825         }
   2826     } caller;
   2827     caller.location = location;
   2828     caller.x = x;
   2829     caller.y = y;
   2830 
   2831     msg.set_arg0(location);
   2832     msg.set_arg1(ToInt(x));
   2833     msg.set_arg2(ToInt(y));
   2834 
   2835     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform2f);
   2836 }
   2837 
   2838 void Debug_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
   2839 {
   2840     glesv2debugger::Message msg;
   2841     struct : public FunctionCall {
   2842         GLint location;
   2843         GLsizei count;
   2844         const GLfloat* v;
   2845 
   2846         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2847             _c->glUniform2fv(location, count, v);
   2848             return 0;
   2849         }
   2850     } caller;
   2851     caller.location = location;
   2852     caller.count = count;
   2853     caller.v = v;
   2854 
   2855     msg.set_arg0(location);
   2856     msg.set_arg1(count);
   2857     msg.set_arg2(ToInt(v));
   2858 
   2859     // FIXME: check for pointer usage
   2860     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 2*count * sizeof(GLfloat));
   2861     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform2fv);
   2862 }
   2863 
   2864 void Debug_glUniform2i(GLint location, GLint x, GLint y)
   2865 {
   2866     glesv2debugger::Message msg;
   2867     struct : public FunctionCall {
   2868         GLint location;
   2869         GLint x;
   2870         GLint y;
   2871 
   2872         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2873             _c->glUniform2i(location, x, y);
   2874             return 0;
   2875         }
   2876     } caller;
   2877     caller.location = location;
   2878     caller.x = x;
   2879     caller.y = y;
   2880 
   2881     msg.set_arg0(location);
   2882     msg.set_arg1(x);
   2883     msg.set_arg2(y);
   2884 
   2885     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform2i);
   2886 }
   2887 
   2888 void Debug_glUniform2iv(GLint location, GLsizei count, const GLint* v)
   2889 {
   2890     glesv2debugger::Message msg;
   2891     struct : public FunctionCall {
   2892         GLint location;
   2893         GLsizei count;
   2894         const GLint* v;
   2895 
   2896         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2897             _c->glUniform2iv(location, count, v);
   2898             return 0;
   2899         }
   2900     } caller;
   2901     caller.location = location;
   2902     caller.count = count;
   2903     caller.v = v;
   2904 
   2905     msg.set_arg0(location);
   2906     msg.set_arg1(count);
   2907     msg.set_arg2(ToInt(v));
   2908 
   2909     // FIXME: check for pointer usage
   2910     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 2*count * sizeof(GLint));
   2911     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform2iv);
   2912 }
   2913 
   2914 void Debug_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
   2915 {
   2916     glesv2debugger::Message msg;
   2917     struct : public FunctionCall {
   2918         GLint location;
   2919         GLfloat x;
   2920         GLfloat y;
   2921         GLfloat z;
   2922 
   2923         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2924             _c->glUniform3f(location, x, y, z);
   2925             return 0;
   2926         }
   2927     } caller;
   2928     caller.location = location;
   2929     caller.x = x;
   2930     caller.y = y;
   2931     caller.z = z;
   2932 
   2933     msg.set_arg0(location);
   2934     msg.set_arg1(ToInt(x));
   2935     msg.set_arg2(ToInt(y));
   2936     msg.set_arg3(ToInt(z));
   2937 
   2938     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform3f);
   2939 }
   2940 
   2941 void Debug_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
   2942 {
   2943     glesv2debugger::Message msg;
   2944     struct : public FunctionCall {
   2945         GLint location;
   2946         GLsizei count;
   2947         const GLfloat* v;
   2948 
   2949         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2950             _c->glUniform3fv(location, count, v);
   2951             return 0;
   2952         }
   2953     } caller;
   2954     caller.location = location;
   2955     caller.count = count;
   2956     caller.v = v;
   2957 
   2958     msg.set_arg0(location);
   2959     msg.set_arg1(count);
   2960     msg.set_arg2(ToInt(v));
   2961 
   2962     // FIXME: check for pointer usage
   2963     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 3*count * sizeof(GLfloat));
   2964     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform3fv);
   2965 }
   2966 
   2967 void Debug_glUniform3i(GLint location, GLint x, GLint y, GLint z)
   2968 {
   2969     glesv2debugger::Message msg;
   2970     struct : public FunctionCall {
   2971         GLint location;
   2972         GLint x;
   2973         GLint y;
   2974         GLint z;
   2975 
   2976         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   2977             _c->glUniform3i(location, x, y, z);
   2978             return 0;
   2979         }
   2980     } caller;
   2981     caller.location = location;
   2982     caller.x = x;
   2983     caller.y = y;
   2984     caller.z = z;
   2985 
   2986     msg.set_arg0(location);
   2987     msg.set_arg1(x);
   2988     msg.set_arg2(y);
   2989     msg.set_arg3(z);
   2990 
   2991     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform3i);
   2992 }
   2993 
   2994 void Debug_glUniform3iv(GLint location, GLsizei count, const GLint* v)
   2995 {
   2996     glesv2debugger::Message msg;
   2997     struct : public FunctionCall {
   2998         GLint location;
   2999         GLsizei count;
   3000         const GLint* v;
   3001 
   3002         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3003             _c->glUniform3iv(location, count, v);
   3004             return 0;
   3005         }
   3006     } caller;
   3007     caller.location = location;
   3008     caller.count = count;
   3009     caller.v = v;
   3010 
   3011     msg.set_arg0(location);
   3012     msg.set_arg1(count);
   3013     msg.set_arg2(ToInt(v));
   3014 
   3015     // FIXME: check for pointer usage
   3016     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 3*count * sizeof(GLint));
   3017     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform3iv);
   3018 }
   3019 
   3020 void Debug_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
   3021 {
   3022     glesv2debugger::Message msg;
   3023     struct : public FunctionCall {
   3024         GLint location;
   3025         GLfloat x;
   3026         GLfloat y;
   3027         GLfloat z;
   3028         GLfloat w;
   3029 
   3030         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3031             _c->glUniform4f(location, x, y, z, w);
   3032             return 0;
   3033         }
   3034     } caller;
   3035     caller.location = location;
   3036     caller.x = x;
   3037     caller.y = y;
   3038     caller.z = z;
   3039     caller.w = w;
   3040 
   3041     msg.set_arg0(location);
   3042     msg.set_arg1(ToInt(x));
   3043     msg.set_arg2(ToInt(y));
   3044     msg.set_arg3(ToInt(z));
   3045     msg.set_arg4(ToInt(w));
   3046 
   3047     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform4f);
   3048 }
   3049 
   3050 void Debug_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
   3051 {
   3052     glesv2debugger::Message msg;
   3053     struct : public FunctionCall {
   3054         GLint location;
   3055         GLsizei count;
   3056         const GLfloat* v;
   3057 
   3058         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3059             _c->glUniform4fv(location, count, v);
   3060             return 0;
   3061         }
   3062     } caller;
   3063     caller.location = location;
   3064     caller.count = count;
   3065     caller.v = v;
   3066 
   3067     msg.set_arg0(location);
   3068     msg.set_arg1(count);
   3069     msg.set_arg2(ToInt(v));
   3070 
   3071     // FIXME: check for pointer usage
   3072     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 4*count * sizeof(GLfloat));
   3073     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform4fv);
   3074 }
   3075 
   3076 void Debug_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
   3077 {
   3078     glesv2debugger::Message msg;
   3079     struct : public FunctionCall {
   3080         GLint location;
   3081         GLint x;
   3082         GLint y;
   3083         GLint z;
   3084         GLint w;
   3085 
   3086         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3087             _c->glUniform4i(location, x, y, z, w);
   3088             return 0;
   3089         }
   3090     } caller;
   3091     caller.location = location;
   3092     caller.x = x;
   3093     caller.y = y;
   3094     caller.z = z;
   3095     caller.w = w;
   3096 
   3097     msg.set_arg0(location);
   3098     msg.set_arg1(x);
   3099     msg.set_arg2(y);
   3100     msg.set_arg3(z);
   3101     msg.set_arg4(w);
   3102 
   3103     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform4i);
   3104 }
   3105 
   3106 void Debug_glUniform4iv(GLint location, GLsizei count, const GLint* v)
   3107 {
   3108     glesv2debugger::Message msg;
   3109     struct : public FunctionCall {
   3110         GLint location;
   3111         GLsizei count;
   3112         const GLint* v;
   3113 
   3114         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3115             _c->glUniform4iv(location, count, v);
   3116             return 0;
   3117         }
   3118     } caller;
   3119     caller.location = location;
   3120     caller.count = count;
   3121     caller.v = v;
   3122 
   3123     msg.set_arg0(location);
   3124     msg.set_arg1(count);
   3125     msg.set_arg2(ToInt(v));
   3126 
   3127     // FIXME: check for pointer usage
   3128     msg.mutable_data()->assign(reinterpret_cast<const char *>(v), 4*count * sizeof(GLint));
   3129     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniform4iv);
   3130 }
   3131 
   3132 void Debug_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   3133 {
   3134     glesv2debugger::Message msg;
   3135     struct : public FunctionCall {
   3136         GLint location;
   3137         GLsizei count;
   3138         GLboolean transpose;
   3139         const GLfloat* value;
   3140 
   3141         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3142             _c->glUniformMatrix2fv(location, count, transpose, value);
   3143             return 0;
   3144         }
   3145     } caller;
   3146     caller.location = location;
   3147     caller.count = count;
   3148     caller.transpose = transpose;
   3149     caller.value = value;
   3150 
   3151     msg.set_arg0(location);
   3152     msg.set_arg1(count);
   3153     msg.set_arg2(transpose);
   3154     msg.set_arg3(ToInt(value));
   3155 
   3156     // FIXME: check for pointer usage
   3157     msg.mutable_data()->assign(reinterpret_cast<const char *>(value), 4*count * sizeof(GLfloat));
   3158     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniformMatrix2fv);
   3159 }
   3160 
   3161 void Debug_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   3162 {
   3163     glesv2debugger::Message msg;
   3164     struct : public FunctionCall {
   3165         GLint location;
   3166         GLsizei count;
   3167         GLboolean transpose;
   3168         const GLfloat* value;
   3169 
   3170         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3171             _c->glUniformMatrix3fv(location, count, transpose, value);
   3172             return 0;
   3173         }
   3174     } caller;
   3175     caller.location = location;
   3176     caller.count = count;
   3177     caller.transpose = transpose;
   3178     caller.value = value;
   3179 
   3180     msg.set_arg0(location);
   3181     msg.set_arg1(count);
   3182     msg.set_arg2(transpose);
   3183     msg.set_arg3(ToInt(value));
   3184 
   3185     // FIXME: check for pointer usage
   3186     msg.mutable_data()->assign(reinterpret_cast<const char *>(value), 9*count * sizeof(GLfloat));
   3187     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniformMatrix3fv);
   3188 }
   3189 
   3190 void Debug_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   3191 {
   3192     glesv2debugger::Message msg;
   3193     struct : public FunctionCall {
   3194         GLint location;
   3195         GLsizei count;
   3196         GLboolean transpose;
   3197         const GLfloat* value;
   3198 
   3199         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3200             _c->glUniformMatrix4fv(location, count, transpose, value);
   3201             return 0;
   3202         }
   3203     } caller;
   3204     caller.location = location;
   3205     caller.count = count;
   3206     caller.transpose = transpose;
   3207     caller.value = value;
   3208 
   3209     msg.set_arg0(location);
   3210     msg.set_arg1(count);
   3211     msg.set_arg2(transpose);
   3212     msg.set_arg3(ToInt(value));
   3213 
   3214     // FIXME: check for pointer usage
   3215     msg.mutable_data()->assign(reinterpret_cast<const char *>(value), 16*count * sizeof(GLfloat));
   3216     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUniformMatrix4fv);
   3217 }
   3218 
   3219 void Debug_glUseProgram(GLuint program)
   3220 {
   3221     glesv2debugger::Message msg;
   3222     struct : public FunctionCall {
   3223         GLuint program;
   3224 
   3225         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3226             _c->glUseProgram(program);
   3227             getDbgContextThreadSpecific()->glUseProgram(program);
   3228             return 0;
   3229         }
   3230     } caller;
   3231     caller.program = program;
   3232 
   3233     msg.set_arg0(program);
   3234 
   3235     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glUseProgram);
   3236 }
   3237 
   3238 void Debug_glValidateProgram(GLuint program)
   3239 {
   3240     glesv2debugger::Message msg;
   3241     struct : public FunctionCall {
   3242         GLuint program;
   3243 
   3244         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3245             _c->glValidateProgram(program);
   3246             return 0;
   3247         }
   3248     } caller;
   3249     caller.program = program;
   3250 
   3251     msg.set_arg0(program);
   3252 
   3253     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glValidateProgram);
   3254 }
   3255 
   3256 void Debug_glVertexAttrib1f(GLuint indx, GLfloat x)
   3257 {
   3258     glesv2debugger::Message msg;
   3259     struct : public FunctionCall {
   3260         GLuint indx;
   3261         GLfloat x;
   3262 
   3263         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3264             _c->glVertexAttrib1f(indx, x);
   3265             return 0;
   3266         }
   3267     } caller;
   3268     caller.indx = indx;
   3269     caller.x = x;
   3270 
   3271     msg.set_arg0(indx);
   3272     msg.set_arg1(ToInt(x));
   3273 
   3274     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib1f);
   3275 }
   3276 
   3277 void Debug_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
   3278 {
   3279     glesv2debugger::Message msg;
   3280     struct : public FunctionCall {
   3281         GLuint indx;
   3282         const GLfloat* values;
   3283 
   3284         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3285             _c->glVertexAttrib1fv(indx, values);
   3286             return 0;
   3287         }
   3288     } caller;
   3289     caller.indx = indx;
   3290     caller.values = values;
   3291 
   3292     msg.set_arg0(indx);
   3293     msg.set_arg1(ToInt(values));
   3294 
   3295     // FIXME: check for pointer usage
   3296     msg.mutable_data()->assign(reinterpret_cast<const char *>(values), 1 * sizeof(GLfloat));
   3297     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib1fv);
   3298 }
   3299 
   3300 void Debug_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
   3301 {
   3302     glesv2debugger::Message msg;
   3303     struct : public FunctionCall {
   3304         GLuint indx;
   3305         GLfloat x;
   3306         GLfloat y;
   3307 
   3308         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3309             _c->glVertexAttrib2f(indx, x, y);
   3310             return 0;
   3311         }
   3312     } caller;
   3313     caller.indx = indx;
   3314     caller.x = x;
   3315     caller.y = y;
   3316 
   3317     msg.set_arg0(indx);
   3318     msg.set_arg1(ToInt(x));
   3319     msg.set_arg2(ToInt(y));
   3320 
   3321     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib2f);
   3322 }
   3323 
   3324 void Debug_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
   3325 {
   3326     glesv2debugger::Message msg;
   3327     struct : public FunctionCall {
   3328         GLuint indx;
   3329         const GLfloat* values;
   3330 
   3331         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3332             _c->glVertexAttrib2fv(indx, values);
   3333             return 0;
   3334         }
   3335     } caller;
   3336     caller.indx = indx;
   3337     caller.values = values;
   3338 
   3339     msg.set_arg0(indx);
   3340     msg.set_arg1(ToInt(values));
   3341 
   3342     // FIXME: check for pointer usage
   3343     msg.mutable_data()->assign(reinterpret_cast<const char *>(values), 2 * sizeof(GLfloat));
   3344     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib2fv);
   3345 }
   3346 
   3347 void Debug_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
   3348 {
   3349     glesv2debugger::Message msg;
   3350     struct : public FunctionCall {
   3351         GLuint indx;
   3352         GLfloat x;
   3353         GLfloat y;
   3354         GLfloat z;
   3355 
   3356         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3357             _c->glVertexAttrib3f(indx, x, y, z);
   3358             return 0;
   3359         }
   3360     } caller;
   3361     caller.indx = indx;
   3362     caller.x = x;
   3363     caller.y = y;
   3364     caller.z = z;
   3365 
   3366     msg.set_arg0(indx);
   3367     msg.set_arg1(ToInt(x));
   3368     msg.set_arg2(ToInt(y));
   3369     msg.set_arg3(ToInt(z));
   3370 
   3371     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib3f);
   3372 }
   3373 
   3374 void Debug_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
   3375 {
   3376     glesv2debugger::Message msg;
   3377     struct : public FunctionCall {
   3378         GLuint indx;
   3379         const GLfloat* values;
   3380 
   3381         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3382             _c->glVertexAttrib3fv(indx, values);
   3383             return 0;
   3384         }
   3385     } caller;
   3386     caller.indx = indx;
   3387     caller.values = values;
   3388 
   3389     msg.set_arg0(indx);
   3390     msg.set_arg1(ToInt(values));
   3391 
   3392     // FIXME: check for pointer usage
   3393     msg.mutable_data()->assign(reinterpret_cast<const char *>(values), 3 * sizeof(GLfloat));
   3394     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib3fv);
   3395 }
   3396 
   3397 void Debug_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
   3398 {
   3399     glesv2debugger::Message msg;
   3400     struct : public FunctionCall {
   3401         GLuint indx;
   3402         GLfloat x;
   3403         GLfloat y;
   3404         GLfloat z;
   3405         GLfloat w;
   3406 
   3407         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3408             _c->glVertexAttrib4f(indx, x, y, z, w);
   3409             return 0;
   3410         }
   3411     } caller;
   3412     caller.indx = indx;
   3413     caller.x = x;
   3414     caller.y = y;
   3415     caller.z = z;
   3416     caller.w = w;
   3417 
   3418     msg.set_arg0(indx);
   3419     msg.set_arg1(ToInt(x));
   3420     msg.set_arg2(ToInt(y));
   3421     msg.set_arg3(ToInt(z));
   3422     msg.set_arg4(ToInt(w));
   3423 
   3424     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib4f);
   3425 }
   3426 
   3427 void Debug_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
   3428 {
   3429     glesv2debugger::Message msg;
   3430     struct : public FunctionCall {
   3431         GLuint indx;
   3432         const GLfloat* values;
   3433 
   3434         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3435             _c->glVertexAttrib4fv(indx, values);
   3436             return 0;
   3437         }
   3438     } caller;
   3439     caller.indx = indx;
   3440     caller.values = values;
   3441 
   3442     msg.set_arg0(indx);
   3443     msg.set_arg1(ToInt(values));
   3444 
   3445     // FIXME: check for pointer usage
   3446     msg.mutable_data()->assign(reinterpret_cast<const char *>(values), 4 * sizeof(GLfloat));
   3447     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttrib4fv);
   3448 }
   3449 
   3450 // FIXME: this function has pointers, it should be hand written
   3451 void Debug_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
   3452 {
   3453     glesv2debugger::Message msg;
   3454     struct : public FunctionCall {
   3455         GLuint indx;
   3456         GLint size;
   3457         GLenum type;
   3458         GLboolean normalized;
   3459         GLsizei stride;
   3460         const GLvoid* ptr;
   3461 
   3462         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3463             _c->glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
   3464             getDbgContextThreadSpecific()->glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
   3465             return 0;
   3466         }
   3467     } caller;
   3468     caller.indx = indx;
   3469     caller.size = size;
   3470     caller.type = type;
   3471     caller.normalized = normalized;
   3472     caller.stride = stride;
   3473     caller.ptr = ptr;
   3474 
   3475     msg.set_arg0(indx);
   3476     msg.set_arg1(size);
   3477     msg.set_arg2(type);
   3478     msg.set_arg3(normalized);
   3479     msg.set_arg4(stride);
   3480     msg.set_arg5(ToInt(ptr));
   3481 
   3482     // FIXME: check for pointer usage
   3483     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glVertexAttribPointer);
   3484 }
   3485 
   3486 void Debug_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
   3487 {
   3488     glesv2debugger::Message msg;
   3489     struct : public FunctionCall {
   3490         GLint x;
   3491         GLint y;
   3492         GLsizei width;
   3493         GLsizei height;
   3494 
   3495         const int * operator()(gl_hooks_t::gl_t const * const _c, glesv2debugger::Message & msg) {
   3496             _c->glViewport(x, y, width, height);
   3497             return 0;
   3498         }
   3499     } caller;
   3500     caller.x = x;
   3501     caller.y = y;
   3502     caller.width = width;
   3503     caller.height = height;
   3504 
   3505     msg.set_arg0(x);
   3506     msg.set_arg1(y);
   3507     msg.set_arg2(width);
   3508     msg.set_arg3(height);
   3509 
   3510     int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_glViewport);
   3511 }
   3512 
   3513 // FIXME: the following functions should be written by hand
   3514 void Debug_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
   3515 void Debug_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
   3516 void Debug_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
   3517 void Debug_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
   3518 void Debug_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
   3519 void Debug_glGetBooleanv(GLenum pname, GLboolean* params);
   3520 void Debug_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
   3521 void Debug_glGetFloatv(GLenum pname, GLfloat* params);
   3522 void Debug_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
   3523 void Debug_glGetIntegerv(GLenum pname, GLint* params);
   3524 void Debug_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
   3525 void Debug_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
   3526 void Debug_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
   3527 void Debug_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
   3528 void Debug_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
   3529 const GLubyte* Debug_glGetString(GLenum name);
   3530 void Debug_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
   3531 void Debug_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
   3532 void Debug_glGetUniformfv(GLuint program, GLint location, GLfloat* params);
   3533 void Debug_glGetUniformiv(GLuint program, GLint location, GLint* params);
   3534 void Debug_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
   3535 void Debug_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
   3536 void Debug_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
   3537 void Debug_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
   3538 void Debug_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
   3539 void Debug_glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
   3540 void Debug_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
   3541