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