1 // Generated Code - DO NOT EDIT !!
2 // generated by 'emugen'
3
4
5 #include <string.h>
6 #include "gl2_opcodes.h"
7
8 #include "gl2_enc.h"
9
10
11 #include <stdio.h>
12
13 namespace {
14
enc_unsupported()15 void enc_unsupported()
16 {
17 ALOGE("Function is unsupported\n");
18 }
19
glActiveTexture_enc(void * self,GLenum texture)20 void glActiveTexture_enc(void *self , GLenum texture)
21 {
22
23 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
24 IOStream *stream = ctx->m_stream;
25 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
26 bool useChecksum = checksumCalculator->getVersion() > 0;
27
28 unsigned char *ptr;
29 unsigned char *buf;
30 const size_t sizeWithoutChecksum = 8 + 4;
31 const size_t checksumSize = checksumCalculator->checksumByteSize();
32 const size_t totalSize = sizeWithoutChecksum + checksumSize;
33 buf = stream->alloc(totalSize);
34 ptr = buf;
35 int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
36 memcpy(ptr, &totalSize, 4); ptr += 4;
37
38 memcpy(ptr, &texture, 4); ptr += 4;
39
40 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
41 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
42
43 }
44
glAttachShader_enc(void * self,GLuint program,GLuint shader)45 void glAttachShader_enc(void *self , GLuint program, GLuint shader)
46 {
47
48 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
49 IOStream *stream = ctx->m_stream;
50 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
51 bool useChecksum = checksumCalculator->getVersion() > 0;
52
53 unsigned char *ptr;
54 unsigned char *buf;
55 const size_t sizeWithoutChecksum = 8 + 4 + 4;
56 const size_t checksumSize = checksumCalculator->checksumByteSize();
57 const size_t totalSize = sizeWithoutChecksum + checksumSize;
58 buf = stream->alloc(totalSize);
59 ptr = buf;
60 int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
61 memcpy(ptr, &totalSize, 4); ptr += 4;
62
63 memcpy(ptr, &program, 4); ptr += 4;
64 memcpy(ptr, &shader, 4); ptr += 4;
65
66 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
67 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
68
69 }
70
glBindAttribLocation_enc(void * self,GLuint program,GLuint index,const GLchar * name)71 void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
72 {
73
74 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
75 IOStream *stream = ctx->m_stream;
76 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
77 bool useChecksum = checksumCalculator->getVersion() > 0;
78
79 const unsigned int __size_name = (strlen(name) + 1);
80 unsigned char *ptr;
81 unsigned char *buf;
82 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
83 const size_t checksumSize = checksumCalculator->checksumByteSize();
84 const size_t totalSize = sizeWithoutChecksum + checksumSize;
85 buf = stream->alloc(totalSize);
86 ptr = buf;
87 int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
88 memcpy(ptr, &totalSize, 4); ptr += 4;
89
90 memcpy(ptr, &program, 4); ptr += 4;
91 memcpy(ptr, &index, 4); ptr += 4;
92 *(unsigned int *)(ptr) = __size_name; ptr += 4;
93 memcpy(ptr, name, __size_name);ptr += __size_name;
94
95 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
96 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
97
98 }
99
glBindBuffer_enc(void * self,GLenum target,GLuint buffer)100 void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
101 {
102
103 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
104 IOStream *stream = ctx->m_stream;
105 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
106 bool useChecksum = checksumCalculator->getVersion() > 0;
107
108 unsigned char *ptr;
109 unsigned char *buf;
110 const size_t sizeWithoutChecksum = 8 + 4 + 4;
111 const size_t checksumSize = checksumCalculator->checksumByteSize();
112 const size_t totalSize = sizeWithoutChecksum + checksumSize;
113 buf = stream->alloc(totalSize);
114 ptr = buf;
115 int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
116 memcpy(ptr, &totalSize, 4); ptr += 4;
117
118 memcpy(ptr, &target, 4); ptr += 4;
119 memcpy(ptr, &buffer, 4); ptr += 4;
120
121 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
122 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
123
124 }
125
glBindFramebuffer_enc(void * self,GLenum target,GLuint framebuffer)126 void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
127 {
128
129 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
130 IOStream *stream = ctx->m_stream;
131 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
132 bool useChecksum = checksumCalculator->getVersion() > 0;
133
134 unsigned char *ptr;
135 unsigned char *buf;
136 const size_t sizeWithoutChecksum = 8 + 4 + 4;
137 const size_t checksumSize = checksumCalculator->checksumByteSize();
138 const size_t totalSize = sizeWithoutChecksum + checksumSize;
139 buf = stream->alloc(totalSize);
140 ptr = buf;
141 int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
142 memcpy(ptr, &totalSize, 4); ptr += 4;
143
144 memcpy(ptr, &target, 4); ptr += 4;
145 memcpy(ptr, &framebuffer, 4); ptr += 4;
146
147 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
148 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
149
150 }
151
glBindRenderbuffer_enc(void * self,GLenum target,GLuint renderbuffer)152 void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
153 {
154
155 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
156 IOStream *stream = ctx->m_stream;
157 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
158 bool useChecksum = checksumCalculator->getVersion() > 0;
159
160 unsigned char *ptr;
161 unsigned char *buf;
162 const size_t sizeWithoutChecksum = 8 + 4 + 4;
163 const size_t checksumSize = checksumCalculator->checksumByteSize();
164 const size_t totalSize = sizeWithoutChecksum + checksumSize;
165 buf = stream->alloc(totalSize);
166 ptr = buf;
167 int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
168 memcpy(ptr, &totalSize, 4); ptr += 4;
169
170 memcpy(ptr, &target, 4); ptr += 4;
171 memcpy(ptr, &renderbuffer, 4); ptr += 4;
172
173 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
174 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
175
176 }
177
glBindTexture_enc(void * self,GLenum target,GLuint texture)178 void glBindTexture_enc(void *self , GLenum target, GLuint texture)
179 {
180
181 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
182 IOStream *stream = ctx->m_stream;
183 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
184 bool useChecksum = checksumCalculator->getVersion() > 0;
185
186 unsigned char *ptr;
187 unsigned char *buf;
188 const size_t sizeWithoutChecksum = 8 + 4 + 4;
189 const size_t checksumSize = checksumCalculator->checksumByteSize();
190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
191 buf = stream->alloc(totalSize);
192 ptr = buf;
193 int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
194 memcpy(ptr, &totalSize, 4); ptr += 4;
195
196 memcpy(ptr, &target, 4); ptr += 4;
197 memcpy(ptr, &texture, 4); ptr += 4;
198
199 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
200 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
201
202 }
203
glBlendColor_enc(void * self,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)204 void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
205 {
206
207 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
208 IOStream *stream = ctx->m_stream;
209 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
210 bool useChecksum = checksumCalculator->getVersion() > 0;
211
212 unsigned char *ptr;
213 unsigned char *buf;
214 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
215 const size_t checksumSize = checksumCalculator->checksumByteSize();
216 const size_t totalSize = sizeWithoutChecksum + checksumSize;
217 buf = stream->alloc(totalSize);
218 ptr = buf;
219 int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
220 memcpy(ptr, &totalSize, 4); ptr += 4;
221
222 memcpy(ptr, &red, 4); ptr += 4;
223 memcpy(ptr, &green, 4); ptr += 4;
224 memcpy(ptr, &blue, 4); ptr += 4;
225 memcpy(ptr, &alpha, 4); ptr += 4;
226
227 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
228 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
229
230 }
231
glBlendEquation_enc(void * self,GLenum mode)232 void glBlendEquation_enc(void *self , GLenum mode)
233 {
234
235 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
236 IOStream *stream = ctx->m_stream;
237 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
238 bool useChecksum = checksumCalculator->getVersion() > 0;
239
240 unsigned char *ptr;
241 unsigned char *buf;
242 const size_t sizeWithoutChecksum = 8 + 4;
243 const size_t checksumSize = checksumCalculator->checksumByteSize();
244 const size_t totalSize = sizeWithoutChecksum + checksumSize;
245 buf = stream->alloc(totalSize);
246 ptr = buf;
247 int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
248 memcpy(ptr, &totalSize, 4); ptr += 4;
249
250 memcpy(ptr, &mode, 4); ptr += 4;
251
252 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
253 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
254
255 }
256
glBlendEquationSeparate_enc(void * self,GLenum modeRGB,GLenum modeAlpha)257 void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
258 {
259
260 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
261 IOStream *stream = ctx->m_stream;
262 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
263 bool useChecksum = checksumCalculator->getVersion() > 0;
264
265 unsigned char *ptr;
266 unsigned char *buf;
267 const size_t sizeWithoutChecksum = 8 + 4 + 4;
268 const size_t checksumSize = checksumCalculator->checksumByteSize();
269 const size_t totalSize = sizeWithoutChecksum + checksumSize;
270 buf = stream->alloc(totalSize);
271 ptr = buf;
272 int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
273 memcpy(ptr, &totalSize, 4); ptr += 4;
274
275 memcpy(ptr, &modeRGB, 4); ptr += 4;
276 memcpy(ptr, &modeAlpha, 4); ptr += 4;
277
278 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
279 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
280
281 }
282
glBlendFunc_enc(void * self,GLenum sfactor,GLenum dfactor)283 void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
284 {
285
286 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
287 IOStream *stream = ctx->m_stream;
288 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
289 bool useChecksum = checksumCalculator->getVersion() > 0;
290
291 unsigned char *ptr;
292 unsigned char *buf;
293 const size_t sizeWithoutChecksum = 8 + 4 + 4;
294 const size_t checksumSize = checksumCalculator->checksumByteSize();
295 const size_t totalSize = sizeWithoutChecksum + checksumSize;
296 buf = stream->alloc(totalSize);
297 ptr = buf;
298 int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
299 memcpy(ptr, &totalSize, 4); ptr += 4;
300
301 memcpy(ptr, &sfactor, 4); ptr += 4;
302 memcpy(ptr, &dfactor, 4); ptr += 4;
303
304 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
305 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
306
307 }
308
glBlendFuncSeparate_enc(void * self,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)309 void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
310 {
311
312 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
313 IOStream *stream = ctx->m_stream;
314 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
315 bool useChecksum = checksumCalculator->getVersion() > 0;
316
317 unsigned char *ptr;
318 unsigned char *buf;
319 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
320 const size_t checksumSize = checksumCalculator->checksumByteSize();
321 const size_t totalSize = sizeWithoutChecksum + checksumSize;
322 buf = stream->alloc(totalSize);
323 ptr = buf;
324 int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
325 memcpy(ptr, &totalSize, 4); ptr += 4;
326
327 memcpy(ptr, &srcRGB, 4); ptr += 4;
328 memcpy(ptr, &dstRGB, 4); ptr += 4;
329 memcpy(ptr, &srcAlpha, 4); ptr += 4;
330 memcpy(ptr, &dstAlpha, 4); ptr += 4;
331
332 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
333 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
334
335 }
336
glBufferData_enc(void * self,GLenum target,GLsizeiptr size,const GLvoid * data,GLenum usage)337 void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
338 {
339
340 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
341 IOStream *stream = ctx->m_stream;
342 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
343 bool useChecksum = checksumCalculator->getVersion() > 0;
344
345 const unsigned int __size_data = ((data != NULL) ? size : 0);
346 unsigned char *ptr;
347 unsigned char *buf;
348 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
349 const size_t checksumSize = checksumCalculator->checksumByteSize();
350 const size_t totalSize = sizeWithoutChecksum + checksumSize;
351 buf = stream->alloc(8 + 4 + 4);
352 ptr = buf;
353 int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
354 memcpy(ptr, &totalSize, 4); ptr += 4;
355
356 memcpy(ptr, &target, 4); ptr += 4;
357 memcpy(ptr, &size, 4); ptr += 4;
358
359 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
360 stream->flush();
361 stream->writeFully(&__size_data,4);
362 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
363 if (data != NULL) {
364 stream->writeFully(data, __size_data);
365 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
366 }
367 buf = stream->alloc(4);
368 ptr = buf;
369 memcpy(ptr, &usage, 4); ptr += 4;
370
371 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
372 buf = stream->alloc(checksumSize);
373 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
374
375 }
376
glBufferSubData_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid * data)377 void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
378 {
379
380 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
381 IOStream *stream = ctx->m_stream;
382 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
383 bool useChecksum = checksumCalculator->getVersion() > 0;
384
385 const unsigned int __size_data = ((data != NULL) ? size : 0);
386 unsigned char *ptr;
387 unsigned char *buf;
388 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
389 const size_t checksumSize = checksumCalculator->checksumByteSize();
390 const size_t totalSize = sizeWithoutChecksum + checksumSize;
391 buf = stream->alloc(8 + 4 + 4 + 4);
392 ptr = buf;
393 int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
394 memcpy(ptr, &totalSize, 4); ptr += 4;
395
396 memcpy(ptr, &target, 4); ptr += 4;
397 memcpy(ptr, &offset, 4); ptr += 4;
398 memcpy(ptr, &size, 4); ptr += 4;
399
400 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
401 stream->flush();
402 stream->writeFully(&__size_data,4);
403 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
404 if (data != NULL) {
405 stream->writeFully(data, __size_data);
406 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
407 }
408 buf = stream->alloc(checksumSize);
409 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
410
411 }
412
glCheckFramebufferStatus_enc(void * self,GLenum target)413 GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
414 {
415
416 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
417 IOStream *stream = ctx->m_stream;
418 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
419 bool useChecksum = checksumCalculator->getVersion() > 0;
420
421 unsigned char *ptr;
422 unsigned char *buf;
423 const size_t sizeWithoutChecksum = 8 + 4;
424 const size_t checksumSize = checksumCalculator->checksumByteSize();
425 const size_t totalSize = sizeWithoutChecksum + checksumSize;
426 buf = stream->alloc(totalSize);
427 ptr = buf;
428 int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
429 memcpy(ptr, &totalSize, 4); ptr += 4;
430
431 memcpy(ptr, &target, 4); ptr += 4;
432
433 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
434 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
435
436
437 GLenum retval;
438 stream->readback(&retval, 4);
439 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
440 if (useChecksum) {
441 unsigned char *checksumBufPtr = NULL;
442 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
443 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
444 stream->readback(checksumBufPtr, checksumSize);
445 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
446 ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
447 abort();
448 }
449 }
450 return retval;
451 }
452
glClear_enc(void * self,GLbitfield mask)453 void glClear_enc(void *self , GLbitfield mask)
454 {
455
456 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
457 IOStream *stream = ctx->m_stream;
458 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
459 bool useChecksum = checksumCalculator->getVersion() > 0;
460
461 unsigned char *ptr;
462 unsigned char *buf;
463 const size_t sizeWithoutChecksum = 8 + 4;
464 const size_t checksumSize = checksumCalculator->checksumByteSize();
465 const size_t totalSize = sizeWithoutChecksum + checksumSize;
466 buf = stream->alloc(totalSize);
467 ptr = buf;
468 int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
469 memcpy(ptr, &totalSize, 4); ptr += 4;
470
471 memcpy(ptr, &mask, 4); ptr += 4;
472
473 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
474 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
475
476 }
477
glClearColor_enc(void * self,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)478 void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
479 {
480
481 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
482 IOStream *stream = ctx->m_stream;
483 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
484 bool useChecksum = checksumCalculator->getVersion() > 0;
485
486 unsigned char *ptr;
487 unsigned char *buf;
488 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
489 const size_t checksumSize = checksumCalculator->checksumByteSize();
490 const size_t totalSize = sizeWithoutChecksum + checksumSize;
491 buf = stream->alloc(totalSize);
492 ptr = buf;
493 int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
494 memcpy(ptr, &totalSize, 4); ptr += 4;
495
496 memcpy(ptr, &red, 4); ptr += 4;
497 memcpy(ptr, &green, 4); ptr += 4;
498 memcpy(ptr, &blue, 4); ptr += 4;
499 memcpy(ptr, &alpha, 4); ptr += 4;
500
501 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
502 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
503
504 }
505
glClearDepthf_enc(void * self,GLclampf depth)506 void glClearDepthf_enc(void *self , GLclampf depth)
507 {
508
509 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
510 IOStream *stream = ctx->m_stream;
511 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
512 bool useChecksum = checksumCalculator->getVersion() > 0;
513
514 unsigned char *ptr;
515 unsigned char *buf;
516 const size_t sizeWithoutChecksum = 8 + 4;
517 const size_t checksumSize = checksumCalculator->checksumByteSize();
518 const size_t totalSize = sizeWithoutChecksum + checksumSize;
519 buf = stream->alloc(totalSize);
520 ptr = buf;
521 int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
522 memcpy(ptr, &totalSize, 4); ptr += 4;
523
524 memcpy(ptr, &depth, 4); ptr += 4;
525
526 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
527 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
528
529 }
530
glClearStencil_enc(void * self,GLint s)531 void glClearStencil_enc(void *self , GLint s)
532 {
533
534 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
535 IOStream *stream = ctx->m_stream;
536 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
537 bool useChecksum = checksumCalculator->getVersion() > 0;
538
539 unsigned char *ptr;
540 unsigned char *buf;
541 const size_t sizeWithoutChecksum = 8 + 4;
542 const size_t checksumSize = checksumCalculator->checksumByteSize();
543 const size_t totalSize = sizeWithoutChecksum + checksumSize;
544 buf = stream->alloc(totalSize);
545 ptr = buf;
546 int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
547 memcpy(ptr, &totalSize, 4); ptr += 4;
548
549 memcpy(ptr, &s, 4); ptr += 4;
550
551 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
552 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
553
554 }
555
glColorMask_enc(void * self,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)556 void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
557 {
558
559 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
560 IOStream *stream = ctx->m_stream;
561 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
562 bool useChecksum = checksumCalculator->getVersion() > 0;
563
564 unsigned char *ptr;
565 unsigned char *buf;
566 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
567 const size_t checksumSize = checksumCalculator->checksumByteSize();
568 const size_t totalSize = sizeWithoutChecksum + checksumSize;
569 buf = stream->alloc(totalSize);
570 ptr = buf;
571 int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
572 memcpy(ptr, &totalSize, 4); ptr += 4;
573
574 memcpy(ptr, &red, 1); ptr += 1;
575 memcpy(ptr, &green, 1); ptr += 1;
576 memcpy(ptr, &blue, 1); ptr += 1;
577 memcpy(ptr, &alpha, 1); ptr += 1;
578
579 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
580 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
581
582 }
583
glCompileShader_enc(void * self,GLuint shader)584 void glCompileShader_enc(void *self , GLuint shader)
585 {
586
587 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
588 IOStream *stream = ctx->m_stream;
589 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
590 bool useChecksum = checksumCalculator->getVersion() > 0;
591
592 unsigned char *ptr;
593 unsigned char *buf;
594 const size_t sizeWithoutChecksum = 8 + 4;
595 const size_t checksumSize = checksumCalculator->checksumByteSize();
596 const size_t totalSize = sizeWithoutChecksum + checksumSize;
597 buf = stream->alloc(totalSize);
598 ptr = buf;
599 int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
600 memcpy(ptr, &totalSize, 4); ptr += 4;
601
602 memcpy(ptr, &shader, 4); ptr += 4;
603
604 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
605 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
606
607 }
608
glCompressedTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)609 void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
610 {
611
612 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
613 IOStream *stream = ctx->m_stream;
614 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
615 bool useChecksum = checksumCalculator->getVersion() > 0;
616
617 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
618 unsigned char *ptr;
619 unsigned char *buf;
620 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
621 const size_t checksumSize = checksumCalculator->checksumByteSize();
622 const size_t totalSize = sizeWithoutChecksum + checksumSize;
623 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
624 ptr = buf;
625 int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
626 memcpy(ptr, &totalSize, 4); ptr += 4;
627
628 memcpy(ptr, &target, 4); ptr += 4;
629 memcpy(ptr, &level, 4); ptr += 4;
630 memcpy(ptr, &internalformat, 4); ptr += 4;
631 memcpy(ptr, &width, 4); ptr += 4;
632 memcpy(ptr, &height, 4); ptr += 4;
633 memcpy(ptr, &border, 4); ptr += 4;
634 memcpy(ptr, &imageSize, 4); ptr += 4;
635
636 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
637 stream->flush();
638 stream->writeFully(&__size_data,4);
639 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
640 if (data != NULL) {
641 stream->writeFully(data, __size_data);
642 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
643 }
644 buf = stream->alloc(checksumSize);
645 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
646
647 }
648
glCompressedTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)649 void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
650 {
651
652 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
653 IOStream *stream = ctx->m_stream;
654 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
655 bool useChecksum = checksumCalculator->getVersion() > 0;
656
657 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
658 unsigned char *ptr;
659 unsigned char *buf;
660 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
661 const size_t checksumSize = checksumCalculator->checksumByteSize();
662 const size_t totalSize = sizeWithoutChecksum + checksumSize;
663 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
664 ptr = buf;
665 int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
666 memcpy(ptr, &totalSize, 4); ptr += 4;
667
668 memcpy(ptr, &target, 4); ptr += 4;
669 memcpy(ptr, &level, 4); ptr += 4;
670 memcpy(ptr, &xoffset, 4); ptr += 4;
671 memcpy(ptr, &yoffset, 4); ptr += 4;
672 memcpy(ptr, &width, 4); ptr += 4;
673 memcpy(ptr, &height, 4); ptr += 4;
674 memcpy(ptr, &format, 4); ptr += 4;
675 memcpy(ptr, &imageSize, 4); ptr += 4;
676
677 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
678 stream->flush();
679 stream->writeFully(&__size_data,4);
680 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
681 if (data != NULL) {
682 stream->writeFully(data, __size_data);
683 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
684 }
685 buf = stream->alloc(checksumSize);
686 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
687
688 }
689
glCopyTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)690 void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
691 {
692
693 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
694 IOStream *stream = ctx->m_stream;
695 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
696 bool useChecksum = checksumCalculator->getVersion() > 0;
697
698 unsigned char *ptr;
699 unsigned char *buf;
700 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
701 const size_t checksumSize = checksumCalculator->checksumByteSize();
702 const size_t totalSize = sizeWithoutChecksum + checksumSize;
703 buf = stream->alloc(totalSize);
704 ptr = buf;
705 int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
706 memcpy(ptr, &totalSize, 4); ptr += 4;
707
708 memcpy(ptr, &target, 4); ptr += 4;
709 memcpy(ptr, &level, 4); ptr += 4;
710 memcpy(ptr, &internalformat, 4); ptr += 4;
711 memcpy(ptr, &x, 4); ptr += 4;
712 memcpy(ptr, &y, 4); ptr += 4;
713 memcpy(ptr, &width, 4); ptr += 4;
714 memcpy(ptr, &height, 4); ptr += 4;
715 memcpy(ptr, &border, 4); ptr += 4;
716
717 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
718 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
719
720 }
721
glCopyTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)722 void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
723 {
724
725 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
726 IOStream *stream = ctx->m_stream;
727 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
728 bool useChecksum = checksumCalculator->getVersion() > 0;
729
730 unsigned char *ptr;
731 unsigned char *buf;
732 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
733 const size_t checksumSize = checksumCalculator->checksumByteSize();
734 const size_t totalSize = sizeWithoutChecksum + checksumSize;
735 buf = stream->alloc(totalSize);
736 ptr = buf;
737 int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
738 memcpy(ptr, &totalSize, 4); ptr += 4;
739
740 memcpy(ptr, &target, 4); ptr += 4;
741 memcpy(ptr, &level, 4); ptr += 4;
742 memcpy(ptr, &xoffset, 4); ptr += 4;
743 memcpy(ptr, &yoffset, 4); ptr += 4;
744 memcpy(ptr, &x, 4); ptr += 4;
745 memcpy(ptr, &y, 4); ptr += 4;
746 memcpy(ptr, &width, 4); ptr += 4;
747 memcpy(ptr, &height, 4); ptr += 4;
748
749 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
750 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
751
752 }
753
glCreateProgram_enc(void * self)754 GLuint glCreateProgram_enc(void *self )
755 {
756
757 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
758 IOStream *stream = ctx->m_stream;
759 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
760 bool useChecksum = checksumCalculator->getVersion() > 0;
761
762 unsigned char *ptr;
763 unsigned char *buf;
764 const size_t sizeWithoutChecksum = 8;
765 const size_t checksumSize = checksumCalculator->checksumByteSize();
766 const size_t totalSize = sizeWithoutChecksum + checksumSize;
767 buf = stream->alloc(totalSize);
768 ptr = buf;
769 int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
770 memcpy(ptr, &totalSize, 4); ptr += 4;
771
772
773 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
774 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
775
776
777 GLuint retval;
778 stream->readback(&retval, 4);
779 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
780 if (useChecksum) {
781 unsigned char *checksumBufPtr = NULL;
782 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
783 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
784 stream->readback(checksumBufPtr, checksumSize);
785 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
786 ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
787 abort();
788 }
789 }
790 return retval;
791 }
792
glCreateShader_enc(void * self,GLenum type)793 GLuint glCreateShader_enc(void *self , GLenum type)
794 {
795
796 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
797 IOStream *stream = ctx->m_stream;
798 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
799 bool useChecksum = checksumCalculator->getVersion() > 0;
800
801 unsigned char *ptr;
802 unsigned char *buf;
803 const size_t sizeWithoutChecksum = 8 + 4;
804 const size_t checksumSize = checksumCalculator->checksumByteSize();
805 const size_t totalSize = sizeWithoutChecksum + checksumSize;
806 buf = stream->alloc(totalSize);
807 ptr = buf;
808 int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
809 memcpy(ptr, &totalSize, 4); ptr += 4;
810
811 memcpy(ptr, &type, 4); ptr += 4;
812
813 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
814 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
815
816
817 GLuint retval;
818 stream->readback(&retval, 4);
819 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
820 if (useChecksum) {
821 unsigned char *checksumBufPtr = NULL;
822 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
823 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
824 stream->readback(checksumBufPtr, checksumSize);
825 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
826 ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
827 abort();
828 }
829 }
830 return retval;
831 }
832
glCullFace_enc(void * self,GLenum mode)833 void glCullFace_enc(void *self , GLenum mode)
834 {
835
836 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
837 IOStream *stream = ctx->m_stream;
838 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
839 bool useChecksum = checksumCalculator->getVersion() > 0;
840
841 unsigned char *ptr;
842 unsigned char *buf;
843 const size_t sizeWithoutChecksum = 8 + 4;
844 const size_t checksumSize = checksumCalculator->checksumByteSize();
845 const size_t totalSize = sizeWithoutChecksum + checksumSize;
846 buf = stream->alloc(totalSize);
847 ptr = buf;
848 int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
849 memcpy(ptr, &totalSize, 4); ptr += 4;
850
851 memcpy(ptr, &mode, 4); ptr += 4;
852
853 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
854 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
855
856 }
857
glDeleteBuffers_enc(void * self,GLsizei n,const GLuint * buffers)858 void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
859 {
860
861 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
862 IOStream *stream = ctx->m_stream;
863 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
864 bool useChecksum = checksumCalculator->getVersion() > 0;
865
866 const unsigned int __size_buffers = (n * sizeof(GLuint));
867 unsigned char *ptr;
868 unsigned char *buf;
869 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
870 const size_t checksumSize = checksumCalculator->checksumByteSize();
871 const size_t totalSize = sizeWithoutChecksum + checksumSize;
872 buf = stream->alloc(totalSize);
873 ptr = buf;
874 int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
875 memcpy(ptr, &totalSize, 4); ptr += 4;
876
877 memcpy(ptr, &n, 4); ptr += 4;
878 *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
879 memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
880
881 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
882 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
883
884 }
885
glDeleteFramebuffers_enc(void * self,GLsizei n,const GLuint * framebuffers)886 void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
887 {
888
889 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
890 IOStream *stream = ctx->m_stream;
891 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
892 bool useChecksum = checksumCalculator->getVersion() > 0;
893
894 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
895 unsigned char *ptr;
896 unsigned char *buf;
897 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
898 const size_t checksumSize = checksumCalculator->checksumByteSize();
899 const size_t totalSize = sizeWithoutChecksum + checksumSize;
900 buf = stream->alloc(totalSize);
901 ptr = buf;
902 int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
903 memcpy(ptr, &totalSize, 4); ptr += 4;
904
905 memcpy(ptr, &n, 4); ptr += 4;
906 *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
907 memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
908
909 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
910 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
911
912 }
913
glDeleteProgram_enc(void * self,GLuint program)914 void glDeleteProgram_enc(void *self , GLuint program)
915 {
916
917 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
918 IOStream *stream = ctx->m_stream;
919 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
920 bool useChecksum = checksumCalculator->getVersion() > 0;
921
922 unsigned char *ptr;
923 unsigned char *buf;
924 const size_t sizeWithoutChecksum = 8 + 4;
925 const size_t checksumSize = checksumCalculator->checksumByteSize();
926 const size_t totalSize = sizeWithoutChecksum + checksumSize;
927 buf = stream->alloc(totalSize);
928 ptr = buf;
929 int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
930 memcpy(ptr, &totalSize, 4); ptr += 4;
931
932 memcpy(ptr, &program, 4); ptr += 4;
933
934 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
935 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
936
937 }
938
glDeleteRenderbuffers_enc(void * self,GLsizei n,const GLuint * renderbuffers)939 void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
940 {
941
942 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
943 IOStream *stream = ctx->m_stream;
944 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
945 bool useChecksum = checksumCalculator->getVersion() > 0;
946
947 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
948 unsigned char *ptr;
949 unsigned char *buf;
950 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
951 const size_t checksumSize = checksumCalculator->checksumByteSize();
952 const size_t totalSize = sizeWithoutChecksum + checksumSize;
953 buf = stream->alloc(totalSize);
954 ptr = buf;
955 int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
956 memcpy(ptr, &totalSize, 4); ptr += 4;
957
958 memcpy(ptr, &n, 4); ptr += 4;
959 *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
960 memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
961
962 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
963 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
964
965 }
966
glDeleteShader_enc(void * self,GLuint shader)967 void glDeleteShader_enc(void *self , GLuint shader)
968 {
969
970 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
971 IOStream *stream = ctx->m_stream;
972 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
973 bool useChecksum = checksumCalculator->getVersion() > 0;
974
975 unsigned char *ptr;
976 unsigned char *buf;
977 const size_t sizeWithoutChecksum = 8 + 4;
978 const size_t checksumSize = checksumCalculator->checksumByteSize();
979 const size_t totalSize = sizeWithoutChecksum + checksumSize;
980 buf = stream->alloc(totalSize);
981 ptr = buf;
982 int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
983 memcpy(ptr, &totalSize, 4); ptr += 4;
984
985 memcpy(ptr, &shader, 4); ptr += 4;
986
987 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
988 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
989
990 }
991
glDeleteTextures_enc(void * self,GLsizei n,const GLuint * textures)992 void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
993 {
994
995 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
996 IOStream *stream = ctx->m_stream;
997 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
998 bool useChecksum = checksumCalculator->getVersion() > 0;
999
1000 const unsigned int __size_textures = (n * sizeof(GLuint));
1001 unsigned char *ptr;
1002 unsigned char *buf;
1003 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
1004 const size_t checksumSize = checksumCalculator->checksumByteSize();
1005 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1006 buf = stream->alloc(totalSize);
1007 ptr = buf;
1008 int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
1009 memcpy(ptr, &totalSize, 4); ptr += 4;
1010
1011 memcpy(ptr, &n, 4); ptr += 4;
1012 *(unsigned int *)(ptr) = __size_textures; ptr += 4;
1013 memcpy(ptr, textures, __size_textures);ptr += __size_textures;
1014
1015 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1016 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1017
1018 }
1019
glDepthFunc_enc(void * self,GLenum func)1020 void glDepthFunc_enc(void *self , GLenum func)
1021 {
1022
1023 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1024 IOStream *stream = ctx->m_stream;
1025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1026 bool useChecksum = checksumCalculator->getVersion() > 0;
1027
1028 unsigned char *ptr;
1029 unsigned char *buf;
1030 const size_t sizeWithoutChecksum = 8 + 4;
1031 const size_t checksumSize = checksumCalculator->checksumByteSize();
1032 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1033 buf = stream->alloc(totalSize);
1034 ptr = buf;
1035 int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
1036 memcpy(ptr, &totalSize, 4); ptr += 4;
1037
1038 memcpy(ptr, &func, 4); ptr += 4;
1039
1040 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1041 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1042
1043 }
1044
glDepthMask_enc(void * self,GLboolean flag)1045 void glDepthMask_enc(void *self , GLboolean flag)
1046 {
1047
1048 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1049 IOStream *stream = ctx->m_stream;
1050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1051 bool useChecksum = checksumCalculator->getVersion() > 0;
1052
1053 unsigned char *ptr;
1054 unsigned char *buf;
1055 const size_t sizeWithoutChecksum = 8 + 1;
1056 const size_t checksumSize = checksumCalculator->checksumByteSize();
1057 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1058 buf = stream->alloc(totalSize);
1059 ptr = buf;
1060 int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
1061 memcpy(ptr, &totalSize, 4); ptr += 4;
1062
1063 memcpy(ptr, &flag, 1); ptr += 1;
1064
1065 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1066 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1067
1068 }
1069
glDepthRangef_enc(void * self,GLclampf zNear,GLclampf zFar)1070 void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
1071 {
1072
1073 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1074 IOStream *stream = ctx->m_stream;
1075 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1076 bool useChecksum = checksumCalculator->getVersion() > 0;
1077
1078 unsigned char *ptr;
1079 unsigned char *buf;
1080 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1081 const size_t checksumSize = checksumCalculator->checksumByteSize();
1082 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1083 buf = stream->alloc(totalSize);
1084 ptr = buf;
1085 int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
1086 memcpy(ptr, &totalSize, 4); ptr += 4;
1087
1088 memcpy(ptr, &zNear, 4); ptr += 4;
1089 memcpy(ptr, &zFar, 4); ptr += 4;
1090
1091 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1092 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1093
1094 }
1095
glDetachShader_enc(void * self,GLuint program,GLuint shader)1096 void glDetachShader_enc(void *self , GLuint program, GLuint shader)
1097 {
1098
1099 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1100 IOStream *stream = ctx->m_stream;
1101 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1102 bool useChecksum = checksumCalculator->getVersion() > 0;
1103
1104 unsigned char *ptr;
1105 unsigned char *buf;
1106 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1107 const size_t checksumSize = checksumCalculator->checksumByteSize();
1108 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1109 buf = stream->alloc(totalSize);
1110 ptr = buf;
1111 int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
1112 memcpy(ptr, &totalSize, 4); ptr += 4;
1113
1114 memcpy(ptr, &program, 4); ptr += 4;
1115 memcpy(ptr, &shader, 4); ptr += 4;
1116
1117 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1118 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1119
1120 }
1121
glDisable_enc(void * self,GLenum cap)1122 void glDisable_enc(void *self , GLenum cap)
1123 {
1124
1125 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1126 IOStream *stream = ctx->m_stream;
1127 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1128 bool useChecksum = checksumCalculator->getVersion() > 0;
1129
1130 unsigned char *ptr;
1131 unsigned char *buf;
1132 const size_t sizeWithoutChecksum = 8 + 4;
1133 const size_t checksumSize = checksumCalculator->checksumByteSize();
1134 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1135 buf = stream->alloc(totalSize);
1136 ptr = buf;
1137 int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
1138 memcpy(ptr, &totalSize, 4); ptr += 4;
1139
1140 memcpy(ptr, &cap, 4); ptr += 4;
1141
1142 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1143 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1144
1145 }
1146
glDisableVertexAttribArray_enc(void * self,GLuint index)1147 void glDisableVertexAttribArray_enc(void *self , GLuint index)
1148 {
1149
1150 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1151 IOStream *stream = ctx->m_stream;
1152 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1153 bool useChecksum = checksumCalculator->getVersion() > 0;
1154
1155 unsigned char *ptr;
1156 unsigned char *buf;
1157 const size_t sizeWithoutChecksum = 8 + 4;
1158 const size_t checksumSize = checksumCalculator->checksumByteSize();
1159 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1160 buf = stream->alloc(totalSize);
1161 ptr = buf;
1162 int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
1163 memcpy(ptr, &totalSize, 4); ptr += 4;
1164
1165 memcpy(ptr, &index, 4); ptr += 4;
1166
1167 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1168 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1169
1170 }
1171
glDrawArrays_enc(void * self,GLenum mode,GLint first,GLsizei count)1172 void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
1173 {
1174
1175 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1176 IOStream *stream = ctx->m_stream;
1177 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1178 bool useChecksum = checksumCalculator->getVersion() > 0;
1179
1180 unsigned char *ptr;
1181 unsigned char *buf;
1182 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1183 const size_t checksumSize = checksumCalculator->checksumByteSize();
1184 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1185 buf = stream->alloc(totalSize);
1186 ptr = buf;
1187 int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
1188 memcpy(ptr, &totalSize, 4); ptr += 4;
1189
1190 memcpy(ptr, &mode, 4); ptr += 4;
1191 memcpy(ptr, &first, 4); ptr += 4;
1192 memcpy(ptr, &count, 4); ptr += 4;
1193
1194 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1195 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1196
1197 }
1198
glEnable_enc(void * self,GLenum cap)1199 void glEnable_enc(void *self , GLenum cap)
1200 {
1201
1202 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1203 IOStream *stream = ctx->m_stream;
1204 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1205 bool useChecksum = checksumCalculator->getVersion() > 0;
1206
1207 unsigned char *ptr;
1208 unsigned char *buf;
1209 const size_t sizeWithoutChecksum = 8 + 4;
1210 const size_t checksumSize = checksumCalculator->checksumByteSize();
1211 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1212 buf = stream->alloc(totalSize);
1213 ptr = buf;
1214 int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
1215 memcpy(ptr, &totalSize, 4); ptr += 4;
1216
1217 memcpy(ptr, &cap, 4); ptr += 4;
1218
1219 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1220 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1221
1222 }
1223
glEnableVertexAttribArray_enc(void * self,GLuint index)1224 void glEnableVertexAttribArray_enc(void *self , GLuint index)
1225 {
1226
1227 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1228 IOStream *stream = ctx->m_stream;
1229 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1230 bool useChecksum = checksumCalculator->getVersion() > 0;
1231
1232 unsigned char *ptr;
1233 unsigned char *buf;
1234 const size_t sizeWithoutChecksum = 8 + 4;
1235 const size_t checksumSize = checksumCalculator->checksumByteSize();
1236 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1237 buf = stream->alloc(totalSize);
1238 ptr = buf;
1239 int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
1240 memcpy(ptr, &totalSize, 4); ptr += 4;
1241
1242 memcpy(ptr, &index, 4); ptr += 4;
1243
1244 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1245 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1246
1247 }
1248
glFinish_enc(void * self)1249 void glFinish_enc(void *self )
1250 {
1251
1252 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1253 IOStream *stream = ctx->m_stream;
1254 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1255 bool useChecksum = checksumCalculator->getVersion() > 0;
1256
1257 unsigned char *ptr;
1258 unsigned char *buf;
1259 const size_t sizeWithoutChecksum = 8;
1260 const size_t checksumSize = checksumCalculator->checksumByteSize();
1261 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1262 buf = stream->alloc(totalSize);
1263 ptr = buf;
1264 int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
1265 memcpy(ptr, &totalSize, 4); ptr += 4;
1266
1267
1268 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1269 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1270
1271 }
1272
glFlush_enc(void * self)1273 void glFlush_enc(void *self )
1274 {
1275
1276 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1277 IOStream *stream = ctx->m_stream;
1278 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1279 bool useChecksum = checksumCalculator->getVersion() > 0;
1280
1281 unsigned char *ptr;
1282 unsigned char *buf;
1283 const size_t sizeWithoutChecksum = 8;
1284 const size_t checksumSize = checksumCalculator->checksumByteSize();
1285 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1286 buf = stream->alloc(totalSize);
1287 ptr = buf;
1288 int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
1289 memcpy(ptr, &totalSize, 4); ptr += 4;
1290
1291
1292 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1293 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1294
1295 }
1296
glFramebufferRenderbuffer_enc(void * self,GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)1297 void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1298 {
1299
1300 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1301 IOStream *stream = ctx->m_stream;
1302 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1303 bool useChecksum = checksumCalculator->getVersion() > 0;
1304
1305 unsigned char *ptr;
1306 unsigned char *buf;
1307 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
1308 const size_t checksumSize = checksumCalculator->checksumByteSize();
1309 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1310 buf = stream->alloc(totalSize);
1311 ptr = buf;
1312 int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
1313 memcpy(ptr, &totalSize, 4); ptr += 4;
1314
1315 memcpy(ptr, &target, 4); ptr += 4;
1316 memcpy(ptr, &attachment, 4); ptr += 4;
1317 memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
1318 memcpy(ptr, &renderbuffer, 4); ptr += 4;
1319
1320 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1321 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1322
1323 }
1324
glFramebufferTexture2D_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)1325 void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
1326 {
1327
1328 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1329 IOStream *stream = ctx->m_stream;
1330 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1331 bool useChecksum = checksumCalculator->getVersion() > 0;
1332
1333 unsigned char *ptr;
1334 unsigned char *buf;
1335 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
1336 const size_t checksumSize = checksumCalculator->checksumByteSize();
1337 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1338 buf = stream->alloc(totalSize);
1339 ptr = buf;
1340 int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
1341 memcpy(ptr, &totalSize, 4); ptr += 4;
1342
1343 memcpy(ptr, &target, 4); ptr += 4;
1344 memcpy(ptr, &attachment, 4); ptr += 4;
1345 memcpy(ptr, &textarget, 4); ptr += 4;
1346 memcpy(ptr, &texture, 4); ptr += 4;
1347 memcpy(ptr, &level, 4); ptr += 4;
1348
1349 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1350 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1351
1352 }
1353
glFrontFace_enc(void * self,GLenum mode)1354 void glFrontFace_enc(void *self , GLenum mode)
1355 {
1356
1357 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1358 IOStream *stream = ctx->m_stream;
1359 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1360 bool useChecksum = checksumCalculator->getVersion() > 0;
1361
1362 unsigned char *ptr;
1363 unsigned char *buf;
1364 const size_t sizeWithoutChecksum = 8 + 4;
1365 const size_t checksumSize = checksumCalculator->checksumByteSize();
1366 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1367 buf = stream->alloc(totalSize);
1368 ptr = buf;
1369 int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
1370 memcpy(ptr, &totalSize, 4); ptr += 4;
1371
1372 memcpy(ptr, &mode, 4); ptr += 4;
1373
1374 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1375 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1376
1377 }
1378
glGenBuffers_enc(void * self,GLsizei n,GLuint * buffers)1379 void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
1380 {
1381
1382 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1383 IOStream *stream = ctx->m_stream;
1384 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1385 bool useChecksum = checksumCalculator->getVersion() > 0;
1386
1387 const unsigned int __size_buffers = (n * sizeof(GLuint));
1388 unsigned char *ptr;
1389 unsigned char *buf;
1390 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1391 const size_t checksumSize = checksumCalculator->checksumByteSize();
1392 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1393 buf = stream->alloc(totalSize);
1394 ptr = buf;
1395 int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1396 memcpy(ptr, &totalSize, 4); ptr += 4;
1397
1398 memcpy(ptr, &n, 4); ptr += 4;
1399 *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
1400
1401 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1402 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1403
1404 stream->readback(buffers, __size_buffers);
1405 if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
1406 if (useChecksum) {
1407 unsigned char *checksumBufPtr = NULL;
1408 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1409 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1410 stream->readback(checksumBufPtr, checksumSize);
1411 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1412 ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
1413 abort();
1414 }
1415 }
1416 }
1417
glGenerateMipmap_enc(void * self,GLenum target)1418 void glGenerateMipmap_enc(void *self , GLenum target)
1419 {
1420
1421 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1422 IOStream *stream = ctx->m_stream;
1423 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1424 bool useChecksum = checksumCalculator->getVersion() > 0;
1425
1426 unsigned char *ptr;
1427 unsigned char *buf;
1428 const size_t sizeWithoutChecksum = 8 + 4;
1429 const size_t checksumSize = checksumCalculator->checksumByteSize();
1430 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1431 buf = stream->alloc(totalSize);
1432 ptr = buf;
1433 int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
1434 memcpy(ptr, &totalSize, 4); ptr += 4;
1435
1436 memcpy(ptr, &target, 4); ptr += 4;
1437
1438 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1439 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1440
1441 }
1442
glGenFramebuffers_enc(void * self,GLsizei n,GLuint * framebuffers)1443 void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
1444 {
1445
1446 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1447 IOStream *stream = ctx->m_stream;
1448 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1449 bool useChecksum = checksumCalculator->getVersion() > 0;
1450
1451 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
1452 unsigned char *ptr;
1453 unsigned char *buf;
1454 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1455 const size_t checksumSize = checksumCalculator->checksumByteSize();
1456 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1457 buf = stream->alloc(totalSize);
1458 ptr = buf;
1459 int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1460 memcpy(ptr, &totalSize, 4); ptr += 4;
1461
1462 memcpy(ptr, &n, 4); ptr += 4;
1463 *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
1464
1465 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1466 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1467
1468 stream->readback(framebuffers, __size_framebuffers);
1469 if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
1470 if (useChecksum) {
1471 unsigned char *checksumBufPtr = NULL;
1472 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1473 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1474 stream->readback(checksumBufPtr, checksumSize);
1475 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1476 ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
1477 abort();
1478 }
1479 }
1480 }
1481
glGenRenderbuffers_enc(void * self,GLsizei n,GLuint * renderbuffers)1482 void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
1483 {
1484
1485 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1486 IOStream *stream = ctx->m_stream;
1487 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1488 bool useChecksum = checksumCalculator->getVersion() > 0;
1489
1490 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
1491 unsigned char *ptr;
1492 unsigned char *buf;
1493 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1494 const size_t checksumSize = checksumCalculator->checksumByteSize();
1495 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1496 buf = stream->alloc(totalSize);
1497 ptr = buf;
1498 int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1499 memcpy(ptr, &totalSize, 4); ptr += 4;
1500
1501 memcpy(ptr, &n, 4); ptr += 4;
1502 *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
1503
1504 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1505 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1506
1507 stream->readback(renderbuffers, __size_renderbuffers);
1508 if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
1509 if (useChecksum) {
1510 unsigned char *checksumBufPtr = NULL;
1511 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1512 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1513 stream->readback(checksumBufPtr, checksumSize);
1514 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1515 ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
1516 abort();
1517 }
1518 }
1519 }
1520
glGenTextures_enc(void * self,GLsizei n,GLuint * textures)1521 void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
1522 {
1523
1524 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1525 IOStream *stream = ctx->m_stream;
1526 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1527 bool useChecksum = checksumCalculator->getVersion() > 0;
1528
1529 const unsigned int __size_textures = (n * sizeof(GLuint));
1530 unsigned char *ptr;
1531 unsigned char *buf;
1532 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1533 const size_t checksumSize = checksumCalculator->checksumByteSize();
1534 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1535 buf = stream->alloc(totalSize);
1536 ptr = buf;
1537 int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
1538 memcpy(ptr, &totalSize, 4); ptr += 4;
1539
1540 memcpy(ptr, &n, 4); ptr += 4;
1541 *(unsigned int *)(ptr) = __size_textures; ptr += 4;
1542
1543 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1544 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1545
1546 stream->readback(textures, __size_textures);
1547 if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
1548 if (useChecksum) {
1549 unsigned char *checksumBufPtr = NULL;
1550 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1551 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1552 stream->readback(checksumBufPtr, checksumSize);
1553 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1554 ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
1555 abort();
1556 }
1557 }
1558 }
1559
glGetActiveAttrib_enc(void * self,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)1560 void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1561 {
1562
1563 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1564 IOStream *stream = ctx->m_stream;
1565 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1566 bool useChecksum = checksumCalculator->getVersion() > 0;
1567
1568 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
1569 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1570 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
1571 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1572 unsigned char *ptr;
1573 unsigned char *buf;
1574 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
1575 const size_t checksumSize = checksumCalculator->checksumByteSize();
1576 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1577 buf = stream->alloc(totalSize);
1578 ptr = buf;
1579 int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
1580 memcpy(ptr, &totalSize, 4); ptr += 4;
1581
1582 memcpy(ptr, &program, 4); ptr += 4;
1583 memcpy(ptr, &index, 4); ptr += 4;
1584 memcpy(ptr, &bufsize, 4); ptr += 4;
1585 *(unsigned int *)(ptr) = __size_length; ptr += 4;
1586 *(unsigned int *)(ptr) = __size_size; ptr += 4;
1587 *(unsigned int *)(ptr) = __size_type; ptr += 4;
1588 *(unsigned int *)(ptr) = __size_name; ptr += 4;
1589
1590 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1591 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1592
1593 if (length != NULL) {
1594 stream->readback(length, __size_length);
1595 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1596 }
1597 if (size != NULL) {
1598 stream->readback(size, __size_size);
1599 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1600 }
1601 if (type != NULL) {
1602 stream->readback(type, __size_type);
1603 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1604 }
1605 if (name != NULL) {
1606 stream->readback(name, __size_name);
1607 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1608 }
1609 if (useChecksum) {
1610 unsigned char *checksumBufPtr = NULL;
1611 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1612 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1613 stream->readback(checksumBufPtr, checksumSize);
1614 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1615 ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
1616 abort();
1617 }
1618 }
1619 }
1620
glGetActiveUniform_enc(void * self,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)1621 void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1622 {
1623
1624 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1625 IOStream *stream = ctx->m_stream;
1626 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1627 bool useChecksum = checksumCalculator->getVersion() > 0;
1628
1629 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
1630 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1631 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
1632 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1633 unsigned char *ptr;
1634 unsigned char *buf;
1635 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
1636 const size_t checksumSize = checksumCalculator->checksumByteSize();
1637 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1638 buf = stream->alloc(totalSize);
1639 ptr = buf;
1640 int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
1641 memcpy(ptr, &totalSize, 4); ptr += 4;
1642
1643 memcpy(ptr, &program, 4); ptr += 4;
1644 memcpy(ptr, &index, 4); ptr += 4;
1645 memcpy(ptr, &bufsize, 4); ptr += 4;
1646 *(unsigned int *)(ptr) = __size_length; ptr += 4;
1647 *(unsigned int *)(ptr) = __size_size; ptr += 4;
1648 *(unsigned int *)(ptr) = __size_type; ptr += 4;
1649 *(unsigned int *)(ptr) = __size_name; ptr += 4;
1650
1651 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1652 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1653
1654 if (length != NULL) {
1655 stream->readback(length, __size_length);
1656 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1657 }
1658 if (size != NULL) {
1659 stream->readback(size, __size_size);
1660 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1661 }
1662 if (type != NULL) {
1663 stream->readback(type, __size_type);
1664 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1665 }
1666 if (name != NULL) {
1667 stream->readback(name, __size_name);
1668 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1669 }
1670 if (useChecksum) {
1671 unsigned char *checksumBufPtr = NULL;
1672 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1673 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1674 stream->readback(checksumBufPtr, checksumSize);
1675 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1676 ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
1677 abort();
1678 }
1679 }
1680 }
1681
glGetAttachedShaders_enc(void * self,GLuint program,GLsizei maxcount,GLsizei * count,GLuint * shaders)1682 void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1683 {
1684
1685 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1686 IOStream *stream = ctx->m_stream;
1687 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1688 bool useChecksum = checksumCalculator->getVersion() > 0;
1689
1690 const unsigned int __size_count = ((count != NULL) ? (sizeof(GLsizei)) : 0);
1691 const unsigned int __size_shaders = (maxcount*sizeof(GLuint));
1692 unsigned char *ptr;
1693 unsigned char *buf;
1694 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
1695 const size_t checksumSize = checksumCalculator->checksumByteSize();
1696 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1697 buf = stream->alloc(totalSize);
1698 ptr = buf;
1699 int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
1700 memcpy(ptr, &totalSize, 4); ptr += 4;
1701
1702 memcpy(ptr, &program, 4); ptr += 4;
1703 memcpy(ptr, &maxcount, 4); ptr += 4;
1704 *(unsigned int *)(ptr) = __size_count; ptr += 4;
1705 *(unsigned int *)(ptr) = __size_shaders; ptr += 4;
1706
1707 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1708 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1709
1710 if (count != NULL) {
1711 stream->readback(count, __size_count);
1712 if (useChecksum) checksumCalculator->addBuffer(count, __size_count);
1713 }
1714 stream->readback(shaders, __size_shaders);
1715 if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
1716 if (useChecksum) {
1717 unsigned char *checksumBufPtr = NULL;
1718 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1719 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1720 stream->readback(checksumBufPtr, checksumSize);
1721 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1722 ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
1723 abort();
1724 }
1725 }
1726 }
1727
glGetAttribLocation_enc(void * self,GLuint program,const GLchar * name)1728 int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
1729 {
1730
1731 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1732 IOStream *stream = ctx->m_stream;
1733 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1734 bool useChecksum = checksumCalculator->getVersion() > 0;
1735
1736 const unsigned int __size_name = (strlen(name) + 1);
1737 unsigned char *ptr;
1738 unsigned char *buf;
1739 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
1740 const size_t checksumSize = checksumCalculator->checksumByteSize();
1741 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1742 buf = stream->alloc(totalSize);
1743 ptr = buf;
1744 int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
1745 memcpy(ptr, &totalSize, 4); ptr += 4;
1746
1747 memcpy(ptr, &program, 4); ptr += 4;
1748 *(unsigned int *)(ptr) = __size_name; ptr += 4;
1749 memcpy(ptr, name, __size_name);ptr += __size_name;
1750
1751 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1752 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1753
1754
1755 int retval;
1756 stream->readback(&retval, 4);
1757 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1758 if (useChecksum) {
1759 unsigned char *checksumBufPtr = NULL;
1760 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1761 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1762 stream->readback(checksumBufPtr, checksumSize);
1763 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1764 ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
1765 abort();
1766 }
1767 }
1768 return retval;
1769 }
1770
glGetBooleanv_enc(void * self,GLenum pname,GLboolean * params)1771 void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
1772 {
1773
1774 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1775 IOStream *stream = ctx->m_stream;
1776 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1777 bool useChecksum = checksumCalculator->getVersion() > 0;
1778
1779 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
1780 unsigned char *ptr;
1781 unsigned char *buf;
1782 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1783 const size_t checksumSize = checksumCalculator->checksumByteSize();
1784 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1785 buf = stream->alloc(totalSize);
1786 ptr = buf;
1787 int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
1788 memcpy(ptr, &totalSize, 4); ptr += 4;
1789
1790 memcpy(ptr, &pname, 4); ptr += 4;
1791 *(unsigned int *)(ptr) = __size_params; ptr += 4;
1792
1793 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1794 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1795
1796 stream->readback(params, __size_params);
1797 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1798 if (useChecksum) {
1799 unsigned char *checksumBufPtr = NULL;
1800 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1801 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1802 stream->readback(checksumBufPtr, checksumSize);
1803 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1804 ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
1805 abort();
1806 }
1807 }
1808 }
1809
glGetBufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)1810 void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
1811 {
1812
1813 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1814 IOStream *stream = ctx->m_stream;
1815 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1816 bool useChecksum = checksumCalculator->getVersion() > 0;
1817
1818 const unsigned int __size_params = (sizeof(GLint));
1819 unsigned char *ptr;
1820 unsigned char *buf;
1821 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
1822 const size_t checksumSize = checksumCalculator->checksumByteSize();
1823 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1824 buf = stream->alloc(totalSize);
1825 ptr = buf;
1826 int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
1827 memcpy(ptr, &totalSize, 4); ptr += 4;
1828
1829 memcpy(ptr, &target, 4); ptr += 4;
1830 memcpy(ptr, &pname, 4); ptr += 4;
1831 *(unsigned int *)(ptr) = __size_params; ptr += 4;
1832
1833 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1834 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1835
1836 stream->readback(params, __size_params);
1837 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1838 if (useChecksum) {
1839 unsigned char *checksumBufPtr = NULL;
1840 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1841 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1842 stream->readback(checksumBufPtr, checksumSize);
1843 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1844 ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
1845 abort();
1846 }
1847 }
1848 }
1849
glGetError_enc(void * self)1850 GLenum glGetError_enc(void *self )
1851 {
1852
1853 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1854 IOStream *stream = ctx->m_stream;
1855 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1856 bool useChecksum = checksumCalculator->getVersion() > 0;
1857
1858 unsigned char *ptr;
1859 unsigned char *buf;
1860 const size_t sizeWithoutChecksum = 8;
1861 const size_t checksumSize = checksumCalculator->checksumByteSize();
1862 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1863 buf = stream->alloc(totalSize);
1864 ptr = buf;
1865 int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
1866 memcpy(ptr, &totalSize, 4); ptr += 4;
1867
1868
1869 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1870 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1871
1872
1873 GLenum retval;
1874 stream->readback(&retval, 4);
1875 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1876 if (useChecksum) {
1877 unsigned char *checksumBufPtr = NULL;
1878 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1879 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1880 stream->readback(checksumBufPtr, checksumSize);
1881 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1882 ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
1883 abort();
1884 }
1885 }
1886 return retval;
1887 }
1888
glGetFloatv_enc(void * self,GLenum pname,GLfloat * params)1889 void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
1890 {
1891
1892 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1893 IOStream *stream = ctx->m_stream;
1894 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1895 bool useChecksum = checksumCalculator->getVersion() > 0;
1896
1897 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
1898 unsigned char *ptr;
1899 unsigned char *buf;
1900 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1901 const size_t checksumSize = checksumCalculator->checksumByteSize();
1902 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1903 buf = stream->alloc(totalSize);
1904 ptr = buf;
1905 int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
1906 memcpy(ptr, &totalSize, 4); ptr += 4;
1907
1908 memcpy(ptr, &pname, 4); ptr += 4;
1909 *(unsigned int *)(ptr) = __size_params; ptr += 4;
1910
1911 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1912 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1913
1914 stream->readback(params, __size_params);
1915 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1916 if (useChecksum) {
1917 unsigned char *checksumBufPtr = NULL;
1918 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1919 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1920 stream->readback(checksumBufPtr, checksumSize);
1921 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1922 ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
1923 abort();
1924 }
1925 }
1926 }
1927
glGetFramebufferAttachmentParameteriv_enc(void * self,GLenum target,GLenum attachment,GLenum pname,GLint * params)1928 void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
1929 {
1930
1931 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1932 IOStream *stream = ctx->m_stream;
1933 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1934 bool useChecksum = checksumCalculator->getVersion() > 0;
1935
1936 const unsigned int __size_params = (sizeof(GLint));
1937 unsigned char *ptr;
1938 unsigned char *buf;
1939 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
1940 const size_t checksumSize = checksumCalculator->checksumByteSize();
1941 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1942 buf = stream->alloc(totalSize);
1943 ptr = buf;
1944 int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
1945 memcpy(ptr, &totalSize, 4); ptr += 4;
1946
1947 memcpy(ptr, &target, 4); ptr += 4;
1948 memcpy(ptr, &attachment, 4); ptr += 4;
1949 memcpy(ptr, &pname, 4); ptr += 4;
1950 *(unsigned int *)(ptr) = __size_params; ptr += 4;
1951
1952 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1953 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1954
1955 stream->readback(params, __size_params);
1956 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1957 if (useChecksum) {
1958 unsigned char *checksumBufPtr = NULL;
1959 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1960 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1961 stream->readback(checksumBufPtr, checksumSize);
1962 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1963 ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
1964 abort();
1965 }
1966 }
1967 }
1968
glGetIntegerv_enc(void * self,GLenum pname,GLint * params)1969 void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
1970 {
1971
1972 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1973 IOStream *stream = ctx->m_stream;
1974 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1975 bool useChecksum = checksumCalculator->getVersion() > 0;
1976
1977 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
1978 unsigned char *ptr;
1979 unsigned char *buf;
1980 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1981 const size_t checksumSize = checksumCalculator->checksumByteSize();
1982 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1983 buf = stream->alloc(totalSize);
1984 ptr = buf;
1985 int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
1986 memcpy(ptr, &totalSize, 4); ptr += 4;
1987
1988 memcpy(ptr, &pname, 4); ptr += 4;
1989 *(unsigned int *)(ptr) = __size_params; ptr += 4;
1990
1991 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1992 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1993
1994 stream->readback(params, __size_params);
1995 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1996 if (useChecksum) {
1997 unsigned char *checksumBufPtr = NULL;
1998 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1999 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2000 stream->readback(checksumBufPtr, checksumSize);
2001 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2002 ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
2003 abort();
2004 }
2005 }
2006 }
2007
glGetProgramiv_enc(void * self,GLuint program,GLenum pname,GLint * params)2008 void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
2009 {
2010
2011 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2012 IOStream *stream = ctx->m_stream;
2013 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2014 bool useChecksum = checksumCalculator->getVersion() > 0;
2015
2016 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2017 unsigned char *ptr;
2018 unsigned char *buf;
2019 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2020 const size_t checksumSize = checksumCalculator->checksumByteSize();
2021 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2022 buf = stream->alloc(totalSize);
2023 ptr = buf;
2024 int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
2025 memcpy(ptr, &totalSize, 4); ptr += 4;
2026
2027 memcpy(ptr, &program, 4); ptr += 4;
2028 memcpy(ptr, &pname, 4); ptr += 4;
2029 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2030
2031 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2032 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2033
2034 stream->readback(params, __size_params);
2035 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2036 if (useChecksum) {
2037 unsigned char *checksumBufPtr = NULL;
2038 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2039 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2040 stream->readback(checksumBufPtr, checksumSize);
2041 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2042 ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
2043 abort();
2044 }
2045 }
2046 }
2047
glGetProgramInfoLog_enc(void * self,GLuint program,GLsizei bufsize,GLsizei * length,GLchar * infolog)2048 void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2049 {
2050
2051 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2052 IOStream *stream = ctx->m_stream;
2053 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2054 bool useChecksum = checksumCalculator->getVersion() > 0;
2055
2056 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
2057 const unsigned int __size_infolog = bufsize;
2058 unsigned char *ptr;
2059 unsigned char *buf;
2060 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2061 const size_t checksumSize = checksumCalculator->checksumByteSize();
2062 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2063 buf = stream->alloc(totalSize);
2064 ptr = buf;
2065 int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
2066 memcpy(ptr, &totalSize, 4); ptr += 4;
2067
2068 memcpy(ptr, &program, 4); ptr += 4;
2069 memcpy(ptr, &bufsize, 4); ptr += 4;
2070 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2071 *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
2072
2073 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2074 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2075
2076 if (length != NULL) {
2077 stream->readback(length, __size_length);
2078 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2079 }
2080 stream->readback(infolog, __size_infolog);
2081 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2082 if (useChecksum) {
2083 unsigned char *checksumBufPtr = NULL;
2084 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2085 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2086 stream->readback(checksumBufPtr, checksumSize);
2087 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2088 ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
2089 abort();
2090 }
2091 }
2092 }
2093
glGetRenderbufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2094 void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2095 {
2096
2097 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2098 IOStream *stream = ctx->m_stream;
2099 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2100 bool useChecksum = checksumCalculator->getVersion() > 0;
2101
2102 const unsigned int __size_params = sizeof(GLint);
2103 unsigned char *ptr;
2104 unsigned char *buf;
2105 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2106 const size_t checksumSize = checksumCalculator->checksumByteSize();
2107 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2108 buf = stream->alloc(totalSize);
2109 ptr = buf;
2110 int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2111 memcpy(ptr, &totalSize, 4); ptr += 4;
2112
2113 memcpy(ptr, &target, 4); ptr += 4;
2114 memcpy(ptr, &pname, 4); ptr += 4;
2115 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2116
2117 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2118 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2119
2120 stream->readback(params, __size_params);
2121 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2122 if (useChecksum) {
2123 unsigned char *checksumBufPtr = NULL;
2124 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2125 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2126 stream->readback(checksumBufPtr, checksumSize);
2127 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2128 ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
2129 abort();
2130 }
2131 }
2132 }
2133
glGetShaderiv_enc(void * self,GLuint shader,GLenum pname,GLint * params)2134 void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
2135 {
2136
2137 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2138 IOStream *stream = ctx->m_stream;
2139 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2140 bool useChecksum = checksumCalculator->getVersion() > 0;
2141
2142 const unsigned int __size_params = sizeof(GLint);
2143 unsigned char *ptr;
2144 unsigned char *buf;
2145 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2146 const size_t checksumSize = checksumCalculator->checksumByteSize();
2147 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2148 buf = stream->alloc(totalSize);
2149 ptr = buf;
2150 int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
2151 memcpy(ptr, &totalSize, 4); ptr += 4;
2152
2153 memcpy(ptr, &shader, 4); ptr += 4;
2154 memcpy(ptr, &pname, 4); ptr += 4;
2155 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2156
2157 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2158 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2159
2160 stream->readback(params, __size_params);
2161 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2162 if (useChecksum) {
2163 unsigned char *checksumBufPtr = NULL;
2164 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2165 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2166 stream->readback(checksumBufPtr, checksumSize);
2167 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2168 ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n");
2169 abort();
2170 }
2171 }
2172 }
2173
glGetShaderInfoLog_enc(void * self,GLuint shader,GLsizei bufsize,GLsizei * length,GLchar * infolog)2174 void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2175 {
2176
2177 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2178 IOStream *stream = ctx->m_stream;
2179 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2180 bool useChecksum = checksumCalculator->getVersion() > 0;
2181
2182 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2183 const unsigned int __size_infolog = bufsize;
2184 unsigned char *ptr;
2185 unsigned char *buf;
2186 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2187 const size_t checksumSize = checksumCalculator->checksumByteSize();
2188 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2189 buf = stream->alloc(totalSize);
2190 ptr = buf;
2191 int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
2192 memcpy(ptr, &totalSize, 4); ptr += 4;
2193
2194 memcpy(ptr, &shader, 4); ptr += 4;
2195 memcpy(ptr, &bufsize, 4); ptr += 4;
2196 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2197 *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
2198
2199 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2200 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2201
2202 if (length != NULL) {
2203 stream->readback(length, __size_length);
2204 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2205 }
2206 stream->readback(infolog, __size_infolog);
2207 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2208 if (useChecksum) {
2209 unsigned char *checksumBufPtr = NULL;
2210 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2211 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2212 stream->readback(checksumBufPtr, checksumSize);
2213 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2214 ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n");
2215 abort();
2216 }
2217 }
2218 }
2219
glGetShaderPrecisionFormat_enc(void * self,GLenum shadertype,GLenum precisiontype,GLint * range,GLint * precision)2220 void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
2221 {
2222
2223 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2224 IOStream *stream = ctx->m_stream;
2225 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2226 bool useChecksum = checksumCalculator->getVersion() > 0;
2227
2228 const unsigned int __size_range = (2 * sizeof(GLint));
2229 const unsigned int __size_precision = (sizeof(GLint));
2230 unsigned char *ptr;
2231 unsigned char *buf;
2232 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2233 const size_t checksumSize = checksumCalculator->checksumByteSize();
2234 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2235 buf = stream->alloc(totalSize);
2236 ptr = buf;
2237 int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
2238 memcpy(ptr, &totalSize, 4); ptr += 4;
2239
2240 memcpy(ptr, &shadertype, 4); ptr += 4;
2241 memcpy(ptr, &precisiontype, 4); ptr += 4;
2242 *(unsigned int *)(ptr) = __size_range; ptr += 4;
2243 *(unsigned int *)(ptr) = __size_precision; ptr += 4;
2244
2245 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2246 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2247
2248 stream->readback(range, __size_range);
2249 if (useChecksum) checksumCalculator->addBuffer(range, __size_range);
2250 stream->readback(precision, __size_precision);
2251 if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision);
2252 if (useChecksum) {
2253 unsigned char *checksumBufPtr = NULL;
2254 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2255 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2256 stream->readback(checksumBufPtr, checksumSize);
2257 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2258 ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n");
2259 abort();
2260 }
2261 }
2262 }
2263
glGetShaderSource_enc(void * self,GLuint shader,GLsizei bufsize,GLsizei * length,GLchar * source)2264 void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
2265 {
2266
2267 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2268 IOStream *stream = ctx->m_stream;
2269 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2270 bool useChecksum = checksumCalculator->getVersion() > 0;
2271
2272 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2273 const unsigned int __size_source = bufsize;
2274 unsigned char *ptr;
2275 unsigned char *buf;
2276 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2277 const size_t checksumSize = checksumCalculator->checksumByteSize();
2278 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2279 buf = stream->alloc(totalSize);
2280 ptr = buf;
2281 int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
2282 memcpy(ptr, &totalSize, 4); ptr += 4;
2283
2284 memcpy(ptr, &shader, 4); ptr += 4;
2285 memcpy(ptr, &bufsize, 4); ptr += 4;
2286 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2287 *(unsigned int *)(ptr) = __size_source; ptr += 4;
2288
2289 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2290 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2291
2292 if (length != NULL) {
2293 stream->readback(length, __size_length);
2294 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2295 }
2296 stream->readback(source, __size_source);
2297 if (useChecksum) checksumCalculator->addBuffer(source, __size_source);
2298 if (useChecksum) {
2299 unsigned char *checksumBufPtr = NULL;
2300 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2301 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2302 stream->readback(checksumBufPtr, checksumSize);
2303 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2304 ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n");
2305 abort();
2306 }
2307 }
2308 }
2309
glGetTexParameterfv_enc(void * self,GLenum target,GLenum pname,GLfloat * params)2310 void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
2311 {
2312
2313 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2314 IOStream *stream = ctx->m_stream;
2315 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2316 bool useChecksum = checksumCalculator->getVersion() > 0;
2317
2318 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2319 unsigned char *ptr;
2320 unsigned char *buf;
2321 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2322 const size_t checksumSize = checksumCalculator->checksumByteSize();
2323 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2324 buf = stream->alloc(totalSize);
2325 ptr = buf;
2326 int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
2327 memcpy(ptr, &totalSize, 4); ptr += 4;
2328
2329 memcpy(ptr, &target, 4); ptr += 4;
2330 memcpy(ptr, &pname, 4); ptr += 4;
2331 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2332
2333 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2334 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2335
2336 stream->readback(params, __size_params);
2337 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2338 if (useChecksum) {
2339 unsigned char *checksumBufPtr = NULL;
2340 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2341 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2342 stream->readback(checksumBufPtr, checksumSize);
2343 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2344 ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
2345 abort();
2346 }
2347 }
2348 }
2349
glGetTexParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2350 void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2351 {
2352
2353 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2354 IOStream *stream = ctx->m_stream;
2355 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2356 bool useChecksum = checksumCalculator->getVersion() > 0;
2357
2358 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2359 unsigned char *ptr;
2360 unsigned char *buf;
2361 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2362 const size_t checksumSize = checksumCalculator->checksumByteSize();
2363 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2364 buf = stream->alloc(totalSize);
2365 ptr = buf;
2366 int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2367 memcpy(ptr, &totalSize, 4); ptr += 4;
2368
2369 memcpy(ptr, &target, 4); ptr += 4;
2370 memcpy(ptr, &pname, 4); ptr += 4;
2371 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2372
2373 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2374 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2375
2376 stream->readback(params, __size_params);
2377 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2378 if (useChecksum) {
2379 unsigned char *checksumBufPtr = NULL;
2380 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2381 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2382 stream->readback(checksumBufPtr, checksumSize);
2383 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2384 ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
2385 abort();
2386 }
2387 }
2388 }
2389
glGetUniformfv_enc(void * self,GLuint program,GLint location,GLfloat * params)2390 void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params)
2391 {
2392
2393 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2394 IOStream *stream = ctx->m_stream;
2395 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2396 bool useChecksum = checksumCalculator->getVersion() > 0;
2397
2398 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
2399 unsigned char *ptr;
2400 unsigned char *buf;
2401 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2402 const size_t checksumSize = checksumCalculator->checksumByteSize();
2403 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2404 buf = stream->alloc(totalSize);
2405 ptr = buf;
2406 int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
2407 memcpy(ptr, &totalSize, 4); ptr += 4;
2408
2409 memcpy(ptr, &program, 4); ptr += 4;
2410 memcpy(ptr, &location, 4); ptr += 4;
2411 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2412
2413 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2414 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2415
2416 stream->readback(params, __size_params);
2417 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2418 if (useChecksum) {
2419 unsigned char *checksumBufPtr = NULL;
2420 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2421 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2422 stream->readback(checksumBufPtr, checksumSize);
2423 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2424 ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n");
2425 abort();
2426 }
2427 }
2428 }
2429
glGetUniformiv_enc(void * self,GLuint program,GLint location,GLint * params)2430 void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params)
2431 {
2432
2433 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2434 IOStream *stream = ctx->m_stream;
2435 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2436 bool useChecksum = checksumCalculator->getVersion() > 0;
2437
2438 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
2439 unsigned char *ptr;
2440 unsigned char *buf;
2441 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2442 const size_t checksumSize = checksumCalculator->checksumByteSize();
2443 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2444 buf = stream->alloc(totalSize);
2445 ptr = buf;
2446 int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
2447 memcpy(ptr, &totalSize, 4); ptr += 4;
2448
2449 memcpy(ptr, &program, 4); ptr += 4;
2450 memcpy(ptr, &location, 4); ptr += 4;
2451 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2452
2453 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2454 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2455
2456 stream->readback(params, __size_params);
2457 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2458 if (useChecksum) {
2459 unsigned char *checksumBufPtr = NULL;
2460 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2461 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2462 stream->readback(checksumBufPtr, checksumSize);
2463 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2464 ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n");
2465 abort();
2466 }
2467 }
2468 }
2469
glGetUniformLocation_enc(void * self,GLuint program,const GLchar * name)2470 int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name)
2471 {
2472
2473 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2474 IOStream *stream = ctx->m_stream;
2475 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2476 bool useChecksum = checksumCalculator->getVersion() > 0;
2477
2478 const unsigned int __size_name = (strlen(name) + 1);
2479 unsigned char *ptr;
2480 unsigned char *buf;
2481 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
2482 const size_t checksumSize = checksumCalculator->checksumByteSize();
2483 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2484 buf = stream->alloc(totalSize);
2485 ptr = buf;
2486 int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
2487 memcpy(ptr, &totalSize, 4); ptr += 4;
2488
2489 memcpy(ptr, &program, 4); ptr += 4;
2490 *(unsigned int *)(ptr) = __size_name; ptr += 4;
2491 memcpy(ptr, name, __size_name);ptr += __size_name;
2492
2493 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2494 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2495
2496
2497 int retval;
2498 stream->readback(&retval, 4);
2499 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
2500 if (useChecksum) {
2501 unsigned char *checksumBufPtr = NULL;
2502 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2503 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2504 stream->readback(checksumBufPtr, checksumSize);
2505 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2506 ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n");
2507 abort();
2508 }
2509 }
2510 return retval;
2511 }
2512
glGetVertexAttribfv_enc(void * self,GLuint index,GLenum pname,GLfloat * params)2513 void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params)
2514 {
2515
2516 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2517 IOStream *stream = ctx->m_stream;
2518 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2519 bool useChecksum = checksumCalculator->getVersion() > 0;
2520
2521 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2522 unsigned char *ptr;
2523 unsigned char *buf;
2524 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2525 const size_t checksumSize = checksumCalculator->checksumByteSize();
2526 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2527 buf = stream->alloc(totalSize);
2528 ptr = buf;
2529 int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
2530 memcpy(ptr, &totalSize, 4); ptr += 4;
2531
2532 memcpy(ptr, &index, 4); ptr += 4;
2533 memcpy(ptr, &pname, 4); ptr += 4;
2534 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2535
2536 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2537 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2538
2539 stream->readback(params, __size_params);
2540 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2541 if (useChecksum) {
2542 unsigned char *checksumBufPtr = NULL;
2543 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2544 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2545 stream->readback(checksumBufPtr, checksumSize);
2546 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2547 ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n");
2548 abort();
2549 }
2550 }
2551 }
2552
glGetVertexAttribiv_enc(void * self,GLuint index,GLenum pname,GLint * params)2553 void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
2554 {
2555
2556 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2557 IOStream *stream = ctx->m_stream;
2558 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2559 bool useChecksum = checksumCalculator->getVersion() > 0;
2560
2561 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2562 unsigned char *ptr;
2563 unsigned char *buf;
2564 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2565 const size_t checksumSize = checksumCalculator->checksumByteSize();
2566 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2567 buf = stream->alloc(totalSize);
2568 ptr = buf;
2569 int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
2570 memcpy(ptr, &totalSize, 4); ptr += 4;
2571
2572 memcpy(ptr, &index, 4); ptr += 4;
2573 memcpy(ptr, &pname, 4); ptr += 4;
2574 *(unsigned int *)(ptr) = __size_params; ptr += 4;
2575
2576 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2577 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2578
2579 stream->readback(params, __size_params);
2580 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2581 if (useChecksum) {
2582 unsigned char *checksumBufPtr = NULL;
2583 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2584 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2585 stream->readback(checksumBufPtr, checksumSize);
2586 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2587 ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n");
2588 abort();
2589 }
2590 }
2591 }
2592
glHint_enc(void * self,GLenum target,GLenum mode)2593 void glHint_enc(void *self , GLenum target, GLenum mode)
2594 {
2595
2596 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2597 IOStream *stream = ctx->m_stream;
2598 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2599 bool useChecksum = checksumCalculator->getVersion() > 0;
2600
2601 unsigned char *ptr;
2602 unsigned char *buf;
2603 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2604 const size_t checksumSize = checksumCalculator->checksumByteSize();
2605 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2606 buf = stream->alloc(totalSize);
2607 ptr = buf;
2608 int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
2609 memcpy(ptr, &totalSize, 4); ptr += 4;
2610
2611 memcpy(ptr, &target, 4); ptr += 4;
2612 memcpy(ptr, &mode, 4); ptr += 4;
2613
2614 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2615 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2616
2617 }
2618
glIsBuffer_enc(void * self,GLuint buffer)2619 GLboolean glIsBuffer_enc(void *self , GLuint buffer)
2620 {
2621
2622 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2623 IOStream *stream = ctx->m_stream;
2624 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2625 bool useChecksum = checksumCalculator->getVersion() > 0;
2626
2627 unsigned char *ptr;
2628 unsigned char *buf;
2629 const size_t sizeWithoutChecksum = 8 + 4;
2630 const size_t checksumSize = checksumCalculator->checksumByteSize();
2631 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2632 buf = stream->alloc(totalSize);
2633 ptr = buf;
2634 int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2635 memcpy(ptr, &totalSize, 4); ptr += 4;
2636
2637 memcpy(ptr, &buffer, 4); ptr += 4;
2638
2639 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2640 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2641
2642
2643 GLboolean retval;
2644 stream->readback(&retval, 1);
2645 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2646 if (useChecksum) {
2647 unsigned char *checksumBufPtr = NULL;
2648 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2649 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2650 stream->readback(checksumBufPtr, checksumSize);
2651 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2652 ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
2653 abort();
2654 }
2655 }
2656 return retval;
2657 }
2658
glIsEnabled_enc(void * self,GLenum cap)2659 GLboolean glIsEnabled_enc(void *self , GLenum cap)
2660 {
2661
2662 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2663 IOStream *stream = ctx->m_stream;
2664 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2665 bool useChecksum = checksumCalculator->getVersion() > 0;
2666
2667 unsigned char *ptr;
2668 unsigned char *buf;
2669 const size_t sizeWithoutChecksum = 8 + 4;
2670 const size_t checksumSize = checksumCalculator->checksumByteSize();
2671 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2672 buf = stream->alloc(totalSize);
2673 ptr = buf;
2674 int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
2675 memcpy(ptr, &totalSize, 4); ptr += 4;
2676
2677 memcpy(ptr, &cap, 4); ptr += 4;
2678
2679 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2680 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2681
2682
2683 GLboolean retval;
2684 stream->readback(&retval, 1);
2685 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2686 if (useChecksum) {
2687 unsigned char *checksumBufPtr = NULL;
2688 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2689 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2690 stream->readback(checksumBufPtr, checksumSize);
2691 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2692 ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
2693 abort();
2694 }
2695 }
2696 return retval;
2697 }
2698
glIsFramebuffer_enc(void * self,GLuint framebuffer)2699 GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer)
2700 {
2701
2702 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2703 IOStream *stream = ctx->m_stream;
2704 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2705 bool useChecksum = checksumCalculator->getVersion() > 0;
2706
2707 unsigned char *ptr;
2708 unsigned char *buf;
2709 const size_t sizeWithoutChecksum = 8 + 4;
2710 const size_t checksumSize = checksumCalculator->checksumByteSize();
2711 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2712 buf = stream->alloc(totalSize);
2713 ptr = buf;
2714 int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2715 memcpy(ptr, &totalSize, 4); ptr += 4;
2716
2717 memcpy(ptr, &framebuffer, 4); ptr += 4;
2718
2719 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2720 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2721
2722
2723 GLboolean retval;
2724 stream->readback(&retval, 1);
2725 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2726 if (useChecksum) {
2727 unsigned char *checksumBufPtr = NULL;
2728 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2729 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2730 stream->readback(checksumBufPtr, checksumSize);
2731 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2732 ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n");
2733 abort();
2734 }
2735 }
2736 return retval;
2737 }
2738
glIsProgram_enc(void * self,GLuint program)2739 GLboolean glIsProgram_enc(void *self , GLuint program)
2740 {
2741
2742 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2743 IOStream *stream = ctx->m_stream;
2744 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2745 bool useChecksum = checksumCalculator->getVersion() > 0;
2746
2747 unsigned char *ptr;
2748 unsigned char *buf;
2749 const size_t sizeWithoutChecksum = 8 + 4;
2750 const size_t checksumSize = checksumCalculator->checksumByteSize();
2751 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2752 buf = stream->alloc(totalSize);
2753 ptr = buf;
2754 int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
2755 memcpy(ptr, &totalSize, 4); ptr += 4;
2756
2757 memcpy(ptr, &program, 4); ptr += 4;
2758
2759 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2760 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2761
2762
2763 GLboolean retval;
2764 stream->readback(&retval, 1);
2765 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2766 if (useChecksum) {
2767 unsigned char *checksumBufPtr = NULL;
2768 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2769 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2770 stream->readback(checksumBufPtr, checksumSize);
2771 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2772 ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n");
2773 abort();
2774 }
2775 }
2776 return retval;
2777 }
2778
glIsRenderbuffer_enc(void * self,GLuint renderbuffer)2779 GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer)
2780 {
2781
2782 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2783 IOStream *stream = ctx->m_stream;
2784 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2785 bool useChecksum = checksumCalculator->getVersion() > 0;
2786
2787 unsigned char *ptr;
2788 unsigned char *buf;
2789 const size_t sizeWithoutChecksum = 8 + 4;
2790 const size_t checksumSize = checksumCalculator->checksumByteSize();
2791 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2792 buf = stream->alloc(totalSize);
2793 ptr = buf;
2794 int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2795 memcpy(ptr, &totalSize, 4); ptr += 4;
2796
2797 memcpy(ptr, &renderbuffer, 4); ptr += 4;
2798
2799 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2800 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2801
2802
2803 GLboolean retval;
2804 stream->readback(&retval, 1);
2805 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2806 if (useChecksum) {
2807 unsigned char *checksumBufPtr = NULL;
2808 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2809 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2810 stream->readback(checksumBufPtr, checksumSize);
2811 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2812 ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n");
2813 abort();
2814 }
2815 }
2816 return retval;
2817 }
2818
glIsShader_enc(void * self,GLuint shader)2819 GLboolean glIsShader_enc(void *self , GLuint shader)
2820 {
2821
2822 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2823 IOStream *stream = ctx->m_stream;
2824 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2825 bool useChecksum = checksumCalculator->getVersion() > 0;
2826
2827 unsigned char *ptr;
2828 unsigned char *buf;
2829 const size_t sizeWithoutChecksum = 8 + 4;
2830 const size_t checksumSize = checksumCalculator->checksumByteSize();
2831 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2832 buf = stream->alloc(totalSize);
2833 ptr = buf;
2834 int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
2835 memcpy(ptr, &totalSize, 4); ptr += 4;
2836
2837 memcpy(ptr, &shader, 4); ptr += 4;
2838
2839 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2840 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2841
2842
2843 GLboolean retval;
2844 stream->readback(&retval, 1);
2845 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2846 if (useChecksum) {
2847 unsigned char *checksumBufPtr = NULL;
2848 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2849 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2850 stream->readback(checksumBufPtr, checksumSize);
2851 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2852 ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n");
2853 abort();
2854 }
2855 }
2856 return retval;
2857 }
2858
glIsTexture_enc(void * self,GLuint texture)2859 GLboolean glIsTexture_enc(void *self , GLuint texture)
2860 {
2861
2862 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2863 IOStream *stream = ctx->m_stream;
2864 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2865 bool useChecksum = checksumCalculator->getVersion() > 0;
2866
2867 unsigned char *ptr;
2868 unsigned char *buf;
2869 const size_t sizeWithoutChecksum = 8 + 4;
2870 const size_t checksumSize = checksumCalculator->checksumByteSize();
2871 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2872 buf = stream->alloc(totalSize);
2873 ptr = buf;
2874 int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
2875 memcpy(ptr, &totalSize, 4); ptr += 4;
2876
2877 memcpy(ptr, &texture, 4); ptr += 4;
2878
2879 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2880 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2881
2882
2883 GLboolean retval;
2884 stream->readback(&retval, 1);
2885 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2886 if (useChecksum) {
2887 unsigned char *checksumBufPtr = NULL;
2888 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2889 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2890 stream->readback(checksumBufPtr, checksumSize);
2891 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2892 ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
2893 abort();
2894 }
2895 }
2896 return retval;
2897 }
2898
glLineWidth_enc(void * self,GLfloat width)2899 void glLineWidth_enc(void *self , GLfloat width)
2900 {
2901
2902 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2903 IOStream *stream = ctx->m_stream;
2904 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2905 bool useChecksum = checksumCalculator->getVersion() > 0;
2906
2907 unsigned char *ptr;
2908 unsigned char *buf;
2909 const size_t sizeWithoutChecksum = 8 + 4;
2910 const size_t checksumSize = checksumCalculator->checksumByteSize();
2911 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2912 buf = stream->alloc(totalSize);
2913 ptr = buf;
2914 int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
2915 memcpy(ptr, &totalSize, 4); ptr += 4;
2916
2917 memcpy(ptr, &width, 4); ptr += 4;
2918
2919 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2920 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2921
2922 }
2923
glLinkProgram_enc(void * self,GLuint program)2924 void glLinkProgram_enc(void *self , GLuint program)
2925 {
2926
2927 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2928 IOStream *stream = ctx->m_stream;
2929 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2930 bool useChecksum = checksumCalculator->getVersion() > 0;
2931
2932 unsigned char *ptr;
2933 unsigned char *buf;
2934 const size_t sizeWithoutChecksum = 8 + 4;
2935 const size_t checksumSize = checksumCalculator->checksumByteSize();
2936 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2937 buf = stream->alloc(totalSize);
2938 ptr = buf;
2939 int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
2940 memcpy(ptr, &totalSize, 4); ptr += 4;
2941
2942 memcpy(ptr, &program, 4); ptr += 4;
2943
2944 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2945 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2946
2947 }
2948
glPixelStorei_enc(void * self,GLenum pname,GLint param)2949 void glPixelStorei_enc(void *self , GLenum pname, GLint param)
2950 {
2951
2952 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2953 IOStream *stream = ctx->m_stream;
2954 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2955 bool useChecksum = checksumCalculator->getVersion() > 0;
2956
2957 unsigned char *ptr;
2958 unsigned char *buf;
2959 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2960 const size_t checksumSize = checksumCalculator->checksumByteSize();
2961 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2962 buf = stream->alloc(totalSize);
2963 ptr = buf;
2964 int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
2965 memcpy(ptr, &totalSize, 4); ptr += 4;
2966
2967 memcpy(ptr, &pname, 4); ptr += 4;
2968 memcpy(ptr, ¶m, 4); ptr += 4;
2969
2970 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2971 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2972
2973 }
2974
glPolygonOffset_enc(void * self,GLfloat factor,GLfloat units)2975 void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
2976 {
2977
2978 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2979 IOStream *stream = ctx->m_stream;
2980 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2981 bool useChecksum = checksumCalculator->getVersion() > 0;
2982
2983 unsigned char *ptr;
2984 unsigned char *buf;
2985 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2986 const size_t checksumSize = checksumCalculator->checksumByteSize();
2987 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2988 buf = stream->alloc(totalSize);
2989 ptr = buf;
2990 int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
2991 memcpy(ptr, &totalSize, 4); ptr += 4;
2992
2993 memcpy(ptr, &factor, 4); ptr += 4;
2994 memcpy(ptr, &units, 4); ptr += 4;
2995
2996 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2997 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2998
2999 }
3000
glReadPixels_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLvoid * pixels)3001 void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
3002 {
3003
3004 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3005 IOStream *stream = ctx->m_stream;
3006 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3007 bool useChecksum = checksumCalculator->getVersion() > 0;
3008
3009 const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1);
3010 unsigned char *ptr;
3011 unsigned char *buf;
3012 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
3013 const size_t checksumSize = checksumCalculator->checksumByteSize();
3014 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3015 buf = stream->alloc(totalSize);
3016 ptr = buf;
3017 int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
3018 memcpy(ptr, &totalSize, 4); ptr += 4;
3019
3020 memcpy(ptr, &x, 4); ptr += 4;
3021 memcpy(ptr, &y, 4); ptr += 4;
3022 memcpy(ptr, &width, 4); ptr += 4;
3023 memcpy(ptr, &height, 4); ptr += 4;
3024 memcpy(ptr, &format, 4); ptr += 4;
3025 memcpy(ptr, &type, 4); ptr += 4;
3026 *(unsigned int *)(ptr) = __size_pixels; ptr += 4;
3027
3028 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3029 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3030
3031 stream->readback(pixels, __size_pixels);
3032 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3033 if (useChecksum) {
3034 unsigned char *checksumBufPtr = NULL;
3035 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
3036 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
3037 stream->readback(checksumBufPtr, checksumSize);
3038 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
3039 ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3040 abort();
3041 }
3042 }
3043 }
3044
glReleaseShaderCompiler_enc(void * self)3045 void glReleaseShaderCompiler_enc(void *self )
3046 {
3047
3048 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3049 IOStream *stream = ctx->m_stream;
3050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3051 bool useChecksum = checksumCalculator->getVersion() > 0;
3052
3053 unsigned char *ptr;
3054 unsigned char *buf;
3055 const size_t sizeWithoutChecksum = 8;
3056 const size_t checksumSize = checksumCalculator->checksumByteSize();
3057 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3058 buf = stream->alloc(totalSize);
3059 ptr = buf;
3060 int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
3061 memcpy(ptr, &totalSize, 4); ptr += 4;
3062
3063
3064 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3065 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3066
3067 }
3068
glRenderbufferStorage_enc(void * self,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)3069 void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
3070 {
3071
3072 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3073 IOStream *stream = ctx->m_stream;
3074 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3075 bool useChecksum = checksumCalculator->getVersion() > 0;
3076
3077 unsigned char *ptr;
3078 unsigned char *buf;
3079 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3080 const size_t checksumSize = checksumCalculator->checksumByteSize();
3081 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3082 buf = stream->alloc(totalSize);
3083 ptr = buf;
3084 int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
3085 memcpy(ptr, &totalSize, 4); ptr += 4;
3086
3087 memcpy(ptr, &target, 4); ptr += 4;
3088 memcpy(ptr, &internalformat, 4); ptr += 4;
3089 memcpy(ptr, &width, 4); ptr += 4;
3090 memcpy(ptr, &height, 4); ptr += 4;
3091
3092 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3093 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3094
3095 }
3096
glSampleCoverage_enc(void * self,GLclampf value,GLboolean invert)3097 void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
3098 {
3099
3100 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3101 IOStream *stream = ctx->m_stream;
3102 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3103 bool useChecksum = checksumCalculator->getVersion() > 0;
3104
3105 unsigned char *ptr;
3106 unsigned char *buf;
3107 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3108 const size_t checksumSize = checksumCalculator->checksumByteSize();
3109 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3110 buf = stream->alloc(totalSize);
3111 ptr = buf;
3112 int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
3113 memcpy(ptr, &totalSize, 4); ptr += 4;
3114
3115 memcpy(ptr, &value, 4); ptr += 4;
3116 memcpy(ptr, &invert, 1); ptr += 1;
3117
3118 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3119 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3120
3121 }
3122
glScissor_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)3123 void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3124 {
3125
3126 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3127 IOStream *stream = ctx->m_stream;
3128 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3129 bool useChecksum = checksumCalculator->getVersion() > 0;
3130
3131 unsigned char *ptr;
3132 unsigned char *buf;
3133 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3134 const size_t checksumSize = checksumCalculator->checksumByteSize();
3135 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3136 buf = stream->alloc(totalSize);
3137 ptr = buf;
3138 int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
3139 memcpy(ptr, &totalSize, 4); ptr += 4;
3140
3141 memcpy(ptr, &x, 4); ptr += 4;
3142 memcpy(ptr, &y, 4); ptr += 4;
3143 memcpy(ptr, &width, 4); ptr += 4;
3144 memcpy(ptr, &height, 4); ptr += 4;
3145
3146 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3147 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3148
3149 }
3150
glStencilFunc_enc(void * self,GLenum func,GLint ref,GLuint mask)3151 void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
3152 {
3153
3154 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3155 IOStream *stream = ctx->m_stream;
3156 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3157 bool useChecksum = checksumCalculator->getVersion() > 0;
3158
3159 unsigned char *ptr;
3160 unsigned char *buf;
3161 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3162 const size_t checksumSize = checksumCalculator->checksumByteSize();
3163 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3164 buf = stream->alloc(totalSize);
3165 ptr = buf;
3166 int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
3167 memcpy(ptr, &totalSize, 4); ptr += 4;
3168
3169 memcpy(ptr, &func, 4); ptr += 4;
3170 memcpy(ptr, &ref, 4); ptr += 4;
3171 memcpy(ptr, &mask, 4); ptr += 4;
3172
3173 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3174 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3175
3176 }
3177
glStencilFuncSeparate_enc(void * self,GLenum face,GLenum func,GLint ref,GLuint mask)3178 void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
3179 {
3180
3181 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3182 IOStream *stream = ctx->m_stream;
3183 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3184 bool useChecksum = checksumCalculator->getVersion() > 0;
3185
3186 unsigned char *ptr;
3187 unsigned char *buf;
3188 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3189 const size_t checksumSize = checksumCalculator->checksumByteSize();
3190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3191 buf = stream->alloc(totalSize);
3192 ptr = buf;
3193 int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3194 memcpy(ptr, &totalSize, 4); ptr += 4;
3195
3196 memcpy(ptr, &face, 4); ptr += 4;
3197 memcpy(ptr, &func, 4); ptr += 4;
3198 memcpy(ptr, &ref, 4); ptr += 4;
3199 memcpy(ptr, &mask, 4); ptr += 4;
3200
3201 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3202 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3203
3204 }
3205
glStencilMask_enc(void * self,GLuint mask)3206 void glStencilMask_enc(void *self , GLuint mask)
3207 {
3208
3209 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3210 IOStream *stream = ctx->m_stream;
3211 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3212 bool useChecksum = checksumCalculator->getVersion() > 0;
3213
3214 unsigned char *ptr;
3215 unsigned char *buf;
3216 const size_t sizeWithoutChecksum = 8 + 4;
3217 const size_t checksumSize = checksumCalculator->checksumByteSize();
3218 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3219 buf = stream->alloc(totalSize);
3220 ptr = buf;
3221 int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
3222 memcpy(ptr, &totalSize, 4); ptr += 4;
3223
3224 memcpy(ptr, &mask, 4); ptr += 4;
3225
3226 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3227 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3228
3229 }
3230
glStencilMaskSeparate_enc(void * self,GLenum face,GLuint mask)3231 void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
3232 {
3233
3234 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3235 IOStream *stream = ctx->m_stream;
3236 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3237 bool useChecksum = checksumCalculator->getVersion() > 0;
3238
3239 unsigned char *ptr;
3240 unsigned char *buf;
3241 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3242 const size_t checksumSize = checksumCalculator->checksumByteSize();
3243 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3244 buf = stream->alloc(totalSize);
3245 ptr = buf;
3246 int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3247 memcpy(ptr, &totalSize, 4); ptr += 4;
3248
3249 memcpy(ptr, &face, 4); ptr += 4;
3250 memcpy(ptr, &mask, 4); ptr += 4;
3251
3252 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3253 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3254
3255 }
3256
glStencilOp_enc(void * self,GLenum fail,GLenum zfail,GLenum zpass)3257 void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
3258 {
3259
3260 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3261 IOStream *stream = ctx->m_stream;
3262 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3263 bool useChecksum = checksumCalculator->getVersion() > 0;
3264
3265 unsigned char *ptr;
3266 unsigned char *buf;
3267 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3268 const size_t checksumSize = checksumCalculator->checksumByteSize();
3269 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3270 buf = stream->alloc(totalSize);
3271 ptr = buf;
3272 int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
3273 memcpy(ptr, &totalSize, 4); ptr += 4;
3274
3275 memcpy(ptr, &fail, 4); ptr += 4;
3276 memcpy(ptr, &zfail, 4); ptr += 4;
3277 memcpy(ptr, &zpass, 4); ptr += 4;
3278
3279 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3280 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3281
3282 }
3283
glStencilOpSeparate_enc(void * self,GLenum face,GLenum fail,GLenum zfail,GLenum zpass)3284 void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3285 {
3286
3287 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3288 IOStream *stream = ctx->m_stream;
3289 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3290 bool useChecksum = checksumCalculator->getVersion() > 0;
3291
3292 unsigned char *ptr;
3293 unsigned char *buf;
3294 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3295 const size_t checksumSize = checksumCalculator->checksumByteSize();
3296 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3297 buf = stream->alloc(totalSize);
3298 ptr = buf;
3299 int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3300 memcpy(ptr, &totalSize, 4); ptr += 4;
3301
3302 memcpy(ptr, &face, 4); ptr += 4;
3303 memcpy(ptr, &fail, 4); ptr += 4;
3304 memcpy(ptr, &zfail, 4); ptr += 4;
3305 memcpy(ptr, &zpass, 4); ptr += 4;
3306
3307 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3308 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3309
3310 }
3311
glTexImage2D_enc(void * self,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)3312 void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
3313 {
3314
3315 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3316 IOStream *stream = ctx->m_stream;
3317 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3318 bool useChecksum = checksumCalculator->getVersion() > 0;
3319
3320 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3321 unsigned char *ptr;
3322 unsigned char *buf;
3323 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3324 const size_t checksumSize = checksumCalculator->checksumByteSize();
3325 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3326 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3327 ptr = buf;
3328 int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3329 memcpy(ptr, &totalSize, 4); ptr += 4;
3330
3331 memcpy(ptr, &target, 4); ptr += 4;
3332 memcpy(ptr, &level, 4); ptr += 4;
3333 memcpy(ptr, &internalformat, 4); ptr += 4;
3334 memcpy(ptr, &width, 4); ptr += 4;
3335 memcpy(ptr, &height, 4); ptr += 4;
3336 memcpy(ptr, &border, 4); ptr += 4;
3337 memcpy(ptr, &format, 4); ptr += 4;
3338 memcpy(ptr, &type, 4); ptr += 4;
3339
3340 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3341 stream->flush();
3342 stream->writeFully(&__size_pixels,4);
3343 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3344 if (pixels != NULL) {
3345 stream->writeFully(pixels, __size_pixels);
3346 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3347 }
3348 buf = stream->alloc(checksumSize);
3349 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3350
3351 }
3352
glTexParameterf_enc(void * self,GLenum target,GLenum pname,GLfloat param)3353 void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
3354 {
3355
3356 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3357 IOStream *stream = ctx->m_stream;
3358 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3359 bool useChecksum = checksumCalculator->getVersion() > 0;
3360
3361 unsigned char *ptr;
3362 unsigned char *buf;
3363 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3364 const size_t checksumSize = checksumCalculator->checksumByteSize();
3365 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3366 buf = stream->alloc(totalSize);
3367 ptr = buf;
3368 int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
3369 memcpy(ptr, &totalSize, 4); ptr += 4;
3370
3371 memcpy(ptr, &target, 4); ptr += 4;
3372 memcpy(ptr, &pname, 4); ptr += 4;
3373 memcpy(ptr, ¶m, 4); ptr += 4;
3374
3375 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3376 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3377
3378 }
3379
glTexParameterfv_enc(void * self,GLenum target,GLenum pname,const GLfloat * params)3380 void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
3381 {
3382
3383 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3384 IOStream *stream = ctx->m_stream;
3385 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3386 bool useChecksum = checksumCalculator->getVersion() > 0;
3387
3388 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
3389 unsigned char *ptr;
3390 unsigned char *buf;
3391 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3392 const size_t checksumSize = checksumCalculator->checksumByteSize();
3393 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3394 buf = stream->alloc(totalSize);
3395 ptr = buf;
3396 int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
3397 memcpy(ptr, &totalSize, 4); ptr += 4;
3398
3399 memcpy(ptr, &target, 4); ptr += 4;
3400 memcpy(ptr, &pname, 4); ptr += 4;
3401 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3402 memcpy(ptr, params, __size_params);ptr += __size_params;
3403
3404 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3405 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3406
3407 }
3408
glTexParameteri_enc(void * self,GLenum target,GLenum pname,GLint param)3409 void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
3410 {
3411
3412 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3413 IOStream *stream = ctx->m_stream;
3414 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3415 bool useChecksum = checksumCalculator->getVersion() > 0;
3416
3417 unsigned char *ptr;
3418 unsigned char *buf;
3419 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3420 const size_t checksumSize = checksumCalculator->checksumByteSize();
3421 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3422 buf = stream->alloc(totalSize);
3423 ptr = buf;
3424 int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
3425 memcpy(ptr, &totalSize, 4); ptr += 4;
3426
3427 memcpy(ptr, &target, 4); ptr += 4;
3428 memcpy(ptr, &pname, 4); ptr += 4;
3429 memcpy(ptr, ¶m, 4); ptr += 4;
3430
3431 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3432 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3433
3434 }
3435
glTexParameteriv_enc(void * self,GLenum target,GLenum pname,const GLint * params)3436 void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3437 {
3438
3439 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3440 IOStream *stream = ctx->m_stream;
3441 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3442 bool useChecksum = checksumCalculator->getVersion() > 0;
3443
3444 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
3445 unsigned char *ptr;
3446 unsigned char *buf;
3447 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3448 const size_t checksumSize = checksumCalculator->checksumByteSize();
3449 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3450 buf = stream->alloc(totalSize);
3451 ptr = buf;
3452 int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
3453 memcpy(ptr, &totalSize, 4); ptr += 4;
3454
3455 memcpy(ptr, &target, 4); ptr += 4;
3456 memcpy(ptr, &pname, 4); ptr += 4;
3457 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3458 memcpy(ptr, params, __size_params);ptr += __size_params;
3459
3460 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3461 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3462
3463 }
3464
glTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)3465 void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
3466 {
3467
3468 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3469 IOStream *stream = ctx->m_stream;
3470 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3471 bool useChecksum = checksumCalculator->getVersion() > 0;
3472
3473 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3474 unsigned char *ptr;
3475 unsigned char *buf;
3476 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3477 const size_t checksumSize = checksumCalculator->checksumByteSize();
3478 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3479 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3480 ptr = buf;
3481 int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3482 memcpy(ptr, &totalSize, 4); ptr += 4;
3483
3484 memcpy(ptr, &target, 4); ptr += 4;
3485 memcpy(ptr, &level, 4); ptr += 4;
3486 memcpy(ptr, &xoffset, 4); ptr += 4;
3487 memcpy(ptr, &yoffset, 4); ptr += 4;
3488 memcpy(ptr, &width, 4); ptr += 4;
3489 memcpy(ptr, &height, 4); ptr += 4;
3490 memcpy(ptr, &format, 4); ptr += 4;
3491 memcpy(ptr, &type, 4); ptr += 4;
3492
3493 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3494 stream->flush();
3495 stream->writeFully(&__size_pixels,4);
3496 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3497 if (pixels != NULL) {
3498 stream->writeFully(pixels, __size_pixels);
3499 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3500 }
3501 buf = stream->alloc(checksumSize);
3502 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3503
3504 }
3505
glUniform1f_enc(void * self,GLint location,GLfloat x)3506 void glUniform1f_enc(void *self , GLint location, GLfloat x)
3507 {
3508
3509 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3510 IOStream *stream = ctx->m_stream;
3511 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3512 bool useChecksum = checksumCalculator->getVersion() > 0;
3513
3514 unsigned char *ptr;
3515 unsigned char *buf;
3516 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3517 const size_t checksumSize = checksumCalculator->checksumByteSize();
3518 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3519 buf = stream->alloc(totalSize);
3520 ptr = buf;
3521 int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
3522 memcpy(ptr, &totalSize, 4); ptr += 4;
3523
3524 memcpy(ptr, &location, 4); ptr += 4;
3525 memcpy(ptr, &x, 4); ptr += 4;
3526
3527 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3528 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3529
3530 }
3531
glUniform1fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3532 void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3533 {
3534
3535 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3536 IOStream *stream = ctx->m_stream;
3537 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3538 bool useChecksum = checksumCalculator->getVersion() > 0;
3539
3540 const unsigned int __size_v = (count * sizeof(GLfloat));
3541 unsigned char *ptr;
3542 unsigned char *buf;
3543 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3544 const size_t checksumSize = checksumCalculator->checksumByteSize();
3545 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3546 buf = stream->alloc(totalSize);
3547 ptr = buf;
3548 int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
3549 memcpy(ptr, &totalSize, 4); ptr += 4;
3550
3551 memcpy(ptr, &location, 4); ptr += 4;
3552 memcpy(ptr, &count, 4); ptr += 4;
3553 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3554 memcpy(ptr, v, __size_v);ptr += __size_v;
3555
3556 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3557 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3558
3559 }
3560
glUniform1i_enc(void * self,GLint location,GLint x)3561 void glUniform1i_enc(void *self , GLint location, GLint x)
3562 {
3563
3564 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3565 IOStream *stream = ctx->m_stream;
3566 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3567 bool useChecksum = checksumCalculator->getVersion() > 0;
3568
3569 unsigned char *ptr;
3570 unsigned char *buf;
3571 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3572 const size_t checksumSize = checksumCalculator->checksumByteSize();
3573 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3574 buf = stream->alloc(totalSize);
3575 ptr = buf;
3576 int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
3577 memcpy(ptr, &totalSize, 4); ptr += 4;
3578
3579 memcpy(ptr, &location, 4); ptr += 4;
3580 memcpy(ptr, &x, 4); ptr += 4;
3581
3582 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3583 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3584
3585 }
3586
glUniform1iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3587 void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3588 {
3589
3590 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3591 IOStream *stream = ctx->m_stream;
3592 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3593 bool useChecksum = checksumCalculator->getVersion() > 0;
3594
3595 const unsigned int __size_v = (count * sizeof(GLint));
3596 unsigned char *ptr;
3597 unsigned char *buf;
3598 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3599 const size_t checksumSize = checksumCalculator->checksumByteSize();
3600 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3601 buf = stream->alloc(totalSize);
3602 ptr = buf;
3603 int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
3604 memcpy(ptr, &totalSize, 4); ptr += 4;
3605
3606 memcpy(ptr, &location, 4); ptr += 4;
3607 memcpy(ptr, &count, 4); ptr += 4;
3608 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3609 memcpy(ptr, v, __size_v);ptr += __size_v;
3610
3611 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3612 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3613
3614 }
3615
glUniform2f_enc(void * self,GLint location,GLfloat x,GLfloat y)3616 void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
3617 {
3618
3619 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3620 IOStream *stream = ctx->m_stream;
3621 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3622 bool useChecksum = checksumCalculator->getVersion() > 0;
3623
3624 unsigned char *ptr;
3625 unsigned char *buf;
3626 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3627 const size_t checksumSize = checksumCalculator->checksumByteSize();
3628 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3629 buf = stream->alloc(totalSize);
3630 ptr = buf;
3631 int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
3632 memcpy(ptr, &totalSize, 4); ptr += 4;
3633
3634 memcpy(ptr, &location, 4); ptr += 4;
3635 memcpy(ptr, &x, 4); ptr += 4;
3636 memcpy(ptr, &y, 4); ptr += 4;
3637
3638 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3639 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3640
3641 }
3642
glUniform2fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3643 void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3644 {
3645
3646 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3647 IOStream *stream = ctx->m_stream;
3648 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3649 bool useChecksum = checksumCalculator->getVersion() > 0;
3650
3651 const unsigned int __size_v = (count * 2 * sizeof(GLfloat));
3652 unsigned char *ptr;
3653 unsigned char *buf;
3654 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3655 const size_t checksumSize = checksumCalculator->checksumByteSize();
3656 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3657 buf = stream->alloc(totalSize);
3658 ptr = buf;
3659 int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
3660 memcpy(ptr, &totalSize, 4); ptr += 4;
3661
3662 memcpy(ptr, &location, 4); ptr += 4;
3663 memcpy(ptr, &count, 4); ptr += 4;
3664 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3665 memcpy(ptr, v, __size_v);ptr += __size_v;
3666
3667 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3668 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3669
3670 }
3671
glUniform2i_enc(void * self,GLint location,GLint x,GLint y)3672 void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
3673 {
3674
3675 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3676 IOStream *stream = ctx->m_stream;
3677 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3678 bool useChecksum = checksumCalculator->getVersion() > 0;
3679
3680 unsigned char *ptr;
3681 unsigned char *buf;
3682 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3683 const size_t checksumSize = checksumCalculator->checksumByteSize();
3684 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3685 buf = stream->alloc(totalSize);
3686 ptr = buf;
3687 int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
3688 memcpy(ptr, &totalSize, 4); ptr += 4;
3689
3690 memcpy(ptr, &location, 4); ptr += 4;
3691 memcpy(ptr, &x, 4); ptr += 4;
3692 memcpy(ptr, &y, 4); ptr += 4;
3693
3694 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3695 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3696
3697 }
3698
glUniform2iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3699 void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3700 {
3701
3702 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3703 IOStream *stream = ctx->m_stream;
3704 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3705 bool useChecksum = checksumCalculator->getVersion() > 0;
3706
3707 const unsigned int __size_v = (count * 2 * sizeof(GLint));
3708 unsigned char *ptr;
3709 unsigned char *buf;
3710 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3711 const size_t checksumSize = checksumCalculator->checksumByteSize();
3712 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3713 buf = stream->alloc(totalSize);
3714 ptr = buf;
3715 int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
3716 memcpy(ptr, &totalSize, 4); ptr += 4;
3717
3718 memcpy(ptr, &location, 4); ptr += 4;
3719 memcpy(ptr, &count, 4); ptr += 4;
3720 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3721 memcpy(ptr, v, __size_v);ptr += __size_v;
3722
3723 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3724 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3725
3726 }
3727
glUniform3f_enc(void * self,GLint location,GLfloat x,GLfloat y,GLfloat z)3728 void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
3729 {
3730
3731 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3732 IOStream *stream = ctx->m_stream;
3733 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3734 bool useChecksum = checksumCalculator->getVersion() > 0;
3735
3736 unsigned char *ptr;
3737 unsigned char *buf;
3738 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3739 const size_t checksumSize = checksumCalculator->checksumByteSize();
3740 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3741 buf = stream->alloc(totalSize);
3742 ptr = buf;
3743 int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
3744 memcpy(ptr, &totalSize, 4); ptr += 4;
3745
3746 memcpy(ptr, &location, 4); ptr += 4;
3747 memcpy(ptr, &x, 4); ptr += 4;
3748 memcpy(ptr, &y, 4); ptr += 4;
3749 memcpy(ptr, &z, 4); ptr += 4;
3750
3751 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3752 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3753
3754 }
3755
glUniform3fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3756 void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3757 {
3758
3759 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3760 IOStream *stream = ctx->m_stream;
3761 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3762 bool useChecksum = checksumCalculator->getVersion() > 0;
3763
3764 const unsigned int __size_v = (count * 3 * sizeof(GLfloat));
3765 unsigned char *ptr;
3766 unsigned char *buf;
3767 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3768 const size_t checksumSize = checksumCalculator->checksumByteSize();
3769 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3770 buf = stream->alloc(totalSize);
3771 ptr = buf;
3772 int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
3773 memcpy(ptr, &totalSize, 4); ptr += 4;
3774
3775 memcpy(ptr, &location, 4); ptr += 4;
3776 memcpy(ptr, &count, 4); ptr += 4;
3777 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3778 memcpy(ptr, v, __size_v);ptr += __size_v;
3779
3780 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3781 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3782
3783 }
3784
glUniform3i_enc(void * self,GLint location,GLint x,GLint y,GLint z)3785 void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
3786 {
3787
3788 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3789 IOStream *stream = ctx->m_stream;
3790 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3791 bool useChecksum = checksumCalculator->getVersion() > 0;
3792
3793 unsigned char *ptr;
3794 unsigned char *buf;
3795 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3796 const size_t checksumSize = checksumCalculator->checksumByteSize();
3797 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3798 buf = stream->alloc(totalSize);
3799 ptr = buf;
3800 int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
3801 memcpy(ptr, &totalSize, 4); ptr += 4;
3802
3803 memcpy(ptr, &location, 4); ptr += 4;
3804 memcpy(ptr, &x, 4); ptr += 4;
3805 memcpy(ptr, &y, 4); ptr += 4;
3806 memcpy(ptr, &z, 4); ptr += 4;
3807
3808 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3809 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3810
3811 }
3812
glUniform3iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3813 void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3814 {
3815
3816 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3817 IOStream *stream = ctx->m_stream;
3818 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3819 bool useChecksum = checksumCalculator->getVersion() > 0;
3820
3821 const unsigned int __size_v = (3 * count * sizeof(GLint));
3822 unsigned char *ptr;
3823 unsigned char *buf;
3824 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3825 const size_t checksumSize = checksumCalculator->checksumByteSize();
3826 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3827 buf = stream->alloc(totalSize);
3828 ptr = buf;
3829 int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
3830 memcpy(ptr, &totalSize, 4); ptr += 4;
3831
3832 memcpy(ptr, &location, 4); ptr += 4;
3833 memcpy(ptr, &count, 4); ptr += 4;
3834 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3835 memcpy(ptr, v, __size_v);ptr += __size_v;
3836
3837 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3838 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3839
3840 }
3841
glUniform4f_enc(void * self,GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)3842 void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3843 {
3844
3845 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3846 IOStream *stream = ctx->m_stream;
3847 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3848 bool useChecksum = checksumCalculator->getVersion() > 0;
3849
3850 unsigned char *ptr;
3851 unsigned char *buf;
3852 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3853 const size_t checksumSize = checksumCalculator->checksumByteSize();
3854 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3855 buf = stream->alloc(totalSize);
3856 ptr = buf;
3857 int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
3858 memcpy(ptr, &totalSize, 4); ptr += 4;
3859
3860 memcpy(ptr, &location, 4); ptr += 4;
3861 memcpy(ptr, &x, 4); ptr += 4;
3862 memcpy(ptr, &y, 4); ptr += 4;
3863 memcpy(ptr, &z, 4); ptr += 4;
3864 memcpy(ptr, &w, 4); ptr += 4;
3865
3866 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3867 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3868
3869 }
3870
glUniform4fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3871 void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3872 {
3873
3874 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3875 IOStream *stream = ctx->m_stream;
3876 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3877 bool useChecksum = checksumCalculator->getVersion() > 0;
3878
3879 const unsigned int __size_v = (4 * count * sizeof(GLfloat));
3880 unsigned char *ptr;
3881 unsigned char *buf;
3882 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3883 const size_t checksumSize = checksumCalculator->checksumByteSize();
3884 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3885 buf = stream->alloc(totalSize);
3886 ptr = buf;
3887 int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
3888 memcpy(ptr, &totalSize, 4); ptr += 4;
3889
3890 memcpy(ptr, &location, 4); ptr += 4;
3891 memcpy(ptr, &count, 4); ptr += 4;
3892 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3893 memcpy(ptr, v, __size_v);ptr += __size_v;
3894
3895 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3896 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3897
3898 }
3899
glUniform4i_enc(void * self,GLint location,GLint x,GLint y,GLint z,GLint w)3900 void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
3901 {
3902
3903 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3904 IOStream *stream = ctx->m_stream;
3905 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3906 bool useChecksum = checksumCalculator->getVersion() > 0;
3907
3908 unsigned char *ptr;
3909 unsigned char *buf;
3910 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3911 const size_t checksumSize = checksumCalculator->checksumByteSize();
3912 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3913 buf = stream->alloc(totalSize);
3914 ptr = buf;
3915 int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
3916 memcpy(ptr, &totalSize, 4); ptr += 4;
3917
3918 memcpy(ptr, &location, 4); ptr += 4;
3919 memcpy(ptr, &x, 4); ptr += 4;
3920 memcpy(ptr, &y, 4); ptr += 4;
3921 memcpy(ptr, &z, 4); ptr += 4;
3922 memcpy(ptr, &w, 4); ptr += 4;
3923
3924 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3925 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3926
3927 }
3928
glUniform4iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3929 void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3930 {
3931
3932 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3933 IOStream *stream = ctx->m_stream;
3934 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3935 bool useChecksum = checksumCalculator->getVersion() > 0;
3936
3937 const unsigned int __size_v = (4 * count * sizeof(GLint));
3938 unsigned char *ptr;
3939 unsigned char *buf;
3940 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3941 const size_t checksumSize = checksumCalculator->checksumByteSize();
3942 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3943 buf = stream->alloc(totalSize);
3944 ptr = buf;
3945 int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
3946 memcpy(ptr, &totalSize, 4); ptr += 4;
3947
3948 memcpy(ptr, &location, 4); ptr += 4;
3949 memcpy(ptr, &count, 4); ptr += 4;
3950 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3951 memcpy(ptr, v, __size_v);ptr += __size_v;
3952
3953 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3954 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3955
3956 }
3957
glUniformMatrix2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3958 void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3959 {
3960
3961 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3962 IOStream *stream = ctx->m_stream;
3963 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3964 bool useChecksum = checksumCalculator->getVersion() > 0;
3965
3966 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
3967 unsigned char *ptr;
3968 unsigned char *buf;
3969 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
3970 const size_t checksumSize = checksumCalculator->checksumByteSize();
3971 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3972 buf = stream->alloc(totalSize);
3973 ptr = buf;
3974 int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
3975 memcpy(ptr, &totalSize, 4); ptr += 4;
3976
3977 memcpy(ptr, &location, 4); ptr += 4;
3978 memcpy(ptr, &count, 4); ptr += 4;
3979 memcpy(ptr, &transpose, 1); ptr += 1;
3980 *(unsigned int *)(ptr) = __size_value; ptr += 4;
3981 memcpy(ptr, value, __size_value);ptr += __size_value;
3982
3983 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3984 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3985
3986 }
3987
glUniformMatrix3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3988 void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3989 {
3990
3991 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3992 IOStream *stream = ctx->m_stream;
3993 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3994 bool useChecksum = checksumCalculator->getVersion() > 0;
3995
3996 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
3997 unsigned char *ptr;
3998 unsigned char *buf;
3999 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4000 const size_t checksumSize = checksumCalculator->checksumByteSize();
4001 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4002 buf = stream->alloc(totalSize);
4003 ptr = buf;
4004 int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
4005 memcpy(ptr, &totalSize, 4); ptr += 4;
4006
4007 memcpy(ptr, &location, 4); ptr += 4;
4008 memcpy(ptr, &count, 4); ptr += 4;
4009 memcpy(ptr, &transpose, 1); ptr += 1;
4010 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4011 memcpy(ptr, value, __size_value);ptr += __size_value;
4012
4013 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4014 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4015
4016 }
4017
glUniformMatrix4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)4018 void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
4019 {
4020
4021 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4022 IOStream *stream = ctx->m_stream;
4023 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4024 bool useChecksum = checksumCalculator->getVersion() > 0;
4025
4026 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
4027 unsigned char *ptr;
4028 unsigned char *buf;
4029 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4030 const size_t checksumSize = checksumCalculator->checksumByteSize();
4031 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4032 buf = stream->alloc(totalSize);
4033 ptr = buf;
4034 int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
4035 memcpy(ptr, &totalSize, 4); ptr += 4;
4036
4037 memcpy(ptr, &location, 4); ptr += 4;
4038 memcpy(ptr, &count, 4); ptr += 4;
4039 memcpy(ptr, &transpose, 1); ptr += 1;
4040 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4041 memcpy(ptr, value, __size_value);ptr += __size_value;
4042
4043 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4044 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4045
4046 }
4047
glUseProgram_enc(void * self,GLuint program)4048 void glUseProgram_enc(void *self , GLuint program)
4049 {
4050
4051 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4052 IOStream *stream = ctx->m_stream;
4053 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4054 bool useChecksum = checksumCalculator->getVersion() > 0;
4055
4056 unsigned char *ptr;
4057 unsigned char *buf;
4058 const size_t sizeWithoutChecksum = 8 + 4;
4059 const size_t checksumSize = checksumCalculator->checksumByteSize();
4060 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4061 buf = stream->alloc(totalSize);
4062 ptr = buf;
4063 int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
4064 memcpy(ptr, &totalSize, 4); ptr += 4;
4065
4066 memcpy(ptr, &program, 4); ptr += 4;
4067
4068 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4069 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4070
4071 }
4072
glValidateProgram_enc(void * self,GLuint program)4073 void glValidateProgram_enc(void *self , GLuint program)
4074 {
4075
4076 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4077 IOStream *stream = ctx->m_stream;
4078 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4079 bool useChecksum = checksumCalculator->getVersion() > 0;
4080
4081 unsigned char *ptr;
4082 unsigned char *buf;
4083 const size_t sizeWithoutChecksum = 8 + 4;
4084 const size_t checksumSize = checksumCalculator->checksumByteSize();
4085 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4086 buf = stream->alloc(totalSize);
4087 ptr = buf;
4088 int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
4089 memcpy(ptr, &totalSize, 4); ptr += 4;
4090
4091 memcpy(ptr, &program, 4); ptr += 4;
4092
4093 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4094 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4095
4096 }
4097
glVertexAttrib1f_enc(void * self,GLuint indx,GLfloat x)4098 void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
4099 {
4100
4101 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4102 IOStream *stream = ctx->m_stream;
4103 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4104 bool useChecksum = checksumCalculator->getVersion() > 0;
4105
4106 unsigned char *ptr;
4107 unsigned char *buf;
4108 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4109 const size_t checksumSize = checksumCalculator->checksumByteSize();
4110 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4111 buf = stream->alloc(totalSize);
4112 ptr = buf;
4113 int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
4114 memcpy(ptr, &totalSize, 4); ptr += 4;
4115
4116 memcpy(ptr, &indx, 4); ptr += 4;
4117 memcpy(ptr, &x, 4); ptr += 4;
4118
4119 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4120 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4121
4122 }
4123
glVertexAttrib1fv_enc(void * self,GLuint indx,const GLfloat * values)4124 void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
4125 {
4126
4127 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4128 IOStream *stream = ctx->m_stream;
4129 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4130 bool useChecksum = checksumCalculator->getVersion() > 0;
4131
4132 const unsigned int __size_values = (sizeof(GLfloat));
4133 unsigned char *ptr;
4134 unsigned char *buf;
4135 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4136 const size_t checksumSize = checksumCalculator->checksumByteSize();
4137 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4138 buf = stream->alloc(totalSize);
4139 ptr = buf;
4140 int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
4141 memcpy(ptr, &totalSize, 4); ptr += 4;
4142
4143 memcpy(ptr, &indx, 4); ptr += 4;
4144 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4145 memcpy(ptr, values, __size_values);ptr += __size_values;
4146
4147 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4148 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4149
4150 }
4151
glVertexAttrib2f_enc(void * self,GLuint indx,GLfloat x,GLfloat y)4152 void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
4153 {
4154
4155 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4156 IOStream *stream = ctx->m_stream;
4157 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4158 bool useChecksum = checksumCalculator->getVersion() > 0;
4159
4160 unsigned char *ptr;
4161 unsigned char *buf;
4162 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4163 const size_t checksumSize = checksumCalculator->checksumByteSize();
4164 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4165 buf = stream->alloc(totalSize);
4166 ptr = buf;
4167 int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
4168 memcpy(ptr, &totalSize, 4); ptr += 4;
4169
4170 memcpy(ptr, &indx, 4); ptr += 4;
4171 memcpy(ptr, &x, 4); ptr += 4;
4172 memcpy(ptr, &y, 4); ptr += 4;
4173
4174 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4175 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4176
4177 }
4178
glVertexAttrib2fv_enc(void * self,GLuint indx,const GLfloat * values)4179 void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
4180 {
4181
4182 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4183 IOStream *stream = ctx->m_stream;
4184 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4185 bool useChecksum = checksumCalculator->getVersion() > 0;
4186
4187 const unsigned int __size_values = (2 * sizeof(GLfloat));
4188 unsigned char *ptr;
4189 unsigned char *buf;
4190 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4191 const size_t checksumSize = checksumCalculator->checksumByteSize();
4192 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4193 buf = stream->alloc(totalSize);
4194 ptr = buf;
4195 int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
4196 memcpy(ptr, &totalSize, 4); ptr += 4;
4197
4198 memcpy(ptr, &indx, 4); ptr += 4;
4199 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4200 memcpy(ptr, values, __size_values);ptr += __size_values;
4201
4202 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4203 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4204
4205 }
4206
glVertexAttrib3f_enc(void * self,GLuint indx,GLfloat x,GLfloat y,GLfloat z)4207 void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
4208 {
4209
4210 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4211 IOStream *stream = ctx->m_stream;
4212 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4213 bool useChecksum = checksumCalculator->getVersion() > 0;
4214
4215 unsigned char *ptr;
4216 unsigned char *buf;
4217 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4218 const size_t checksumSize = checksumCalculator->checksumByteSize();
4219 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4220 buf = stream->alloc(totalSize);
4221 ptr = buf;
4222 int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
4223 memcpy(ptr, &totalSize, 4); ptr += 4;
4224
4225 memcpy(ptr, &indx, 4); ptr += 4;
4226 memcpy(ptr, &x, 4); ptr += 4;
4227 memcpy(ptr, &y, 4); ptr += 4;
4228 memcpy(ptr, &z, 4); ptr += 4;
4229
4230 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4231 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4232
4233 }
4234
glVertexAttrib3fv_enc(void * self,GLuint indx,const GLfloat * values)4235 void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
4236 {
4237
4238 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4239 IOStream *stream = ctx->m_stream;
4240 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4241 bool useChecksum = checksumCalculator->getVersion() > 0;
4242
4243 const unsigned int __size_values = (3 * sizeof(GLfloat));
4244 unsigned char *ptr;
4245 unsigned char *buf;
4246 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4247 const size_t checksumSize = checksumCalculator->checksumByteSize();
4248 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4249 buf = stream->alloc(totalSize);
4250 ptr = buf;
4251 int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
4252 memcpy(ptr, &totalSize, 4); ptr += 4;
4253
4254 memcpy(ptr, &indx, 4); ptr += 4;
4255 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4256 memcpy(ptr, values, __size_values);ptr += __size_values;
4257
4258 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4259 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4260
4261 }
4262
glVertexAttrib4f_enc(void * self,GLuint indx,GLfloat x,GLfloat y,GLfloat z,GLfloat w)4263 void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4264 {
4265
4266 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4267 IOStream *stream = ctx->m_stream;
4268 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4269 bool useChecksum = checksumCalculator->getVersion() > 0;
4270
4271 unsigned char *ptr;
4272 unsigned char *buf;
4273 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4274 const size_t checksumSize = checksumCalculator->checksumByteSize();
4275 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4276 buf = stream->alloc(totalSize);
4277 ptr = buf;
4278 int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
4279 memcpy(ptr, &totalSize, 4); ptr += 4;
4280
4281 memcpy(ptr, &indx, 4); ptr += 4;
4282 memcpy(ptr, &x, 4); ptr += 4;
4283 memcpy(ptr, &y, 4); ptr += 4;
4284 memcpy(ptr, &z, 4); ptr += 4;
4285 memcpy(ptr, &w, 4); ptr += 4;
4286
4287 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4288 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4289
4290 }
4291
glVertexAttrib4fv_enc(void * self,GLuint indx,const GLfloat * values)4292 void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
4293 {
4294
4295 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4296 IOStream *stream = ctx->m_stream;
4297 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4298 bool useChecksum = checksumCalculator->getVersion() > 0;
4299
4300 const unsigned int __size_values = (4 * sizeof(GLfloat));
4301 unsigned char *ptr;
4302 unsigned char *buf;
4303 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4304 const size_t checksumSize = checksumCalculator->checksumByteSize();
4305 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4306 buf = stream->alloc(totalSize);
4307 ptr = buf;
4308 int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
4309 memcpy(ptr, &totalSize, 4); ptr += 4;
4310
4311 memcpy(ptr, &indx, 4); ptr += 4;
4312 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4313 memcpy(ptr, values, __size_values);ptr += __size_values;
4314
4315 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4316 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4317
4318 }
4319
glViewport_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)4320 void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
4321 {
4322
4323 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4324 IOStream *stream = ctx->m_stream;
4325 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4326 bool useChecksum = checksumCalculator->getVersion() > 0;
4327
4328 unsigned char *ptr;
4329 unsigned char *buf;
4330 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4331 const size_t checksumSize = checksumCalculator->checksumByteSize();
4332 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4333 buf = stream->alloc(totalSize);
4334 ptr = buf;
4335 int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
4336 memcpy(ptr, &totalSize, 4); ptr += 4;
4337
4338 memcpy(ptr, &x, 4); ptr += 4;
4339 memcpy(ptr, &y, 4); ptr += 4;
4340 memcpy(ptr, &width, 4); ptr += 4;
4341 memcpy(ptr, &height, 4); ptr += 4;
4342
4343 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4344 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4345
4346 }
4347
glEGLImageTargetTexture2DOES_enc(void * self,GLenum target,GLeglImageOES image)4348 void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
4349 {
4350
4351 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4352 IOStream *stream = ctx->m_stream;
4353 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4354 bool useChecksum = checksumCalculator->getVersion() > 0;
4355
4356 unsigned char *ptr;
4357 unsigned char *buf;
4358 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4359 const size_t checksumSize = checksumCalculator->checksumByteSize();
4360 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4361 buf = stream->alloc(totalSize);
4362 ptr = buf;
4363 int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4364 memcpy(ptr, &totalSize, 4); ptr += 4;
4365
4366 memcpy(ptr, &target, 4); ptr += 4;
4367 memcpy(ptr, &image, 4); ptr += 4;
4368
4369 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4370 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4371
4372 }
4373
glEGLImageTargetRenderbufferStorageOES_enc(void * self,GLenum target,GLeglImageOES image)4374 void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
4375 {
4376
4377 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4378 IOStream *stream = ctx->m_stream;
4379 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4380 bool useChecksum = checksumCalculator->getVersion() > 0;
4381
4382 unsigned char *ptr;
4383 unsigned char *buf;
4384 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4385 const size_t checksumSize = checksumCalculator->checksumByteSize();
4386 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4387 buf = stream->alloc(totalSize);
4388 ptr = buf;
4389 int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
4390 memcpy(ptr, &totalSize, 4); ptr += 4;
4391
4392 memcpy(ptr, &target, 4); ptr += 4;
4393 memcpy(ptr, &image, 4); ptr += 4;
4394
4395 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4396 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4397
4398 }
4399
glUnmapBufferOES_enc(void * self,GLenum target)4400 GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
4401 {
4402
4403 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4404 IOStream *stream = ctx->m_stream;
4405 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4406 bool useChecksum = checksumCalculator->getVersion() > 0;
4407
4408 unsigned char *ptr;
4409 unsigned char *buf;
4410 const size_t sizeWithoutChecksum = 8 + 4;
4411 const size_t checksumSize = checksumCalculator->checksumByteSize();
4412 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4413 buf = stream->alloc(totalSize);
4414 ptr = buf;
4415 int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
4416 memcpy(ptr, &totalSize, 4); ptr += 4;
4417
4418 memcpy(ptr, &target, 4); ptr += 4;
4419
4420 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4421 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4422
4423
4424 GLboolean retval;
4425 stream->readback(&retval, 1);
4426 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4427 if (useChecksum) {
4428 unsigned char *checksumBufPtr = NULL;
4429 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4430 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4431 stream->readback(checksumBufPtr, checksumSize);
4432 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4433 ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
4434 abort();
4435 }
4436 }
4437 return retval;
4438 }
4439
glTexImage3DOES_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * pixels)4440 void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
4441 {
4442
4443 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4444 IOStream *stream = ctx->m_stream;
4445 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4446 bool useChecksum = checksumCalculator->getVersion() > 0;
4447
4448 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
4449 unsigned char *ptr;
4450 unsigned char *buf;
4451 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4452 const size_t checksumSize = checksumCalculator->checksumByteSize();
4453 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4454 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4455 ptr = buf;
4456 int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4457 memcpy(ptr, &totalSize, 4); ptr += 4;
4458
4459 memcpy(ptr, &target, 4); ptr += 4;
4460 memcpy(ptr, &level, 4); ptr += 4;
4461 memcpy(ptr, &internalformat, 4); ptr += 4;
4462 memcpy(ptr, &width, 4); ptr += 4;
4463 memcpy(ptr, &height, 4); ptr += 4;
4464 memcpy(ptr, &depth, 4); ptr += 4;
4465 memcpy(ptr, &border, 4); ptr += 4;
4466 memcpy(ptr, &format, 4); ptr += 4;
4467 memcpy(ptr, &type, 4); ptr += 4;
4468
4469 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4470 stream->flush();
4471 stream->writeFully(&__size_pixels,4);
4472 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
4473 if (pixels != NULL) {
4474 stream->writeFully(pixels, __size_pixels);
4475 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
4476 }
4477 buf = stream->alloc(checksumSize);
4478 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4479
4480 }
4481
glTexSubImage3DOES_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * pixels)4482 void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
4483 {
4484
4485 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4486 IOStream *stream = ctx->m_stream;
4487 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4488 bool useChecksum = checksumCalculator->getVersion() > 0;
4489
4490 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
4491 unsigned char *ptr;
4492 unsigned char *buf;
4493 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4494 const size_t checksumSize = checksumCalculator->checksumByteSize();
4495 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4496 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4497 ptr = buf;
4498 int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4499 memcpy(ptr, &totalSize, 4); ptr += 4;
4500
4501 memcpy(ptr, &target, 4); ptr += 4;
4502 memcpy(ptr, &level, 4); ptr += 4;
4503 memcpy(ptr, &xoffset, 4); ptr += 4;
4504 memcpy(ptr, &yoffset, 4); ptr += 4;
4505 memcpy(ptr, &zoffset, 4); ptr += 4;
4506 memcpy(ptr, &width, 4); ptr += 4;
4507 memcpy(ptr, &height, 4); ptr += 4;
4508 memcpy(ptr, &depth, 4); ptr += 4;
4509 memcpy(ptr, &format, 4); ptr += 4;
4510 memcpy(ptr, &type, 4); ptr += 4;
4511
4512 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4513 stream->flush();
4514 stream->writeFully(&__size_pixels,4);
4515 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
4516 if (pixels != NULL) {
4517 stream->writeFully(pixels, __size_pixels);
4518 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
4519 }
4520 buf = stream->alloc(checksumSize);
4521 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4522
4523 }
4524
glCopyTexSubImage3DOES_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)4525 void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
4526 {
4527
4528 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4529 IOStream *stream = ctx->m_stream;
4530 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4531 bool useChecksum = checksumCalculator->getVersion() > 0;
4532
4533 unsigned char *ptr;
4534 unsigned char *buf;
4535 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
4536 const size_t checksumSize = checksumCalculator->checksumByteSize();
4537 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4538 buf = stream->alloc(totalSize);
4539 ptr = buf;
4540 int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4541 memcpy(ptr, &totalSize, 4); ptr += 4;
4542
4543 memcpy(ptr, &target, 4); ptr += 4;
4544 memcpy(ptr, &level, 4); ptr += 4;
4545 memcpy(ptr, &xoffset, 4); ptr += 4;
4546 memcpy(ptr, &yoffset, 4); ptr += 4;
4547 memcpy(ptr, &zoffset, 4); ptr += 4;
4548 memcpy(ptr, &x, 4); ptr += 4;
4549 memcpy(ptr, &y, 4); ptr += 4;
4550 memcpy(ptr, &width, 4); ptr += 4;
4551 memcpy(ptr, &height, 4); ptr += 4;
4552
4553 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4554 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4555
4556 }
4557
glCompressedTexImage3DOES_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)4558 void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
4559 {
4560
4561 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4562 IOStream *stream = ctx->m_stream;
4563 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4564 bool useChecksum = checksumCalculator->getVersion() > 0;
4565
4566 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
4567 unsigned char *ptr;
4568 unsigned char *buf;
4569 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4570 const size_t checksumSize = checksumCalculator->checksumByteSize();
4571 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4572 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4573 ptr = buf;
4574 int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4575 memcpy(ptr, &totalSize, 4); ptr += 4;
4576
4577 memcpy(ptr, &target, 4); ptr += 4;
4578 memcpy(ptr, &level, 4); ptr += 4;
4579 memcpy(ptr, &internalformat, 4); ptr += 4;
4580 memcpy(ptr, &width, 4); ptr += 4;
4581 memcpy(ptr, &height, 4); ptr += 4;
4582 memcpy(ptr, &depth, 4); ptr += 4;
4583 memcpy(ptr, &border, 4); ptr += 4;
4584 memcpy(ptr, &imageSize, 4); ptr += 4;
4585
4586 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4587 stream->flush();
4588 stream->writeFully(&__size_data,4);
4589 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
4590 if (data != NULL) {
4591 stream->writeFully(data, __size_data);
4592 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
4593 }
4594 buf = stream->alloc(checksumSize);
4595 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4596
4597 }
4598
glCompressedTexSubImage3DOES_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)4599 void glCompressedTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
4600 {
4601
4602 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4603 IOStream *stream = ctx->m_stream;
4604 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4605 bool useChecksum = checksumCalculator->getVersion() > 0;
4606
4607 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
4608 unsigned char *ptr;
4609 unsigned char *buf;
4610 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4611 const size_t checksumSize = checksumCalculator->checksumByteSize();
4612 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4613 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4614 ptr = buf;
4615 int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4616 memcpy(ptr, &totalSize, 4); ptr += 4;
4617
4618 memcpy(ptr, &target, 4); ptr += 4;
4619 memcpy(ptr, &level, 4); ptr += 4;
4620 memcpy(ptr, &xoffset, 4); ptr += 4;
4621 memcpy(ptr, &yoffset, 4); ptr += 4;
4622 memcpy(ptr, &zoffset, 4); ptr += 4;
4623 memcpy(ptr, &width, 4); ptr += 4;
4624 memcpy(ptr, &height, 4); ptr += 4;
4625 memcpy(ptr, &depth, 4); ptr += 4;
4626 memcpy(ptr, &format, 4); ptr += 4;
4627 memcpy(ptr, &imageSize, 4); ptr += 4;
4628
4629 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4630 stream->flush();
4631 stream->writeFully(&__size_data,4);
4632 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
4633 if (data != NULL) {
4634 stream->writeFully(data, __size_data);
4635 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
4636 }
4637 buf = stream->alloc(checksumSize);
4638 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4639
4640 }
4641
glFramebufferTexture3DOES_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLint zoffset)4642 void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
4643 {
4644
4645 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4646 IOStream *stream = ctx->m_stream;
4647 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4648 bool useChecksum = checksumCalculator->getVersion() > 0;
4649
4650 unsigned char *ptr;
4651 unsigned char *buf;
4652 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
4653 const size_t checksumSize = checksumCalculator->checksumByteSize();
4654 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4655 buf = stream->alloc(totalSize);
4656 ptr = buf;
4657 int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4658 memcpy(ptr, &totalSize, 4); ptr += 4;
4659
4660 memcpy(ptr, &target, 4); ptr += 4;
4661 memcpy(ptr, &attachment, 4); ptr += 4;
4662 memcpy(ptr, &textarget, 4); ptr += 4;
4663 memcpy(ptr, &texture, 4); ptr += 4;
4664 memcpy(ptr, &level, 4); ptr += 4;
4665 memcpy(ptr, &zoffset, 4); ptr += 4;
4666
4667 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4668 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4669
4670 }
4671
glBindVertexArrayOES_enc(void * self,GLuint array)4672 void glBindVertexArrayOES_enc(void *self , GLuint array)
4673 {
4674
4675 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4676 IOStream *stream = ctx->m_stream;
4677 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4678 bool useChecksum = checksumCalculator->getVersion() > 0;
4679
4680 unsigned char *ptr;
4681 unsigned char *buf;
4682 const size_t sizeWithoutChecksum = 8 + 4;
4683 const size_t checksumSize = checksumCalculator->checksumByteSize();
4684 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4685 buf = stream->alloc(totalSize);
4686 ptr = buf;
4687 int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
4688 memcpy(ptr, &totalSize, 4); ptr += 4;
4689
4690 memcpy(ptr, &array, 4); ptr += 4;
4691
4692 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4693 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4694
4695 }
4696
glDeleteVertexArraysOES_enc(void * self,GLsizei n,const GLuint * arrays)4697 void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
4698 {
4699
4700 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4701 IOStream *stream = ctx->m_stream;
4702 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4703 bool useChecksum = checksumCalculator->getVersion() > 0;
4704
4705 const unsigned int __size_arrays = (n * sizeof(GLuint));
4706 unsigned char *ptr;
4707 unsigned char *buf;
4708 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
4709 const size_t checksumSize = checksumCalculator->checksumByteSize();
4710 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4711 buf = stream->alloc(totalSize);
4712 ptr = buf;
4713 int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
4714 memcpy(ptr, &totalSize, 4); ptr += 4;
4715
4716 memcpy(ptr, &n, 4); ptr += 4;
4717 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4718 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
4719
4720 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4721 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4722
4723 }
4724
glGenVertexArraysOES_enc(void * self,GLsizei n,GLuint * arrays)4725 void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
4726 {
4727
4728 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4729 IOStream *stream = ctx->m_stream;
4730 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4731 bool useChecksum = checksumCalculator->getVersion() > 0;
4732
4733 const unsigned int __size_arrays = (n * sizeof(GLuint));
4734 unsigned char *ptr;
4735 unsigned char *buf;
4736 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
4737 const size_t checksumSize = checksumCalculator->checksumByteSize();
4738 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4739 buf = stream->alloc(totalSize);
4740 ptr = buf;
4741 int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
4742 memcpy(ptr, &totalSize, 4); ptr += 4;
4743
4744 memcpy(ptr, &n, 4); ptr += 4;
4745 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4746
4747 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4748 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4749
4750 stream->readback(arrays, __size_arrays);
4751 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
4752 if (useChecksum) {
4753 unsigned char *checksumBufPtr = NULL;
4754 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4755 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4756 stream->readback(checksumBufPtr, checksumSize);
4757 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4758 ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
4759 abort();
4760 }
4761 }
4762 }
4763
glIsVertexArrayOES_enc(void * self,GLuint array)4764 GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
4765 {
4766
4767 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4768 IOStream *stream = ctx->m_stream;
4769 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4770 bool useChecksum = checksumCalculator->getVersion() > 0;
4771
4772 unsigned char *ptr;
4773 unsigned char *buf;
4774 const size_t sizeWithoutChecksum = 8 + 4;
4775 const size_t checksumSize = checksumCalculator->checksumByteSize();
4776 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4777 buf = stream->alloc(totalSize);
4778 ptr = buf;
4779 int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
4780 memcpy(ptr, &totalSize, 4); ptr += 4;
4781
4782 memcpy(ptr, &array, 4); ptr += 4;
4783
4784 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4785 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4786
4787
4788 GLboolean retval;
4789 stream->readback(&retval, 1);
4790 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4791 if (useChecksum) {
4792 unsigned char *checksumBufPtr = NULL;
4793 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4794 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4795 stream->readback(checksumBufPtr, checksumSize);
4796 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4797 ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
4798 abort();
4799 }
4800 }
4801 return retval;
4802 }
4803
glDiscardFramebufferEXT_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments)4804 void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
4805 {
4806
4807 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4808 IOStream *stream = ctx->m_stream;
4809 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4810 bool useChecksum = checksumCalculator->getVersion() > 0;
4811
4812 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
4813 unsigned char *ptr;
4814 unsigned char *buf;
4815 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
4816 const size_t checksumSize = checksumCalculator->checksumByteSize();
4817 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4818 buf = stream->alloc(totalSize);
4819 ptr = buf;
4820 int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
4821 memcpy(ptr, &totalSize, 4); ptr += 4;
4822
4823 memcpy(ptr, &target, 4); ptr += 4;
4824 memcpy(ptr, &numAttachments, 4); ptr += 4;
4825 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
4826 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
4827
4828 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4829 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4830
4831 }
4832
glVertexAttribPointerData_enc(void * self,GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,void * data,GLuint datalen)4833 void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
4834 {
4835
4836 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4837 IOStream *stream = ctx->m_stream;
4838 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4839 bool useChecksum = checksumCalculator->getVersion() > 0;
4840
4841 const unsigned int __size_data = datalen;
4842 unsigned char *ptr;
4843 unsigned char *buf;
4844 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
4845 const size_t checksumSize = checksumCalculator->checksumByteSize();
4846 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4847 buf = stream->alloc(totalSize);
4848 ptr = buf;
4849 int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4850 memcpy(ptr, &totalSize, 4); ptr += 4;
4851
4852 memcpy(ptr, &indx, 4); ptr += 4;
4853 memcpy(ptr, &size, 4); ptr += 4;
4854 memcpy(ptr, &type, 4); ptr += 4;
4855 memcpy(ptr, &normalized, 1); ptr += 1;
4856 memcpy(ptr, &stride, 4); ptr += 4;
4857 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4858 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4859 memcpy(ptr, &datalen, 4); ptr += 4;
4860
4861 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4862 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4863
4864 }
4865
glVertexAttribPointerOffset_enc(void * self,GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,GLuint offset)4866 void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
4867 {
4868
4869 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4870 IOStream *stream = ctx->m_stream;
4871 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4872 bool useChecksum = checksumCalculator->getVersion() > 0;
4873
4874 unsigned char *ptr;
4875 unsigned char *buf;
4876 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4;
4877 const size_t checksumSize = checksumCalculator->checksumByteSize();
4878 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4879 buf = stream->alloc(totalSize);
4880 ptr = buf;
4881 int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4882 memcpy(ptr, &totalSize, 4); ptr += 4;
4883
4884 memcpy(ptr, &indx, 4); ptr += 4;
4885 memcpy(ptr, &size, 4); ptr += 4;
4886 memcpy(ptr, &type, 4); ptr += 4;
4887 memcpy(ptr, &normalized, 1); ptr += 1;
4888 memcpy(ptr, &stride, 4); ptr += 4;
4889 memcpy(ptr, &offset, 4); ptr += 4;
4890
4891 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4892 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4893
4894 }
4895
glDrawElementsOffset_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset)4896 void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
4897 {
4898
4899 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4900 IOStream *stream = ctx->m_stream;
4901 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4902 bool useChecksum = checksumCalculator->getVersion() > 0;
4903
4904 unsigned char *ptr;
4905 unsigned char *buf;
4906 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4907 const size_t checksumSize = checksumCalculator->checksumByteSize();
4908 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4909 buf = stream->alloc(totalSize);
4910 ptr = buf;
4911 int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4912 memcpy(ptr, &totalSize, 4); ptr += 4;
4913
4914 memcpy(ptr, &mode, 4); ptr += 4;
4915 memcpy(ptr, &count, 4); ptr += 4;
4916 memcpy(ptr, &type, 4); ptr += 4;
4917 memcpy(ptr, &offset, 4); ptr += 4;
4918
4919 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4920 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4921
4922 }
4923
glDrawElementsData_enc(void * self,GLenum mode,GLsizei count,GLenum type,void * data,GLuint datalen)4924 void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
4925 {
4926
4927 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4928 IOStream *stream = ctx->m_stream;
4929 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4930 bool useChecksum = checksumCalculator->getVersion() > 0;
4931
4932 const unsigned int __size_data = datalen;
4933 unsigned char *ptr;
4934 unsigned char *buf;
4935 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4936 const size_t checksumSize = checksumCalculator->checksumByteSize();
4937 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4938 buf = stream->alloc(totalSize);
4939 ptr = buf;
4940 int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
4941 memcpy(ptr, &totalSize, 4); ptr += 4;
4942
4943 memcpy(ptr, &mode, 4); ptr += 4;
4944 memcpy(ptr, &count, 4); ptr += 4;
4945 memcpy(ptr, &type, 4); ptr += 4;
4946 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4947 memcpy(ptr, data, __size_data);ptr += __size_data;
4948 memcpy(ptr, &datalen, 4); ptr += 4;
4949
4950 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4951 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4952
4953 }
4954
glGetCompressedTextureFormats_enc(void * self,int count,GLint * formats)4955 void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
4956 {
4957
4958 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4959 IOStream *stream = ctx->m_stream;
4960 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4961 bool useChecksum = checksumCalculator->getVersion() > 0;
4962
4963 const unsigned int __size_formats = (count * sizeof(GLint));
4964 unsigned char *ptr;
4965 unsigned char *buf;
4966 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
4967 const size_t checksumSize = checksumCalculator->checksumByteSize();
4968 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4969 buf = stream->alloc(totalSize);
4970 ptr = buf;
4971 int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
4972 memcpy(ptr, &totalSize, 4); ptr += 4;
4973
4974 memcpy(ptr, &count, 4); ptr += 4;
4975 *(unsigned int *)(ptr) = __size_formats; ptr += 4;
4976
4977 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4978 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4979
4980 stream->readback(formats, __size_formats);
4981 if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4982 if (useChecksum) {
4983 unsigned char *checksumBufPtr = NULL;
4984 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4985 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4986 stream->readback(checksumBufPtr, checksumSize);
4987 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4988 ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4989 abort();
4990 }
4991 }
4992 }
4993
glShaderString_enc(void * self,GLuint shader,const GLchar * string,GLsizei len)4994 void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
4995 {
4996
4997 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4998 IOStream *stream = ctx->m_stream;
4999 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5000 bool useChecksum = checksumCalculator->getVersion() > 0;
5001
5002 const unsigned int __size_string = len;
5003 unsigned char *ptr;
5004 unsigned char *buf;
5005 const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4;
5006 const size_t checksumSize = checksumCalculator->checksumByteSize();
5007 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5008 buf = stream->alloc(totalSize);
5009 ptr = buf;
5010 int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
5011 memcpy(ptr, &totalSize, 4); ptr += 4;
5012
5013 memcpy(ptr, &shader, 4); ptr += 4;
5014 *(unsigned int *)(ptr) = __size_string; ptr += 4;
5015 memcpy(ptr, string, __size_string);ptr += __size_string;
5016 memcpy(ptr, &len, 4); ptr += 4;
5017
5018 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5019 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5020
5021 }
5022
glFinishRoundTrip_enc(void * self)5023 int glFinishRoundTrip_enc(void *self )
5024 {
5025
5026 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5027 IOStream *stream = ctx->m_stream;
5028 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5029 bool useChecksum = checksumCalculator->getVersion() > 0;
5030
5031 unsigned char *ptr;
5032 unsigned char *buf;
5033 const size_t sizeWithoutChecksum = 8;
5034 const size_t checksumSize = checksumCalculator->checksumByteSize();
5035 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5036 buf = stream->alloc(totalSize);
5037 ptr = buf;
5038 int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
5039 memcpy(ptr, &totalSize, 4); ptr += 4;
5040
5041
5042 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5043 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5044
5045
5046 int retval;
5047 stream->readback(&retval, 4);
5048 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5049 if (useChecksum) {
5050 unsigned char *checksumBufPtr = NULL;
5051 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5052 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5053 stream->readback(checksumBufPtr, checksumSize);
5054 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5055 ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
5056 abort();
5057 }
5058 }
5059 return retval;
5060 }
5061
glGenVertexArrays_enc(void * self,GLsizei n,GLuint * arrays)5062 void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays)
5063 {
5064
5065 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5066 IOStream *stream = ctx->m_stream;
5067 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5068 bool useChecksum = checksumCalculator->getVersion() > 0;
5069
5070 const unsigned int __size_arrays = (n * sizeof(GLuint));
5071 unsigned char *ptr;
5072 unsigned char *buf;
5073 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
5074 const size_t checksumSize = checksumCalculator->checksumByteSize();
5075 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5076 buf = stream->alloc(totalSize);
5077 ptr = buf;
5078 int tmp = OP_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5079 memcpy(ptr, &totalSize, 4); ptr += 4;
5080
5081 memcpy(ptr, &n, 4); ptr += 4;
5082 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5083
5084 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5085 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5086
5087 stream->readback(arrays, __size_arrays);
5088 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
5089 if (useChecksum) {
5090 unsigned char *checksumBufPtr = NULL;
5091 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5092 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5093 stream->readback(checksumBufPtr, checksumSize);
5094 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5095 ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n");
5096 abort();
5097 }
5098 }
5099 }
5100
glBindVertexArray_enc(void * self,GLuint array)5101 void glBindVertexArray_enc(void *self , GLuint array)
5102 {
5103
5104 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5105 IOStream *stream = ctx->m_stream;
5106 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5107 bool useChecksum = checksumCalculator->getVersion() > 0;
5108
5109 unsigned char *ptr;
5110 unsigned char *buf;
5111 const size_t sizeWithoutChecksum = 8 + 4;
5112 const size_t checksumSize = checksumCalculator->checksumByteSize();
5113 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5114 buf = stream->alloc(totalSize);
5115 ptr = buf;
5116 int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5117 memcpy(ptr, &totalSize, 4); ptr += 4;
5118
5119 memcpy(ptr, &array, 4); ptr += 4;
5120
5121 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5122 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5123
5124 }
5125
glDeleteVertexArrays_enc(void * self,GLsizei n,const GLuint * arrays)5126 void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays)
5127 {
5128
5129 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5130 IOStream *stream = ctx->m_stream;
5131 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5132 bool useChecksum = checksumCalculator->getVersion() > 0;
5133
5134 const unsigned int __size_arrays = (n * sizeof(GLuint));
5135 unsigned char *ptr;
5136 unsigned char *buf;
5137 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
5138 const size_t checksumSize = checksumCalculator->checksumByteSize();
5139 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5140 buf = stream->alloc(totalSize);
5141 ptr = buf;
5142 int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5143 memcpy(ptr, &totalSize, 4); ptr += 4;
5144
5145 memcpy(ptr, &n, 4); ptr += 4;
5146 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5147 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
5148
5149 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5150 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5151
5152 }
5153
glIsVertexArray_enc(void * self,GLuint array)5154 GLboolean glIsVertexArray_enc(void *self , GLuint array)
5155 {
5156
5157 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5158 IOStream *stream = ctx->m_stream;
5159 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5160 bool useChecksum = checksumCalculator->getVersion() > 0;
5161
5162 unsigned char *ptr;
5163 unsigned char *buf;
5164 const size_t sizeWithoutChecksum = 8 + 4;
5165 const size_t checksumSize = checksumCalculator->checksumByteSize();
5166 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5167 buf = stream->alloc(totalSize);
5168 ptr = buf;
5169 int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5170 memcpy(ptr, &totalSize, 4); ptr += 4;
5171
5172 memcpy(ptr, &array, 4); ptr += 4;
5173
5174 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5175 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5176
5177
5178 GLboolean retval;
5179 stream->readback(&retval, 1);
5180 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
5181 if (useChecksum) {
5182 unsigned char *checksumBufPtr = NULL;
5183 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5184 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5185 stream->readback(checksumBufPtr, checksumSize);
5186 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5187 ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n");
5188 abort();
5189 }
5190 }
5191 return retval;
5192 }
5193
glMapBufferRangeAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * mapped)5194 void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped)
5195 {
5196
5197 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5198 IOStream *stream = ctx->m_stream;
5199 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5200 bool useChecksum = checksumCalculator->getVersion() > 0;
5201
5202 const unsigned int __size_mapped = ((mapped != NULL) ? length : 0);
5203 unsigned char *ptr;
5204 unsigned char *buf;
5205 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
5206 const size_t checksumSize = checksumCalculator->checksumByteSize();
5207 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5208 buf = stream->alloc(totalSize);
5209 ptr = buf;
5210 int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5211 memcpy(ptr, &totalSize, 4); ptr += 4;
5212
5213 memcpy(ptr, &target, 4); ptr += 4;
5214 memcpy(ptr, &offset, 4); ptr += 4;
5215 memcpy(ptr, &length, 4); ptr += 4;
5216 memcpy(ptr, &access, 4); ptr += 4;
5217 *(unsigned int *)(ptr) = __size_mapped; ptr += 4;
5218
5219 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5220 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5221
5222 if (mapped != NULL) {
5223 stream->readback(mapped, __size_mapped);
5224 if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped);
5225 }
5226 if (useChecksum) {
5227 unsigned char *checksumBufPtr = NULL;
5228 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5229 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5230 stream->readback(checksumBufPtr, checksumSize);
5231 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5232 ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n");
5233 abort();
5234 }
5235 }
5236 }
5237
glUnmapBufferAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer,GLboolean * out_res)5238 void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
5239 {
5240
5241 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5242 IOStream *stream = ctx->m_stream;
5243 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5244 bool useChecksum = checksumCalculator->getVersion() > 0;
5245
5246 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5247 const unsigned int __size_out_res = (sizeof(GLboolean));
5248 unsigned char *ptr;
5249 unsigned char *buf;
5250 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4;
5251 const size_t checksumSize = checksumCalculator->checksumByteSize();
5252 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5253 buf = stream->alloc(totalSize);
5254 ptr = buf;
5255 int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5256 memcpy(ptr, &totalSize, 4); ptr += 4;
5257
5258 memcpy(ptr, &target, 4); ptr += 4;
5259 memcpy(ptr, &offset, 4); ptr += 4;
5260 memcpy(ptr, &length, 4); ptr += 4;
5261 memcpy(ptr, &access, 4); ptr += 4;
5262 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5263 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5264 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
5265
5266 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5267 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5268
5269 stream->readback(out_res, __size_out_res);
5270 if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
5271 if (useChecksum) {
5272 unsigned char *checksumBufPtr = NULL;
5273 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5274 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5275 stream->readback(checksumBufPtr, checksumSize);
5276 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5277 ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n");
5278 abort();
5279 }
5280 }
5281 }
5282
glFlushMappedBufferRangeAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer)5283 void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
5284 {
5285
5286 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5287 IOStream *stream = ctx->m_stream;
5288 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5289 bool useChecksum = checksumCalculator->getVersion() > 0;
5290
5291 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5292 unsigned char *ptr;
5293 unsigned char *buf;
5294 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
5295 const size_t checksumSize = checksumCalculator->checksumByteSize();
5296 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5297 buf = stream->alloc(totalSize);
5298 ptr = buf;
5299 int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5300 memcpy(ptr, &totalSize, 4); ptr += 4;
5301
5302 memcpy(ptr, &target, 4); ptr += 4;
5303 memcpy(ptr, &offset, 4); ptr += 4;
5304 memcpy(ptr, &length, 4); ptr += 4;
5305 memcpy(ptr, &access, 4); ptr += 4;
5306 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5307 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5308
5309 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5310 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5311
5312 }
5313
glReadPixelsOffsetAEMU_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLuint offset)5314 void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5315 {
5316
5317 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5318 IOStream *stream = ctx->m_stream;
5319 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5320 bool useChecksum = checksumCalculator->getVersion() > 0;
5321
5322 unsigned char *ptr;
5323 unsigned char *buf;
5324 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5325 const size_t checksumSize = checksumCalculator->checksumByteSize();
5326 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5327 buf = stream->alloc(totalSize);
5328 ptr = buf;
5329 int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5330 memcpy(ptr, &totalSize, 4); ptr += 4;
5331
5332 memcpy(ptr, &x, 4); ptr += 4;
5333 memcpy(ptr, &y, 4); ptr += 4;
5334 memcpy(ptr, &width, 4); ptr += 4;
5335 memcpy(ptr, &height, 4); ptr += 4;
5336 memcpy(ptr, &format, 4); ptr += 4;
5337 memcpy(ptr, &type, 4); ptr += 4;
5338 memcpy(ptr, &offset, 4); ptr += 4;
5339
5340 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5341 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5342
5343 }
5344
glCompressedTexImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,GLuint offset)5345 void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset)
5346 {
5347
5348 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5349 IOStream *stream = ctx->m_stream;
5350 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5351 bool useChecksum = checksumCalculator->getVersion() > 0;
5352
5353 unsigned char *ptr;
5354 unsigned char *buf;
5355 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5356 const size_t checksumSize = checksumCalculator->checksumByteSize();
5357 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5358 buf = stream->alloc(totalSize);
5359 ptr = buf;
5360 int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5361 memcpy(ptr, &totalSize, 4); ptr += 4;
5362
5363 memcpy(ptr, &target, 4); ptr += 4;
5364 memcpy(ptr, &level, 4); ptr += 4;
5365 memcpy(ptr, &internalformat, 4); ptr += 4;
5366 memcpy(ptr, &width, 4); ptr += 4;
5367 memcpy(ptr, &height, 4); ptr += 4;
5368 memcpy(ptr, &border, 4); ptr += 4;
5369 memcpy(ptr, &imageSize, 4); ptr += 4;
5370 memcpy(ptr, &offset, 4); ptr += 4;
5371
5372 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5373 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5374
5375 }
5376
glCompressedTexSubImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,GLuint offset)5377 void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset)
5378 {
5379
5380 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5381 IOStream *stream = ctx->m_stream;
5382 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5383 bool useChecksum = checksumCalculator->getVersion() > 0;
5384
5385 unsigned char *ptr;
5386 unsigned char *buf;
5387 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5388 const size_t checksumSize = checksumCalculator->checksumByteSize();
5389 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5390 buf = stream->alloc(totalSize);
5391 ptr = buf;
5392 int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5393 memcpy(ptr, &totalSize, 4); ptr += 4;
5394
5395 memcpy(ptr, &target, 4); ptr += 4;
5396 memcpy(ptr, &level, 4); ptr += 4;
5397 memcpy(ptr, &xoffset, 4); ptr += 4;
5398 memcpy(ptr, &yoffset, 4); ptr += 4;
5399 memcpy(ptr, &width, 4); ptr += 4;
5400 memcpy(ptr, &height, 4); ptr += 4;
5401 memcpy(ptr, &format, 4); ptr += 4;
5402 memcpy(ptr, &imageSize, 4); ptr += 4;
5403 memcpy(ptr, &offset, 4); ptr += 4;
5404
5405 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5406 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5407
5408 }
5409
glTexImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,GLuint offset)5410 void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset)
5411 {
5412
5413 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5414 IOStream *stream = ctx->m_stream;
5415 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5416 bool useChecksum = checksumCalculator->getVersion() > 0;
5417
5418 unsigned char *ptr;
5419 unsigned char *buf;
5420 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5421 const size_t checksumSize = checksumCalculator->checksumByteSize();
5422 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5423 buf = stream->alloc(totalSize);
5424 ptr = buf;
5425 int tmp = OP_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5426 memcpy(ptr, &totalSize, 4); ptr += 4;
5427
5428 memcpy(ptr, &target, 4); ptr += 4;
5429 memcpy(ptr, &level, 4); ptr += 4;
5430 memcpy(ptr, &internalformat, 4); ptr += 4;
5431 memcpy(ptr, &width, 4); ptr += 4;
5432 memcpy(ptr, &height, 4); ptr += 4;
5433 memcpy(ptr, &border, 4); ptr += 4;
5434 memcpy(ptr, &format, 4); ptr += 4;
5435 memcpy(ptr, &type, 4); ptr += 4;
5436 memcpy(ptr, &offset, 4); ptr += 4;
5437
5438 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5439 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5440
5441 }
5442
glTexSubImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,GLuint offset)5443 void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5444 {
5445
5446 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5447 IOStream *stream = ctx->m_stream;
5448 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5449 bool useChecksum = checksumCalculator->getVersion() > 0;
5450
5451 unsigned char *ptr;
5452 unsigned char *buf;
5453 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5454 const size_t checksumSize = checksumCalculator->checksumByteSize();
5455 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5456 buf = stream->alloc(totalSize);
5457 ptr = buf;
5458 int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5459 memcpy(ptr, &totalSize, 4); ptr += 4;
5460
5461 memcpy(ptr, &target, 4); ptr += 4;
5462 memcpy(ptr, &level, 4); ptr += 4;
5463 memcpy(ptr, &xoffset, 4); ptr += 4;
5464 memcpy(ptr, &yoffset, 4); ptr += 4;
5465 memcpy(ptr, &width, 4); ptr += 4;
5466 memcpy(ptr, &height, 4); ptr += 4;
5467 memcpy(ptr, &format, 4); ptr += 4;
5468 memcpy(ptr, &type, 4); ptr += 4;
5469 memcpy(ptr, &offset, 4); ptr += 4;
5470
5471 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5472 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5473
5474 }
5475
glBindBufferRange_enc(void * self,GLenum target,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)5476 void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5477 {
5478
5479 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5480 IOStream *stream = ctx->m_stream;
5481 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5482 bool useChecksum = checksumCalculator->getVersion() > 0;
5483
5484 unsigned char *ptr;
5485 unsigned char *buf;
5486 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5487 const size_t checksumSize = checksumCalculator->checksumByteSize();
5488 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5489 buf = stream->alloc(totalSize);
5490 ptr = buf;
5491 int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4;
5492 memcpy(ptr, &totalSize, 4); ptr += 4;
5493
5494 memcpy(ptr, &target, 4); ptr += 4;
5495 memcpy(ptr, &index, 4); ptr += 4;
5496 memcpy(ptr, &buffer, 4); ptr += 4;
5497 memcpy(ptr, &offset, 4); ptr += 4;
5498 memcpy(ptr, &size, 4); ptr += 4;
5499
5500 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5501 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5502
5503 }
5504
glBindBufferBase_enc(void * self,GLenum target,GLuint index,GLuint buffer)5505 void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer)
5506 {
5507
5508 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5509 IOStream *stream = ctx->m_stream;
5510 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5511 bool useChecksum = checksumCalculator->getVersion() > 0;
5512
5513 unsigned char *ptr;
5514 unsigned char *buf;
5515 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5516 const size_t checksumSize = checksumCalculator->checksumByteSize();
5517 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5518 buf = stream->alloc(totalSize);
5519 ptr = buf;
5520 int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4;
5521 memcpy(ptr, &totalSize, 4); ptr += 4;
5522
5523 memcpy(ptr, &target, 4); ptr += 4;
5524 memcpy(ptr, &index, 4); ptr += 4;
5525 memcpy(ptr, &buffer, 4); ptr += 4;
5526
5527 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5528 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5529
5530 }
5531
glCopyBufferSubData_enc(void * self,GLenum readtarget,GLenum writetarget,GLintptr readoffset,GLintptr writeoffset,GLsizeiptr size)5532 void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
5533 {
5534
5535 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5536 IOStream *stream = ctx->m_stream;
5537 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5538 bool useChecksum = checksumCalculator->getVersion() > 0;
5539
5540 unsigned char *ptr;
5541 unsigned char *buf;
5542 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5543 const size_t checksumSize = checksumCalculator->checksumByteSize();
5544 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5545 buf = stream->alloc(totalSize);
5546 ptr = buf;
5547 int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
5548 memcpy(ptr, &totalSize, 4); ptr += 4;
5549
5550 memcpy(ptr, &readtarget, 4); ptr += 4;
5551 memcpy(ptr, &writetarget, 4); ptr += 4;
5552 memcpy(ptr, &readoffset, 4); ptr += 4;
5553 memcpy(ptr, &writeoffset, 4); ptr += 4;
5554 memcpy(ptr, &size, 4); ptr += 4;
5555
5556 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5557 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5558
5559 stream->flush();
5560 }
5561
glClearBufferiv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLint * value)5562 void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value)
5563 {
5564
5565 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5566 IOStream *stream = ctx->m_stream;
5567 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5568 bool useChecksum = checksumCalculator->getVersion() > 0;
5569
5570 const unsigned int __size_value = (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer));
5571 unsigned char *ptr;
5572 unsigned char *buf;
5573 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5574 const size_t checksumSize = checksumCalculator->checksumByteSize();
5575 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5576 buf = stream->alloc(totalSize);
5577 ptr = buf;
5578 int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4;
5579 memcpy(ptr, &totalSize, 4); ptr += 4;
5580
5581 memcpy(ptr, &buffer, 4); ptr += 4;
5582 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5583 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5584 memcpy(ptr, value, __size_value);ptr += __size_value;
5585
5586 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5587 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5588
5589 }
5590
glClearBufferuiv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLuint * value)5591 void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value)
5592 {
5593
5594 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5595 IOStream *stream = ctx->m_stream;
5596 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5597 bool useChecksum = checksumCalculator->getVersion() > 0;
5598
5599 const unsigned int __size_value = (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer));
5600 unsigned char *ptr;
5601 unsigned char *buf;
5602 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5603 const size_t checksumSize = checksumCalculator->checksumByteSize();
5604 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5605 buf = stream->alloc(totalSize);
5606 ptr = buf;
5607 int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4;
5608 memcpy(ptr, &totalSize, 4); ptr += 4;
5609
5610 memcpy(ptr, &buffer, 4); ptr += 4;
5611 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5612 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5613 memcpy(ptr, value, __size_value);ptr += __size_value;
5614
5615 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5616 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5617
5618 }
5619
glClearBufferfv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLfloat * value)5620 void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value)
5621 {
5622
5623 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5624 IOStream *stream = ctx->m_stream;
5625 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5626 bool useChecksum = checksumCalculator->getVersion() > 0;
5627
5628 const unsigned int __size_value = (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer));
5629 unsigned char *ptr;
5630 unsigned char *buf;
5631 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5632 const size_t checksumSize = checksumCalculator->checksumByteSize();
5633 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5634 buf = stream->alloc(totalSize);
5635 ptr = buf;
5636 int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4;
5637 memcpy(ptr, &totalSize, 4); ptr += 4;
5638
5639 memcpy(ptr, &buffer, 4); ptr += 4;
5640 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5641 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5642 memcpy(ptr, value, __size_value);ptr += __size_value;
5643
5644 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5645 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5646
5647 }
5648
glClearBufferfi_enc(void * self,GLenum buffer,GLint drawBuffer,GLfloat depth,GLint stencil)5649 void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
5650 {
5651
5652 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5653 IOStream *stream = ctx->m_stream;
5654 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5655 bool useChecksum = checksumCalculator->getVersion() > 0;
5656
5657 unsigned char *ptr;
5658 unsigned char *buf;
5659 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5660 const size_t checksumSize = checksumCalculator->checksumByteSize();
5661 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5662 buf = stream->alloc(totalSize);
5663 ptr = buf;
5664 int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4;
5665 memcpy(ptr, &totalSize, 4); ptr += 4;
5666
5667 memcpy(ptr, &buffer, 4); ptr += 4;
5668 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5669 memcpy(ptr, &depth, 4); ptr += 4;
5670 memcpy(ptr, &stencil, 4); ptr += 4;
5671
5672 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5673 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5674
5675 }
5676
glUniformBlockBinding_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLuint uniformBlockBinding)5677 void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5678 {
5679
5680 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5681 IOStream *stream = ctx->m_stream;
5682 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5683 bool useChecksum = checksumCalculator->getVersion() > 0;
5684
5685 unsigned char *ptr;
5686 unsigned char *buf;
5687 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5688 const size_t checksumSize = checksumCalculator->checksumByteSize();
5689 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5690 buf = stream->alloc(totalSize);
5691 ptr = buf;
5692 int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4;
5693 memcpy(ptr, &totalSize, 4); ptr += 4;
5694
5695 memcpy(ptr, &program, 4); ptr += 4;
5696 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5697 memcpy(ptr, &uniformBlockBinding, 4); ptr += 4;
5698
5699 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5700 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5701
5702 }
5703
glGetUniformBlockIndex_enc(void * self,GLuint program,const GLchar * uniformBlockName)5704 GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName)
5705 {
5706
5707 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5708 IOStream *stream = ctx->m_stream;
5709 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5710 bool useChecksum = checksumCalculator->getVersion() > 0;
5711
5712 const unsigned int __size_uniformBlockName = (strlen(uniformBlockName) + 1);
5713 unsigned char *ptr;
5714 unsigned char *buf;
5715 const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4;
5716 const size_t checksumSize = checksumCalculator->checksumByteSize();
5717 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5718 buf = stream->alloc(totalSize);
5719 ptr = buf;
5720 int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4;
5721 memcpy(ptr, &totalSize, 4); ptr += 4;
5722
5723 memcpy(ptr, &program, 4); ptr += 4;
5724 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5725 memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName;
5726
5727 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5728 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5729
5730
5731 GLuint retval;
5732 stream->readback(&retval, 4);
5733 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5734 if (useChecksum) {
5735 unsigned char *checksumBufPtr = NULL;
5736 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5737 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5738 stream->readback(checksumBufPtr, checksumSize);
5739 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5740 ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n");
5741 abort();
5742 }
5743 }
5744 return retval;
5745 }
5746
glGetUniformIndicesAEMU_enc(void * self,GLuint program,GLsizei uniformCount,const GLchar * packedUniformNames,GLsizei packedLen,GLuint * uniformIndices)5747 void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices)
5748 {
5749
5750 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5751 IOStream *stream = ctx->m_stream;
5752 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5753 bool useChecksum = checksumCalculator->getVersion() > 0;
5754
5755 const unsigned int __size_packedUniformNames = packedLen;
5756 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
5757 unsigned char *ptr;
5758 unsigned char *buf;
5759 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4;
5760 const size_t checksumSize = checksumCalculator->checksumByteSize();
5761 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5762 buf = stream->alloc(totalSize);
5763 ptr = buf;
5764 int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5765 memcpy(ptr, &totalSize, 4); ptr += 4;
5766
5767 memcpy(ptr, &program, 4); ptr += 4;
5768 memcpy(ptr, &uniformCount, 4); ptr += 4;
5769 *(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4;
5770 memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames;
5771 memcpy(ptr, &packedLen, 4); ptr += 4;
5772 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
5773
5774 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5775 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5776
5777 stream->readback(uniformIndices, __size_uniformIndices);
5778 if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices);
5779 if (useChecksum) {
5780 unsigned char *checksumBufPtr = NULL;
5781 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5782 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5783 stream->readback(checksumBufPtr, checksumSize);
5784 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5785 ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n");
5786 abort();
5787 }
5788 }
5789 }
5790
glGetActiveUniformBlockiv_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLenum pname,GLint * params)5791 void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5792 {
5793
5794 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5795 IOStream *stream = ctx->m_stream;
5796 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5797 bool useChecksum = checksumCalculator->getVersion() > 0;
5798
5799 const unsigned int __size_params = (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint));
5800 unsigned char *ptr;
5801 unsigned char *buf;
5802 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
5803 const size_t checksumSize = checksumCalculator->checksumByteSize();
5804 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5805 buf = stream->alloc(totalSize);
5806 ptr = buf;
5807 int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4;
5808 memcpy(ptr, &totalSize, 4); ptr += 4;
5809
5810 memcpy(ptr, &program, 4); ptr += 4;
5811 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5812 memcpy(ptr, &pname, 4); ptr += 4;
5813 *(unsigned int *)(ptr) = __size_params; ptr += 4;
5814
5815 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5816 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5817
5818 stream->readback(params, __size_params);
5819 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5820 if (useChecksum) {
5821 unsigned char *checksumBufPtr = NULL;
5822 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5823 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5824 stream->readback(checksumBufPtr, checksumSize);
5825 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5826 ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n");
5827 abort();
5828 }
5829 }
5830 }
5831
glGetActiveUniformBlockName_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName)5832 void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5833 {
5834
5835 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5836 IOStream *stream = ctx->m_stream;
5837 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5838 bool useChecksum = checksumCalculator->getVersion() > 0;
5839
5840 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
5841 const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ? bufSize : 0);
5842 unsigned char *ptr;
5843 unsigned char *buf;
5844 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4;
5845 const size_t checksumSize = checksumCalculator->checksumByteSize();
5846 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5847 buf = stream->alloc(totalSize);
5848 ptr = buf;
5849 int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4;
5850 memcpy(ptr, &totalSize, 4); ptr += 4;
5851
5852 memcpy(ptr, &program, 4); ptr += 4;
5853 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5854 memcpy(ptr, &bufSize, 4); ptr += 4;
5855 *(unsigned int *)(ptr) = __size_length; ptr += 4;
5856 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5857
5858 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5859 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5860
5861 if (length != NULL) {
5862 stream->readback(length, __size_length);
5863 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
5864 }
5865 if (uniformBlockName != NULL) {
5866 stream->readback(uniformBlockName, __size_uniformBlockName);
5867 if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName);
5868 }
5869 if (useChecksum) {
5870 unsigned char *checksumBufPtr = NULL;
5871 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5872 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5873 stream->readback(checksumBufPtr, checksumSize);
5874 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5875 ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n");
5876 abort();
5877 }
5878 }
5879 }
5880
glUniform1ui_enc(void * self,GLint location,GLuint v0)5881 void glUniform1ui_enc(void *self , GLint location, GLuint v0)
5882 {
5883
5884 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5885 IOStream *stream = ctx->m_stream;
5886 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5887 bool useChecksum = checksumCalculator->getVersion() > 0;
5888
5889 unsigned char *ptr;
5890 unsigned char *buf;
5891 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5892 const size_t checksumSize = checksumCalculator->checksumByteSize();
5893 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5894 buf = stream->alloc(totalSize);
5895 ptr = buf;
5896 int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
5897 memcpy(ptr, &totalSize, 4); ptr += 4;
5898
5899 memcpy(ptr, &location, 4); ptr += 4;
5900 memcpy(ptr, &v0, 4); ptr += 4;
5901
5902 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5903 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5904
5905 }
5906
glUniform2ui_enc(void * self,GLint location,GLuint v0,GLuint v1)5907 void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1)
5908 {
5909
5910 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5911 IOStream *stream = ctx->m_stream;
5912 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5913 bool useChecksum = checksumCalculator->getVersion() > 0;
5914
5915 unsigned char *ptr;
5916 unsigned char *buf;
5917 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5918 const size_t checksumSize = checksumCalculator->checksumByteSize();
5919 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5920 buf = stream->alloc(totalSize);
5921 ptr = buf;
5922 int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
5923 memcpy(ptr, &totalSize, 4); ptr += 4;
5924
5925 memcpy(ptr, &location, 4); ptr += 4;
5926 memcpy(ptr, &v0, 4); ptr += 4;
5927 memcpy(ptr, &v1, 4); ptr += 4;
5928
5929 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5930 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5931
5932 }
5933
glUniform3ui_enc(void * self,GLint location,GLuint v0,GLuint v1,GLuint v2)5934 void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2)
5935 {
5936
5937 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5938 IOStream *stream = ctx->m_stream;
5939 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5940 bool useChecksum = checksumCalculator->getVersion() > 0;
5941
5942 unsigned char *ptr;
5943 unsigned char *buf;
5944 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5945 const size_t checksumSize = checksumCalculator->checksumByteSize();
5946 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5947 buf = stream->alloc(totalSize);
5948 ptr = buf;
5949 int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
5950 memcpy(ptr, &totalSize, 4); ptr += 4;
5951
5952 memcpy(ptr, &location, 4); ptr += 4;
5953 memcpy(ptr, &v0, 4); ptr += 4;
5954 memcpy(ptr, &v1, 4); ptr += 4;
5955 memcpy(ptr, &v2, 4); ptr += 4;
5956
5957 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5958 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5959
5960 }
5961
glUniform4ui_enc(void * self,GLint location,GLint v0,GLuint v1,GLuint v2,GLuint v3)5962 void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3)
5963 {
5964
5965 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5966 IOStream *stream = ctx->m_stream;
5967 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5968 bool useChecksum = checksumCalculator->getVersion() > 0;
5969
5970 unsigned char *ptr;
5971 unsigned char *buf;
5972 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5973 const size_t checksumSize = checksumCalculator->checksumByteSize();
5974 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5975 buf = stream->alloc(totalSize);
5976 ptr = buf;
5977 int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
5978 memcpy(ptr, &totalSize, 4); ptr += 4;
5979
5980 memcpy(ptr, &location, 4); ptr += 4;
5981 memcpy(ptr, &v0, 4); ptr += 4;
5982 memcpy(ptr, &v1, 4); ptr += 4;
5983 memcpy(ptr, &v2, 4); ptr += 4;
5984 memcpy(ptr, &v3, 4); ptr += 4;
5985
5986 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5987 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5988
5989 }
5990
glUniform1uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)5991 void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
5992 {
5993
5994 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5995 IOStream *stream = ctx->m_stream;
5996 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5997 bool useChecksum = checksumCalculator->getVersion() > 0;
5998
5999 const unsigned int __size_value = (count * sizeof(GLuint));
6000 unsigned char *ptr;
6001 unsigned char *buf;
6002 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6003 const size_t checksumSize = checksumCalculator->checksumByteSize();
6004 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6005 buf = stream->alloc(totalSize);
6006 ptr = buf;
6007 int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6008 memcpy(ptr, &totalSize, 4); ptr += 4;
6009
6010 memcpy(ptr, &location, 4); ptr += 4;
6011 memcpy(ptr, &count, 4); ptr += 4;
6012 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6013 memcpy(ptr, value, __size_value);ptr += __size_value;
6014
6015 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6016 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6017
6018 }
6019
glUniform2uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6020 void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6021 {
6022
6023 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6024 IOStream *stream = ctx->m_stream;
6025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6026 bool useChecksum = checksumCalculator->getVersion() > 0;
6027
6028 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
6029 unsigned char *ptr;
6030 unsigned char *buf;
6031 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6032 const size_t checksumSize = checksumCalculator->checksumByteSize();
6033 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6034 buf = stream->alloc(totalSize);
6035 ptr = buf;
6036 int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6037 memcpy(ptr, &totalSize, 4); ptr += 4;
6038
6039 memcpy(ptr, &location, 4); ptr += 4;
6040 memcpy(ptr, &count, 4); ptr += 4;
6041 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6042 memcpy(ptr, value, __size_value);ptr += __size_value;
6043
6044 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6045 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6046
6047 }
6048
glUniform3uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6049 void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6050 {
6051
6052 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6053 IOStream *stream = ctx->m_stream;
6054 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6055 bool useChecksum = checksumCalculator->getVersion() > 0;
6056
6057 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
6058 unsigned char *ptr;
6059 unsigned char *buf;
6060 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6061 const size_t checksumSize = checksumCalculator->checksumByteSize();
6062 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6063 buf = stream->alloc(totalSize);
6064 ptr = buf;
6065 int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6066 memcpy(ptr, &totalSize, 4); ptr += 4;
6067
6068 memcpy(ptr, &location, 4); ptr += 4;
6069 memcpy(ptr, &count, 4); ptr += 4;
6070 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6071 memcpy(ptr, value, __size_value);ptr += __size_value;
6072
6073 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6074 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6075
6076 }
6077
glUniform4uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6078 void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6079 {
6080
6081 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6082 IOStream *stream = ctx->m_stream;
6083 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6084 bool useChecksum = checksumCalculator->getVersion() > 0;
6085
6086 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
6087 unsigned char *ptr;
6088 unsigned char *buf;
6089 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6090 const size_t checksumSize = checksumCalculator->checksumByteSize();
6091 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6092 buf = stream->alloc(totalSize);
6093 ptr = buf;
6094 int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6095 memcpy(ptr, &totalSize, 4); ptr += 4;
6096
6097 memcpy(ptr, &location, 4); ptr += 4;
6098 memcpy(ptr, &count, 4); ptr += 4;
6099 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6100 memcpy(ptr, value, __size_value);ptr += __size_value;
6101
6102 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6103 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6104
6105 }
6106
glUniformMatrix2x3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6107 void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6108 {
6109
6110 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6111 IOStream *stream = ctx->m_stream;
6112 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6113 bool useChecksum = checksumCalculator->getVersion() > 0;
6114
6115 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6116 unsigned char *ptr;
6117 unsigned char *buf;
6118 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6119 const size_t checksumSize = checksumCalculator->checksumByteSize();
6120 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6121 buf = stream->alloc(totalSize);
6122 ptr = buf;
6123 int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6124 memcpy(ptr, &totalSize, 4); ptr += 4;
6125
6126 memcpy(ptr, &location, 4); ptr += 4;
6127 memcpy(ptr, &count, 4); ptr += 4;
6128 memcpy(ptr, &transpose, 1); ptr += 1;
6129 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6130 memcpy(ptr, value, __size_value);ptr += __size_value;
6131
6132 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6133 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6134
6135 }
6136
glUniformMatrix3x2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6137 void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6138 {
6139
6140 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6141 IOStream *stream = ctx->m_stream;
6142 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6143 bool useChecksum = checksumCalculator->getVersion() > 0;
6144
6145 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6146 unsigned char *ptr;
6147 unsigned char *buf;
6148 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6149 const size_t checksumSize = checksumCalculator->checksumByteSize();
6150 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6151 buf = stream->alloc(totalSize);
6152 ptr = buf;
6153 int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6154 memcpy(ptr, &totalSize, 4); ptr += 4;
6155
6156 memcpy(ptr, &location, 4); ptr += 4;
6157 memcpy(ptr, &count, 4); ptr += 4;
6158 memcpy(ptr, &transpose, 1); ptr += 1;
6159 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6160 memcpy(ptr, value, __size_value);ptr += __size_value;
6161
6162 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6163 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6164
6165 }
6166
glUniformMatrix2x4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6167 void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6168 {
6169
6170 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6171 IOStream *stream = ctx->m_stream;
6172 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6173 bool useChecksum = checksumCalculator->getVersion() > 0;
6174
6175 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6176 unsigned char *ptr;
6177 unsigned char *buf;
6178 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6179 const size_t checksumSize = checksumCalculator->checksumByteSize();
6180 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6181 buf = stream->alloc(totalSize);
6182 ptr = buf;
6183 int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6184 memcpy(ptr, &totalSize, 4); ptr += 4;
6185
6186 memcpy(ptr, &location, 4); ptr += 4;
6187 memcpy(ptr, &count, 4); ptr += 4;
6188 memcpy(ptr, &transpose, 1); ptr += 1;
6189 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6190 memcpy(ptr, value, __size_value);ptr += __size_value;
6191
6192 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6193 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6194
6195 }
6196
glUniformMatrix4x2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6197 void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6198 {
6199
6200 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6201 IOStream *stream = ctx->m_stream;
6202 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6203 bool useChecksum = checksumCalculator->getVersion() > 0;
6204
6205 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6206 unsigned char *ptr;
6207 unsigned char *buf;
6208 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6209 const size_t checksumSize = checksumCalculator->checksumByteSize();
6210 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6211 buf = stream->alloc(totalSize);
6212 ptr = buf;
6213 int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6214 memcpy(ptr, &totalSize, 4); ptr += 4;
6215
6216 memcpy(ptr, &location, 4); ptr += 4;
6217 memcpy(ptr, &count, 4); ptr += 4;
6218 memcpy(ptr, &transpose, 1); ptr += 1;
6219 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6220 memcpy(ptr, value, __size_value);ptr += __size_value;
6221
6222 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6223 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6224
6225 }
6226
glUniformMatrix3x4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6227 void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6228 {
6229
6230 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6231 IOStream *stream = ctx->m_stream;
6232 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6233 bool useChecksum = checksumCalculator->getVersion() > 0;
6234
6235 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6236 unsigned char *ptr;
6237 unsigned char *buf;
6238 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6239 const size_t checksumSize = checksumCalculator->checksumByteSize();
6240 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6241 buf = stream->alloc(totalSize);
6242 ptr = buf;
6243 int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6244 memcpy(ptr, &totalSize, 4); ptr += 4;
6245
6246 memcpy(ptr, &location, 4); ptr += 4;
6247 memcpy(ptr, &count, 4); ptr += 4;
6248 memcpy(ptr, &transpose, 1); ptr += 1;
6249 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6250 memcpy(ptr, value, __size_value);ptr += __size_value;
6251
6252 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6253 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6254
6255 }
6256
glUniformMatrix4x3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6257 void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6258 {
6259
6260 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6261 IOStream *stream = ctx->m_stream;
6262 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6263 bool useChecksum = checksumCalculator->getVersion() > 0;
6264
6265 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6266 unsigned char *ptr;
6267 unsigned char *buf;
6268 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6269 const size_t checksumSize = checksumCalculator->checksumByteSize();
6270 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6271 buf = stream->alloc(totalSize);
6272 ptr = buf;
6273 int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6274 memcpy(ptr, &totalSize, 4); ptr += 4;
6275
6276 memcpy(ptr, &location, 4); ptr += 4;
6277 memcpy(ptr, &count, 4); ptr += 4;
6278 memcpy(ptr, &transpose, 1); ptr += 1;
6279 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6280 memcpy(ptr, value, __size_value);ptr += __size_value;
6281
6282 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6283 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6284
6285 }
6286
glGetUniformuiv_enc(void * self,GLuint program,GLint location,GLuint * params)6287 void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params)
6288 {
6289
6290 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6291 IOStream *stream = ctx->m_stream;
6292 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6293 bool useChecksum = checksumCalculator->getVersion() > 0;
6294
6295 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
6296 unsigned char *ptr;
6297 unsigned char *buf;
6298 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6299 const size_t checksumSize = checksumCalculator->checksumByteSize();
6300 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6301 buf = stream->alloc(totalSize);
6302 ptr = buf;
6303 int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6304 memcpy(ptr, &totalSize, 4); ptr += 4;
6305
6306 memcpy(ptr, &program, 4); ptr += 4;
6307 memcpy(ptr, &location, 4); ptr += 4;
6308 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6309
6310 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6311 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6312
6313 stream->readback(params, __size_params);
6314 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6315 if (useChecksum) {
6316 unsigned char *checksumBufPtr = NULL;
6317 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6318 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6319 stream->readback(checksumBufPtr, checksumSize);
6320 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6321 ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n");
6322 abort();
6323 }
6324 }
6325 }
6326
glGetActiveUniformsiv_enc(void * self,GLuint program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params)6327 void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
6328 {
6329
6330 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6331 IOStream *stream = ctx->m_stream;
6332 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6333 bool useChecksum = checksumCalculator->getVersion() > 0;
6334
6335 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
6336 const unsigned int __size_params = (uniformCount * sizeof(GLint));
6337 unsigned char *ptr;
6338 unsigned char *buf;
6339 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4;
6340 const size_t checksumSize = checksumCalculator->checksumByteSize();
6341 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6342 buf = stream->alloc(totalSize);
6343 ptr = buf;
6344 int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4;
6345 memcpy(ptr, &totalSize, 4); ptr += 4;
6346
6347 memcpy(ptr, &program, 4); ptr += 4;
6348 memcpy(ptr, &uniformCount, 4); ptr += 4;
6349 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
6350 memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices;
6351 memcpy(ptr, &pname, 4); ptr += 4;
6352 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6353
6354 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6355 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6356
6357 stream->readback(params, __size_params);
6358 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6359 if (useChecksum) {
6360 unsigned char *checksumBufPtr = NULL;
6361 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6362 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6363 stream->readback(checksumBufPtr, checksumSize);
6364 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6365 ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n");
6366 abort();
6367 }
6368 }
6369 }
6370
glVertexAttribI4i_enc(void * self,GLuint index,GLint v0,GLint v1,GLint v2,GLint v3)6371 void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3)
6372 {
6373
6374 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6375 IOStream *stream = ctx->m_stream;
6376 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6377 bool useChecksum = checksumCalculator->getVersion() > 0;
6378
6379 unsigned char *ptr;
6380 unsigned char *buf;
6381 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6382 const size_t checksumSize = checksumCalculator->checksumByteSize();
6383 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6384 buf = stream->alloc(totalSize);
6385 ptr = buf;
6386 int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4;
6387 memcpy(ptr, &totalSize, 4); ptr += 4;
6388
6389 memcpy(ptr, &index, 4); ptr += 4;
6390 memcpy(ptr, &v0, 4); ptr += 4;
6391 memcpy(ptr, &v1, 4); ptr += 4;
6392 memcpy(ptr, &v2, 4); ptr += 4;
6393 memcpy(ptr, &v3, 4); ptr += 4;
6394
6395 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6396 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6397
6398 }
6399
glVertexAttribI4ui_enc(void * self,GLuint index,GLuint v0,GLuint v1,GLuint v2,GLuint v3)6400 void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
6401 {
6402
6403 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6404 IOStream *stream = ctx->m_stream;
6405 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6406 bool useChecksum = checksumCalculator->getVersion() > 0;
6407
6408 unsigned char *ptr;
6409 unsigned char *buf;
6410 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6411 const size_t checksumSize = checksumCalculator->checksumByteSize();
6412 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6413 buf = stream->alloc(totalSize);
6414 ptr = buf;
6415 int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4;
6416 memcpy(ptr, &totalSize, 4); ptr += 4;
6417
6418 memcpy(ptr, &index, 4); ptr += 4;
6419 memcpy(ptr, &v0, 4); ptr += 4;
6420 memcpy(ptr, &v1, 4); ptr += 4;
6421 memcpy(ptr, &v2, 4); ptr += 4;
6422 memcpy(ptr, &v3, 4); ptr += 4;
6423
6424 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6425 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6426
6427 }
6428
glVertexAttribI4iv_enc(void * self,GLuint index,const GLint * v)6429 void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v)
6430 {
6431
6432 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6433 IOStream *stream = ctx->m_stream;
6434 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6435 bool useChecksum = checksumCalculator->getVersion() > 0;
6436
6437 const unsigned int __size_v = (4 * sizeof(GLint));
6438 unsigned char *ptr;
6439 unsigned char *buf;
6440 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6441 const size_t checksumSize = checksumCalculator->checksumByteSize();
6442 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6443 buf = stream->alloc(totalSize);
6444 ptr = buf;
6445 int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4;
6446 memcpy(ptr, &totalSize, 4); ptr += 4;
6447
6448 memcpy(ptr, &index, 4); ptr += 4;
6449 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6450 memcpy(ptr, v, __size_v);ptr += __size_v;
6451
6452 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6453 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6454
6455 }
6456
glVertexAttribI4uiv_enc(void * self,GLuint index,const GLuint * v)6457 void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v)
6458 {
6459
6460 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6461 IOStream *stream = ctx->m_stream;
6462 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6463 bool useChecksum = checksumCalculator->getVersion() > 0;
6464
6465 const unsigned int __size_v = (4 * sizeof(GLuint));
6466 unsigned char *ptr;
6467 unsigned char *buf;
6468 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6469 const size_t checksumSize = checksumCalculator->checksumByteSize();
6470 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6471 buf = stream->alloc(totalSize);
6472 ptr = buf;
6473 int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6474 memcpy(ptr, &totalSize, 4); ptr += 4;
6475
6476 memcpy(ptr, &index, 4); ptr += 4;
6477 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6478 memcpy(ptr, v, __size_v);ptr += __size_v;
6479
6480 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6481 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6482
6483 }
6484
glVertexAttribIPointerOffsetAEMU_enc(void * self,GLuint index,GLint size,GLenum type,GLsizei stride,GLuint offset)6485 void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset)
6486 {
6487
6488 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6489 IOStream *stream = ctx->m_stream;
6490 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6491 bool useChecksum = checksumCalculator->getVersion() > 0;
6492
6493 unsigned char *ptr;
6494 unsigned char *buf;
6495 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6496 const size_t checksumSize = checksumCalculator->checksumByteSize();
6497 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6498 buf = stream->alloc(totalSize);
6499 ptr = buf;
6500 int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6501 memcpy(ptr, &totalSize, 4); ptr += 4;
6502
6503 memcpy(ptr, &index, 4); ptr += 4;
6504 memcpy(ptr, &size, 4); ptr += 4;
6505 memcpy(ptr, &type, 4); ptr += 4;
6506 memcpy(ptr, &stride, 4); ptr += 4;
6507 memcpy(ptr, &offset, 4); ptr += 4;
6508
6509 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6510 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6511
6512 }
6513
glVertexAttribIPointerDataAEMU_enc(void * self,GLuint index,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)6514 void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
6515 {
6516
6517 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6518 IOStream *stream = ctx->m_stream;
6519 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6520 bool useChecksum = checksumCalculator->getVersion() > 0;
6521
6522 const unsigned int __size_data = datalen;
6523 unsigned char *ptr;
6524 unsigned char *buf;
6525 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
6526 const size_t checksumSize = checksumCalculator->checksumByteSize();
6527 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6528 buf = stream->alloc(totalSize);
6529 ptr = buf;
6530 int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6531 memcpy(ptr, &totalSize, 4); ptr += 4;
6532
6533 memcpy(ptr, &index, 4); ptr += 4;
6534 memcpy(ptr, &size, 4); ptr += 4;
6535 memcpy(ptr, &type, 4); ptr += 4;
6536 memcpy(ptr, &stride, 4); ptr += 4;
6537 *(unsigned int *)(ptr) = __size_data; ptr += 4;
6538 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
6539 memcpy(ptr, &datalen, 4); ptr += 4;
6540
6541 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6542 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6543
6544 }
6545
glGetVertexAttribIiv_enc(void * self,GLuint index,GLenum pname,GLint * params)6546 void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
6547 {
6548
6549 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6550 IOStream *stream = ctx->m_stream;
6551 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6552 bool useChecksum = checksumCalculator->getVersion() > 0;
6553
6554 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
6555 unsigned char *ptr;
6556 unsigned char *buf;
6557 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6558 const size_t checksumSize = checksumCalculator->checksumByteSize();
6559 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6560 buf = stream->alloc(totalSize);
6561 ptr = buf;
6562 int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4;
6563 memcpy(ptr, &totalSize, 4); ptr += 4;
6564
6565 memcpy(ptr, &index, 4); ptr += 4;
6566 memcpy(ptr, &pname, 4); ptr += 4;
6567 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6568
6569 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6570 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6571
6572 stream->readback(params, __size_params);
6573 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6574 if (useChecksum) {
6575 unsigned char *checksumBufPtr = NULL;
6576 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6577 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6578 stream->readback(checksumBufPtr, checksumSize);
6579 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6580 ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n");
6581 abort();
6582 }
6583 }
6584 }
6585
glGetVertexAttribIuiv_enc(void * self,GLuint index,GLenum pname,GLuint * params)6586 void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params)
6587 {
6588
6589 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6590 IOStream *stream = ctx->m_stream;
6591 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6592 bool useChecksum = checksumCalculator->getVersion() > 0;
6593
6594 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
6595 unsigned char *ptr;
6596 unsigned char *buf;
6597 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6598 const size_t checksumSize = checksumCalculator->checksumByteSize();
6599 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6600 buf = stream->alloc(totalSize);
6601 ptr = buf;
6602 int tmp = OP_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6603 memcpy(ptr, &totalSize, 4); ptr += 4;
6604
6605 memcpy(ptr, &index, 4); ptr += 4;
6606 memcpy(ptr, &pname, 4); ptr += 4;
6607 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6608
6609 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6610 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6611
6612 stream->readback(params, __size_params);
6613 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6614 if (useChecksum) {
6615 unsigned char *checksumBufPtr = NULL;
6616 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6617 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6618 stream->readback(checksumBufPtr, checksumSize);
6619 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6620 ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n");
6621 abort();
6622 }
6623 }
6624 }
6625
glVertexAttribDivisor_enc(void * self,GLuint index,GLuint divisor)6626 void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor)
6627 {
6628
6629 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6630 IOStream *stream = ctx->m_stream;
6631 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6632 bool useChecksum = checksumCalculator->getVersion() > 0;
6633
6634 unsigned char *ptr;
6635 unsigned char *buf;
6636 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6637 const size_t checksumSize = checksumCalculator->checksumByteSize();
6638 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6639 buf = stream->alloc(totalSize);
6640 ptr = buf;
6641 int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
6642 memcpy(ptr, &totalSize, 4); ptr += 4;
6643
6644 memcpy(ptr, &index, 4); ptr += 4;
6645 memcpy(ptr, &divisor, 4); ptr += 4;
6646
6647 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6648 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6649
6650 }
6651
glDrawArraysInstanced_enc(void * self,GLenum mode,GLint first,GLsizei count,GLsizei primcount)6652 void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount)
6653 {
6654
6655 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6656 IOStream *stream = ctx->m_stream;
6657 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6658 bool useChecksum = checksumCalculator->getVersion() > 0;
6659
6660 unsigned char *ptr;
6661 unsigned char *buf;
6662 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6663 const size_t checksumSize = checksumCalculator->checksumByteSize();
6664 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6665 buf = stream->alloc(totalSize);
6666 ptr = buf;
6667 int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4;
6668 memcpy(ptr, &totalSize, 4); ptr += 4;
6669
6670 memcpy(ptr, &mode, 4); ptr += 4;
6671 memcpy(ptr, &first, 4); ptr += 4;
6672 memcpy(ptr, &count, 4); ptr += 4;
6673 memcpy(ptr, &primcount, 4); ptr += 4;
6674
6675 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6676 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6677
6678 }
6679
glDrawElementsInstancedDataAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount,GLsizei datalen)6680 void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen)
6681 {
6682
6683 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6684 IOStream *stream = ctx->m_stream;
6685 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6686 bool useChecksum = checksumCalculator->getVersion() > 0;
6687
6688 const unsigned int __size_indices = datalen;
6689 unsigned char *ptr;
6690 unsigned char *buf;
6691 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4;
6692 const size_t checksumSize = checksumCalculator->checksumByteSize();
6693 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6694 buf = stream->alloc(totalSize);
6695 ptr = buf;
6696 int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6697 memcpy(ptr, &totalSize, 4); ptr += 4;
6698
6699 memcpy(ptr, &mode, 4); ptr += 4;
6700 memcpy(ptr, &count, 4); ptr += 4;
6701 memcpy(ptr, &type, 4); ptr += 4;
6702 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6703 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6704 memcpy(ptr, &primcount, 4); ptr += 4;
6705 memcpy(ptr, &datalen, 4); ptr += 4;
6706
6707 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6708 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6709
6710 }
6711
glDrawElementsInstancedOffsetAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset,GLsizei primcount)6712 void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount)
6713 {
6714
6715 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6716 IOStream *stream = ctx->m_stream;
6717 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6718 bool useChecksum = checksumCalculator->getVersion() > 0;
6719
6720 unsigned char *ptr;
6721 unsigned char *buf;
6722 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6723 const size_t checksumSize = checksumCalculator->checksumByteSize();
6724 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6725 buf = stream->alloc(totalSize);
6726 ptr = buf;
6727 int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6728 memcpy(ptr, &totalSize, 4); ptr += 4;
6729
6730 memcpy(ptr, &mode, 4); ptr += 4;
6731 memcpy(ptr, &count, 4); ptr += 4;
6732 memcpy(ptr, &type, 4); ptr += 4;
6733 memcpy(ptr, &offset, 4); ptr += 4;
6734 memcpy(ptr, &primcount, 4); ptr += 4;
6735
6736 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6737 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6738
6739 }
6740
glDrawRangeElementsDataAEMU_enc(void * self,GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const GLvoid * indices,GLsizei datalen)6741 void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen)
6742 {
6743
6744 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6745 IOStream *stream = ctx->m_stream;
6746 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6747 bool useChecksum = checksumCalculator->getVersion() > 0;
6748
6749 const unsigned int __size_indices = datalen;
6750 unsigned char *ptr;
6751 unsigned char *buf;
6752 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4;
6753 const size_t checksumSize = checksumCalculator->checksumByteSize();
6754 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6755 buf = stream->alloc(totalSize);
6756 ptr = buf;
6757 int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6758 memcpy(ptr, &totalSize, 4); ptr += 4;
6759
6760 memcpy(ptr, &mode, 4); ptr += 4;
6761 memcpy(ptr, &start, 4); ptr += 4;
6762 memcpy(ptr, &end, 4); ptr += 4;
6763 memcpy(ptr, &count, 4); ptr += 4;
6764 memcpy(ptr, &type, 4); ptr += 4;
6765 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6766 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6767 memcpy(ptr, &datalen, 4); ptr += 4;
6768
6769 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6770 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6771
6772 }
6773
glDrawRangeElementsOffsetAEMU_enc(void * self,GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,GLuint offset)6774 void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset)
6775 {
6776
6777 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6778 IOStream *stream = ctx->m_stream;
6779 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6780 bool useChecksum = checksumCalculator->getVersion() > 0;
6781
6782 unsigned char *ptr;
6783 unsigned char *buf;
6784 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6785 const size_t checksumSize = checksumCalculator->checksumByteSize();
6786 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6787 buf = stream->alloc(totalSize);
6788 ptr = buf;
6789 int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6790 memcpy(ptr, &totalSize, 4); ptr += 4;
6791
6792 memcpy(ptr, &mode, 4); ptr += 4;
6793 memcpy(ptr, &start, 4); ptr += 4;
6794 memcpy(ptr, &end, 4); ptr += 4;
6795 memcpy(ptr, &count, 4); ptr += 4;
6796 memcpy(ptr, &type, 4); ptr += 4;
6797 memcpy(ptr, &offset, 4); ptr += 4;
6798
6799 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6800 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6801
6802 }
6803
glFenceSyncAEMU_enc(void * self,GLenum condition,GLbitfield flags)6804 uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
6805 {
6806
6807 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6808 IOStream *stream = ctx->m_stream;
6809 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6810 bool useChecksum = checksumCalculator->getVersion() > 0;
6811
6812 unsigned char *ptr;
6813 unsigned char *buf;
6814 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6815 const size_t checksumSize = checksumCalculator->checksumByteSize();
6816 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6817 buf = stream->alloc(totalSize);
6818 ptr = buf;
6819 int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6820 memcpy(ptr, &totalSize, 4); ptr += 4;
6821
6822 memcpy(ptr, &condition, 4); ptr += 4;
6823 memcpy(ptr, &flags, 4); ptr += 4;
6824
6825 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6826 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6827
6828
6829 uint64_t retval;
6830 stream->readback(&retval, 8);
6831 if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
6832 if (useChecksum) {
6833 unsigned char *checksumBufPtr = NULL;
6834 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6835 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6836 stream->readback(checksumBufPtr, checksumSize);
6837 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6838 ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6839 abort();
6840 }
6841 }
6842 return retval;
6843 }
6844
glClientWaitSyncAEMU_enc(void * self,uint64_t wait_on,GLbitfield flags,GLuint64 timeout)6845 GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
6846 {
6847
6848 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6849 IOStream *stream = ctx->m_stream;
6850 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6851 bool useChecksum = checksumCalculator->getVersion() > 0;
6852
6853 unsigned char *ptr;
6854 unsigned char *buf;
6855 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6856 const size_t checksumSize = checksumCalculator->checksumByteSize();
6857 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6858 buf = stream->alloc(totalSize);
6859 ptr = buf;
6860 int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6861 memcpy(ptr, &totalSize, 4); ptr += 4;
6862
6863 memcpy(ptr, &wait_on, 8); ptr += 8;
6864 memcpy(ptr, &flags, 4); ptr += 4;
6865 memcpy(ptr, &timeout, 8); ptr += 8;
6866
6867 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6868 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6869
6870
6871 GLenum retval;
6872 stream->readback(&retval, 4);
6873 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6874 if (useChecksum) {
6875 unsigned char *checksumBufPtr = NULL;
6876 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6877 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6878 stream->readback(checksumBufPtr, checksumSize);
6879 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6880 ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6881 abort();
6882 }
6883 }
6884 return retval;
6885 }
6886
glWaitSyncAEMU_enc(void * self,uint64_t wait_on,GLbitfield flags,GLuint64 timeout)6887 void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
6888 {
6889
6890 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6891 IOStream *stream = ctx->m_stream;
6892 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6893 bool useChecksum = checksumCalculator->getVersion() > 0;
6894
6895 unsigned char *ptr;
6896 unsigned char *buf;
6897 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6898 const size_t checksumSize = checksumCalculator->checksumByteSize();
6899 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6900 buf = stream->alloc(totalSize);
6901 ptr = buf;
6902 int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6903 memcpy(ptr, &totalSize, 4); ptr += 4;
6904
6905 memcpy(ptr, &wait_on, 8); ptr += 8;
6906 memcpy(ptr, &flags, 4); ptr += 4;
6907 memcpy(ptr, &timeout, 8); ptr += 8;
6908
6909 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6910 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6911
6912 }
6913
glDeleteSyncAEMU_enc(void * self,uint64_t to_delete)6914 void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
6915 {
6916
6917 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6918 IOStream *stream = ctx->m_stream;
6919 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6920 bool useChecksum = checksumCalculator->getVersion() > 0;
6921
6922 unsigned char *ptr;
6923 unsigned char *buf;
6924 const size_t sizeWithoutChecksum = 8 + 8;
6925 const size_t checksumSize = checksumCalculator->checksumByteSize();
6926 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6927 buf = stream->alloc(totalSize);
6928 ptr = buf;
6929 int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6930 memcpy(ptr, &totalSize, 4); ptr += 4;
6931
6932 memcpy(ptr, &to_delete, 8); ptr += 8;
6933
6934 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6935 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6936
6937 }
6938
glIsSyncAEMU_enc(void * self,uint64_t sync)6939 GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
6940 {
6941
6942 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6943 IOStream *stream = ctx->m_stream;
6944 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6945 bool useChecksum = checksumCalculator->getVersion() > 0;
6946
6947 unsigned char *ptr;
6948 unsigned char *buf;
6949 const size_t sizeWithoutChecksum = 8 + 8;
6950 const size_t checksumSize = checksumCalculator->checksumByteSize();
6951 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6952 buf = stream->alloc(totalSize);
6953 ptr = buf;
6954 int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6955 memcpy(ptr, &totalSize, 4); ptr += 4;
6956
6957 memcpy(ptr, &sync, 8); ptr += 8;
6958
6959 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6960 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6961
6962
6963 GLboolean retval;
6964 stream->readback(&retval, 1);
6965 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6966 if (useChecksum) {
6967 unsigned char *checksumBufPtr = NULL;
6968 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6969 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6970 stream->readback(checksumBufPtr, checksumSize);
6971 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6972 ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6973 abort();
6974 }
6975 }
6976 return retval;
6977 }
6978
glGetSyncivAEMU_enc(void * self,uint64_t sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values)6979 void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
6980 {
6981
6982 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6983 IOStream *stream = ctx->m_stream;
6984 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6985 bool useChecksum = checksumCalculator->getVersion() > 0;
6986
6987 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
6988 const unsigned int __size_values = (bufSize * sizeof(GLint));
6989 unsigned char *ptr;
6990 unsigned char *buf;
6991 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4;
6992 const size_t checksumSize = checksumCalculator->checksumByteSize();
6993 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6994 buf = stream->alloc(totalSize);
6995 ptr = buf;
6996 int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6997 memcpy(ptr, &totalSize, 4); ptr += 4;
6998
6999 memcpy(ptr, &sync, 8); ptr += 8;
7000 memcpy(ptr, &pname, 4); ptr += 4;
7001 memcpy(ptr, &bufSize, 4); ptr += 4;
7002 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7003 *(unsigned int *)(ptr) = __size_values; ptr += 4;
7004
7005 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7006 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7007
7008 if (length != NULL) {
7009 stream->readback(length, __size_length);
7010 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7011 }
7012 stream->readback(values, __size_values);
7013 if (useChecksum) checksumCalculator->addBuffer(values, __size_values);
7014 if (useChecksum) {
7015 unsigned char *checksumBufPtr = NULL;
7016 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7017 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7018 stream->readback(checksumBufPtr, checksumSize);
7019 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7020 ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
7021 abort();
7022 }
7023 }
7024 }
7025
glDrawBuffers_enc(void * self,GLsizei n,const GLenum * bufs)7026 void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs)
7027 {
7028
7029 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7030 IOStream *stream = ctx->m_stream;
7031 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7032 bool useChecksum = checksumCalculator->getVersion() > 0;
7033
7034 const unsigned int __size_bufs = (n * sizeof(GLenum));
7035 unsigned char *ptr;
7036 unsigned char *buf;
7037 const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4;
7038 const size_t checksumSize = checksumCalculator->checksumByteSize();
7039 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7040 buf = stream->alloc(totalSize);
7041 ptr = buf;
7042 int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
7043 memcpy(ptr, &totalSize, 4); ptr += 4;
7044
7045 memcpy(ptr, &n, 4); ptr += 4;
7046 *(unsigned int *)(ptr) = __size_bufs; ptr += 4;
7047 memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs;
7048
7049 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7050 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7051
7052 }
7053
glReadBuffer_enc(void * self,GLenum src)7054 void glReadBuffer_enc(void *self , GLenum src)
7055 {
7056
7057 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7058 IOStream *stream = ctx->m_stream;
7059 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7060 bool useChecksum = checksumCalculator->getVersion() > 0;
7061
7062 unsigned char *ptr;
7063 unsigned char *buf;
7064 const size_t sizeWithoutChecksum = 8 + 4;
7065 const size_t checksumSize = checksumCalculator->checksumByteSize();
7066 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7067 buf = stream->alloc(totalSize);
7068 ptr = buf;
7069 int tmp = OP_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7070 memcpy(ptr, &totalSize, 4); ptr += 4;
7071
7072 memcpy(ptr, &src, 4); ptr += 4;
7073
7074 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7075 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7076
7077 }
7078
glBlitFramebuffer_enc(void * self,GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)7079 void glBlitFramebuffer_enc(void *self , GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
7080 {
7081
7082 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7083 IOStream *stream = ctx->m_stream;
7084 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7085 bool useChecksum = checksumCalculator->getVersion() > 0;
7086
7087 unsigned char *ptr;
7088 unsigned char *buf;
7089 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
7090 const size_t checksumSize = checksumCalculator->checksumByteSize();
7091 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7092 buf = stream->alloc(totalSize);
7093 ptr = buf;
7094 int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7095 memcpy(ptr, &totalSize, 4); ptr += 4;
7096
7097 memcpy(ptr, &srcX0, 4); ptr += 4;
7098 memcpy(ptr, &srcY0, 4); ptr += 4;
7099 memcpy(ptr, &srcX1, 4); ptr += 4;
7100 memcpy(ptr, &srcY1, 4); ptr += 4;
7101 memcpy(ptr, &dstX0, 4); ptr += 4;
7102 memcpy(ptr, &dstY0, 4); ptr += 4;
7103 memcpy(ptr, &dstX1, 4); ptr += 4;
7104 memcpy(ptr, &dstY1, 4); ptr += 4;
7105 memcpy(ptr, &mask, 4); ptr += 4;
7106 memcpy(ptr, &filter, 4); ptr += 4;
7107
7108 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7109 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7110
7111 }
7112
glInvalidateFramebuffer_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments)7113 void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
7114 {
7115
7116 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7117 IOStream *stream = ctx->m_stream;
7118 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7119 bool useChecksum = checksumCalculator->getVersion() > 0;
7120
7121 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7122 unsigned char *ptr;
7123 unsigned char *buf;
7124 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
7125 const size_t checksumSize = checksumCalculator->checksumByteSize();
7126 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7127 buf = stream->alloc(totalSize);
7128 ptr = buf;
7129 int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7130 memcpy(ptr, &totalSize, 4); ptr += 4;
7131
7132 memcpy(ptr, &target, 4); ptr += 4;
7133 memcpy(ptr, &numAttachments, 4); ptr += 4;
7134 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7135 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7136
7137 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7138 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7139
7140 }
7141
glInvalidateSubFramebuffer_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)7142 void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
7143 {
7144
7145 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7146 IOStream *stream = ctx->m_stream;
7147 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7148 bool useChecksum = checksumCalculator->getVersion() > 0;
7149
7150 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7151 unsigned char *ptr;
7152 unsigned char *buf;
7153 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4;
7154 const size_t checksumSize = checksumCalculator->checksumByteSize();
7155 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7156 buf = stream->alloc(totalSize);
7157 ptr = buf;
7158 int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7159 memcpy(ptr, &totalSize, 4); ptr += 4;
7160
7161 memcpy(ptr, &target, 4); ptr += 4;
7162 memcpy(ptr, &numAttachments, 4); ptr += 4;
7163 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7164 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7165 memcpy(ptr, &x, 4); ptr += 4;
7166 memcpy(ptr, &y, 4); ptr += 4;
7167 memcpy(ptr, &width, 4); ptr += 4;
7168 memcpy(ptr, &height, 4); ptr += 4;
7169
7170 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7171 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7172
7173 }
7174
glFramebufferTextureLayer_enc(void * self,GLenum target,GLenum attachment,GLuint texture,GLint level,GLint layer)7175 void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
7176 {
7177
7178 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7179 IOStream *stream = ctx->m_stream;
7180 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7181 bool useChecksum = checksumCalculator->getVersion() > 0;
7182
7183 unsigned char *ptr;
7184 unsigned char *buf;
7185 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7186 const size_t checksumSize = checksumCalculator->checksumByteSize();
7187 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7188 buf = stream->alloc(totalSize);
7189 ptr = buf;
7190 int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4;
7191 memcpy(ptr, &totalSize, 4); ptr += 4;
7192
7193 memcpy(ptr, &target, 4); ptr += 4;
7194 memcpy(ptr, &attachment, 4); ptr += 4;
7195 memcpy(ptr, &texture, 4); ptr += 4;
7196 memcpy(ptr, &level, 4); ptr += 4;
7197 memcpy(ptr, &layer, 4); ptr += 4;
7198
7199 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7200 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7201
7202 }
7203
glRenderbufferStorageMultisample_enc(void * self,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)7204 void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
7205 {
7206
7207 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7208 IOStream *stream = ctx->m_stream;
7209 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7210 bool useChecksum = checksumCalculator->getVersion() > 0;
7211
7212 unsigned char *ptr;
7213 unsigned char *buf;
7214 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7215 const size_t checksumSize = checksumCalculator->checksumByteSize();
7216 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7217 buf = stream->alloc(totalSize);
7218 ptr = buf;
7219 int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
7220 memcpy(ptr, &totalSize, 4); ptr += 4;
7221
7222 memcpy(ptr, &target, 4); ptr += 4;
7223 memcpy(ptr, &samples, 4); ptr += 4;
7224 memcpy(ptr, &internalformat, 4); ptr += 4;
7225 memcpy(ptr, &width, 4); ptr += 4;
7226 memcpy(ptr, &height, 4); ptr += 4;
7227
7228 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7229 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7230
7231 }
7232
glTexStorage2D_enc(void * self,GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)7233 void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
7234 {
7235
7236 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7237 IOStream *stream = ctx->m_stream;
7238 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7239 bool useChecksum = checksumCalculator->getVersion() > 0;
7240
7241 unsigned char *ptr;
7242 unsigned char *buf;
7243 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7244 const size_t checksumSize = checksumCalculator->checksumByteSize();
7245 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7246 buf = stream->alloc(totalSize);
7247 ptr = buf;
7248 int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4;
7249 memcpy(ptr, &totalSize, 4); ptr += 4;
7250
7251 memcpy(ptr, &target, 4); ptr += 4;
7252 memcpy(ptr, &levels, 4); ptr += 4;
7253 memcpy(ptr, &internalformat, 4); ptr += 4;
7254 memcpy(ptr, &width, 4); ptr += 4;
7255 memcpy(ptr, &height, 4); ptr += 4;
7256
7257 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7258 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7259
7260 }
7261
glGetInternalformativ_enc(void * self,GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params)7262 void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
7263 {
7264
7265 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7266 IOStream *stream = ctx->m_stream;
7267 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7268 bool useChecksum = checksumCalculator->getVersion() > 0;
7269
7270 const unsigned int __size_params = (sizeof(GLint) * bufSize);
7271 unsigned char *ptr;
7272 unsigned char *buf;
7273 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
7274 const size_t checksumSize = checksumCalculator->checksumByteSize();
7275 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7276 buf = stream->alloc(totalSize);
7277 ptr = buf;
7278 int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4;
7279 memcpy(ptr, &totalSize, 4); ptr += 4;
7280
7281 memcpy(ptr, &target, 4); ptr += 4;
7282 memcpy(ptr, &internalformat, 4); ptr += 4;
7283 memcpy(ptr, &pname, 4); ptr += 4;
7284 memcpy(ptr, &bufSize, 4); ptr += 4;
7285 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7286
7287 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7288 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7289
7290 stream->readback(params, __size_params);
7291 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7292 if (useChecksum) {
7293 unsigned char *checksumBufPtr = NULL;
7294 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7295 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7296 stream->readback(checksumBufPtr, checksumSize);
7297 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7298 ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n");
7299 abort();
7300 }
7301 }
7302 }
7303
glBeginTransformFeedback_enc(void * self,GLenum primitiveMode)7304 void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode)
7305 {
7306
7307 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7308 IOStream *stream = ctx->m_stream;
7309 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7310 bool useChecksum = checksumCalculator->getVersion() > 0;
7311
7312 unsigned char *ptr;
7313 unsigned char *buf;
7314 const size_t sizeWithoutChecksum = 8 + 4;
7315 const size_t checksumSize = checksumCalculator->checksumByteSize();
7316 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7317 buf = stream->alloc(totalSize);
7318 ptr = buf;
7319 int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7320 memcpy(ptr, &totalSize, 4); ptr += 4;
7321
7322 memcpy(ptr, &primitiveMode, 4); ptr += 4;
7323
7324 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7325 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7326
7327 }
7328
glEndTransformFeedback_enc(void * self)7329 void glEndTransformFeedback_enc(void *self )
7330 {
7331
7332 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7333 IOStream *stream = ctx->m_stream;
7334 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7335 bool useChecksum = checksumCalculator->getVersion() > 0;
7336
7337 unsigned char *ptr;
7338 unsigned char *buf;
7339 const size_t sizeWithoutChecksum = 8;
7340 const size_t checksumSize = checksumCalculator->checksumByteSize();
7341 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7342 buf = stream->alloc(totalSize);
7343 ptr = buf;
7344 int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7345 memcpy(ptr, &totalSize, 4); ptr += 4;
7346
7347
7348 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7349 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7350
7351 }
7352
glGenTransformFeedbacks_enc(void * self,GLsizei n,GLuint * ids)7353 void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids)
7354 {
7355
7356 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7357 IOStream *stream = ctx->m_stream;
7358 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7359 bool useChecksum = checksumCalculator->getVersion() > 0;
7360
7361 const unsigned int __size_ids = (n * sizeof(GLuint));
7362 unsigned char *ptr;
7363 unsigned char *buf;
7364 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7365 const size_t checksumSize = checksumCalculator->checksumByteSize();
7366 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7367 buf = stream->alloc(totalSize);
7368 ptr = buf;
7369 int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7370 memcpy(ptr, &totalSize, 4); ptr += 4;
7371
7372 memcpy(ptr, &n, 4); ptr += 4;
7373 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7374
7375 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7376 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7377
7378 stream->readback(ids, __size_ids);
7379 if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids);
7380 if (useChecksum) {
7381 unsigned char *checksumBufPtr = NULL;
7382 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7383 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7384 stream->readback(checksumBufPtr, checksumSize);
7385 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7386 ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n");
7387 abort();
7388 }
7389 }
7390 }
7391
glDeleteTransformFeedbacks_enc(void * self,GLsizei n,const GLuint * ids)7392 void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids)
7393 {
7394
7395 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7396 IOStream *stream = ctx->m_stream;
7397 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7398 bool useChecksum = checksumCalculator->getVersion() > 0;
7399
7400 const unsigned int __size_ids = (n * sizeof(GLuint));
7401 unsigned char *ptr;
7402 unsigned char *buf;
7403 const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4;
7404 const size_t checksumSize = checksumCalculator->checksumByteSize();
7405 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7406 buf = stream->alloc(totalSize);
7407 ptr = buf;
7408 int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7409 memcpy(ptr, &totalSize, 4); ptr += 4;
7410
7411 memcpy(ptr, &n, 4); ptr += 4;
7412 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7413 memcpy(ptr, ids, __size_ids);ptr += __size_ids;
7414
7415 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7416 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7417
7418 }
7419
glBindTransformFeedback_enc(void * self,GLenum target,GLuint id)7420 void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id)
7421 {
7422
7423 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7424 IOStream *stream = ctx->m_stream;
7425 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7426 bool useChecksum = checksumCalculator->getVersion() > 0;
7427
7428 unsigned char *ptr;
7429 unsigned char *buf;
7430 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7431 const size_t checksumSize = checksumCalculator->checksumByteSize();
7432 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7433 buf = stream->alloc(totalSize);
7434 ptr = buf;
7435 int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7436 memcpy(ptr, &totalSize, 4); ptr += 4;
7437
7438 memcpy(ptr, &target, 4); ptr += 4;
7439 memcpy(ptr, &id, 4); ptr += 4;
7440
7441 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7442 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7443
7444 }
7445
glPauseTransformFeedback_enc(void * self)7446 void glPauseTransformFeedback_enc(void *self )
7447 {
7448
7449 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7450 IOStream *stream = ctx->m_stream;
7451 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7452 bool useChecksum = checksumCalculator->getVersion() > 0;
7453
7454 unsigned char *ptr;
7455 unsigned char *buf;
7456 const size_t sizeWithoutChecksum = 8;
7457 const size_t checksumSize = checksumCalculator->checksumByteSize();
7458 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7459 buf = stream->alloc(totalSize);
7460 ptr = buf;
7461 int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7462 memcpy(ptr, &totalSize, 4); ptr += 4;
7463
7464
7465 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7466 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7467
7468 }
7469
glResumeTransformFeedback_enc(void * self)7470 void glResumeTransformFeedback_enc(void *self )
7471 {
7472
7473 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7474 IOStream *stream = ctx->m_stream;
7475 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7476 bool useChecksum = checksumCalculator->getVersion() > 0;
7477
7478 unsigned char *ptr;
7479 unsigned char *buf;
7480 const size_t sizeWithoutChecksum = 8;
7481 const size_t checksumSize = checksumCalculator->checksumByteSize();
7482 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7483 buf = stream->alloc(totalSize);
7484 ptr = buf;
7485 int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7486 memcpy(ptr, &totalSize, 4); ptr += 4;
7487
7488
7489 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7490 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7491
7492 }
7493
glIsTransformFeedback_enc(void * self,GLuint id)7494 GLboolean glIsTransformFeedback_enc(void *self , GLuint id)
7495 {
7496
7497 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7498 IOStream *stream = ctx->m_stream;
7499 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7500 bool useChecksum = checksumCalculator->getVersion() > 0;
7501
7502 unsigned char *ptr;
7503 unsigned char *buf;
7504 const size_t sizeWithoutChecksum = 8 + 4;
7505 const size_t checksumSize = checksumCalculator->checksumByteSize();
7506 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7507 buf = stream->alloc(totalSize);
7508 ptr = buf;
7509 int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7510 memcpy(ptr, &totalSize, 4); ptr += 4;
7511
7512 memcpy(ptr, &id, 4); ptr += 4;
7513
7514 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7515 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7516
7517
7518 GLboolean retval;
7519 stream->readback(&retval, 1);
7520 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7521 if (useChecksum) {
7522 unsigned char *checksumBufPtr = NULL;
7523 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7524 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7525 stream->readback(checksumBufPtr, checksumSize);
7526 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7527 ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n");
7528 abort();
7529 }
7530 }
7531 return retval;
7532 }
7533
glTransformFeedbackVaryingsAEMU_enc(void * self,GLuint program,GLsizei count,const char * packedVaryings,GLuint packedVaryingsLen,GLenum bufferMode)7534 void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode)
7535 {
7536
7537 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7538 IOStream *stream = ctx->m_stream;
7539 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7540 bool useChecksum = checksumCalculator->getVersion() > 0;
7541
7542 const unsigned int __size_packedVaryings = packedVaryingsLen;
7543 unsigned char *ptr;
7544 unsigned char *buf;
7545 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4;
7546 const size_t checksumSize = checksumCalculator->checksumByteSize();
7547 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7548 buf = stream->alloc(totalSize);
7549 ptr = buf;
7550 int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
7551 memcpy(ptr, &totalSize, 4); ptr += 4;
7552
7553 memcpy(ptr, &program, 4); ptr += 4;
7554 memcpy(ptr, &count, 4); ptr += 4;
7555 *(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4;
7556 memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings;
7557 memcpy(ptr, &packedVaryingsLen, 4); ptr += 4;
7558 memcpy(ptr, &bufferMode, 4); ptr += 4;
7559
7560 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7561 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7562
7563 }
7564
glGetTransformFeedbackVarying_enc(void * self,GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,char * name)7565 void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name)
7566 {
7567
7568 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7569 IOStream *stream = ctx->m_stream;
7570 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7571 bool useChecksum = checksumCalculator->getVersion() > 0;
7572
7573 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
7574 const unsigned int __size_size = (sizeof(GLsizei));
7575 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
7576 const unsigned int __size_name = ((name != NULL) ? bufSize : 0);
7577 unsigned char *ptr;
7578 unsigned char *buf;
7579 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
7580 const size_t checksumSize = checksumCalculator->checksumByteSize();
7581 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7582 buf = stream->alloc(totalSize);
7583 ptr = buf;
7584 int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4;
7585 memcpy(ptr, &totalSize, 4); ptr += 4;
7586
7587 memcpy(ptr, &program, 4); ptr += 4;
7588 memcpy(ptr, &index, 4); ptr += 4;
7589 memcpy(ptr, &bufSize, 4); ptr += 4;
7590 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7591 *(unsigned int *)(ptr) = __size_size; ptr += 4;
7592 *(unsigned int *)(ptr) = __size_type; ptr += 4;
7593 *(unsigned int *)(ptr) = __size_name; ptr += 4;
7594
7595 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7596 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7597
7598 if (length != NULL) {
7599 stream->readback(length, __size_length);
7600 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7601 }
7602 stream->readback(size, __size_size);
7603 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
7604 if (type != NULL) {
7605 stream->readback(type, __size_type);
7606 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
7607 }
7608 if (name != NULL) {
7609 stream->readback(name, __size_name);
7610 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
7611 }
7612 if (useChecksum) {
7613 unsigned char *checksumBufPtr = NULL;
7614 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7615 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7616 stream->readback(checksumBufPtr, checksumSize);
7617 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7618 ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n");
7619 abort();
7620 }
7621 }
7622 }
7623
glGenSamplers_enc(void * self,GLsizei n,GLuint * samplers)7624 void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers)
7625 {
7626
7627 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7628 IOStream *stream = ctx->m_stream;
7629 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7630 bool useChecksum = checksumCalculator->getVersion() > 0;
7631
7632 const unsigned int __size_samplers = (n * sizeof(GLuint));
7633 unsigned char *ptr;
7634 unsigned char *buf;
7635 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7636 const size_t checksumSize = checksumCalculator->checksumByteSize();
7637 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7638 buf = stream->alloc(totalSize);
7639 ptr = buf;
7640 int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7641 memcpy(ptr, &totalSize, 4); ptr += 4;
7642
7643 memcpy(ptr, &n, 4); ptr += 4;
7644 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7645
7646 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7647 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7648
7649 stream->readback(samplers, __size_samplers);
7650 if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers);
7651 if (useChecksum) {
7652 unsigned char *checksumBufPtr = NULL;
7653 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7654 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7655 stream->readback(checksumBufPtr, checksumSize);
7656 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7657 ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n");
7658 abort();
7659 }
7660 }
7661 }
7662
glDeleteSamplers_enc(void * self,GLsizei n,const GLuint * samplers)7663 void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers)
7664 {
7665
7666 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7667 IOStream *stream = ctx->m_stream;
7668 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7669 bool useChecksum = checksumCalculator->getVersion() > 0;
7670
7671 const unsigned int __size_samplers = (n * sizeof(GLuint));
7672 unsigned char *ptr;
7673 unsigned char *buf;
7674 const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4;
7675 const size_t checksumSize = checksumCalculator->checksumByteSize();
7676 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7677 buf = stream->alloc(totalSize);
7678 ptr = buf;
7679 int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7680 memcpy(ptr, &totalSize, 4); ptr += 4;
7681
7682 memcpy(ptr, &n, 4); ptr += 4;
7683 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7684 memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers;
7685
7686 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7687 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7688
7689 }
7690
glBindSampler_enc(void * self,GLuint unit,GLuint sampler)7691 void glBindSampler_enc(void *self , GLuint unit, GLuint sampler)
7692 {
7693
7694 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7695 IOStream *stream = ctx->m_stream;
7696 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7697 bool useChecksum = checksumCalculator->getVersion() > 0;
7698
7699 unsigned char *ptr;
7700 unsigned char *buf;
7701 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7702 const size_t checksumSize = checksumCalculator->checksumByteSize();
7703 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7704 buf = stream->alloc(totalSize);
7705 ptr = buf;
7706 int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7707 memcpy(ptr, &totalSize, 4); ptr += 4;
7708
7709 memcpy(ptr, &unit, 4); ptr += 4;
7710 memcpy(ptr, &sampler, 4); ptr += 4;
7711
7712 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7713 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7714
7715 }
7716
glSamplerParameterf_enc(void * self,GLuint sampler,GLenum pname,GLfloat param)7717 void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param)
7718 {
7719
7720 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7721 IOStream *stream = ctx->m_stream;
7722 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7723 bool useChecksum = checksumCalculator->getVersion() > 0;
7724
7725 unsigned char *ptr;
7726 unsigned char *buf;
7727 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7728 const size_t checksumSize = checksumCalculator->checksumByteSize();
7729 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7730 buf = stream->alloc(totalSize);
7731 ptr = buf;
7732 int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
7733 memcpy(ptr, &totalSize, 4); ptr += 4;
7734
7735 memcpy(ptr, &sampler, 4); ptr += 4;
7736 memcpy(ptr, &pname, 4); ptr += 4;
7737 memcpy(ptr, ¶m, 4); ptr += 4;
7738
7739 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7740 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7741
7742 }
7743
glSamplerParameteri_enc(void * self,GLuint sampler,GLenum pname,GLint param)7744 void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param)
7745 {
7746
7747 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7748 IOStream *stream = ctx->m_stream;
7749 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7750 bool useChecksum = checksumCalculator->getVersion() > 0;
7751
7752 unsigned char *ptr;
7753 unsigned char *buf;
7754 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7755 const size_t checksumSize = checksumCalculator->checksumByteSize();
7756 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7757 buf = stream->alloc(totalSize);
7758 ptr = buf;
7759 int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
7760 memcpy(ptr, &totalSize, 4); ptr += 4;
7761
7762 memcpy(ptr, &sampler, 4); ptr += 4;
7763 memcpy(ptr, &pname, 4); ptr += 4;
7764 memcpy(ptr, ¶m, 4); ptr += 4;
7765
7766 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7767 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7768
7769 }
7770
glSamplerParameterfv_enc(void * self,GLuint sampler,GLenum pname,const GLfloat * params)7771 void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params)
7772 {
7773
7774 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7775 IOStream *stream = ctx->m_stream;
7776 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7777 bool useChecksum = checksumCalculator->getVersion() > 0;
7778
7779 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7780 unsigned char *ptr;
7781 unsigned char *buf;
7782 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7783 const size_t checksumSize = checksumCalculator->checksumByteSize();
7784 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7785 buf = stream->alloc(totalSize);
7786 ptr = buf;
7787 int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7788 memcpy(ptr, &totalSize, 4); ptr += 4;
7789
7790 memcpy(ptr, &sampler, 4); ptr += 4;
7791 memcpy(ptr, &pname, 4); ptr += 4;
7792 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7793 memcpy(ptr, params, __size_params);ptr += __size_params;
7794
7795 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7796 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7797
7798 }
7799
glSamplerParameteriv_enc(void * self,GLuint sampler,GLenum pname,const GLint * params)7800 void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params)
7801 {
7802
7803 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7804 IOStream *stream = ctx->m_stream;
7805 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7806 bool useChecksum = checksumCalculator->getVersion() > 0;
7807
7808 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7809 unsigned char *ptr;
7810 unsigned char *buf;
7811 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7812 const size_t checksumSize = checksumCalculator->checksumByteSize();
7813 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7814 buf = stream->alloc(totalSize);
7815 ptr = buf;
7816 int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7817 memcpy(ptr, &totalSize, 4); ptr += 4;
7818
7819 memcpy(ptr, &sampler, 4); ptr += 4;
7820 memcpy(ptr, &pname, 4); ptr += 4;
7821 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7822 memcpy(ptr, params, __size_params);ptr += __size_params;
7823
7824 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7825 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7826
7827 }
7828
glGetSamplerParameterfv_enc(void * self,GLuint sampler,GLenum pname,GLfloat * params)7829 void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params)
7830 {
7831
7832 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7833 IOStream *stream = ctx->m_stream;
7834 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7835 bool useChecksum = checksumCalculator->getVersion() > 0;
7836
7837 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7838 unsigned char *ptr;
7839 unsigned char *buf;
7840 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7841 const size_t checksumSize = checksumCalculator->checksumByteSize();
7842 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7843 buf = stream->alloc(totalSize);
7844 ptr = buf;
7845 int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7846 memcpy(ptr, &totalSize, 4); ptr += 4;
7847
7848 memcpy(ptr, &sampler, 4); ptr += 4;
7849 memcpy(ptr, &pname, 4); ptr += 4;
7850 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7851
7852 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7853 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7854
7855 stream->readback(params, __size_params);
7856 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7857 if (useChecksum) {
7858 unsigned char *checksumBufPtr = NULL;
7859 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7860 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7861 stream->readback(checksumBufPtr, checksumSize);
7862 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7863 ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n");
7864 abort();
7865 }
7866 }
7867 }
7868
glGetSamplerParameteriv_enc(void * self,GLuint sampler,GLenum pname,GLint * params)7869 void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params)
7870 {
7871
7872 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7873 IOStream *stream = ctx->m_stream;
7874 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7875 bool useChecksum = checksumCalculator->getVersion() > 0;
7876
7877 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7878 unsigned char *ptr;
7879 unsigned char *buf;
7880 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7881 const size_t checksumSize = checksumCalculator->checksumByteSize();
7882 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7883 buf = stream->alloc(totalSize);
7884 ptr = buf;
7885 int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7886 memcpy(ptr, &totalSize, 4); ptr += 4;
7887
7888 memcpy(ptr, &sampler, 4); ptr += 4;
7889 memcpy(ptr, &pname, 4); ptr += 4;
7890 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7891
7892 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7893 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7894
7895 stream->readback(params, __size_params);
7896 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7897 if (useChecksum) {
7898 unsigned char *checksumBufPtr = NULL;
7899 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7900 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7901 stream->readback(checksumBufPtr, checksumSize);
7902 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7903 ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n");
7904 abort();
7905 }
7906 }
7907 }
7908
glIsSampler_enc(void * self,GLuint sampler)7909 GLboolean glIsSampler_enc(void *self , GLuint sampler)
7910 {
7911
7912 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7913 IOStream *stream = ctx->m_stream;
7914 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7915 bool useChecksum = checksumCalculator->getVersion() > 0;
7916
7917 unsigned char *ptr;
7918 unsigned char *buf;
7919 const size_t sizeWithoutChecksum = 8 + 4;
7920 const size_t checksumSize = checksumCalculator->checksumByteSize();
7921 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7922 buf = stream->alloc(totalSize);
7923 ptr = buf;
7924 int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7925 memcpy(ptr, &totalSize, 4); ptr += 4;
7926
7927 memcpy(ptr, &sampler, 4); ptr += 4;
7928
7929 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7930 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7931
7932
7933 GLboolean retval;
7934 stream->readback(&retval, 1);
7935 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7936 if (useChecksum) {
7937 unsigned char *checksumBufPtr = NULL;
7938 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7939 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7940 stream->readback(checksumBufPtr, checksumSize);
7941 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7942 ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n");
7943 abort();
7944 }
7945 }
7946 return retval;
7947 }
7948
glGenQueries_enc(void * self,GLsizei n,GLuint * queries)7949 void glGenQueries_enc(void *self , GLsizei n, GLuint* queries)
7950 {
7951
7952 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7953 IOStream *stream = ctx->m_stream;
7954 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7955 bool useChecksum = checksumCalculator->getVersion() > 0;
7956
7957 const unsigned int __size_queries = (n * sizeof(GLuint));
7958 unsigned char *ptr;
7959 unsigned char *buf;
7960 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7961 const size_t checksumSize = checksumCalculator->checksumByteSize();
7962 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7963 buf = stream->alloc(totalSize);
7964 ptr = buf;
7965 int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4;
7966 memcpy(ptr, &totalSize, 4); ptr += 4;
7967
7968 memcpy(ptr, &n, 4); ptr += 4;
7969 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
7970
7971 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7972 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7973
7974 stream->readback(queries, __size_queries);
7975 if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries);
7976 if (useChecksum) {
7977 unsigned char *checksumBufPtr = NULL;
7978 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7979 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7980 stream->readback(checksumBufPtr, checksumSize);
7981 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7982 ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n");
7983 abort();
7984 }
7985 }
7986 }
7987
glDeleteQueries_enc(void * self,GLsizei n,const GLuint * queries)7988 void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries)
7989 {
7990
7991 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7992 IOStream *stream = ctx->m_stream;
7993 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7994 bool useChecksum = checksumCalculator->getVersion() > 0;
7995
7996 const unsigned int __size_queries = (n * sizeof(GLuint));
7997 unsigned char *ptr;
7998 unsigned char *buf;
7999 const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4;
8000 const size_t checksumSize = checksumCalculator->checksumByteSize();
8001 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8002 buf = stream->alloc(totalSize);
8003 ptr = buf;
8004 int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4;
8005 memcpy(ptr, &totalSize, 4); ptr += 4;
8006
8007 memcpy(ptr, &n, 4); ptr += 4;
8008 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
8009 memcpy(ptr, queries, __size_queries);ptr += __size_queries;
8010
8011 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8012 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8013
8014 }
8015
glBeginQuery_enc(void * self,GLenum target,GLuint query)8016 void glBeginQuery_enc(void *self , GLenum target, GLuint query)
8017 {
8018
8019 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8020 IOStream *stream = ctx->m_stream;
8021 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8022 bool useChecksum = checksumCalculator->getVersion() > 0;
8023
8024 unsigned char *ptr;
8025 unsigned char *buf;
8026 const size_t sizeWithoutChecksum = 8 + 4 + 4;
8027 const size_t checksumSize = checksumCalculator->checksumByteSize();
8028 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8029 buf = stream->alloc(totalSize);
8030 ptr = buf;
8031 int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8032 memcpy(ptr, &totalSize, 4); ptr += 4;
8033
8034 memcpy(ptr, &target, 4); ptr += 4;
8035 memcpy(ptr, &query, 4); ptr += 4;
8036
8037 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8038 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8039
8040 }
8041
glEndQuery_enc(void * self,GLenum target)8042 void glEndQuery_enc(void *self , GLenum target)
8043 {
8044
8045 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8046 IOStream *stream = ctx->m_stream;
8047 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8048 bool useChecksum = checksumCalculator->getVersion() > 0;
8049
8050 unsigned char *ptr;
8051 unsigned char *buf;
8052 const size_t sizeWithoutChecksum = 8 + 4;
8053 const size_t checksumSize = checksumCalculator->checksumByteSize();
8054 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8055 buf = stream->alloc(totalSize);
8056 ptr = buf;
8057 int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8058 memcpy(ptr, &totalSize, 4); ptr += 4;
8059
8060 memcpy(ptr, &target, 4); ptr += 4;
8061
8062 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8063 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8064
8065 }
8066
glGetQueryiv_enc(void * self,GLenum target,GLenum pname,GLint * params)8067 void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params)
8068 {
8069
8070 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8071 IOStream *stream = ctx->m_stream;
8072 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8073 bool useChecksum = checksumCalculator->getVersion() > 0;
8074
8075 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
8076 unsigned char *ptr;
8077 unsigned char *buf;
8078 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8079 const size_t checksumSize = checksumCalculator->checksumByteSize();
8080 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8081 buf = stream->alloc(totalSize);
8082 ptr = buf;
8083 int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4;
8084 memcpy(ptr, &totalSize, 4); ptr += 4;
8085
8086 memcpy(ptr, &target, 4); ptr += 4;
8087 memcpy(ptr, &pname, 4); ptr += 4;
8088 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8089
8090 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8091 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8092
8093 stream->readback(params, __size_params);
8094 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8095 if (useChecksum) {
8096 unsigned char *checksumBufPtr = NULL;
8097 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8098 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8099 stream->readback(checksumBufPtr, checksumSize);
8100 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8101 ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n");
8102 abort();
8103 }
8104 }
8105 }
8106
glGetQueryObjectuiv_enc(void * self,GLuint query,GLenum pname,GLuint * params)8107 void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params)
8108 {
8109
8110 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8111 IOStream *stream = ctx->m_stream;
8112 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8113 bool useChecksum = checksumCalculator->getVersion() > 0;
8114
8115 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
8116 unsigned char *ptr;
8117 unsigned char *buf;
8118 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8119 const size_t checksumSize = checksumCalculator->checksumByteSize();
8120 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8121 buf = stream->alloc(totalSize);
8122 ptr = buf;
8123 int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4;
8124 memcpy(ptr, &totalSize, 4); ptr += 4;
8125
8126 memcpy(ptr, &query, 4); ptr += 4;
8127 memcpy(ptr, &pname, 4); ptr += 4;
8128 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8129
8130 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8131 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8132
8133 stream->readback(params, __size_params);
8134 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8135 if (useChecksum) {
8136 unsigned char *checksumBufPtr = NULL;
8137 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8138 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8139 stream->readback(checksumBufPtr, checksumSize);
8140 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8141 ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n");
8142 abort();
8143 }
8144 }
8145 }
8146
glIsQuery_enc(void * self,GLuint query)8147 GLboolean glIsQuery_enc(void *self , GLuint query)
8148 {
8149
8150 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8151 IOStream *stream = ctx->m_stream;
8152 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8153 bool useChecksum = checksumCalculator->getVersion() > 0;
8154
8155 unsigned char *ptr;
8156 unsigned char *buf;
8157 const size_t sizeWithoutChecksum = 8 + 4;
8158 const size_t checksumSize = checksumCalculator->checksumByteSize();
8159 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8160 buf = stream->alloc(totalSize);
8161 ptr = buf;
8162 int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8163 memcpy(ptr, &totalSize, 4); ptr += 4;
8164
8165 memcpy(ptr, &query, 4); ptr += 4;
8166
8167 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8168 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8169
8170
8171 GLboolean retval;
8172 stream->readback(&retval, 1);
8173 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
8174 if (useChecksum) {
8175 unsigned char *checksumBufPtr = NULL;
8176 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8177 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8178 stream->readback(checksumBufPtr, checksumSize);
8179 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8180 ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n");
8181 abort();
8182 }
8183 }
8184 return retval;
8185 }
8186
glProgramParameteri_enc(void * self,GLuint program,GLenum pname,GLint value)8187 void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value)
8188 {
8189
8190 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8191 IOStream *stream = ctx->m_stream;
8192 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8193 bool useChecksum = checksumCalculator->getVersion() > 0;
8194
8195 unsigned char *ptr;
8196 unsigned char *buf;
8197 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
8198 const size_t checksumSize = checksumCalculator->checksumByteSize();
8199 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8200 buf = stream->alloc(totalSize);
8201 ptr = buf;
8202 int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
8203 memcpy(ptr, &totalSize, 4); ptr += 4;
8204
8205 memcpy(ptr, &program, 4); ptr += 4;
8206 memcpy(ptr, &pname, 4); ptr += 4;
8207 memcpy(ptr, &value, 4); ptr += 4;
8208
8209 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8210 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8211
8212 }
8213
glProgramBinary_enc(void * self,GLuint program,GLenum binaryFormat,const void * binary,GLsizei length)8214 void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length)
8215 {
8216
8217 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8218 IOStream *stream = ctx->m_stream;
8219 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8220 bool useChecksum = checksumCalculator->getVersion() > 0;
8221
8222 const unsigned int __size_binary = length;
8223 unsigned char *ptr;
8224 unsigned char *buf;
8225 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4;
8226 const size_t checksumSize = checksumCalculator->checksumByteSize();
8227 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8228 buf = stream->alloc(totalSize);
8229 ptr = buf;
8230 int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8231 memcpy(ptr, &totalSize, 4); ptr += 4;
8232
8233 memcpy(ptr, &program, 4); ptr += 4;
8234 memcpy(ptr, &binaryFormat, 4); ptr += 4;
8235 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8236 memcpy(ptr, binary, __size_binary);ptr += __size_binary;
8237 memcpy(ptr, &length, 4); ptr += 4;
8238
8239 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8240 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8241
8242 }
8243
glGetProgramBinary_enc(void * self,GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)8244 void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary)
8245 {
8246
8247 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8248 IOStream *stream = ctx->m_stream;
8249 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8250 bool useChecksum = checksumCalculator->getVersion() > 0;
8251
8252 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
8253 const unsigned int __size_binaryFormat = (sizeof(GLenum));
8254 const unsigned int __size_binary = bufSize;
8255 unsigned char *ptr;
8256 unsigned char *buf;
8257 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4;
8258 const size_t checksumSize = checksumCalculator->checksumByteSize();
8259 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8260 buf = stream->alloc(totalSize);
8261 ptr = buf;
8262 int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8263 memcpy(ptr, &totalSize, 4); ptr += 4;
8264
8265 memcpy(ptr, &program, 4); ptr += 4;
8266 memcpy(ptr, &bufSize, 4); ptr += 4;
8267 *(unsigned int *)(ptr) = __size_length; ptr += 4;
8268 *(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4;
8269 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8270
8271 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8272 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8273
8274 if (length != NULL) {
8275 stream->readback(length, __size_length);
8276 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
8277 }
8278 stream->readback(binaryFormat, __size_binaryFormat);
8279 if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat);
8280 stream->readback(binary, __size_binary);
8281 if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary);
8282 if (useChecksum) {
8283 unsigned char *checksumBufPtr = NULL;
8284 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8285 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8286 stream->readback(checksumBufPtr, checksumSize);
8287 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8288 ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n");
8289 abort();
8290 }
8291 }
8292 }
8293
glGetFragDataLocation_enc(void * self,GLuint program,const char * name)8294 GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name)
8295 {
8296
8297 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8298 IOStream *stream = ctx->m_stream;
8299 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8300 bool useChecksum = checksumCalculator->getVersion() > 0;
8301
8302 const unsigned int __size_name = (strlen(name) + 1);
8303 unsigned char *ptr;
8304 unsigned char *buf;
8305 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
8306 const size_t checksumSize = checksumCalculator->checksumByteSize();
8307 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8308 buf = stream->alloc(totalSize);
8309 ptr = buf;
8310 int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4;
8311 memcpy(ptr, &totalSize, 4); ptr += 4;
8312
8313 memcpy(ptr, &program, 4); ptr += 4;
8314 *(unsigned int *)(ptr) = __size_name; ptr += 4;
8315 memcpy(ptr, name, __size_name);ptr += __size_name;
8316
8317 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8318 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8319
8320
8321 GLint retval;
8322 stream->readback(&retval, 4);
8323 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
8324 if (useChecksum) {
8325 unsigned char *checksumBufPtr = NULL;
8326 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8327 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8328 stream->readback(checksumBufPtr, checksumSize);
8329 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8330 ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n");
8331 abort();
8332 }
8333 }
8334 return retval;
8335 }
8336
glGetInteger64v_enc(void * self,GLenum pname,GLint64 * data)8337 void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data)
8338 {
8339
8340 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8341 IOStream *stream = ctx->m_stream;
8342 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8343 bool useChecksum = checksumCalculator->getVersion() > 0;
8344
8345 const unsigned int __size_data = (glUtilsParamSize(pname) * sizeof(GLint64));
8346 unsigned char *ptr;
8347 unsigned char *buf;
8348 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8349 const size_t checksumSize = checksumCalculator->checksumByteSize();
8350 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8351 buf = stream->alloc(totalSize);
8352 ptr = buf;
8353 int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4;
8354 memcpy(ptr, &totalSize, 4); ptr += 4;
8355
8356 memcpy(ptr, &pname, 4); ptr += 4;
8357 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8358
8359 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8360 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8361
8362 stream->readback(data, __size_data);
8363 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8364 if (useChecksum) {
8365 unsigned char *checksumBufPtr = NULL;
8366 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8367 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8368 stream->readback(checksumBufPtr, checksumSize);
8369 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8370 ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n");
8371 abort();
8372 }
8373 }
8374 }
8375
glGetIntegeri_v_enc(void * self,GLenum target,GLuint index,GLint * data)8376 void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data)
8377 {
8378
8379 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8380 IOStream *stream = ctx->m_stream;
8381 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8382 bool useChecksum = checksumCalculator->getVersion() > 0;
8383
8384 const unsigned int __size_data = (sizeof(GLint));
8385 unsigned char *ptr;
8386 unsigned char *buf;
8387 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8388 const size_t checksumSize = checksumCalculator->checksumByteSize();
8389 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8390 buf = stream->alloc(totalSize);
8391 ptr = buf;
8392 int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4;
8393 memcpy(ptr, &totalSize, 4); ptr += 4;
8394
8395 memcpy(ptr, &target, 4); ptr += 4;
8396 memcpy(ptr, &index, 4); ptr += 4;
8397 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8398
8399 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8400 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8401
8402 stream->readback(data, __size_data);
8403 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8404 if (useChecksum) {
8405 unsigned char *checksumBufPtr = NULL;
8406 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8407 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8408 stream->readback(checksumBufPtr, checksumSize);
8409 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8410 ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n");
8411 abort();
8412 }
8413 }
8414 }
8415
glGetInteger64i_v_enc(void * self,GLenum target,GLuint index,GLint64 * data)8416 void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data)
8417 {
8418
8419 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8420 IOStream *stream = ctx->m_stream;
8421 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8422 bool useChecksum = checksumCalculator->getVersion() > 0;
8423
8424 const unsigned int __size_data = (sizeof(GLint64));
8425 unsigned char *ptr;
8426 unsigned char *buf;
8427 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8428 const size_t checksumSize = checksumCalculator->checksumByteSize();
8429 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8430 buf = stream->alloc(totalSize);
8431 ptr = buf;
8432 int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4;
8433 memcpy(ptr, &totalSize, 4); ptr += 4;
8434
8435 memcpy(ptr, &target, 4); ptr += 4;
8436 memcpy(ptr, &index, 4); ptr += 4;
8437 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8438
8439 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8440 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8441
8442 stream->readback(data, __size_data);
8443 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8444 if (useChecksum) {
8445 unsigned char *checksumBufPtr = NULL;
8446 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8447 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8448 stream->readback(checksumBufPtr, checksumSize);
8449 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8450 ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n");
8451 abort();
8452 }
8453 }
8454 }
8455
glTexImage3D_enc(void * self,GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,const GLvoid * data)8456 void glTexImage3D_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data)
8457 {
8458
8459 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8460 IOStream *stream = ctx->m_stream;
8461 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8462 bool useChecksum = checksumCalculator->getVersion() > 0;
8463
8464 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8465 unsigned char *ptr;
8466 unsigned char *buf;
8467 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8468 const size_t checksumSize = checksumCalculator->checksumByteSize();
8469 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8470 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8471 ptr = buf;
8472 int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8473 memcpy(ptr, &totalSize, 4); ptr += 4;
8474
8475 memcpy(ptr, &target, 4); ptr += 4;
8476 memcpy(ptr, &level, 4); ptr += 4;
8477 memcpy(ptr, &internalFormat, 4); ptr += 4;
8478 memcpy(ptr, &width, 4); ptr += 4;
8479 memcpy(ptr, &height, 4); ptr += 4;
8480 memcpy(ptr, &depth, 4); ptr += 4;
8481 memcpy(ptr, &border, 4); ptr += 4;
8482 memcpy(ptr, &format, 4); ptr += 4;
8483 memcpy(ptr, &type, 4); ptr += 4;
8484
8485 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8486 stream->flush();
8487 stream->writeFully(&__size_data,4);
8488 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8489 if (data != NULL) {
8490 stream->writeFully(data, __size_data);
8491 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8492 }
8493 buf = stream->alloc(checksumSize);
8494 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8495
8496 }
8497
glTexImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,GLuint offset)8498 void glTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLuint offset)
8499 {
8500
8501 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8502 IOStream *stream = ctx->m_stream;
8503 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8504 bool useChecksum = checksumCalculator->getVersion() > 0;
8505
8506 unsigned char *ptr;
8507 unsigned char *buf;
8508 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8509 const size_t checksumSize = checksumCalculator->checksumByteSize();
8510 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8511 buf = stream->alloc(totalSize);
8512 ptr = buf;
8513 int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8514 memcpy(ptr, &totalSize, 4); ptr += 4;
8515
8516 memcpy(ptr, &target, 4); ptr += 4;
8517 memcpy(ptr, &level, 4); ptr += 4;
8518 memcpy(ptr, &internalFormat, 4); ptr += 4;
8519 memcpy(ptr, &width, 4); ptr += 4;
8520 memcpy(ptr, &height, 4); ptr += 4;
8521 memcpy(ptr, &depth, 4); ptr += 4;
8522 memcpy(ptr, &border, 4); ptr += 4;
8523 memcpy(ptr, &format, 4); ptr += 4;
8524 memcpy(ptr, &type, 4); ptr += 4;
8525 memcpy(ptr, &offset, 4); ptr += 4;
8526
8527 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8528 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8529
8530 }
8531
glTexStorage3D_enc(void * self,GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)8532 void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
8533 {
8534
8535 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8536 IOStream *stream = ctx->m_stream;
8537 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8538 bool useChecksum = checksumCalculator->getVersion() > 0;
8539
8540 unsigned char *ptr;
8541 unsigned char *buf;
8542 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
8543 const size_t checksumSize = checksumCalculator->checksumByteSize();
8544 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8545 buf = stream->alloc(totalSize);
8546 ptr = buf;
8547 int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8548 memcpy(ptr, &totalSize, 4); ptr += 4;
8549
8550 memcpy(ptr, &target, 4); ptr += 4;
8551 memcpy(ptr, &levels, 4); ptr += 4;
8552 memcpy(ptr, &internalformat, 4); ptr += 4;
8553 memcpy(ptr, &width, 4); ptr += 4;
8554 memcpy(ptr, &height, 4); ptr += 4;
8555 memcpy(ptr, &depth, 4); ptr += 4;
8556
8557 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8558 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8559
8560 }
8561
glTexSubImage3D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,const GLvoid * data)8562 void glTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data)
8563 {
8564
8565 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8566 IOStream *stream = ctx->m_stream;
8567 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8568 bool useChecksum = checksumCalculator->getVersion() > 0;
8569
8570 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8571 unsigned char *ptr;
8572 unsigned char *buf;
8573 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8574 const size_t checksumSize = checksumCalculator->checksumByteSize();
8575 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8576 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8577 ptr = buf;
8578 int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8579 memcpy(ptr, &totalSize, 4); ptr += 4;
8580
8581 memcpy(ptr, &target, 4); ptr += 4;
8582 memcpy(ptr, &level, 4); ptr += 4;
8583 memcpy(ptr, &xoffset, 4); ptr += 4;
8584 memcpy(ptr, &yoffset, 4); ptr += 4;
8585 memcpy(ptr, &zoffset, 4); ptr += 4;
8586 memcpy(ptr, &width, 4); ptr += 4;
8587 memcpy(ptr, &height, 4); ptr += 4;
8588 memcpy(ptr, &depth, 4); ptr += 4;
8589 memcpy(ptr, &format, 4); ptr += 4;
8590 memcpy(ptr, &type, 4); ptr += 4;
8591
8592 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8593 stream->flush();
8594 stream->writeFully(&__size_data,4);
8595 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8596 if (data != NULL) {
8597 stream->writeFully(data, __size_data);
8598 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8599 }
8600 buf = stream->alloc(checksumSize);
8601 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8602
8603 }
8604
glTexSubImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLuint offset)8605 void glTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLuint offset)
8606 {
8607
8608 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8609 IOStream *stream = ctx->m_stream;
8610 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8611 bool useChecksum = checksumCalculator->getVersion() > 0;
8612
8613 unsigned char *ptr;
8614 unsigned char *buf;
8615 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8616 const size_t checksumSize = checksumCalculator->checksumByteSize();
8617 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8618 buf = stream->alloc(totalSize);
8619 ptr = buf;
8620 int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8621 memcpy(ptr, &totalSize, 4); ptr += 4;
8622
8623 memcpy(ptr, &target, 4); ptr += 4;
8624 memcpy(ptr, &level, 4); ptr += 4;
8625 memcpy(ptr, &xoffset, 4); ptr += 4;
8626 memcpy(ptr, &yoffset, 4); ptr += 4;
8627 memcpy(ptr, &zoffset, 4); ptr += 4;
8628 memcpy(ptr, &width, 4); ptr += 4;
8629 memcpy(ptr, &height, 4); ptr += 4;
8630 memcpy(ptr, &depth, 4); ptr += 4;
8631 memcpy(ptr, &format, 4); ptr += 4;
8632 memcpy(ptr, &type, 4); ptr += 4;
8633 memcpy(ptr, &offset, 4); ptr += 4;
8634
8635 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8636 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8637
8638 }
8639
glCompressedTexImage3D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)8640 void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
8641 {
8642
8643 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8644 IOStream *stream = ctx->m_stream;
8645 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8646 bool useChecksum = checksumCalculator->getVersion() > 0;
8647
8648 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8649 unsigned char *ptr;
8650 unsigned char *buf;
8651 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8652 const size_t checksumSize = checksumCalculator->checksumByteSize();
8653 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8654 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8655 ptr = buf;
8656 int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8657 memcpy(ptr, &totalSize, 4); ptr += 4;
8658
8659 memcpy(ptr, &target, 4); ptr += 4;
8660 memcpy(ptr, &level, 4); ptr += 4;
8661 memcpy(ptr, &internalformat, 4); ptr += 4;
8662 memcpy(ptr, &width, 4); ptr += 4;
8663 memcpy(ptr, &height, 4); ptr += 4;
8664 memcpy(ptr, &depth, 4); ptr += 4;
8665 memcpy(ptr, &border, 4); ptr += 4;
8666 memcpy(ptr, &imageSize, 4); ptr += 4;
8667
8668 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8669 stream->flush();
8670 stream->writeFully(&__size_data,4);
8671 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8672 if (data != NULL) {
8673 stream->writeFully(data, __size_data);
8674 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8675 }
8676 buf = stream->alloc(checksumSize);
8677 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8678
8679 }
8680
glCompressedTexImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,GLuint offset)8681 void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset)
8682 {
8683
8684 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8685 IOStream *stream = ctx->m_stream;
8686 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8687 bool useChecksum = checksumCalculator->getVersion() > 0;
8688
8689 unsigned char *ptr;
8690 unsigned char *buf;
8691 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8692 const size_t checksumSize = checksumCalculator->checksumByteSize();
8693 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8694 buf = stream->alloc(totalSize);
8695 ptr = buf;
8696 int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8697 memcpy(ptr, &totalSize, 4); ptr += 4;
8698
8699 memcpy(ptr, &target, 4); ptr += 4;
8700 memcpy(ptr, &level, 4); ptr += 4;
8701 memcpy(ptr, &internalformat, 4); ptr += 4;
8702 memcpy(ptr, &width, 4); ptr += 4;
8703 memcpy(ptr, &height, 4); ptr += 4;
8704 memcpy(ptr, &depth, 4); ptr += 4;
8705 memcpy(ptr, &border, 4); ptr += 4;
8706 memcpy(ptr, &imageSize, 4); ptr += 4;
8707 memcpy(ptr, &offset, 4); ptr += 4;
8708
8709 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8710 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8711
8712 }
8713
glCompressedTexSubImage3D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,const GLvoid * data)8714 void glCompressedTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
8715 {
8716
8717 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8718 IOStream *stream = ctx->m_stream;
8719 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8720 bool useChecksum = checksumCalculator->getVersion() > 0;
8721
8722 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8723 unsigned char *ptr;
8724 unsigned char *buf;
8725 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8726 const size_t checksumSize = checksumCalculator->checksumByteSize();
8727 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8728 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8729 ptr = buf;
8730 int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8731 memcpy(ptr, &totalSize, 4); ptr += 4;
8732
8733 memcpy(ptr, &target, 4); ptr += 4;
8734 memcpy(ptr, &level, 4); ptr += 4;
8735 memcpy(ptr, &xoffset, 4); ptr += 4;
8736 memcpy(ptr, &yoffset, 4); ptr += 4;
8737 memcpy(ptr, &zoffset, 4); ptr += 4;
8738 memcpy(ptr, &width, 4); ptr += 4;
8739 memcpy(ptr, &height, 4); ptr += 4;
8740 memcpy(ptr, &depth, 4); ptr += 4;
8741 memcpy(ptr, &format, 4); ptr += 4;
8742 memcpy(ptr, &imageSize, 4); ptr += 4;
8743
8744 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8745 stream->flush();
8746 stream->writeFully(&__size_data,4);
8747 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8748 if (data != NULL) {
8749 stream->writeFully(data, __size_data);
8750 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8751 }
8752 buf = stream->alloc(checksumSize);
8753 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8754
8755 }
8756
glCompressedTexSubImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLsizei imageSize,GLuint data)8757 void glCompressedTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLuint data)
8758 {
8759
8760 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8761 IOStream *stream = ctx->m_stream;
8762 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8763 bool useChecksum = checksumCalculator->getVersion() > 0;
8764
8765 unsigned char *ptr;
8766 unsigned char *buf;
8767 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8768 const size_t checksumSize = checksumCalculator->checksumByteSize();
8769 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8770 buf = stream->alloc(totalSize);
8771 ptr = buf;
8772 int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8773 memcpy(ptr, &totalSize, 4); ptr += 4;
8774
8775 memcpy(ptr, &target, 4); ptr += 4;
8776 memcpy(ptr, &level, 4); ptr += 4;
8777 memcpy(ptr, &xoffset, 4); ptr += 4;
8778 memcpy(ptr, &yoffset, 4); ptr += 4;
8779 memcpy(ptr, &zoffset, 4); ptr += 4;
8780 memcpy(ptr, &width, 4); ptr += 4;
8781 memcpy(ptr, &height, 4); ptr += 4;
8782 memcpy(ptr, &depth, 4); ptr += 4;
8783 memcpy(ptr, &format, 4); ptr += 4;
8784 memcpy(ptr, &imageSize, 4); ptr += 4;
8785 memcpy(ptr, &data, 4); ptr += 4;
8786
8787 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8788 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8789
8790 }
8791
glCopyTexSubImage3D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)8792 void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
8793 {
8794
8795 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8796 IOStream *stream = ctx->m_stream;
8797 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8798 bool useChecksum = checksumCalculator->getVersion() > 0;
8799
8800 unsigned char *ptr;
8801 unsigned char *buf;
8802 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8803 const size_t checksumSize = checksumCalculator->checksumByteSize();
8804 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8805 buf = stream->alloc(totalSize);
8806 ptr = buf;
8807 int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8808 memcpy(ptr, &totalSize, 4); ptr += 4;
8809
8810 memcpy(ptr, &target, 4); ptr += 4;
8811 memcpy(ptr, &level, 4); ptr += 4;
8812 memcpy(ptr, &xoffset, 4); ptr += 4;
8813 memcpy(ptr, &yoffset, 4); ptr += 4;
8814 memcpy(ptr, &zoffset, 4); ptr += 4;
8815 memcpy(ptr, &x, 4); ptr += 4;
8816 memcpy(ptr, &y, 4); ptr += 4;
8817 memcpy(ptr, &width, 4); ptr += 4;
8818 memcpy(ptr, &height, 4); ptr += 4;
8819
8820 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8821 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8822
8823 }
8824
glGetBooleani_v_enc(void * self,GLenum target,GLuint index,GLboolean * data)8825 void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data)
8826 {
8827
8828 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8829 IOStream *stream = ctx->m_stream;
8830 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8831 bool useChecksum = checksumCalculator->getVersion() > 0;
8832
8833 const unsigned int __size_data = (sizeof(GLboolean));
8834 unsigned char *ptr;
8835 unsigned char *buf;
8836 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8837 const size_t checksumSize = checksumCalculator->checksumByteSize();
8838 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8839 buf = stream->alloc(totalSize);
8840 ptr = buf;
8841 int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4;
8842 memcpy(ptr, &totalSize, 4); ptr += 4;
8843
8844 memcpy(ptr, &target, 4); ptr += 4;
8845 memcpy(ptr, &index, 4); ptr += 4;
8846 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8847
8848 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8849 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8850
8851 stream->readback(data, __size_data);
8852 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8853 if (useChecksum) {
8854 unsigned char *checksumBufPtr = NULL;
8855 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8856 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8857 stream->readback(checksumBufPtr, checksumSize);
8858 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8859 ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n");
8860 abort();
8861 }
8862 }
8863 }
8864
glMemoryBarrier_enc(void * self,GLbitfield barriers)8865 void glMemoryBarrier_enc(void *self , GLbitfield barriers)
8866 {
8867
8868 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8869 IOStream *stream = ctx->m_stream;
8870 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8871 bool useChecksum = checksumCalculator->getVersion() > 0;
8872
8873 unsigned char *ptr;
8874 unsigned char *buf;
8875 const size_t sizeWithoutChecksum = 8 + 4;
8876 const size_t checksumSize = checksumCalculator->checksumByteSize();
8877 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8878 buf = stream->alloc(totalSize);
8879 ptr = buf;
8880 int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4;
8881 memcpy(ptr, &totalSize, 4); ptr += 4;
8882
8883 memcpy(ptr, &barriers, 4); ptr += 4;
8884
8885 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8886 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8887
8888 }
8889
glMemoryBarrierByRegion_enc(void * self,GLbitfield barriers)8890 void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers)
8891 {
8892
8893 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8894 IOStream *stream = ctx->m_stream;
8895 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8896 bool useChecksum = checksumCalculator->getVersion() > 0;
8897
8898 unsigned char *ptr;
8899 unsigned char *buf;
8900 const size_t sizeWithoutChecksum = 8 + 4;
8901 const size_t checksumSize = checksumCalculator->checksumByteSize();
8902 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8903 buf = stream->alloc(totalSize);
8904 ptr = buf;
8905 int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4;
8906 memcpy(ptr, &totalSize, 4); ptr += 4;
8907
8908 memcpy(ptr, &barriers, 4); ptr += 4;
8909
8910 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8911 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8912
8913 }
8914
glGenProgramPipelines_enc(void * self,GLsizei n,GLuint * pipelines)8915 void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines)
8916 {
8917
8918 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8919 IOStream *stream = ctx->m_stream;
8920 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8921 bool useChecksum = checksumCalculator->getVersion() > 0;
8922
8923 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8924 unsigned char *ptr;
8925 unsigned char *buf;
8926 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8927 const size_t checksumSize = checksumCalculator->checksumByteSize();
8928 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8929 buf = stream->alloc(totalSize);
8930 ptr = buf;
8931 int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8932 memcpy(ptr, &totalSize, 4); ptr += 4;
8933
8934 memcpy(ptr, &n, 4); ptr += 4;
8935 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8936
8937 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8938 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8939
8940 stream->readback(pipelines, __size_pipelines);
8941 if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines);
8942 if (useChecksum) {
8943 unsigned char *checksumBufPtr = NULL;
8944 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8945 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8946 stream->readback(checksumBufPtr, checksumSize);
8947 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8948 ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n");
8949 abort();
8950 }
8951 }
8952 }
8953
glDeleteProgramPipelines_enc(void * self,GLsizei n,const GLuint * pipelines)8954 void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines)
8955 {
8956
8957 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8958 IOStream *stream = ctx->m_stream;
8959 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8960 bool useChecksum = checksumCalculator->getVersion() > 0;
8961
8962 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8963 unsigned char *ptr;
8964 unsigned char *buf;
8965 const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4;
8966 const size_t checksumSize = checksumCalculator->checksumByteSize();
8967 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8968 buf = stream->alloc(totalSize);
8969 ptr = buf;
8970 int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8971 memcpy(ptr, &totalSize, 4); ptr += 4;
8972
8973 memcpy(ptr, &n, 4); ptr += 4;
8974 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8975 memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines;
8976
8977 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8978 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8979
8980 }
8981
glBindProgramPipeline_enc(void * self,GLuint pipeline)8982 void glBindProgramPipeline_enc(void *self , GLuint pipeline)
8983 {
8984
8985 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8986 IOStream *stream = ctx->m_stream;
8987 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8988 bool useChecksum = checksumCalculator->getVersion() > 0;
8989
8990 unsigned char *ptr;
8991 unsigned char *buf;
8992 const size_t sizeWithoutChecksum = 8 + 4;
8993 const size_t checksumSize = checksumCalculator->checksumByteSize();
8994 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8995 buf = stream->alloc(totalSize);
8996 ptr = buf;
8997 int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
8998 memcpy(ptr, &totalSize, 4); ptr += 4;
8999
9000 memcpy(ptr, &pipeline, 4); ptr += 4;
9001
9002 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9003 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9004
9005 }
9006
glGetProgramPipelineiv_enc(void * self,GLuint pipeline,GLenum pname,GLint * params)9007 void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params)
9008 {
9009
9010 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9011 IOStream *stream = ctx->m_stream;
9012 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9013 bool useChecksum = checksumCalculator->getVersion() > 0;
9014
9015 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
9016 unsigned char *ptr;
9017 unsigned char *buf;
9018 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
9019 const size_t checksumSize = checksumCalculator->checksumByteSize();
9020 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9021 buf = stream->alloc(totalSize);
9022 ptr = buf;
9023 int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4;
9024 memcpy(ptr, &totalSize, 4); ptr += 4;
9025
9026 memcpy(ptr, &pipeline, 4); ptr += 4;
9027 memcpy(ptr, &pname, 4); ptr += 4;
9028 *(unsigned int *)(ptr) = __size_params; ptr += 4;
9029
9030 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9031 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9032
9033 stream->readback(params, __size_params);
9034 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
9035 if (useChecksum) {
9036 unsigned char *checksumBufPtr = NULL;
9037 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9038 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9039 stream->readback(checksumBufPtr, checksumSize);
9040 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9041 ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n");
9042 abort();
9043 }
9044 }
9045 }
9046
glGetProgramPipelineInfoLog_enc(void * self,GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)9047 void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog)
9048 {
9049
9050 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9051 IOStream *stream = ctx->m_stream;
9052 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9053 bool useChecksum = checksumCalculator->getVersion() > 0;
9054
9055 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
9056 const unsigned int __size_infoLog = bufSize;
9057 unsigned char *ptr;
9058 unsigned char *buf;
9059 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
9060 const size_t checksumSize = checksumCalculator->checksumByteSize();
9061 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9062 buf = stream->alloc(totalSize);
9063 ptr = buf;
9064 int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
9065 memcpy(ptr, &totalSize, 4); ptr += 4;
9066
9067 memcpy(ptr, &pipeline, 4); ptr += 4;
9068 memcpy(ptr, &bufSize, 4); ptr += 4;
9069 *(unsigned int *)(ptr) = __size_length; ptr += 4;
9070 *(unsigned int *)(ptr) = __size_infoLog; ptr += 4;
9071
9072 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9073 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9074
9075 if (length != NULL) {
9076 stream->readback(length, __size_length);
9077 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
9078 }
9079 stream->readback(infoLog, __size_infoLog);
9080 if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog);
9081 if (useChecksum) {
9082 unsigned char *checksumBufPtr = NULL;
9083 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9084 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9085 stream->readback(checksumBufPtr, checksumSize);
9086 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9087 ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n");
9088 abort();
9089 }
9090 }
9091 }
9092
glValidateProgramPipeline_enc(void * self,GLuint pipeline)9093 void glValidateProgramPipeline_enc(void *self , GLuint pipeline)
9094 {
9095
9096 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9097 IOStream *stream = ctx->m_stream;
9098 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9099 bool useChecksum = checksumCalculator->getVersion() > 0;
9100
9101 unsigned char *ptr;
9102 unsigned char *buf;
9103 const size_t sizeWithoutChecksum = 8 + 4;
9104 const size_t checksumSize = checksumCalculator->checksumByteSize();
9105 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9106 buf = stream->alloc(totalSize);
9107 ptr = buf;
9108 int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9109 memcpy(ptr, &totalSize, 4); ptr += 4;
9110
9111 memcpy(ptr, &pipeline, 4); ptr += 4;
9112
9113 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9114 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9115
9116 }
9117
glIsProgramPipeline_enc(void * self,GLuint pipeline)9118 GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline)
9119 {
9120
9121 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9122 IOStream *stream = ctx->m_stream;
9123 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9124 bool useChecksum = checksumCalculator->getVersion() > 0;
9125
9126 unsigned char *ptr;
9127 unsigned char *buf;
9128 const size_t sizeWithoutChecksum = 8 + 4;
9129 const size_t checksumSize = checksumCalculator->checksumByteSize();
9130 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9131 buf = stream->alloc(totalSize);
9132 ptr = buf;
9133 int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9134 memcpy(ptr, &totalSize, 4); ptr += 4;
9135
9136 memcpy(ptr, &pipeline, 4); ptr += 4;
9137
9138 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9139 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9140
9141
9142 GLboolean retval;
9143 stream->readback(&retval, 1);
9144 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
9145 if (useChecksum) {
9146 unsigned char *checksumBufPtr = NULL;
9147 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9148 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9149 stream->readback(checksumBufPtr, checksumSize);
9150 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9151 ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n");
9152 abort();
9153 }
9154 }
9155 return retval;
9156 }
9157
glUseProgramStages_enc(void * self,GLuint pipeline,GLbitfield stages,GLuint program)9158 void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program)
9159 {
9160
9161 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9162 IOStream *stream = ctx->m_stream;
9163 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9164 bool useChecksum = checksumCalculator->getVersion() > 0;
9165
9166 unsigned char *ptr;
9167 unsigned char *buf;
9168 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9169 const size_t checksumSize = checksumCalculator->checksumByteSize();
9170 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9171 buf = stream->alloc(totalSize);
9172 ptr = buf;
9173 int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4;
9174 memcpy(ptr, &totalSize, 4); ptr += 4;
9175
9176 memcpy(ptr, &pipeline, 4); ptr += 4;
9177 memcpy(ptr, &stages, 4); ptr += 4;
9178 memcpy(ptr, &program, 4); ptr += 4;
9179
9180 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9181 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9182
9183 }
9184
glActiveShaderProgram_enc(void * self,GLuint pipeline,GLuint program)9185 void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program)
9186 {
9187
9188 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9189 IOStream *stream = ctx->m_stream;
9190 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9191 bool useChecksum = checksumCalculator->getVersion() > 0;
9192
9193 unsigned char *ptr;
9194 unsigned char *buf;
9195 const size_t sizeWithoutChecksum = 8 + 4 + 4;
9196 const size_t checksumSize = checksumCalculator->checksumByteSize();
9197 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9198 buf = stream->alloc(totalSize);
9199 ptr = buf;
9200 int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4;
9201 memcpy(ptr, &totalSize, 4); ptr += 4;
9202
9203 memcpy(ptr, &pipeline, 4); ptr += 4;
9204 memcpy(ptr, &program, 4); ptr += 4;
9205
9206 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9207 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9208
9209 }
9210
glCreateShaderProgramvAEMU_enc(void * self,GLenum type,GLsizei count,const char * packedStrings,GLuint packedLen)9211 GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen)
9212 {
9213
9214 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9215 IOStream *stream = ctx->m_stream;
9216 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9217 bool useChecksum = checksumCalculator->getVersion() > 0;
9218
9219 const unsigned int __size_packedStrings = packedLen;
9220 unsigned char *ptr;
9221 unsigned char *buf;
9222 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4;
9223 const size_t checksumSize = checksumCalculator->checksumByteSize();
9224 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9225 buf = stream->alloc(totalSize);
9226 ptr = buf;
9227 int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
9228 memcpy(ptr, &totalSize, 4); ptr += 4;
9229
9230 memcpy(ptr, &type, 4); ptr += 4;
9231 memcpy(ptr, &count, 4); ptr += 4;
9232 *(unsigned int *)(ptr) = __size_packedStrings; ptr += 4;
9233 memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings;
9234 memcpy(ptr, &packedLen, 4); ptr += 4;
9235
9236 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9237 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9238
9239
9240 GLuint retval;
9241 stream->readback(&retval, 4);
9242 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
9243 if (useChecksum) {
9244 unsigned char *checksumBufPtr = NULL;
9245 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9246 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9247 stream->readback(checksumBufPtr, checksumSize);
9248 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9249 ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n");
9250 abort();
9251 }
9252 }
9253 return retval;
9254 }
9255
glProgramUniform1f_enc(void * self,GLuint program,GLint location,GLfloat v0)9256 void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0)
9257 {
9258
9259 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9260 IOStream *stream = ctx->m_stream;
9261 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9262 bool useChecksum = checksumCalculator->getVersion() > 0;
9263
9264 unsigned char *ptr;
9265 unsigned char *buf;
9266 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9267 const size_t checksumSize = checksumCalculator->checksumByteSize();
9268 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9269 buf = stream->alloc(totalSize);
9270 ptr = buf;
9271 int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
9272 memcpy(ptr, &totalSize, 4); ptr += 4;
9273
9274 memcpy(ptr, &program, 4); ptr += 4;
9275 memcpy(ptr, &location, 4); ptr += 4;
9276 memcpy(ptr, &v0, 4); ptr += 4;
9277
9278 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9279 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9280
9281 }
9282
glProgramUniform2f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1)9283 void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1)
9284 {
9285
9286 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9287 IOStream *stream = ctx->m_stream;
9288 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9289 bool useChecksum = checksumCalculator->getVersion() > 0;
9290
9291 unsigned char *ptr;
9292 unsigned char *buf;
9293 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9294 const size_t checksumSize = checksumCalculator->checksumByteSize();
9295 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9296 buf = stream->alloc(totalSize);
9297 ptr = buf;
9298 int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
9299 memcpy(ptr, &totalSize, 4); ptr += 4;
9300
9301 memcpy(ptr, &program, 4); ptr += 4;
9302 memcpy(ptr, &location, 4); ptr += 4;
9303 memcpy(ptr, &v0, 4); ptr += 4;
9304 memcpy(ptr, &v1, 4); ptr += 4;
9305
9306 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9307 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9308
9309 }
9310
glProgramUniform3f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)9311 void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
9312 {
9313
9314 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9315 IOStream *stream = ctx->m_stream;
9316 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9317 bool useChecksum = checksumCalculator->getVersion() > 0;
9318
9319 unsigned char *ptr;
9320 unsigned char *buf;
9321 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9322 const size_t checksumSize = checksumCalculator->checksumByteSize();
9323 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9324 buf = stream->alloc(totalSize);
9325 ptr = buf;
9326 int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
9327 memcpy(ptr, &totalSize, 4); ptr += 4;
9328
9329 memcpy(ptr, &program, 4); ptr += 4;
9330 memcpy(ptr, &location, 4); ptr += 4;
9331 memcpy(ptr, &v0, 4); ptr += 4;
9332 memcpy(ptr, &v1, 4); ptr += 4;
9333 memcpy(ptr, &v2, 4); ptr += 4;
9334
9335 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9336 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9337
9338 }
9339
glProgramUniform4f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)9340 void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
9341 {
9342
9343 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9344 IOStream *stream = ctx->m_stream;
9345 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9346 bool useChecksum = checksumCalculator->getVersion() > 0;
9347
9348 unsigned char *ptr;
9349 unsigned char *buf;
9350 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9351 const size_t checksumSize = checksumCalculator->checksumByteSize();
9352 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9353 buf = stream->alloc(totalSize);
9354 ptr = buf;
9355 int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
9356 memcpy(ptr, &totalSize, 4); ptr += 4;
9357
9358 memcpy(ptr, &program, 4); ptr += 4;
9359 memcpy(ptr, &location, 4); ptr += 4;
9360 memcpy(ptr, &v0, 4); ptr += 4;
9361 memcpy(ptr, &v1, 4); ptr += 4;
9362 memcpy(ptr, &v2, 4); ptr += 4;
9363 memcpy(ptr, &v3, 4); ptr += 4;
9364
9365 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9366 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9367
9368 }
9369
glProgramUniform1i_enc(void * self,GLuint program,GLint location,GLint v0)9370 void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0)
9371 {
9372
9373 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9374 IOStream *stream = ctx->m_stream;
9375 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9376 bool useChecksum = checksumCalculator->getVersion() > 0;
9377
9378 unsigned char *ptr;
9379 unsigned char *buf;
9380 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9381 const size_t checksumSize = checksumCalculator->checksumByteSize();
9382 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9383 buf = stream->alloc(totalSize);
9384 ptr = buf;
9385 int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
9386 memcpy(ptr, &totalSize, 4); ptr += 4;
9387
9388 memcpy(ptr, &program, 4); ptr += 4;
9389 memcpy(ptr, &location, 4); ptr += 4;
9390 memcpy(ptr, &v0, 4); ptr += 4;
9391
9392 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9393 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9394
9395 }
9396
glProgramUniform2i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1)9397 void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1)
9398 {
9399
9400 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9401 IOStream *stream = ctx->m_stream;
9402 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9403 bool useChecksum = checksumCalculator->getVersion() > 0;
9404
9405 unsigned char *ptr;
9406 unsigned char *buf;
9407 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9408 const size_t checksumSize = checksumCalculator->checksumByteSize();
9409 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9410 buf = stream->alloc(totalSize);
9411 ptr = buf;
9412 int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
9413 memcpy(ptr, &totalSize, 4); ptr += 4;
9414
9415 memcpy(ptr, &program, 4); ptr += 4;
9416 memcpy(ptr, &location, 4); ptr += 4;
9417 memcpy(ptr, &v0, 4); ptr += 4;
9418 memcpy(ptr, &v1, 4); ptr += 4;
9419
9420 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9421 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9422
9423 }
9424
glProgramUniform3i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2)9425 void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
9426 {
9427
9428 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9429 IOStream *stream = ctx->m_stream;
9430 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9431 bool useChecksum = checksumCalculator->getVersion() > 0;
9432
9433 unsigned char *ptr;
9434 unsigned char *buf;
9435 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9436 const size_t checksumSize = checksumCalculator->checksumByteSize();
9437 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9438 buf = stream->alloc(totalSize);
9439 ptr = buf;
9440 int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
9441 memcpy(ptr, &totalSize, 4); ptr += 4;
9442
9443 memcpy(ptr, &program, 4); ptr += 4;
9444 memcpy(ptr, &location, 4); ptr += 4;
9445 memcpy(ptr, &v0, 4); ptr += 4;
9446 memcpy(ptr, &v1, 4); ptr += 4;
9447 memcpy(ptr, &v2, 4); ptr += 4;
9448
9449 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9450 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9451
9452 }
9453
glProgramUniform4i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)9454 void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
9455 {
9456
9457 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9458 IOStream *stream = ctx->m_stream;
9459 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9460 bool useChecksum = checksumCalculator->getVersion() > 0;
9461
9462 unsigned char *ptr;
9463 unsigned char *buf;
9464 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9465 const size_t checksumSize = checksumCalculator->checksumByteSize();
9466 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9467 buf = stream->alloc(totalSize);
9468 ptr = buf;
9469 int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
9470 memcpy(ptr, &totalSize, 4); ptr += 4;
9471
9472 memcpy(ptr, &program, 4); ptr += 4;
9473 memcpy(ptr, &location, 4); ptr += 4;
9474 memcpy(ptr, &v0, 4); ptr += 4;
9475 memcpy(ptr, &v1, 4); ptr += 4;
9476 memcpy(ptr, &v2, 4); ptr += 4;
9477 memcpy(ptr, &v3, 4); ptr += 4;
9478
9479 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9480 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9481
9482 }
9483
glProgramUniform1ui_enc(void * self,GLuint program,GLint location,GLuint v0)9484 void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0)
9485 {
9486
9487 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9488 IOStream *stream = ctx->m_stream;
9489 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9490 bool useChecksum = checksumCalculator->getVersion() > 0;
9491
9492 unsigned char *ptr;
9493 unsigned char *buf;
9494 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9495 const size_t checksumSize = checksumCalculator->checksumByteSize();
9496 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9497 buf = stream->alloc(totalSize);
9498 ptr = buf;
9499 int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
9500 memcpy(ptr, &totalSize, 4); ptr += 4;
9501
9502 memcpy(ptr, &program, 4); ptr += 4;
9503 memcpy(ptr, &location, 4); ptr += 4;
9504 memcpy(ptr, &v0, 4); ptr += 4;
9505
9506 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9507 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9508
9509 }
9510
glProgramUniform2ui_enc(void * self,GLuint program,GLint location,GLint v0,GLuint v1)9511 void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1)
9512 {
9513
9514 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9515 IOStream *stream = ctx->m_stream;
9516 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9517 bool useChecksum = checksumCalculator->getVersion() > 0;
9518
9519 unsigned char *ptr;
9520 unsigned char *buf;
9521 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9522 const size_t checksumSize = checksumCalculator->checksumByteSize();
9523 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9524 buf = stream->alloc(totalSize);
9525 ptr = buf;
9526 int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
9527 memcpy(ptr, &totalSize, 4); ptr += 4;
9528
9529 memcpy(ptr, &program, 4); ptr += 4;
9530 memcpy(ptr, &location, 4); ptr += 4;
9531 memcpy(ptr, &v0, 4); ptr += 4;
9532 memcpy(ptr, &v1, 4); ptr += 4;
9533
9534 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9535 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9536
9537 }
9538
glProgramUniform3ui_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLuint v2)9539 void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
9540 {
9541
9542 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9543 IOStream *stream = ctx->m_stream;
9544 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9545 bool useChecksum = checksumCalculator->getVersion() > 0;
9546
9547 unsigned char *ptr;
9548 unsigned char *buf;
9549 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9550 const size_t checksumSize = checksumCalculator->checksumByteSize();
9551 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9552 buf = stream->alloc(totalSize);
9553 ptr = buf;
9554 int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
9555 memcpy(ptr, &totalSize, 4); ptr += 4;
9556
9557 memcpy(ptr, &program, 4); ptr += 4;
9558 memcpy(ptr, &location, 4); ptr += 4;
9559 memcpy(ptr, &v0, 4); ptr += 4;
9560 memcpy(ptr, &v1, 4); ptr += 4;
9561 memcpy(ptr, &v2, 4); ptr += 4;
9562
9563 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9564 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9565
9566 }
9567
glProgramUniform4ui_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLuint v3)9568 void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
9569 {
9570
9571 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9572 IOStream *stream = ctx->m_stream;
9573 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9574 bool useChecksum = checksumCalculator->getVersion() > 0;
9575
9576 unsigned char *ptr;
9577 unsigned char *buf;
9578 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9579 const size_t checksumSize = checksumCalculator->checksumByteSize();
9580 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9581 buf = stream->alloc(totalSize);
9582 ptr = buf;
9583 int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
9584 memcpy(ptr, &totalSize, 4); ptr += 4;
9585
9586 memcpy(ptr, &program, 4); ptr += 4;
9587 memcpy(ptr, &location, 4); ptr += 4;
9588 memcpy(ptr, &v0, 4); ptr += 4;
9589 memcpy(ptr, &v1, 4); ptr += 4;
9590 memcpy(ptr, &v2, 4); ptr += 4;
9591 memcpy(ptr, &v3, 4); ptr += 4;
9592
9593 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9594 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9595
9596 }
9597
glProgramUniform1fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9598 void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9599 {
9600
9601 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9602 IOStream *stream = ctx->m_stream;
9603 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9604 bool useChecksum = checksumCalculator->getVersion() > 0;
9605
9606 const unsigned int __size_value = (count * sizeof(GLfloat));
9607 unsigned char *ptr;
9608 unsigned char *buf;
9609 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9610 const size_t checksumSize = checksumCalculator->checksumByteSize();
9611 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9612 buf = stream->alloc(totalSize);
9613 ptr = buf;
9614 int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
9615 memcpy(ptr, &totalSize, 4); ptr += 4;
9616
9617 memcpy(ptr, &program, 4); ptr += 4;
9618 memcpy(ptr, &location, 4); ptr += 4;
9619 memcpy(ptr, &count, 4); ptr += 4;
9620 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9621 memcpy(ptr, value, __size_value);ptr += __size_value;
9622
9623 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9624 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9625
9626 }
9627
glProgramUniform2fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9628 void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9629 {
9630
9631 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9632 IOStream *stream = ctx->m_stream;
9633 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9634 bool useChecksum = checksumCalculator->getVersion() > 0;
9635
9636 const unsigned int __size_value = (count * 2 * sizeof(GLfloat));
9637 unsigned char *ptr;
9638 unsigned char *buf;
9639 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9640 const size_t checksumSize = checksumCalculator->checksumByteSize();
9641 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9642 buf = stream->alloc(totalSize);
9643 ptr = buf;
9644 int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9645 memcpy(ptr, &totalSize, 4); ptr += 4;
9646
9647 memcpy(ptr, &program, 4); ptr += 4;
9648 memcpy(ptr, &location, 4); ptr += 4;
9649 memcpy(ptr, &count, 4); ptr += 4;
9650 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9651 memcpy(ptr, value, __size_value);ptr += __size_value;
9652
9653 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9654 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9655
9656 }
9657
glProgramUniform3fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9658 void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9659 {
9660
9661 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9662 IOStream *stream = ctx->m_stream;
9663 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9664 bool useChecksum = checksumCalculator->getVersion() > 0;
9665
9666 const unsigned int __size_value = (count * 3 * sizeof(GLfloat));
9667 unsigned char *ptr;
9668 unsigned char *buf;
9669 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9670 const size_t checksumSize = checksumCalculator->checksumByteSize();
9671 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9672 buf = stream->alloc(totalSize);
9673 ptr = buf;
9674 int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
9675 memcpy(ptr, &totalSize, 4); ptr += 4;
9676
9677 memcpy(ptr, &program, 4); ptr += 4;
9678 memcpy(ptr, &location, 4); ptr += 4;
9679 memcpy(ptr, &count, 4); ptr += 4;
9680 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9681 memcpy(ptr, value, __size_value);ptr += __size_value;
9682
9683 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9684 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9685
9686 }
9687
glProgramUniform4fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9688 void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9689 {
9690
9691 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9692 IOStream *stream = ctx->m_stream;
9693 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9694 bool useChecksum = checksumCalculator->getVersion() > 0;
9695
9696 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
9697 unsigned char *ptr;
9698 unsigned char *buf;
9699 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9700 const size_t checksumSize = checksumCalculator->checksumByteSize();
9701 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9702 buf = stream->alloc(totalSize);
9703 ptr = buf;
9704 int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
9705 memcpy(ptr, &totalSize, 4); ptr += 4;
9706
9707 memcpy(ptr, &program, 4); ptr += 4;
9708 memcpy(ptr, &location, 4); ptr += 4;
9709 memcpy(ptr, &count, 4); ptr += 4;
9710 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9711 memcpy(ptr, value, __size_value);ptr += __size_value;
9712
9713 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9714 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9715
9716 }
9717
glProgramUniform1iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9718 void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9719 {
9720
9721 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9722 IOStream *stream = ctx->m_stream;
9723 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9724 bool useChecksum = checksumCalculator->getVersion() > 0;
9725
9726 const unsigned int __size_value = (count * sizeof(GLint));
9727 unsigned char *ptr;
9728 unsigned char *buf;
9729 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9730 const size_t checksumSize = checksumCalculator->checksumByteSize();
9731 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9732 buf = stream->alloc(totalSize);
9733 ptr = buf;
9734 int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
9735 memcpy(ptr, &totalSize, 4); ptr += 4;
9736
9737 memcpy(ptr, &program, 4); ptr += 4;
9738 memcpy(ptr, &location, 4); ptr += 4;
9739 memcpy(ptr, &count, 4); ptr += 4;
9740 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9741 memcpy(ptr, value, __size_value);ptr += __size_value;
9742
9743 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9744 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9745
9746 }
9747
glProgramUniform2iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9748 void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9749 {
9750
9751 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9752 IOStream *stream = ctx->m_stream;
9753 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9754 bool useChecksum = checksumCalculator->getVersion() > 0;
9755
9756 const unsigned int __size_value = (count * 2 * sizeof(GLint));
9757 unsigned char *ptr;
9758 unsigned char *buf;
9759 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9760 const size_t checksumSize = checksumCalculator->checksumByteSize();
9761 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9762 buf = stream->alloc(totalSize);
9763 ptr = buf;
9764 int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
9765 memcpy(ptr, &totalSize, 4); ptr += 4;
9766
9767 memcpy(ptr, &program, 4); ptr += 4;
9768 memcpy(ptr, &location, 4); ptr += 4;
9769 memcpy(ptr, &count, 4); ptr += 4;
9770 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9771 memcpy(ptr, value, __size_value);ptr += __size_value;
9772
9773 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9774 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9775
9776 }
9777
glProgramUniform3iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9778 void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9779 {
9780
9781 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9782 IOStream *stream = ctx->m_stream;
9783 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9784 bool useChecksum = checksumCalculator->getVersion() > 0;
9785
9786 const unsigned int __size_value = (count * 3 * sizeof(GLint));
9787 unsigned char *ptr;
9788 unsigned char *buf;
9789 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9790 const size_t checksumSize = checksumCalculator->checksumByteSize();
9791 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9792 buf = stream->alloc(totalSize);
9793 ptr = buf;
9794 int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
9795 memcpy(ptr, &totalSize, 4); ptr += 4;
9796
9797 memcpy(ptr, &program, 4); ptr += 4;
9798 memcpy(ptr, &location, 4); ptr += 4;
9799 memcpy(ptr, &count, 4); ptr += 4;
9800 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9801 memcpy(ptr, value, __size_value);ptr += __size_value;
9802
9803 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9804 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9805
9806 }
9807
glProgramUniform4iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9808 void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9809 {
9810
9811 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9812 IOStream *stream = ctx->m_stream;
9813 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9814 bool useChecksum = checksumCalculator->getVersion() > 0;
9815
9816 const unsigned int __size_value = (count * 4 * sizeof(GLint));
9817 unsigned char *ptr;
9818 unsigned char *buf;
9819 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9820 const size_t checksumSize = checksumCalculator->checksumByteSize();
9821 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9822 buf = stream->alloc(totalSize);
9823 ptr = buf;
9824 int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
9825 memcpy(ptr, &totalSize, 4); ptr += 4;
9826
9827 memcpy(ptr, &program, 4); ptr += 4;
9828 memcpy(ptr, &location, 4); ptr += 4;
9829 memcpy(ptr, &count, 4); ptr += 4;
9830 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9831 memcpy(ptr, value, __size_value);ptr += __size_value;
9832
9833 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9834 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9835
9836 }
9837
glProgramUniform1uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9838 void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9839 {
9840
9841 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9842 IOStream *stream = ctx->m_stream;
9843 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9844 bool useChecksum = checksumCalculator->getVersion() > 0;
9845
9846 const unsigned int __size_value = (count * sizeof(GLuint));
9847 unsigned char *ptr;
9848 unsigned char *buf;
9849 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9850 const size_t checksumSize = checksumCalculator->checksumByteSize();
9851 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9852 buf = stream->alloc(totalSize);
9853 ptr = buf;
9854 int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9855 memcpy(ptr, &totalSize, 4); ptr += 4;
9856
9857 memcpy(ptr, &program, 4); ptr += 4;
9858 memcpy(ptr, &location, 4); ptr += 4;
9859 memcpy(ptr, &count, 4); ptr += 4;
9860 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9861 memcpy(ptr, value, __size_value);ptr += __size_value;
9862
9863 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9864 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9865
9866 }
9867
glProgramUniform2uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9868 void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9869 {
9870
9871 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9872 IOStream *stream = ctx->m_stream;
9873 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9874 bool useChecksum = checksumCalculator->getVersion() > 0;
9875
9876 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
9877 unsigned char *ptr;
9878 unsigned char *buf;
9879 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9880 const size_t checksumSize = checksumCalculator->checksumByteSize();
9881 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9882 buf = stream->alloc(totalSize);
9883 ptr = buf;
9884 int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9885 memcpy(ptr, &totalSize, 4); ptr += 4;
9886
9887 memcpy(ptr, &program, 4); ptr += 4;
9888 memcpy(ptr, &location, 4); ptr += 4;
9889 memcpy(ptr, &count, 4); ptr += 4;
9890 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9891 memcpy(ptr, value, __size_value);ptr += __size_value;
9892
9893 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9894 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9895
9896 }
9897
glProgramUniform3uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9898 void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9899 {
9900
9901 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9902 IOStream *stream = ctx->m_stream;
9903 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9904 bool useChecksum = checksumCalculator->getVersion() > 0;
9905
9906 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
9907 unsigned char *ptr;
9908 unsigned char *buf;
9909 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9910 const size_t checksumSize = checksumCalculator->checksumByteSize();
9911 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9912 buf = stream->alloc(totalSize);
9913 ptr = buf;
9914 int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9915 memcpy(ptr, &totalSize, 4); ptr += 4;
9916
9917 memcpy(ptr, &program, 4); ptr += 4;
9918 memcpy(ptr, &location, 4); ptr += 4;
9919 memcpy(ptr, &count, 4); ptr += 4;
9920 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9921 memcpy(ptr, value, __size_value);ptr += __size_value;
9922
9923 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9924 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9925
9926 }
9927
glProgramUniform4uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9928 void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9929 {
9930
9931 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9932 IOStream *stream = ctx->m_stream;
9933 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9934 bool useChecksum = checksumCalculator->getVersion() > 0;
9935
9936 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
9937 unsigned char *ptr;
9938 unsigned char *buf;
9939 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9940 const size_t checksumSize = checksumCalculator->checksumByteSize();
9941 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9942 buf = stream->alloc(totalSize);
9943 ptr = buf;
9944 int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9945 memcpy(ptr, &totalSize, 4); ptr += 4;
9946
9947 memcpy(ptr, &program, 4); ptr += 4;
9948 memcpy(ptr, &location, 4); ptr += 4;
9949 memcpy(ptr, &count, 4); ptr += 4;
9950 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9951 memcpy(ptr, value, __size_value);ptr += __size_value;
9952
9953 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9954 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9955
9956 }
9957
glProgramUniformMatrix2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9958 void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9959 {
9960
9961 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9962 IOStream *stream = ctx->m_stream;
9963 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9964 bool useChecksum = checksumCalculator->getVersion() > 0;
9965
9966 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
9967 unsigned char *ptr;
9968 unsigned char *buf;
9969 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
9970 const size_t checksumSize = checksumCalculator->checksumByteSize();
9971 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9972 buf = stream->alloc(totalSize);
9973 ptr = buf;
9974 int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9975 memcpy(ptr, &totalSize, 4); ptr += 4;
9976
9977 memcpy(ptr, &program, 4); ptr += 4;
9978 memcpy(ptr, &location, 4); ptr += 4;
9979 memcpy(ptr, &count, 4); ptr += 4;
9980 memcpy(ptr, &transpose, 1); ptr += 1;
9981 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9982 memcpy(ptr, value, __size_value);ptr += __size_value;
9983
9984 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9985 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9986
9987 }
9988
glProgramUniformMatrix3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9989 void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9990 {
9991
9992 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9993 IOStream *stream = ctx->m_stream;
9994 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9995 bool useChecksum = checksumCalculator->getVersion() > 0;
9996
9997 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
9998 unsigned char *ptr;
9999 unsigned char *buf;
10000 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10001 const size_t checksumSize = checksumCalculator->checksumByteSize();
10002 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10003 buf = stream->alloc(totalSize);
10004 ptr = buf;
10005 int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10006 memcpy(ptr, &totalSize, 4); ptr += 4;
10007
10008 memcpy(ptr, &program, 4); ptr += 4;
10009 memcpy(ptr, &location, 4); ptr += 4;
10010 memcpy(ptr, &count, 4); ptr += 4;
10011 memcpy(ptr, &transpose, 1); ptr += 1;
10012 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10013 memcpy(ptr, value, __size_value);ptr += __size_value;
10014
10015 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10016 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10017
10018 }
10019
glProgramUniformMatrix4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10020 void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10021 {
10022
10023 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10024 IOStream *stream = ctx->m_stream;
10025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10026 bool useChecksum = checksumCalculator->getVersion() > 0;
10027
10028 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
10029 unsigned char *ptr;
10030 unsigned char *buf;
10031 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10032 const size_t checksumSize = checksumCalculator->checksumByteSize();
10033 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10034 buf = stream->alloc(totalSize);
10035 ptr = buf;
10036 int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10037 memcpy(ptr, &totalSize, 4); ptr += 4;
10038
10039 memcpy(ptr, &program, 4); ptr += 4;
10040 memcpy(ptr, &location, 4); ptr += 4;
10041 memcpy(ptr, &count, 4); ptr += 4;
10042 memcpy(ptr, &transpose, 1); ptr += 1;
10043 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10044 memcpy(ptr, value, __size_value);ptr += __size_value;
10045
10046 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10047 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10048
10049 }
10050
glProgramUniformMatrix2x3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10051 void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10052 {
10053
10054 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10055 IOStream *stream = ctx->m_stream;
10056 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10057 bool useChecksum = checksumCalculator->getVersion() > 0;
10058
10059 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10060 unsigned char *ptr;
10061 unsigned char *buf;
10062 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10063 const size_t checksumSize = checksumCalculator->checksumByteSize();
10064 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10065 buf = stream->alloc(totalSize);
10066 ptr = buf;
10067 int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10068 memcpy(ptr, &totalSize, 4); ptr += 4;
10069
10070 memcpy(ptr, &program, 4); ptr += 4;
10071 memcpy(ptr, &location, 4); ptr += 4;
10072 memcpy(ptr, &count, 4); ptr += 4;
10073 memcpy(ptr, &transpose, 1); ptr += 1;
10074 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10075 memcpy(ptr, value, __size_value);ptr += __size_value;
10076
10077 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10078 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10079
10080 }
10081
glProgramUniformMatrix3x2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10082 void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10083 {
10084
10085 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10086 IOStream *stream = ctx->m_stream;
10087 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10088 bool useChecksum = checksumCalculator->getVersion() > 0;
10089
10090 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10091 unsigned char *ptr;
10092 unsigned char *buf;
10093 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10094 const size_t checksumSize = checksumCalculator->checksumByteSize();
10095 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10096 buf = stream->alloc(totalSize);
10097 ptr = buf;
10098 int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10099 memcpy(ptr, &totalSize, 4); ptr += 4;
10100
10101 memcpy(ptr, &program, 4); ptr += 4;
10102 memcpy(ptr, &location, 4); ptr += 4;
10103 memcpy(ptr, &count, 4); ptr += 4;
10104 memcpy(ptr, &transpose, 1); ptr += 1;
10105 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10106 memcpy(ptr, value, __size_value);ptr += __size_value;
10107
10108 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10109 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10110
10111 }
10112
glProgramUniformMatrix2x4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10113 void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10114 {
10115
10116 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10117 IOStream *stream = ctx->m_stream;
10118 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10119 bool useChecksum = checksumCalculator->getVersion() > 0;
10120
10121 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10122 unsigned char *ptr;
10123 unsigned char *buf;
10124 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10125 const size_t checksumSize = checksumCalculator->checksumByteSize();
10126 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10127 buf = stream->alloc(totalSize);
10128 ptr = buf;
10129 int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10130 memcpy(ptr, &totalSize, 4); ptr += 4;
10131
10132 memcpy(ptr, &program, 4); ptr += 4;
10133 memcpy(ptr, &location, 4); ptr += 4;
10134 memcpy(ptr, &count, 4); ptr += 4;
10135 memcpy(ptr, &transpose, 1); ptr += 1;
10136 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10137 memcpy(ptr, value, __size_value);ptr += __size_value;
10138
10139 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10140 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10141
10142 }
10143
glProgramUniformMatrix4x2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10144 void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10145 {
10146
10147 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10148 IOStream *stream = ctx->m_stream;
10149 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10150 bool useChecksum = checksumCalculator->getVersion() > 0;
10151
10152 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10153 unsigned char *ptr;
10154 unsigned char *buf;
10155 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10156 const size_t checksumSize = checksumCalculator->checksumByteSize();
10157 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10158 buf = stream->alloc(totalSize);
10159 ptr = buf;
10160 int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10161 memcpy(ptr, &totalSize, 4); ptr += 4;
10162
10163 memcpy(ptr, &program, 4); ptr += 4;
10164 memcpy(ptr, &location, 4); ptr += 4;
10165 memcpy(ptr, &count, 4); ptr += 4;
10166 memcpy(ptr, &transpose, 1); ptr += 1;
10167 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10168 memcpy(ptr, value, __size_value);ptr += __size_value;
10169
10170 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10171 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10172
10173 }
10174
glProgramUniformMatrix3x4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10175 void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10176 {
10177
10178 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10179 IOStream *stream = ctx->m_stream;
10180 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10181 bool useChecksum = checksumCalculator->getVersion() > 0;
10182
10183 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10184 unsigned char *ptr;
10185 unsigned char *buf;
10186 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10187 const size_t checksumSize = checksumCalculator->checksumByteSize();
10188 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10189 buf = stream->alloc(totalSize);
10190 ptr = buf;
10191 int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10192 memcpy(ptr, &totalSize, 4); ptr += 4;
10193
10194 memcpy(ptr, &program, 4); ptr += 4;
10195 memcpy(ptr, &location, 4); ptr += 4;
10196 memcpy(ptr, &count, 4); ptr += 4;
10197 memcpy(ptr, &transpose, 1); ptr += 1;
10198 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10199 memcpy(ptr, value, __size_value);ptr += __size_value;
10200
10201 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10202 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10203
10204 }
10205
glProgramUniformMatrix4x3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10206 void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10207 {
10208
10209 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10210 IOStream *stream = ctx->m_stream;
10211 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10212 bool useChecksum = checksumCalculator->getVersion() > 0;
10213
10214 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10215 unsigned char *ptr;
10216 unsigned char *buf;
10217 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10218 const size_t checksumSize = checksumCalculator->checksumByteSize();
10219 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10220 buf = stream->alloc(totalSize);
10221 ptr = buf;
10222 int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10223 memcpy(ptr, &totalSize, 4); ptr += 4;
10224
10225 memcpy(ptr, &program, 4); ptr += 4;
10226 memcpy(ptr, &location, 4); ptr += 4;
10227 memcpy(ptr, &count, 4); ptr += 4;
10228 memcpy(ptr, &transpose, 1); ptr += 1;
10229 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10230 memcpy(ptr, value, __size_value);ptr += __size_value;
10231
10232 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10233 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10234
10235 }
10236
glGetProgramInterfaceiv_enc(void * self,GLuint program,GLenum programInterface,GLenum pname,GLint * params)10237 void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params)
10238 {
10239
10240 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10241 IOStream *stream = ctx->m_stream;
10242 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10243 bool useChecksum = checksumCalculator->getVersion() > 0;
10244
10245 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10246 unsigned char *ptr;
10247 unsigned char *buf;
10248 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10249 const size_t checksumSize = checksumCalculator->checksumByteSize();
10250 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10251 buf = stream->alloc(totalSize);
10252 ptr = buf;
10253 int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10254 memcpy(ptr, &totalSize, 4); ptr += 4;
10255
10256 memcpy(ptr, &program, 4); ptr += 4;
10257 memcpy(ptr, &programInterface, 4); ptr += 4;
10258 memcpy(ptr, &pname, 4); ptr += 4;
10259 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10260
10261 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10262 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10263
10264 stream->readback(params, __size_params);
10265 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10266 if (useChecksum) {
10267 unsigned char *checksumBufPtr = NULL;
10268 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10269 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10270 stream->readback(checksumBufPtr, checksumSize);
10271 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10272 ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n");
10273 abort();
10274 }
10275 }
10276 }
10277
glGetProgramResourceiv_enc(void * self,GLuint program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,GLsizei * length,GLint * params)10278 void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params)
10279 {
10280
10281 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10282 IOStream *stream = ctx->m_stream;
10283 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10284 bool useChecksum = checksumCalculator->getVersion() > 0;
10285
10286 const unsigned int __size_props = (propCount * sizeof(GLenum));
10287 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10288 const unsigned int __size_params = (bufSize * sizeof(GLint));
10289 unsigned char *ptr;
10290 unsigned char *buf;
10291 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4;
10292 const size_t checksumSize = checksumCalculator->checksumByteSize();
10293 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10294 buf = stream->alloc(totalSize);
10295 ptr = buf;
10296 int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10297 memcpy(ptr, &totalSize, 4); ptr += 4;
10298
10299 memcpy(ptr, &program, 4); ptr += 4;
10300 memcpy(ptr, &programInterface, 4); ptr += 4;
10301 memcpy(ptr, &index, 4); ptr += 4;
10302 memcpy(ptr, &propCount, 4); ptr += 4;
10303 *(unsigned int *)(ptr) = __size_props; ptr += 4;
10304 memcpy(ptr, props, __size_props);ptr += __size_props;
10305 memcpy(ptr, &bufSize, 4); ptr += 4;
10306 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10307 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10308
10309 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10310 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10311
10312 if (length != NULL) {
10313 stream->readback(length, __size_length);
10314 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10315 }
10316 stream->readback(params, __size_params);
10317 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10318 if (useChecksum) {
10319 unsigned char *checksumBufPtr = NULL;
10320 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10321 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10322 stream->readback(checksumBufPtr, checksumSize);
10323 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10324 ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n");
10325 abort();
10326 }
10327 }
10328 }
10329
glGetProgramResourceIndex_enc(void * self,GLuint program,GLenum programInterface,const char * name)10330 GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10331 {
10332
10333 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10334 IOStream *stream = ctx->m_stream;
10335 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10336 bool useChecksum = checksumCalculator->getVersion() > 0;
10337
10338 const unsigned int __size_name = (strlen(name) + 1);
10339 unsigned char *ptr;
10340 unsigned char *buf;
10341 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10342 const size_t checksumSize = checksumCalculator->checksumByteSize();
10343 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10344 buf = stream->alloc(totalSize);
10345 ptr = buf;
10346 int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4;
10347 memcpy(ptr, &totalSize, 4); ptr += 4;
10348
10349 memcpy(ptr, &program, 4); ptr += 4;
10350 memcpy(ptr, &programInterface, 4); ptr += 4;
10351 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10352 memcpy(ptr, name, __size_name);ptr += __size_name;
10353
10354 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10355 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10356
10357
10358 GLuint retval;
10359 stream->readback(&retval, 4);
10360 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10361 if (useChecksum) {
10362 unsigned char *checksumBufPtr = NULL;
10363 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10364 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10365 stream->readback(checksumBufPtr, checksumSize);
10366 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10367 ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n");
10368 abort();
10369 }
10370 }
10371 return retval;
10372 }
10373
glGetProgramResourceLocation_enc(void * self,GLuint program,GLenum programInterface,const char * name)10374 GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10375 {
10376
10377 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10378 IOStream *stream = ctx->m_stream;
10379 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10380 bool useChecksum = checksumCalculator->getVersion() > 0;
10381
10382 const unsigned int __size_name = (strlen(name) + 1);
10383 unsigned char *ptr;
10384 unsigned char *buf;
10385 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10386 const size_t checksumSize = checksumCalculator->checksumByteSize();
10387 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10388 buf = stream->alloc(totalSize);
10389 ptr = buf;
10390 int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4;
10391 memcpy(ptr, &totalSize, 4); ptr += 4;
10392
10393 memcpy(ptr, &program, 4); ptr += 4;
10394 memcpy(ptr, &programInterface, 4); ptr += 4;
10395 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10396 memcpy(ptr, name, __size_name);ptr += __size_name;
10397
10398 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10399 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10400
10401
10402 GLint retval;
10403 stream->readback(&retval, 4);
10404 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10405 if (useChecksum) {
10406 unsigned char *checksumBufPtr = NULL;
10407 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10408 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10409 stream->readback(checksumBufPtr, checksumSize);
10410 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10411 ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n");
10412 abort();
10413 }
10414 }
10415 return retval;
10416 }
10417
glGetProgramResourceName_enc(void * self,GLuint program,GLenum programInterface,GLuint index,GLsizei bufSize,GLsizei * length,char * name)10418 void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name)
10419 {
10420
10421 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10422 IOStream *stream = ctx->m_stream;
10423 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10424 bool useChecksum = checksumCalculator->getVersion() > 0;
10425
10426 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10427 const unsigned int __size_name = bufSize;
10428 unsigned char *ptr;
10429 unsigned char *buf;
10430 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4;
10431 const size_t checksumSize = checksumCalculator->checksumByteSize();
10432 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10433 buf = stream->alloc(totalSize);
10434 ptr = buf;
10435 int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4;
10436 memcpy(ptr, &totalSize, 4); ptr += 4;
10437
10438 memcpy(ptr, &program, 4); ptr += 4;
10439 memcpy(ptr, &programInterface, 4); ptr += 4;
10440 memcpy(ptr, &index, 4); ptr += 4;
10441 memcpy(ptr, &bufSize, 4); ptr += 4;
10442 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10443 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10444
10445 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10446 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10447
10448 if (length != NULL) {
10449 stream->readback(length, __size_length);
10450 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10451 }
10452 stream->readback(name, __size_name);
10453 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
10454 if (useChecksum) {
10455 unsigned char *checksumBufPtr = NULL;
10456 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10457 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10458 stream->readback(checksumBufPtr, checksumSize);
10459 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10460 ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n");
10461 abort();
10462 }
10463 }
10464 }
10465
glBindImageTexture_enc(void * self,GLuint unit,GLuint texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)10466 void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
10467 {
10468
10469 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10470 IOStream *stream = ctx->m_stream;
10471 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10472 bool useChecksum = checksumCalculator->getVersion() > 0;
10473
10474 unsigned char *ptr;
10475 unsigned char *buf;
10476 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4;
10477 const size_t checksumSize = checksumCalculator->checksumByteSize();
10478 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10479 buf = stream->alloc(totalSize);
10480 ptr = buf;
10481 int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4;
10482 memcpy(ptr, &totalSize, 4); ptr += 4;
10483
10484 memcpy(ptr, &unit, 4); ptr += 4;
10485 memcpy(ptr, &texture, 4); ptr += 4;
10486 memcpy(ptr, &level, 4); ptr += 4;
10487 memcpy(ptr, &layered, 1); ptr += 1;
10488 memcpy(ptr, &layer, 4); ptr += 4;
10489 memcpy(ptr, &access, 4); ptr += 4;
10490 memcpy(ptr, &format, 4); ptr += 4;
10491
10492 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10493 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10494
10495 }
10496
glDispatchCompute_enc(void * self,GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)10497 void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
10498 {
10499
10500 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10501 IOStream *stream = ctx->m_stream;
10502 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10503 bool useChecksum = checksumCalculator->getVersion() > 0;
10504
10505 unsigned char *ptr;
10506 unsigned char *buf;
10507 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10508 const size_t checksumSize = checksumCalculator->checksumByteSize();
10509 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10510 buf = stream->alloc(totalSize);
10511 ptr = buf;
10512 int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4;
10513 memcpy(ptr, &totalSize, 4); ptr += 4;
10514
10515 memcpy(ptr, &num_groups_x, 4); ptr += 4;
10516 memcpy(ptr, &num_groups_y, 4); ptr += 4;
10517 memcpy(ptr, &num_groups_z, 4); ptr += 4;
10518
10519 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10520 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10521
10522 }
10523
glDispatchComputeIndirect_enc(void * self,GLintptr indirect)10524 void glDispatchComputeIndirect_enc(void *self , GLintptr indirect)
10525 {
10526
10527 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10528 IOStream *stream = ctx->m_stream;
10529 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10530 bool useChecksum = checksumCalculator->getVersion() > 0;
10531
10532 unsigned char *ptr;
10533 unsigned char *buf;
10534 const size_t sizeWithoutChecksum = 8 + 4;
10535 const size_t checksumSize = checksumCalculator->checksumByteSize();
10536 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10537 buf = stream->alloc(totalSize);
10538 ptr = buf;
10539 int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4;
10540 memcpy(ptr, &totalSize, 4); ptr += 4;
10541
10542 memcpy(ptr, &indirect, 4); ptr += 4;
10543
10544 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10545 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10546
10547 }
10548
glBindVertexBuffer_enc(void * self,GLuint bindingindex,GLuint buffer,GLintptr offset,GLintptr stride)10549 void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride)
10550 {
10551
10552 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10553 IOStream *stream = ctx->m_stream;
10554 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10555 bool useChecksum = checksumCalculator->getVersion() > 0;
10556
10557 unsigned char *ptr;
10558 unsigned char *buf;
10559 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10560 const size_t checksumSize = checksumCalculator->checksumByteSize();
10561 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10562 buf = stream->alloc(totalSize);
10563 ptr = buf;
10564 int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
10565 memcpy(ptr, &totalSize, 4); ptr += 4;
10566
10567 memcpy(ptr, &bindingindex, 4); ptr += 4;
10568 memcpy(ptr, &buffer, 4); ptr += 4;
10569 memcpy(ptr, &offset, 4); ptr += 4;
10570 memcpy(ptr, &stride, 4); ptr += 4;
10571
10572 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10573 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10574
10575 }
10576
glVertexAttribBinding_enc(void * self,GLuint attribindex,GLuint bindingindex)10577 void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex)
10578 {
10579
10580 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10581 IOStream *stream = ctx->m_stream;
10582 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10583 bool useChecksum = checksumCalculator->getVersion() > 0;
10584
10585 unsigned char *ptr;
10586 unsigned char *buf;
10587 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10588 const size_t checksumSize = checksumCalculator->checksumByteSize();
10589 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10590 buf = stream->alloc(totalSize);
10591 ptr = buf;
10592 int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4;
10593 memcpy(ptr, &totalSize, 4); ptr += 4;
10594
10595 memcpy(ptr, &attribindex, 4); ptr += 4;
10596 memcpy(ptr, &bindingindex, 4); ptr += 4;
10597
10598 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10599 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10600
10601 }
10602
glVertexAttribFormat_enc(void * self,GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)10603 void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
10604 {
10605
10606 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10607 IOStream *stream = ctx->m_stream;
10608 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10609 bool useChecksum = checksumCalculator->getVersion() > 0;
10610
10611 unsigned char *ptr;
10612 unsigned char *buf;
10613 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4;
10614 const size_t checksumSize = checksumCalculator->checksumByteSize();
10615 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10616 buf = stream->alloc(totalSize);
10617 ptr = buf;
10618 int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10619 memcpy(ptr, &totalSize, 4); ptr += 4;
10620
10621 memcpy(ptr, &attribindex, 4); ptr += 4;
10622 memcpy(ptr, &size, 4); ptr += 4;
10623 memcpy(ptr, &type, 4); ptr += 4;
10624 memcpy(ptr, &normalized, 1); ptr += 1;
10625 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10626
10627 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10628 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10629
10630 }
10631
glVertexAttribIFormat_enc(void * self,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)10632 void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
10633 {
10634
10635 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10636 IOStream *stream = ctx->m_stream;
10637 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10638 bool useChecksum = checksumCalculator->getVersion() > 0;
10639
10640 unsigned char *ptr;
10641 unsigned char *buf;
10642 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10643 const size_t checksumSize = checksumCalculator->checksumByteSize();
10644 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10645 buf = stream->alloc(totalSize);
10646 ptr = buf;
10647 int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10648 memcpy(ptr, &totalSize, 4); ptr += 4;
10649
10650 memcpy(ptr, &attribindex, 4); ptr += 4;
10651 memcpy(ptr, &size, 4); ptr += 4;
10652 memcpy(ptr, &type, 4); ptr += 4;
10653 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10654
10655 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10656 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10657
10658 }
10659
glVertexBindingDivisor_enc(void * self,GLuint bindingindex,GLuint divisor)10660 void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor)
10661 {
10662
10663 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10664 IOStream *stream = ctx->m_stream;
10665 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10666 bool useChecksum = checksumCalculator->getVersion() > 0;
10667
10668 unsigned char *ptr;
10669 unsigned char *buf;
10670 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10671 const size_t checksumSize = checksumCalculator->checksumByteSize();
10672 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10673 buf = stream->alloc(totalSize);
10674 ptr = buf;
10675 int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
10676 memcpy(ptr, &totalSize, 4); ptr += 4;
10677
10678 memcpy(ptr, &bindingindex, 4); ptr += 4;
10679 memcpy(ptr, &divisor, 4); ptr += 4;
10680
10681 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10682 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10683
10684 }
10685
glDrawArraysIndirectDataAEMU_enc(void * self,GLenum mode,const void * indirect,GLuint datalen)10686 void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen)
10687 {
10688
10689 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10690 IOStream *stream = ctx->m_stream;
10691 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10692 bool useChecksum = checksumCalculator->getVersion() > 0;
10693
10694 const unsigned int __size_indirect = datalen;
10695 unsigned char *ptr;
10696 unsigned char *buf;
10697 const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4;
10698 const size_t checksumSize = checksumCalculator->checksumByteSize();
10699 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10700 buf = stream->alloc(totalSize);
10701 ptr = buf;
10702 int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10703 memcpy(ptr, &totalSize, 4); ptr += 4;
10704
10705 memcpy(ptr, &mode, 4); ptr += 4;
10706 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10707 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10708 memcpy(ptr, &datalen, 4); ptr += 4;
10709
10710 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10711 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10712
10713 }
10714
glDrawArraysIndirectOffsetAEMU_enc(void * self,GLenum mode,GLuint offset)10715 void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset)
10716 {
10717
10718 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10719 IOStream *stream = ctx->m_stream;
10720 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10721 bool useChecksum = checksumCalculator->getVersion() > 0;
10722
10723 unsigned char *ptr;
10724 unsigned char *buf;
10725 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10726 const size_t checksumSize = checksumCalculator->checksumByteSize();
10727 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10728 buf = stream->alloc(totalSize);
10729 ptr = buf;
10730 int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10731 memcpy(ptr, &totalSize, 4); ptr += 4;
10732
10733 memcpy(ptr, &mode, 4); ptr += 4;
10734 memcpy(ptr, &offset, 4); ptr += 4;
10735
10736 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10737 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10738
10739 }
10740
glDrawElementsIndirectDataAEMU_enc(void * self,GLenum mode,GLenum type,const void * indirect,GLuint datalen)10741 void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen)
10742 {
10743
10744 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10745 IOStream *stream = ctx->m_stream;
10746 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10747 bool useChecksum = checksumCalculator->getVersion() > 0;
10748
10749 const unsigned int __size_indirect = datalen;
10750 unsigned char *ptr;
10751 unsigned char *buf;
10752 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4;
10753 const size_t checksumSize = checksumCalculator->checksumByteSize();
10754 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10755 buf = stream->alloc(totalSize);
10756 ptr = buf;
10757 int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10758 memcpy(ptr, &totalSize, 4); ptr += 4;
10759
10760 memcpy(ptr, &mode, 4); ptr += 4;
10761 memcpy(ptr, &type, 4); ptr += 4;
10762 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10763 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10764 memcpy(ptr, &datalen, 4); ptr += 4;
10765
10766 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10767 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10768
10769 }
10770
glDrawElementsIndirectOffsetAEMU_enc(void * self,GLenum mode,GLenum type,GLuint offset)10771 void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset)
10772 {
10773
10774 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10775 IOStream *stream = ctx->m_stream;
10776 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10777 bool useChecksum = checksumCalculator->getVersion() > 0;
10778
10779 unsigned char *ptr;
10780 unsigned char *buf;
10781 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10782 const size_t checksumSize = checksumCalculator->checksumByteSize();
10783 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10784 buf = stream->alloc(totalSize);
10785 ptr = buf;
10786 int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10787 memcpy(ptr, &totalSize, 4); ptr += 4;
10788
10789 memcpy(ptr, &mode, 4); ptr += 4;
10790 memcpy(ptr, &type, 4); ptr += 4;
10791 memcpy(ptr, &offset, 4); ptr += 4;
10792
10793 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10794 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10795
10796 }
10797
glTexStorage2DMultisample_enc(void * self,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)10798 void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
10799 {
10800
10801 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10802 IOStream *stream = ctx->m_stream;
10803 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10804 bool useChecksum = checksumCalculator->getVersion() > 0;
10805
10806 unsigned char *ptr;
10807 unsigned char *buf;
10808 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1;
10809 const size_t checksumSize = checksumCalculator->checksumByteSize();
10810 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10811 buf = stream->alloc(totalSize);
10812 ptr = buf;
10813 int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
10814 memcpy(ptr, &totalSize, 4); ptr += 4;
10815
10816 memcpy(ptr, &target, 4); ptr += 4;
10817 memcpy(ptr, &samples, 4); ptr += 4;
10818 memcpy(ptr, &internalformat, 4); ptr += 4;
10819 memcpy(ptr, &width, 4); ptr += 4;
10820 memcpy(ptr, &height, 4); ptr += 4;
10821 memcpy(ptr, &fixedsamplelocations, 1); ptr += 1;
10822
10823 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10824 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10825
10826 }
10827
glSampleMaski_enc(void * self,GLuint maskNumber,GLbitfield mask)10828 void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask)
10829 {
10830
10831 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10832 IOStream *stream = ctx->m_stream;
10833 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10834 bool useChecksum = checksumCalculator->getVersion() > 0;
10835
10836 unsigned char *ptr;
10837 unsigned char *buf;
10838 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10839 const size_t checksumSize = checksumCalculator->checksumByteSize();
10840 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10841 buf = stream->alloc(totalSize);
10842 ptr = buf;
10843 int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4;
10844 memcpy(ptr, &totalSize, 4); ptr += 4;
10845
10846 memcpy(ptr, &maskNumber, 4); ptr += 4;
10847 memcpy(ptr, &mask, 4); ptr += 4;
10848
10849 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10850 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10851
10852 }
10853
glGetMultisamplefv_enc(void * self,GLenum pname,GLuint index,GLfloat * val)10854 void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val)
10855 {
10856
10857 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10858 IOStream *stream = ctx->m_stream;
10859 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10860 bool useChecksum = checksumCalculator->getVersion() > 0;
10861
10862 const unsigned int __size_val = (glUtilsParamSize(pname) * sizeof(GLfloat));
10863 unsigned char *ptr;
10864 unsigned char *buf;
10865 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10866 const size_t checksumSize = checksumCalculator->checksumByteSize();
10867 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10868 buf = stream->alloc(totalSize);
10869 ptr = buf;
10870 int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4;
10871 memcpy(ptr, &totalSize, 4); ptr += 4;
10872
10873 memcpy(ptr, &pname, 4); ptr += 4;
10874 memcpy(ptr, &index, 4); ptr += 4;
10875 *(unsigned int *)(ptr) = __size_val; ptr += 4;
10876
10877 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10878 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10879
10880 stream->readback(val, __size_val);
10881 if (useChecksum) checksumCalculator->addBuffer(val, __size_val);
10882 if (useChecksum) {
10883 unsigned char *checksumBufPtr = NULL;
10884 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10885 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10886 stream->readback(checksumBufPtr, checksumSize);
10887 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10888 ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n");
10889 abort();
10890 }
10891 }
10892 }
10893
glFramebufferParameteri_enc(void * self,GLenum target,GLenum pname,GLint param)10894 void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
10895 {
10896
10897 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10898 IOStream *stream = ctx->m_stream;
10899 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10900 bool useChecksum = checksumCalculator->getVersion() > 0;
10901
10902 unsigned char *ptr;
10903 unsigned char *buf;
10904 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10905 const size_t checksumSize = checksumCalculator->checksumByteSize();
10906 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10907 buf = stream->alloc(totalSize);
10908 ptr = buf;
10909 int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
10910 memcpy(ptr, &totalSize, 4); ptr += 4;
10911
10912 memcpy(ptr, &target, 4); ptr += 4;
10913 memcpy(ptr, &pname, 4); ptr += 4;
10914 memcpy(ptr, ¶m, 4); ptr += 4;
10915
10916 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10917 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10918
10919 }
10920
glGetFramebufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)10921 void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
10922 {
10923
10924 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10925 IOStream *stream = ctx->m_stream;
10926 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10927 bool useChecksum = checksumCalculator->getVersion() > 0;
10928
10929 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10930 unsigned char *ptr;
10931 unsigned char *buf;
10932 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10933 const size_t checksumSize = checksumCalculator->checksumByteSize();
10934 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10935 buf = stream->alloc(totalSize);
10936 ptr = buf;
10937 int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
10938 memcpy(ptr, &totalSize, 4); ptr += 4;
10939
10940 memcpy(ptr, &target, 4); ptr += 4;
10941 memcpy(ptr, &pname, 4); ptr += 4;
10942 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10943
10944 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10945 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10946
10947 stream->readback(params, __size_params);
10948 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10949 if (useChecksum) {
10950 unsigned char *checksumBufPtr = NULL;
10951 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10952 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10953 stream->readback(checksumBufPtr, checksumSize);
10954 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10955 ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
10956 abort();
10957 }
10958 }
10959 }
10960
glGetTexLevelParameterfv_enc(void * self,GLenum target,GLint level,GLenum pname,GLfloat * params)10961 void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params)
10962 {
10963
10964 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10965 IOStream *stream = ctx->m_stream;
10966 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10967 bool useChecksum = checksumCalculator->getVersion() > 0;
10968
10969 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
10970 unsigned char *ptr;
10971 unsigned char *buf;
10972 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10973 const size_t checksumSize = checksumCalculator->checksumByteSize();
10974 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10975 buf = stream->alloc(totalSize);
10976 ptr = buf;
10977 int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
10978 memcpy(ptr, &totalSize, 4); ptr += 4;
10979
10980 memcpy(ptr, &target, 4); ptr += 4;
10981 memcpy(ptr, &level, 4); ptr += 4;
10982 memcpy(ptr, &pname, 4); ptr += 4;
10983 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10984
10985 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10986 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10987
10988 stream->readback(params, __size_params);
10989 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10990 if (useChecksum) {
10991 unsigned char *checksumBufPtr = NULL;
10992 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10993 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10994 stream->readback(checksumBufPtr, checksumSize);
10995 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10996 ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n");
10997 abort();
10998 }
10999 }
11000 }
11001
glGetTexLevelParameteriv_enc(void * self,GLenum target,GLint level,GLenum pname,GLint * params)11002 void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params)
11003 {
11004
11005 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11006 IOStream *stream = ctx->m_stream;
11007 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11008 bool useChecksum = checksumCalculator->getVersion() > 0;
11009
11010 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
11011 unsigned char *ptr;
11012 unsigned char *buf;
11013 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11014 const size_t checksumSize = checksumCalculator->checksumByteSize();
11015 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11016 buf = stream->alloc(totalSize);
11017 ptr = buf;
11018 int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
11019 memcpy(ptr, &totalSize, 4); ptr += 4;
11020
11021 memcpy(ptr, &target, 4); ptr += 4;
11022 memcpy(ptr, &level, 4); ptr += 4;
11023 memcpy(ptr, &pname, 4); ptr += 4;
11024 *(unsigned int *)(ptr) = __size_params; ptr += 4;
11025
11026 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11027 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11028
11029 stream->readback(params, __size_params);
11030 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11031 if (useChecksum) {
11032 unsigned char *checksumBufPtr = NULL;
11033 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11034 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11035 stream->readback(checksumBufPtr, checksumSize);
11036 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11037 ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n");
11038 abort();
11039 }
11040 }
11041 }
11042
11043 } // namespace
11044
gl2_encoder_context_t(IOStream * stream,ChecksumCalculator * checksumCalculator)11045 gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
11046 {
11047 m_stream = stream;
11048 m_checksumCalculator = checksumCalculator;
11049
11050 this->glActiveTexture = &glActiveTexture_enc;
11051 this->glAttachShader = &glAttachShader_enc;
11052 this->glBindAttribLocation = &glBindAttribLocation_enc;
11053 this->glBindBuffer = &glBindBuffer_enc;
11054 this->glBindFramebuffer = &glBindFramebuffer_enc;
11055 this->glBindRenderbuffer = &glBindRenderbuffer_enc;
11056 this->glBindTexture = &glBindTexture_enc;
11057 this->glBlendColor = &glBlendColor_enc;
11058 this->glBlendEquation = &glBlendEquation_enc;
11059 this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
11060 this->glBlendFunc = &glBlendFunc_enc;
11061 this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
11062 this->glBufferData = &glBufferData_enc;
11063 this->glBufferSubData = &glBufferSubData_enc;
11064 this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
11065 this->glClear = &glClear_enc;
11066 this->glClearColor = &glClearColor_enc;
11067 this->glClearDepthf = &glClearDepthf_enc;
11068 this->glClearStencil = &glClearStencil_enc;
11069 this->glColorMask = &glColorMask_enc;
11070 this->glCompileShader = &glCompileShader_enc;
11071 this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
11072 this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
11073 this->glCopyTexImage2D = &glCopyTexImage2D_enc;
11074 this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
11075 this->glCreateProgram = &glCreateProgram_enc;
11076 this->glCreateShader = &glCreateShader_enc;
11077 this->glCullFace = &glCullFace_enc;
11078 this->glDeleteBuffers = &glDeleteBuffers_enc;
11079 this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
11080 this->glDeleteProgram = &glDeleteProgram_enc;
11081 this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
11082 this->glDeleteShader = &glDeleteShader_enc;
11083 this->glDeleteTextures = &glDeleteTextures_enc;
11084 this->glDepthFunc = &glDepthFunc_enc;
11085 this->glDepthMask = &glDepthMask_enc;
11086 this->glDepthRangef = &glDepthRangef_enc;
11087 this->glDetachShader = &glDetachShader_enc;
11088 this->glDisable = &glDisable_enc;
11089 this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
11090 this->glDrawArrays = &glDrawArrays_enc;
11091 this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
11092 this->glEnable = &glEnable_enc;
11093 this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
11094 this->glFinish = &glFinish_enc;
11095 this->glFlush = &glFlush_enc;
11096 this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
11097 this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
11098 this->glFrontFace = &glFrontFace_enc;
11099 this->glGenBuffers = &glGenBuffers_enc;
11100 this->glGenerateMipmap = &glGenerateMipmap_enc;
11101 this->glGenFramebuffers = &glGenFramebuffers_enc;
11102 this->glGenRenderbuffers = &glGenRenderbuffers_enc;
11103 this->glGenTextures = &glGenTextures_enc;
11104 this->glGetActiveAttrib = &glGetActiveAttrib_enc;
11105 this->glGetActiveUniform = &glGetActiveUniform_enc;
11106 this->glGetAttachedShaders = &glGetAttachedShaders_enc;
11107 this->glGetAttribLocation = &glGetAttribLocation_enc;
11108 this->glGetBooleanv = &glGetBooleanv_enc;
11109 this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
11110 this->glGetError = &glGetError_enc;
11111 this->glGetFloatv = &glGetFloatv_enc;
11112 this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
11113 this->glGetIntegerv = &glGetIntegerv_enc;
11114 this->glGetProgramiv = &glGetProgramiv_enc;
11115 this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
11116 this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
11117 this->glGetShaderiv = &glGetShaderiv_enc;
11118 this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
11119 this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
11120 this->glGetShaderSource = &glGetShaderSource_enc;
11121 this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
11122 this->glGetTexParameterfv = &glGetTexParameterfv_enc;
11123 this->glGetTexParameteriv = &glGetTexParameteriv_enc;
11124 this->glGetUniformfv = &glGetUniformfv_enc;
11125 this->glGetUniformiv = &glGetUniformiv_enc;
11126 this->glGetUniformLocation = &glGetUniformLocation_enc;
11127 this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
11128 this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
11129 this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
11130 this->glHint = &glHint_enc;
11131 this->glIsBuffer = &glIsBuffer_enc;
11132 this->glIsEnabled = &glIsEnabled_enc;
11133 this->glIsFramebuffer = &glIsFramebuffer_enc;
11134 this->glIsProgram = &glIsProgram_enc;
11135 this->glIsRenderbuffer = &glIsRenderbuffer_enc;
11136 this->glIsShader = &glIsShader_enc;
11137 this->glIsTexture = &glIsTexture_enc;
11138 this->glLineWidth = &glLineWidth_enc;
11139 this->glLinkProgram = &glLinkProgram_enc;
11140 this->glPixelStorei = &glPixelStorei_enc;
11141 this->glPolygonOffset = &glPolygonOffset_enc;
11142 this->glReadPixels = &glReadPixels_enc;
11143 this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
11144 this->glRenderbufferStorage = &glRenderbufferStorage_enc;
11145 this->glSampleCoverage = &glSampleCoverage_enc;
11146 this->glScissor = &glScissor_enc;
11147 this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
11148 this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
11149 this->glStencilFunc = &glStencilFunc_enc;
11150 this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
11151 this->glStencilMask = &glStencilMask_enc;
11152 this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
11153 this->glStencilOp = &glStencilOp_enc;
11154 this->glStencilOpSeparate = &glStencilOpSeparate_enc;
11155 this->glTexImage2D = &glTexImage2D_enc;
11156 this->glTexParameterf = &glTexParameterf_enc;
11157 this->glTexParameterfv = &glTexParameterfv_enc;
11158 this->glTexParameteri = &glTexParameteri_enc;
11159 this->glTexParameteriv = &glTexParameteriv_enc;
11160 this->glTexSubImage2D = &glTexSubImage2D_enc;
11161 this->glUniform1f = &glUniform1f_enc;
11162 this->glUniform1fv = &glUniform1fv_enc;
11163 this->glUniform1i = &glUniform1i_enc;
11164 this->glUniform1iv = &glUniform1iv_enc;
11165 this->glUniform2f = &glUniform2f_enc;
11166 this->glUniform2fv = &glUniform2fv_enc;
11167 this->glUniform2i = &glUniform2i_enc;
11168 this->glUniform2iv = &glUniform2iv_enc;
11169 this->glUniform3f = &glUniform3f_enc;
11170 this->glUniform3fv = &glUniform3fv_enc;
11171 this->glUniform3i = &glUniform3i_enc;
11172 this->glUniform3iv = &glUniform3iv_enc;
11173 this->glUniform4f = &glUniform4f_enc;
11174 this->glUniform4fv = &glUniform4fv_enc;
11175 this->glUniform4i = &glUniform4i_enc;
11176 this->glUniform4iv = &glUniform4iv_enc;
11177 this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
11178 this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
11179 this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
11180 this->glUseProgram = &glUseProgram_enc;
11181 this->glValidateProgram = &glValidateProgram_enc;
11182 this->glVertexAttrib1f = &glVertexAttrib1f_enc;
11183 this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
11184 this->glVertexAttrib2f = &glVertexAttrib2f_enc;
11185 this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
11186 this->glVertexAttrib3f = &glVertexAttrib3f_enc;
11187 this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
11188 this->glVertexAttrib4f = &glVertexAttrib4f_enc;
11189 this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
11190 this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
11191 this->glViewport = &glViewport_enc;
11192 this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
11193 this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
11194 this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
11195 this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
11196 this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
11197 this->glUnmapBufferOES = &glUnmapBufferOES_enc;
11198 this->glTexImage3DOES = &glTexImage3DOES_enc;
11199 this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
11200 this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
11201 this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
11202 this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
11203 this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
11204 this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
11205 this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
11206 this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
11207 this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
11208 this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
11209 this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
11210 this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
11211 this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
11212 this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11213 this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
11214 this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
11215 this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
11216 this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
11217 this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
11218 this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11219 this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
11220 this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
11221 this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
11222 this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
11223 this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
11224 this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
11225 this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
11226 this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
11227 this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
11228 this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
11229 this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
11230 this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
11231 this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
11232 this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
11233 this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
11234 this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
11235 this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
11236 this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
11237 this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
11238 this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
11239 this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
11240 this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
11241 this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
11242 this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
11243 this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
11244 this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
11245 this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
11246 this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
11247 this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
11248 this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
11249 this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
11250 this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
11251 this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
11252 this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
11253 this->glDrawElementsOffset = &glDrawElementsOffset_enc;
11254 this->glDrawElementsData = &glDrawElementsData_enc;
11255 this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
11256 this->glShaderString = &glShaderString_enc;
11257 this->glFinishRoundTrip = &glFinishRoundTrip_enc;
11258 this->glGenVertexArrays = &glGenVertexArrays_enc;
11259 this->glBindVertexArray = &glBindVertexArray_enc;
11260 this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
11261 this->glIsVertexArray = &glIsVertexArray_enc;
11262 this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
11263 this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
11264 this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
11265 this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
11266 this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
11267 this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
11268 this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
11269 this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
11270 this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
11271 this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
11272 this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
11273 this->glBindBufferRange = &glBindBufferRange_enc;
11274 this->glBindBufferBase = &glBindBufferBase_enc;
11275 this->glCopyBufferSubData = &glCopyBufferSubData_enc;
11276 this->glClearBufferiv = &glClearBufferiv_enc;
11277 this->glClearBufferuiv = &glClearBufferuiv_enc;
11278 this->glClearBufferfv = &glClearBufferfv_enc;
11279 this->glClearBufferfi = &glClearBufferfi_enc;
11280 this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
11281 this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
11282 this->glUniformBlockBinding = &glUniformBlockBinding_enc;
11283 this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
11284 this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
11285 this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
11286 this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
11287 this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
11288 this->glUniform1ui = &glUniform1ui_enc;
11289 this->glUniform2ui = &glUniform2ui_enc;
11290 this->glUniform3ui = &glUniform3ui_enc;
11291 this->glUniform4ui = &glUniform4ui_enc;
11292 this->glUniform1uiv = &glUniform1uiv_enc;
11293 this->glUniform2uiv = &glUniform2uiv_enc;
11294 this->glUniform3uiv = &glUniform3uiv_enc;
11295 this->glUniform4uiv = &glUniform4uiv_enc;
11296 this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
11297 this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
11298 this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
11299 this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
11300 this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
11301 this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
11302 this->glGetUniformuiv = &glGetUniformuiv_enc;
11303 this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
11304 this->glVertexAttribI4i = &glVertexAttribI4i_enc;
11305 this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
11306 this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
11307 this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
11308 this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
11309 this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
11310 this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
11311 this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
11312 this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
11313 this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
11314 this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
11315 this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
11316 this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
11317 this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
11318 this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
11319 this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
11320 this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
11321 this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
11322 this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
11323 this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
11324 this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
11325 this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
11326 this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
11327 this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
11328 this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
11329 this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
11330 this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
11331 this->glIsSyncAEMU = &glIsSyncAEMU_enc;
11332 this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
11333 this->glDrawBuffers = &glDrawBuffers_enc;
11334 this->glReadBuffer = &glReadBuffer_enc;
11335 this->glBlitFramebuffer = &glBlitFramebuffer_enc;
11336 this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
11337 this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
11338 this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
11339 this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
11340 this->glTexStorage2D = &glTexStorage2D_enc;
11341 this->glGetInternalformativ = &glGetInternalformativ_enc;
11342 this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
11343 this->glEndTransformFeedback = &glEndTransformFeedback_enc;
11344 this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
11345 this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
11346 this->glBindTransformFeedback = &glBindTransformFeedback_enc;
11347 this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
11348 this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
11349 this->glIsTransformFeedback = &glIsTransformFeedback_enc;
11350 this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
11351 this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
11352 this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
11353 this->glGenSamplers = &glGenSamplers_enc;
11354 this->glDeleteSamplers = &glDeleteSamplers_enc;
11355 this->glBindSampler = &glBindSampler_enc;
11356 this->glSamplerParameterf = &glSamplerParameterf_enc;
11357 this->glSamplerParameteri = &glSamplerParameteri_enc;
11358 this->glSamplerParameterfv = &glSamplerParameterfv_enc;
11359 this->glSamplerParameteriv = &glSamplerParameteriv_enc;
11360 this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
11361 this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
11362 this->glIsSampler = &glIsSampler_enc;
11363 this->glGenQueries = &glGenQueries_enc;
11364 this->glDeleteQueries = &glDeleteQueries_enc;
11365 this->glBeginQuery = &glBeginQuery_enc;
11366 this->glEndQuery = &glEndQuery_enc;
11367 this->glGetQueryiv = &glGetQueryiv_enc;
11368 this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
11369 this->glIsQuery = &glIsQuery_enc;
11370 this->glProgramParameteri = &glProgramParameteri_enc;
11371 this->glProgramBinary = &glProgramBinary_enc;
11372 this->glGetProgramBinary = &glGetProgramBinary_enc;
11373 this->glGetFragDataLocation = &glGetFragDataLocation_enc;
11374 this->glGetInteger64v = &glGetInteger64v_enc;
11375 this->glGetIntegeri_v = &glGetIntegeri_v_enc;
11376 this->glGetInteger64i_v = &glGetInteger64i_v_enc;
11377 this->glTexImage3D = &glTexImage3D_enc;
11378 this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
11379 this->glTexStorage3D = &glTexStorage3D_enc;
11380 this->glTexSubImage3D = &glTexSubImage3D_enc;
11381 this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
11382 this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
11383 this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
11384 this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
11385 this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
11386 this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
11387 this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
11388 this->glGetBooleani_v = &glGetBooleani_v_enc;
11389 this->glMemoryBarrier = &glMemoryBarrier_enc;
11390 this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
11391 this->glGenProgramPipelines = &glGenProgramPipelines_enc;
11392 this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
11393 this->glBindProgramPipeline = &glBindProgramPipeline_enc;
11394 this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
11395 this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
11396 this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
11397 this->glIsProgramPipeline = &glIsProgramPipeline_enc;
11398 this->glUseProgramStages = &glUseProgramStages_enc;
11399 this->glActiveShaderProgram = &glActiveShaderProgram_enc;
11400 this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
11401 this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
11402 this->glProgramUniform1f = &glProgramUniform1f_enc;
11403 this->glProgramUniform2f = &glProgramUniform2f_enc;
11404 this->glProgramUniform3f = &glProgramUniform3f_enc;
11405 this->glProgramUniform4f = &glProgramUniform4f_enc;
11406 this->glProgramUniform1i = &glProgramUniform1i_enc;
11407 this->glProgramUniform2i = &glProgramUniform2i_enc;
11408 this->glProgramUniform3i = &glProgramUniform3i_enc;
11409 this->glProgramUniform4i = &glProgramUniform4i_enc;
11410 this->glProgramUniform1ui = &glProgramUniform1ui_enc;
11411 this->glProgramUniform2ui = &glProgramUniform2ui_enc;
11412 this->glProgramUniform3ui = &glProgramUniform3ui_enc;
11413 this->glProgramUniform4ui = &glProgramUniform4ui_enc;
11414 this->glProgramUniform1fv = &glProgramUniform1fv_enc;
11415 this->glProgramUniform2fv = &glProgramUniform2fv_enc;
11416 this->glProgramUniform3fv = &glProgramUniform3fv_enc;
11417 this->glProgramUniform4fv = &glProgramUniform4fv_enc;
11418 this->glProgramUniform1iv = &glProgramUniform1iv_enc;
11419 this->glProgramUniform2iv = &glProgramUniform2iv_enc;
11420 this->glProgramUniform3iv = &glProgramUniform3iv_enc;
11421 this->glProgramUniform4iv = &glProgramUniform4iv_enc;
11422 this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
11423 this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
11424 this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
11425 this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
11426 this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
11427 this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
11428 this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
11429 this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
11430 this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
11431 this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
11432 this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
11433 this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
11434 this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
11435 this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
11436 this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
11437 this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
11438 this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
11439 this->glGetProgramResourceName = &glGetProgramResourceName_enc;
11440 this->glBindImageTexture = &glBindImageTexture_enc;
11441 this->glDispatchCompute = &glDispatchCompute_enc;
11442 this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
11443 this->glBindVertexBuffer = &glBindVertexBuffer_enc;
11444 this->glVertexAttribBinding = &glVertexAttribBinding_enc;
11445 this->glVertexAttribFormat = &glVertexAttribFormat_enc;
11446 this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
11447 this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
11448 this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
11449 this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
11450 this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
11451 this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
11452 this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
11453 this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
11454 this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
11455 this->glSampleMaski = &glSampleMaski_enc;
11456 this->glGetMultisamplefv = &glGetMultisamplefv_enc;
11457 this->glFramebufferParameteri = &glFramebufferParameteri_enc;
11458 this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
11459 this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
11460 this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
11461 }
11462
11463