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 * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT.
17 */
18
19#include <cutils/log.h>
20#include <utils/Timers.h>
21#include <GLES2/gl2.h>
22
23#include "gltrace.pb.h"
24#include "gltrace_context.h"
25#include "gltrace_fixup.h"
26#include "gltrace_transport.h"
27
28namespace android {
29namespace gltrace {
30
31// Definitions for GL2 APIs
32
33void GLTrace_glActiveTexture(GLenum texture) {
34    GLMessage glmsg;
35    GLTraceContext *glContext = getGLTraceContext();
36
37    glmsg.set_function(GLMessage::glActiveTexture);
38
39    // copy argument texture
40    GLMessage_DataType *arg_texture = glmsg.add_args();
41    arg_texture->set_isarray(false);
42    arg_texture->set_type(GLMessage::DataType::ENUM);
43    arg_texture->add_intvalue((int)texture);
44
45    // call function
46    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
47    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
48    glContext->hooks->gl.glActiveTexture(texture);
49    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
50    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
51
52    void *pointerArgs[] = {
53    };
54
55    fixupGLMessage(glContext, wallStartTime, wallEndTime,
56                              threadStartTime, threadEndTime,
57                              &glmsg, pointerArgs);
58    glContext->traceGLMessage(&glmsg);
59}
60
61void GLTrace_glAttachShader(GLuint program, GLuint shader) {
62    GLMessage glmsg;
63    GLTraceContext *glContext = getGLTraceContext();
64
65    glmsg.set_function(GLMessage::glAttachShader);
66
67    // copy argument program
68    GLMessage_DataType *arg_program = glmsg.add_args();
69    arg_program->set_isarray(false);
70    arg_program->set_type(GLMessage::DataType::INT);
71    arg_program->add_intvalue(program);
72
73    // copy argument shader
74    GLMessage_DataType *arg_shader = glmsg.add_args();
75    arg_shader->set_isarray(false);
76    arg_shader->set_type(GLMessage::DataType::INT);
77    arg_shader->add_intvalue(shader);
78
79    // call function
80    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
81    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
82    glContext->hooks->gl.glAttachShader(program, shader);
83    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
84    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
85
86    void *pointerArgs[] = {
87    };
88
89    fixupGLMessage(glContext, wallStartTime, wallEndTime,
90                              threadStartTime, threadEndTime,
91                              &glmsg, pointerArgs);
92    glContext->traceGLMessage(&glmsg);
93}
94
95void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) {
96    GLMessage glmsg;
97    GLTraceContext *glContext = getGLTraceContext();
98
99    glmsg.set_function(GLMessage::glBindAttribLocation);
100
101    // copy argument program
102    GLMessage_DataType *arg_program = glmsg.add_args();
103    arg_program->set_isarray(false);
104    arg_program->set_type(GLMessage::DataType::INT);
105    arg_program->add_intvalue(program);
106
107    // copy argument index
108    GLMessage_DataType *arg_index = glmsg.add_args();
109    arg_index->set_isarray(false);
110    arg_index->set_type(GLMessage::DataType::INT);
111    arg_index->add_intvalue(index);
112
113    // copy argument name
114    GLMessage_DataType *arg_name = glmsg.add_args();
115    arg_name->set_isarray(false);
116    arg_name->set_type(GLMessage::DataType::INT);
117    arg_name->add_intvalue((int)name);
118
119    // call function
120    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
121    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
122    glContext->hooks->gl.glBindAttribLocation(program, index, name);
123    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
124    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
125
126    void *pointerArgs[] = {
127        (void *) name,
128    };
129
130    fixupGLMessage(glContext, wallStartTime, wallEndTime,
131                              threadStartTime, threadEndTime,
132                              &glmsg, pointerArgs);
133    glContext->traceGLMessage(&glmsg);
134}
135
136void GLTrace_glBindBuffer(GLenum target, GLuint buffer) {
137    GLMessage glmsg;
138    GLTraceContext *glContext = getGLTraceContext();
139
140    glmsg.set_function(GLMessage::glBindBuffer);
141
142    // copy argument target
143    GLMessage_DataType *arg_target = glmsg.add_args();
144    arg_target->set_isarray(false);
145    arg_target->set_type(GLMessage::DataType::ENUM);
146    arg_target->add_intvalue((int)target);
147
148    // copy argument buffer
149    GLMessage_DataType *arg_buffer = glmsg.add_args();
150    arg_buffer->set_isarray(false);
151    arg_buffer->set_type(GLMessage::DataType::INT);
152    arg_buffer->add_intvalue(buffer);
153
154    // call function
155    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
156    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
157    glContext->hooks->gl.glBindBuffer(target, buffer);
158    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
159    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
160
161    void *pointerArgs[] = {
162    };
163
164    fixupGLMessage(glContext, wallStartTime, wallEndTime,
165                              threadStartTime, threadEndTime,
166                              &glmsg, pointerArgs);
167    glContext->traceGLMessage(&glmsg);
168}
169
170void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer) {
171    GLMessage glmsg;
172    GLTraceContext *glContext = getGLTraceContext();
173
174    glmsg.set_function(GLMessage::glBindFramebuffer);
175
176    // copy argument target
177    GLMessage_DataType *arg_target = glmsg.add_args();
178    arg_target->set_isarray(false);
179    arg_target->set_type(GLMessage::DataType::ENUM);
180    arg_target->add_intvalue((int)target);
181
182    // copy argument framebuffer
183    GLMessage_DataType *arg_framebuffer = glmsg.add_args();
184    arg_framebuffer->set_isarray(false);
185    arg_framebuffer->set_type(GLMessage::DataType::INT);
186    arg_framebuffer->add_intvalue(framebuffer);
187
188    // call function
189    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
190    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
191    glContext->hooks->gl.glBindFramebuffer(target, framebuffer);
192    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
193    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
194
195    void *pointerArgs[] = {
196    };
197
198    fixupGLMessage(glContext, wallStartTime, wallEndTime,
199                              threadStartTime, threadEndTime,
200                              &glmsg, pointerArgs);
201    glContext->traceGLMessage(&glmsg);
202}
203
204void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer) {
205    GLMessage glmsg;
206    GLTraceContext *glContext = getGLTraceContext();
207
208    glmsg.set_function(GLMessage::glBindRenderbuffer);
209
210    // copy argument target
211    GLMessage_DataType *arg_target = glmsg.add_args();
212    arg_target->set_isarray(false);
213    arg_target->set_type(GLMessage::DataType::ENUM);
214    arg_target->add_intvalue((int)target);
215
216    // copy argument renderbuffer
217    GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
218    arg_renderbuffer->set_isarray(false);
219    arg_renderbuffer->set_type(GLMessage::DataType::INT);
220    arg_renderbuffer->add_intvalue(renderbuffer);
221
222    // call function
223    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
224    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
225    glContext->hooks->gl.glBindRenderbuffer(target, renderbuffer);
226    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
227    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
228
229    void *pointerArgs[] = {
230    };
231
232    fixupGLMessage(glContext, wallStartTime, wallEndTime,
233                              threadStartTime, threadEndTime,
234                              &glmsg, pointerArgs);
235    glContext->traceGLMessage(&glmsg);
236}
237
238void GLTrace_glBindTexture(GLenum target, GLuint texture) {
239    GLMessage glmsg;
240    GLTraceContext *glContext = getGLTraceContext();
241
242    glmsg.set_function(GLMessage::glBindTexture);
243
244    // copy argument target
245    GLMessage_DataType *arg_target = glmsg.add_args();
246    arg_target->set_isarray(false);
247    arg_target->set_type(GLMessage::DataType::ENUM);
248    arg_target->add_intvalue((int)target);
249
250    // copy argument texture
251    GLMessage_DataType *arg_texture = glmsg.add_args();
252    arg_texture->set_isarray(false);
253    arg_texture->set_type(GLMessage::DataType::INT);
254    arg_texture->add_intvalue(texture);
255
256    // call function
257    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
258    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
259    glContext->hooks->gl.glBindTexture(target, texture);
260    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
261    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
262
263    void *pointerArgs[] = {
264    };
265
266    fixupGLMessage(glContext, wallStartTime, wallEndTime,
267                              threadStartTime, threadEndTime,
268                              &glmsg, pointerArgs);
269    glContext->traceGLMessage(&glmsg);
270}
271
272void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
273    GLMessage glmsg;
274    GLTraceContext *glContext = getGLTraceContext();
275
276    glmsg.set_function(GLMessage::glBlendColor);
277
278    // copy argument red
279    GLMessage_DataType *arg_red = glmsg.add_args();
280    arg_red->set_isarray(false);
281    arg_red->set_type(GLMessage::DataType::FLOAT);
282    arg_red->add_floatvalue(red);
283
284    // copy argument green
285    GLMessage_DataType *arg_green = glmsg.add_args();
286    arg_green->set_isarray(false);
287    arg_green->set_type(GLMessage::DataType::FLOAT);
288    arg_green->add_floatvalue(green);
289
290    // copy argument blue
291    GLMessage_DataType *arg_blue = glmsg.add_args();
292    arg_blue->set_isarray(false);
293    arg_blue->set_type(GLMessage::DataType::FLOAT);
294    arg_blue->add_floatvalue(blue);
295
296    // copy argument alpha
297    GLMessage_DataType *arg_alpha = glmsg.add_args();
298    arg_alpha->set_isarray(false);
299    arg_alpha->set_type(GLMessage::DataType::FLOAT);
300    arg_alpha->add_floatvalue(alpha);
301
302    // call function
303    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
304    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
305    glContext->hooks->gl.glBlendColor(red, green, blue, alpha);
306    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
307    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
308
309    void *pointerArgs[] = {
310    };
311
312    fixupGLMessage(glContext, wallStartTime, wallEndTime,
313                              threadStartTime, threadEndTime,
314                              &glmsg, pointerArgs);
315    glContext->traceGLMessage(&glmsg);
316}
317
318void GLTrace_glBlendEquation(GLenum mode) {
319    GLMessage glmsg;
320    GLTraceContext *glContext = getGLTraceContext();
321
322    glmsg.set_function(GLMessage::glBlendEquation);
323
324    // copy argument mode
325    GLMessage_DataType *arg_mode = glmsg.add_args();
326    arg_mode->set_isarray(false);
327    arg_mode->set_type(GLMessage::DataType::ENUM);
328    arg_mode->add_intvalue((int)mode);
329
330    // call function
331    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
332    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
333    glContext->hooks->gl.glBlendEquation(mode);
334    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
335    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
336
337    void *pointerArgs[] = {
338    };
339
340    fixupGLMessage(glContext, wallStartTime, wallEndTime,
341                              threadStartTime, threadEndTime,
342                              &glmsg, pointerArgs);
343    glContext->traceGLMessage(&glmsg);
344}
345
346void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
347    GLMessage glmsg;
348    GLTraceContext *glContext = getGLTraceContext();
349
350    glmsg.set_function(GLMessage::glBlendEquationSeparate);
351
352    // copy argument modeRGB
353    GLMessage_DataType *arg_modeRGB = glmsg.add_args();
354    arg_modeRGB->set_isarray(false);
355    arg_modeRGB->set_type(GLMessage::DataType::ENUM);
356    arg_modeRGB->add_intvalue((int)modeRGB);
357
358    // copy argument modeAlpha
359    GLMessage_DataType *arg_modeAlpha = glmsg.add_args();
360    arg_modeAlpha->set_isarray(false);
361    arg_modeAlpha->set_type(GLMessage::DataType::ENUM);
362    arg_modeAlpha->add_intvalue((int)modeAlpha);
363
364    // call function
365    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
366    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
367    glContext->hooks->gl.glBlendEquationSeparate(modeRGB, modeAlpha);
368    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
369    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
370
371    void *pointerArgs[] = {
372    };
373
374    fixupGLMessage(glContext, wallStartTime, wallEndTime,
375                              threadStartTime, threadEndTime,
376                              &glmsg, pointerArgs);
377    glContext->traceGLMessage(&glmsg);
378}
379
380void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor) {
381    GLMessage glmsg;
382    GLTraceContext *glContext = getGLTraceContext();
383
384    glmsg.set_function(GLMessage::glBlendFunc);
385
386    // copy argument sfactor
387    GLMessage_DataType *arg_sfactor = glmsg.add_args();
388    arg_sfactor->set_isarray(false);
389    arg_sfactor->set_type(GLMessage::DataType::ENUM);
390    arg_sfactor->add_intvalue((int)sfactor);
391
392    // copy argument dfactor
393    GLMessage_DataType *arg_dfactor = glmsg.add_args();
394    arg_dfactor->set_isarray(false);
395    arg_dfactor->set_type(GLMessage::DataType::ENUM);
396    arg_dfactor->add_intvalue((int)dfactor);
397
398    // call function
399    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
400    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
401    glContext->hooks->gl.glBlendFunc(sfactor, dfactor);
402    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
403    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
404
405    void *pointerArgs[] = {
406    };
407
408    fixupGLMessage(glContext, wallStartTime, wallEndTime,
409                              threadStartTime, threadEndTime,
410                              &glmsg, pointerArgs);
411    glContext->traceGLMessage(&glmsg);
412}
413
414void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
415    GLMessage glmsg;
416    GLTraceContext *glContext = getGLTraceContext();
417
418    glmsg.set_function(GLMessage::glBlendFuncSeparate);
419
420    // copy argument srcRGB
421    GLMessage_DataType *arg_srcRGB = glmsg.add_args();
422    arg_srcRGB->set_isarray(false);
423    arg_srcRGB->set_type(GLMessage::DataType::ENUM);
424    arg_srcRGB->add_intvalue((int)srcRGB);
425
426    // copy argument dstRGB
427    GLMessage_DataType *arg_dstRGB = glmsg.add_args();
428    arg_dstRGB->set_isarray(false);
429    arg_dstRGB->set_type(GLMessage::DataType::ENUM);
430    arg_dstRGB->add_intvalue((int)dstRGB);
431
432    // copy argument srcAlpha
433    GLMessage_DataType *arg_srcAlpha = glmsg.add_args();
434    arg_srcAlpha->set_isarray(false);
435    arg_srcAlpha->set_type(GLMessage::DataType::ENUM);
436    arg_srcAlpha->add_intvalue((int)srcAlpha);
437
438    // copy argument dstAlpha
439    GLMessage_DataType *arg_dstAlpha = glmsg.add_args();
440    arg_dstAlpha->set_isarray(false);
441    arg_dstAlpha->set_type(GLMessage::DataType::ENUM);
442    arg_dstAlpha->add_intvalue((int)dstAlpha);
443
444    // call function
445    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
446    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
447    glContext->hooks->gl.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
448    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
449    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
450
451    void *pointerArgs[] = {
452    };
453
454    fixupGLMessage(glContext, wallStartTime, wallEndTime,
455                              threadStartTime, threadEndTime,
456                              &glmsg, pointerArgs);
457    glContext->traceGLMessage(&glmsg);
458}
459
460void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
461    GLMessage glmsg;
462    GLTraceContext *glContext = getGLTraceContext();
463
464    glmsg.set_function(GLMessage::glBufferData);
465
466    // copy argument target
467    GLMessage_DataType *arg_target = glmsg.add_args();
468    arg_target->set_isarray(false);
469    arg_target->set_type(GLMessage::DataType::ENUM);
470    arg_target->add_intvalue((int)target);
471
472    // copy argument size
473    GLMessage_DataType *arg_size = glmsg.add_args();
474    arg_size->set_isarray(false);
475    arg_size->set_type(GLMessage::DataType::INT);
476    arg_size->add_intvalue(size);
477
478    // copy argument data
479    GLMessage_DataType *arg_data = glmsg.add_args();
480    arg_data->set_isarray(false);
481    arg_data->set_type(GLMessage::DataType::INT);
482    arg_data->add_intvalue((int)data);
483
484    // copy argument usage
485    GLMessage_DataType *arg_usage = glmsg.add_args();
486    arg_usage->set_isarray(false);
487    arg_usage->set_type(GLMessage::DataType::ENUM);
488    arg_usage->add_intvalue((int)usage);
489
490    // call function
491    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
492    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
493    glContext->hooks->gl.glBufferData(target, size, data, usage);
494    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
495    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
496
497    void *pointerArgs[] = {
498        (void *) data,
499    };
500
501    fixupGLMessage(glContext, wallStartTime, wallEndTime,
502                              threadStartTime, threadEndTime,
503                              &glmsg, pointerArgs);
504    glContext->traceGLMessage(&glmsg);
505}
506
507void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
508    GLMessage glmsg;
509    GLTraceContext *glContext = getGLTraceContext();
510
511    glmsg.set_function(GLMessage::glBufferSubData);
512
513    // copy argument target
514    GLMessage_DataType *arg_target = glmsg.add_args();
515    arg_target->set_isarray(false);
516    arg_target->set_type(GLMessage::DataType::ENUM);
517    arg_target->add_intvalue((int)target);
518
519    // copy argument offset
520    GLMessage_DataType *arg_offset = glmsg.add_args();
521    arg_offset->set_isarray(false);
522    arg_offset->set_type(GLMessage::DataType::INT);
523    arg_offset->add_intvalue(offset);
524
525    // copy argument size
526    GLMessage_DataType *arg_size = glmsg.add_args();
527    arg_size->set_isarray(false);
528    arg_size->set_type(GLMessage::DataType::INT);
529    arg_size->add_intvalue(size);
530
531    // copy argument data
532    GLMessage_DataType *arg_data = glmsg.add_args();
533    arg_data->set_isarray(false);
534    arg_data->set_type(GLMessage::DataType::INT);
535    arg_data->add_intvalue((int)data);
536
537    // call function
538    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
539    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
540    glContext->hooks->gl.glBufferSubData(target, offset, size, data);
541    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
542    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
543
544    void *pointerArgs[] = {
545        (void *) data,
546    };
547
548    fixupGLMessage(glContext, wallStartTime, wallEndTime,
549                              threadStartTime, threadEndTime,
550                              &glmsg, pointerArgs);
551    glContext->traceGLMessage(&glmsg);
552}
553
554GLenum GLTrace_glCheckFramebufferStatus(GLenum target) {
555    GLMessage glmsg;
556    GLTraceContext *glContext = getGLTraceContext();
557
558    glmsg.set_function(GLMessage::glCheckFramebufferStatus);
559
560    // copy argument target
561    GLMessage_DataType *arg_target = glmsg.add_args();
562    arg_target->set_isarray(false);
563    arg_target->set_type(GLMessage::DataType::ENUM);
564    arg_target->add_intvalue((int)target);
565
566    // call function
567    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
568    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
569    GLenum retValue = glContext->hooks->gl.glCheckFramebufferStatus(target);
570    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
571    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
572
573    // set return value
574    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
575    rt->set_isarray(false);
576    rt->set_type(GLMessage::DataType::ENUM);
577    rt->add_intvalue((int)retValue);
578
579    void *pointerArgs[] = {
580    };
581
582    fixupGLMessage(glContext, wallStartTime, wallEndTime,
583                              threadStartTime, threadEndTime,
584                              &glmsg, pointerArgs);
585    glContext->traceGLMessage(&glmsg);
586
587    return retValue;
588}
589
590void GLTrace_glClear(GLbitfield mask) {
591    GLMessage glmsg;
592    GLTraceContext *glContext = getGLTraceContext();
593
594    glmsg.set_function(GLMessage::glClear);
595
596    // copy argument mask
597    GLMessage_DataType *arg_mask = glmsg.add_args();
598    arg_mask->set_isarray(false);
599    arg_mask->set_type(GLMessage::DataType::INT);
600    arg_mask->add_intvalue(mask);
601
602    // call function
603    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
604    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
605    glContext->hooks->gl.glClear(mask);
606    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
607    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
608
609    void *pointerArgs[] = {
610    };
611
612    fixupGLMessage(glContext, wallStartTime, wallEndTime,
613                              threadStartTime, threadEndTime,
614                              &glmsg, pointerArgs);
615    glContext->traceGLMessage(&glmsg);
616}
617
618void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
619    GLMessage glmsg;
620    GLTraceContext *glContext = getGLTraceContext();
621
622    glmsg.set_function(GLMessage::glClearColor);
623
624    // copy argument red
625    GLMessage_DataType *arg_red = glmsg.add_args();
626    arg_red->set_isarray(false);
627    arg_red->set_type(GLMessage::DataType::FLOAT);
628    arg_red->add_floatvalue(red);
629
630    // copy argument green
631    GLMessage_DataType *arg_green = glmsg.add_args();
632    arg_green->set_isarray(false);
633    arg_green->set_type(GLMessage::DataType::FLOAT);
634    arg_green->add_floatvalue(green);
635
636    // copy argument blue
637    GLMessage_DataType *arg_blue = glmsg.add_args();
638    arg_blue->set_isarray(false);
639    arg_blue->set_type(GLMessage::DataType::FLOAT);
640    arg_blue->add_floatvalue(blue);
641
642    // copy argument alpha
643    GLMessage_DataType *arg_alpha = glmsg.add_args();
644    arg_alpha->set_isarray(false);
645    arg_alpha->set_type(GLMessage::DataType::FLOAT);
646    arg_alpha->add_floatvalue(alpha);
647
648    // call function
649    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
650    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
651    glContext->hooks->gl.glClearColor(red, green, blue, alpha);
652    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
653    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
654
655    void *pointerArgs[] = {
656    };
657
658    fixupGLMessage(glContext, wallStartTime, wallEndTime,
659                              threadStartTime, threadEndTime,
660                              &glmsg, pointerArgs);
661    glContext->traceGLMessage(&glmsg);
662}
663
664void GLTrace_glClearDepthf(GLclampf depth) {
665    GLMessage glmsg;
666    GLTraceContext *glContext = getGLTraceContext();
667
668    glmsg.set_function(GLMessage::glClearDepthf);
669
670    // copy argument depth
671    GLMessage_DataType *arg_depth = glmsg.add_args();
672    arg_depth->set_isarray(false);
673    arg_depth->set_type(GLMessage::DataType::FLOAT);
674    arg_depth->add_floatvalue(depth);
675
676    // call function
677    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
678    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
679    glContext->hooks->gl.glClearDepthf(depth);
680    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
681    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
682
683    void *pointerArgs[] = {
684    };
685
686    fixupGLMessage(glContext, wallStartTime, wallEndTime,
687                              threadStartTime, threadEndTime,
688                              &glmsg, pointerArgs);
689    glContext->traceGLMessage(&glmsg);
690}
691
692void GLTrace_glClearStencil(GLint s) {
693    GLMessage glmsg;
694    GLTraceContext *glContext = getGLTraceContext();
695
696    glmsg.set_function(GLMessage::glClearStencil);
697
698    // copy argument s
699    GLMessage_DataType *arg_s = glmsg.add_args();
700    arg_s->set_isarray(false);
701    arg_s->set_type(GLMessage::DataType::INT);
702    arg_s->add_intvalue(s);
703
704    // call function
705    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
706    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
707    glContext->hooks->gl.glClearStencil(s);
708    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
709    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
710
711    void *pointerArgs[] = {
712    };
713
714    fixupGLMessage(glContext, wallStartTime, wallEndTime,
715                              threadStartTime, threadEndTime,
716                              &glmsg, pointerArgs);
717    glContext->traceGLMessage(&glmsg);
718}
719
720void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
721    GLMessage glmsg;
722    GLTraceContext *glContext = getGLTraceContext();
723
724    glmsg.set_function(GLMessage::glColorMask);
725
726    // copy argument red
727    GLMessage_DataType *arg_red = glmsg.add_args();
728    arg_red->set_isarray(false);
729    arg_red->set_type(GLMessage::DataType::BOOL);
730    arg_red->add_boolvalue(red);
731
732    // copy argument green
733    GLMessage_DataType *arg_green = glmsg.add_args();
734    arg_green->set_isarray(false);
735    arg_green->set_type(GLMessage::DataType::BOOL);
736    arg_green->add_boolvalue(green);
737
738    // copy argument blue
739    GLMessage_DataType *arg_blue = glmsg.add_args();
740    arg_blue->set_isarray(false);
741    arg_blue->set_type(GLMessage::DataType::BOOL);
742    arg_blue->add_boolvalue(blue);
743
744    // copy argument alpha
745    GLMessage_DataType *arg_alpha = glmsg.add_args();
746    arg_alpha->set_isarray(false);
747    arg_alpha->set_type(GLMessage::DataType::BOOL);
748    arg_alpha->add_boolvalue(alpha);
749
750    // call function
751    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
752    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
753    glContext->hooks->gl.glColorMask(red, green, blue, alpha);
754    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
755    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
756
757    void *pointerArgs[] = {
758    };
759
760    fixupGLMessage(glContext, wallStartTime, wallEndTime,
761                              threadStartTime, threadEndTime,
762                              &glmsg, pointerArgs);
763    glContext->traceGLMessage(&glmsg);
764}
765
766void GLTrace_glCompileShader(GLuint shader) {
767    GLMessage glmsg;
768    GLTraceContext *glContext = getGLTraceContext();
769
770    glmsg.set_function(GLMessage::glCompileShader);
771
772    // copy argument shader
773    GLMessage_DataType *arg_shader = glmsg.add_args();
774    arg_shader->set_isarray(false);
775    arg_shader->set_type(GLMessage::DataType::INT);
776    arg_shader->add_intvalue(shader);
777
778    // call function
779    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
780    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
781    glContext->hooks->gl.glCompileShader(shader);
782    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
783    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
784
785    void *pointerArgs[] = {
786    };
787
788    fixupGLMessage(glContext, wallStartTime, wallEndTime,
789                              threadStartTime, threadEndTime,
790                              &glmsg, pointerArgs);
791    glContext->traceGLMessage(&glmsg);
792}
793
794void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) {
795    GLMessage glmsg;
796    GLTraceContext *glContext = getGLTraceContext();
797
798    glmsg.set_function(GLMessage::glCompressedTexImage2D);
799
800    // copy argument target
801    GLMessage_DataType *arg_target = glmsg.add_args();
802    arg_target->set_isarray(false);
803    arg_target->set_type(GLMessage::DataType::ENUM);
804    arg_target->add_intvalue((int)target);
805
806    // copy argument level
807    GLMessage_DataType *arg_level = glmsg.add_args();
808    arg_level->set_isarray(false);
809    arg_level->set_type(GLMessage::DataType::INT);
810    arg_level->add_intvalue(level);
811
812    // copy argument internalformat
813    GLMessage_DataType *arg_internalformat = glmsg.add_args();
814    arg_internalformat->set_isarray(false);
815    arg_internalformat->set_type(GLMessage::DataType::ENUM);
816    arg_internalformat->add_intvalue((int)internalformat);
817
818    // copy argument width
819    GLMessage_DataType *arg_width = glmsg.add_args();
820    arg_width->set_isarray(false);
821    arg_width->set_type(GLMessage::DataType::INT);
822    arg_width->add_intvalue(width);
823
824    // copy argument height
825    GLMessage_DataType *arg_height = glmsg.add_args();
826    arg_height->set_isarray(false);
827    arg_height->set_type(GLMessage::DataType::INT);
828    arg_height->add_intvalue(height);
829
830    // copy argument border
831    GLMessage_DataType *arg_border = glmsg.add_args();
832    arg_border->set_isarray(false);
833    arg_border->set_type(GLMessage::DataType::INT);
834    arg_border->add_intvalue(border);
835
836    // copy argument imageSize
837    GLMessage_DataType *arg_imageSize = glmsg.add_args();
838    arg_imageSize->set_isarray(false);
839    arg_imageSize->set_type(GLMessage::DataType::INT);
840    arg_imageSize->add_intvalue(imageSize);
841
842    // copy argument data
843    GLMessage_DataType *arg_data = glmsg.add_args();
844    arg_data->set_isarray(false);
845    arg_data->set_type(GLMessage::DataType::INT);
846    arg_data->add_intvalue((int)data);
847
848    // call function
849    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
850    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
851    glContext->hooks->gl.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
852    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
853    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
854
855    void *pointerArgs[] = {
856        (void *) data,
857    };
858
859    fixupGLMessage(glContext, wallStartTime, wallEndTime,
860                              threadStartTime, threadEndTime,
861                              &glmsg, pointerArgs);
862    glContext->traceGLMessage(&glmsg);
863}
864
865void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) {
866    GLMessage glmsg;
867    GLTraceContext *glContext = getGLTraceContext();
868
869    glmsg.set_function(GLMessage::glCompressedTexSubImage2D);
870
871    // copy argument target
872    GLMessage_DataType *arg_target = glmsg.add_args();
873    arg_target->set_isarray(false);
874    arg_target->set_type(GLMessage::DataType::ENUM);
875    arg_target->add_intvalue((int)target);
876
877    // copy argument level
878    GLMessage_DataType *arg_level = glmsg.add_args();
879    arg_level->set_isarray(false);
880    arg_level->set_type(GLMessage::DataType::INT);
881    arg_level->add_intvalue(level);
882
883    // copy argument xoffset
884    GLMessage_DataType *arg_xoffset = glmsg.add_args();
885    arg_xoffset->set_isarray(false);
886    arg_xoffset->set_type(GLMessage::DataType::INT);
887    arg_xoffset->add_intvalue(xoffset);
888
889    // copy argument yoffset
890    GLMessage_DataType *arg_yoffset = glmsg.add_args();
891    arg_yoffset->set_isarray(false);
892    arg_yoffset->set_type(GLMessage::DataType::INT);
893    arg_yoffset->add_intvalue(yoffset);
894
895    // copy argument width
896    GLMessage_DataType *arg_width = glmsg.add_args();
897    arg_width->set_isarray(false);
898    arg_width->set_type(GLMessage::DataType::INT);
899    arg_width->add_intvalue(width);
900
901    // copy argument height
902    GLMessage_DataType *arg_height = glmsg.add_args();
903    arg_height->set_isarray(false);
904    arg_height->set_type(GLMessage::DataType::INT);
905    arg_height->add_intvalue(height);
906
907    // copy argument format
908    GLMessage_DataType *arg_format = glmsg.add_args();
909    arg_format->set_isarray(false);
910    arg_format->set_type(GLMessage::DataType::ENUM);
911    arg_format->add_intvalue((int)format);
912
913    // copy argument imageSize
914    GLMessage_DataType *arg_imageSize = glmsg.add_args();
915    arg_imageSize->set_isarray(false);
916    arg_imageSize->set_type(GLMessage::DataType::INT);
917    arg_imageSize->add_intvalue(imageSize);
918
919    // copy argument data
920    GLMessage_DataType *arg_data = glmsg.add_args();
921    arg_data->set_isarray(false);
922    arg_data->set_type(GLMessage::DataType::INT);
923    arg_data->add_intvalue((int)data);
924
925    // call function
926    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
927    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
928    glContext->hooks->gl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
929    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
930    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
931
932    void *pointerArgs[] = {
933        (void *) data,
934    };
935
936    fixupGLMessage(glContext, wallStartTime, wallEndTime,
937                              threadStartTime, threadEndTime,
938                              &glmsg, pointerArgs);
939    glContext->traceGLMessage(&glmsg);
940}
941
942void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
943    GLMessage glmsg;
944    GLTraceContext *glContext = getGLTraceContext();
945
946    glmsg.set_function(GLMessage::glCopyTexImage2D);
947
948    // copy argument target
949    GLMessage_DataType *arg_target = glmsg.add_args();
950    arg_target->set_isarray(false);
951    arg_target->set_type(GLMessage::DataType::ENUM);
952    arg_target->add_intvalue((int)target);
953
954    // copy argument level
955    GLMessage_DataType *arg_level = glmsg.add_args();
956    arg_level->set_isarray(false);
957    arg_level->set_type(GLMessage::DataType::INT);
958    arg_level->add_intvalue(level);
959
960    // copy argument internalformat
961    GLMessage_DataType *arg_internalformat = glmsg.add_args();
962    arg_internalformat->set_isarray(false);
963    arg_internalformat->set_type(GLMessage::DataType::ENUM);
964    arg_internalformat->add_intvalue((int)internalformat);
965
966    // copy argument x
967    GLMessage_DataType *arg_x = glmsg.add_args();
968    arg_x->set_isarray(false);
969    arg_x->set_type(GLMessage::DataType::INT);
970    arg_x->add_intvalue(x);
971
972    // copy argument y
973    GLMessage_DataType *arg_y = glmsg.add_args();
974    arg_y->set_isarray(false);
975    arg_y->set_type(GLMessage::DataType::INT);
976    arg_y->add_intvalue(y);
977
978    // copy argument width
979    GLMessage_DataType *arg_width = glmsg.add_args();
980    arg_width->set_isarray(false);
981    arg_width->set_type(GLMessage::DataType::INT);
982    arg_width->add_intvalue(width);
983
984    // copy argument height
985    GLMessage_DataType *arg_height = glmsg.add_args();
986    arg_height->set_isarray(false);
987    arg_height->set_type(GLMessage::DataType::INT);
988    arg_height->add_intvalue(height);
989
990    // copy argument border
991    GLMessage_DataType *arg_border = glmsg.add_args();
992    arg_border->set_isarray(false);
993    arg_border->set_type(GLMessage::DataType::INT);
994    arg_border->add_intvalue(border);
995
996    // call function
997    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
998    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
999    glContext->hooks->gl.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
1000    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1001    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1002
1003    void *pointerArgs[] = {
1004    };
1005
1006    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1007                              threadStartTime, threadEndTime,
1008                              &glmsg, pointerArgs);
1009    glContext->traceGLMessage(&glmsg);
1010}
1011
1012void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
1013    GLMessage glmsg;
1014    GLTraceContext *glContext = getGLTraceContext();
1015
1016    glmsg.set_function(GLMessage::glCopyTexSubImage2D);
1017
1018    // copy argument target
1019    GLMessage_DataType *arg_target = glmsg.add_args();
1020    arg_target->set_isarray(false);
1021    arg_target->set_type(GLMessage::DataType::ENUM);
1022    arg_target->add_intvalue((int)target);
1023
1024    // copy argument level
1025    GLMessage_DataType *arg_level = glmsg.add_args();
1026    arg_level->set_isarray(false);
1027    arg_level->set_type(GLMessage::DataType::INT);
1028    arg_level->add_intvalue(level);
1029
1030    // copy argument xoffset
1031    GLMessage_DataType *arg_xoffset = glmsg.add_args();
1032    arg_xoffset->set_isarray(false);
1033    arg_xoffset->set_type(GLMessage::DataType::INT);
1034    arg_xoffset->add_intvalue(xoffset);
1035
1036    // copy argument yoffset
1037    GLMessage_DataType *arg_yoffset = glmsg.add_args();
1038    arg_yoffset->set_isarray(false);
1039    arg_yoffset->set_type(GLMessage::DataType::INT);
1040    arg_yoffset->add_intvalue(yoffset);
1041
1042    // copy argument x
1043    GLMessage_DataType *arg_x = glmsg.add_args();
1044    arg_x->set_isarray(false);
1045    arg_x->set_type(GLMessage::DataType::INT);
1046    arg_x->add_intvalue(x);
1047
1048    // copy argument y
1049    GLMessage_DataType *arg_y = glmsg.add_args();
1050    arg_y->set_isarray(false);
1051    arg_y->set_type(GLMessage::DataType::INT);
1052    arg_y->add_intvalue(y);
1053
1054    // copy argument width
1055    GLMessage_DataType *arg_width = glmsg.add_args();
1056    arg_width->set_isarray(false);
1057    arg_width->set_type(GLMessage::DataType::INT);
1058    arg_width->add_intvalue(width);
1059
1060    // copy argument height
1061    GLMessage_DataType *arg_height = glmsg.add_args();
1062    arg_height->set_isarray(false);
1063    arg_height->set_type(GLMessage::DataType::INT);
1064    arg_height->add_intvalue(height);
1065
1066    // call function
1067    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1068    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1069    glContext->hooks->gl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
1070    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1071    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1072
1073    void *pointerArgs[] = {
1074    };
1075
1076    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1077                              threadStartTime, threadEndTime,
1078                              &glmsg, pointerArgs);
1079    glContext->traceGLMessage(&glmsg);
1080}
1081
1082GLuint GLTrace_glCreateProgram(void) {
1083    GLMessage glmsg;
1084    GLTraceContext *glContext = getGLTraceContext();
1085
1086    glmsg.set_function(GLMessage::glCreateProgram);
1087
1088    // call function
1089    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1090    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1091    GLuint retValue = glContext->hooks->gl.glCreateProgram();
1092    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1093    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1094
1095    // set return value
1096    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
1097    rt->set_isarray(false);
1098    rt->set_type(GLMessage::DataType::INT);
1099    rt->add_intvalue(retValue);
1100
1101    void *pointerArgs[] = {
1102    };
1103
1104    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1105                              threadStartTime, threadEndTime,
1106                              &glmsg, pointerArgs);
1107    glContext->traceGLMessage(&glmsg);
1108
1109    return retValue;
1110}
1111
1112GLuint GLTrace_glCreateShader(GLenum type) {
1113    GLMessage glmsg;
1114    GLTraceContext *glContext = getGLTraceContext();
1115
1116    glmsg.set_function(GLMessage::glCreateShader);
1117
1118    // copy argument type
1119    GLMessage_DataType *arg_type = glmsg.add_args();
1120    arg_type->set_isarray(false);
1121    arg_type->set_type(GLMessage::DataType::ENUM);
1122    arg_type->add_intvalue((int)type);
1123
1124    // call function
1125    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1126    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1127    GLuint retValue = glContext->hooks->gl.glCreateShader(type);
1128    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1129    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1130
1131    // set return value
1132    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
1133    rt->set_isarray(false);
1134    rt->set_type(GLMessage::DataType::INT);
1135    rt->add_intvalue(retValue);
1136
1137    void *pointerArgs[] = {
1138    };
1139
1140    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1141                              threadStartTime, threadEndTime,
1142                              &glmsg, pointerArgs);
1143    glContext->traceGLMessage(&glmsg);
1144
1145    return retValue;
1146}
1147
1148void GLTrace_glCullFace(GLenum mode) {
1149    GLMessage glmsg;
1150    GLTraceContext *glContext = getGLTraceContext();
1151
1152    glmsg.set_function(GLMessage::glCullFace);
1153
1154    // copy argument mode
1155    GLMessage_DataType *arg_mode = glmsg.add_args();
1156    arg_mode->set_isarray(false);
1157    arg_mode->set_type(GLMessage::DataType::ENUM);
1158    arg_mode->add_intvalue((int)mode);
1159
1160    // call function
1161    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1162    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1163    glContext->hooks->gl.glCullFace(mode);
1164    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1165    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1166
1167    void *pointerArgs[] = {
1168    };
1169
1170    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1171                              threadStartTime, threadEndTime,
1172                              &glmsg, pointerArgs);
1173    glContext->traceGLMessage(&glmsg);
1174}
1175
1176void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers) {
1177    GLMessage glmsg;
1178    GLTraceContext *glContext = getGLTraceContext();
1179
1180    glmsg.set_function(GLMessage::glDeleteBuffers);
1181
1182    // copy argument n
1183    GLMessage_DataType *arg_n = glmsg.add_args();
1184    arg_n->set_isarray(false);
1185    arg_n->set_type(GLMessage::DataType::INT);
1186    arg_n->add_intvalue(n);
1187
1188    // copy argument buffers
1189    GLMessage_DataType *arg_buffers = glmsg.add_args();
1190    arg_buffers->set_isarray(false);
1191    arg_buffers->set_type(GLMessage::DataType::INT);
1192    arg_buffers->add_intvalue((int)buffers);
1193
1194    // call function
1195    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1196    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1197    glContext->hooks->gl.glDeleteBuffers(n, buffers);
1198    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1199    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1200
1201    void *pointerArgs[] = {
1202        (void *) buffers,
1203    };
1204
1205    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1206                              threadStartTime, threadEndTime,
1207                              &glmsg, pointerArgs);
1208    glContext->traceGLMessage(&glmsg);
1209}
1210
1211void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
1212    GLMessage glmsg;
1213    GLTraceContext *glContext = getGLTraceContext();
1214
1215    glmsg.set_function(GLMessage::glDeleteFramebuffers);
1216
1217    // copy argument n
1218    GLMessage_DataType *arg_n = glmsg.add_args();
1219    arg_n->set_isarray(false);
1220    arg_n->set_type(GLMessage::DataType::INT);
1221    arg_n->add_intvalue(n);
1222
1223    // copy argument framebuffers
1224    GLMessage_DataType *arg_framebuffers = glmsg.add_args();
1225    arg_framebuffers->set_isarray(false);
1226    arg_framebuffers->set_type(GLMessage::DataType::INT);
1227    arg_framebuffers->add_intvalue((int)framebuffers);
1228
1229    // call function
1230    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1231    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1232    glContext->hooks->gl.glDeleteFramebuffers(n, framebuffers);
1233    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1234    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1235
1236    void *pointerArgs[] = {
1237        (void *) framebuffers,
1238    };
1239
1240    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1241                              threadStartTime, threadEndTime,
1242                              &glmsg, pointerArgs);
1243    glContext->traceGLMessage(&glmsg);
1244}
1245
1246void GLTrace_glDeleteProgram(GLuint program) {
1247    GLMessage glmsg;
1248    GLTraceContext *glContext = getGLTraceContext();
1249
1250    glmsg.set_function(GLMessage::glDeleteProgram);
1251
1252    // copy argument program
1253    GLMessage_DataType *arg_program = glmsg.add_args();
1254    arg_program->set_isarray(false);
1255    arg_program->set_type(GLMessage::DataType::INT);
1256    arg_program->add_intvalue(program);
1257
1258    // call function
1259    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1260    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1261    glContext->hooks->gl.glDeleteProgram(program);
1262    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1263    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1264
1265    void *pointerArgs[] = {
1266    };
1267
1268    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1269                              threadStartTime, threadEndTime,
1270                              &glmsg, pointerArgs);
1271    glContext->traceGLMessage(&glmsg);
1272}
1273
1274void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
1275    GLMessage glmsg;
1276    GLTraceContext *glContext = getGLTraceContext();
1277
1278    glmsg.set_function(GLMessage::glDeleteRenderbuffers);
1279
1280    // copy argument n
1281    GLMessage_DataType *arg_n = glmsg.add_args();
1282    arg_n->set_isarray(false);
1283    arg_n->set_type(GLMessage::DataType::INT);
1284    arg_n->add_intvalue(n);
1285
1286    // copy argument renderbuffers
1287    GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
1288    arg_renderbuffers->set_isarray(false);
1289    arg_renderbuffers->set_type(GLMessage::DataType::INT);
1290    arg_renderbuffers->add_intvalue((int)renderbuffers);
1291
1292    // call function
1293    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1294    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1295    glContext->hooks->gl.glDeleteRenderbuffers(n, renderbuffers);
1296    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1297    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1298
1299    void *pointerArgs[] = {
1300        (void *) renderbuffers,
1301    };
1302
1303    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1304                              threadStartTime, threadEndTime,
1305                              &glmsg, pointerArgs);
1306    glContext->traceGLMessage(&glmsg);
1307}
1308
1309void GLTrace_glDeleteShader(GLuint shader) {
1310    GLMessage glmsg;
1311    GLTraceContext *glContext = getGLTraceContext();
1312
1313    glmsg.set_function(GLMessage::glDeleteShader);
1314
1315    // copy argument shader
1316    GLMessage_DataType *arg_shader = glmsg.add_args();
1317    arg_shader->set_isarray(false);
1318    arg_shader->set_type(GLMessage::DataType::INT);
1319    arg_shader->add_intvalue(shader);
1320
1321    // call function
1322    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1323    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1324    glContext->hooks->gl.glDeleteShader(shader);
1325    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1326    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1327
1328    void *pointerArgs[] = {
1329    };
1330
1331    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1332                              threadStartTime, threadEndTime,
1333                              &glmsg, pointerArgs);
1334    glContext->traceGLMessage(&glmsg);
1335}
1336
1337void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures) {
1338    GLMessage glmsg;
1339    GLTraceContext *glContext = getGLTraceContext();
1340
1341    glmsg.set_function(GLMessage::glDeleteTextures);
1342
1343    // copy argument n
1344    GLMessage_DataType *arg_n = glmsg.add_args();
1345    arg_n->set_isarray(false);
1346    arg_n->set_type(GLMessage::DataType::INT);
1347    arg_n->add_intvalue(n);
1348
1349    // copy argument textures
1350    GLMessage_DataType *arg_textures = glmsg.add_args();
1351    arg_textures->set_isarray(false);
1352    arg_textures->set_type(GLMessage::DataType::INT);
1353    arg_textures->add_intvalue((int)textures);
1354
1355    // call function
1356    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1357    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1358    glContext->hooks->gl.glDeleteTextures(n, textures);
1359    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1360    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1361
1362    void *pointerArgs[] = {
1363        (void *) textures,
1364    };
1365
1366    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1367                              threadStartTime, threadEndTime,
1368                              &glmsg, pointerArgs);
1369    glContext->traceGLMessage(&glmsg);
1370}
1371
1372void GLTrace_glDepthFunc(GLenum func) {
1373    GLMessage glmsg;
1374    GLTraceContext *glContext = getGLTraceContext();
1375
1376    glmsg.set_function(GLMessage::glDepthFunc);
1377
1378    // copy argument func
1379    GLMessage_DataType *arg_func = glmsg.add_args();
1380    arg_func->set_isarray(false);
1381    arg_func->set_type(GLMessage::DataType::ENUM);
1382    arg_func->add_intvalue((int)func);
1383
1384    // call function
1385    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1386    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1387    glContext->hooks->gl.glDepthFunc(func);
1388    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1389    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1390
1391    void *pointerArgs[] = {
1392    };
1393
1394    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1395                              threadStartTime, threadEndTime,
1396                              &glmsg, pointerArgs);
1397    glContext->traceGLMessage(&glmsg);
1398}
1399
1400void GLTrace_glDepthMask(GLboolean flag) {
1401    GLMessage glmsg;
1402    GLTraceContext *glContext = getGLTraceContext();
1403
1404    glmsg.set_function(GLMessage::glDepthMask);
1405
1406    // copy argument flag
1407    GLMessage_DataType *arg_flag = glmsg.add_args();
1408    arg_flag->set_isarray(false);
1409    arg_flag->set_type(GLMessage::DataType::BOOL);
1410    arg_flag->add_boolvalue(flag);
1411
1412    // call function
1413    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1414    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1415    glContext->hooks->gl.glDepthMask(flag);
1416    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1417    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1418
1419    void *pointerArgs[] = {
1420    };
1421
1422    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1423                              threadStartTime, threadEndTime,
1424                              &glmsg, pointerArgs);
1425    glContext->traceGLMessage(&glmsg);
1426}
1427
1428void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar) {
1429    GLMessage glmsg;
1430    GLTraceContext *glContext = getGLTraceContext();
1431
1432    glmsg.set_function(GLMessage::glDepthRangef);
1433
1434    // copy argument zNear
1435    GLMessage_DataType *arg_zNear = glmsg.add_args();
1436    arg_zNear->set_isarray(false);
1437    arg_zNear->set_type(GLMessage::DataType::FLOAT);
1438    arg_zNear->add_floatvalue(zNear);
1439
1440    // copy argument zFar
1441    GLMessage_DataType *arg_zFar = glmsg.add_args();
1442    arg_zFar->set_isarray(false);
1443    arg_zFar->set_type(GLMessage::DataType::FLOAT);
1444    arg_zFar->add_floatvalue(zFar);
1445
1446    // call function
1447    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1448    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1449    glContext->hooks->gl.glDepthRangef(zNear, zFar);
1450    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1451    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1452
1453    void *pointerArgs[] = {
1454    };
1455
1456    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1457                              threadStartTime, threadEndTime,
1458                              &glmsg, pointerArgs);
1459    glContext->traceGLMessage(&glmsg);
1460}
1461
1462void GLTrace_glDetachShader(GLuint program, GLuint shader) {
1463    GLMessage glmsg;
1464    GLTraceContext *glContext = getGLTraceContext();
1465
1466    glmsg.set_function(GLMessage::glDetachShader);
1467
1468    // copy argument program
1469    GLMessage_DataType *arg_program = glmsg.add_args();
1470    arg_program->set_isarray(false);
1471    arg_program->set_type(GLMessage::DataType::INT);
1472    arg_program->add_intvalue(program);
1473
1474    // copy argument shader
1475    GLMessage_DataType *arg_shader = glmsg.add_args();
1476    arg_shader->set_isarray(false);
1477    arg_shader->set_type(GLMessage::DataType::INT);
1478    arg_shader->add_intvalue(shader);
1479
1480    // call function
1481    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1482    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1483    glContext->hooks->gl.glDetachShader(program, shader);
1484    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1485    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1486
1487    void *pointerArgs[] = {
1488    };
1489
1490    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1491                              threadStartTime, threadEndTime,
1492                              &glmsg, pointerArgs);
1493    glContext->traceGLMessage(&glmsg);
1494}
1495
1496void GLTrace_glDisable(GLenum cap) {
1497    GLMessage glmsg;
1498    GLTraceContext *glContext = getGLTraceContext();
1499
1500    glmsg.set_function(GLMessage::glDisable);
1501
1502    // copy argument cap
1503    GLMessage_DataType *arg_cap = glmsg.add_args();
1504    arg_cap->set_isarray(false);
1505    arg_cap->set_type(GLMessage::DataType::ENUM);
1506    arg_cap->add_intvalue((int)cap);
1507
1508    // call function
1509    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1510    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1511    glContext->hooks->gl.glDisable(cap);
1512    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1513    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1514
1515    void *pointerArgs[] = {
1516    };
1517
1518    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1519                              threadStartTime, threadEndTime,
1520                              &glmsg, pointerArgs);
1521    glContext->traceGLMessage(&glmsg);
1522}
1523
1524void GLTrace_glDisableVertexAttribArray(GLuint index) {
1525    GLMessage glmsg;
1526    GLTraceContext *glContext = getGLTraceContext();
1527
1528    glmsg.set_function(GLMessage::glDisableVertexAttribArray);
1529
1530    // copy argument index
1531    GLMessage_DataType *arg_index = glmsg.add_args();
1532    arg_index->set_isarray(false);
1533    arg_index->set_type(GLMessage::DataType::INT);
1534    arg_index->add_intvalue(index);
1535
1536    // call function
1537    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1538    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1539    glContext->hooks->gl.glDisableVertexAttribArray(index);
1540    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1541    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1542
1543    void *pointerArgs[] = {
1544    };
1545
1546    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1547                              threadStartTime, threadEndTime,
1548                              &glmsg, pointerArgs);
1549    glContext->traceGLMessage(&glmsg);
1550}
1551
1552void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count) {
1553    GLMessage glmsg;
1554    GLTraceContext *glContext = getGLTraceContext();
1555
1556    glmsg.set_function(GLMessage::glDrawArrays);
1557
1558    // copy argument mode
1559    GLMessage_DataType *arg_mode = glmsg.add_args();
1560    arg_mode->set_isarray(false);
1561    arg_mode->set_type(GLMessage::DataType::ENUM);
1562    arg_mode->add_intvalue((int)mode);
1563
1564    // copy argument first
1565    GLMessage_DataType *arg_first = glmsg.add_args();
1566    arg_first->set_isarray(false);
1567    arg_first->set_type(GLMessage::DataType::INT);
1568    arg_first->add_intvalue(first);
1569
1570    // copy argument count
1571    GLMessage_DataType *arg_count = glmsg.add_args();
1572    arg_count->set_isarray(false);
1573    arg_count->set_type(GLMessage::DataType::INT);
1574    arg_count->add_intvalue(count);
1575
1576    // call function
1577    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1578    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1579    glContext->hooks->gl.glDrawArrays(mode, first, count);
1580    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1581    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1582
1583    void *pointerArgs[] = {
1584    };
1585
1586    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1587                              threadStartTime, threadEndTime,
1588                              &glmsg, pointerArgs);
1589    glContext->traceGLMessage(&glmsg);
1590}
1591
1592void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) {
1593    GLMessage glmsg;
1594    GLTraceContext *glContext = getGLTraceContext();
1595
1596    glmsg.set_function(GLMessage::glDrawElements);
1597
1598    // copy argument mode
1599    GLMessage_DataType *arg_mode = glmsg.add_args();
1600    arg_mode->set_isarray(false);
1601    arg_mode->set_type(GLMessage::DataType::ENUM);
1602    arg_mode->add_intvalue((int)mode);
1603
1604    // copy argument count
1605    GLMessage_DataType *arg_count = glmsg.add_args();
1606    arg_count->set_isarray(false);
1607    arg_count->set_type(GLMessage::DataType::INT);
1608    arg_count->add_intvalue(count);
1609
1610    // copy argument type
1611    GLMessage_DataType *arg_type = glmsg.add_args();
1612    arg_type->set_isarray(false);
1613    arg_type->set_type(GLMessage::DataType::ENUM);
1614    arg_type->add_intvalue((int)type);
1615
1616    // copy argument indices
1617    GLMessage_DataType *arg_indices = glmsg.add_args();
1618    arg_indices->set_isarray(false);
1619    arg_indices->set_type(GLMessage::DataType::INT);
1620    arg_indices->add_intvalue((int)indices);
1621
1622    // call function
1623    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1624    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1625    glContext->hooks->gl.glDrawElements(mode, count, type, indices);
1626    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1627    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1628
1629    void *pointerArgs[] = {
1630        (void *) indices,
1631    };
1632
1633    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1634                              threadStartTime, threadEndTime,
1635                              &glmsg, pointerArgs);
1636    glContext->traceGLMessage(&glmsg);
1637}
1638
1639void GLTrace_glEnable(GLenum cap) {
1640    GLMessage glmsg;
1641    GLTraceContext *glContext = getGLTraceContext();
1642
1643    glmsg.set_function(GLMessage::glEnable);
1644
1645    // copy argument cap
1646    GLMessage_DataType *arg_cap = glmsg.add_args();
1647    arg_cap->set_isarray(false);
1648    arg_cap->set_type(GLMessage::DataType::ENUM);
1649    arg_cap->add_intvalue((int)cap);
1650
1651    // call function
1652    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1653    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1654    glContext->hooks->gl.glEnable(cap);
1655    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1656    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1657
1658    void *pointerArgs[] = {
1659    };
1660
1661    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1662                              threadStartTime, threadEndTime,
1663                              &glmsg, pointerArgs);
1664    glContext->traceGLMessage(&glmsg);
1665}
1666
1667void GLTrace_glEnableVertexAttribArray(GLuint index) {
1668    GLMessage glmsg;
1669    GLTraceContext *glContext = getGLTraceContext();
1670
1671    glmsg.set_function(GLMessage::glEnableVertexAttribArray);
1672
1673    // copy argument index
1674    GLMessage_DataType *arg_index = glmsg.add_args();
1675    arg_index->set_isarray(false);
1676    arg_index->set_type(GLMessage::DataType::INT);
1677    arg_index->add_intvalue(index);
1678
1679    // call function
1680    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1681    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1682    glContext->hooks->gl.glEnableVertexAttribArray(index);
1683    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1684    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1685
1686    void *pointerArgs[] = {
1687    };
1688
1689    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1690                              threadStartTime, threadEndTime,
1691                              &glmsg, pointerArgs);
1692    glContext->traceGLMessage(&glmsg);
1693}
1694
1695void GLTrace_glFinish(void) {
1696    GLMessage glmsg;
1697    GLTraceContext *glContext = getGLTraceContext();
1698
1699    glmsg.set_function(GLMessage::glFinish);
1700
1701    // call function
1702    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1703    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1704    glContext->hooks->gl.glFinish();
1705    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1706    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1707
1708    void *pointerArgs[] = {
1709    };
1710
1711    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1712                              threadStartTime, threadEndTime,
1713                              &glmsg, pointerArgs);
1714    glContext->traceGLMessage(&glmsg);
1715}
1716
1717void GLTrace_glFlush(void) {
1718    GLMessage glmsg;
1719    GLTraceContext *glContext = getGLTraceContext();
1720
1721    glmsg.set_function(GLMessage::glFlush);
1722
1723    // call function
1724    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1725    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1726    glContext->hooks->gl.glFlush();
1727    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1728    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1729
1730    void *pointerArgs[] = {
1731    };
1732
1733    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1734                              threadStartTime, threadEndTime,
1735                              &glmsg, pointerArgs);
1736    glContext->traceGLMessage(&glmsg);
1737}
1738
1739void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
1740    GLMessage glmsg;
1741    GLTraceContext *glContext = getGLTraceContext();
1742
1743    glmsg.set_function(GLMessage::glFramebufferRenderbuffer);
1744
1745    // copy argument target
1746    GLMessage_DataType *arg_target = glmsg.add_args();
1747    arg_target->set_isarray(false);
1748    arg_target->set_type(GLMessage::DataType::ENUM);
1749    arg_target->add_intvalue((int)target);
1750
1751    // copy argument attachment
1752    GLMessage_DataType *arg_attachment = glmsg.add_args();
1753    arg_attachment->set_isarray(false);
1754    arg_attachment->set_type(GLMessage::DataType::ENUM);
1755    arg_attachment->add_intvalue((int)attachment);
1756
1757    // copy argument renderbuffertarget
1758    GLMessage_DataType *arg_renderbuffertarget = glmsg.add_args();
1759    arg_renderbuffertarget->set_isarray(false);
1760    arg_renderbuffertarget->set_type(GLMessage::DataType::ENUM);
1761    arg_renderbuffertarget->add_intvalue((int)renderbuffertarget);
1762
1763    // copy argument renderbuffer
1764    GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
1765    arg_renderbuffer->set_isarray(false);
1766    arg_renderbuffer->set_type(GLMessage::DataType::INT);
1767    arg_renderbuffer->add_intvalue(renderbuffer);
1768
1769    // call function
1770    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1771    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1772    glContext->hooks->gl.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
1773    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1774    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1775
1776    void *pointerArgs[] = {
1777    };
1778
1779    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1780                              threadStartTime, threadEndTime,
1781                              &glmsg, pointerArgs);
1782    glContext->traceGLMessage(&glmsg);
1783}
1784
1785void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
1786    GLMessage glmsg;
1787    GLTraceContext *glContext = getGLTraceContext();
1788
1789    glmsg.set_function(GLMessage::glFramebufferTexture2D);
1790
1791    // copy argument target
1792    GLMessage_DataType *arg_target = glmsg.add_args();
1793    arg_target->set_isarray(false);
1794    arg_target->set_type(GLMessage::DataType::ENUM);
1795    arg_target->add_intvalue((int)target);
1796
1797    // copy argument attachment
1798    GLMessage_DataType *arg_attachment = glmsg.add_args();
1799    arg_attachment->set_isarray(false);
1800    arg_attachment->set_type(GLMessage::DataType::ENUM);
1801    arg_attachment->add_intvalue((int)attachment);
1802
1803    // copy argument textarget
1804    GLMessage_DataType *arg_textarget = glmsg.add_args();
1805    arg_textarget->set_isarray(false);
1806    arg_textarget->set_type(GLMessage::DataType::ENUM);
1807    arg_textarget->add_intvalue((int)textarget);
1808
1809    // copy argument texture
1810    GLMessage_DataType *arg_texture = glmsg.add_args();
1811    arg_texture->set_isarray(false);
1812    arg_texture->set_type(GLMessage::DataType::INT);
1813    arg_texture->add_intvalue(texture);
1814
1815    // copy argument level
1816    GLMessage_DataType *arg_level = glmsg.add_args();
1817    arg_level->set_isarray(false);
1818    arg_level->set_type(GLMessage::DataType::INT);
1819    arg_level->add_intvalue(level);
1820
1821    // call function
1822    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1823    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1824    glContext->hooks->gl.glFramebufferTexture2D(target, attachment, textarget, texture, level);
1825    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1826    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1827
1828    void *pointerArgs[] = {
1829    };
1830
1831    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1832                              threadStartTime, threadEndTime,
1833                              &glmsg, pointerArgs);
1834    glContext->traceGLMessage(&glmsg);
1835}
1836
1837void GLTrace_glFrontFace(GLenum mode) {
1838    GLMessage glmsg;
1839    GLTraceContext *glContext = getGLTraceContext();
1840
1841    glmsg.set_function(GLMessage::glFrontFace);
1842
1843    // copy argument mode
1844    GLMessage_DataType *arg_mode = glmsg.add_args();
1845    arg_mode->set_isarray(false);
1846    arg_mode->set_type(GLMessage::DataType::ENUM);
1847    arg_mode->add_intvalue((int)mode);
1848
1849    // call function
1850    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1851    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1852    glContext->hooks->gl.glFrontFace(mode);
1853    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1854    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1855
1856    void *pointerArgs[] = {
1857    };
1858
1859    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1860                              threadStartTime, threadEndTime,
1861                              &glmsg, pointerArgs);
1862    glContext->traceGLMessage(&glmsg);
1863}
1864
1865void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers) {
1866    GLMessage glmsg;
1867    GLTraceContext *glContext = getGLTraceContext();
1868
1869    glmsg.set_function(GLMessage::glGenBuffers);
1870
1871    // copy argument n
1872    GLMessage_DataType *arg_n = glmsg.add_args();
1873    arg_n->set_isarray(false);
1874    arg_n->set_type(GLMessage::DataType::INT);
1875    arg_n->add_intvalue(n);
1876
1877    // copy argument buffers
1878    GLMessage_DataType *arg_buffers = glmsg.add_args();
1879    arg_buffers->set_isarray(false);
1880    arg_buffers->set_type(GLMessage::DataType::INT);
1881    arg_buffers->add_intvalue((int)buffers);
1882
1883    // call function
1884    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1885    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1886    glContext->hooks->gl.glGenBuffers(n, buffers);
1887    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1888    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1889
1890    void *pointerArgs[] = {
1891        (void *) buffers,
1892    };
1893
1894    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1895                              threadStartTime, threadEndTime,
1896                              &glmsg, pointerArgs);
1897    glContext->traceGLMessage(&glmsg);
1898}
1899
1900void GLTrace_glGenerateMipmap(GLenum target) {
1901    GLMessage glmsg;
1902    GLTraceContext *glContext = getGLTraceContext();
1903
1904    glmsg.set_function(GLMessage::glGenerateMipmap);
1905
1906    // copy argument target
1907    GLMessage_DataType *arg_target = glmsg.add_args();
1908    arg_target->set_isarray(false);
1909    arg_target->set_type(GLMessage::DataType::ENUM);
1910    arg_target->add_intvalue((int)target);
1911
1912    // call function
1913    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1914    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1915    glContext->hooks->gl.glGenerateMipmap(target);
1916    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1917    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1918
1919    void *pointerArgs[] = {
1920    };
1921
1922    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1923                              threadStartTime, threadEndTime,
1924                              &glmsg, pointerArgs);
1925    glContext->traceGLMessage(&glmsg);
1926}
1927
1928void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers) {
1929    GLMessage glmsg;
1930    GLTraceContext *glContext = getGLTraceContext();
1931
1932    glmsg.set_function(GLMessage::glGenFramebuffers);
1933
1934    // copy argument n
1935    GLMessage_DataType *arg_n = glmsg.add_args();
1936    arg_n->set_isarray(false);
1937    arg_n->set_type(GLMessage::DataType::INT);
1938    arg_n->add_intvalue(n);
1939
1940    // copy argument framebuffers
1941    GLMessage_DataType *arg_framebuffers = glmsg.add_args();
1942    arg_framebuffers->set_isarray(false);
1943    arg_framebuffers->set_type(GLMessage::DataType::INT);
1944    arg_framebuffers->add_intvalue((int)framebuffers);
1945
1946    // call function
1947    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1948    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1949    glContext->hooks->gl.glGenFramebuffers(n, framebuffers);
1950    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1951    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1952
1953    void *pointerArgs[] = {
1954        (void *) framebuffers,
1955    };
1956
1957    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1958                              threadStartTime, threadEndTime,
1959                              &glmsg, pointerArgs);
1960    glContext->traceGLMessage(&glmsg);
1961}
1962
1963void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
1964    GLMessage glmsg;
1965    GLTraceContext *glContext = getGLTraceContext();
1966
1967    glmsg.set_function(GLMessage::glGenRenderbuffers);
1968
1969    // copy argument n
1970    GLMessage_DataType *arg_n = glmsg.add_args();
1971    arg_n->set_isarray(false);
1972    arg_n->set_type(GLMessage::DataType::INT);
1973    arg_n->add_intvalue(n);
1974
1975    // copy argument renderbuffers
1976    GLMessage_DataType *arg_renderbuffers = glmsg.add_args();
1977    arg_renderbuffers->set_isarray(false);
1978    arg_renderbuffers->set_type(GLMessage::DataType::INT);
1979    arg_renderbuffers->add_intvalue((int)renderbuffers);
1980
1981    // call function
1982    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
1983    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
1984    glContext->hooks->gl.glGenRenderbuffers(n, renderbuffers);
1985    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
1986    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
1987
1988    void *pointerArgs[] = {
1989        (void *) renderbuffers,
1990    };
1991
1992    fixupGLMessage(glContext, wallStartTime, wallEndTime,
1993                              threadStartTime, threadEndTime,
1994                              &glmsg, pointerArgs);
1995    glContext->traceGLMessage(&glmsg);
1996}
1997
1998void GLTrace_glGenTextures(GLsizei n, GLuint* textures) {
1999    GLMessage glmsg;
2000    GLTraceContext *glContext = getGLTraceContext();
2001
2002    glmsg.set_function(GLMessage::glGenTextures);
2003
2004    // copy argument n
2005    GLMessage_DataType *arg_n = glmsg.add_args();
2006    arg_n->set_isarray(false);
2007    arg_n->set_type(GLMessage::DataType::INT);
2008    arg_n->add_intvalue(n);
2009
2010    // copy argument textures
2011    GLMessage_DataType *arg_textures = glmsg.add_args();
2012    arg_textures->set_isarray(false);
2013    arg_textures->set_type(GLMessage::DataType::INT);
2014    arg_textures->add_intvalue((int)textures);
2015
2016    // call function
2017    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2018    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2019    glContext->hooks->gl.glGenTextures(n, textures);
2020    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2021    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2022
2023    void *pointerArgs[] = {
2024        (void *) textures,
2025    };
2026
2027    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2028                              threadStartTime, threadEndTime,
2029                              &glmsg, pointerArgs);
2030    glContext->traceGLMessage(&glmsg);
2031}
2032
2033void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
2034    GLMessage glmsg;
2035    GLTraceContext *glContext = getGLTraceContext();
2036
2037    glmsg.set_function(GLMessage::glGetActiveAttrib);
2038
2039    // copy argument program
2040    GLMessage_DataType *arg_program = glmsg.add_args();
2041    arg_program->set_isarray(false);
2042    arg_program->set_type(GLMessage::DataType::INT);
2043    arg_program->add_intvalue(program);
2044
2045    // copy argument index
2046    GLMessage_DataType *arg_index = glmsg.add_args();
2047    arg_index->set_isarray(false);
2048    arg_index->set_type(GLMessage::DataType::INT);
2049    arg_index->add_intvalue(index);
2050
2051    // copy argument bufsize
2052    GLMessage_DataType *arg_bufsize = glmsg.add_args();
2053    arg_bufsize->set_isarray(false);
2054    arg_bufsize->set_type(GLMessage::DataType::INT);
2055    arg_bufsize->add_intvalue(bufsize);
2056
2057    // copy argument length
2058    GLMessage_DataType *arg_length = glmsg.add_args();
2059    arg_length->set_isarray(false);
2060    arg_length->set_type(GLMessage::DataType::INT);
2061    arg_length->add_intvalue((int)length);
2062
2063    // copy argument size
2064    GLMessage_DataType *arg_size = glmsg.add_args();
2065    arg_size->set_isarray(false);
2066    arg_size->set_type(GLMessage::DataType::INT);
2067    arg_size->add_intvalue((int)size);
2068
2069    // copy argument type
2070    GLMessage_DataType *arg_type = glmsg.add_args();
2071    arg_type->set_isarray(false);
2072    arg_type->set_type(GLMessage::DataType::INT);
2073    arg_type->add_intvalue((int)type);
2074
2075    // copy argument name
2076    GLMessage_DataType *arg_name = glmsg.add_args();
2077    arg_name->set_isarray(false);
2078    arg_name->set_type(GLMessage::DataType::INT);
2079    arg_name->add_intvalue((int)name);
2080
2081    // call function
2082    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2083    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2084    glContext->hooks->gl.glGetActiveAttrib(program, index, bufsize, length, size, type, name);
2085    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2086    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2087
2088    void *pointerArgs[] = {
2089        (void *) length,
2090        (void *) size,
2091        (void *) type,
2092        (void *) name,
2093    };
2094
2095    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2096                              threadStartTime, threadEndTime,
2097                              &glmsg, pointerArgs);
2098    glContext->traceGLMessage(&glmsg);
2099}
2100
2101void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) {
2102    GLMessage glmsg;
2103    GLTraceContext *glContext = getGLTraceContext();
2104
2105    glmsg.set_function(GLMessage::glGetActiveUniform);
2106
2107    // copy argument program
2108    GLMessage_DataType *arg_program = glmsg.add_args();
2109    arg_program->set_isarray(false);
2110    arg_program->set_type(GLMessage::DataType::INT);
2111    arg_program->add_intvalue(program);
2112
2113    // copy argument index
2114    GLMessage_DataType *arg_index = glmsg.add_args();
2115    arg_index->set_isarray(false);
2116    arg_index->set_type(GLMessage::DataType::INT);
2117    arg_index->add_intvalue(index);
2118
2119    // copy argument bufsize
2120    GLMessage_DataType *arg_bufsize = glmsg.add_args();
2121    arg_bufsize->set_isarray(false);
2122    arg_bufsize->set_type(GLMessage::DataType::INT);
2123    arg_bufsize->add_intvalue(bufsize);
2124
2125    // copy argument length
2126    GLMessage_DataType *arg_length = glmsg.add_args();
2127    arg_length->set_isarray(false);
2128    arg_length->set_type(GLMessage::DataType::INT);
2129    arg_length->add_intvalue((int)length);
2130
2131    // copy argument size
2132    GLMessage_DataType *arg_size = glmsg.add_args();
2133    arg_size->set_isarray(false);
2134    arg_size->set_type(GLMessage::DataType::INT);
2135    arg_size->add_intvalue((int)size);
2136
2137    // copy argument type
2138    GLMessage_DataType *arg_type = glmsg.add_args();
2139    arg_type->set_isarray(false);
2140    arg_type->set_type(GLMessage::DataType::INT);
2141    arg_type->add_intvalue((int)type);
2142
2143    // copy argument name
2144    GLMessage_DataType *arg_name = glmsg.add_args();
2145    arg_name->set_isarray(false);
2146    arg_name->set_type(GLMessage::DataType::INT);
2147    arg_name->add_intvalue((int)name);
2148
2149    // call function
2150    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2151    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2152    glContext->hooks->gl.glGetActiveUniform(program, index, bufsize, length, size, type, name);
2153    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2154    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2155
2156    void *pointerArgs[] = {
2157        (void *) length,
2158        (void *) size,
2159        (void *) type,
2160        (void *) name,
2161    };
2162
2163    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2164                              threadStartTime, threadEndTime,
2165                              &glmsg, pointerArgs);
2166    glContext->traceGLMessage(&glmsg);
2167}
2168
2169void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
2170    GLMessage glmsg;
2171    GLTraceContext *glContext = getGLTraceContext();
2172
2173    glmsg.set_function(GLMessage::glGetAttachedShaders);
2174
2175    // copy argument program
2176    GLMessage_DataType *arg_program = glmsg.add_args();
2177    arg_program->set_isarray(false);
2178    arg_program->set_type(GLMessage::DataType::INT);
2179    arg_program->add_intvalue(program);
2180
2181    // copy argument maxcount
2182    GLMessage_DataType *arg_maxcount = glmsg.add_args();
2183    arg_maxcount->set_isarray(false);
2184    arg_maxcount->set_type(GLMessage::DataType::INT);
2185    arg_maxcount->add_intvalue(maxcount);
2186
2187    // copy argument count
2188    GLMessage_DataType *arg_count = glmsg.add_args();
2189    arg_count->set_isarray(false);
2190    arg_count->set_type(GLMessage::DataType::INT);
2191    arg_count->add_intvalue((int)count);
2192
2193    // copy argument shaders
2194    GLMessage_DataType *arg_shaders = glmsg.add_args();
2195    arg_shaders->set_isarray(false);
2196    arg_shaders->set_type(GLMessage::DataType::INT);
2197    arg_shaders->add_intvalue((int)shaders);
2198
2199    // call function
2200    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2201    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2202    glContext->hooks->gl.glGetAttachedShaders(program, maxcount, count, shaders);
2203    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2204    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2205
2206    void *pointerArgs[] = {
2207        (void *) count,
2208        (void *) shaders,
2209    };
2210
2211    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2212                              threadStartTime, threadEndTime,
2213                              &glmsg, pointerArgs);
2214    glContext->traceGLMessage(&glmsg);
2215}
2216
2217int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
2218    GLMessage glmsg;
2219    GLTraceContext *glContext = getGLTraceContext();
2220
2221    glmsg.set_function(GLMessage::glGetAttribLocation);
2222
2223    // copy argument program
2224    GLMessage_DataType *arg_program = glmsg.add_args();
2225    arg_program->set_isarray(false);
2226    arg_program->set_type(GLMessage::DataType::INT);
2227    arg_program->add_intvalue(program);
2228
2229    // copy argument name
2230    GLMessage_DataType *arg_name = glmsg.add_args();
2231    arg_name->set_isarray(false);
2232    arg_name->set_type(GLMessage::DataType::INT);
2233    arg_name->add_intvalue((int)name);
2234
2235    // call function
2236    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2237    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2238    int retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
2239    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2240    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2241
2242    // set return value
2243    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
2244    rt->set_isarray(false);
2245    rt->set_type(GLMessage::DataType::INT);
2246    rt->add_intvalue(retValue);
2247
2248    void *pointerArgs[] = {
2249        (void *) name,
2250    };
2251
2252    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2253                              threadStartTime, threadEndTime,
2254                              &glmsg, pointerArgs);
2255    glContext->traceGLMessage(&glmsg);
2256
2257    return retValue;
2258}
2259
2260void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params) {
2261    GLMessage glmsg;
2262    GLTraceContext *glContext = getGLTraceContext();
2263
2264    glmsg.set_function(GLMessage::glGetBooleanv);
2265
2266    // copy argument pname
2267    GLMessage_DataType *arg_pname = glmsg.add_args();
2268    arg_pname->set_isarray(false);
2269    arg_pname->set_type(GLMessage::DataType::ENUM);
2270    arg_pname->add_intvalue((int)pname);
2271
2272    // copy argument params
2273    GLMessage_DataType *arg_params = glmsg.add_args();
2274    arg_params->set_isarray(false);
2275    arg_params->set_type(GLMessage::DataType::INT);
2276    arg_params->add_intvalue((int)params);
2277
2278    // call function
2279    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2280    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2281    glContext->hooks->gl.glGetBooleanv(pname, params);
2282    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2283    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2284
2285    void *pointerArgs[] = {
2286        (void *) params,
2287    };
2288
2289    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2290                              threadStartTime, threadEndTime,
2291                              &glmsg, pointerArgs);
2292    glContext->traceGLMessage(&glmsg);
2293}
2294
2295void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
2296    GLMessage glmsg;
2297    GLTraceContext *glContext = getGLTraceContext();
2298
2299    glmsg.set_function(GLMessage::glGetBufferParameteriv);
2300
2301    // copy argument target
2302    GLMessage_DataType *arg_target = glmsg.add_args();
2303    arg_target->set_isarray(false);
2304    arg_target->set_type(GLMessage::DataType::ENUM);
2305    arg_target->add_intvalue((int)target);
2306
2307    // copy argument pname
2308    GLMessage_DataType *arg_pname = glmsg.add_args();
2309    arg_pname->set_isarray(false);
2310    arg_pname->set_type(GLMessage::DataType::ENUM);
2311    arg_pname->add_intvalue((int)pname);
2312
2313    // copy argument params
2314    GLMessage_DataType *arg_params = glmsg.add_args();
2315    arg_params->set_isarray(false);
2316    arg_params->set_type(GLMessage::DataType::INT);
2317    arg_params->add_intvalue((int)params);
2318
2319    // call function
2320    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2321    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2322    glContext->hooks->gl.glGetBufferParameteriv(target, pname, params);
2323    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2324    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2325
2326    void *pointerArgs[] = {
2327        (void *) params,
2328    };
2329
2330    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2331                              threadStartTime, threadEndTime,
2332                              &glmsg, pointerArgs);
2333    glContext->traceGLMessage(&glmsg);
2334}
2335
2336GLenum GLTrace_glGetError(void) {
2337    GLMessage glmsg;
2338    GLTraceContext *glContext = getGLTraceContext();
2339
2340    glmsg.set_function(GLMessage::glGetError);
2341
2342    // call function
2343    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2344    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2345    GLenum retValue = glContext->hooks->gl.glGetError();
2346    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2347    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2348
2349    // set return value
2350    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
2351    rt->set_isarray(false);
2352    rt->set_type(GLMessage::DataType::ENUM);
2353    rt->add_intvalue((int)retValue);
2354
2355    void *pointerArgs[] = {
2356    };
2357
2358    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2359                              threadStartTime, threadEndTime,
2360                              &glmsg, pointerArgs);
2361    glContext->traceGLMessage(&glmsg);
2362
2363    return retValue;
2364}
2365
2366void GLTrace_glGetFloatv(GLenum pname, GLfloat* params) {
2367    GLMessage glmsg;
2368    GLTraceContext *glContext = getGLTraceContext();
2369
2370    glmsg.set_function(GLMessage::glGetFloatv);
2371
2372    // copy argument pname
2373    GLMessage_DataType *arg_pname = glmsg.add_args();
2374    arg_pname->set_isarray(false);
2375    arg_pname->set_type(GLMessage::DataType::ENUM);
2376    arg_pname->add_intvalue((int)pname);
2377
2378    // copy argument params
2379    GLMessage_DataType *arg_params = glmsg.add_args();
2380    arg_params->set_isarray(false);
2381    arg_params->set_type(GLMessage::DataType::INT);
2382    arg_params->add_intvalue((int)params);
2383
2384    // call function
2385    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2386    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2387    glContext->hooks->gl.glGetFloatv(pname, params);
2388    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2389    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2390
2391    void *pointerArgs[] = {
2392        (void *) params,
2393    };
2394
2395    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2396                              threadStartTime, threadEndTime,
2397                              &glmsg, pointerArgs);
2398    glContext->traceGLMessage(&glmsg);
2399}
2400
2401void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
2402    GLMessage glmsg;
2403    GLTraceContext *glContext = getGLTraceContext();
2404
2405    glmsg.set_function(GLMessage::glGetFramebufferAttachmentParameteriv);
2406
2407    // copy argument target
2408    GLMessage_DataType *arg_target = glmsg.add_args();
2409    arg_target->set_isarray(false);
2410    arg_target->set_type(GLMessage::DataType::ENUM);
2411    arg_target->add_intvalue((int)target);
2412
2413    // copy argument attachment
2414    GLMessage_DataType *arg_attachment = glmsg.add_args();
2415    arg_attachment->set_isarray(false);
2416    arg_attachment->set_type(GLMessage::DataType::ENUM);
2417    arg_attachment->add_intvalue((int)attachment);
2418
2419    // copy argument pname
2420    GLMessage_DataType *arg_pname = glmsg.add_args();
2421    arg_pname->set_isarray(false);
2422    arg_pname->set_type(GLMessage::DataType::ENUM);
2423    arg_pname->add_intvalue((int)pname);
2424
2425    // copy argument params
2426    GLMessage_DataType *arg_params = glmsg.add_args();
2427    arg_params->set_isarray(false);
2428    arg_params->set_type(GLMessage::DataType::INT);
2429    arg_params->add_intvalue((int)params);
2430
2431    // call function
2432    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2433    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2434    glContext->hooks->gl.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
2435    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2436    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2437
2438    void *pointerArgs[] = {
2439        (void *) params,
2440    };
2441
2442    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2443                              threadStartTime, threadEndTime,
2444                              &glmsg, pointerArgs);
2445    glContext->traceGLMessage(&glmsg);
2446}
2447
2448void GLTrace_glGetIntegerv(GLenum pname, GLint* params) {
2449    GLMessage glmsg;
2450    GLTraceContext *glContext = getGLTraceContext();
2451
2452    glmsg.set_function(GLMessage::glGetIntegerv);
2453
2454    // copy argument pname
2455    GLMessage_DataType *arg_pname = glmsg.add_args();
2456    arg_pname->set_isarray(false);
2457    arg_pname->set_type(GLMessage::DataType::ENUM);
2458    arg_pname->add_intvalue((int)pname);
2459
2460    // copy argument params
2461    GLMessage_DataType *arg_params = glmsg.add_args();
2462    arg_params->set_isarray(false);
2463    arg_params->set_type(GLMessage::DataType::INT);
2464    arg_params->add_intvalue((int)params);
2465
2466    // call function
2467    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2468    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2469    glContext->hooks->gl.glGetIntegerv(pname, params);
2470    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2471    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2472
2473    void *pointerArgs[] = {
2474        (void *) params,
2475    };
2476
2477    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2478                              threadStartTime, threadEndTime,
2479                              &glmsg, pointerArgs);
2480    glContext->traceGLMessage(&glmsg);
2481}
2482
2483void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params) {
2484    GLMessage glmsg;
2485    GLTraceContext *glContext = getGLTraceContext();
2486
2487    glmsg.set_function(GLMessage::glGetProgramiv);
2488
2489    // copy argument program
2490    GLMessage_DataType *arg_program = glmsg.add_args();
2491    arg_program->set_isarray(false);
2492    arg_program->set_type(GLMessage::DataType::INT);
2493    arg_program->add_intvalue(program);
2494
2495    // copy argument pname
2496    GLMessage_DataType *arg_pname = glmsg.add_args();
2497    arg_pname->set_isarray(false);
2498    arg_pname->set_type(GLMessage::DataType::ENUM);
2499    arg_pname->add_intvalue((int)pname);
2500
2501    // copy argument params
2502    GLMessage_DataType *arg_params = glmsg.add_args();
2503    arg_params->set_isarray(false);
2504    arg_params->set_type(GLMessage::DataType::INT);
2505    arg_params->add_intvalue((int)params);
2506
2507    // call function
2508    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2509    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2510    glContext->hooks->gl.glGetProgramiv(program, pname, params);
2511    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2512    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2513
2514    void *pointerArgs[] = {
2515        (void *) params,
2516    };
2517
2518    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2519                              threadStartTime, threadEndTime,
2520                              &glmsg, pointerArgs);
2521    glContext->traceGLMessage(&glmsg);
2522}
2523
2524void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
2525    GLMessage glmsg;
2526    GLTraceContext *glContext = getGLTraceContext();
2527
2528    glmsg.set_function(GLMessage::glGetProgramInfoLog);
2529
2530    // copy argument program
2531    GLMessage_DataType *arg_program = glmsg.add_args();
2532    arg_program->set_isarray(false);
2533    arg_program->set_type(GLMessage::DataType::INT);
2534    arg_program->add_intvalue(program);
2535
2536    // copy argument bufsize
2537    GLMessage_DataType *arg_bufsize = glmsg.add_args();
2538    arg_bufsize->set_isarray(false);
2539    arg_bufsize->set_type(GLMessage::DataType::INT);
2540    arg_bufsize->add_intvalue(bufsize);
2541
2542    // copy argument length
2543    GLMessage_DataType *arg_length = glmsg.add_args();
2544    arg_length->set_isarray(false);
2545    arg_length->set_type(GLMessage::DataType::INT);
2546    arg_length->add_intvalue((int)length);
2547
2548    // copy argument infolog
2549    GLMessage_DataType *arg_infolog = glmsg.add_args();
2550    arg_infolog->set_isarray(false);
2551    arg_infolog->set_type(GLMessage::DataType::INT);
2552    arg_infolog->add_intvalue((int)infolog);
2553
2554    // call function
2555    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2556    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2557    glContext->hooks->gl.glGetProgramInfoLog(program, bufsize, length, infolog);
2558    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2559    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2560
2561    void *pointerArgs[] = {
2562        (void *) length,
2563        (void *) infolog,
2564    };
2565
2566    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2567                              threadStartTime, threadEndTime,
2568                              &glmsg, pointerArgs);
2569    glContext->traceGLMessage(&glmsg);
2570}
2571
2572void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) {
2573    GLMessage glmsg;
2574    GLTraceContext *glContext = getGLTraceContext();
2575
2576    glmsg.set_function(GLMessage::glGetRenderbufferParameteriv);
2577
2578    // copy argument target
2579    GLMessage_DataType *arg_target = glmsg.add_args();
2580    arg_target->set_isarray(false);
2581    arg_target->set_type(GLMessage::DataType::ENUM);
2582    arg_target->add_intvalue((int)target);
2583
2584    // copy argument pname
2585    GLMessage_DataType *arg_pname = glmsg.add_args();
2586    arg_pname->set_isarray(false);
2587    arg_pname->set_type(GLMessage::DataType::ENUM);
2588    arg_pname->add_intvalue((int)pname);
2589
2590    // copy argument params
2591    GLMessage_DataType *arg_params = glmsg.add_args();
2592    arg_params->set_isarray(false);
2593    arg_params->set_type(GLMessage::DataType::INT);
2594    arg_params->add_intvalue((int)params);
2595
2596    // call function
2597    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2598    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2599    glContext->hooks->gl.glGetRenderbufferParameteriv(target, pname, params);
2600    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2601    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2602
2603    void *pointerArgs[] = {
2604        (void *) params,
2605    };
2606
2607    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2608                              threadStartTime, threadEndTime,
2609                              &glmsg, pointerArgs);
2610    glContext->traceGLMessage(&glmsg);
2611}
2612
2613void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params) {
2614    GLMessage glmsg;
2615    GLTraceContext *glContext = getGLTraceContext();
2616
2617    glmsg.set_function(GLMessage::glGetShaderiv);
2618
2619    // copy argument shader
2620    GLMessage_DataType *arg_shader = glmsg.add_args();
2621    arg_shader->set_isarray(false);
2622    arg_shader->set_type(GLMessage::DataType::INT);
2623    arg_shader->add_intvalue(shader);
2624
2625    // copy argument pname
2626    GLMessage_DataType *arg_pname = glmsg.add_args();
2627    arg_pname->set_isarray(false);
2628    arg_pname->set_type(GLMessage::DataType::ENUM);
2629    arg_pname->add_intvalue((int)pname);
2630
2631    // copy argument params
2632    GLMessage_DataType *arg_params = glmsg.add_args();
2633    arg_params->set_isarray(false);
2634    arg_params->set_type(GLMessage::DataType::INT);
2635    arg_params->add_intvalue((int)params);
2636
2637    // call function
2638    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2639    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2640    glContext->hooks->gl.glGetShaderiv(shader, pname, params);
2641    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2642    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2643
2644    void *pointerArgs[] = {
2645        (void *) params,
2646    };
2647
2648    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2649                              threadStartTime, threadEndTime,
2650                              &glmsg, pointerArgs);
2651    glContext->traceGLMessage(&glmsg);
2652}
2653
2654void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) {
2655    GLMessage glmsg;
2656    GLTraceContext *glContext = getGLTraceContext();
2657
2658    glmsg.set_function(GLMessage::glGetShaderInfoLog);
2659
2660    // copy argument shader
2661    GLMessage_DataType *arg_shader = glmsg.add_args();
2662    arg_shader->set_isarray(false);
2663    arg_shader->set_type(GLMessage::DataType::INT);
2664    arg_shader->add_intvalue(shader);
2665
2666    // copy argument bufsize
2667    GLMessage_DataType *arg_bufsize = glmsg.add_args();
2668    arg_bufsize->set_isarray(false);
2669    arg_bufsize->set_type(GLMessage::DataType::INT);
2670    arg_bufsize->add_intvalue(bufsize);
2671
2672    // copy argument length
2673    GLMessage_DataType *arg_length = glmsg.add_args();
2674    arg_length->set_isarray(false);
2675    arg_length->set_type(GLMessage::DataType::INT);
2676    arg_length->add_intvalue((int)length);
2677
2678    // copy argument infolog
2679    GLMessage_DataType *arg_infolog = glmsg.add_args();
2680    arg_infolog->set_isarray(false);
2681    arg_infolog->set_type(GLMessage::DataType::INT);
2682    arg_infolog->add_intvalue((int)infolog);
2683
2684    // call function
2685    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2686    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2687    glContext->hooks->gl.glGetShaderInfoLog(shader, bufsize, length, infolog);
2688    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2689    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2690
2691    void *pointerArgs[] = {
2692        (void *) length,
2693        (void *) infolog,
2694    };
2695
2696    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2697                              threadStartTime, threadEndTime,
2698                              &glmsg, pointerArgs);
2699    glContext->traceGLMessage(&glmsg);
2700}
2701
2702void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
2703    GLMessage glmsg;
2704    GLTraceContext *glContext = getGLTraceContext();
2705
2706    glmsg.set_function(GLMessage::glGetShaderPrecisionFormat);
2707
2708    // copy argument shadertype
2709    GLMessage_DataType *arg_shadertype = glmsg.add_args();
2710    arg_shadertype->set_isarray(false);
2711    arg_shadertype->set_type(GLMessage::DataType::ENUM);
2712    arg_shadertype->add_intvalue((int)shadertype);
2713
2714    // copy argument precisiontype
2715    GLMessage_DataType *arg_precisiontype = glmsg.add_args();
2716    arg_precisiontype->set_isarray(false);
2717    arg_precisiontype->set_type(GLMessage::DataType::ENUM);
2718    arg_precisiontype->add_intvalue((int)precisiontype);
2719
2720    // copy argument range
2721    GLMessage_DataType *arg_range = glmsg.add_args();
2722    arg_range->set_isarray(false);
2723    arg_range->set_type(GLMessage::DataType::INT);
2724    arg_range->add_intvalue((int)range);
2725
2726    // copy argument precision
2727    GLMessage_DataType *arg_precision = glmsg.add_args();
2728    arg_precision->set_isarray(false);
2729    arg_precision->set_type(GLMessage::DataType::INT);
2730    arg_precision->add_intvalue((int)precision);
2731
2732    // call function
2733    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2734    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2735    glContext->hooks->gl.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
2736    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2737    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2738
2739    void *pointerArgs[] = {
2740        (void *) range,
2741        (void *) precision,
2742    };
2743
2744    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2745                              threadStartTime, threadEndTime,
2746                              &glmsg, pointerArgs);
2747    glContext->traceGLMessage(&glmsg);
2748}
2749
2750void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) {
2751    GLMessage glmsg;
2752    GLTraceContext *glContext = getGLTraceContext();
2753
2754    glmsg.set_function(GLMessage::glGetShaderSource);
2755
2756    // copy argument shader
2757    GLMessage_DataType *arg_shader = glmsg.add_args();
2758    arg_shader->set_isarray(false);
2759    arg_shader->set_type(GLMessage::DataType::INT);
2760    arg_shader->add_intvalue(shader);
2761
2762    // copy argument bufsize
2763    GLMessage_DataType *arg_bufsize = glmsg.add_args();
2764    arg_bufsize->set_isarray(false);
2765    arg_bufsize->set_type(GLMessage::DataType::INT);
2766    arg_bufsize->add_intvalue(bufsize);
2767
2768    // copy argument length
2769    GLMessage_DataType *arg_length = glmsg.add_args();
2770    arg_length->set_isarray(false);
2771    arg_length->set_type(GLMessage::DataType::INT);
2772    arg_length->add_intvalue((int)length);
2773
2774    // copy argument source
2775    GLMessage_DataType *arg_source = glmsg.add_args();
2776    arg_source->set_isarray(false);
2777    arg_source->set_type(GLMessage::DataType::INT);
2778    arg_source->add_intvalue((int)source);
2779
2780    // call function
2781    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2782    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2783    glContext->hooks->gl.glGetShaderSource(shader, bufsize, length, source);
2784    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2785    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2786
2787    void *pointerArgs[] = {
2788        (void *) length,
2789        (void *) source,
2790    };
2791
2792    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2793                              threadStartTime, threadEndTime,
2794                              &glmsg, pointerArgs);
2795    glContext->traceGLMessage(&glmsg);
2796}
2797
2798const GLubyte* GLTrace_glGetString(GLenum name) {
2799    GLMessage glmsg;
2800    GLTraceContext *glContext = getGLTraceContext();
2801
2802    glmsg.set_function(GLMessage::glGetString);
2803
2804    // copy argument name
2805    GLMessage_DataType *arg_name = glmsg.add_args();
2806    arg_name->set_isarray(false);
2807    arg_name->set_type(GLMessage::DataType::ENUM);
2808    arg_name->add_intvalue((int)name);
2809
2810    // call function
2811    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2812    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2813    const GLubyte* retValue = glContext->hooks->gl.glGetString(name);
2814    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2815    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2816
2817    // set return value
2818    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
2819    rt->set_isarray(false);
2820    rt->set_type(GLMessage::DataType::INT);
2821    rt->add_intvalue((int)retValue);
2822
2823    void *pointerArgs[] = {
2824        (void *) retValue,
2825    };
2826
2827    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2828                              threadStartTime, threadEndTime,
2829                              &glmsg, pointerArgs);
2830    glContext->traceGLMessage(&glmsg);
2831
2832    return retValue;
2833}
2834
2835void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
2836    GLMessage glmsg;
2837    GLTraceContext *glContext = getGLTraceContext();
2838
2839    glmsg.set_function(GLMessage::glGetTexParameterfv);
2840
2841    // copy argument target
2842    GLMessage_DataType *arg_target = glmsg.add_args();
2843    arg_target->set_isarray(false);
2844    arg_target->set_type(GLMessage::DataType::ENUM);
2845    arg_target->add_intvalue((int)target);
2846
2847    // copy argument pname
2848    GLMessage_DataType *arg_pname = glmsg.add_args();
2849    arg_pname->set_isarray(false);
2850    arg_pname->set_type(GLMessage::DataType::ENUM);
2851    arg_pname->add_intvalue((int)pname);
2852
2853    // copy argument params
2854    GLMessage_DataType *arg_params = glmsg.add_args();
2855    arg_params->set_isarray(false);
2856    arg_params->set_type(GLMessage::DataType::INT);
2857    arg_params->add_intvalue((int)params);
2858
2859    // call function
2860    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2861    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2862    glContext->hooks->gl.glGetTexParameterfv(target, pname, params);
2863    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2864    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2865
2866    void *pointerArgs[] = {
2867        (void *) params,
2868    };
2869
2870    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2871                              threadStartTime, threadEndTime,
2872                              &glmsg, pointerArgs);
2873    glContext->traceGLMessage(&glmsg);
2874}
2875
2876void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
2877    GLMessage glmsg;
2878    GLTraceContext *glContext = getGLTraceContext();
2879
2880    glmsg.set_function(GLMessage::glGetTexParameteriv);
2881
2882    // copy argument target
2883    GLMessage_DataType *arg_target = glmsg.add_args();
2884    arg_target->set_isarray(false);
2885    arg_target->set_type(GLMessage::DataType::ENUM);
2886    arg_target->add_intvalue((int)target);
2887
2888    // copy argument pname
2889    GLMessage_DataType *arg_pname = glmsg.add_args();
2890    arg_pname->set_isarray(false);
2891    arg_pname->set_type(GLMessage::DataType::ENUM);
2892    arg_pname->add_intvalue((int)pname);
2893
2894    // copy argument params
2895    GLMessage_DataType *arg_params = glmsg.add_args();
2896    arg_params->set_isarray(false);
2897    arg_params->set_type(GLMessage::DataType::INT);
2898    arg_params->add_intvalue((int)params);
2899
2900    // call function
2901    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2902    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2903    glContext->hooks->gl.glGetTexParameteriv(target, pname, params);
2904    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2905    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2906
2907    void *pointerArgs[] = {
2908        (void *) params,
2909    };
2910
2911    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2912                              threadStartTime, threadEndTime,
2913                              &glmsg, pointerArgs);
2914    glContext->traceGLMessage(&glmsg);
2915}
2916
2917void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params) {
2918    GLMessage glmsg;
2919    GLTraceContext *glContext = getGLTraceContext();
2920
2921    glmsg.set_function(GLMessage::glGetUniformfv);
2922
2923    // copy argument program
2924    GLMessage_DataType *arg_program = glmsg.add_args();
2925    arg_program->set_isarray(false);
2926    arg_program->set_type(GLMessage::DataType::INT);
2927    arg_program->add_intvalue(program);
2928
2929    // copy argument location
2930    GLMessage_DataType *arg_location = glmsg.add_args();
2931    arg_location->set_isarray(false);
2932    arg_location->set_type(GLMessage::DataType::INT);
2933    arg_location->add_intvalue(location);
2934
2935    // copy argument params
2936    GLMessage_DataType *arg_params = glmsg.add_args();
2937    arg_params->set_isarray(false);
2938    arg_params->set_type(GLMessage::DataType::INT);
2939    arg_params->add_intvalue((int)params);
2940
2941    // call function
2942    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2943    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2944    glContext->hooks->gl.glGetUniformfv(program, location, params);
2945    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2946    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2947
2948    void *pointerArgs[] = {
2949        (void *) params,
2950    };
2951
2952    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2953                              threadStartTime, threadEndTime,
2954                              &glmsg, pointerArgs);
2955    glContext->traceGLMessage(&glmsg);
2956}
2957
2958void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) {
2959    GLMessage glmsg;
2960    GLTraceContext *glContext = getGLTraceContext();
2961
2962    glmsg.set_function(GLMessage::glGetUniformiv);
2963
2964    // copy argument program
2965    GLMessage_DataType *arg_program = glmsg.add_args();
2966    arg_program->set_isarray(false);
2967    arg_program->set_type(GLMessage::DataType::INT);
2968    arg_program->add_intvalue(program);
2969
2970    // copy argument location
2971    GLMessage_DataType *arg_location = glmsg.add_args();
2972    arg_location->set_isarray(false);
2973    arg_location->set_type(GLMessage::DataType::INT);
2974    arg_location->add_intvalue(location);
2975
2976    // copy argument params
2977    GLMessage_DataType *arg_params = glmsg.add_args();
2978    arg_params->set_isarray(false);
2979    arg_params->set_type(GLMessage::DataType::INT);
2980    arg_params->add_intvalue((int)params);
2981
2982    // call function
2983    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
2984    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
2985    glContext->hooks->gl.glGetUniformiv(program, location, params);
2986    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
2987    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
2988
2989    void *pointerArgs[] = {
2990        (void *) params,
2991    };
2992
2993    fixupGLMessage(glContext, wallStartTime, wallEndTime,
2994                              threadStartTime, threadEndTime,
2995                              &glmsg, pointerArgs);
2996    glContext->traceGLMessage(&glmsg);
2997}
2998
2999int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
3000    GLMessage glmsg;
3001    GLTraceContext *glContext = getGLTraceContext();
3002
3003    glmsg.set_function(GLMessage::glGetUniformLocation);
3004
3005    // copy argument program
3006    GLMessage_DataType *arg_program = glmsg.add_args();
3007    arg_program->set_isarray(false);
3008    arg_program->set_type(GLMessage::DataType::INT);
3009    arg_program->add_intvalue(program);
3010
3011    // copy argument name
3012    GLMessage_DataType *arg_name = glmsg.add_args();
3013    arg_name->set_isarray(false);
3014    arg_name->set_type(GLMessage::DataType::INT);
3015    arg_name->add_intvalue((int)name);
3016
3017    // call function
3018    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3019    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3020    int retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
3021    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3022    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3023
3024    // set return value
3025    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3026    rt->set_isarray(false);
3027    rt->set_type(GLMessage::DataType::INT);
3028    rt->add_intvalue(retValue);
3029
3030    void *pointerArgs[] = {
3031        (void *) name,
3032    };
3033
3034    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3035                              threadStartTime, threadEndTime,
3036                              &glmsg, pointerArgs);
3037    glContext->traceGLMessage(&glmsg);
3038
3039    return retValue;
3040}
3041
3042void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) {
3043    GLMessage glmsg;
3044    GLTraceContext *glContext = getGLTraceContext();
3045
3046    glmsg.set_function(GLMessage::glGetVertexAttribfv);
3047
3048    // copy argument index
3049    GLMessage_DataType *arg_index = glmsg.add_args();
3050    arg_index->set_isarray(false);
3051    arg_index->set_type(GLMessage::DataType::INT);
3052    arg_index->add_intvalue(index);
3053
3054    // copy argument pname
3055    GLMessage_DataType *arg_pname = glmsg.add_args();
3056    arg_pname->set_isarray(false);
3057    arg_pname->set_type(GLMessage::DataType::ENUM);
3058    arg_pname->add_intvalue((int)pname);
3059
3060    // copy argument params
3061    GLMessage_DataType *arg_params = glmsg.add_args();
3062    arg_params->set_isarray(false);
3063    arg_params->set_type(GLMessage::DataType::INT);
3064    arg_params->add_intvalue((int)params);
3065
3066    // call function
3067    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3068    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3069    glContext->hooks->gl.glGetVertexAttribfv(index, pname, params);
3070    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3071    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3072
3073    void *pointerArgs[] = {
3074        (void *) params,
3075    };
3076
3077    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3078                              threadStartTime, threadEndTime,
3079                              &glmsg, pointerArgs);
3080    glContext->traceGLMessage(&glmsg);
3081}
3082
3083void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) {
3084    GLMessage glmsg;
3085    GLTraceContext *glContext = getGLTraceContext();
3086
3087    glmsg.set_function(GLMessage::glGetVertexAttribiv);
3088
3089    // copy argument index
3090    GLMessage_DataType *arg_index = glmsg.add_args();
3091    arg_index->set_isarray(false);
3092    arg_index->set_type(GLMessage::DataType::INT);
3093    arg_index->add_intvalue(index);
3094
3095    // copy argument pname
3096    GLMessage_DataType *arg_pname = glmsg.add_args();
3097    arg_pname->set_isarray(false);
3098    arg_pname->set_type(GLMessage::DataType::ENUM);
3099    arg_pname->add_intvalue((int)pname);
3100
3101    // copy argument params
3102    GLMessage_DataType *arg_params = glmsg.add_args();
3103    arg_params->set_isarray(false);
3104    arg_params->set_type(GLMessage::DataType::INT);
3105    arg_params->add_intvalue((int)params);
3106
3107    // call function
3108    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3109    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3110    glContext->hooks->gl.glGetVertexAttribiv(index, pname, params);
3111    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3112    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3113
3114    void *pointerArgs[] = {
3115        (void *) params,
3116    };
3117
3118    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3119                              threadStartTime, threadEndTime,
3120                              &glmsg, pointerArgs);
3121    glContext->traceGLMessage(&glmsg);
3122}
3123
3124void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) {
3125    GLMessage glmsg;
3126    GLTraceContext *glContext = getGLTraceContext();
3127
3128    glmsg.set_function(GLMessage::glGetVertexAttribPointerv);
3129
3130    // copy argument index
3131    GLMessage_DataType *arg_index = glmsg.add_args();
3132    arg_index->set_isarray(false);
3133    arg_index->set_type(GLMessage::DataType::INT);
3134    arg_index->add_intvalue(index);
3135
3136    // copy argument pname
3137    GLMessage_DataType *arg_pname = glmsg.add_args();
3138    arg_pname->set_isarray(false);
3139    arg_pname->set_type(GLMessage::DataType::ENUM);
3140    arg_pname->add_intvalue((int)pname);
3141
3142    // copy argument pointer
3143    GLMessage_DataType *arg_pointer = glmsg.add_args();
3144    arg_pointer->set_isarray(false);
3145    arg_pointer->set_type(GLMessage::DataType::INT);
3146    arg_pointer->add_intvalue((int)pointer);
3147
3148    // call function
3149    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3150    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3151    glContext->hooks->gl.glGetVertexAttribPointerv(index, pname, pointer);
3152    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3153    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3154
3155    void *pointerArgs[] = {
3156        (void *) pointer,
3157    };
3158
3159    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3160                              threadStartTime, threadEndTime,
3161                              &glmsg, pointerArgs);
3162    glContext->traceGLMessage(&glmsg);
3163}
3164
3165void GLTrace_glHint(GLenum target, GLenum mode) {
3166    GLMessage glmsg;
3167    GLTraceContext *glContext = getGLTraceContext();
3168
3169    glmsg.set_function(GLMessage::glHint);
3170
3171    // copy argument target
3172    GLMessage_DataType *arg_target = glmsg.add_args();
3173    arg_target->set_isarray(false);
3174    arg_target->set_type(GLMessage::DataType::ENUM);
3175    arg_target->add_intvalue((int)target);
3176
3177    // copy argument mode
3178    GLMessage_DataType *arg_mode = glmsg.add_args();
3179    arg_mode->set_isarray(false);
3180    arg_mode->set_type(GLMessage::DataType::ENUM);
3181    arg_mode->add_intvalue((int)mode);
3182
3183    // call function
3184    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3185    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3186    glContext->hooks->gl.glHint(target, mode);
3187    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3188    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3189
3190    void *pointerArgs[] = {
3191    };
3192
3193    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3194                              threadStartTime, threadEndTime,
3195                              &glmsg, pointerArgs);
3196    glContext->traceGLMessage(&glmsg);
3197}
3198
3199GLboolean GLTrace_glIsBuffer(GLuint buffer) {
3200    GLMessage glmsg;
3201    GLTraceContext *glContext = getGLTraceContext();
3202
3203    glmsg.set_function(GLMessage::glIsBuffer);
3204
3205    // copy argument buffer
3206    GLMessage_DataType *arg_buffer = glmsg.add_args();
3207    arg_buffer->set_isarray(false);
3208    arg_buffer->set_type(GLMessage::DataType::INT);
3209    arg_buffer->add_intvalue(buffer);
3210
3211    // call function
3212    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3213    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3214    GLboolean retValue = glContext->hooks->gl.glIsBuffer(buffer);
3215    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3216    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3217
3218    // set return value
3219    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3220    rt->set_isarray(false);
3221    rt->set_type(GLMessage::DataType::BOOL);
3222    rt->add_boolvalue(retValue);
3223
3224    void *pointerArgs[] = {
3225    };
3226
3227    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3228                              threadStartTime, threadEndTime,
3229                              &glmsg, pointerArgs);
3230    glContext->traceGLMessage(&glmsg);
3231
3232    return retValue;
3233}
3234
3235GLboolean GLTrace_glIsEnabled(GLenum cap) {
3236    GLMessage glmsg;
3237    GLTraceContext *glContext = getGLTraceContext();
3238
3239    glmsg.set_function(GLMessage::glIsEnabled);
3240
3241    // copy argument cap
3242    GLMessage_DataType *arg_cap = glmsg.add_args();
3243    arg_cap->set_isarray(false);
3244    arg_cap->set_type(GLMessage::DataType::ENUM);
3245    arg_cap->add_intvalue((int)cap);
3246
3247    // call function
3248    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3249    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3250    GLboolean retValue = glContext->hooks->gl.glIsEnabled(cap);
3251    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3252    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3253
3254    // set return value
3255    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3256    rt->set_isarray(false);
3257    rt->set_type(GLMessage::DataType::BOOL);
3258    rt->add_boolvalue(retValue);
3259
3260    void *pointerArgs[] = {
3261    };
3262
3263    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3264                              threadStartTime, threadEndTime,
3265                              &glmsg, pointerArgs);
3266    glContext->traceGLMessage(&glmsg);
3267
3268    return retValue;
3269}
3270
3271GLboolean GLTrace_glIsFramebuffer(GLuint framebuffer) {
3272    GLMessage glmsg;
3273    GLTraceContext *glContext = getGLTraceContext();
3274
3275    glmsg.set_function(GLMessage::glIsFramebuffer);
3276
3277    // copy argument framebuffer
3278    GLMessage_DataType *arg_framebuffer = glmsg.add_args();
3279    arg_framebuffer->set_isarray(false);
3280    arg_framebuffer->set_type(GLMessage::DataType::INT);
3281    arg_framebuffer->add_intvalue(framebuffer);
3282
3283    // call function
3284    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3285    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3286    GLboolean retValue = glContext->hooks->gl.glIsFramebuffer(framebuffer);
3287    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3288    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3289
3290    // set return value
3291    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3292    rt->set_isarray(false);
3293    rt->set_type(GLMessage::DataType::BOOL);
3294    rt->add_boolvalue(retValue);
3295
3296    void *pointerArgs[] = {
3297    };
3298
3299    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3300                              threadStartTime, threadEndTime,
3301                              &glmsg, pointerArgs);
3302    glContext->traceGLMessage(&glmsg);
3303
3304    return retValue;
3305}
3306
3307GLboolean GLTrace_glIsProgram(GLuint program) {
3308    GLMessage glmsg;
3309    GLTraceContext *glContext = getGLTraceContext();
3310
3311    glmsg.set_function(GLMessage::glIsProgram);
3312
3313    // copy argument program
3314    GLMessage_DataType *arg_program = glmsg.add_args();
3315    arg_program->set_isarray(false);
3316    arg_program->set_type(GLMessage::DataType::INT);
3317    arg_program->add_intvalue(program);
3318
3319    // call function
3320    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3321    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3322    GLboolean retValue = glContext->hooks->gl.glIsProgram(program);
3323    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3324    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3325
3326    // set return value
3327    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3328    rt->set_isarray(false);
3329    rt->set_type(GLMessage::DataType::BOOL);
3330    rt->add_boolvalue(retValue);
3331
3332    void *pointerArgs[] = {
3333    };
3334
3335    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3336                              threadStartTime, threadEndTime,
3337                              &glmsg, pointerArgs);
3338    glContext->traceGLMessage(&glmsg);
3339
3340    return retValue;
3341}
3342
3343GLboolean GLTrace_glIsRenderbuffer(GLuint renderbuffer) {
3344    GLMessage glmsg;
3345    GLTraceContext *glContext = getGLTraceContext();
3346
3347    glmsg.set_function(GLMessage::glIsRenderbuffer);
3348
3349    // copy argument renderbuffer
3350    GLMessage_DataType *arg_renderbuffer = glmsg.add_args();
3351    arg_renderbuffer->set_isarray(false);
3352    arg_renderbuffer->set_type(GLMessage::DataType::INT);
3353    arg_renderbuffer->add_intvalue(renderbuffer);
3354
3355    // call function
3356    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3357    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3358    GLboolean retValue = glContext->hooks->gl.glIsRenderbuffer(renderbuffer);
3359    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3360    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3361
3362    // set return value
3363    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3364    rt->set_isarray(false);
3365    rt->set_type(GLMessage::DataType::BOOL);
3366    rt->add_boolvalue(retValue);
3367
3368    void *pointerArgs[] = {
3369    };
3370
3371    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3372                              threadStartTime, threadEndTime,
3373                              &glmsg, pointerArgs);
3374    glContext->traceGLMessage(&glmsg);
3375
3376    return retValue;
3377}
3378
3379GLboolean GLTrace_glIsShader(GLuint shader) {
3380    GLMessage glmsg;
3381    GLTraceContext *glContext = getGLTraceContext();
3382
3383    glmsg.set_function(GLMessage::glIsShader);
3384
3385    // copy argument shader
3386    GLMessage_DataType *arg_shader = glmsg.add_args();
3387    arg_shader->set_isarray(false);
3388    arg_shader->set_type(GLMessage::DataType::INT);
3389    arg_shader->add_intvalue(shader);
3390
3391    // call function
3392    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3393    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3394    GLboolean retValue = glContext->hooks->gl.glIsShader(shader);
3395    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3396    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3397
3398    // set return value
3399    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3400    rt->set_isarray(false);
3401    rt->set_type(GLMessage::DataType::BOOL);
3402    rt->add_boolvalue(retValue);
3403
3404    void *pointerArgs[] = {
3405    };
3406
3407    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3408                              threadStartTime, threadEndTime,
3409                              &glmsg, pointerArgs);
3410    glContext->traceGLMessage(&glmsg);
3411
3412    return retValue;
3413}
3414
3415GLboolean GLTrace_glIsTexture(GLuint texture) {
3416    GLMessage glmsg;
3417    GLTraceContext *glContext = getGLTraceContext();
3418
3419    glmsg.set_function(GLMessage::glIsTexture);
3420
3421    // copy argument texture
3422    GLMessage_DataType *arg_texture = glmsg.add_args();
3423    arg_texture->set_isarray(false);
3424    arg_texture->set_type(GLMessage::DataType::INT);
3425    arg_texture->add_intvalue(texture);
3426
3427    // call function
3428    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3429    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3430    GLboolean retValue = glContext->hooks->gl.glIsTexture(texture);
3431    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3432    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3433
3434    // set return value
3435    GLMessage_DataType *rt = glmsg.mutable_returnvalue();
3436    rt->set_isarray(false);
3437    rt->set_type(GLMessage::DataType::BOOL);
3438    rt->add_boolvalue(retValue);
3439
3440    void *pointerArgs[] = {
3441    };
3442
3443    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3444                              threadStartTime, threadEndTime,
3445                              &glmsg, pointerArgs);
3446    glContext->traceGLMessage(&glmsg);
3447
3448    return retValue;
3449}
3450
3451void GLTrace_glLineWidth(GLfloat width) {
3452    GLMessage glmsg;
3453    GLTraceContext *glContext = getGLTraceContext();
3454
3455    glmsg.set_function(GLMessage::glLineWidth);
3456
3457    // copy argument width
3458    GLMessage_DataType *arg_width = glmsg.add_args();
3459    arg_width->set_isarray(false);
3460    arg_width->set_type(GLMessage::DataType::FLOAT);
3461    arg_width->add_floatvalue(width);
3462
3463    // call function
3464    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3465    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3466    glContext->hooks->gl.glLineWidth(width);
3467    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3468    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3469
3470    void *pointerArgs[] = {
3471    };
3472
3473    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3474                              threadStartTime, threadEndTime,
3475                              &glmsg, pointerArgs);
3476    glContext->traceGLMessage(&glmsg);
3477}
3478
3479void GLTrace_glLinkProgram(GLuint program) {
3480    GLMessage glmsg;
3481    GLTraceContext *glContext = getGLTraceContext();
3482
3483    glmsg.set_function(GLMessage::glLinkProgram);
3484
3485    // copy argument program
3486    GLMessage_DataType *arg_program = glmsg.add_args();
3487    arg_program->set_isarray(false);
3488    arg_program->set_type(GLMessage::DataType::INT);
3489    arg_program->add_intvalue(program);
3490
3491    // call function
3492    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3493    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3494    glContext->hooks->gl.glLinkProgram(program);
3495    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3496    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3497
3498    void *pointerArgs[] = {
3499    };
3500
3501    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3502                              threadStartTime, threadEndTime,
3503                              &glmsg, pointerArgs);
3504    glContext->traceGLMessage(&glmsg);
3505}
3506
3507void GLTrace_glPixelStorei(GLenum pname, GLint param) {
3508    GLMessage glmsg;
3509    GLTraceContext *glContext = getGLTraceContext();
3510
3511    glmsg.set_function(GLMessage::glPixelStorei);
3512
3513    // copy argument pname
3514    GLMessage_DataType *arg_pname = glmsg.add_args();
3515    arg_pname->set_isarray(false);
3516    arg_pname->set_type(GLMessage::DataType::ENUM);
3517    arg_pname->add_intvalue((int)pname);
3518
3519    // copy argument param
3520    GLMessage_DataType *arg_param = glmsg.add_args();
3521    arg_param->set_isarray(false);
3522    arg_param->set_type(GLMessage::DataType::INT);
3523    arg_param->add_intvalue(param);
3524
3525    // call function
3526    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3527    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3528    glContext->hooks->gl.glPixelStorei(pname, param);
3529    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3530    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3531
3532    void *pointerArgs[] = {
3533    };
3534
3535    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3536                              threadStartTime, threadEndTime,
3537                              &glmsg, pointerArgs);
3538    glContext->traceGLMessage(&glmsg);
3539}
3540
3541void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units) {
3542    GLMessage glmsg;
3543    GLTraceContext *glContext = getGLTraceContext();
3544
3545    glmsg.set_function(GLMessage::glPolygonOffset);
3546
3547    // copy argument factor
3548    GLMessage_DataType *arg_factor = glmsg.add_args();
3549    arg_factor->set_isarray(false);
3550    arg_factor->set_type(GLMessage::DataType::FLOAT);
3551    arg_factor->add_floatvalue(factor);
3552
3553    // copy argument units
3554    GLMessage_DataType *arg_units = glmsg.add_args();
3555    arg_units->set_isarray(false);
3556    arg_units->set_type(GLMessage::DataType::FLOAT);
3557    arg_units->add_floatvalue(units);
3558
3559    // call function
3560    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3561    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3562    glContext->hooks->gl.glPolygonOffset(factor, units);
3563    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3564    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3565
3566    void *pointerArgs[] = {
3567    };
3568
3569    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3570                              threadStartTime, threadEndTime,
3571                              &glmsg, pointerArgs);
3572    glContext->traceGLMessage(&glmsg);
3573}
3574
3575void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) {
3576    GLMessage glmsg;
3577    GLTraceContext *glContext = getGLTraceContext();
3578
3579    glmsg.set_function(GLMessage::glReadPixels);
3580
3581    // copy argument x
3582    GLMessage_DataType *arg_x = glmsg.add_args();
3583    arg_x->set_isarray(false);
3584    arg_x->set_type(GLMessage::DataType::INT);
3585    arg_x->add_intvalue(x);
3586
3587    // copy argument y
3588    GLMessage_DataType *arg_y = glmsg.add_args();
3589    arg_y->set_isarray(false);
3590    arg_y->set_type(GLMessage::DataType::INT);
3591    arg_y->add_intvalue(y);
3592
3593    // copy argument width
3594    GLMessage_DataType *arg_width = glmsg.add_args();
3595    arg_width->set_isarray(false);
3596    arg_width->set_type(GLMessage::DataType::INT);
3597    arg_width->add_intvalue(width);
3598
3599    // copy argument height
3600    GLMessage_DataType *arg_height = glmsg.add_args();
3601    arg_height->set_isarray(false);
3602    arg_height->set_type(GLMessage::DataType::INT);
3603    arg_height->add_intvalue(height);
3604
3605    // copy argument format
3606    GLMessage_DataType *arg_format = glmsg.add_args();
3607    arg_format->set_isarray(false);
3608    arg_format->set_type(GLMessage::DataType::ENUM);
3609    arg_format->add_intvalue((int)format);
3610
3611    // copy argument type
3612    GLMessage_DataType *arg_type = glmsg.add_args();
3613    arg_type->set_isarray(false);
3614    arg_type->set_type(GLMessage::DataType::ENUM);
3615    arg_type->add_intvalue((int)type);
3616
3617    // copy argument pixels
3618    GLMessage_DataType *arg_pixels = glmsg.add_args();
3619    arg_pixels->set_isarray(false);
3620    arg_pixels->set_type(GLMessage::DataType::INT);
3621    arg_pixels->add_intvalue((int)pixels);
3622
3623    // call function
3624    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3625    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3626    glContext->hooks->gl.glReadPixels(x, y, width, height, format, type, pixels);
3627    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3628    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3629
3630    void *pointerArgs[] = {
3631        (void *) pixels,
3632    };
3633
3634    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3635                              threadStartTime, threadEndTime,
3636                              &glmsg, pointerArgs);
3637    glContext->traceGLMessage(&glmsg);
3638}
3639
3640void GLTrace_glReleaseShaderCompiler(void) {
3641    GLMessage glmsg;
3642    GLTraceContext *glContext = getGLTraceContext();
3643
3644    glmsg.set_function(GLMessage::glReleaseShaderCompiler);
3645
3646    // call function
3647    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3648    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3649    glContext->hooks->gl.glReleaseShaderCompiler();
3650    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3651    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3652
3653    void *pointerArgs[] = {
3654    };
3655
3656    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3657                              threadStartTime, threadEndTime,
3658                              &glmsg, pointerArgs);
3659    glContext->traceGLMessage(&glmsg);
3660}
3661
3662void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
3663    GLMessage glmsg;
3664    GLTraceContext *glContext = getGLTraceContext();
3665
3666    glmsg.set_function(GLMessage::glRenderbufferStorage);
3667
3668    // copy argument target
3669    GLMessage_DataType *arg_target = glmsg.add_args();
3670    arg_target->set_isarray(false);
3671    arg_target->set_type(GLMessage::DataType::ENUM);
3672    arg_target->add_intvalue((int)target);
3673
3674    // copy argument internalformat
3675    GLMessage_DataType *arg_internalformat = glmsg.add_args();
3676    arg_internalformat->set_isarray(false);
3677    arg_internalformat->set_type(GLMessage::DataType::ENUM);
3678    arg_internalformat->add_intvalue((int)internalformat);
3679
3680    // copy argument width
3681    GLMessage_DataType *arg_width = glmsg.add_args();
3682    arg_width->set_isarray(false);
3683    arg_width->set_type(GLMessage::DataType::INT);
3684    arg_width->add_intvalue(width);
3685
3686    // copy argument height
3687    GLMessage_DataType *arg_height = glmsg.add_args();
3688    arg_height->set_isarray(false);
3689    arg_height->set_type(GLMessage::DataType::INT);
3690    arg_height->add_intvalue(height);
3691
3692    // call function
3693    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3694    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3695    glContext->hooks->gl.glRenderbufferStorage(target, internalformat, width, height);
3696    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3697    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3698
3699    void *pointerArgs[] = {
3700    };
3701
3702    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3703                              threadStartTime, threadEndTime,
3704                              &glmsg, pointerArgs);
3705    glContext->traceGLMessage(&glmsg);
3706}
3707
3708void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert) {
3709    GLMessage glmsg;
3710    GLTraceContext *glContext = getGLTraceContext();
3711
3712    glmsg.set_function(GLMessage::glSampleCoverage);
3713
3714    // copy argument value
3715    GLMessage_DataType *arg_value = glmsg.add_args();
3716    arg_value->set_isarray(false);
3717    arg_value->set_type(GLMessage::DataType::FLOAT);
3718    arg_value->add_floatvalue(value);
3719
3720    // copy argument invert
3721    GLMessage_DataType *arg_invert = glmsg.add_args();
3722    arg_invert->set_isarray(false);
3723    arg_invert->set_type(GLMessage::DataType::BOOL);
3724    arg_invert->add_boolvalue(invert);
3725
3726    // call function
3727    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3728    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3729    glContext->hooks->gl.glSampleCoverage(value, invert);
3730    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3731    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3732
3733    void *pointerArgs[] = {
3734    };
3735
3736    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3737                              threadStartTime, threadEndTime,
3738                              &glmsg, pointerArgs);
3739    glContext->traceGLMessage(&glmsg);
3740}
3741
3742void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
3743    GLMessage glmsg;
3744    GLTraceContext *glContext = getGLTraceContext();
3745
3746    glmsg.set_function(GLMessage::glScissor);
3747
3748    // copy argument x
3749    GLMessage_DataType *arg_x = glmsg.add_args();
3750    arg_x->set_isarray(false);
3751    arg_x->set_type(GLMessage::DataType::INT);
3752    arg_x->add_intvalue(x);
3753
3754    // copy argument y
3755    GLMessage_DataType *arg_y = glmsg.add_args();
3756    arg_y->set_isarray(false);
3757    arg_y->set_type(GLMessage::DataType::INT);
3758    arg_y->add_intvalue(y);
3759
3760    // copy argument width
3761    GLMessage_DataType *arg_width = glmsg.add_args();
3762    arg_width->set_isarray(false);
3763    arg_width->set_type(GLMessage::DataType::INT);
3764    arg_width->add_intvalue(width);
3765
3766    // copy argument height
3767    GLMessage_DataType *arg_height = glmsg.add_args();
3768    arg_height->set_isarray(false);
3769    arg_height->set_type(GLMessage::DataType::INT);
3770    arg_height->add_intvalue(height);
3771
3772    // call function
3773    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3774    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3775    glContext->hooks->gl.glScissor(x, y, width, height);
3776    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3777    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3778
3779    void *pointerArgs[] = {
3780    };
3781
3782    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3783                              threadStartTime, threadEndTime,
3784                              &glmsg, pointerArgs);
3785    glContext->traceGLMessage(&glmsg);
3786}
3787
3788void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) {
3789    GLMessage glmsg;
3790    GLTraceContext *glContext = getGLTraceContext();
3791
3792    glmsg.set_function(GLMessage::glShaderBinary);
3793
3794    // copy argument n
3795    GLMessage_DataType *arg_n = glmsg.add_args();
3796    arg_n->set_isarray(false);
3797    arg_n->set_type(GLMessage::DataType::INT);
3798    arg_n->add_intvalue(n);
3799
3800    // copy argument shaders
3801    GLMessage_DataType *arg_shaders = glmsg.add_args();
3802    arg_shaders->set_isarray(false);
3803    arg_shaders->set_type(GLMessage::DataType::INT);
3804    arg_shaders->add_intvalue((int)shaders);
3805
3806    // copy argument binaryformat
3807    GLMessage_DataType *arg_binaryformat = glmsg.add_args();
3808    arg_binaryformat->set_isarray(false);
3809    arg_binaryformat->set_type(GLMessage::DataType::ENUM);
3810    arg_binaryformat->add_intvalue((int)binaryformat);
3811
3812    // copy argument binary
3813    GLMessage_DataType *arg_binary = glmsg.add_args();
3814    arg_binary->set_isarray(false);
3815    arg_binary->set_type(GLMessage::DataType::INT);
3816    arg_binary->add_intvalue((int)binary);
3817
3818    // copy argument length
3819    GLMessage_DataType *arg_length = glmsg.add_args();
3820    arg_length->set_isarray(false);
3821    arg_length->set_type(GLMessage::DataType::INT);
3822    arg_length->add_intvalue(length);
3823
3824    // call function
3825    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3826    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3827    glContext->hooks->gl.glShaderBinary(n, shaders, binaryformat, binary, length);
3828    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3829    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3830
3831    void *pointerArgs[] = {
3832        (void *) shaders,
3833        (void *) binary,
3834    };
3835
3836    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3837                              threadStartTime, threadEndTime,
3838                              &glmsg, pointerArgs);
3839    glContext->traceGLMessage(&glmsg);
3840}
3841
3842void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) {
3843    GLMessage glmsg;
3844    GLTraceContext *glContext = getGLTraceContext();
3845
3846    glmsg.set_function(GLMessage::glShaderSource);
3847
3848    // copy argument shader
3849    GLMessage_DataType *arg_shader = glmsg.add_args();
3850    arg_shader->set_isarray(false);
3851    arg_shader->set_type(GLMessage::DataType::INT);
3852    arg_shader->add_intvalue(shader);
3853
3854    // copy argument count
3855    GLMessage_DataType *arg_count = glmsg.add_args();
3856    arg_count->set_isarray(false);
3857    arg_count->set_type(GLMessage::DataType::INT);
3858    arg_count->add_intvalue(count);
3859
3860    // copy argument string
3861    GLMessage_DataType *arg_string = glmsg.add_args();
3862    arg_string->set_isarray(false);
3863    arg_string->set_type(GLMessage::DataType::INT);
3864    arg_string->add_intvalue((int)string);
3865
3866    // copy argument length
3867    GLMessage_DataType *arg_length = glmsg.add_args();
3868    arg_length->set_isarray(false);
3869    arg_length->set_type(GLMessage::DataType::INT);
3870    arg_length->add_intvalue((int)length);
3871
3872    // call function
3873    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3874    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3875    glContext->hooks->gl.glShaderSource(shader, count, string, length);
3876    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3877    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3878
3879    void *pointerArgs[] = {
3880        (void *) string,
3881        (void *) length,
3882    };
3883
3884    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3885                              threadStartTime, threadEndTime,
3886                              &glmsg, pointerArgs);
3887    glContext->traceGLMessage(&glmsg);
3888}
3889
3890void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask) {
3891    GLMessage glmsg;
3892    GLTraceContext *glContext = getGLTraceContext();
3893
3894    glmsg.set_function(GLMessage::glStencilFunc);
3895
3896    // copy argument func
3897    GLMessage_DataType *arg_func = glmsg.add_args();
3898    arg_func->set_isarray(false);
3899    arg_func->set_type(GLMessage::DataType::ENUM);
3900    arg_func->add_intvalue((int)func);
3901
3902    // copy argument ref
3903    GLMessage_DataType *arg_ref = glmsg.add_args();
3904    arg_ref->set_isarray(false);
3905    arg_ref->set_type(GLMessage::DataType::INT);
3906    arg_ref->add_intvalue(ref);
3907
3908    // copy argument mask
3909    GLMessage_DataType *arg_mask = glmsg.add_args();
3910    arg_mask->set_isarray(false);
3911    arg_mask->set_type(GLMessage::DataType::INT);
3912    arg_mask->add_intvalue(mask);
3913
3914    // call function
3915    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3916    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3917    glContext->hooks->gl.glStencilFunc(func, ref, mask);
3918    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3919    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3920
3921    void *pointerArgs[] = {
3922    };
3923
3924    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3925                              threadStartTime, threadEndTime,
3926                              &glmsg, pointerArgs);
3927    glContext->traceGLMessage(&glmsg);
3928}
3929
3930void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
3931    GLMessage glmsg;
3932    GLTraceContext *glContext = getGLTraceContext();
3933
3934    glmsg.set_function(GLMessage::glStencilFuncSeparate);
3935
3936    // copy argument face
3937    GLMessage_DataType *arg_face = glmsg.add_args();
3938    arg_face->set_isarray(false);
3939    arg_face->set_type(GLMessage::DataType::ENUM);
3940    arg_face->add_intvalue((int)face);
3941
3942    // copy argument func
3943    GLMessage_DataType *arg_func = glmsg.add_args();
3944    arg_func->set_isarray(false);
3945    arg_func->set_type(GLMessage::DataType::ENUM);
3946    arg_func->add_intvalue((int)func);
3947
3948    // copy argument ref
3949    GLMessage_DataType *arg_ref = glmsg.add_args();
3950    arg_ref->set_isarray(false);
3951    arg_ref->set_type(GLMessage::DataType::INT);
3952    arg_ref->add_intvalue(ref);
3953
3954    // copy argument mask
3955    GLMessage_DataType *arg_mask = glmsg.add_args();
3956    arg_mask->set_isarray(false);
3957    arg_mask->set_type(GLMessage::DataType::INT);
3958    arg_mask->add_intvalue(mask);
3959
3960    // call function
3961    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3962    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3963    glContext->hooks->gl.glStencilFuncSeparate(face, func, ref, mask);
3964    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3965    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3966
3967    void *pointerArgs[] = {
3968    };
3969
3970    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3971                              threadStartTime, threadEndTime,
3972                              &glmsg, pointerArgs);
3973    glContext->traceGLMessage(&glmsg);
3974}
3975
3976void GLTrace_glStencilMask(GLuint mask) {
3977    GLMessage glmsg;
3978    GLTraceContext *glContext = getGLTraceContext();
3979
3980    glmsg.set_function(GLMessage::glStencilMask);
3981
3982    // copy argument mask
3983    GLMessage_DataType *arg_mask = glmsg.add_args();
3984    arg_mask->set_isarray(false);
3985    arg_mask->set_type(GLMessage::DataType::INT);
3986    arg_mask->add_intvalue(mask);
3987
3988    // call function
3989    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
3990    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
3991    glContext->hooks->gl.glStencilMask(mask);
3992    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
3993    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
3994
3995    void *pointerArgs[] = {
3996    };
3997
3998    fixupGLMessage(glContext, wallStartTime, wallEndTime,
3999                              threadStartTime, threadEndTime,
4000                              &glmsg, pointerArgs);
4001    glContext->traceGLMessage(&glmsg);
4002}
4003
4004void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask) {
4005    GLMessage glmsg;
4006    GLTraceContext *glContext = getGLTraceContext();
4007
4008    glmsg.set_function(GLMessage::glStencilMaskSeparate);
4009
4010    // copy argument face
4011    GLMessage_DataType *arg_face = glmsg.add_args();
4012    arg_face->set_isarray(false);
4013    arg_face->set_type(GLMessage::DataType::ENUM);
4014    arg_face->add_intvalue((int)face);
4015
4016    // copy argument mask
4017    GLMessage_DataType *arg_mask = glmsg.add_args();
4018    arg_mask->set_isarray(false);
4019    arg_mask->set_type(GLMessage::DataType::INT);
4020    arg_mask->add_intvalue(mask);
4021
4022    // call function
4023    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
4024    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
4025    glContext->hooks->gl.glStencilMaskSeparate(face, mask);
4026    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
4027    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
4028
4029    void *pointerArgs[] = {
4030    };
4031
4032    fixupGLMessage(glContext, wallStartTime, wallEndTime,
4033                              threadStartTime, threadEndTime,
4034                              &glmsg, pointerArgs);
4035    glContext->traceGLMessage(&glmsg);
4036}
4037
4038void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
4039    GLMessage glmsg;
4040    GLTraceContext *glContext = getGLTraceContext();
4041
4042    glmsg.set_function(GLMessage::glStencilOp);
4043
4044    // copy argument fail
4045    GLMessage_DataType *arg_fail = glmsg.add_args();
4046    arg_fail->set_isarray(false);
4047    arg_fail->set_type(GLMessage::DataType::ENUM);
4048    arg_fail->add_intvalue((int)fail);
4049
4050    // copy argument zfail
4051    GLMessage_DataType *arg_zfail = glmsg.add_args();
4052    arg_zfail->set_isarray(false);
4053    arg_zfail->set_type(GLMessage::DataType::ENUM);
4054    arg_zfail->add_intvalue((int)zfail);
4055
4056    // copy argument zpass
4057    GLMessage_DataType *arg_zpass = glmsg.add_args();
4058    arg_zpass->set_isarray(false);
4059    arg_zpass->set_type(GLMessage::DataType::ENUM);
4060    arg_zpass->add_intvalue((int)zpass);
4061
4062    // call function
4063    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
4064    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
4065    glContext->hooks->gl.glStencilOp(fail, zfail, zpass);
4066    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
4067    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
4068
4069    void *pointerArgs[] = {
4070    };
4071
4072    fixupGLMessage(glContext, wallStartTime, wallEndTime,
4073                              threadStartTime, threadEndTime,
4074                              &glmsg, pointerArgs);
4075    glContext->traceGLMessage(&glmsg);
4076}
4077
4078void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
4079    GLMessage glmsg;
4080    GLTraceContext *glContext = getGLTraceContext();
4081
4082    glmsg.set_function(GLMessage::glStencilOpSeparate);
4083
4084    // copy argument face
4085    GLMessage_DataType *arg_face = glmsg.add_args();
4086    arg_face->set_isarray(false);
4087    arg_face->set_type(GLMessage::DataType::ENUM);
4088    arg_face->add_intvalue((int)face);
4089
4090    // copy argument fail
4091    GLMessage_DataType *arg_fail = glmsg.add_args();
4092    arg_fail->set_isarray(false);
4093    arg_fail->set_type(GLMessage::DataType::ENUM);
4094    arg_fail->add_intvalue((int)fail);
4095
4096    // copy argument zfail
4097    GLMessage_DataType *arg_zfail = glmsg.add_args();
4098    arg_zfail->set_isarray(false);
4099    arg_zfail->set_type(GLMessage::DataType::ENUM);
4100    arg_zfail->add_intvalue((int)zfail);
4101
4102    // copy argument zpass
4103    GLMessage_DataType *arg_zpass = glmsg.add_args();
4104    arg_zpass->set_isarray(false);
4105    arg_zpass->set_type(GLMessage::DataType::ENUM);
4106    arg_zpass->add_intvalue((int)zpass);
4107
4108    // call function
4109    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
4110    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
4111    glContext->hooks->gl.glStencilOpSeparate(face, fail, zfail, zpass);
4112    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
4113    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
4114
4115    void *pointerArgs[] = {
4116    };
4117
4118    fixupGLMessage(glContext, wallStartTime, wallEndTime,
4119                              threadStartTime, threadEndTime,
4120                              &glmsg, pointerArgs);
4121    glContext->traceGLMessage(&glmsg);
4122}
4123
4124void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) {
4125    GLMessage glmsg;
4126    GLTraceContext *glContext = getGLTraceContext();
4127
4128    glmsg.set_function(GLMessage::glTexImage2D);
4129
4130    // copy argument target
4131    GLMessage_DataType *arg_target = glmsg.add_args();
4132    arg_target->set_isarray(false);
4133    arg_target->set_type(GLMessage::DataType::ENUM);
4134    arg_target->add_intvalue((int)target);
4135
4136    // copy argument level
4137    GLMessage_DataType *arg_level = glmsg.add_args();
4138    arg_level->set_isarray(false);
4139    arg_level->set_type(GLMessage::DataType::INT);
4140    arg_level->add_intvalue(level);
4141
4142    // copy argument internalformat
4143    GLMessage_DataType *arg_internalformat = glmsg.add_args();
4144    arg_internalformat->set_isarray(false);
4145    arg_internalformat->set_type(GLMessage::DataType::INT);
4146    arg_internalformat->add_intvalue(internalformat);
4147
4148    // copy argument width
4149    GLMessage_DataType *arg_width = glmsg.add_args();
4150    arg_width->set_isarray(false);
4151    arg_width->set_type(GLMessage::DataType::INT);
4152    arg_width->add_intvalue(width);
4153
4154    // copy argument height
4155    GLMessage_DataType *arg_height = glmsg.add_args();
4156    arg_height->set_isarray(false);
4157    arg_height->set_type(GLMessage::DataType::INT);
4158    arg_height->add_intvalue(height);
4159
4160    // copy argument border
4161    GLMessage_DataType *arg_border = glmsg.add_args();
4162    arg_border->set_isarray(false);
4163    arg_border->set_type(GLMessage::DataType::INT);
4164    arg_border->add_intvalue(border);
4165
4166    // copy argument format
4167    GLMessage_DataType *arg_format = glmsg.add_args();
4168    arg_format->set_isarray(false);
4169    arg_format->set_type(GLMessage::DataType::ENUM);
4170    arg_format->add_intvalue((int)format);
4171
4172    // copy argument type
4173    GLMessage_DataType *arg_type = glmsg.add_args();
4174    arg_type->set_isarray(false);
4175    arg_type->set_type(GLMessage::DataType::ENUM);
4176    arg_type->add_intvalue((int)type);
4177
4178    // copy argument pixels
4179    GLMessage_DataType *arg_pixels = glmsg.add_args();
4180    arg_pixels->set_isarray(false);
4181    arg_pixels->set_type(GLMessage::DataType::INT);
4182    arg_pixels->add_intvalue((int)pixels);
4183
4184    // call function
4185    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
4186    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
4187    glContext->hooks->gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
4188    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
4189    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
4190
4191    void *pointerArgs[] = {
4192        (void *) pixels,
4193    };
4194
4195    fixupGLMessage(glContext, wallStartTime, wallEndTime,
4196                              threadStartTime, threadEndTime,
4197                              &glmsg, pointerArgs);
4198    glContext->traceGLMessage(&glmsg);
4199}
4200
4201void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param) {
4202    GLMessage glmsg;
4203    GLTraceContext *glContext = getGLTraceContext();
4204
4205    glmsg.set_function(GLMessage::glTexParameterf);
4206
4207    // copy argument target
4208    GLMessage_DataType *arg_target = glmsg.add_args();
4209    arg_target->set_isarray(false);
4210    arg_target->set_type(GLMessage::DataType::ENUM);
4211    arg_target->add_intvalue((int)target);
4212
4213    // copy argument pname
4214    GLMessage_DataType *arg_pname = glmsg.add_args();
4215    arg_pname->set_isarray(false);
4216    arg_pname->set_type(GLMessage::DataType::ENUM);
4217    arg_pname->add_intvalue((int)pname);
4218
4219    // copy argument param
4220    GLMessage_DataType *arg_param = glmsg.add_args();
4221    arg_param->set_isarray(false);
4222    arg_param->set_type(GLMessage::DataType::FLOAT);
4223    arg_param->add_floatvalue(param);
4224
4225    // call function
4226    nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
4227    nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
4228    glContext->hooks->gl.glTexParameterf(target, pname, param);
4229    nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
4230    nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
4231
4232    void *pointerArgs[] = {
4233    };
4234
4235    fixupGLMessage(glContext, wallStartTime, wallEndTime,
4236                              threadStartTime, threadEndTime,
4237                              &glmsg, pointerArgs);
4238    glContext->traceGLMessage(&glmsg);
4239}
4240
4241void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) {
4242    GLMessage glmsg;
4243    GLTraceContext *glContext = getGLTraceContext();
4244
4245    glmsg.set_function(GLMessage::glTexParameterfv);
4246
4247    // copy argument target
4248    GLMessage_DataType *arg_target = glmsg.add_args();
4249    arg_target->set_isarray(false);
4250    arg_target->set_type(GLMessage::DataType::ENUM);
4251    arg_target->add_intvalue((int)target);
4252
4253    // copy argument pname
4254    GLMessage_DataType *arg_pname = glmsg.add_args();
4255    arg_pname->set_isarray(false);
4256    arg_pname->set_type(GLMessage::DataType::ENUM);
4257    arg_pname->add_intvalue((int)pname);
4258
4259    // copy argument params
4260    GLMessage_DataType *arg_params = glmsg.add_args();
4261    arg_params->set_isarray(false);
4262    arg_params->set_type(GLMessage::DataType::INT);
4263    arg_params->add_intvalue((int)params);
4264
4265    // call function