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 <vector>
12 
13 #include <stdio.h>
14 
15 namespace {
16 
enc_unsupported()17 void enc_unsupported()
18 {
19 	ALOGE("Function is unsupported\n");
20 }
21 
glActiveTexture_enc(void * self,GLenum texture)22 void glActiveTexture_enc(void *self , GLenum texture)
23 {
24 
25 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
26 	IOStream *stream = ctx->m_stream;
27 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
28 	bool useChecksum = checksumCalculator->getVersion() > 0;
29 
30 	 unsigned char *ptr;
31 	 unsigned char *buf;
32 	 const size_t sizeWithoutChecksum = 8 + 4;
33 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
34 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
35 	buf = stream->alloc(totalSize);
36 	ptr = buf;
37 	int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
38 	memcpy(ptr, &totalSize, 4);  ptr += 4;
39 
40 		memcpy(ptr, &texture, 4); ptr += 4;
41 
42 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
43 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
44 
45 }
46 
glAttachShader_enc(void * self,GLuint program,GLuint shader)47 void glAttachShader_enc(void *self , GLuint program, GLuint shader)
48 {
49 
50 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
51 	IOStream *stream = ctx->m_stream;
52 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
53 	bool useChecksum = checksumCalculator->getVersion() > 0;
54 
55 	 unsigned char *ptr;
56 	 unsigned char *buf;
57 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
58 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
59 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
60 	buf = stream->alloc(totalSize);
61 	ptr = buf;
62 	int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
63 	memcpy(ptr, &totalSize, 4);  ptr += 4;
64 
65 		memcpy(ptr, &program, 4); ptr += 4;
66 		memcpy(ptr, &shader, 4); ptr += 4;
67 
68 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
69 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
70 
71 }
72 
glBindAttribLocation_enc(void * self,GLuint program,GLuint index,const GLchar * name)73 void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
74 {
75 
76 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
77 	IOStream *stream = ctx->m_stream;
78 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
79 	bool useChecksum = checksumCalculator->getVersion() > 0;
80 
81 	const unsigned int __size_name =  (strlen(name) + 1);
82 	 unsigned char *ptr;
83 	 unsigned char *buf;
84 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
85 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
86 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
87 	buf = stream->alloc(totalSize);
88 	ptr = buf;
89 	int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
90 	memcpy(ptr, &totalSize, 4);  ptr += 4;
91 
92 		memcpy(ptr, &program, 4); ptr += 4;
93 		memcpy(ptr, &index, 4); ptr += 4;
94 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
95 	memcpy(ptr, name, __size_name);ptr += __size_name;
96 
97 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
98 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
99 
100 }
101 
glBindBuffer_enc(void * self,GLenum target,GLuint buffer)102 void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
103 {
104 
105 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
106 	IOStream *stream = ctx->m_stream;
107 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
108 	bool useChecksum = checksumCalculator->getVersion() > 0;
109 
110 	 unsigned char *ptr;
111 	 unsigned char *buf;
112 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
113 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
114 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
115 	buf = stream->alloc(totalSize);
116 	ptr = buf;
117 	int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
118 	memcpy(ptr, &totalSize, 4);  ptr += 4;
119 
120 		memcpy(ptr, &target, 4); ptr += 4;
121 		memcpy(ptr, &buffer, 4); ptr += 4;
122 
123 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
124 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
125 
126 }
127 
glBindFramebuffer_enc(void * self,GLenum target,GLuint framebuffer)128 void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
129 {
130 
131 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
132 	IOStream *stream = ctx->m_stream;
133 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
134 	bool useChecksum = checksumCalculator->getVersion() > 0;
135 
136 	 unsigned char *ptr;
137 	 unsigned char *buf;
138 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
139 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
140 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
141 	buf = stream->alloc(totalSize);
142 	ptr = buf;
143 	int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
144 	memcpy(ptr, &totalSize, 4);  ptr += 4;
145 
146 		memcpy(ptr, &target, 4); ptr += 4;
147 		memcpy(ptr, &framebuffer, 4); ptr += 4;
148 
149 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
150 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
151 
152 }
153 
glBindRenderbuffer_enc(void * self,GLenum target,GLuint renderbuffer)154 void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
155 {
156 
157 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
158 	IOStream *stream = ctx->m_stream;
159 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
160 	bool useChecksum = checksumCalculator->getVersion() > 0;
161 
162 	 unsigned char *ptr;
163 	 unsigned char *buf;
164 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
165 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
166 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
167 	buf = stream->alloc(totalSize);
168 	ptr = buf;
169 	int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
170 	memcpy(ptr, &totalSize, 4);  ptr += 4;
171 
172 		memcpy(ptr, &target, 4); ptr += 4;
173 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
174 
175 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
176 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
177 
178 }
179 
glBindTexture_enc(void * self,GLenum target,GLuint texture)180 void glBindTexture_enc(void *self , GLenum target, GLuint texture)
181 {
182 
183 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
184 	IOStream *stream = ctx->m_stream;
185 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
186 	bool useChecksum = checksumCalculator->getVersion() > 0;
187 
188 	 unsigned char *ptr;
189 	 unsigned char *buf;
190 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
191 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
192 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
193 	buf = stream->alloc(totalSize);
194 	ptr = buf;
195 	int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
196 	memcpy(ptr, &totalSize, 4);  ptr += 4;
197 
198 		memcpy(ptr, &target, 4); ptr += 4;
199 		memcpy(ptr, &texture, 4); ptr += 4;
200 
201 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
202 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
203 
204 }
205 
glBlendColor_enc(void * self,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)206 void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
207 {
208 
209 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
210 	IOStream *stream = ctx->m_stream;
211 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
212 	bool useChecksum = checksumCalculator->getVersion() > 0;
213 
214 	 unsigned char *ptr;
215 	 unsigned char *buf;
216 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
217 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
218 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
219 	buf = stream->alloc(totalSize);
220 	ptr = buf;
221 	int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
222 	memcpy(ptr, &totalSize, 4);  ptr += 4;
223 
224 		memcpy(ptr, &red, 4); ptr += 4;
225 		memcpy(ptr, &green, 4); ptr += 4;
226 		memcpy(ptr, &blue, 4); ptr += 4;
227 		memcpy(ptr, &alpha, 4); ptr += 4;
228 
229 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
230 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
231 
232 }
233 
glBlendEquation_enc(void * self,GLenum mode)234 void glBlendEquation_enc(void *self , GLenum mode)
235 {
236 
237 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
238 	IOStream *stream = ctx->m_stream;
239 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
240 	bool useChecksum = checksumCalculator->getVersion() > 0;
241 
242 	 unsigned char *ptr;
243 	 unsigned char *buf;
244 	 const size_t sizeWithoutChecksum = 8 + 4;
245 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
246 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
247 	buf = stream->alloc(totalSize);
248 	ptr = buf;
249 	int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
250 	memcpy(ptr, &totalSize, 4);  ptr += 4;
251 
252 		memcpy(ptr, &mode, 4); ptr += 4;
253 
254 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
255 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
256 
257 }
258 
glBlendEquationSeparate_enc(void * self,GLenum modeRGB,GLenum modeAlpha)259 void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
260 {
261 
262 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
263 	IOStream *stream = ctx->m_stream;
264 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
265 	bool useChecksum = checksumCalculator->getVersion() > 0;
266 
267 	 unsigned char *ptr;
268 	 unsigned char *buf;
269 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
270 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
271 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
272 	buf = stream->alloc(totalSize);
273 	ptr = buf;
274 	int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
275 	memcpy(ptr, &totalSize, 4);  ptr += 4;
276 
277 		memcpy(ptr, &modeRGB, 4); ptr += 4;
278 		memcpy(ptr, &modeAlpha, 4); ptr += 4;
279 
280 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
281 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
282 
283 }
284 
glBlendFunc_enc(void * self,GLenum sfactor,GLenum dfactor)285 void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
286 {
287 
288 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
289 	IOStream *stream = ctx->m_stream;
290 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
291 	bool useChecksum = checksumCalculator->getVersion() > 0;
292 
293 	 unsigned char *ptr;
294 	 unsigned char *buf;
295 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
296 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
297 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
298 	buf = stream->alloc(totalSize);
299 	ptr = buf;
300 	int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
301 	memcpy(ptr, &totalSize, 4);  ptr += 4;
302 
303 		memcpy(ptr, &sfactor, 4); ptr += 4;
304 		memcpy(ptr, &dfactor, 4); ptr += 4;
305 
306 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
307 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
308 
309 }
310 
glBlendFuncSeparate_enc(void * self,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)311 void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
312 {
313 
314 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
315 	IOStream *stream = ctx->m_stream;
316 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
317 	bool useChecksum = checksumCalculator->getVersion() > 0;
318 
319 	 unsigned char *ptr;
320 	 unsigned char *buf;
321 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
322 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
323 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
324 	buf = stream->alloc(totalSize);
325 	ptr = buf;
326 	int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
327 	memcpy(ptr, &totalSize, 4);  ptr += 4;
328 
329 		memcpy(ptr, &srcRGB, 4); ptr += 4;
330 		memcpy(ptr, &dstRGB, 4); ptr += 4;
331 		memcpy(ptr, &srcAlpha, 4); ptr += 4;
332 		memcpy(ptr, &dstAlpha, 4); ptr += 4;
333 
334 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
335 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
336 
337 }
338 
glBufferData_enc(void * self,GLenum target,GLsizeiptr size,const GLvoid * data,GLenum usage)339 void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
340 {
341 
342 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
343 	IOStream *stream = ctx->m_stream;
344 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
345 	bool useChecksum = checksumCalculator->getVersion() > 0;
346 
347 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
348 	 unsigned char *ptr;
349 	 unsigned char *buf;
350 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
351 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
352 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
353 	buf = stream->alloc(8 + 4 + 4);
354 	ptr = buf;
355 	int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
356 	memcpy(ptr, &totalSize, 4);  ptr += 4;
357 
358 		memcpy(ptr, &target, 4); ptr += 4;
359 		memcpy(ptr, &size, 4); ptr += 4;
360 
361 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
362 	stream->flush();
363 	stream->writeFully(&__size_data,4);
364 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
365 	if (data != NULL) {
366 		stream->writeFully(data, __size_data);
367 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
368 	}
369 	buf = stream->alloc(4);
370 	ptr = buf;
371 		memcpy(ptr, &usage, 4); ptr += 4;
372 
373 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
374 	buf = stream->alloc(checksumSize);
375 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
376 
377 }
378 
glBufferSubData_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid * data)379 void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
380 {
381 
382 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
383 	IOStream *stream = ctx->m_stream;
384 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
385 	bool useChecksum = checksumCalculator->getVersion() > 0;
386 
387 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
388 	 unsigned char *ptr;
389 	 unsigned char *buf;
390 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
391 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
392 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
393 	buf = stream->alloc(8 + 4 + 4 + 4);
394 	ptr = buf;
395 	int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
396 	memcpy(ptr, &totalSize, 4);  ptr += 4;
397 
398 		memcpy(ptr, &target, 4); ptr += 4;
399 		memcpy(ptr, &offset, 4); ptr += 4;
400 		memcpy(ptr, &size, 4); ptr += 4;
401 
402 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
403 	stream->flush();
404 	stream->writeFully(&__size_data,4);
405 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
406 	if (data != NULL) {
407 		stream->writeFully(data, __size_data);
408 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
409 	}
410 	buf = stream->alloc(checksumSize);
411 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
412 
413 }
414 
glCheckFramebufferStatus_enc(void * self,GLenum target)415 GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
416 {
417 
418 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
419 	IOStream *stream = ctx->m_stream;
420 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
421 	bool useChecksum = checksumCalculator->getVersion() > 0;
422 
423 	 unsigned char *ptr;
424 	 unsigned char *buf;
425 	 const size_t sizeWithoutChecksum = 8 + 4;
426 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
427 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
428 	buf = stream->alloc(totalSize);
429 	ptr = buf;
430 	int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
431 	memcpy(ptr, &totalSize, 4);  ptr += 4;
432 
433 		memcpy(ptr, &target, 4); ptr += 4;
434 
435 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
436 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
437 
438 
439 	GLenum retval;
440 	stream->readback(&retval, 4);
441 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
442 	if (useChecksum) {
443 		unsigned char *checksumBufPtr = NULL;
444 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
445 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
446 		stream->readback(checksumBufPtr, checksumSize);
447 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
448 			ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
449 			abort();
450 		}
451 	}
452 	return retval;
453 }
454 
glClear_enc(void * self,GLbitfield mask)455 void glClear_enc(void *self , GLbitfield mask)
456 {
457 
458 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
459 	IOStream *stream = ctx->m_stream;
460 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
461 	bool useChecksum = checksumCalculator->getVersion() > 0;
462 
463 	 unsigned char *ptr;
464 	 unsigned char *buf;
465 	 const size_t sizeWithoutChecksum = 8 + 4;
466 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
467 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
468 	buf = stream->alloc(totalSize);
469 	ptr = buf;
470 	int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
471 	memcpy(ptr, &totalSize, 4);  ptr += 4;
472 
473 		memcpy(ptr, &mask, 4); ptr += 4;
474 
475 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
476 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
477 
478 }
479 
glClearColor_enc(void * self,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)480 void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
481 {
482 
483 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
484 	IOStream *stream = ctx->m_stream;
485 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
486 	bool useChecksum = checksumCalculator->getVersion() > 0;
487 
488 	 unsigned char *ptr;
489 	 unsigned char *buf;
490 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
491 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
492 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
493 	buf = stream->alloc(totalSize);
494 	ptr = buf;
495 	int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
496 	memcpy(ptr, &totalSize, 4);  ptr += 4;
497 
498 		memcpy(ptr, &red, 4); ptr += 4;
499 		memcpy(ptr, &green, 4); ptr += 4;
500 		memcpy(ptr, &blue, 4); ptr += 4;
501 		memcpy(ptr, &alpha, 4); ptr += 4;
502 
503 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
504 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
505 
506 }
507 
glClearDepthf_enc(void * self,GLclampf depth)508 void glClearDepthf_enc(void *self , GLclampf depth)
509 {
510 
511 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
512 	IOStream *stream = ctx->m_stream;
513 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
514 	bool useChecksum = checksumCalculator->getVersion() > 0;
515 
516 	 unsigned char *ptr;
517 	 unsigned char *buf;
518 	 const size_t sizeWithoutChecksum = 8 + 4;
519 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
520 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
521 	buf = stream->alloc(totalSize);
522 	ptr = buf;
523 	int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
524 	memcpy(ptr, &totalSize, 4);  ptr += 4;
525 
526 		memcpy(ptr, &depth, 4); ptr += 4;
527 
528 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
529 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
530 
531 }
532 
glClearStencil_enc(void * self,GLint s)533 void glClearStencil_enc(void *self , GLint s)
534 {
535 
536 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
537 	IOStream *stream = ctx->m_stream;
538 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
539 	bool useChecksum = checksumCalculator->getVersion() > 0;
540 
541 	 unsigned char *ptr;
542 	 unsigned char *buf;
543 	 const size_t sizeWithoutChecksum = 8 + 4;
544 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
545 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
546 	buf = stream->alloc(totalSize);
547 	ptr = buf;
548 	int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
549 	memcpy(ptr, &totalSize, 4);  ptr += 4;
550 
551 		memcpy(ptr, &s, 4); ptr += 4;
552 
553 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
554 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
555 
556 }
557 
glColorMask_enc(void * self,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)558 void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
559 {
560 
561 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
562 	IOStream *stream = ctx->m_stream;
563 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
564 	bool useChecksum = checksumCalculator->getVersion() > 0;
565 
566 	 unsigned char *ptr;
567 	 unsigned char *buf;
568 	 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
569 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
570 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
571 	buf = stream->alloc(totalSize);
572 	ptr = buf;
573 	int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
574 	memcpy(ptr, &totalSize, 4);  ptr += 4;
575 
576 		memcpy(ptr, &red, 1); ptr += 1;
577 		memcpy(ptr, &green, 1); ptr += 1;
578 		memcpy(ptr, &blue, 1); ptr += 1;
579 		memcpy(ptr, &alpha, 1); ptr += 1;
580 
581 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
582 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
583 
584 }
585 
glCompileShader_enc(void * self,GLuint shader)586 void glCompileShader_enc(void *self , GLuint shader)
587 {
588 
589 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
590 	IOStream *stream = ctx->m_stream;
591 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
592 	bool useChecksum = checksumCalculator->getVersion() > 0;
593 
594 	 unsigned char *ptr;
595 	 unsigned char *buf;
596 	 const size_t sizeWithoutChecksum = 8 + 4;
597 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
598 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
599 	buf = stream->alloc(totalSize);
600 	ptr = buf;
601 	int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
602 	memcpy(ptr, &totalSize, 4);  ptr += 4;
603 
604 		memcpy(ptr, &shader, 4); ptr += 4;
605 
606 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
607 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
608 
609 }
610 
glCompressedTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)611 void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
612 {
613 
614 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
615 	IOStream *stream = ctx->m_stream;
616 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
617 	bool useChecksum = checksumCalculator->getVersion() > 0;
618 
619 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
620 	 unsigned char *ptr;
621 	 unsigned char *buf;
622 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
623 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
624 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
625 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
626 	ptr = buf;
627 	int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
628 	memcpy(ptr, &totalSize, 4);  ptr += 4;
629 
630 		memcpy(ptr, &target, 4); ptr += 4;
631 		memcpy(ptr, &level, 4); ptr += 4;
632 		memcpy(ptr, &internalformat, 4); ptr += 4;
633 		memcpy(ptr, &width, 4); ptr += 4;
634 		memcpy(ptr, &height, 4); ptr += 4;
635 		memcpy(ptr, &border, 4); ptr += 4;
636 		memcpy(ptr, &imageSize, 4); ptr += 4;
637 
638 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
639 	stream->flush();
640 	stream->writeFully(&__size_data,4);
641 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
642 	if (data != NULL) {
643 		stream->writeFully(data, __size_data);
644 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
645 	}
646 	buf = stream->alloc(checksumSize);
647 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
648 
649 }
650 
glCompressedTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)651 void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
652 {
653 
654 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
655 	IOStream *stream = ctx->m_stream;
656 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
657 	bool useChecksum = checksumCalculator->getVersion() > 0;
658 
659 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
660 	 unsigned char *ptr;
661 	 unsigned char *buf;
662 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
663 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
664 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
665 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
666 	ptr = buf;
667 	int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
668 	memcpy(ptr, &totalSize, 4);  ptr += 4;
669 
670 		memcpy(ptr, &target, 4); ptr += 4;
671 		memcpy(ptr, &level, 4); ptr += 4;
672 		memcpy(ptr, &xoffset, 4); ptr += 4;
673 		memcpy(ptr, &yoffset, 4); ptr += 4;
674 		memcpy(ptr, &width, 4); ptr += 4;
675 		memcpy(ptr, &height, 4); ptr += 4;
676 		memcpy(ptr, &format, 4); ptr += 4;
677 		memcpy(ptr, &imageSize, 4); ptr += 4;
678 
679 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
680 	stream->flush();
681 	stream->writeFully(&__size_data,4);
682 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
683 	if (data != NULL) {
684 		stream->writeFully(data, __size_data);
685 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
686 	}
687 	buf = stream->alloc(checksumSize);
688 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
689 
690 }
691 
glCopyTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)692 void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
693 {
694 
695 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
696 	IOStream *stream = ctx->m_stream;
697 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
698 	bool useChecksum = checksumCalculator->getVersion() > 0;
699 
700 	 unsigned char *ptr;
701 	 unsigned char *buf;
702 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
703 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
704 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
705 	buf = stream->alloc(totalSize);
706 	ptr = buf;
707 	int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
708 	memcpy(ptr, &totalSize, 4);  ptr += 4;
709 
710 		memcpy(ptr, &target, 4); ptr += 4;
711 		memcpy(ptr, &level, 4); ptr += 4;
712 		memcpy(ptr, &internalformat, 4); ptr += 4;
713 		memcpy(ptr, &x, 4); ptr += 4;
714 		memcpy(ptr, &y, 4); ptr += 4;
715 		memcpy(ptr, &width, 4); ptr += 4;
716 		memcpy(ptr, &height, 4); ptr += 4;
717 		memcpy(ptr, &border, 4); ptr += 4;
718 
719 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
720 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
721 
722 }
723 
glCopyTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)724 void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
725 {
726 
727 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
728 	IOStream *stream = ctx->m_stream;
729 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
730 	bool useChecksum = checksumCalculator->getVersion() > 0;
731 
732 	 unsigned char *ptr;
733 	 unsigned char *buf;
734 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
735 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
736 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
737 	buf = stream->alloc(totalSize);
738 	ptr = buf;
739 	int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
740 	memcpy(ptr, &totalSize, 4);  ptr += 4;
741 
742 		memcpy(ptr, &target, 4); ptr += 4;
743 		memcpy(ptr, &level, 4); ptr += 4;
744 		memcpy(ptr, &xoffset, 4); ptr += 4;
745 		memcpy(ptr, &yoffset, 4); ptr += 4;
746 		memcpy(ptr, &x, 4); ptr += 4;
747 		memcpy(ptr, &y, 4); ptr += 4;
748 		memcpy(ptr, &width, 4); ptr += 4;
749 		memcpy(ptr, &height, 4); ptr += 4;
750 
751 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
752 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
753 
754 }
755 
glCreateProgram_enc(void * self)756 GLuint glCreateProgram_enc(void *self )
757 {
758 
759 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
760 	IOStream *stream = ctx->m_stream;
761 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
762 	bool useChecksum = checksumCalculator->getVersion() > 0;
763 
764 	 unsigned char *ptr;
765 	 unsigned char *buf;
766 	 const size_t sizeWithoutChecksum = 8;
767 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
768 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
769 	buf = stream->alloc(totalSize);
770 	ptr = buf;
771 	int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
772 	memcpy(ptr, &totalSize, 4);  ptr += 4;
773 
774 
775 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
776 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
777 
778 
779 	GLuint retval;
780 	stream->readback(&retval, 4);
781 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
782 	if (useChecksum) {
783 		unsigned char *checksumBufPtr = NULL;
784 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
785 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
786 		stream->readback(checksumBufPtr, checksumSize);
787 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
788 			ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
789 			abort();
790 		}
791 	}
792 	return retval;
793 }
794 
glCreateShader_enc(void * self,GLenum type)795 GLuint glCreateShader_enc(void *self , GLenum type)
796 {
797 
798 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
799 	IOStream *stream = ctx->m_stream;
800 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
801 	bool useChecksum = checksumCalculator->getVersion() > 0;
802 
803 	 unsigned char *ptr;
804 	 unsigned char *buf;
805 	 const size_t sizeWithoutChecksum = 8 + 4;
806 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
807 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
808 	buf = stream->alloc(totalSize);
809 	ptr = buf;
810 	int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
811 	memcpy(ptr, &totalSize, 4);  ptr += 4;
812 
813 		memcpy(ptr, &type, 4); ptr += 4;
814 
815 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
816 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
817 
818 
819 	GLuint retval;
820 	stream->readback(&retval, 4);
821 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
822 	if (useChecksum) {
823 		unsigned char *checksumBufPtr = NULL;
824 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
825 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
826 		stream->readback(checksumBufPtr, checksumSize);
827 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
828 			ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
829 			abort();
830 		}
831 	}
832 	return retval;
833 }
834 
glCullFace_enc(void * self,GLenum mode)835 void glCullFace_enc(void *self , GLenum mode)
836 {
837 
838 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
839 	IOStream *stream = ctx->m_stream;
840 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
841 	bool useChecksum = checksumCalculator->getVersion() > 0;
842 
843 	 unsigned char *ptr;
844 	 unsigned char *buf;
845 	 const size_t sizeWithoutChecksum = 8 + 4;
846 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
847 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
848 	buf = stream->alloc(totalSize);
849 	ptr = buf;
850 	int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
851 	memcpy(ptr, &totalSize, 4);  ptr += 4;
852 
853 		memcpy(ptr, &mode, 4); ptr += 4;
854 
855 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
856 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
857 
858 }
859 
glDeleteBuffers_enc(void * self,GLsizei n,const GLuint * buffers)860 void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
861 {
862 
863 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
864 	IOStream *stream = ctx->m_stream;
865 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
866 	bool useChecksum = checksumCalculator->getVersion() > 0;
867 
868 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
869 	 unsigned char *ptr;
870 	 unsigned char *buf;
871 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
872 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
873 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
874 	buf = stream->alloc(totalSize);
875 	ptr = buf;
876 	int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
877 	memcpy(ptr, &totalSize, 4);  ptr += 4;
878 
879 		memcpy(ptr, &n, 4); ptr += 4;
880 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
881 	memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
882 
883 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
884 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
885 
886 }
887 
glDeleteFramebuffers_enc(void * self,GLsizei n,const GLuint * framebuffers)888 void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
889 {
890 
891 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
892 	IOStream *stream = ctx->m_stream;
893 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
894 	bool useChecksum = checksumCalculator->getVersion() > 0;
895 
896 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
897 	 unsigned char *ptr;
898 	 unsigned char *buf;
899 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
900 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
901 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
902 	buf = stream->alloc(totalSize);
903 	ptr = buf;
904 	int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
905 	memcpy(ptr, &totalSize, 4);  ptr += 4;
906 
907 		memcpy(ptr, &n, 4); ptr += 4;
908 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
909 	memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
910 
911 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
912 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
913 
914 }
915 
glDeleteProgram_enc(void * self,GLuint program)916 void glDeleteProgram_enc(void *self , GLuint program)
917 {
918 
919 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
920 	IOStream *stream = ctx->m_stream;
921 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
922 	bool useChecksum = checksumCalculator->getVersion() > 0;
923 
924 	 unsigned char *ptr;
925 	 unsigned char *buf;
926 	 const size_t sizeWithoutChecksum = 8 + 4;
927 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
928 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
929 	buf = stream->alloc(totalSize);
930 	ptr = buf;
931 	int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
932 	memcpy(ptr, &totalSize, 4);  ptr += 4;
933 
934 		memcpy(ptr, &program, 4); ptr += 4;
935 
936 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
937 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
938 
939 }
940 
glDeleteRenderbuffers_enc(void * self,GLsizei n,const GLuint * renderbuffers)941 void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
942 {
943 
944 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
945 	IOStream *stream = ctx->m_stream;
946 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
947 	bool useChecksum = checksumCalculator->getVersion() > 0;
948 
949 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
950 	 unsigned char *ptr;
951 	 unsigned char *buf;
952 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
953 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
954 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
955 	buf = stream->alloc(totalSize);
956 	ptr = buf;
957 	int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
958 	memcpy(ptr, &totalSize, 4);  ptr += 4;
959 
960 		memcpy(ptr, &n, 4); ptr += 4;
961 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
962 	memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
963 
964 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
965 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
966 
967 }
968 
glDeleteShader_enc(void * self,GLuint shader)969 void glDeleteShader_enc(void *self , GLuint shader)
970 {
971 
972 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
973 	IOStream *stream = ctx->m_stream;
974 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
975 	bool useChecksum = checksumCalculator->getVersion() > 0;
976 
977 	 unsigned char *ptr;
978 	 unsigned char *buf;
979 	 const size_t sizeWithoutChecksum = 8 + 4;
980 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
981 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
982 	buf = stream->alloc(totalSize);
983 	ptr = buf;
984 	int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
985 	memcpy(ptr, &totalSize, 4);  ptr += 4;
986 
987 		memcpy(ptr, &shader, 4); ptr += 4;
988 
989 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
990 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
991 
992 }
993 
glDeleteTextures_enc(void * self,GLsizei n,const GLuint * textures)994 void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
995 {
996 
997 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
998 	IOStream *stream = ctx->m_stream;
999 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1000 	bool useChecksum = checksumCalculator->getVersion() > 0;
1001 
1002 	const unsigned int __size_textures =  (n * sizeof(GLuint));
1003 	 unsigned char *ptr;
1004 	 unsigned char *buf;
1005 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
1006 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1007 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1008 	buf = stream->alloc(totalSize);
1009 	ptr = buf;
1010 	int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
1011 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1012 
1013 		memcpy(ptr, &n, 4); ptr += 4;
1014 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
1015 	memcpy(ptr, textures, __size_textures);ptr += __size_textures;
1016 
1017 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1018 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1019 
1020 }
1021 
glDepthFunc_enc(void * self,GLenum func)1022 void glDepthFunc_enc(void *self , GLenum func)
1023 {
1024 
1025 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1026 	IOStream *stream = ctx->m_stream;
1027 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1028 	bool useChecksum = checksumCalculator->getVersion() > 0;
1029 
1030 	 unsigned char *ptr;
1031 	 unsigned char *buf;
1032 	 const size_t sizeWithoutChecksum = 8 + 4;
1033 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1034 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1035 	buf = stream->alloc(totalSize);
1036 	ptr = buf;
1037 	int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
1038 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1039 
1040 		memcpy(ptr, &func, 4); ptr += 4;
1041 
1042 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1043 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1044 
1045 }
1046 
glDepthMask_enc(void * self,GLboolean flag)1047 void glDepthMask_enc(void *self , GLboolean flag)
1048 {
1049 
1050 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1051 	IOStream *stream = ctx->m_stream;
1052 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1053 	bool useChecksum = checksumCalculator->getVersion() > 0;
1054 
1055 	 unsigned char *ptr;
1056 	 unsigned char *buf;
1057 	 const size_t sizeWithoutChecksum = 8 + 1;
1058 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1059 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1060 	buf = stream->alloc(totalSize);
1061 	ptr = buf;
1062 	int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
1063 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1064 
1065 		memcpy(ptr, &flag, 1); ptr += 1;
1066 
1067 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1068 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1069 
1070 }
1071 
glDepthRangef_enc(void * self,GLclampf zNear,GLclampf zFar)1072 void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
1073 {
1074 
1075 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1076 	IOStream *stream = ctx->m_stream;
1077 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1078 	bool useChecksum = checksumCalculator->getVersion() > 0;
1079 
1080 	 unsigned char *ptr;
1081 	 unsigned char *buf;
1082 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1083 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1084 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1085 	buf = stream->alloc(totalSize);
1086 	ptr = buf;
1087 	int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
1088 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1089 
1090 		memcpy(ptr, &zNear, 4); ptr += 4;
1091 		memcpy(ptr, &zFar, 4); ptr += 4;
1092 
1093 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1094 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1095 
1096 }
1097 
glDetachShader_enc(void * self,GLuint program,GLuint shader)1098 void glDetachShader_enc(void *self , GLuint program, GLuint shader)
1099 {
1100 
1101 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1102 	IOStream *stream = ctx->m_stream;
1103 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1104 	bool useChecksum = checksumCalculator->getVersion() > 0;
1105 
1106 	 unsigned char *ptr;
1107 	 unsigned char *buf;
1108 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1109 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1110 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1111 	buf = stream->alloc(totalSize);
1112 	ptr = buf;
1113 	int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
1114 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1115 
1116 		memcpy(ptr, &program, 4); ptr += 4;
1117 		memcpy(ptr, &shader, 4); ptr += 4;
1118 
1119 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1120 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1121 
1122 }
1123 
glDisable_enc(void * self,GLenum cap)1124 void glDisable_enc(void *self , GLenum cap)
1125 {
1126 
1127 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1128 	IOStream *stream = ctx->m_stream;
1129 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1130 	bool useChecksum = checksumCalculator->getVersion() > 0;
1131 
1132 	 unsigned char *ptr;
1133 	 unsigned char *buf;
1134 	 const size_t sizeWithoutChecksum = 8 + 4;
1135 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1136 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1137 	buf = stream->alloc(totalSize);
1138 	ptr = buf;
1139 	int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
1140 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1141 
1142 		memcpy(ptr, &cap, 4); ptr += 4;
1143 
1144 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1145 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1146 
1147 }
1148 
glDisableVertexAttribArray_enc(void * self,GLuint index)1149 void glDisableVertexAttribArray_enc(void *self , GLuint index)
1150 {
1151 
1152 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1153 	IOStream *stream = ctx->m_stream;
1154 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1155 	bool useChecksum = checksumCalculator->getVersion() > 0;
1156 
1157 	 unsigned char *ptr;
1158 	 unsigned char *buf;
1159 	 const size_t sizeWithoutChecksum = 8 + 4;
1160 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1161 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1162 	buf = stream->alloc(totalSize);
1163 	ptr = buf;
1164 	int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
1165 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1166 
1167 		memcpy(ptr, &index, 4); ptr += 4;
1168 
1169 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1170 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1171 
1172 }
1173 
glDrawArrays_enc(void * self,GLenum mode,GLint first,GLsizei count)1174 void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
1175 {
1176 
1177 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1178 	IOStream *stream = ctx->m_stream;
1179 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1180 	bool useChecksum = checksumCalculator->getVersion() > 0;
1181 
1182 	 unsigned char *ptr;
1183 	 unsigned char *buf;
1184 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1185 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1186 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1187 	buf = stream->alloc(totalSize);
1188 	ptr = buf;
1189 	int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
1190 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1191 
1192 		memcpy(ptr, &mode, 4); ptr += 4;
1193 		memcpy(ptr, &first, 4); ptr += 4;
1194 		memcpy(ptr, &count, 4); ptr += 4;
1195 
1196 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1197 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1198 
1199 }
1200 
glEnable_enc(void * self,GLenum cap)1201 void glEnable_enc(void *self , GLenum cap)
1202 {
1203 
1204 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1205 	IOStream *stream = ctx->m_stream;
1206 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1207 	bool useChecksum = checksumCalculator->getVersion() > 0;
1208 
1209 	 unsigned char *ptr;
1210 	 unsigned char *buf;
1211 	 const size_t sizeWithoutChecksum = 8 + 4;
1212 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1213 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1214 	buf = stream->alloc(totalSize);
1215 	ptr = buf;
1216 	int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
1217 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1218 
1219 		memcpy(ptr, &cap, 4); ptr += 4;
1220 
1221 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1222 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1223 
1224 }
1225 
glEnableVertexAttribArray_enc(void * self,GLuint index)1226 void glEnableVertexAttribArray_enc(void *self , GLuint index)
1227 {
1228 
1229 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1230 	IOStream *stream = ctx->m_stream;
1231 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1232 	bool useChecksum = checksumCalculator->getVersion() > 0;
1233 
1234 	 unsigned char *ptr;
1235 	 unsigned char *buf;
1236 	 const size_t sizeWithoutChecksum = 8 + 4;
1237 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1238 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1239 	buf = stream->alloc(totalSize);
1240 	ptr = buf;
1241 	int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
1242 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1243 
1244 		memcpy(ptr, &index, 4); ptr += 4;
1245 
1246 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1247 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1248 
1249 }
1250 
glFinish_enc(void * self)1251 void glFinish_enc(void *self )
1252 {
1253 
1254 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1255 	IOStream *stream = ctx->m_stream;
1256 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1257 	bool useChecksum = checksumCalculator->getVersion() > 0;
1258 
1259 	 unsigned char *ptr;
1260 	 unsigned char *buf;
1261 	 const size_t sizeWithoutChecksum = 8;
1262 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1263 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1264 	buf = stream->alloc(totalSize);
1265 	ptr = buf;
1266 	int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
1267 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1268 
1269 
1270 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1271 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1272 
1273 }
1274 
glFlush_enc(void * self)1275 void glFlush_enc(void *self )
1276 {
1277 
1278 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1279 	IOStream *stream = ctx->m_stream;
1280 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1281 	bool useChecksum = checksumCalculator->getVersion() > 0;
1282 
1283 	 unsigned char *ptr;
1284 	 unsigned char *buf;
1285 	 const size_t sizeWithoutChecksum = 8;
1286 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1287 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1288 	buf = stream->alloc(totalSize);
1289 	ptr = buf;
1290 	int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
1291 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1292 
1293 
1294 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1295 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1296 
1297 }
1298 
glFramebufferRenderbuffer_enc(void * self,GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)1299 void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1300 {
1301 
1302 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1303 	IOStream *stream = ctx->m_stream;
1304 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1305 	bool useChecksum = checksumCalculator->getVersion() > 0;
1306 
1307 	 unsigned char *ptr;
1308 	 unsigned char *buf;
1309 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
1310 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1311 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1312 	buf = stream->alloc(totalSize);
1313 	ptr = buf;
1314 	int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
1315 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1316 
1317 		memcpy(ptr, &target, 4); ptr += 4;
1318 		memcpy(ptr, &attachment, 4); ptr += 4;
1319 		memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
1320 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
1321 
1322 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1323 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1324 
1325 }
1326 
glFramebufferTexture2D_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)1327 void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
1328 {
1329 
1330 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1331 	IOStream *stream = ctx->m_stream;
1332 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1333 	bool useChecksum = checksumCalculator->getVersion() > 0;
1334 
1335 	 unsigned char *ptr;
1336 	 unsigned char *buf;
1337 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
1338 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1339 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1340 	buf = stream->alloc(totalSize);
1341 	ptr = buf;
1342 	int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
1343 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1344 
1345 		memcpy(ptr, &target, 4); ptr += 4;
1346 		memcpy(ptr, &attachment, 4); ptr += 4;
1347 		memcpy(ptr, &textarget, 4); ptr += 4;
1348 		memcpy(ptr, &texture, 4); ptr += 4;
1349 		memcpy(ptr, &level, 4); ptr += 4;
1350 
1351 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1352 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1353 
1354 }
1355 
glFrontFace_enc(void * self,GLenum mode)1356 void glFrontFace_enc(void *self , GLenum mode)
1357 {
1358 
1359 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1360 	IOStream *stream = ctx->m_stream;
1361 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1362 	bool useChecksum = checksumCalculator->getVersion() > 0;
1363 
1364 	 unsigned char *ptr;
1365 	 unsigned char *buf;
1366 	 const size_t sizeWithoutChecksum = 8 + 4;
1367 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1368 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1369 	buf = stream->alloc(totalSize);
1370 	ptr = buf;
1371 	int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
1372 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1373 
1374 		memcpy(ptr, &mode, 4); ptr += 4;
1375 
1376 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1377 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1378 
1379 }
1380 
glGenBuffers_enc(void * self,GLsizei n,GLuint * buffers)1381 void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
1382 {
1383 
1384 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1385 	IOStream *stream = ctx->m_stream;
1386 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1387 	bool useChecksum = checksumCalculator->getVersion() > 0;
1388 
1389 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
1390 	 unsigned char *ptr;
1391 	 unsigned char *buf;
1392 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1393 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1394 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1395 	buf = stream->alloc(totalSize);
1396 	ptr = buf;
1397 	int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1398 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1399 
1400 		memcpy(ptr, &n, 4); ptr += 4;
1401 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
1402 
1403 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1404 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1405 
1406 	stream->readback(buffers, __size_buffers);
1407 	if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
1408 	if (useChecksum) {
1409 		unsigned char *checksumBufPtr = NULL;
1410 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1411 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1412 		stream->readback(checksumBufPtr, checksumSize);
1413 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1414 			ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
1415 			abort();
1416 		}
1417 	}
1418 }
1419 
glGenerateMipmap_enc(void * self,GLenum target)1420 void glGenerateMipmap_enc(void *self , GLenum target)
1421 {
1422 
1423 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1424 	IOStream *stream = ctx->m_stream;
1425 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1426 	bool useChecksum = checksumCalculator->getVersion() > 0;
1427 
1428 	 unsigned char *ptr;
1429 	 unsigned char *buf;
1430 	 const size_t sizeWithoutChecksum = 8 + 4;
1431 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1432 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1433 	buf = stream->alloc(totalSize);
1434 	ptr = buf;
1435 	int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
1436 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1437 
1438 		memcpy(ptr, &target, 4); ptr += 4;
1439 
1440 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1441 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1442 
1443 }
1444 
glGenFramebuffers_enc(void * self,GLsizei n,GLuint * framebuffers)1445 void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
1446 {
1447 
1448 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1449 	IOStream *stream = ctx->m_stream;
1450 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1451 	bool useChecksum = checksumCalculator->getVersion() > 0;
1452 
1453 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
1454 	 unsigned char *ptr;
1455 	 unsigned char *buf;
1456 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1457 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1458 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1459 	buf = stream->alloc(totalSize);
1460 	ptr = buf;
1461 	int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1462 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1463 
1464 		memcpy(ptr, &n, 4); ptr += 4;
1465 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
1466 
1467 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1468 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1469 
1470 	stream->readback(framebuffers, __size_framebuffers);
1471 	if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
1472 	if (useChecksum) {
1473 		unsigned char *checksumBufPtr = NULL;
1474 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1475 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1476 		stream->readback(checksumBufPtr, checksumSize);
1477 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1478 			ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
1479 			abort();
1480 		}
1481 	}
1482 }
1483 
glGenRenderbuffers_enc(void * self,GLsizei n,GLuint * renderbuffers)1484 void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
1485 {
1486 
1487 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1488 	IOStream *stream = ctx->m_stream;
1489 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1490 	bool useChecksum = checksumCalculator->getVersion() > 0;
1491 
1492 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
1493 	 unsigned char *ptr;
1494 	 unsigned char *buf;
1495 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1496 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1497 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1498 	buf = stream->alloc(totalSize);
1499 	ptr = buf;
1500 	int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1501 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1502 
1503 		memcpy(ptr, &n, 4); ptr += 4;
1504 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
1505 
1506 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1507 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1508 
1509 	stream->readback(renderbuffers, __size_renderbuffers);
1510 	if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
1511 	if (useChecksum) {
1512 		unsigned char *checksumBufPtr = NULL;
1513 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1514 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1515 		stream->readback(checksumBufPtr, checksumSize);
1516 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1517 			ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
1518 			abort();
1519 		}
1520 	}
1521 }
1522 
glGenTextures_enc(void * self,GLsizei n,GLuint * textures)1523 void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
1524 {
1525 
1526 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1527 	IOStream *stream = ctx->m_stream;
1528 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1529 	bool useChecksum = checksumCalculator->getVersion() > 0;
1530 
1531 	const unsigned int __size_textures =  (n * sizeof(GLuint));
1532 	 unsigned char *ptr;
1533 	 unsigned char *buf;
1534 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1535 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1536 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1537 	buf = stream->alloc(totalSize);
1538 	ptr = buf;
1539 	int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
1540 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1541 
1542 		memcpy(ptr, &n, 4); ptr += 4;
1543 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
1544 
1545 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1546 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1547 
1548 	stream->readback(textures, __size_textures);
1549 	if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
1550 	if (useChecksum) {
1551 		unsigned char *checksumBufPtr = NULL;
1552 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1553 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1554 		stream->readback(checksumBufPtr, checksumSize);
1555 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1556 			ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
1557 			abort();
1558 		}
1559 	}
1560 }
1561 
glGetActiveAttrib_enc(void * self,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)1562 void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1563 {
1564 
1565 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1566 	IOStream *stream = ctx->m_stream;
1567 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1568 	bool useChecksum = checksumCalculator->getVersion() > 0;
1569 
1570 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
1571 	const unsigned int __size_size = ((size != NULL) ?  (sizeof(GLint)) : 0);
1572 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
1573 	const unsigned int __size_name = ((name != NULL) ?  bufsize : 0);
1574 	 unsigned char *ptr;
1575 	 unsigned char *buf;
1576 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
1577 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1578 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1579 	buf = stream->alloc(totalSize);
1580 	ptr = buf;
1581 	int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
1582 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1583 
1584 		memcpy(ptr, &program, 4); ptr += 4;
1585 		memcpy(ptr, &index, 4); ptr += 4;
1586 		memcpy(ptr, &bufsize, 4); ptr += 4;
1587 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
1588 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
1589 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
1590 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
1591 
1592 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1593 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1594 
1595 	if (length != NULL) {
1596 		stream->readback(length, __size_length);
1597 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1598 	}
1599 	if (size != NULL) {
1600 		stream->readback(size, __size_size);
1601 		if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1602 	}
1603 	if (type != NULL) {
1604 		stream->readback(type, __size_type);
1605 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1606 	}
1607 	if (name != NULL) {
1608 		stream->readback(name, __size_name);
1609 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1610 	}
1611 	if (useChecksum) {
1612 		unsigned char *checksumBufPtr = NULL;
1613 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1614 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1615 		stream->readback(checksumBufPtr, checksumSize);
1616 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1617 			ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
1618 			abort();
1619 		}
1620 	}
1621 }
1622 
glGetActiveUniform_enc(void * self,GLuint program,GLuint index,GLsizei bufsize,GLsizei * length,GLint * size,GLenum * type,GLchar * name)1623 void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1624 {
1625 
1626 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1627 	IOStream *stream = ctx->m_stream;
1628 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1629 	bool useChecksum = checksumCalculator->getVersion() > 0;
1630 
1631 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
1632 	const unsigned int __size_size = ((size != NULL) ?  (sizeof(GLint)) : 0);
1633 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
1634 	const unsigned int __size_name = ((name != NULL) ?  bufsize : 0);
1635 	 unsigned char *ptr;
1636 	 unsigned char *buf;
1637 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
1638 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1639 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1640 	buf = stream->alloc(totalSize);
1641 	ptr = buf;
1642 	int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
1643 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1644 
1645 		memcpy(ptr, &program, 4); ptr += 4;
1646 		memcpy(ptr, &index, 4); ptr += 4;
1647 		memcpy(ptr, &bufsize, 4); ptr += 4;
1648 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
1649 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
1650 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
1651 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
1652 
1653 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1654 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1655 
1656 	if (length != NULL) {
1657 		stream->readback(length, __size_length);
1658 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1659 	}
1660 	if (size != NULL) {
1661 		stream->readback(size, __size_size);
1662 		if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1663 	}
1664 	if (type != NULL) {
1665 		stream->readback(type, __size_type);
1666 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1667 	}
1668 	if (name != NULL) {
1669 		stream->readback(name, __size_name);
1670 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1671 	}
1672 	if (useChecksum) {
1673 		unsigned char *checksumBufPtr = NULL;
1674 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1675 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1676 		stream->readback(checksumBufPtr, checksumSize);
1677 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1678 			ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
1679 			abort();
1680 		}
1681 	}
1682 }
1683 
glGetAttachedShaders_enc(void * self,GLuint program,GLsizei maxcount,GLsizei * count,GLuint * shaders)1684 void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1685 {
1686 
1687 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1688 	IOStream *stream = ctx->m_stream;
1689 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1690 	bool useChecksum = checksumCalculator->getVersion() > 0;
1691 
1692 	const unsigned int __size_count = ((count != NULL) ?  (sizeof(GLsizei)) : 0);
1693 	const unsigned int __size_shaders =  (maxcount*sizeof(GLuint));
1694 	 unsigned char *ptr;
1695 	 unsigned char *buf;
1696 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
1697 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1698 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1699 	buf = stream->alloc(totalSize);
1700 	ptr = buf;
1701 	int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
1702 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1703 
1704 		memcpy(ptr, &program, 4); ptr += 4;
1705 		memcpy(ptr, &maxcount, 4); ptr += 4;
1706 	*(unsigned int *)(ptr) = __size_count; ptr += 4;
1707 	*(unsigned int *)(ptr) = __size_shaders; ptr += 4;
1708 
1709 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1710 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1711 
1712 	if (count != NULL) {
1713 		stream->readback(count, __size_count);
1714 		if (useChecksum) checksumCalculator->addBuffer(count, __size_count);
1715 	}
1716 	stream->readback(shaders, __size_shaders);
1717 	if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
1718 	if (useChecksum) {
1719 		unsigned char *checksumBufPtr = NULL;
1720 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1721 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1722 		stream->readback(checksumBufPtr, checksumSize);
1723 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1724 			ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
1725 			abort();
1726 		}
1727 	}
1728 }
1729 
glGetAttribLocation_enc(void * self,GLuint program,const GLchar * name)1730 int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
1731 {
1732 
1733 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1734 	IOStream *stream = ctx->m_stream;
1735 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1736 	bool useChecksum = checksumCalculator->getVersion() > 0;
1737 
1738 	const unsigned int __size_name =  (strlen(name) + 1);
1739 	 unsigned char *ptr;
1740 	 unsigned char *buf;
1741 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
1742 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1743 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1744 	buf = stream->alloc(totalSize);
1745 	ptr = buf;
1746 	int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
1747 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1748 
1749 		memcpy(ptr, &program, 4); ptr += 4;
1750 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
1751 	memcpy(ptr, name, __size_name);ptr += __size_name;
1752 
1753 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1754 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1755 
1756 
1757 	int retval;
1758 	stream->readback(&retval, 4);
1759 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1760 	if (useChecksum) {
1761 		unsigned char *checksumBufPtr = NULL;
1762 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1763 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1764 		stream->readback(checksumBufPtr, checksumSize);
1765 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1766 			ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
1767 			abort();
1768 		}
1769 	}
1770 	return retval;
1771 }
1772 
glGetBooleanv_enc(void * self,GLenum pname,GLboolean * params)1773 void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
1774 {
1775 
1776 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1777 	IOStream *stream = ctx->m_stream;
1778 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1779 	bool useChecksum = checksumCalculator->getVersion() > 0;
1780 
1781 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLboolean));
1782 	 unsigned char *ptr;
1783 	 unsigned char *buf;
1784 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1785 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1786 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1787 	buf = stream->alloc(totalSize);
1788 	ptr = buf;
1789 	int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
1790 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1791 
1792 		memcpy(ptr, &pname, 4); ptr += 4;
1793 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1794 
1795 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1796 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1797 
1798 	stream->readback(params, __size_params);
1799 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1800 	if (useChecksum) {
1801 		unsigned char *checksumBufPtr = NULL;
1802 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1803 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1804 		stream->readback(checksumBufPtr, checksumSize);
1805 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1806 			ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
1807 			abort();
1808 		}
1809 	}
1810 }
1811 
glGetBufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)1812 void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
1813 {
1814 
1815 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1816 	IOStream *stream = ctx->m_stream;
1817 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1818 	bool useChecksum = checksumCalculator->getVersion() > 0;
1819 
1820 	const unsigned int __size_params =  (sizeof(GLint));
1821 	 unsigned char *ptr;
1822 	 unsigned char *buf;
1823 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
1824 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1825 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1826 	buf = stream->alloc(totalSize);
1827 	ptr = buf;
1828 	int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
1829 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1830 
1831 		memcpy(ptr, &target, 4); ptr += 4;
1832 		memcpy(ptr, &pname, 4); ptr += 4;
1833 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1834 
1835 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1836 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1837 
1838 	stream->readback(params, __size_params);
1839 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1840 	if (useChecksum) {
1841 		unsigned char *checksumBufPtr = NULL;
1842 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1843 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1844 		stream->readback(checksumBufPtr, checksumSize);
1845 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1846 			ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
1847 			abort();
1848 		}
1849 	}
1850 }
1851 
glGetError_enc(void * self)1852 GLenum glGetError_enc(void *self )
1853 {
1854 
1855 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1856 	IOStream *stream = ctx->m_stream;
1857 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1858 	bool useChecksum = checksumCalculator->getVersion() > 0;
1859 
1860 	 unsigned char *ptr;
1861 	 unsigned char *buf;
1862 	 const size_t sizeWithoutChecksum = 8;
1863 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1864 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1865 	buf = stream->alloc(totalSize);
1866 	ptr = buf;
1867 	int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
1868 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1869 
1870 
1871 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1872 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1873 
1874 
1875 	GLenum retval;
1876 	stream->readback(&retval, 4);
1877 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1878 	if (useChecksum) {
1879 		unsigned char *checksumBufPtr = NULL;
1880 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1881 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1882 		stream->readback(checksumBufPtr, checksumSize);
1883 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1884 			ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
1885 			abort();
1886 		}
1887 	}
1888 	return retval;
1889 }
1890 
glGetFloatv_enc(void * self,GLenum pname,GLfloat * params)1891 void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
1892 {
1893 
1894 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1895 	IOStream *stream = ctx->m_stream;
1896 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1897 	bool useChecksum = checksumCalculator->getVersion() > 0;
1898 
1899 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
1900 	 unsigned char *ptr;
1901 	 unsigned char *buf;
1902 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1903 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1904 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1905 	buf = stream->alloc(totalSize);
1906 	ptr = buf;
1907 	int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
1908 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1909 
1910 		memcpy(ptr, &pname, 4); ptr += 4;
1911 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1912 
1913 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1914 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1915 
1916 	stream->readback(params, __size_params);
1917 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1918 	if (useChecksum) {
1919 		unsigned char *checksumBufPtr = NULL;
1920 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1921 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1922 		stream->readback(checksumBufPtr, checksumSize);
1923 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1924 			ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
1925 			abort();
1926 		}
1927 	}
1928 }
1929 
glGetFramebufferAttachmentParameteriv_enc(void * self,GLenum target,GLenum attachment,GLenum pname,GLint * params)1930 void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
1931 {
1932 
1933 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1934 	IOStream *stream = ctx->m_stream;
1935 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1936 	bool useChecksum = checksumCalculator->getVersion() > 0;
1937 
1938 	const unsigned int __size_params =  (sizeof(GLint));
1939 	 unsigned char *ptr;
1940 	 unsigned char *buf;
1941 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
1942 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1943 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1944 	buf = stream->alloc(totalSize);
1945 	ptr = buf;
1946 	int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
1947 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1948 
1949 		memcpy(ptr, &target, 4); ptr += 4;
1950 		memcpy(ptr, &attachment, 4); ptr += 4;
1951 		memcpy(ptr, &pname, 4); ptr += 4;
1952 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1953 
1954 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1955 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1956 
1957 	stream->readback(params, __size_params);
1958 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1959 	if (useChecksum) {
1960 		unsigned char *checksumBufPtr = NULL;
1961 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
1962 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1963 		stream->readback(checksumBufPtr, checksumSize);
1964 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
1965 			ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
1966 			abort();
1967 		}
1968 	}
1969 }
1970 
glGetIntegerv_enc(void * self,GLenum pname,GLint * params)1971 void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
1972 {
1973 
1974 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1975 	IOStream *stream = ctx->m_stream;
1976 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1977 	bool useChecksum = checksumCalculator->getVersion() > 0;
1978 
1979 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
1980 	 unsigned char *ptr;
1981 	 unsigned char *buf;
1982 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
1983 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1984 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1985 	buf = stream->alloc(totalSize);
1986 	ptr = buf;
1987 	int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
1988 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1989 
1990 		memcpy(ptr, &pname, 4); ptr += 4;
1991 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1992 
1993 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1994 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1995 
1996 	stream->readback(params, __size_params);
1997 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1998 	if (useChecksum) {
1999 		unsigned char *checksumBufPtr = NULL;
2000 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2001 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2002 		stream->readback(checksumBufPtr, checksumSize);
2003 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2004 			ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
2005 			abort();
2006 		}
2007 	}
2008 }
2009 
glGetProgramiv_enc(void * self,GLuint program,GLenum pname,GLint * params)2010 void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
2011 {
2012 
2013 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2014 	IOStream *stream = ctx->m_stream;
2015 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2016 	bool useChecksum = checksumCalculator->getVersion() > 0;
2017 
2018 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
2019 	 unsigned char *ptr;
2020 	 unsigned char *buf;
2021 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2022 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2023 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2024 	buf = stream->alloc(totalSize);
2025 	ptr = buf;
2026 	int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
2027 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2028 
2029 		memcpy(ptr, &program, 4); ptr += 4;
2030 		memcpy(ptr, &pname, 4); ptr += 4;
2031 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2032 
2033 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2034 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2035 
2036 	stream->readback(params, __size_params);
2037 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2038 	if (useChecksum) {
2039 		unsigned char *checksumBufPtr = NULL;
2040 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2041 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2042 		stream->readback(checksumBufPtr, checksumSize);
2043 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2044 			ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
2045 			abort();
2046 		}
2047 	}
2048 }
2049 
glGetProgramInfoLog_enc(void * self,GLuint program,GLsizei bufsize,GLsizei * length,GLchar * infolog)2050 void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2051 {
2052 
2053 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2054 	IOStream *stream = ctx->m_stream;
2055 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2056 	bool useChecksum = checksumCalculator->getVersion() > 0;
2057 
2058 	const unsigned int __size_length = ((length != NULL) ?  sizeof(GLsizei) : 0);
2059 	const unsigned int __size_infolog =  bufsize;
2060 	 unsigned char *ptr;
2061 	 unsigned char *buf;
2062 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2063 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2064 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2065 	buf = stream->alloc(totalSize);
2066 	ptr = buf;
2067 	int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
2068 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2069 
2070 		memcpy(ptr, &program, 4); ptr += 4;
2071 		memcpy(ptr, &bufsize, 4); ptr += 4;
2072 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
2073 	*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
2074 
2075 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2076 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2077 
2078 	if (length != NULL) {
2079 		stream->readback(length, __size_length);
2080 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2081 	}
2082 	stream->readback(infolog, __size_infolog);
2083 	if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2084 	if (useChecksum) {
2085 		unsigned char *checksumBufPtr = NULL;
2086 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2087 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2088 		stream->readback(checksumBufPtr, checksumSize);
2089 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2090 			ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
2091 			abort();
2092 		}
2093 	}
2094 }
2095 
glGetRenderbufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2096 void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2097 {
2098 
2099 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2100 	IOStream *stream = ctx->m_stream;
2101 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2102 	bool useChecksum = checksumCalculator->getVersion() > 0;
2103 
2104 	const unsigned int __size_params =  sizeof(GLint);
2105 	 unsigned char *ptr;
2106 	 unsigned char *buf;
2107 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2108 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2109 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2110 	buf = stream->alloc(totalSize);
2111 	ptr = buf;
2112 	int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2113 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2114 
2115 		memcpy(ptr, &target, 4); ptr += 4;
2116 		memcpy(ptr, &pname, 4); ptr += 4;
2117 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2118 
2119 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2120 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2121 
2122 	stream->readback(params, __size_params);
2123 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2124 	if (useChecksum) {
2125 		unsigned char *checksumBufPtr = NULL;
2126 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2127 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2128 		stream->readback(checksumBufPtr, checksumSize);
2129 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2130 			ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
2131 			abort();
2132 		}
2133 	}
2134 }
2135 
glGetShaderiv_enc(void * self,GLuint shader,GLenum pname,GLint * params)2136 void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
2137 {
2138 
2139 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2140 	IOStream *stream = ctx->m_stream;
2141 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2142 	bool useChecksum = checksumCalculator->getVersion() > 0;
2143 
2144 	const unsigned int __size_params =  sizeof(GLint);
2145 	 unsigned char *ptr;
2146 	 unsigned char *buf;
2147 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2148 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2149 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2150 	buf = stream->alloc(totalSize);
2151 	ptr = buf;
2152 	int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
2153 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2154 
2155 		memcpy(ptr, &shader, 4); ptr += 4;
2156 		memcpy(ptr, &pname, 4); ptr += 4;
2157 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2158 
2159 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2160 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2161 
2162 	stream->readback(params, __size_params);
2163 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2164 	if (useChecksum) {
2165 		unsigned char *checksumBufPtr = NULL;
2166 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2167 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2168 		stream->readback(checksumBufPtr, checksumSize);
2169 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2170 			ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n");
2171 			abort();
2172 		}
2173 	}
2174 }
2175 
glGetShaderInfoLog_enc(void * self,GLuint shader,GLsizei bufsize,GLsizei * length,GLchar * infolog)2176 void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2177 {
2178 
2179 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2180 	IOStream *stream = ctx->m_stream;
2181 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2182 	bool useChecksum = checksumCalculator->getVersion() > 0;
2183 
2184 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
2185 	const unsigned int __size_infolog =  bufsize;
2186 	 unsigned char *ptr;
2187 	 unsigned char *buf;
2188 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2189 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2190 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2191 	buf = stream->alloc(totalSize);
2192 	ptr = buf;
2193 	int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
2194 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2195 
2196 		memcpy(ptr, &shader, 4); ptr += 4;
2197 		memcpy(ptr, &bufsize, 4); ptr += 4;
2198 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
2199 	*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
2200 
2201 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2202 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2203 
2204 	if (length != NULL) {
2205 		stream->readback(length, __size_length);
2206 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2207 	}
2208 	stream->readback(infolog, __size_infolog);
2209 	if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2210 	if (useChecksum) {
2211 		unsigned char *checksumBufPtr = NULL;
2212 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2213 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2214 		stream->readback(checksumBufPtr, checksumSize);
2215 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2216 			ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n");
2217 			abort();
2218 		}
2219 	}
2220 }
2221 
glGetShaderPrecisionFormat_enc(void * self,GLenum shadertype,GLenum precisiontype,GLint * range,GLint * precision)2222 void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
2223 {
2224 
2225 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2226 	IOStream *stream = ctx->m_stream;
2227 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2228 	bool useChecksum = checksumCalculator->getVersion() > 0;
2229 
2230 	const unsigned int __size_range =  (2 * sizeof(GLint));
2231 	const unsigned int __size_precision =  (sizeof(GLint));
2232 	 unsigned char *ptr;
2233 	 unsigned char *buf;
2234 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2235 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2236 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2237 	buf = stream->alloc(totalSize);
2238 	ptr = buf;
2239 	int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
2240 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2241 
2242 		memcpy(ptr, &shadertype, 4); ptr += 4;
2243 		memcpy(ptr, &precisiontype, 4); ptr += 4;
2244 	*(unsigned int *)(ptr) = __size_range; ptr += 4;
2245 	*(unsigned int *)(ptr) = __size_precision; ptr += 4;
2246 
2247 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2248 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2249 
2250 	stream->readback(range, __size_range);
2251 	if (useChecksum) checksumCalculator->addBuffer(range, __size_range);
2252 	stream->readback(precision, __size_precision);
2253 	if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision);
2254 	if (useChecksum) {
2255 		unsigned char *checksumBufPtr = NULL;
2256 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2257 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2258 		stream->readback(checksumBufPtr, checksumSize);
2259 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2260 			ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n");
2261 			abort();
2262 		}
2263 	}
2264 }
2265 
glGetShaderSource_enc(void * self,GLuint shader,GLsizei bufsize,GLsizei * length,GLchar * source)2266 void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
2267 {
2268 
2269 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2270 	IOStream *stream = ctx->m_stream;
2271 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2272 	bool useChecksum = checksumCalculator->getVersion() > 0;
2273 
2274 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
2275 	const unsigned int __size_source =  bufsize;
2276 	 unsigned char *ptr;
2277 	 unsigned char *buf;
2278 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
2279 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2280 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2281 	buf = stream->alloc(totalSize);
2282 	ptr = buf;
2283 	int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
2284 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2285 
2286 		memcpy(ptr, &shader, 4); ptr += 4;
2287 		memcpy(ptr, &bufsize, 4); ptr += 4;
2288 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
2289 	*(unsigned int *)(ptr) = __size_source; ptr += 4;
2290 
2291 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2292 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2293 
2294 	if (length != NULL) {
2295 		stream->readback(length, __size_length);
2296 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2297 	}
2298 	stream->readback(source, __size_source);
2299 	if (useChecksum) checksumCalculator->addBuffer(source, __size_source);
2300 	if (useChecksum) {
2301 		unsigned char *checksumBufPtr = NULL;
2302 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2303 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2304 		stream->readback(checksumBufPtr, checksumSize);
2305 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2306 			ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n");
2307 			abort();
2308 		}
2309 	}
2310 }
2311 
glGetTexParameterfv_enc(void * self,GLenum target,GLenum pname,GLfloat * params)2312 void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
2313 {
2314 
2315 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2316 	IOStream *stream = ctx->m_stream;
2317 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2318 	bool useChecksum = checksumCalculator->getVersion() > 0;
2319 
2320 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
2321 	 unsigned char *ptr;
2322 	 unsigned char *buf;
2323 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2324 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2325 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2326 	buf = stream->alloc(totalSize);
2327 	ptr = buf;
2328 	int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
2329 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2330 
2331 		memcpy(ptr, &target, 4); ptr += 4;
2332 		memcpy(ptr, &pname, 4); ptr += 4;
2333 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2334 
2335 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2336 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2337 
2338 	stream->readback(params, __size_params);
2339 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2340 	if (useChecksum) {
2341 		unsigned char *checksumBufPtr = NULL;
2342 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2343 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2344 		stream->readback(checksumBufPtr, checksumSize);
2345 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2346 			ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
2347 			abort();
2348 		}
2349 	}
2350 }
2351 
glGetTexParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2352 void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2353 {
2354 
2355 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2356 	IOStream *stream = ctx->m_stream;
2357 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2358 	bool useChecksum = checksumCalculator->getVersion() > 0;
2359 
2360 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
2361 	 unsigned char *ptr;
2362 	 unsigned char *buf;
2363 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2364 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2365 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2366 	buf = stream->alloc(totalSize);
2367 	ptr = buf;
2368 	int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2369 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2370 
2371 		memcpy(ptr, &target, 4); ptr += 4;
2372 		memcpy(ptr, &pname, 4); ptr += 4;
2373 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2374 
2375 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2376 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2377 
2378 	stream->readback(params, __size_params);
2379 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2380 	if (useChecksum) {
2381 		unsigned char *checksumBufPtr = NULL;
2382 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2383 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2384 		stream->readback(checksumBufPtr, checksumSize);
2385 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2386 			ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
2387 			abort();
2388 		}
2389 	}
2390 }
2391 
glGetUniformfv_enc(void * self,GLuint program,GLint location,GLfloat * params)2392 void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params)
2393 {
2394 
2395 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2396 	IOStream *stream = ctx->m_stream;
2397 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2398 	bool useChecksum = checksumCalculator->getVersion() > 0;
2399 
2400 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
2401 	 unsigned char *ptr;
2402 	 unsigned char *buf;
2403 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2404 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2405 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2406 	buf = stream->alloc(totalSize);
2407 	ptr = buf;
2408 	int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
2409 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2410 
2411 		memcpy(ptr, &program, 4); ptr += 4;
2412 		memcpy(ptr, &location, 4); ptr += 4;
2413 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2414 
2415 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2416 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2417 
2418 	stream->readback(params, __size_params);
2419 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2420 	if (useChecksum) {
2421 		unsigned char *checksumBufPtr = NULL;
2422 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2423 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2424 		stream->readback(checksumBufPtr, checksumSize);
2425 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2426 			ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n");
2427 			abort();
2428 		}
2429 	}
2430 }
2431 
glGetUniformiv_enc(void * self,GLuint program,GLint location,GLint * params)2432 void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params)
2433 {
2434 
2435 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2436 	IOStream *stream = ctx->m_stream;
2437 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2438 	bool useChecksum = checksumCalculator->getVersion() > 0;
2439 
2440 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
2441 	 unsigned char *ptr;
2442 	 unsigned char *buf;
2443 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2444 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2445 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2446 	buf = stream->alloc(totalSize);
2447 	ptr = buf;
2448 	int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
2449 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2450 
2451 		memcpy(ptr, &program, 4); ptr += 4;
2452 		memcpy(ptr, &location, 4); ptr += 4;
2453 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2454 
2455 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2456 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2457 
2458 	stream->readback(params, __size_params);
2459 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2460 	if (useChecksum) {
2461 		unsigned char *checksumBufPtr = NULL;
2462 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2463 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2464 		stream->readback(checksumBufPtr, checksumSize);
2465 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2466 			ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n");
2467 			abort();
2468 		}
2469 	}
2470 }
2471 
glGetUniformLocation_enc(void * self,GLuint program,const GLchar * name)2472 int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name)
2473 {
2474 
2475 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2476 	IOStream *stream = ctx->m_stream;
2477 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2478 	bool useChecksum = checksumCalculator->getVersion() > 0;
2479 
2480 	const unsigned int __size_name =  (strlen(name) + 1);
2481 	 unsigned char *ptr;
2482 	 unsigned char *buf;
2483 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
2484 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2485 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2486 	buf = stream->alloc(totalSize);
2487 	ptr = buf;
2488 	int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
2489 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2490 
2491 		memcpy(ptr, &program, 4); ptr += 4;
2492 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
2493 	memcpy(ptr, name, __size_name);ptr += __size_name;
2494 
2495 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2496 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2497 
2498 
2499 	int retval;
2500 	stream->readback(&retval, 4);
2501 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
2502 	if (useChecksum) {
2503 		unsigned char *checksumBufPtr = NULL;
2504 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2505 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2506 		stream->readback(checksumBufPtr, checksumSize);
2507 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2508 			ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n");
2509 			abort();
2510 		}
2511 	}
2512 	return retval;
2513 }
2514 
glGetVertexAttribfv_enc(void * self,GLuint index,GLenum pname,GLfloat * params)2515 void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params)
2516 {
2517 
2518 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2519 	IOStream *stream = ctx->m_stream;
2520 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2521 	bool useChecksum = checksumCalculator->getVersion() > 0;
2522 
2523 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
2524 	 unsigned char *ptr;
2525 	 unsigned char *buf;
2526 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2527 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2528 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2529 	buf = stream->alloc(totalSize);
2530 	ptr = buf;
2531 	int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
2532 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2533 
2534 		memcpy(ptr, &index, 4); ptr += 4;
2535 		memcpy(ptr, &pname, 4); ptr += 4;
2536 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2537 
2538 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2539 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2540 
2541 	stream->readback(params, __size_params);
2542 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2543 	if (useChecksum) {
2544 		unsigned char *checksumBufPtr = NULL;
2545 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2546 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2547 		stream->readback(checksumBufPtr, checksumSize);
2548 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2549 			ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n");
2550 			abort();
2551 		}
2552 	}
2553 }
2554 
glGetVertexAttribiv_enc(void * self,GLuint index,GLenum pname,GLint * params)2555 void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
2556 {
2557 
2558 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2559 	IOStream *stream = ctx->m_stream;
2560 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2561 	bool useChecksum = checksumCalculator->getVersion() > 0;
2562 
2563 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
2564 	 unsigned char *ptr;
2565 	 unsigned char *buf;
2566 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
2567 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2568 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2569 	buf = stream->alloc(totalSize);
2570 	ptr = buf;
2571 	int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
2572 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2573 
2574 		memcpy(ptr, &index, 4); ptr += 4;
2575 		memcpy(ptr, &pname, 4); ptr += 4;
2576 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2577 
2578 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2579 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2580 
2581 	stream->readback(params, __size_params);
2582 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2583 	if (useChecksum) {
2584 		unsigned char *checksumBufPtr = NULL;
2585 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2586 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2587 		stream->readback(checksumBufPtr, checksumSize);
2588 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2589 			ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n");
2590 			abort();
2591 		}
2592 	}
2593 }
2594 
glHint_enc(void * self,GLenum target,GLenum mode)2595 void glHint_enc(void *self , GLenum target, GLenum mode)
2596 {
2597 
2598 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2599 	IOStream *stream = ctx->m_stream;
2600 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2601 	bool useChecksum = checksumCalculator->getVersion() > 0;
2602 
2603 	 unsigned char *ptr;
2604 	 unsigned char *buf;
2605 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2606 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2607 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2608 	buf = stream->alloc(totalSize);
2609 	ptr = buf;
2610 	int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
2611 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2612 
2613 		memcpy(ptr, &target, 4); ptr += 4;
2614 		memcpy(ptr, &mode, 4); ptr += 4;
2615 
2616 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2617 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2618 
2619 }
2620 
glIsBuffer_enc(void * self,GLuint buffer)2621 GLboolean glIsBuffer_enc(void *self , GLuint buffer)
2622 {
2623 
2624 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2625 	IOStream *stream = ctx->m_stream;
2626 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2627 	bool useChecksum = checksumCalculator->getVersion() > 0;
2628 
2629 	 unsigned char *ptr;
2630 	 unsigned char *buf;
2631 	 const size_t sizeWithoutChecksum = 8 + 4;
2632 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2633 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2634 	buf = stream->alloc(totalSize);
2635 	ptr = buf;
2636 	int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2637 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2638 
2639 		memcpy(ptr, &buffer, 4); ptr += 4;
2640 
2641 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2642 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2643 
2644 
2645 	GLboolean retval;
2646 	stream->readback(&retval, 1);
2647 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2648 	if (useChecksum) {
2649 		unsigned char *checksumBufPtr = NULL;
2650 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2651 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2652 		stream->readback(checksumBufPtr, checksumSize);
2653 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2654 			ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
2655 			abort();
2656 		}
2657 	}
2658 	return retval;
2659 }
2660 
glIsEnabled_enc(void * self,GLenum cap)2661 GLboolean glIsEnabled_enc(void *self , GLenum cap)
2662 {
2663 
2664 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2665 	IOStream *stream = ctx->m_stream;
2666 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2667 	bool useChecksum = checksumCalculator->getVersion() > 0;
2668 
2669 	 unsigned char *ptr;
2670 	 unsigned char *buf;
2671 	 const size_t sizeWithoutChecksum = 8 + 4;
2672 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2673 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2674 	buf = stream->alloc(totalSize);
2675 	ptr = buf;
2676 	int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
2677 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2678 
2679 		memcpy(ptr, &cap, 4); ptr += 4;
2680 
2681 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2682 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2683 
2684 
2685 	GLboolean retval;
2686 	stream->readback(&retval, 1);
2687 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2688 	if (useChecksum) {
2689 		unsigned char *checksumBufPtr = NULL;
2690 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2691 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2692 		stream->readback(checksumBufPtr, checksumSize);
2693 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2694 			ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
2695 			abort();
2696 		}
2697 	}
2698 	return retval;
2699 }
2700 
glIsFramebuffer_enc(void * self,GLuint framebuffer)2701 GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer)
2702 {
2703 
2704 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2705 	IOStream *stream = ctx->m_stream;
2706 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2707 	bool useChecksum = checksumCalculator->getVersion() > 0;
2708 
2709 	 unsigned char *ptr;
2710 	 unsigned char *buf;
2711 	 const size_t sizeWithoutChecksum = 8 + 4;
2712 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2713 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2714 	buf = stream->alloc(totalSize);
2715 	ptr = buf;
2716 	int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2717 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2718 
2719 		memcpy(ptr, &framebuffer, 4); ptr += 4;
2720 
2721 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2722 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2723 
2724 
2725 	GLboolean retval;
2726 	stream->readback(&retval, 1);
2727 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2728 	if (useChecksum) {
2729 		unsigned char *checksumBufPtr = NULL;
2730 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2731 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2732 		stream->readback(checksumBufPtr, checksumSize);
2733 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2734 			ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n");
2735 			abort();
2736 		}
2737 	}
2738 	return retval;
2739 }
2740 
glIsProgram_enc(void * self,GLuint program)2741 GLboolean glIsProgram_enc(void *self , GLuint program)
2742 {
2743 
2744 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2745 	IOStream *stream = ctx->m_stream;
2746 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2747 	bool useChecksum = checksumCalculator->getVersion() > 0;
2748 
2749 	 unsigned char *ptr;
2750 	 unsigned char *buf;
2751 	 const size_t sizeWithoutChecksum = 8 + 4;
2752 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2753 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2754 	buf = stream->alloc(totalSize);
2755 	ptr = buf;
2756 	int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
2757 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2758 
2759 		memcpy(ptr, &program, 4); ptr += 4;
2760 
2761 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2762 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2763 
2764 
2765 	GLboolean retval;
2766 	stream->readback(&retval, 1);
2767 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2768 	if (useChecksum) {
2769 		unsigned char *checksumBufPtr = NULL;
2770 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2771 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2772 		stream->readback(checksumBufPtr, checksumSize);
2773 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2774 			ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n");
2775 			abort();
2776 		}
2777 	}
2778 	return retval;
2779 }
2780 
glIsRenderbuffer_enc(void * self,GLuint renderbuffer)2781 GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer)
2782 {
2783 
2784 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2785 	IOStream *stream = ctx->m_stream;
2786 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2787 	bool useChecksum = checksumCalculator->getVersion() > 0;
2788 
2789 	 unsigned char *ptr;
2790 	 unsigned char *buf;
2791 	 const size_t sizeWithoutChecksum = 8 + 4;
2792 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2793 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2794 	buf = stream->alloc(totalSize);
2795 	ptr = buf;
2796 	int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2797 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2798 
2799 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
2800 
2801 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2802 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2803 
2804 
2805 	GLboolean retval;
2806 	stream->readback(&retval, 1);
2807 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2808 	if (useChecksum) {
2809 		unsigned char *checksumBufPtr = NULL;
2810 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2811 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2812 		stream->readback(checksumBufPtr, checksumSize);
2813 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2814 			ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n");
2815 			abort();
2816 		}
2817 	}
2818 	return retval;
2819 }
2820 
glIsShader_enc(void * self,GLuint shader)2821 GLboolean glIsShader_enc(void *self , GLuint shader)
2822 {
2823 
2824 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2825 	IOStream *stream = ctx->m_stream;
2826 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2827 	bool useChecksum = checksumCalculator->getVersion() > 0;
2828 
2829 	 unsigned char *ptr;
2830 	 unsigned char *buf;
2831 	 const size_t sizeWithoutChecksum = 8 + 4;
2832 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2833 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2834 	buf = stream->alloc(totalSize);
2835 	ptr = buf;
2836 	int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
2837 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2838 
2839 		memcpy(ptr, &shader, 4); ptr += 4;
2840 
2841 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2842 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2843 
2844 
2845 	GLboolean retval;
2846 	stream->readback(&retval, 1);
2847 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2848 	if (useChecksum) {
2849 		unsigned char *checksumBufPtr = NULL;
2850 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2851 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2852 		stream->readback(checksumBufPtr, checksumSize);
2853 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2854 			ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n");
2855 			abort();
2856 		}
2857 	}
2858 	return retval;
2859 }
2860 
glIsTexture_enc(void * self,GLuint texture)2861 GLboolean glIsTexture_enc(void *self , GLuint texture)
2862 {
2863 
2864 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2865 	IOStream *stream = ctx->m_stream;
2866 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2867 	bool useChecksum = checksumCalculator->getVersion() > 0;
2868 
2869 	 unsigned char *ptr;
2870 	 unsigned char *buf;
2871 	 const size_t sizeWithoutChecksum = 8 + 4;
2872 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2873 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2874 	buf = stream->alloc(totalSize);
2875 	ptr = buf;
2876 	int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
2877 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2878 
2879 		memcpy(ptr, &texture, 4); ptr += 4;
2880 
2881 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2882 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2883 
2884 
2885 	GLboolean retval;
2886 	stream->readback(&retval, 1);
2887 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2888 	if (useChecksum) {
2889 		unsigned char *checksumBufPtr = NULL;
2890 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
2891 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2892 		stream->readback(checksumBufPtr, checksumSize);
2893 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
2894 			ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
2895 			abort();
2896 		}
2897 	}
2898 	return retval;
2899 }
2900 
glLineWidth_enc(void * self,GLfloat width)2901 void glLineWidth_enc(void *self , GLfloat width)
2902 {
2903 
2904 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2905 	IOStream *stream = ctx->m_stream;
2906 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2907 	bool useChecksum = checksumCalculator->getVersion() > 0;
2908 
2909 	 unsigned char *ptr;
2910 	 unsigned char *buf;
2911 	 const size_t sizeWithoutChecksum = 8 + 4;
2912 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2913 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2914 	buf = stream->alloc(totalSize);
2915 	ptr = buf;
2916 	int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
2917 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2918 
2919 		memcpy(ptr, &width, 4); ptr += 4;
2920 
2921 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2922 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2923 
2924 }
2925 
glLinkProgram_enc(void * self,GLuint program)2926 void glLinkProgram_enc(void *self , GLuint program)
2927 {
2928 
2929 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2930 	IOStream *stream = ctx->m_stream;
2931 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2932 	bool useChecksum = checksumCalculator->getVersion() > 0;
2933 
2934 	 unsigned char *ptr;
2935 	 unsigned char *buf;
2936 	 const size_t sizeWithoutChecksum = 8 + 4;
2937 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2938 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2939 	buf = stream->alloc(totalSize);
2940 	ptr = buf;
2941 	int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
2942 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2943 
2944 		memcpy(ptr, &program, 4); ptr += 4;
2945 
2946 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2947 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2948 
2949 }
2950 
glPixelStorei_enc(void * self,GLenum pname,GLint param)2951 void glPixelStorei_enc(void *self , GLenum pname, GLint param)
2952 {
2953 
2954 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2955 	IOStream *stream = ctx->m_stream;
2956 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2957 	bool useChecksum = checksumCalculator->getVersion() > 0;
2958 
2959 	 unsigned char *ptr;
2960 	 unsigned char *buf;
2961 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2962 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2963 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2964 	buf = stream->alloc(totalSize);
2965 	ptr = buf;
2966 	int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
2967 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2968 
2969 		memcpy(ptr, &pname, 4); ptr += 4;
2970 		memcpy(ptr, &param, 4); ptr += 4;
2971 
2972 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2973 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2974 
2975 }
2976 
glPolygonOffset_enc(void * self,GLfloat factor,GLfloat units)2977 void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
2978 {
2979 
2980 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2981 	IOStream *stream = ctx->m_stream;
2982 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2983 	bool useChecksum = checksumCalculator->getVersion() > 0;
2984 
2985 	 unsigned char *ptr;
2986 	 unsigned char *buf;
2987 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2988 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2989 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2990 	buf = stream->alloc(totalSize);
2991 	ptr = buf;
2992 	int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
2993 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2994 
2995 		memcpy(ptr, &factor, 4); ptr += 4;
2996 		memcpy(ptr, &units, 4); ptr += 4;
2997 
2998 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2999 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3000 
3001 }
3002 
glReadPixels_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLvoid * pixels)3003 void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
3004 {
3005 
3006 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3007 	IOStream *stream = ctx->m_stream;
3008 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3009 	bool useChecksum = checksumCalculator->getVersion() > 0;
3010 
3011 	const unsigned int __size_pixels =  glesv2_enc::pixelDataSize(self, width, height, format, type, 1);
3012 	 unsigned char *ptr;
3013 	 unsigned char *buf;
3014 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
3015 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3016 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3017 	buf = stream->alloc(totalSize);
3018 	ptr = buf;
3019 	int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
3020 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3021 
3022 		memcpy(ptr, &x, 4); ptr += 4;
3023 		memcpy(ptr, &y, 4); ptr += 4;
3024 		memcpy(ptr, &width, 4); ptr += 4;
3025 		memcpy(ptr, &height, 4); ptr += 4;
3026 		memcpy(ptr, &format, 4); ptr += 4;
3027 		memcpy(ptr, &type, 4); ptr += 4;
3028 	*(unsigned int *)(ptr) = __size_pixels; ptr += 4;
3029 
3030 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3031 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3032 
3033 	 stream->readbackPixels(self, width, height, format, type, pixels);
3034 	if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3035 	if (useChecksum) {
3036 		unsigned char *checksumBufPtr = NULL;
3037 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
3038 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
3039 		stream->readback(checksumBufPtr, checksumSize);
3040 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
3041 			ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3042 			abort();
3043 		}
3044 	}
3045 }
3046 
glReleaseShaderCompiler_enc(void * self)3047 void glReleaseShaderCompiler_enc(void *self )
3048 {
3049 
3050 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3051 	IOStream *stream = ctx->m_stream;
3052 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3053 	bool useChecksum = checksumCalculator->getVersion() > 0;
3054 
3055 	 unsigned char *ptr;
3056 	 unsigned char *buf;
3057 	 const size_t sizeWithoutChecksum = 8;
3058 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3059 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3060 	buf = stream->alloc(totalSize);
3061 	ptr = buf;
3062 	int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
3063 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3064 
3065 
3066 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3067 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3068 
3069 }
3070 
glRenderbufferStorage_enc(void * self,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)3071 void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
3072 {
3073 
3074 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3075 	IOStream *stream = ctx->m_stream;
3076 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3077 	bool useChecksum = checksumCalculator->getVersion() > 0;
3078 
3079 	 unsigned char *ptr;
3080 	 unsigned char *buf;
3081 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3082 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3083 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3084 	buf = stream->alloc(totalSize);
3085 	ptr = buf;
3086 	int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
3087 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3088 
3089 		memcpy(ptr, &target, 4); ptr += 4;
3090 		memcpy(ptr, &internalformat, 4); ptr += 4;
3091 		memcpy(ptr, &width, 4); ptr += 4;
3092 		memcpy(ptr, &height, 4); ptr += 4;
3093 
3094 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3095 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3096 
3097 }
3098 
glSampleCoverage_enc(void * self,GLclampf value,GLboolean invert)3099 void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
3100 {
3101 
3102 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3103 	IOStream *stream = ctx->m_stream;
3104 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3105 	bool useChecksum = checksumCalculator->getVersion() > 0;
3106 
3107 	 unsigned char *ptr;
3108 	 unsigned char *buf;
3109 	 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3110 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3111 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3112 	buf = stream->alloc(totalSize);
3113 	ptr = buf;
3114 	int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
3115 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3116 
3117 		memcpy(ptr, &value, 4); ptr += 4;
3118 		memcpy(ptr, &invert, 1); ptr += 1;
3119 
3120 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3121 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3122 
3123 }
3124 
glScissor_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)3125 void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3126 {
3127 
3128 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3129 	IOStream *stream = ctx->m_stream;
3130 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3131 	bool useChecksum = checksumCalculator->getVersion() > 0;
3132 
3133 	 unsigned char *ptr;
3134 	 unsigned char *buf;
3135 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3136 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3137 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3138 	buf = stream->alloc(totalSize);
3139 	ptr = buf;
3140 	int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
3141 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3142 
3143 		memcpy(ptr, &x, 4); ptr += 4;
3144 		memcpy(ptr, &y, 4); ptr += 4;
3145 		memcpy(ptr, &width, 4); ptr += 4;
3146 		memcpy(ptr, &height, 4); ptr += 4;
3147 
3148 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3149 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3150 
3151 }
3152 
glStencilFunc_enc(void * self,GLenum func,GLint ref,GLuint mask)3153 void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
3154 {
3155 
3156 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3157 	IOStream *stream = ctx->m_stream;
3158 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3159 	bool useChecksum = checksumCalculator->getVersion() > 0;
3160 
3161 	 unsigned char *ptr;
3162 	 unsigned char *buf;
3163 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3164 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3165 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3166 	buf = stream->alloc(totalSize);
3167 	ptr = buf;
3168 	int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
3169 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3170 
3171 		memcpy(ptr, &func, 4); ptr += 4;
3172 		memcpy(ptr, &ref, 4); ptr += 4;
3173 		memcpy(ptr, &mask, 4); ptr += 4;
3174 
3175 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3176 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3177 
3178 }
3179 
glStencilFuncSeparate_enc(void * self,GLenum face,GLenum func,GLint ref,GLuint mask)3180 void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
3181 {
3182 
3183 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3184 	IOStream *stream = ctx->m_stream;
3185 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3186 	bool useChecksum = checksumCalculator->getVersion() > 0;
3187 
3188 	 unsigned char *ptr;
3189 	 unsigned char *buf;
3190 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3191 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3192 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3193 	buf = stream->alloc(totalSize);
3194 	ptr = buf;
3195 	int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3196 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3197 
3198 		memcpy(ptr, &face, 4); ptr += 4;
3199 		memcpy(ptr, &func, 4); ptr += 4;
3200 		memcpy(ptr, &ref, 4); ptr += 4;
3201 		memcpy(ptr, &mask, 4); ptr += 4;
3202 
3203 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3204 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3205 
3206 }
3207 
glStencilMask_enc(void * self,GLuint mask)3208 void glStencilMask_enc(void *self , GLuint mask)
3209 {
3210 
3211 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3212 	IOStream *stream = ctx->m_stream;
3213 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3214 	bool useChecksum = checksumCalculator->getVersion() > 0;
3215 
3216 	 unsigned char *ptr;
3217 	 unsigned char *buf;
3218 	 const size_t sizeWithoutChecksum = 8 + 4;
3219 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3220 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3221 	buf = stream->alloc(totalSize);
3222 	ptr = buf;
3223 	int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
3224 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3225 
3226 		memcpy(ptr, &mask, 4); ptr += 4;
3227 
3228 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3229 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3230 
3231 }
3232 
glStencilMaskSeparate_enc(void * self,GLenum face,GLuint mask)3233 void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
3234 {
3235 
3236 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3237 	IOStream *stream = ctx->m_stream;
3238 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3239 	bool useChecksum = checksumCalculator->getVersion() > 0;
3240 
3241 	 unsigned char *ptr;
3242 	 unsigned char *buf;
3243 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3244 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3245 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3246 	buf = stream->alloc(totalSize);
3247 	ptr = buf;
3248 	int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3249 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3250 
3251 		memcpy(ptr, &face, 4); ptr += 4;
3252 		memcpy(ptr, &mask, 4); ptr += 4;
3253 
3254 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3255 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3256 
3257 }
3258 
glStencilOp_enc(void * self,GLenum fail,GLenum zfail,GLenum zpass)3259 void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
3260 {
3261 
3262 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3263 	IOStream *stream = ctx->m_stream;
3264 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3265 	bool useChecksum = checksumCalculator->getVersion() > 0;
3266 
3267 	 unsigned char *ptr;
3268 	 unsigned char *buf;
3269 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3270 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3271 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3272 	buf = stream->alloc(totalSize);
3273 	ptr = buf;
3274 	int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
3275 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3276 
3277 		memcpy(ptr, &fail, 4); ptr += 4;
3278 		memcpy(ptr, &zfail, 4); ptr += 4;
3279 		memcpy(ptr, &zpass, 4); ptr += 4;
3280 
3281 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3282 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3283 
3284 }
3285 
glStencilOpSeparate_enc(void * self,GLenum face,GLenum fail,GLenum zfail,GLenum zpass)3286 void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3287 {
3288 
3289 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3290 	IOStream *stream = ctx->m_stream;
3291 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3292 	bool useChecksum = checksumCalculator->getVersion() > 0;
3293 
3294 	 unsigned char *ptr;
3295 	 unsigned char *buf;
3296 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3297 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3298 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3299 	buf = stream->alloc(totalSize);
3300 	ptr = buf;
3301 	int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
3302 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3303 
3304 		memcpy(ptr, &face, 4); ptr += 4;
3305 		memcpy(ptr, &fail, 4); ptr += 4;
3306 		memcpy(ptr, &zfail, 4); ptr += 4;
3307 		memcpy(ptr, &zpass, 4); ptr += 4;
3308 
3309 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3310 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3311 
3312 }
3313 
glTexImage2D_enc(void * self,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)3314 void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
3315 {
3316 
3317 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3318 	IOStream *stream = ctx->m_stream;
3319 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3320 	bool useChecksum = checksumCalculator->getVersion() > 0;
3321 
3322 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3323 	 unsigned char *ptr;
3324 	 unsigned char *buf;
3325 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3326 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3327 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3328 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3329 	ptr = buf;
3330 	int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3331 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3332 
3333 		memcpy(ptr, &target, 4); ptr += 4;
3334 		memcpy(ptr, &level, 4); ptr += 4;
3335 		memcpy(ptr, &internalformat, 4); ptr += 4;
3336 		memcpy(ptr, &width, 4); ptr += 4;
3337 		memcpy(ptr, &height, 4); ptr += 4;
3338 		memcpy(ptr, &border, 4); ptr += 4;
3339 		memcpy(ptr, &format, 4); ptr += 4;
3340 		memcpy(ptr, &type, 4); ptr += 4;
3341 
3342 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3343 	stream->flush();
3344 	stream->writeFully(&__size_pixels,4);
3345 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3346 	if (pixels != NULL) {
3347 		 stream->uploadPixels(self, width, height, 1, format, type, pixels);
3348 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3349 	}
3350 	buf = stream->alloc(checksumSize);
3351 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3352 
3353 }
3354 
glTexParameterf_enc(void * self,GLenum target,GLenum pname,GLfloat param)3355 void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
3356 {
3357 
3358 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3359 	IOStream *stream = ctx->m_stream;
3360 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3361 	bool useChecksum = checksumCalculator->getVersion() > 0;
3362 
3363 	 unsigned char *ptr;
3364 	 unsigned char *buf;
3365 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3366 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3367 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3368 	buf = stream->alloc(totalSize);
3369 	ptr = buf;
3370 	int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
3371 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3372 
3373 		memcpy(ptr, &target, 4); ptr += 4;
3374 		memcpy(ptr, &pname, 4); ptr += 4;
3375 		memcpy(ptr, &param, 4); ptr += 4;
3376 
3377 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3378 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3379 
3380 }
3381 
glTexParameterfv_enc(void * self,GLenum target,GLenum pname,const GLfloat * params)3382 void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
3383 {
3384 
3385 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3386 	IOStream *stream = ctx->m_stream;
3387 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3388 	bool useChecksum = checksumCalculator->getVersion() > 0;
3389 
3390 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
3391 	 unsigned char *ptr;
3392 	 unsigned char *buf;
3393 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3394 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3395 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3396 	buf = stream->alloc(totalSize);
3397 	ptr = buf;
3398 	int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
3399 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3400 
3401 		memcpy(ptr, &target, 4); ptr += 4;
3402 		memcpy(ptr, &pname, 4); ptr += 4;
3403 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3404 	memcpy(ptr, params, __size_params);ptr += __size_params;
3405 
3406 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3407 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3408 
3409 }
3410 
glTexParameteri_enc(void * self,GLenum target,GLenum pname,GLint param)3411 void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
3412 {
3413 
3414 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3415 	IOStream *stream = ctx->m_stream;
3416 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3417 	bool useChecksum = checksumCalculator->getVersion() > 0;
3418 
3419 	 unsigned char *ptr;
3420 	 unsigned char *buf;
3421 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3422 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3423 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3424 	buf = stream->alloc(totalSize);
3425 	ptr = buf;
3426 	int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
3427 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3428 
3429 		memcpy(ptr, &target, 4); ptr += 4;
3430 		memcpy(ptr, &pname, 4); ptr += 4;
3431 		memcpy(ptr, &param, 4); ptr += 4;
3432 
3433 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3434 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3435 
3436 }
3437 
glTexParameteriv_enc(void * self,GLenum target,GLenum pname,const GLint * params)3438 void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3439 {
3440 
3441 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3442 	IOStream *stream = ctx->m_stream;
3443 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3444 	bool useChecksum = checksumCalculator->getVersion() > 0;
3445 
3446 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
3447 	 unsigned char *ptr;
3448 	 unsigned char *buf;
3449 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3450 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3451 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3452 	buf = stream->alloc(totalSize);
3453 	ptr = buf;
3454 	int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
3455 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3456 
3457 		memcpy(ptr, &target, 4); ptr += 4;
3458 		memcpy(ptr, &pname, 4); ptr += 4;
3459 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3460 	memcpy(ptr, params, __size_params);ptr += __size_params;
3461 
3462 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3463 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3464 
3465 }
3466 
glTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)3467 void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
3468 {
3469 
3470 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3471 	IOStream *stream = ctx->m_stream;
3472 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3473 	bool useChecksum = checksumCalculator->getVersion() > 0;
3474 
3475 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3476 	 unsigned char *ptr;
3477 	 unsigned char *buf;
3478 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3479 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3480 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3481 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3482 	ptr = buf;
3483 	int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3484 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3485 
3486 		memcpy(ptr, &target, 4); ptr += 4;
3487 		memcpy(ptr, &level, 4); ptr += 4;
3488 		memcpy(ptr, &xoffset, 4); ptr += 4;
3489 		memcpy(ptr, &yoffset, 4); ptr += 4;
3490 		memcpy(ptr, &width, 4); ptr += 4;
3491 		memcpy(ptr, &height, 4); ptr += 4;
3492 		memcpy(ptr, &format, 4); ptr += 4;
3493 		memcpy(ptr, &type, 4); ptr += 4;
3494 
3495 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3496 	stream->flush();
3497 	stream->writeFully(&__size_pixels,4);
3498 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3499 	if (pixels != NULL) {
3500 		 stream->uploadPixels(self, width, height, 1, format, type, pixels);
3501 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3502 	}
3503 	buf = stream->alloc(checksumSize);
3504 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3505 
3506 }
3507 
glUniform1f_enc(void * self,GLint location,GLfloat x)3508 void glUniform1f_enc(void *self , GLint location, GLfloat x)
3509 {
3510 
3511 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3512 	IOStream *stream = ctx->m_stream;
3513 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3514 	bool useChecksum = checksumCalculator->getVersion() > 0;
3515 
3516 	 unsigned char *ptr;
3517 	 unsigned char *buf;
3518 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3519 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3520 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3521 	buf = stream->alloc(totalSize);
3522 	ptr = buf;
3523 	int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
3524 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3525 
3526 		memcpy(ptr, &location, 4); ptr += 4;
3527 		memcpy(ptr, &x, 4); ptr += 4;
3528 
3529 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3530 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3531 
3532 }
3533 
glUniform1fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3534 void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3535 {
3536 
3537 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3538 	IOStream *stream = ctx->m_stream;
3539 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3540 	bool useChecksum = checksumCalculator->getVersion() > 0;
3541 
3542 	const unsigned int __size_v =  (count * sizeof(GLfloat));
3543 	 unsigned char *ptr;
3544 	 unsigned char *buf;
3545 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3546 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3547 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3548 	buf = stream->alloc(totalSize);
3549 	ptr = buf;
3550 	int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
3551 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3552 
3553 		memcpy(ptr, &location, 4); ptr += 4;
3554 		memcpy(ptr, &count, 4); ptr += 4;
3555 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3556 	memcpy(ptr, v, __size_v);ptr += __size_v;
3557 
3558 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3559 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3560 
3561 }
3562 
glUniform1i_enc(void * self,GLint location,GLint x)3563 void glUniform1i_enc(void *self , GLint location, GLint x)
3564 {
3565 
3566 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3567 	IOStream *stream = ctx->m_stream;
3568 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3569 	bool useChecksum = checksumCalculator->getVersion() > 0;
3570 
3571 	 unsigned char *ptr;
3572 	 unsigned char *buf;
3573 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3574 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3575 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3576 	buf = stream->alloc(totalSize);
3577 	ptr = buf;
3578 	int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
3579 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3580 
3581 		memcpy(ptr, &location, 4); ptr += 4;
3582 		memcpy(ptr, &x, 4); ptr += 4;
3583 
3584 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3585 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3586 
3587 }
3588 
glUniform1iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3589 void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3590 {
3591 
3592 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3593 	IOStream *stream = ctx->m_stream;
3594 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3595 	bool useChecksum = checksumCalculator->getVersion() > 0;
3596 
3597 	const unsigned int __size_v =  (count * sizeof(GLint));
3598 	 unsigned char *ptr;
3599 	 unsigned char *buf;
3600 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3601 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3602 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3603 	buf = stream->alloc(totalSize);
3604 	ptr = buf;
3605 	int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
3606 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3607 
3608 		memcpy(ptr, &location, 4); ptr += 4;
3609 		memcpy(ptr, &count, 4); ptr += 4;
3610 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3611 	memcpy(ptr, v, __size_v);ptr += __size_v;
3612 
3613 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3614 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3615 
3616 }
3617 
glUniform2f_enc(void * self,GLint location,GLfloat x,GLfloat y)3618 void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
3619 {
3620 
3621 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3622 	IOStream *stream = ctx->m_stream;
3623 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3624 	bool useChecksum = checksumCalculator->getVersion() > 0;
3625 
3626 	 unsigned char *ptr;
3627 	 unsigned char *buf;
3628 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3629 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3630 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3631 	buf = stream->alloc(totalSize);
3632 	ptr = buf;
3633 	int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
3634 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3635 
3636 		memcpy(ptr, &location, 4); ptr += 4;
3637 		memcpy(ptr, &x, 4); ptr += 4;
3638 		memcpy(ptr, &y, 4); ptr += 4;
3639 
3640 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3641 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3642 
3643 }
3644 
glUniform2fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3645 void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3646 {
3647 
3648 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3649 	IOStream *stream = ctx->m_stream;
3650 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3651 	bool useChecksum = checksumCalculator->getVersion() > 0;
3652 
3653 	const unsigned int __size_v =  (count * 2 * sizeof(GLfloat));
3654 	 unsigned char *ptr;
3655 	 unsigned char *buf;
3656 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3657 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3658 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3659 	buf = stream->alloc(totalSize);
3660 	ptr = buf;
3661 	int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
3662 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3663 
3664 		memcpy(ptr, &location, 4); ptr += 4;
3665 		memcpy(ptr, &count, 4); ptr += 4;
3666 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3667 	memcpy(ptr, v, __size_v);ptr += __size_v;
3668 
3669 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3670 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3671 
3672 }
3673 
glUniform2i_enc(void * self,GLint location,GLint x,GLint y)3674 void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
3675 {
3676 
3677 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3678 	IOStream *stream = ctx->m_stream;
3679 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3680 	bool useChecksum = checksumCalculator->getVersion() > 0;
3681 
3682 	 unsigned char *ptr;
3683 	 unsigned char *buf;
3684 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3685 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3686 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3687 	buf = stream->alloc(totalSize);
3688 	ptr = buf;
3689 	int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
3690 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3691 
3692 		memcpy(ptr, &location, 4); ptr += 4;
3693 		memcpy(ptr, &x, 4); ptr += 4;
3694 		memcpy(ptr, &y, 4); ptr += 4;
3695 
3696 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3697 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3698 
3699 }
3700 
glUniform2iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3701 void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3702 {
3703 
3704 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3705 	IOStream *stream = ctx->m_stream;
3706 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3707 	bool useChecksum = checksumCalculator->getVersion() > 0;
3708 
3709 	const unsigned int __size_v =  (count * 2 * sizeof(GLint));
3710 	 unsigned char *ptr;
3711 	 unsigned char *buf;
3712 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3713 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3714 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3715 	buf = stream->alloc(totalSize);
3716 	ptr = buf;
3717 	int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
3718 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3719 
3720 		memcpy(ptr, &location, 4); ptr += 4;
3721 		memcpy(ptr, &count, 4); ptr += 4;
3722 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3723 	memcpy(ptr, v, __size_v);ptr += __size_v;
3724 
3725 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3726 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3727 
3728 }
3729 
glUniform3f_enc(void * self,GLint location,GLfloat x,GLfloat y,GLfloat z)3730 void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
3731 {
3732 
3733 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3734 	IOStream *stream = ctx->m_stream;
3735 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3736 	bool useChecksum = checksumCalculator->getVersion() > 0;
3737 
3738 	 unsigned char *ptr;
3739 	 unsigned char *buf;
3740 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3741 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3742 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3743 	buf = stream->alloc(totalSize);
3744 	ptr = buf;
3745 	int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
3746 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3747 
3748 		memcpy(ptr, &location, 4); ptr += 4;
3749 		memcpy(ptr, &x, 4); ptr += 4;
3750 		memcpy(ptr, &y, 4); ptr += 4;
3751 		memcpy(ptr, &z, 4); ptr += 4;
3752 
3753 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3754 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3755 
3756 }
3757 
glUniform3fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3758 void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3759 {
3760 
3761 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3762 	IOStream *stream = ctx->m_stream;
3763 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3764 	bool useChecksum = checksumCalculator->getVersion() > 0;
3765 
3766 	const unsigned int __size_v =  (count * 3 * sizeof(GLfloat));
3767 	 unsigned char *ptr;
3768 	 unsigned char *buf;
3769 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3770 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3771 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3772 	buf = stream->alloc(totalSize);
3773 	ptr = buf;
3774 	int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
3775 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3776 
3777 		memcpy(ptr, &location, 4); ptr += 4;
3778 		memcpy(ptr, &count, 4); ptr += 4;
3779 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3780 	memcpy(ptr, v, __size_v);ptr += __size_v;
3781 
3782 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3783 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3784 
3785 }
3786 
glUniform3i_enc(void * self,GLint location,GLint x,GLint y,GLint z)3787 void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
3788 {
3789 
3790 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3791 	IOStream *stream = ctx->m_stream;
3792 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3793 	bool useChecksum = checksumCalculator->getVersion() > 0;
3794 
3795 	 unsigned char *ptr;
3796 	 unsigned char *buf;
3797 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3798 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3799 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3800 	buf = stream->alloc(totalSize);
3801 	ptr = buf;
3802 	int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
3803 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3804 
3805 		memcpy(ptr, &location, 4); ptr += 4;
3806 		memcpy(ptr, &x, 4); ptr += 4;
3807 		memcpy(ptr, &y, 4); ptr += 4;
3808 		memcpy(ptr, &z, 4); ptr += 4;
3809 
3810 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3811 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3812 
3813 }
3814 
glUniform3iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3815 void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3816 {
3817 
3818 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3819 	IOStream *stream = ctx->m_stream;
3820 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3821 	bool useChecksum = checksumCalculator->getVersion() > 0;
3822 
3823 	const unsigned int __size_v =  (3 * count * sizeof(GLint));
3824 	 unsigned char *ptr;
3825 	 unsigned char *buf;
3826 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3827 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3828 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3829 	buf = stream->alloc(totalSize);
3830 	ptr = buf;
3831 	int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
3832 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3833 
3834 		memcpy(ptr, &location, 4); ptr += 4;
3835 		memcpy(ptr, &count, 4); ptr += 4;
3836 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3837 	memcpy(ptr, v, __size_v);ptr += __size_v;
3838 
3839 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3840 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3841 
3842 }
3843 
glUniform4f_enc(void * self,GLint location,GLfloat x,GLfloat y,GLfloat z,GLfloat w)3844 void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3845 {
3846 
3847 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3848 	IOStream *stream = ctx->m_stream;
3849 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3850 	bool useChecksum = checksumCalculator->getVersion() > 0;
3851 
3852 	 unsigned char *ptr;
3853 	 unsigned char *buf;
3854 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3855 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3856 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3857 	buf = stream->alloc(totalSize);
3858 	ptr = buf;
3859 	int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
3860 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3861 
3862 		memcpy(ptr, &location, 4); ptr += 4;
3863 		memcpy(ptr, &x, 4); ptr += 4;
3864 		memcpy(ptr, &y, 4); ptr += 4;
3865 		memcpy(ptr, &z, 4); ptr += 4;
3866 		memcpy(ptr, &w, 4); ptr += 4;
3867 
3868 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3869 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3870 
3871 }
3872 
glUniform4fv_enc(void * self,GLint location,GLsizei count,const GLfloat * v)3873 void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3874 {
3875 
3876 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3877 	IOStream *stream = ctx->m_stream;
3878 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3879 	bool useChecksum = checksumCalculator->getVersion() > 0;
3880 
3881 	const unsigned int __size_v =  (4 * count * sizeof(GLfloat));
3882 	 unsigned char *ptr;
3883 	 unsigned char *buf;
3884 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3885 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3886 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3887 	buf = stream->alloc(totalSize);
3888 	ptr = buf;
3889 	int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
3890 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3891 
3892 		memcpy(ptr, &location, 4); ptr += 4;
3893 		memcpy(ptr, &count, 4); ptr += 4;
3894 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3895 	memcpy(ptr, v, __size_v);ptr += __size_v;
3896 
3897 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3898 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3899 
3900 }
3901 
glUniform4i_enc(void * self,GLint location,GLint x,GLint y,GLint z,GLint w)3902 void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
3903 {
3904 
3905 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3906 	IOStream *stream = ctx->m_stream;
3907 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3908 	bool useChecksum = checksumCalculator->getVersion() > 0;
3909 
3910 	 unsigned char *ptr;
3911 	 unsigned char *buf;
3912 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3913 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3914 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3915 	buf = stream->alloc(totalSize);
3916 	ptr = buf;
3917 	int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
3918 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3919 
3920 		memcpy(ptr, &location, 4); ptr += 4;
3921 		memcpy(ptr, &x, 4); ptr += 4;
3922 		memcpy(ptr, &y, 4); ptr += 4;
3923 		memcpy(ptr, &z, 4); ptr += 4;
3924 		memcpy(ptr, &w, 4); ptr += 4;
3925 
3926 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3927 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3928 
3929 }
3930 
glUniform4iv_enc(void * self,GLint location,GLsizei count,const GLint * v)3931 void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3932 {
3933 
3934 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3935 	IOStream *stream = ctx->m_stream;
3936 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3937 	bool useChecksum = checksumCalculator->getVersion() > 0;
3938 
3939 	const unsigned int __size_v =  (4 * count * sizeof(GLint));
3940 	 unsigned char *ptr;
3941 	 unsigned char *buf;
3942 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3943 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3944 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3945 	buf = stream->alloc(totalSize);
3946 	ptr = buf;
3947 	int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
3948 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3949 
3950 		memcpy(ptr, &location, 4); ptr += 4;
3951 		memcpy(ptr, &count, 4); ptr += 4;
3952 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
3953 	memcpy(ptr, v, __size_v);ptr += __size_v;
3954 
3955 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3956 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3957 
3958 }
3959 
glUniformMatrix2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3960 void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3961 {
3962 
3963 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3964 	IOStream *stream = ctx->m_stream;
3965 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3966 	bool useChecksum = checksumCalculator->getVersion() > 0;
3967 
3968 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
3969 	 unsigned char *ptr;
3970 	 unsigned char *buf;
3971 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
3972 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3973 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3974 	buf = stream->alloc(totalSize);
3975 	ptr = buf;
3976 	int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
3977 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3978 
3979 		memcpy(ptr, &location, 4); ptr += 4;
3980 		memcpy(ptr, &count, 4); ptr += 4;
3981 		memcpy(ptr, &transpose, 1); ptr += 1;
3982 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
3983 	memcpy(ptr, value, __size_value);ptr += __size_value;
3984 
3985 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3986 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3987 
3988 }
3989 
glUniformMatrix3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)3990 void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3991 {
3992 
3993 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3994 	IOStream *stream = ctx->m_stream;
3995 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3996 	bool useChecksum = checksumCalculator->getVersion() > 0;
3997 
3998 	const unsigned int __size_value =  (count * 9 * sizeof(GLfloat));
3999 	 unsigned char *ptr;
4000 	 unsigned char *buf;
4001 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4002 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4003 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4004 	buf = stream->alloc(totalSize);
4005 	ptr = buf;
4006 	int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
4007 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4008 
4009 		memcpy(ptr, &location, 4); ptr += 4;
4010 		memcpy(ptr, &count, 4); ptr += 4;
4011 		memcpy(ptr, &transpose, 1); ptr += 1;
4012 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
4013 	memcpy(ptr, value, __size_value);ptr += __size_value;
4014 
4015 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4016 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4017 
4018 }
4019 
glUniformMatrix4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)4020 void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
4021 {
4022 
4023 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4024 	IOStream *stream = ctx->m_stream;
4025 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4026 	bool useChecksum = checksumCalculator->getVersion() > 0;
4027 
4028 	const unsigned int __size_value =  (count * 16 * sizeof(GLfloat));
4029 	 unsigned char *ptr;
4030 	 unsigned char *buf;
4031 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4032 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4033 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4034 	buf = stream->alloc(totalSize);
4035 	ptr = buf;
4036 	int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
4037 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4038 
4039 		memcpy(ptr, &location, 4); ptr += 4;
4040 		memcpy(ptr, &count, 4); ptr += 4;
4041 		memcpy(ptr, &transpose, 1); ptr += 1;
4042 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
4043 	memcpy(ptr, value, __size_value);ptr += __size_value;
4044 
4045 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4046 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4047 
4048 }
4049 
glUseProgram_enc(void * self,GLuint program)4050 void glUseProgram_enc(void *self , GLuint program)
4051 {
4052 
4053 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4054 	IOStream *stream = ctx->m_stream;
4055 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4056 	bool useChecksum = checksumCalculator->getVersion() > 0;
4057 
4058 	 unsigned char *ptr;
4059 	 unsigned char *buf;
4060 	 const size_t sizeWithoutChecksum = 8 + 4;
4061 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4062 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4063 	buf = stream->alloc(totalSize);
4064 	ptr = buf;
4065 	int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
4066 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4067 
4068 		memcpy(ptr, &program, 4); ptr += 4;
4069 
4070 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4071 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4072 
4073 }
4074 
glValidateProgram_enc(void * self,GLuint program)4075 void glValidateProgram_enc(void *self , GLuint program)
4076 {
4077 
4078 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4079 	IOStream *stream = ctx->m_stream;
4080 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4081 	bool useChecksum = checksumCalculator->getVersion() > 0;
4082 
4083 	 unsigned char *ptr;
4084 	 unsigned char *buf;
4085 	 const size_t sizeWithoutChecksum = 8 + 4;
4086 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4087 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4088 	buf = stream->alloc(totalSize);
4089 	ptr = buf;
4090 	int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
4091 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4092 
4093 		memcpy(ptr, &program, 4); ptr += 4;
4094 
4095 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4096 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4097 
4098 }
4099 
glVertexAttrib1f_enc(void * self,GLuint indx,GLfloat x)4100 void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
4101 {
4102 
4103 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4104 	IOStream *stream = ctx->m_stream;
4105 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4106 	bool useChecksum = checksumCalculator->getVersion() > 0;
4107 
4108 	 unsigned char *ptr;
4109 	 unsigned char *buf;
4110 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4111 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4112 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4113 	buf = stream->alloc(totalSize);
4114 	ptr = buf;
4115 	int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
4116 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4117 
4118 		memcpy(ptr, &indx, 4); ptr += 4;
4119 		memcpy(ptr, &x, 4); ptr += 4;
4120 
4121 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4122 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4123 
4124 }
4125 
glVertexAttrib1fv_enc(void * self,GLuint indx,const GLfloat * values)4126 void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
4127 {
4128 
4129 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4130 	IOStream *stream = ctx->m_stream;
4131 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4132 	bool useChecksum = checksumCalculator->getVersion() > 0;
4133 
4134 	const unsigned int __size_values =  (sizeof(GLfloat));
4135 	 unsigned char *ptr;
4136 	 unsigned char *buf;
4137 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4138 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4139 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4140 	buf = stream->alloc(totalSize);
4141 	ptr = buf;
4142 	int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
4143 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4144 
4145 		memcpy(ptr, &indx, 4); ptr += 4;
4146 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
4147 	memcpy(ptr, values, __size_values);ptr += __size_values;
4148 
4149 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4150 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4151 
4152 }
4153 
glVertexAttrib2f_enc(void * self,GLuint indx,GLfloat x,GLfloat y)4154 void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
4155 {
4156 
4157 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4158 	IOStream *stream = ctx->m_stream;
4159 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4160 	bool useChecksum = checksumCalculator->getVersion() > 0;
4161 
4162 	 unsigned char *ptr;
4163 	 unsigned char *buf;
4164 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4165 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4166 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4167 	buf = stream->alloc(totalSize);
4168 	ptr = buf;
4169 	int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
4170 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4171 
4172 		memcpy(ptr, &indx, 4); ptr += 4;
4173 		memcpy(ptr, &x, 4); ptr += 4;
4174 		memcpy(ptr, &y, 4); ptr += 4;
4175 
4176 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4177 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4178 
4179 }
4180 
glVertexAttrib2fv_enc(void * self,GLuint indx,const GLfloat * values)4181 void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
4182 {
4183 
4184 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4185 	IOStream *stream = ctx->m_stream;
4186 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4187 	bool useChecksum = checksumCalculator->getVersion() > 0;
4188 
4189 	const unsigned int __size_values =  (2 * sizeof(GLfloat));
4190 	 unsigned char *ptr;
4191 	 unsigned char *buf;
4192 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4193 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4194 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4195 	buf = stream->alloc(totalSize);
4196 	ptr = buf;
4197 	int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
4198 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4199 
4200 		memcpy(ptr, &indx, 4); ptr += 4;
4201 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
4202 	memcpy(ptr, values, __size_values);ptr += __size_values;
4203 
4204 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4205 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4206 
4207 }
4208 
glVertexAttrib3f_enc(void * self,GLuint indx,GLfloat x,GLfloat y,GLfloat z)4209 void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
4210 {
4211 
4212 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4213 	IOStream *stream = ctx->m_stream;
4214 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4215 	bool useChecksum = checksumCalculator->getVersion() > 0;
4216 
4217 	 unsigned char *ptr;
4218 	 unsigned char *buf;
4219 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4220 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4221 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4222 	buf = stream->alloc(totalSize);
4223 	ptr = buf;
4224 	int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
4225 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4226 
4227 		memcpy(ptr, &indx, 4); ptr += 4;
4228 		memcpy(ptr, &x, 4); ptr += 4;
4229 		memcpy(ptr, &y, 4); ptr += 4;
4230 		memcpy(ptr, &z, 4); ptr += 4;
4231 
4232 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4233 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4234 
4235 }
4236 
glVertexAttrib3fv_enc(void * self,GLuint indx,const GLfloat * values)4237 void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
4238 {
4239 
4240 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4241 	IOStream *stream = ctx->m_stream;
4242 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4243 	bool useChecksum = checksumCalculator->getVersion() > 0;
4244 
4245 	const unsigned int __size_values =  (3 * sizeof(GLfloat));
4246 	 unsigned char *ptr;
4247 	 unsigned char *buf;
4248 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4249 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4250 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4251 	buf = stream->alloc(totalSize);
4252 	ptr = buf;
4253 	int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
4254 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4255 
4256 		memcpy(ptr, &indx, 4); ptr += 4;
4257 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
4258 	memcpy(ptr, values, __size_values);ptr += __size_values;
4259 
4260 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4261 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4262 
4263 }
4264 
glVertexAttrib4f_enc(void * self,GLuint indx,GLfloat x,GLfloat y,GLfloat z,GLfloat w)4265 void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4266 {
4267 
4268 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4269 	IOStream *stream = ctx->m_stream;
4270 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4271 	bool useChecksum = checksumCalculator->getVersion() > 0;
4272 
4273 	 unsigned char *ptr;
4274 	 unsigned char *buf;
4275 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4276 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4277 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4278 	buf = stream->alloc(totalSize);
4279 	ptr = buf;
4280 	int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
4281 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4282 
4283 		memcpy(ptr, &indx, 4); ptr += 4;
4284 		memcpy(ptr, &x, 4); ptr += 4;
4285 		memcpy(ptr, &y, 4); ptr += 4;
4286 		memcpy(ptr, &z, 4); ptr += 4;
4287 		memcpy(ptr, &w, 4); ptr += 4;
4288 
4289 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4290 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4291 
4292 }
4293 
glVertexAttrib4fv_enc(void * self,GLuint indx,const GLfloat * values)4294 void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
4295 {
4296 
4297 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4298 	IOStream *stream = ctx->m_stream;
4299 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4300 	bool useChecksum = checksumCalculator->getVersion() > 0;
4301 
4302 	const unsigned int __size_values =  (4 * sizeof(GLfloat));
4303 	 unsigned char *ptr;
4304 	 unsigned char *buf;
4305 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4306 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4307 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4308 	buf = stream->alloc(totalSize);
4309 	ptr = buf;
4310 	int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
4311 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4312 
4313 		memcpy(ptr, &indx, 4); ptr += 4;
4314 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
4315 	memcpy(ptr, values, __size_values);ptr += __size_values;
4316 
4317 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4318 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4319 
4320 }
4321 
glViewport_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)4322 void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
4323 {
4324 
4325 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4326 	IOStream *stream = ctx->m_stream;
4327 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4328 	bool useChecksum = checksumCalculator->getVersion() > 0;
4329 
4330 	 unsigned char *ptr;
4331 	 unsigned char *buf;
4332 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4333 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4334 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4335 	buf = stream->alloc(totalSize);
4336 	ptr = buf;
4337 	int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
4338 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4339 
4340 		memcpy(ptr, &x, 4); ptr += 4;
4341 		memcpy(ptr, &y, 4); ptr += 4;
4342 		memcpy(ptr, &width, 4); ptr += 4;
4343 		memcpy(ptr, &height, 4); ptr += 4;
4344 
4345 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4346 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4347 
4348 }
4349 
glEGLImageTargetTexture2DOES_enc(void * self,GLenum target,GLeglImageOES image)4350 void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
4351 {
4352 
4353 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4354 	IOStream *stream = ctx->m_stream;
4355 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4356 	bool useChecksum = checksumCalculator->getVersion() > 0;
4357 
4358 	 unsigned char *ptr;
4359 	 unsigned char *buf;
4360 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4361 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4362 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4363 	buf = stream->alloc(totalSize);
4364 	ptr = buf;
4365 	int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4366 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4367 
4368 		memcpy(ptr, &target, 4); ptr += 4;
4369 		memcpy(ptr, &image, 4); ptr += 4;
4370 
4371 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4372 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4373 
4374 }
4375 
glEGLImageTargetRenderbufferStorageOES_enc(void * self,GLenum target,GLeglImageOES image)4376 void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
4377 {
4378 
4379 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4380 	IOStream *stream = ctx->m_stream;
4381 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4382 	bool useChecksum = checksumCalculator->getVersion() > 0;
4383 
4384 	 unsigned char *ptr;
4385 	 unsigned char *buf;
4386 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4387 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4388 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4389 	buf = stream->alloc(totalSize);
4390 	ptr = buf;
4391 	int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
4392 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4393 
4394 		memcpy(ptr, &target, 4); ptr += 4;
4395 		memcpy(ptr, &image, 4); ptr += 4;
4396 
4397 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4398 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4399 
4400 }
4401 
glUnmapBufferOES_enc(void * self,GLenum target)4402 GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
4403 {
4404 
4405 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4406 	IOStream *stream = ctx->m_stream;
4407 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4408 	bool useChecksum = checksumCalculator->getVersion() > 0;
4409 
4410 	 unsigned char *ptr;
4411 	 unsigned char *buf;
4412 	 const size_t sizeWithoutChecksum = 8 + 4;
4413 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4414 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4415 	buf = stream->alloc(totalSize);
4416 	ptr = buf;
4417 	int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
4418 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4419 
4420 		memcpy(ptr, &target, 4); ptr += 4;
4421 
4422 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4423 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4424 
4425 
4426 	GLboolean retval;
4427 	stream->readback(&retval, 1);
4428 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4429 	if (useChecksum) {
4430 		unsigned char *checksumBufPtr = NULL;
4431 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4432 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4433 		stream->readback(checksumBufPtr, checksumSize);
4434 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4435 			ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
4436 			abort();
4437 		}
4438 	}
4439 	return retval;
4440 }
4441 
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)4442 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)
4443 {
4444 
4445 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4446 	IOStream *stream = ctx->m_stream;
4447 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4448 	bool useChecksum = checksumCalculator->getVersion() > 0;
4449 
4450 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
4451 	 unsigned char *ptr;
4452 	 unsigned char *buf;
4453 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4454 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4455 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4456 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4457 	ptr = buf;
4458 	int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4459 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4460 
4461 		memcpy(ptr, &target, 4); ptr += 4;
4462 		memcpy(ptr, &level, 4); ptr += 4;
4463 		memcpy(ptr, &internalformat, 4); ptr += 4;
4464 		memcpy(ptr, &width, 4); ptr += 4;
4465 		memcpy(ptr, &height, 4); ptr += 4;
4466 		memcpy(ptr, &depth, 4); ptr += 4;
4467 		memcpy(ptr, &border, 4); ptr += 4;
4468 		memcpy(ptr, &format, 4); ptr += 4;
4469 		memcpy(ptr, &type, 4); ptr += 4;
4470 
4471 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4472 	stream->flush();
4473 	stream->writeFully(&__size_pixels,4);
4474 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
4475 	if (pixels != NULL) {
4476 		stream->writeFully(pixels, __size_pixels);
4477 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
4478 	}
4479 	buf = stream->alloc(checksumSize);
4480 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4481 
4482 }
4483 
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)4484 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)
4485 {
4486 
4487 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4488 	IOStream *stream = ctx->m_stream;
4489 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4490 	bool useChecksum = checksumCalculator->getVersion() > 0;
4491 
4492 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
4493 	 unsigned char *ptr;
4494 	 unsigned char *buf;
4495 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4496 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4497 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4498 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4499 	ptr = buf;
4500 	int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4501 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4502 
4503 		memcpy(ptr, &target, 4); ptr += 4;
4504 		memcpy(ptr, &level, 4); ptr += 4;
4505 		memcpy(ptr, &xoffset, 4); ptr += 4;
4506 		memcpy(ptr, &yoffset, 4); ptr += 4;
4507 		memcpy(ptr, &zoffset, 4); ptr += 4;
4508 		memcpy(ptr, &width, 4); ptr += 4;
4509 		memcpy(ptr, &height, 4); ptr += 4;
4510 		memcpy(ptr, &depth, 4); ptr += 4;
4511 		memcpy(ptr, &format, 4); ptr += 4;
4512 		memcpy(ptr, &type, 4); ptr += 4;
4513 
4514 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4515 	stream->flush();
4516 	stream->writeFully(&__size_pixels,4);
4517 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
4518 	if (pixels != NULL) {
4519 		stream->writeFully(pixels, __size_pixels);
4520 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
4521 	}
4522 	buf = stream->alloc(checksumSize);
4523 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4524 
4525 }
4526 
glCopyTexSubImage3DOES_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)4527 void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
4528 {
4529 
4530 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4531 	IOStream *stream = ctx->m_stream;
4532 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4533 	bool useChecksum = checksumCalculator->getVersion() > 0;
4534 
4535 	 unsigned char *ptr;
4536 	 unsigned char *buf;
4537 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
4538 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4539 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4540 	buf = stream->alloc(totalSize);
4541 	ptr = buf;
4542 	int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4543 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4544 
4545 		memcpy(ptr, &target, 4); ptr += 4;
4546 		memcpy(ptr, &level, 4); ptr += 4;
4547 		memcpy(ptr, &xoffset, 4); ptr += 4;
4548 		memcpy(ptr, &yoffset, 4); ptr += 4;
4549 		memcpy(ptr, &zoffset, 4); ptr += 4;
4550 		memcpy(ptr, &x, 4); ptr += 4;
4551 		memcpy(ptr, &y, 4); ptr += 4;
4552 		memcpy(ptr, &width, 4); ptr += 4;
4553 		memcpy(ptr, &height, 4); ptr += 4;
4554 
4555 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4556 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4557 
4558 }
4559 
glCompressedTexImage3DOES_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)4560 void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
4561 {
4562 
4563 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4564 	IOStream *stream = ctx->m_stream;
4565 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4566 	bool useChecksum = checksumCalculator->getVersion() > 0;
4567 
4568 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
4569 	 unsigned char *ptr;
4570 	 unsigned char *buf;
4571 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4572 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4573 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4574 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4575 	ptr = buf;
4576 	int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4577 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4578 
4579 		memcpy(ptr, &target, 4); ptr += 4;
4580 		memcpy(ptr, &level, 4); ptr += 4;
4581 		memcpy(ptr, &internalformat, 4); ptr += 4;
4582 		memcpy(ptr, &width, 4); ptr += 4;
4583 		memcpy(ptr, &height, 4); ptr += 4;
4584 		memcpy(ptr, &depth, 4); ptr += 4;
4585 		memcpy(ptr, &border, 4); ptr += 4;
4586 		memcpy(ptr, &imageSize, 4); ptr += 4;
4587 
4588 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4589 	stream->flush();
4590 	stream->writeFully(&__size_data,4);
4591 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
4592 	if (data != NULL) {
4593 		stream->writeFully(data, __size_data);
4594 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
4595 	}
4596 	buf = stream->alloc(checksumSize);
4597 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4598 
4599 }
4600 
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)4601 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)
4602 {
4603 
4604 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4605 	IOStream *stream = ctx->m_stream;
4606 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4607 	bool useChecksum = checksumCalculator->getVersion() > 0;
4608 
4609 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
4610 	 unsigned char *ptr;
4611 	 unsigned char *buf;
4612 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4613 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4614 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4615 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4616 	ptr = buf;
4617 	int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4618 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4619 
4620 		memcpy(ptr, &target, 4); ptr += 4;
4621 		memcpy(ptr, &level, 4); ptr += 4;
4622 		memcpy(ptr, &xoffset, 4); ptr += 4;
4623 		memcpy(ptr, &yoffset, 4); ptr += 4;
4624 		memcpy(ptr, &zoffset, 4); ptr += 4;
4625 		memcpy(ptr, &width, 4); ptr += 4;
4626 		memcpy(ptr, &height, 4); ptr += 4;
4627 		memcpy(ptr, &depth, 4); ptr += 4;
4628 		memcpy(ptr, &format, 4); ptr += 4;
4629 		memcpy(ptr, &imageSize, 4); ptr += 4;
4630 
4631 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4632 	stream->flush();
4633 	stream->writeFully(&__size_data,4);
4634 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
4635 	if (data != NULL) {
4636 		stream->writeFully(data, __size_data);
4637 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
4638 	}
4639 	buf = stream->alloc(checksumSize);
4640 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4641 
4642 }
4643 
glFramebufferTexture3DOES_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLint zoffset)4644 void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
4645 {
4646 
4647 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4648 	IOStream *stream = ctx->m_stream;
4649 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4650 	bool useChecksum = checksumCalculator->getVersion() > 0;
4651 
4652 	 unsigned char *ptr;
4653 	 unsigned char *buf;
4654 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
4655 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4656 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4657 	buf = stream->alloc(totalSize);
4658 	ptr = buf;
4659 	int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4660 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4661 
4662 		memcpy(ptr, &target, 4); ptr += 4;
4663 		memcpy(ptr, &attachment, 4); ptr += 4;
4664 		memcpy(ptr, &textarget, 4); ptr += 4;
4665 		memcpy(ptr, &texture, 4); ptr += 4;
4666 		memcpy(ptr, &level, 4); ptr += 4;
4667 		memcpy(ptr, &zoffset, 4); ptr += 4;
4668 
4669 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4670 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4671 
4672 }
4673 
glBindVertexArrayOES_enc(void * self,GLuint array)4674 void glBindVertexArrayOES_enc(void *self , GLuint array)
4675 {
4676 
4677 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4678 	IOStream *stream = ctx->m_stream;
4679 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4680 	bool useChecksum = checksumCalculator->getVersion() > 0;
4681 
4682 	 unsigned char *ptr;
4683 	 unsigned char *buf;
4684 	 const size_t sizeWithoutChecksum = 8 + 4;
4685 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4686 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4687 	buf = stream->alloc(totalSize);
4688 	ptr = buf;
4689 	int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
4690 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4691 
4692 		memcpy(ptr, &array, 4); ptr += 4;
4693 
4694 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4695 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4696 
4697 }
4698 
glDeleteVertexArraysOES_enc(void * self,GLsizei n,const GLuint * arrays)4699 void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
4700 {
4701 
4702 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4703 	IOStream *stream = ctx->m_stream;
4704 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4705 	bool useChecksum = checksumCalculator->getVersion() > 0;
4706 
4707 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
4708 	 unsigned char *ptr;
4709 	 unsigned char *buf;
4710 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
4711 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4712 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4713 	buf = stream->alloc(totalSize);
4714 	ptr = buf;
4715 	int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
4716 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4717 
4718 		memcpy(ptr, &n, 4); ptr += 4;
4719 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4720 	memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
4721 
4722 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4723 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4724 
4725 }
4726 
glGenVertexArraysOES_enc(void * self,GLsizei n,GLuint * arrays)4727 void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
4728 {
4729 
4730 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4731 	IOStream *stream = ctx->m_stream;
4732 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4733 	bool useChecksum = checksumCalculator->getVersion() > 0;
4734 
4735 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
4736 	 unsigned char *ptr;
4737 	 unsigned char *buf;
4738 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
4739 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4740 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4741 	buf = stream->alloc(totalSize);
4742 	ptr = buf;
4743 	int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
4744 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4745 
4746 		memcpy(ptr, &n, 4); ptr += 4;
4747 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4748 
4749 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4750 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4751 
4752 	stream->readback(arrays, __size_arrays);
4753 	if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
4754 	if (useChecksum) {
4755 		unsigned char *checksumBufPtr = NULL;
4756 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4757 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4758 		stream->readback(checksumBufPtr, checksumSize);
4759 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4760 			ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
4761 			abort();
4762 		}
4763 	}
4764 }
4765 
glIsVertexArrayOES_enc(void * self,GLuint array)4766 GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
4767 {
4768 
4769 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4770 	IOStream *stream = ctx->m_stream;
4771 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4772 	bool useChecksum = checksumCalculator->getVersion() > 0;
4773 
4774 	 unsigned char *ptr;
4775 	 unsigned char *buf;
4776 	 const size_t sizeWithoutChecksum = 8 + 4;
4777 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4778 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4779 	buf = stream->alloc(totalSize);
4780 	ptr = buf;
4781 	int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
4782 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4783 
4784 		memcpy(ptr, &array, 4); ptr += 4;
4785 
4786 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4787 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4788 
4789 
4790 	GLboolean retval;
4791 	stream->readback(&retval, 1);
4792 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4793 	if (useChecksum) {
4794 		unsigned char *checksumBufPtr = NULL;
4795 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4796 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4797 		stream->readback(checksumBufPtr, checksumSize);
4798 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4799 			ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
4800 			abort();
4801 		}
4802 	}
4803 	return retval;
4804 }
4805 
glDiscardFramebufferEXT_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments)4806 void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
4807 {
4808 
4809 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4810 	IOStream *stream = ctx->m_stream;
4811 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4812 	bool useChecksum = checksumCalculator->getVersion() > 0;
4813 
4814 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
4815 	 unsigned char *ptr;
4816 	 unsigned char *buf;
4817 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
4818 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4819 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4820 	buf = stream->alloc(totalSize);
4821 	ptr = buf;
4822 	int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
4823 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4824 
4825 		memcpy(ptr, &target, 4); ptr += 4;
4826 		memcpy(ptr, &numAttachments, 4); ptr += 4;
4827 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
4828 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
4829 
4830 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4831 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4832 
4833 }
4834 
glVertexAttribPointerData_enc(void * self,GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,void * data,GLuint datalen)4835 void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
4836 {
4837 
4838 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4839 	IOStream *stream = ctx->m_stream;
4840 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4841 	bool useChecksum = checksumCalculator->getVersion() > 0;
4842 
4843 	const unsigned int __size_data =  datalen;
4844 	 unsigned char *ptr;
4845 	 unsigned char *buf;
4846 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
4847 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4848 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4849 	buf = stream->alloc(totalSize);
4850 	ptr = buf;
4851 	int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4852 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4853 
4854 		memcpy(ptr, &indx, 4); ptr += 4;
4855 		memcpy(ptr, &size, 4); ptr += 4;
4856 		memcpy(ptr, &type, 4); ptr += 4;
4857 		memcpy(ptr, &normalized, 1); ptr += 1;
4858 		memcpy(ptr, &stride, 4); ptr += 4;
4859 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4860 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4861 		memcpy(ptr, &datalen, 4); ptr += 4;
4862 
4863 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4864 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4865 
4866 }
4867 
glVertexAttribPointerOffset_enc(void * self,GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,GLuint offset)4868 void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
4869 {
4870 
4871 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4872 	IOStream *stream = ctx->m_stream;
4873 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4874 	bool useChecksum = checksumCalculator->getVersion() > 0;
4875 
4876 	 unsigned char *ptr;
4877 	 unsigned char *buf;
4878 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4;
4879 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4880 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4881 	buf = stream->alloc(totalSize);
4882 	ptr = buf;
4883 	int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4884 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4885 
4886 		memcpy(ptr, &indx, 4); ptr += 4;
4887 		memcpy(ptr, &size, 4); ptr += 4;
4888 		memcpy(ptr, &type, 4); ptr += 4;
4889 		memcpy(ptr, &normalized, 1); ptr += 1;
4890 		memcpy(ptr, &stride, 4); ptr += 4;
4891 		memcpy(ptr, &offset, 4); ptr += 4;
4892 
4893 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4894 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4895 
4896 }
4897 
glDrawElementsOffset_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset)4898 void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
4899 {
4900 
4901 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4902 	IOStream *stream = ctx->m_stream;
4903 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4904 	bool useChecksum = checksumCalculator->getVersion() > 0;
4905 
4906 	 unsigned char *ptr;
4907 	 unsigned char *buf;
4908 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4909 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4910 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4911 	buf = stream->alloc(totalSize);
4912 	ptr = buf;
4913 	int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4914 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4915 
4916 		memcpy(ptr, &mode, 4); ptr += 4;
4917 		memcpy(ptr, &count, 4); ptr += 4;
4918 		memcpy(ptr, &type, 4); ptr += 4;
4919 		memcpy(ptr, &offset, 4); ptr += 4;
4920 
4921 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4922 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4923 
4924 }
4925 
glDrawElementsData_enc(void * self,GLenum mode,GLsizei count,GLenum type,void * data,GLuint datalen)4926 void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
4927 {
4928 
4929 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4930 	IOStream *stream = ctx->m_stream;
4931 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4932 	bool useChecksum = checksumCalculator->getVersion() > 0;
4933 
4934 	const unsigned int __size_data =  datalen;
4935 	 unsigned char *ptr;
4936 	 unsigned char *buf;
4937 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4938 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4939 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4940 	buf = stream->alloc(totalSize);
4941 	ptr = buf;
4942 	int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
4943 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4944 
4945 		memcpy(ptr, &mode, 4); ptr += 4;
4946 		memcpy(ptr, &count, 4); ptr += 4;
4947 		memcpy(ptr, &type, 4); ptr += 4;
4948 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4949 	memcpy(ptr, data, __size_data);ptr += __size_data;
4950 		memcpy(ptr, &datalen, 4); ptr += 4;
4951 
4952 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4953 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4954 
4955 }
4956 
glGetCompressedTextureFormats_enc(void * self,int count,GLint * formats)4957 void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
4958 {
4959 
4960 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4961 	IOStream *stream = ctx->m_stream;
4962 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4963 	bool useChecksum = checksumCalculator->getVersion() > 0;
4964 
4965 	const unsigned int __size_formats =  (count * sizeof(GLint));
4966 	 unsigned char *ptr;
4967 	 unsigned char *buf;
4968 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
4969 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4970 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4971 	buf = stream->alloc(totalSize);
4972 	ptr = buf;
4973 	int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
4974 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4975 
4976 		memcpy(ptr, &count, 4); ptr += 4;
4977 	*(unsigned int *)(ptr) = __size_formats; ptr += 4;
4978 
4979 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4980 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4981 
4982 	stream->readback(formats, __size_formats);
4983 	if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4984 	if (useChecksum) {
4985 		unsigned char *checksumBufPtr = NULL;
4986 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
4987 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4988 		stream->readback(checksumBufPtr, checksumSize);
4989 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
4990 			ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4991 			abort();
4992 		}
4993 	}
4994 }
4995 
glShaderString_enc(void * self,GLuint shader,const GLchar * string,GLsizei len)4996 void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
4997 {
4998 
4999 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5000 	IOStream *stream = ctx->m_stream;
5001 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5002 	bool useChecksum = checksumCalculator->getVersion() > 0;
5003 
5004 	const unsigned int __size_string =  len;
5005 	 unsigned char *ptr;
5006 	 unsigned char *buf;
5007 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4;
5008 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5009 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5010 	buf = stream->alloc(totalSize);
5011 	ptr = buf;
5012 	int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
5013 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5014 
5015 		memcpy(ptr, &shader, 4); ptr += 4;
5016 	*(unsigned int *)(ptr) = __size_string; ptr += 4;
5017 	memcpy(ptr, string, __size_string);ptr += __size_string;
5018 		memcpy(ptr, &len, 4); ptr += 4;
5019 
5020 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5021 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5022 
5023 }
5024 
glFinishRoundTrip_enc(void * self)5025 int glFinishRoundTrip_enc(void *self )
5026 {
5027 
5028 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5029 	IOStream *stream = ctx->m_stream;
5030 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5031 	bool useChecksum = checksumCalculator->getVersion() > 0;
5032 
5033 	 unsigned char *ptr;
5034 	 unsigned char *buf;
5035 	 const size_t sizeWithoutChecksum = 8;
5036 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5037 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5038 	buf = stream->alloc(totalSize);
5039 	ptr = buf;
5040 	int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
5041 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5042 
5043 
5044 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5045 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5046 
5047 
5048 	int retval;
5049 	stream->readback(&retval, 4);
5050 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5051 	if (useChecksum) {
5052 		unsigned char *checksumBufPtr = NULL;
5053 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5054 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5055 		stream->readback(checksumBufPtr, checksumSize);
5056 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5057 			ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
5058 			abort();
5059 		}
5060 	}
5061 	return retval;
5062 }
5063 
glGenVertexArrays_enc(void * self,GLsizei n,GLuint * arrays)5064 void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays)
5065 {
5066 
5067 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5068 	IOStream *stream = ctx->m_stream;
5069 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5070 	bool useChecksum = checksumCalculator->getVersion() > 0;
5071 
5072 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
5073 	 unsigned char *ptr;
5074 	 unsigned char *buf;
5075 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
5076 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5077 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5078 	buf = stream->alloc(totalSize);
5079 	ptr = buf;
5080 	int tmp = OP_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5081 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5082 
5083 		memcpy(ptr, &n, 4); ptr += 4;
5084 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5085 
5086 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5087 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5088 
5089 	stream->readback(arrays, __size_arrays);
5090 	if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
5091 	if (useChecksum) {
5092 		unsigned char *checksumBufPtr = NULL;
5093 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5094 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5095 		stream->readback(checksumBufPtr, checksumSize);
5096 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5097 			ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n");
5098 			abort();
5099 		}
5100 	}
5101 }
5102 
glBindVertexArray_enc(void * self,GLuint array)5103 void glBindVertexArray_enc(void *self , GLuint array)
5104 {
5105 
5106 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5107 	IOStream *stream = ctx->m_stream;
5108 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5109 	bool useChecksum = checksumCalculator->getVersion() > 0;
5110 
5111 	 unsigned char *ptr;
5112 	 unsigned char *buf;
5113 	 const size_t sizeWithoutChecksum = 8 + 4;
5114 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5115 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5116 	buf = stream->alloc(totalSize);
5117 	ptr = buf;
5118 	int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5119 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5120 
5121 		memcpy(ptr, &array, 4); ptr += 4;
5122 
5123 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5124 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5125 
5126 }
5127 
glDeleteVertexArrays_enc(void * self,GLsizei n,const GLuint * arrays)5128 void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays)
5129 {
5130 
5131 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5132 	IOStream *stream = ctx->m_stream;
5133 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5134 	bool useChecksum = checksumCalculator->getVersion() > 0;
5135 
5136 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
5137 	 unsigned char *ptr;
5138 	 unsigned char *buf;
5139 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
5140 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5141 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5142 	buf = stream->alloc(totalSize);
5143 	ptr = buf;
5144 	int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5145 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5146 
5147 		memcpy(ptr, &n, 4); ptr += 4;
5148 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5149 	memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
5150 
5151 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5152 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5153 
5154 }
5155 
glIsVertexArray_enc(void * self,GLuint array)5156 GLboolean glIsVertexArray_enc(void *self , GLuint array)
5157 {
5158 
5159 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5160 	IOStream *stream = ctx->m_stream;
5161 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5162 	bool useChecksum = checksumCalculator->getVersion() > 0;
5163 
5164 	 unsigned char *ptr;
5165 	 unsigned char *buf;
5166 	 const size_t sizeWithoutChecksum = 8 + 4;
5167 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5168 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5169 	buf = stream->alloc(totalSize);
5170 	ptr = buf;
5171 	int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5172 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5173 
5174 		memcpy(ptr, &array, 4); ptr += 4;
5175 
5176 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5177 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5178 
5179 
5180 	GLboolean retval;
5181 	stream->readback(&retval, 1);
5182 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
5183 	if (useChecksum) {
5184 		unsigned char *checksumBufPtr = NULL;
5185 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5186 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5187 		stream->readback(checksumBufPtr, checksumSize);
5188 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5189 			ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n");
5190 			abort();
5191 		}
5192 	}
5193 	return retval;
5194 }
5195 
glMapBufferRangeAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * mapped)5196 void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped)
5197 {
5198 
5199 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5200 	IOStream *stream = ctx->m_stream;
5201 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5202 	bool useChecksum = checksumCalculator->getVersion() > 0;
5203 
5204 	const unsigned int __size_mapped = ((mapped != NULL) ?  length : 0);
5205 	 unsigned char *ptr;
5206 	 unsigned char *buf;
5207 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
5208 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5209 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5210 	buf = stream->alloc(totalSize);
5211 	ptr = buf;
5212 	int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5213 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5214 
5215 		memcpy(ptr, &target, 4); ptr += 4;
5216 		memcpy(ptr, &offset, 4); ptr += 4;
5217 		memcpy(ptr, &length, 4); ptr += 4;
5218 		memcpy(ptr, &access, 4); ptr += 4;
5219 	*(unsigned int *)(ptr) = __size_mapped; ptr += 4;
5220 
5221 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5222 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5223 
5224 	if (mapped != NULL) {
5225 		stream->readback(mapped, __size_mapped);
5226 		if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped);
5227 	}
5228 	if (useChecksum) {
5229 		unsigned char *checksumBufPtr = NULL;
5230 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5231 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5232 		stream->readback(checksumBufPtr, checksumSize);
5233 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5234 			ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n");
5235 			abort();
5236 		}
5237 	}
5238 }
5239 
glUnmapBufferAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer,GLboolean * out_res)5240 void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
5241 {
5242 
5243 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5244 	IOStream *stream = ctx->m_stream;
5245 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5246 	bool useChecksum = checksumCalculator->getVersion() > 0;
5247 
5248 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
5249 	const unsigned int __size_out_res =  (sizeof(GLboolean));
5250 	 unsigned char *ptr;
5251 	 unsigned char *buf;
5252 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4;
5253 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5254 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5255 	buf = stream->alloc(totalSize);
5256 	ptr = buf;
5257 	int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5258 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5259 
5260 		memcpy(ptr, &target, 4); ptr += 4;
5261 		memcpy(ptr, &offset, 4); ptr += 4;
5262 		memcpy(ptr, &length, 4); ptr += 4;
5263 		memcpy(ptr, &access, 4); ptr += 4;
5264 	*(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5265 	if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5266 	*(unsigned int *)(ptr) = __size_out_res; ptr += 4;
5267 
5268 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5269 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5270 
5271 	stream->readback(out_res, __size_out_res);
5272 	if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
5273 	if (useChecksum) {
5274 		unsigned char *checksumBufPtr = NULL;
5275 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5276 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5277 		stream->readback(checksumBufPtr, checksumSize);
5278 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5279 			ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n");
5280 			abort();
5281 		}
5282 	}
5283 }
5284 
glFlushMappedBufferRangeAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer)5285 void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
5286 {
5287 
5288 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5289 	IOStream *stream = ctx->m_stream;
5290 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5291 	bool useChecksum = checksumCalculator->getVersion() > 0;
5292 
5293 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
5294 	 unsigned char *ptr;
5295 	 unsigned char *buf;
5296 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
5297 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5298 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5299 	buf = stream->alloc(totalSize);
5300 	ptr = buf;
5301 	int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5302 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5303 
5304 		memcpy(ptr, &target, 4); ptr += 4;
5305 		memcpy(ptr, &offset, 4); ptr += 4;
5306 		memcpy(ptr, &length, 4); ptr += 4;
5307 		memcpy(ptr, &access, 4); ptr += 4;
5308 	*(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5309 	if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5310 
5311 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5312 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5313 
5314 }
5315 
glReadPixelsOffsetAEMU_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLuint offset)5316 void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5317 {
5318 
5319 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5320 	IOStream *stream = ctx->m_stream;
5321 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5322 	bool useChecksum = checksumCalculator->getVersion() > 0;
5323 
5324 	 unsigned char *ptr;
5325 	 unsigned char *buf;
5326 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5327 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5328 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5329 	buf = stream->alloc(totalSize);
5330 	ptr = buf;
5331 	int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5332 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5333 
5334 		memcpy(ptr, &x, 4); ptr += 4;
5335 		memcpy(ptr, &y, 4); ptr += 4;
5336 		memcpy(ptr, &width, 4); ptr += 4;
5337 		memcpy(ptr, &height, 4); ptr += 4;
5338 		memcpy(ptr, &format, 4); ptr += 4;
5339 		memcpy(ptr, &type, 4); ptr += 4;
5340 		memcpy(ptr, &offset, 4); ptr += 4;
5341 
5342 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5343 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5344 
5345 }
5346 
glCompressedTexImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,GLuint offset)5347 void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset)
5348 {
5349 
5350 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5351 	IOStream *stream = ctx->m_stream;
5352 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5353 	bool useChecksum = checksumCalculator->getVersion() > 0;
5354 
5355 	 unsigned char *ptr;
5356 	 unsigned char *buf;
5357 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5358 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5359 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5360 	buf = stream->alloc(totalSize);
5361 	ptr = buf;
5362 	int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5363 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5364 
5365 		memcpy(ptr, &target, 4); ptr += 4;
5366 		memcpy(ptr, &level, 4); ptr += 4;
5367 		memcpy(ptr, &internalformat, 4); ptr += 4;
5368 		memcpy(ptr, &width, 4); ptr += 4;
5369 		memcpy(ptr, &height, 4); ptr += 4;
5370 		memcpy(ptr, &border, 4); ptr += 4;
5371 		memcpy(ptr, &imageSize, 4); ptr += 4;
5372 		memcpy(ptr, &offset, 4); ptr += 4;
5373 
5374 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5375 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5376 
5377 }
5378 
glCompressedTexSubImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,GLuint offset)5379 void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset)
5380 {
5381 
5382 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5383 	IOStream *stream = ctx->m_stream;
5384 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5385 	bool useChecksum = checksumCalculator->getVersion() > 0;
5386 
5387 	 unsigned char *ptr;
5388 	 unsigned char *buf;
5389 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5390 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5391 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5392 	buf = stream->alloc(totalSize);
5393 	ptr = buf;
5394 	int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5395 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5396 
5397 		memcpy(ptr, &target, 4); ptr += 4;
5398 		memcpy(ptr, &level, 4); ptr += 4;
5399 		memcpy(ptr, &xoffset, 4); ptr += 4;
5400 		memcpy(ptr, &yoffset, 4); ptr += 4;
5401 		memcpy(ptr, &width, 4); ptr += 4;
5402 		memcpy(ptr, &height, 4); ptr += 4;
5403 		memcpy(ptr, &format, 4); ptr += 4;
5404 		memcpy(ptr, &imageSize, 4); ptr += 4;
5405 		memcpy(ptr, &offset, 4); ptr += 4;
5406 
5407 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5408 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5409 
5410 }
5411 
glTexImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,GLuint offset)5412 void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset)
5413 {
5414 
5415 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5416 	IOStream *stream = ctx->m_stream;
5417 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5418 	bool useChecksum = checksumCalculator->getVersion() > 0;
5419 
5420 	 unsigned char *ptr;
5421 	 unsigned char *buf;
5422 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5423 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5424 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5425 	buf = stream->alloc(totalSize);
5426 	ptr = buf;
5427 	int tmp = OP_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5428 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5429 
5430 		memcpy(ptr, &target, 4); ptr += 4;
5431 		memcpy(ptr, &level, 4); ptr += 4;
5432 		memcpy(ptr, &internalformat, 4); ptr += 4;
5433 		memcpy(ptr, &width, 4); ptr += 4;
5434 		memcpy(ptr, &height, 4); ptr += 4;
5435 		memcpy(ptr, &border, 4); ptr += 4;
5436 		memcpy(ptr, &format, 4); ptr += 4;
5437 		memcpy(ptr, &type, 4); ptr += 4;
5438 		memcpy(ptr, &offset, 4); ptr += 4;
5439 
5440 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5441 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5442 
5443 }
5444 
glTexSubImage2DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,GLuint offset)5445 void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5446 {
5447 
5448 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5449 	IOStream *stream = ctx->m_stream;
5450 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5451 	bool useChecksum = checksumCalculator->getVersion() > 0;
5452 
5453 	 unsigned char *ptr;
5454 	 unsigned char *buf;
5455 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5456 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5457 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5458 	buf = stream->alloc(totalSize);
5459 	ptr = buf;
5460 	int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5461 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5462 
5463 		memcpy(ptr, &target, 4); ptr += 4;
5464 		memcpy(ptr, &level, 4); ptr += 4;
5465 		memcpy(ptr, &xoffset, 4); ptr += 4;
5466 		memcpy(ptr, &yoffset, 4); ptr += 4;
5467 		memcpy(ptr, &width, 4); ptr += 4;
5468 		memcpy(ptr, &height, 4); ptr += 4;
5469 		memcpy(ptr, &format, 4); ptr += 4;
5470 		memcpy(ptr, &type, 4); ptr += 4;
5471 		memcpy(ptr, &offset, 4); ptr += 4;
5472 
5473 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5474 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5475 
5476 }
5477 
glBindBufferRange_enc(void * self,GLenum target,GLuint index,GLuint buffer,GLintptr offset,GLsizeiptr size)5478 void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5479 {
5480 
5481 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5482 	IOStream *stream = ctx->m_stream;
5483 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5484 	bool useChecksum = checksumCalculator->getVersion() > 0;
5485 
5486 	 unsigned char *ptr;
5487 	 unsigned char *buf;
5488 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5489 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5490 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5491 	buf = stream->alloc(totalSize);
5492 	ptr = buf;
5493 	int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4;
5494 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5495 
5496 		memcpy(ptr, &target, 4); ptr += 4;
5497 		memcpy(ptr, &index, 4); ptr += 4;
5498 		memcpy(ptr, &buffer, 4); ptr += 4;
5499 		memcpy(ptr, &offset, 4); ptr += 4;
5500 		memcpy(ptr, &size, 4); ptr += 4;
5501 
5502 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5503 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5504 
5505 }
5506 
glBindBufferBase_enc(void * self,GLenum target,GLuint index,GLuint buffer)5507 void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer)
5508 {
5509 
5510 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5511 	IOStream *stream = ctx->m_stream;
5512 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5513 	bool useChecksum = checksumCalculator->getVersion() > 0;
5514 
5515 	 unsigned char *ptr;
5516 	 unsigned char *buf;
5517 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5518 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5519 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5520 	buf = stream->alloc(totalSize);
5521 	ptr = buf;
5522 	int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4;
5523 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5524 
5525 		memcpy(ptr, &target, 4); ptr += 4;
5526 		memcpy(ptr, &index, 4); ptr += 4;
5527 		memcpy(ptr, &buffer, 4); ptr += 4;
5528 
5529 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5530 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5531 
5532 }
5533 
glCopyBufferSubData_enc(void * self,GLenum readtarget,GLenum writetarget,GLintptr readoffset,GLintptr writeoffset,GLsizeiptr size)5534 void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
5535 {
5536 
5537 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5538 	IOStream *stream = ctx->m_stream;
5539 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5540 	bool useChecksum = checksumCalculator->getVersion() > 0;
5541 
5542 	 unsigned char *ptr;
5543 	 unsigned char *buf;
5544 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5545 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5546 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5547 	buf = stream->alloc(totalSize);
5548 	ptr = buf;
5549 	int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
5550 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5551 
5552 		memcpy(ptr, &readtarget, 4); ptr += 4;
5553 		memcpy(ptr, &writetarget, 4); ptr += 4;
5554 		memcpy(ptr, &readoffset, 4); ptr += 4;
5555 		memcpy(ptr, &writeoffset, 4); ptr += 4;
5556 		memcpy(ptr, &size, 4); ptr += 4;
5557 
5558 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5559 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5560 
5561 	stream->flush();
5562 }
5563 
glClearBufferiv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLint * value)5564 void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value)
5565 {
5566 
5567 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5568 	IOStream *stream = ctx->m_stream;
5569 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5570 	bool useChecksum = checksumCalculator->getVersion() > 0;
5571 
5572 	const unsigned int __size_value =  (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer));
5573 	 unsigned char *ptr;
5574 	 unsigned char *buf;
5575 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5576 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5577 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5578 	buf = stream->alloc(totalSize);
5579 	ptr = buf;
5580 	int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4;
5581 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5582 
5583 		memcpy(ptr, &buffer, 4); ptr += 4;
5584 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
5585 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
5586 	memcpy(ptr, value, __size_value);ptr += __size_value;
5587 
5588 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5589 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5590 
5591 }
5592 
glClearBufferuiv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLuint * value)5593 void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value)
5594 {
5595 
5596 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5597 	IOStream *stream = ctx->m_stream;
5598 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5599 	bool useChecksum = checksumCalculator->getVersion() > 0;
5600 
5601 	const unsigned int __size_value =  (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer));
5602 	 unsigned char *ptr;
5603 	 unsigned char *buf;
5604 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5605 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5606 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5607 	buf = stream->alloc(totalSize);
5608 	ptr = buf;
5609 	int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4;
5610 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5611 
5612 		memcpy(ptr, &buffer, 4); ptr += 4;
5613 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
5614 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
5615 	memcpy(ptr, value, __size_value);ptr += __size_value;
5616 
5617 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5618 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5619 
5620 }
5621 
glClearBufferfv_enc(void * self,GLenum buffer,GLint drawBuffer,const GLfloat * value)5622 void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value)
5623 {
5624 
5625 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5626 	IOStream *stream = ctx->m_stream;
5627 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5628 	bool useChecksum = checksumCalculator->getVersion() > 0;
5629 
5630 	const unsigned int __size_value =  (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer));
5631 	 unsigned char *ptr;
5632 	 unsigned char *buf;
5633 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5634 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5635 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5636 	buf = stream->alloc(totalSize);
5637 	ptr = buf;
5638 	int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4;
5639 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5640 
5641 		memcpy(ptr, &buffer, 4); ptr += 4;
5642 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
5643 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
5644 	memcpy(ptr, value, __size_value);ptr += __size_value;
5645 
5646 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5647 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5648 
5649 }
5650 
glClearBufferfi_enc(void * self,GLenum buffer,GLint drawBuffer,GLfloat depth,GLint stencil)5651 void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
5652 {
5653 
5654 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5655 	IOStream *stream = ctx->m_stream;
5656 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5657 	bool useChecksum = checksumCalculator->getVersion() > 0;
5658 
5659 	 unsigned char *ptr;
5660 	 unsigned char *buf;
5661 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5662 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5663 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5664 	buf = stream->alloc(totalSize);
5665 	ptr = buf;
5666 	int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4;
5667 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5668 
5669 		memcpy(ptr, &buffer, 4); ptr += 4;
5670 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
5671 		memcpy(ptr, &depth, 4); ptr += 4;
5672 		memcpy(ptr, &stencil, 4); ptr += 4;
5673 
5674 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5675 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5676 
5677 }
5678 
glUniformBlockBinding_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLuint uniformBlockBinding)5679 void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5680 {
5681 
5682 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5683 	IOStream *stream = ctx->m_stream;
5684 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5685 	bool useChecksum = checksumCalculator->getVersion() > 0;
5686 
5687 	 unsigned char *ptr;
5688 	 unsigned char *buf;
5689 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5690 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5691 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5692 	buf = stream->alloc(totalSize);
5693 	ptr = buf;
5694 	int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4;
5695 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5696 
5697 		memcpy(ptr, &program, 4); ptr += 4;
5698 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5699 		memcpy(ptr, &uniformBlockBinding, 4); ptr += 4;
5700 
5701 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5702 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5703 
5704 }
5705 
glGetUniformBlockIndex_enc(void * self,GLuint program,const GLchar * uniformBlockName)5706 GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName)
5707 {
5708 
5709 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5710 	IOStream *stream = ctx->m_stream;
5711 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5712 	bool useChecksum = checksumCalculator->getVersion() > 0;
5713 
5714 	const unsigned int __size_uniformBlockName =  (strlen(uniformBlockName) + 1);
5715 	 unsigned char *ptr;
5716 	 unsigned char *buf;
5717 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4;
5718 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5719 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5720 	buf = stream->alloc(totalSize);
5721 	ptr = buf;
5722 	int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4;
5723 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5724 
5725 		memcpy(ptr, &program, 4); ptr += 4;
5726 	*(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5727 	memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName;
5728 
5729 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5730 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5731 
5732 
5733 	GLuint retval;
5734 	stream->readback(&retval, 4);
5735 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5736 	if (useChecksum) {
5737 		unsigned char *checksumBufPtr = NULL;
5738 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5739 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5740 		stream->readback(checksumBufPtr, checksumSize);
5741 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5742 			ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n");
5743 			abort();
5744 		}
5745 	}
5746 	return retval;
5747 }
5748 
glGetUniformIndicesAEMU_enc(void * self,GLuint program,GLsizei uniformCount,const GLchar * packedUniformNames,GLsizei packedLen,GLuint * uniformIndices)5749 void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices)
5750 {
5751 
5752 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5753 	IOStream *stream = ctx->m_stream;
5754 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5755 	bool useChecksum = checksumCalculator->getVersion() > 0;
5756 
5757 	const unsigned int __size_packedUniformNames =  packedLen;
5758 	const unsigned int __size_uniformIndices =  (uniformCount * sizeof(GLuint));
5759 	 unsigned char *ptr;
5760 	 unsigned char *buf;
5761 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4;
5762 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5763 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5764 	buf = stream->alloc(totalSize);
5765 	ptr = buf;
5766 	int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5767 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5768 
5769 		memcpy(ptr, &program, 4); ptr += 4;
5770 		memcpy(ptr, &uniformCount, 4); ptr += 4;
5771 	*(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4;
5772 	memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames;
5773 		memcpy(ptr, &packedLen, 4); ptr += 4;
5774 	*(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
5775 
5776 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5777 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5778 
5779 	stream->readback(uniformIndices, __size_uniformIndices);
5780 	if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices);
5781 	if (useChecksum) {
5782 		unsigned char *checksumBufPtr = NULL;
5783 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5784 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5785 		stream->readback(checksumBufPtr, checksumSize);
5786 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5787 			ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n");
5788 			abort();
5789 		}
5790 	}
5791 }
5792 
glGetActiveUniformBlockiv_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLenum pname,GLint * params)5793 void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5794 {
5795 
5796 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5797 	IOStream *stream = ctx->m_stream;
5798 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5799 	bool useChecksum = checksumCalculator->getVersion() > 0;
5800 
5801 	const unsigned int __size_params =  (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint));
5802 	 unsigned char *ptr;
5803 	 unsigned char *buf;
5804 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
5805 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5806 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5807 	buf = stream->alloc(totalSize);
5808 	ptr = buf;
5809 	int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4;
5810 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5811 
5812 		memcpy(ptr, &program, 4); ptr += 4;
5813 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5814 		memcpy(ptr, &pname, 4); ptr += 4;
5815 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5816 
5817 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5818 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5819 
5820 	stream->readback(params, __size_params);
5821 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5822 	if (useChecksum) {
5823 		unsigned char *checksumBufPtr = NULL;
5824 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5825 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5826 		stream->readback(checksumBufPtr, checksumSize);
5827 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5828 			ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n");
5829 			abort();
5830 		}
5831 	}
5832 }
5833 
glGetActiveUniformBlockName_enc(void * self,GLuint program,GLuint uniformBlockIndex,GLsizei bufSize,GLsizei * length,GLchar * uniformBlockName)5834 void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5835 {
5836 
5837 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5838 	IOStream *stream = ctx->m_stream;
5839 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5840 	bool useChecksum = checksumCalculator->getVersion() > 0;
5841 
5842 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
5843 	const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ?  bufSize : 0);
5844 	 unsigned char *ptr;
5845 	 unsigned char *buf;
5846 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4;
5847 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5848 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5849 	buf = stream->alloc(totalSize);
5850 	ptr = buf;
5851 	int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4;
5852 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5853 
5854 		memcpy(ptr, &program, 4); ptr += 4;
5855 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5856 		memcpy(ptr, &bufSize, 4); ptr += 4;
5857 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
5858 	*(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5859 
5860 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5861 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5862 
5863 	if (length != NULL) {
5864 		stream->readback(length, __size_length);
5865 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
5866 	}
5867 	if (uniformBlockName != NULL) {
5868 		stream->readback(uniformBlockName, __size_uniformBlockName);
5869 		if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName);
5870 	}
5871 	if (useChecksum) {
5872 		unsigned char *checksumBufPtr = NULL;
5873 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5874 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5875 		stream->readback(checksumBufPtr, checksumSize);
5876 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5877 			ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n");
5878 			abort();
5879 		}
5880 	}
5881 }
5882 
glUniform1ui_enc(void * self,GLint location,GLuint v0)5883 void glUniform1ui_enc(void *self , GLint location, GLuint v0)
5884 {
5885 
5886 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5887 	IOStream *stream = ctx->m_stream;
5888 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5889 	bool useChecksum = checksumCalculator->getVersion() > 0;
5890 
5891 	 unsigned char *ptr;
5892 	 unsigned char *buf;
5893 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5894 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5895 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5896 	buf = stream->alloc(totalSize);
5897 	ptr = buf;
5898 	int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
5899 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5900 
5901 		memcpy(ptr, &location, 4); ptr += 4;
5902 		memcpy(ptr, &v0, 4); ptr += 4;
5903 
5904 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5905 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5906 
5907 }
5908 
glUniform2ui_enc(void * self,GLint location,GLuint v0,GLuint v1)5909 void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1)
5910 {
5911 
5912 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5913 	IOStream *stream = ctx->m_stream;
5914 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5915 	bool useChecksum = checksumCalculator->getVersion() > 0;
5916 
5917 	 unsigned char *ptr;
5918 	 unsigned char *buf;
5919 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5920 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5921 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5922 	buf = stream->alloc(totalSize);
5923 	ptr = buf;
5924 	int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
5925 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5926 
5927 		memcpy(ptr, &location, 4); ptr += 4;
5928 		memcpy(ptr, &v0, 4); ptr += 4;
5929 		memcpy(ptr, &v1, 4); ptr += 4;
5930 
5931 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5932 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5933 
5934 }
5935 
glUniform3ui_enc(void * self,GLint location,GLuint v0,GLuint v1,GLuint v2)5936 void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2)
5937 {
5938 
5939 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5940 	IOStream *stream = ctx->m_stream;
5941 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5942 	bool useChecksum = checksumCalculator->getVersion() > 0;
5943 
5944 	 unsigned char *ptr;
5945 	 unsigned char *buf;
5946 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5947 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5948 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5949 	buf = stream->alloc(totalSize);
5950 	ptr = buf;
5951 	int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
5952 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5953 
5954 		memcpy(ptr, &location, 4); ptr += 4;
5955 		memcpy(ptr, &v0, 4); ptr += 4;
5956 		memcpy(ptr, &v1, 4); ptr += 4;
5957 		memcpy(ptr, &v2, 4); ptr += 4;
5958 
5959 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5960 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5961 
5962 }
5963 
glUniform4ui_enc(void * self,GLint location,GLint v0,GLuint v1,GLuint v2,GLuint v3)5964 void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3)
5965 {
5966 
5967 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5968 	IOStream *stream = ctx->m_stream;
5969 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5970 	bool useChecksum = checksumCalculator->getVersion() > 0;
5971 
5972 	 unsigned char *ptr;
5973 	 unsigned char *buf;
5974 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5975 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5976 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5977 	buf = stream->alloc(totalSize);
5978 	ptr = buf;
5979 	int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
5980 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5981 
5982 		memcpy(ptr, &location, 4); ptr += 4;
5983 		memcpy(ptr, &v0, 4); ptr += 4;
5984 		memcpy(ptr, &v1, 4); ptr += 4;
5985 		memcpy(ptr, &v2, 4); ptr += 4;
5986 		memcpy(ptr, &v3, 4); ptr += 4;
5987 
5988 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5989 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5990 
5991 }
5992 
glUniform1uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)5993 void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
5994 {
5995 
5996 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5997 	IOStream *stream = ctx->m_stream;
5998 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5999 	bool useChecksum = checksumCalculator->getVersion() > 0;
6000 
6001 	const unsigned int __size_value =  (count * sizeof(GLuint));
6002 	 unsigned char *ptr;
6003 	 unsigned char *buf;
6004 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6005 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6006 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6007 	buf = stream->alloc(totalSize);
6008 	ptr = buf;
6009 	int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6010 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6011 
6012 		memcpy(ptr, &location, 4); ptr += 4;
6013 		memcpy(ptr, &count, 4); ptr += 4;
6014 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6015 	memcpy(ptr, value, __size_value);ptr += __size_value;
6016 
6017 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6018 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6019 
6020 }
6021 
glUniform2uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6022 void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6023 {
6024 
6025 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6026 	IOStream *stream = ctx->m_stream;
6027 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6028 	bool useChecksum = checksumCalculator->getVersion() > 0;
6029 
6030 	const unsigned int __size_value =  (count * 2 * sizeof(GLuint));
6031 	 unsigned char *ptr;
6032 	 unsigned char *buf;
6033 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6034 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6035 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6036 	buf = stream->alloc(totalSize);
6037 	ptr = buf;
6038 	int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6039 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6040 
6041 		memcpy(ptr, &location, 4); ptr += 4;
6042 		memcpy(ptr, &count, 4); ptr += 4;
6043 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6044 	memcpy(ptr, value, __size_value);ptr += __size_value;
6045 
6046 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6047 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6048 
6049 }
6050 
glUniform3uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6051 void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6052 {
6053 
6054 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6055 	IOStream *stream = ctx->m_stream;
6056 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6057 	bool useChecksum = checksumCalculator->getVersion() > 0;
6058 
6059 	const unsigned int __size_value =  (count * 3 * sizeof(GLuint));
6060 	 unsigned char *ptr;
6061 	 unsigned char *buf;
6062 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6063 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6064 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6065 	buf = stream->alloc(totalSize);
6066 	ptr = buf;
6067 	int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6068 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6069 
6070 		memcpy(ptr, &location, 4); ptr += 4;
6071 		memcpy(ptr, &count, 4); ptr += 4;
6072 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6073 	memcpy(ptr, value, __size_value);ptr += __size_value;
6074 
6075 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6076 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6077 
6078 }
6079 
glUniform4uiv_enc(void * self,GLint location,GLsizei count,const GLuint * value)6080 void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6081 {
6082 
6083 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6084 	IOStream *stream = ctx->m_stream;
6085 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6086 	bool useChecksum = checksumCalculator->getVersion() > 0;
6087 
6088 	const unsigned int __size_value =  (count * 4 * sizeof(GLuint));
6089 	 unsigned char *ptr;
6090 	 unsigned char *buf;
6091 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6092 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6093 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6094 	buf = stream->alloc(totalSize);
6095 	ptr = buf;
6096 	int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6097 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6098 
6099 		memcpy(ptr, &location, 4); ptr += 4;
6100 		memcpy(ptr, &count, 4); ptr += 4;
6101 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6102 	memcpy(ptr, value, __size_value);ptr += __size_value;
6103 
6104 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6105 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6106 
6107 }
6108 
glUniformMatrix2x3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6109 void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6110 {
6111 
6112 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6113 	IOStream *stream = ctx->m_stream;
6114 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6115 	bool useChecksum = checksumCalculator->getVersion() > 0;
6116 
6117 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
6118 	 unsigned char *ptr;
6119 	 unsigned char *buf;
6120 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6121 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6122 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6123 	buf = stream->alloc(totalSize);
6124 	ptr = buf;
6125 	int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6126 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6127 
6128 		memcpy(ptr, &location, 4); ptr += 4;
6129 		memcpy(ptr, &count, 4); ptr += 4;
6130 		memcpy(ptr, &transpose, 1); ptr += 1;
6131 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6132 	memcpy(ptr, value, __size_value);ptr += __size_value;
6133 
6134 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6135 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6136 
6137 }
6138 
glUniformMatrix3x2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6139 void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6140 {
6141 
6142 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6143 	IOStream *stream = ctx->m_stream;
6144 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6145 	bool useChecksum = checksumCalculator->getVersion() > 0;
6146 
6147 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
6148 	 unsigned char *ptr;
6149 	 unsigned char *buf;
6150 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6151 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6152 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6153 	buf = stream->alloc(totalSize);
6154 	ptr = buf;
6155 	int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6156 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6157 
6158 		memcpy(ptr, &location, 4); ptr += 4;
6159 		memcpy(ptr, &count, 4); ptr += 4;
6160 		memcpy(ptr, &transpose, 1); ptr += 1;
6161 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6162 	memcpy(ptr, value, __size_value);ptr += __size_value;
6163 
6164 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6165 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6166 
6167 }
6168 
glUniformMatrix2x4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6169 void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6170 {
6171 
6172 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6173 	IOStream *stream = ctx->m_stream;
6174 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6175 	bool useChecksum = checksumCalculator->getVersion() > 0;
6176 
6177 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
6178 	 unsigned char *ptr;
6179 	 unsigned char *buf;
6180 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6181 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6182 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6183 	buf = stream->alloc(totalSize);
6184 	ptr = buf;
6185 	int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6186 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6187 
6188 		memcpy(ptr, &location, 4); ptr += 4;
6189 		memcpy(ptr, &count, 4); ptr += 4;
6190 		memcpy(ptr, &transpose, 1); ptr += 1;
6191 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6192 	memcpy(ptr, value, __size_value);ptr += __size_value;
6193 
6194 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6195 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6196 
6197 }
6198 
glUniformMatrix4x2fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6199 void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6200 {
6201 
6202 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6203 	IOStream *stream = ctx->m_stream;
6204 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6205 	bool useChecksum = checksumCalculator->getVersion() > 0;
6206 
6207 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
6208 	 unsigned char *ptr;
6209 	 unsigned char *buf;
6210 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6211 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6212 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6213 	buf = stream->alloc(totalSize);
6214 	ptr = buf;
6215 	int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6216 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6217 
6218 		memcpy(ptr, &location, 4); ptr += 4;
6219 		memcpy(ptr, &count, 4); ptr += 4;
6220 		memcpy(ptr, &transpose, 1); ptr += 1;
6221 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6222 	memcpy(ptr, value, __size_value);ptr += __size_value;
6223 
6224 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6225 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6226 
6227 }
6228 
glUniformMatrix3x4fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6229 void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6230 {
6231 
6232 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6233 	IOStream *stream = ctx->m_stream;
6234 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6235 	bool useChecksum = checksumCalculator->getVersion() > 0;
6236 
6237 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
6238 	 unsigned char *ptr;
6239 	 unsigned char *buf;
6240 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6241 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6242 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6243 	buf = stream->alloc(totalSize);
6244 	ptr = buf;
6245 	int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6246 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6247 
6248 		memcpy(ptr, &location, 4); ptr += 4;
6249 		memcpy(ptr, &count, 4); ptr += 4;
6250 		memcpy(ptr, &transpose, 1); ptr += 1;
6251 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6252 	memcpy(ptr, value, __size_value);ptr += __size_value;
6253 
6254 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6255 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6256 
6257 }
6258 
glUniformMatrix4x3fv_enc(void * self,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)6259 void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6260 {
6261 
6262 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6263 	IOStream *stream = ctx->m_stream;
6264 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6265 	bool useChecksum = checksumCalculator->getVersion() > 0;
6266 
6267 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
6268 	 unsigned char *ptr;
6269 	 unsigned char *buf;
6270 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6271 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6272 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6273 	buf = stream->alloc(totalSize);
6274 	ptr = buf;
6275 	int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6276 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6277 
6278 		memcpy(ptr, &location, 4); ptr += 4;
6279 		memcpy(ptr, &count, 4); ptr += 4;
6280 		memcpy(ptr, &transpose, 1); ptr += 1;
6281 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
6282 	memcpy(ptr, value, __size_value);ptr += __size_value;
6283 
6284 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6285 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6286 
6287 }
6288 
glGetUniformuiv_enc(void * self,GLuint program,GLint location,GLuint * params)6289 void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params)
6290 {
6291 
6292 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6293 	IOStream *stream = ctx->m_stream;
6294 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6295 	bool useChecksum = checksumCalculator->getVersion() > 0;
6296 
6297 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
6298 	 unsigned char *ptr;
6299 	 unsigned char *buf;
6300 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6301 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6302 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6303 	buf = stream->alloc(totalSize);
6304 	ptr = buf;
6305 	int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6306 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6307 
6308 		memcpy(ptr, &program, 4); ptr += 4;
6309 		memcpy(ptr, &location, 4); ptr += 4;
6310 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6311 
6312 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6313 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6314 
6315 	stream->readback(params, __size_params);
6316 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6317 	if (useChecksum) {
6318 		unsigned char *checksumBufPtr = NULL;
6319 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6320 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6321 		stream->readback(checksumBufPtr, checksumSize);
6322 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6323 			ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n");
6324 			abort();
6325 		}
6326 	}
6327 }
6328 
glGetActiveUniformsiv_enc(void * self,GLuint program,GLsizei uniformCount,const GLuint * uniformIndices,GLenum pname,GLint * params)6329 void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
6330 {
6331 
6332 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6333 	IOStream *stream = ctx->m_stream;
6334 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6335 	bool useChecksum = checksumCalculator->getVersion() > 0;
6336 
6337 	const unsigned int __size_uniformIndices =  (uniformCount * sizeof(GLuint));
6338 	const unsigned int __size_params =  (uniformCount * sizeof(GLint));
6339 	 unsigned char *ptr;
6340 	 unsigned char *buf;
6341 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4;
6342 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6343 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6344 	buf = stream->alloc(totalSize);
6345 	ptr = buf;
6346 	int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4;
6347 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6348 
6349 		memcpy(ptr, &program, 4); ptr += 4;
6350 		memcpy(ptr, &uniformCount, 4); ptr += 4;
6351 	*(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
6352 	memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices;
6353 		memcpy(ptr, &pname, 4); ptr += 4;
6354 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6355 
6356 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6357 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6358 
6359 	stream->readback(params, __size_params);
6360 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6361 	if (useChecksum) {
6362 		unsigned char *checksumBufPtr = NULL;
6363 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6364 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6365 		stream->readback(checksumBufPtr, checksumSize);
6366 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6367 			ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n");
6368 			abort();
6369 		}
6370 	}
6371 }
6372 
glVertexAttribI4i_enc(void * self,GLuint index,GLint v0,GLint v1,GLint v2,GLint v3)6373 void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3)
6374 {
6375 
6376 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6377 	IOStream *stream = ctx->m_stream;
6378 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6379 	bool useChecksum = checksumCalculator->getVersion() > 0;
6380 
6381 	 unsigned char *ptr;
6382 	 unsigned char *buf;
6383 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6384 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6385 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6386 	buf = stream->alloc(totalSize);
6387 	ptr = buf;
6388 	int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4;
6389 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6390 
6391 		memcpy(ptr, &index, 4); ptr += 4;
6392 		memcpy(ptr, &v0, 4); ptr += 4;
6393 		memcpy(ptr, &v1, 4); ptr += 4;
6394 		memcpy(ptr, &v2, 4); ptr += 4;
6395 		memcpy(ptr, &v3, 4); ptr += 4;
6396 
6397 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6398 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6399 
6400 }
6401 
glVertexAttribI4ui_enc(void * self,GLuint index,GLuint v0,GLuint v1,GLuint v2,GLuint v3)6402 void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
6403 {
6404 
6405 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6406 	IOStream *stream = ctx->m_stream;
6407 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6408 	bool useChecksum = checksumCalculator->getVersion() > 0;
6409 
6410 	 unsigned char *ptr;
6411 	 unsigned char *buf;
6412 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6413 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6414 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6415 	buf = stream->alloc(totalSize);
6416 	ptr = buf;
6417 	int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4;
6418 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6419 
6420 		memcpy(ptr, &index, 4); ptr += 4;
6421 		memcpy(ptr, &v0, 4); ptr += 4;
6422 		memcpy(ptr, &v1, 4); ptr += 4;
6423 		memcpy(ptr, &v2, 4); ptr += 4;
6424 		memcpy(ptr, &v3, 4); ptr += 4;
6425 
6426 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6427 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6428 
6429 }
6430 
glVertexAttribI4iv_enc(void * self,GLuint index,const GLint * v)6431 void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v)
6432 {
6433 
6434 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6435 	IOStream *stream = ctx->m_stream;
6436 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6437 	bool useChecksum = checksumCalculator->getVersion() > 0;
6438 
6439 	const unsigned int __size_v =  (4 * sizeof(GLint));
6440 	 unsigned char *ptr;
6441 	 unsigned char *buf;
6442 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6443 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6444 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6445 	buf = stream->alloc(totalSize);
6446 	ptr = buf;
6447 	int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4;
6448 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6449 
6450 		memcpy(ptr, &index, 4); ptr += 4;
6451 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
6452 	memcpy(ptr, v, __size_v);ptr += __size_v;
6453 
6454 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6455 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6456 
6457 }
6458 
glVertexAttribI4uiv_enc(void * self,GLuint index,const GLuint * v)6459 void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v)
6460 {
6461 
6462 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6463 	IOStream *stream = ctx->m_stream;
6464 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6465 	bool useChecksum = checksumCalculator->getVersion() > 0;
6466 
6467 	const unsigned int __size_v =  (4 * sizeof(GLuint));
6468 	 unsigned char *ptr;
6469 	 unsigned char *buf;
6470 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6471 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6472 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6473 	buf = stream->alloc(totalSize);
6474 	ptr = buf;
6475 	int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6476 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6477 
6478 		memcpy(ptr, &index, 4); ptr += 4;
6479 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
6480 	memcpy(ptr, v, __size_v);ptr += __size_v;
6481 
6482 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6483 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6484 
6485 }
6486 
glVertexAttribIPointerOffsetAEMU_enc(void * self,GLuint index,GLint size,GLenum type,GLsizei stride,GLuint offset)6487 void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset)
6488 {
6489 
6490 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6491 	IOStream *stream = ctx->m_stream;
6492 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6493 	bool useChecksum = checksumCalculator->getVersion() > 0;
6494 
6495 	 unsigned char *ptr;
6496 	 unsigned char *buf;
6497 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6498 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6499 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6500 	buf = stream->alloc(totalSize);
6501 	ptr = buf;
6502 	int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6503 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6504 
6505 		memcpy(ptr, &index, 4); ptr += 4;
6506 		memcpy(ptr, &size, 4); ptr += 4;
6507 		memcpy(ptr, &type, 4); ptr += 4;
6508 		memcpy(ptr, &stride, 4); ptr += 4;
6509 		memcpy(ptr, &offset, 4); ptr += 4;
6510 
6511 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6512 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6513 
6514 }
6515 
glVertexAttribIPointerDataAEMU_enc(void * self,GLuint index,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)6516 void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
6517 {
6518 
6519 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6520 	IOStream *stream = ctx->m_stream;
6521 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6522 	bool useChecksum = checksumCalculator->getVersion() > 0;
6523 
6524 	const unsigned int __size_data =  datalen;
6525 	 unsigned char *ptr;
6526 	 unsigned char *buf;
6527 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
6528 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6529 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6530 	buf = stream->alloc(totalSize);
6531 	ptr = buf;
6532 	int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6533 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6534 
6535 		memcpy(ptr, &index, 4); ptr += 4;
6536 		memcpy(ptr, &size, 4); ptr += 4;
6537 		memcpy(ptr, &type, 4); ptr += 4;
6538 		memcpy(ptr, &stride, 4); ptr += 4;
6539 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
6540 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
6541 		memcpy(ptr, &datalen, 4); ptr += 4;
6542 
6543 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6544 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6545 
6546 }
6547 
glGetVertexAttribIiv_enc(void * self,GLuint index,GLenum pname,GLint * params)6548 void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
6549 {
6550 
6551 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6552 	IOStream *stream = ctx->m_stream;
6553 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6554 	bool useChecksum = checksumCalculator->getVersion() > 0;
6555 
6556 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
6557 	 unsigned char *ptr;
6558 	 unsigned char *buf;
6559 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6560 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6561 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6562 	buf = stream->alloc(totalSize);
6563 	ptr = buf;
6564 	int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4;
6565 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6566 
6567 		memcpy(ptr, &index, 4); ptr += 4;
6568 		memcpy(ptr, &pname, 4); ptr += 4;
6569 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6570 
6571 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6572 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6573 
6574 	stream->readback(params, __size_params);
6575 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6576 	if (useChecksum) {
6577 		unsigned char *checksumBufPtr = NULL;
6578 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6579 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6580 		stream->readback(checksumBufPtr, checksumSize);
6581 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6582 			ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n");
6583 			abort();
6584 		}
6585 	}
6586 }
6587 
glGetVertexAttribIuiv_enc(void * self,GLuint index,GLenum pname,GLuint * params)6588 void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params)
6589 {
6590 
6591 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6592 	IOStream *stream = ctx->m_stream;
6593 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6594 	bool useChecksum = checksumCalculator->getVersion() > 0;
6595 
6596 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLuint));
6597 	 unsigned char *ptr;
6598 	 unsigned char *buf;
6599 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6600 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6601 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6602 	buf = stream->alloc(totalSize);
6603 	ptr = buf;
6604 	int tmp = OP_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6605 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6606 
6607 		memcpy(ptr, &index, 4); ptr += 4;
6608 		memcpy(ptr, &pname, 4); ptr += 4;
6609 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6610 
6611 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6612 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6613 
6614 	stream->readback(params, __size_params);
6615 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6616 	if (useChecksum) {
6617 		unsigned char *checksumBufPtr = NULL;
6618 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6619 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6620 		stream->readback(checksumBufPtr, checksumSize);
6621 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6622 			ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n");
6623 			abort();
6624 		}
6625 	}
6626 }
6627 
glVertexAttribDivisor_enc(void * self,GLuint index,GLuint divisor)6628 void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor)
6629 {
6630 
6631 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6632 	IOStream *stream = ctx->m_stream;
6633 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6634 	bool useChecksum = checksumCalculator->getVersion() > 0;
6635 
6636 	 unsigned char *ptr;
6637 	 unsigned char *buf;
6638 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6639 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6640 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6641 	buf = stream->alloc(totalSize);
6642 	ptr = buf;
6643 	int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
6644 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6645 
6646 		memcpy(ptr, &index, 4); ptr += 4;
6647 		memcpy(ptr, &divisor, 4); ptr += 4;
6648 
6649 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6650 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6651 
6652 }
6653 
glDrawArraysInstanced_enc(void * self,GLenum mode,GLint first,GLsizei count,GLsizei primcount)6654 void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount)
6655 {
6656 
6657 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6658 	IOStream *stream = ctx->m_stream;
6659 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6660 	bool useChecksum = checksumCalculator->getVersion() > 0;
6661 
6662 	 unsigned char *ptr;
6663 	 unsigned char *buf;
6664 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6665 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6666 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6667 	buf = stream->alloc(totalSize);
6668 	ptr = buf;
6669 	int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4;
6670 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6671 
6672 		memcpy(ptr, &mode, 4); ptr += 4;
6673 		memcpy(ptr, &first, 4); ptr += 4;
6674 		memcpy(ptr, &count, 4); ptr += 4;
6675 		memcpy(ptr, &primcount, 4); ptr += 4;
6676 
6677 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6678 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6679 
6680 }
6681 
glDrawElementsInstancedDataAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,const void * indices,GLsizei primcount,GLsizei datalen)6682 void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen)
6683 {
6684 
6685 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6686 	IOStream *stream = ctx->m_stream;
6687 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6688 	bool useChecksum = checksumCalculator->getVersion() > 0;
6689 
6690 	const unsigned int __size_indices =  datalen;
6691 	 unsigned char *ptr;
6692 	 unsigned char *buf;
6693 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4;
6694 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6695 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6696 	buf = stream->alloc(totalSize);
6697 	ptr = buf;
6698 	int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6699 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6700 
6701 		memcpy(ptr, &mode, 4); ptr += 4;
6702 		memcpy(ptr, &count, 4); ptr += 4;
6703 		memcpy(ptr, &type, 4); ptr += 4;
6704 	*(unsigned int *)(ptr) = __size_indices; ptr += 4;
6705 	memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6706 		memcpy(ptr, &primcount, 4); ptr += 4;
6707 		memcpy(ptr, &datalen, 4); ptr += 4;
6708 
6709 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6710 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6711 
6712 }
6713 
glDrawElementsInstancedOffsetAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset,GLsizei primcount)6714 void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount)
6715 {
6716 
6717 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6718 	IOStream *stream = ctx->m_stream;
6719 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6720 	bool useChecksum = checksumCalculator->getVersion() > 0;
6721 
6722 	 unsigned char *ptr;
6723 	 unsigned char *buf;
6724 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6725 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6726 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6727 	buf = stream->alloc(totalSize);
6728 	ptr = buf;
6729 	int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6730 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6731 
6732 		memcpy(ptr, &mode, 4); ptr += 4;
6733 		memcpy(ptr, &count, 4); ptr += 4;
6734 		memcpy(ptr, &type, 4); ptr += 4;
6735 		memcpy(ptr, &offset, 4); ptr += 4;
6736 		memcpy(ptr, &primcount, 4); ptr += 4;
6737 
6738 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6739 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6740 
6741 }
6742 
glDrawRangeElementsDataAEMU_enc(void * self,GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,const GLvoid * indices,GLsizei datalen)6743 void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen)
6744 {
6745 
6746 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6747 	IOStream *stream = ctx->m_stream;
6748 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6749 	bool useChecksum = checksumCalculator->getVersion() > 0;
6750 
6751 	const unsigned int __size_indices =  datalen;
6752 	 unsigned char *ptr;
6753 	 unsigned char *buf;
6754 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4;
6755 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6756 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6757 	buf = stream->alloc(totalSize);
6758 	ptr = buf;
6759 	int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6760 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6761 
6762 		memcpy(ptr, &mode, 4); ptr += 4;
6763 		memcpy(ptr, &start, 4); ptr += 4;
6764 		memcpy(ptr, &end, 4); ptr += 4;
6765 		memcpy(ptr, &count, 4); ptr += 4;
6766 		memcpy(ptr, &type, 4); ptr += 4;
6767 	*(unsigned int *)(ptr) = __size_indices; ptr += 4;
6768 	memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6769 		memcpy(ptr, &datalen, 4); ptr += 4;
6770 
6771 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6772 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6773 
6774 }
6775 
glDrawRangeElementsOffsetAEMU_enc(void * self,GLenum mode,GLuint start,GLuint end,GLsizei count,GLenum type,GLuint offset)6776 void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset)
6777 {
6778 
6779 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6780 	IOStream *stream = ctx->m_stream;
6781 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6782 	bool useChecksum = checksumCalculator->getVersion() > 0;
6783 
6784 	 unsigned char *ptr;
6785 	 unsigned char *buf;
6786 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6787 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6788 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6789 	buf = stream->alloc(totalSize);
6790 	ptr = buf;
6791 	int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6792 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6793 
6794 		memcpy(ptr, &mode, 4); ptr += 4;
6795 		memcpy(ptr, &start, 4); ptr += 4;
6796 		memcpy(ptr, &end, 4); ptr += 4;
6797 		memcpy(ptr, &count, 4); ptr += 4;
6798 		memcpy(ptr, &type, 4); ptr += 4;
6799 		memcpy(ptr, &offset, 4); ptr += 4;
6800 
6801 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6802 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6803 
6804 }
6805 
glFenceSyncAEMU_enc(void * self,GLenum condition,GLbitfield flags)6806 uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
6807 {
6808 
6809 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6810 	IOStream *stream = ctx->m_stream;
6811 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6812 	bool useChecksum = checksumCalculator->getVersion() > 0;
6813 
6814 	 unsigned char *ptr;
6815 	 unsigned char *buf;
6816 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6817 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6818 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6819 	buf = stream->alloc(totalSize);
6820 	ptr = buf;
6821 	int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6822 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6823 
6824 		memcpy(ptr, &condition, 4); ptr += 4;
6825 		memcpy(ptr, &flags, 4); ptr += 4;
6826 
6827 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6828 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6829 
6830 
6831 	uint64_t retval;
6832 	stream->readback(&retval, 8);
6833 	if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
6834 	if (useChecksum) {
6835 		unsigned char *checksumBufPtr = NULL;
6836 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6837 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6838 		stream->readback(checksumBufPtr, checksumSize);
6839 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6840 			ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6841 			abort();
6842 		}
6843 	}
6844 	return retval;
6845 }
6846 
glClientWaitSyncAEMU_enc(void * self,uint64_t wait_on,GLbitfield flags,GLuint64 timeout)6847 GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
6848 {
6849 
6850 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6851 	IOStream *stream = ctx->m_stream;
6852 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6853 	bool useChecksum = checksumCalculator->getVersion() > 0;
6854 
6855 	 unsigned char *ptr;
6856 	 unsigned char *buf;
6857 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6858 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6859 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6860 	buf = stream->alloc(totalSize);
6861 	ptr = buf;
6862 	int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6863 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6864 
6865 		memcpy(ptr, &wait_on, 8); ptr += 8;
6866 		memcpy(ptr, &flags, 4); ptr += 4;
6867 		memcpy(ptr, &timeout, 8); ptr += 8;
6868 
6869 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6870 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6871 
6872 
6873 	GLenum retval;
6874 	stream->readback(&retval, 4);
6875 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6876 	if (useChecksum) {
6877 		unsigned char *checksumBufPtr = NULL;
6878 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6879 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6880 		stream->readback(checksumBufPtr, checksumSize);
6881 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6882 			ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6883 			abort();
6884 		}
6885 	}
6886 	return retval;
6887 }
6888 
glWaitSyncAEMU_enc(void * self,uint64_t wait_on,GLbitfield flags,GLuint64 timeout)6889 void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
6890 {
6891 
6892 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6893 	IOStream *stream = ctx->m_stream;
6894 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6895 	bool useChecksum = checksumCalculator->getVersion() > 0;
6896 
6897 	 unsigned char *ptr;
6898 	 unsigned char *buf;
6899 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6900 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6901 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6902 	buf = stream->alloc(totalSize);
6903 	ptr = buf;
6904 	int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6905 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6906 
6907 		memcpy(ptr, &wait_on, 8); ptr += 8;
6908 		memcpy(ptr, &flags, 4); ptr += 4;
6909 		memcpy(ptr, &timeout, 8); ptr += 8;
6910 
6911 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6912 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6913 
6914 }
6915 
glDeleteSyncAEMU_enc(void * self,uint64_t to_delete)6916 void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
6917 {
6918 
6919 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6920 	IOStream *stream = ctx->m_stream;
6921 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6922 	bool useChecksum = checksumCalculator->getVersion() > 0;
6923 
6924 	 unsigned char *ptr;
6925 	 unsigned char *buf;
6926 	 const size_t sizeWithoutChecksum = 8 + 8;
6927 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6928 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6929 	buf = stream->alloc(totalSize);
6930 	ptr = buf;
6931 	int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6932 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6933 
6934 		memcpy(ptr, &to_delete, 8); ptr += 8;
6935 
6936 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6937 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6938 
6939 }
6940 
glIsSyncAEMU_enc(void * self,uint64_t sync)6941 GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
6942 {
6943 
6944 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6945 	IOStream *stream = ctx->m_stream;
6946 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6947 	bool useChecksum = checksumCalculator->getVersion() > 0;
6948 
6949 	 unsigned char *ptr;
6950 	 unsigned char *buf;
6951 	 const size_t sizeWithoutChecksum = 8 + 8;
6952 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6953 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6954 	buf = stream->alloc(totalSize);
6955 	ptr = buf;
6956 	int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6957 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6958 
6959 		memcpy(ptr, &sync, 8); ptr += 8;
6960 
6961 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6962 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6963 
6964 
6965 	GLboolean retval;
6966 	stream->readback(&retval, 1);
6967 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6968 	if (useChecksum) {
6969 		unsigned char *checksumBufPtr = NULL;
6970 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6971 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6972 		stream->readback(checksumBufPtr, checksumSize);
6973 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6974 			ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
6975 			abort();
6976 		}
6977 	}
6978 	return retval;
6979 }
6980 
glGetSyncivAEMU_enc(void * self,uint64_t sync,GLenum pname,GLsizei bufSize,GLsizei * length,GLint * values)6981 void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
6982 {
6983 
6984 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6985 	IOStream *stream = ctx->m_stream;
6986 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6987 	bool useChecksum = checksumCalculator->getVersion() > 0;
6988 
6989 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
6990 	const unsigned int __size_values =  (bufSize * sizeof(GLint));
6991 	 unsigned char *ptr;
6992 	 unsigned char *buf;
6993 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4;
6994 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6995 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6996 	buf = stream->alloc(totalSize);
6997 	ptr = buf;
6998 	int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6999 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7000 
7001 		memcpy(ptr, &sync, 8); ptr += 8;
7002 		memcpy(ptr, &pname, 4); ptr += 4;
7003 		memcpy(ptr, &bufSize, 4); ptr += 4;
7004 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
7005 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
7006 
7007 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7008 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7009 
7010 	if (length != NULL) {
7011 		stream->readback(length, __size_length);
7012 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7013 	}
7014 	stream->readback(values, __size_values);
7015 	if (useChecksum) checksumCalculator->addBuffer(values, __size_values);
7016 	if (useChecksum) {
7017 		unsigned char *checksumBufPtr = NULL;
7018 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7019 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7020 		stream->readback(checksumBufPtr, checksumSize);
7021 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7022 			ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
7023 			abort();
7024 		}
7025 	}
7026 }
7027 
glDrawBuffers_enc(void * self,GLsizei n,const GLenum * bufs)7028 void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs)
7029 {
7030 
7031 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7032 	IOStream *stream = ctx->m_stream;
7033 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7034 	bool useChecksum = checksumCalculator->getVersion() > 0;
7035 
7036 	const unsigned int __size_bufs =  (n * sizeof(GLenum));
7037 	 unsigned char *ptr;
7038 	 unsigned char *buf;
7039 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4;
7040 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7041 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7042 	buf = stream->alloc(totalSize);
7043 	ptr = buf;
7044 	int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
7045 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7046 
7047 		memcpy(ptr, &n, 4); ptr += 4;
7048 	*(unsigned int *)(ptr) = __size_bufs; ptr += 4;
7049 	memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs;
7050 
7051 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7052 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7053 
7054 }
7055 
glReadBuffer_enc(void * self,GLenum src)7056 void glReadBuffer_enc(void *self , GLenum src)
7057 {
7058 
7059 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7060 	IOStream *stream = ctx->m_stream;
7061 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7062 	bool useChecksum = checksumCalculator->getVersion() > 0;
7063 
7064 	 unsigned char *ptr;
7065 	 unsigned char *buf;
7066 	 const size_t sizeWithoutChecksum = 8 + 4;
7067 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7068 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7069 	buf = stream->alloc(totalSize);
7070 	ptr = buf;
7071 	int tmp = OP_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7072 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7073 
7074 		memcpy(ptr, &src, 4); ptr += 4;
7075 
7076 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7077 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7078 
7079 }
7080 
glBlitFramebuffer_enc(void * self,GLint srcX0,GLint srcY0,GLint srcX1,GLint srcY1,GLint dstX0,GLint dstY0,GLint dstX1,GLint dstY1,GLbitfield mask,GLenum filter)7081 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)
7082 {
7083 
7084 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7085 	IOStream *stream = ctx->m_stream;
7086 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7087 	bool useChecksum = checksumCalculator->getVersion() > 0;
7088 
7089 	 unsigned char *ptr;
7090 	 unsigned char *buf;
7091 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
7092 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7093 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7094 	buf = stream->alloc(totalSize);
7095 	ptr = buf;
7096 	int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7097 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7098 
7099 		memcpy(ptr, &srcX0, 4); ptr += 4;
7100 		memcpy(ptr, &srcY0, 4); ptr += 4;
7101 		memcpy(ptr, &srcX1, 4); ptr += 4;
7102 		memcpy(ptr, &srcY1, 4); ptr += 4;
7103 		memcpy(ptr, &dstX0, 4); ptr += 4;
7104 		memcpy(ptr, &dstY0, 4); ptr += 4;
7105 		memcpy(ptr, &dstX1, 4); ptr += 4;
7106 		memcpy(ptr, &dstY1, 4); ptr += 4;
7107 		memcpy(ptr, &mask, 4); ptr += 4;
7108 		memcpy(ptr, &filter, 4); ptr += 4;
7109 
7110 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7111 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7112 
7113 }
7114 
glInvalidateFramebuffer_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments)7115 void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
7116 {
7117 
7118 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7119 	IOStream *stream = ctx->m_stream;
7120 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7121 	bool useChecksum = checksumCalculator->getVersion() > 0;
7122 
7123 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
7124 	 unsigned char *ptr;
7125 	 unsigned char *buf;
7126 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
7127 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7128 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7129 	buf = stream->alloc(totalSize);
7130 	ptr = buf;
7131 	int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7132 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7133 
7134 		memcpy(ptr, &target, 4); ptr += 4;
7135 		memcpy(ptr, &numAttachments, 4); ptr += 4;
7136 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7137 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7138 
7139 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7140 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7141 
7142 }
7143 
glInvalidateSubFramebuffer_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments,GLint x,GLint y,GLsizei width,GLsizei height)7144 void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
7145 {
7146 
7147 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7148 	IOStream *stream = ctx->m_stream;
7149 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7150 	bool useChecksum = checksumCalculator->getVersion() > 0;
7151 
7152 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
7153 	 unsigned char *ptr;
7154 	 unsigned char *buf;
7155 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4;
7156 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7157 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7158 	buf = stream->alloc(totalSize);
7159 	ptr = buf;
7160 	int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7161 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7162 
7163 		memcpy(ptr, &target, 4); ptr += 4;
7164 		memcpy(ptr, &numAttachments, 4); ptr += 4;
7165 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7166 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7167 		memcpy(ptr, &x, 4); ptr += 4;
7168 		memcpy(ptr, &y, 4); ptr += 4;
7169 		memcpy(ptr, &width, 4); ptr += 4;
7170 		memcpy(ptr, &height, 4); ptr += 4;
7171 
7172 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7173 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7174 
7175 }
7176 
glFramebufferTextureLayer_enc(void * self,GLenum target,GLenum attachment,GLuint texture,GLint level,GLint layer)7177 void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
7178 {
7179 
7180 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7181 	IOStream *stream = ctx->m_stream;
7182 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7183 	bool useChecksum = checksumCalculator->getVersion() > 0;
7184 
7185 	 unsigned char *ptr;
7186 	 unsigned char *buf;
7187 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7188 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7189 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7190 	buf = stream->alloc(totalSize);
7191 	ptr = buf;
7192 	int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4;
7193 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7194 
7195 		memcpy(ptr, &target, 4); ptr += 4;
7196 		memcpy(ptr, &attachment, 4); ptr += 4;
7197 		memcpy(ptr, &texture, 4); ptr += 4;
7198 		memcpy(ptr, &level, 4); ptr += 4;
7199 		memcpy(ptr, &layer, 4); ptr += 4;
7200 
7201 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7202 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7203 
7204 }
7205 
glRenderbufferStorageMultisample_enc(void * self,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)7206 void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
7207 {
7208 
7209 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7210 	IOStream *stream = ctx->m_stream;
7211 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7212 	bool useChecksum = checksumCalculator->getVersion() > 0;
7213 
7214 	 unsigned char *ptr;
7215 	 unsigned char *buf;
7216 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7217 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7218 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7219 	buf = stream->alloc(totalSize);
7220 	ptr = buf;
7221 	int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
7222 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7223 
7224 		memcpy(ptr, &target, 4); ptr += 4;
7225 		memcpy(ptr, &samples, 4); ptr += 4;
7226 		memcpy(ptr, &internalformat, 4); ptr += 4;
7227 		memcpy(ptr, &width, 4); ptr += 4;
7228 		memcpy(ptr, &height, 4); ptr += 4;
7229 
7230 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7231 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7232 
7233 }
7234 
glTexStorage2D_enc(void * self,GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height)7235 void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
7236 {
7237 
7238 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7239 	IOStream *stream = ctx->m_stream;
7240 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7241 	bool useChecksum = checksumCalculator->getVersion() > 0;
7242 
7243 	 unsigned char *ptr;
7244 	 unsigned char *buf;
7245 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7246 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7247 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7248 	buf = stream->alloc(totalSize);
7249 	ptr = buf;
7250 	int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4;
7251 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7252 
7253 		memcpy(ptr, &target, 4); ptr += 4;
7254 		memcpy(ptr, &levels, 4); ptr += 4;
7255 		memcpy(ptr, &internalformat, 4); ptr += 4;
7256 		memcpy(ptr, &width, 4); ptr += 4;
7257 		memcpy(ptr, &height, 4); ptr += 4;
7258 
7259 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7260 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7261 
7262 }
7263 
glGetInternalformativ_enc(void * self,GLenum target,GLenum internalformat,GLenum pname,GLsizei bufSize,GLint * params)7264 void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
7265 {
7266 
7267 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7268 	IOStream *stream = ctx->m_stream;
7269 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7270 	bool useChecksum = checksumCalculator->getVersion() > 0;
7271 
7272 	const unsigned int __size_params =  (sizeof(GLint) * bufSize);
7273 	 unsigned char *ptr;
7274 	 unsigned char *buf;
7275 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
7276 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7277 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7278 	buf = stream->alloc(totalSize);
7279 	ptr = buf;
7280 	int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4;
7281 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7282 
7283 		memcpy(ptr, &target, 4); ptr += 4;
7284 		memcpy(ptr, &internalformat, 4); ptr += 4;
7285 		memcpy(ptr, &pname, 4); ptr += 4;
7286 		memcpy(ptr, &bufSize, 4); ptr += 4;
7287 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7288 
7289 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7290 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7291 
7292 	stream->readback(params, __size_params);
7293 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7294 	if (useChecksum) {
7295 		unsigned char *checksumBufPtr = NULL;
7296 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7297 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7298 		stream->readback(checksumBufPtr, checksumSize);
7299 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7300 			ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n");
7301 			abort();
7302 		}
7303 	}
7304 }
7305 
glBeginTransformFeedback_enc(void * self,GLenum primitiveMode)7306 void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode)
7307 {
7308 
7309 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7310 	IOStream *stream = ctx->m_stream;
7311 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7312 	bool useChecksum = checksumCalculator->getVersion() > 0;
7313 
7314 	 unsigned char *ptr;
7315 	 unsigned char *buf;
7316 	 const size_t sizeWithoutChecksum = 8 + 4;
7317 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7318 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7319 	buf = stream->alloc(totalSize);
7320 	ptr = buf;
7321 	int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7322 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7323 
7324 		memcpy(ptr, &primitiveMode, 4); ptr += 4;
7325 
7326 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7327 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7328 
7329 }
7330 
glEndTransformFeedback_enc(void * self)7331 void glEndTransformFeedback_enc(void *self )
7332 {
7333 
7334 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7335 	IOStream *stream = ctx->m_stream;
7336 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7337 	bool useChecksum = checksumCalculator->getVersion() > 0;
7338 
7339 	 unsigned char *ptr;
7340 	 unsigned char *buf;
7341 	 const size_t sizeWithoutChecksum = 8;
7342 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7343 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7344 	buf = stream->alloc(totalSize);
7345 	ptr = buf;
7346 	int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7347 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7348 
7349 
7350 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7351 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7352 
7353 }
7354 
glGenTransformFeedbacks_enc(void * self,GLsizei n,GLuint * ids)7355 void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids)
7356 {
7357 
7358 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7359 	IOStream *stream = ctx->m_stream;
7360 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7361 	bool useChecksum = checksumCalculator->getVersion() > 0;
7362 
7363 	const unsigned int __size_ids =  (n * sizeof(GLuint));
7364 	 unsigned char *ptr;
7365 	 unsigned char *buf;
7366 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7367 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7368 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7369 	buf = stream->alloc(totalSize);
7370 	ptr = buf;
7371 	int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7372 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7373 
7374 		memcpy(ptr, &n, 4); ptr += 4;
7375 	*(unsigned int *)(ptr) = __size_ids; ptr += 4;
7376 
7377 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7378 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7379 
7380 	stream->readback(ids, __size_ids);
7381 	if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids);
7382 	if (useChecksum) {
7383 		unsigned char *checksumBufPtr = NULL;
7384 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7385 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7386 		stream->readback(checksumBufPtr, checksumSize);
7387 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7388 			ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n");
7389 			abort();
7390 		}
7391 	}
7392 }
7393 
glDeleteTransformFeedbacks_enc(void * self,GLsizei n,const GLuint * ids)7394 void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids)
7395 {
7396 
7397 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7398 	IOStream *stream = ctx->m_stream;
7399 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7400 	bool useChecksum = checksumCalculator->getVersion() > 0;
7401 
7402 	const unsigned int __size_ids =  (n * sizeof(GLuint));
7403 	 unsigned char *ptr;
7404 	 unsigned char *buf;
7405 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4;
7406 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7407 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7408 	buf = stream->alloc(totalSize);
7409 	ptr = buf;
7410 	int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7411 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7412 
7413 		memcpy(ptr, &n, 4); ptr += 4;
7414 	*(unsigned int *)(ptr) = __size_ids; ptr += 4;
7415 	memcpy(ptr, ids, __size_ids);ptr += __size_ids;
7416 
7417 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7418 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7419 
7420 }
7421 
glBindTransformFeedback_enc(void * self,GLenum target,GLuint id)7422 void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id)
7423 {
7424 
7425 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7426 	IOStream *stream = ctx->m_stream;
7427 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7428 	bool useChecksum = checksumCalculator->getVersion() > 0;
7429 
7430 	 unsigned char *ptr;
7431 	 unsigned char *buf;
7432 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7433 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7434 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7435 	buf = stream->alloc(totalSize);
7436 	ptr = buf;
7437 	int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7438 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7439 
7440 		memcpy(ptr, &target, 4); ptr += 4;
7441 		memcpy(ptr, &id, 4); ptr += 4;
7442 
7443 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7444 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7445 
7446 }
7447 
glPauseTransformFeedback_enc(void * self)7448 void glPauseTransformFeedback_enc(void *self )
7449 {
7450 
7451 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7452 	IOStream *stream = ctx->m_stream;
7453 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7454 	bool useChecksum = checksumCalculator->getVersion() > 0;
7455 
7456 	 unsigned char *ptr;
7457 	 unsigned char *buf;
7458 	 const size_t sizeWithoutChecksum = 8;
7459 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7460 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7461 	buf = stream->alloc(totalSize);
7462 	ptr = buf;
7463 	int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7464 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7465 
7466 
7467 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7468 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7469 
7470 }
7471 
glResumeTransformFeedback_enc(void * self)7472 void glResumeTransformFeedback_enc(void *self )
7473 {
7474 
7475 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7476 	IOStream *stream = ctx->m_stream;
7477 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7478 	bool useChecksum = checksumCalculator->getVersion() > 0;
7479 
7480 	 unsigned char *ptr;
7481 	 unsigned char *buf;
7482 	 const size_t sizeWithoutChecksum = 8;
7483 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7484 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7485 	buf = stream->alloc(totalSize);
7486 	ptr = buf;
7487 	int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7488 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7489 
7490 
7491 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7492 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7493 
7494 }
7495 
glIsTransformFeedback_enc(void * self,GLuint id)7496 GLboolean glIsTransformFeedback_enc(void *self , GLuint id)
7497 {
7498 
7499 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7500 	IOStream *stream = ctx->m_stream;
7501 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7502 	bool useChecksum = checksumCalculator->getVersion() > 0;
7503 
7504 	 unsigned char *ptr;
7505 	 unsigned char *buf;
7506 	 const size_t sizeWithoutChecksum = 8 + 4;
7507 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7508 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7509 	buf = stream->alloc(totalSize);
7510 	ptr = buf;
7511 	int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7512 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7513 
7514 		memcpy(ptr, &id, 4); ptr += 4;
7515 
7516 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7517 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7518 
7519 
7520 	GLboolean retval;
7521 	stream->readback(&retval, 1);
7522 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7523 	if (useChecksum) {
7524 		unsigned char *checksumBufPtr = NULL;
7525 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7526 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7527 		stream->readback(checksumBufPtr, checksumSize);
7528 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7529 			ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n");
7530 			abort();
7531 		}
7532 	}
7533 	return retval;
7534 }
7535 
glTransformFeedbackVaryingsAEMU_enc(void * self,GLuint program,GLsizei count,const char * packedVaryings,GLuint packedVaryingsLen,GLenum bufferMode)7536 void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode)
7537 {
7538 
7539 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7540 	IOStream *stream = ctx->m_stream;
7541 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7542 	bool useChecksum = checksumCalculator->getVersion() > 0;
7543 
7544 	const unsigned int __size_packedVaryings =  packedVaryingsLen;
7545 	 unsigned char *ptr;
7546 	 unsigned char *buf;
7547 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4;
7548 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7549 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7550 	buf = stream->alloc(totalSize);
7551 	ptr = buf;
7552 	int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
7553 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7554 
7555 		memcpy(ptr, &program, 4); ptr += 4;
7556 		memcpy(ptr, &count, 4); ptr += 4;
7557 	*(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4;
7558 	memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings;
7559 		memcpy(ptr, &packedVaryingsLen, 4); ptr += 4;
7560 		memcpy(ptr, &bufferMode, 4); ptr += 4;
7561 
7562 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7563 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7564 
7565 }
7566 
glGetTransformFeedbackVarying_enc(void * self,GLuint program,GLuint index,GLsizei bufSize,GLsizei * length,GLsizei * size,GLenum * type,char * name)7567 void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name)
7568 {
7569 
7570 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7571 	IOStream *stream = ctx->m_stream;
7572 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7573 	bool useChecksum = checksumCalculator->getVersion() > 0;
7574 
7575 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
7576 	const unsigned int __size_size =  (sizeof(GLsizei));
7577 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
7578 	const unsigned int __size_name = ((name != NULL) ?  bufSize : 0);
7579 	 unsigned char *ptr;
7580 	 unsigned char *buf;
7581 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
7582 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7583 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7584 	buf = stream->alloc(totalSize);
7585 	ptr = buf;
7586 	int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4;
7587 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7588 
7589 		memcpy(ptr, &program, 4); ptr += 4;
7590 		memcpy(ptr, &index, 4); ptr += 4;
7591 		memcpy(ptr, &bufSize, 4); ptr += 4;
7592 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
7593 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
7594 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
7595 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
7596 
7597 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7598 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7599 
7600 	if (length != NULL) {
7601 		stream->readback(length, __size_length);
7602 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7603 	}
7604 	stream->readback(size, __size_size);
7605 	if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
7606 	if (type != NULL) {
7607 		stream->readback(type, __size_type);
7608 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
7609 	}
7610 	if (name != NULL) {
7611 		stream->readback(name, __size_name);
7612 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
7613 	}
7614 	if (useChecksum) {
7615 		unsigned char *checksumBufPtr = NULL;
7616 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7617 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7618 		stream->readback(checksumBufPtr, checksumSize);
7619 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7620 			ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n");
7621 			abort();
7622 		}
7623 	}
7624 }
7625 
glGenSamplers_enc(void * self,GLsizei n,GLuint * samplers)7626 void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers)
7627 {
7628 
7629 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7630 	IOStream *stream = ctx->m_stream;
7631 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7632 	bool useChecksum = checksumCalculator->getVersion() > 0;
7633 
7634 	const unsigned int __size_samplers =  (n * sizeof(GLuint));
7635 	 unsigned char *ptr;
7636 	 unsigned char *buf;
7637 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7638 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7639 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7640 	buf = stream->alloc(totalSize);
7641 	ptr = buf;
7642 	int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7643 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7644 
7645 		memcpy(ptr, &n, 4); ptr += 4;
7646 	*(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7647 
7648 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7649 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7650 
7651 	stream->readback(samplers, __size_samplers);
7652 	if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers);
7653 	if (useChecksum) {
7654 		unsigned char *checksumBufPtr = NULL;
7655 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7656 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7657 		stream->readback(checksumBufPtr, checksumSize);
7658 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7659 			ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n");
7660 			abort();
7661 		}
7662 	}
7663 }
7664 
glDeleteSamplers_enc(void * self,GLsizei n,const GLuint * samplers)7665 void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers)
7666 {
7667 
7668 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7669 	IOStream *stream = ctx->m_stream;
7670 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7671 	bool useChecksum = checksumCalculator->getVersion() > 0;
7672 
7673 	const unsigned int __size_samplers =  (n * sizeof(GLuint));
7674 	 unsigned char *ptr;
7675 	 unsigned char *buf;
7676 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4;
7677 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7678 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7679 	buf = stream->alloc(totalSize);
7680 	ptr = buf;
7681 	int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7682 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7683 
7684 		memcpy(ptr, &n, 4); ptr += 4;
7685 	*(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7686 	memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers;
7687 
7688 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7689 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7690 
7691 }
7692 
glBindSampler_enc(void * self,GLuint unit,GLuint sampler)7693 void glBindSampler_enc(void *self , GLuint unit, GLuint sampler)
7694 {
7695 
7696 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7697 	IOStream *stream = ctx->m_stream;
7698 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7699 	bool useChecksum = checksumCalculator->getVersion() > 0;
7700 
7701 	 unsigned char *ptr;
7702 	 unsigned char *buf;
7703 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7704 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7705 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7706 	buf = stream->alloc(totalSize);
7707 	ptr = buf;
7708 	int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7709 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7710 
7711 		memcpy(ptr, &unit, 4); ptr += 4;
7712 		memcpy(ptr, &sampler, 4); ptr += 4;
7713 
7714 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7715 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7716 
7717 }
7718 
glSamplerParameterf_enc(void * self,GLuint sampler,GLenum pname,GLfloat param)7719 void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param)
7720 {
7721 
7722 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7723 	IOStream *stream = ctx->m_stream;
7724 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7725 	bool useChecksum = checksumCalculator->getVersion() > 0;
7726 
7727 	 unsigned char *ptr;
7728 	 unsigned char *buf;
7729 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7730 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7731 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7732 	buf = stream->alloc(totalSize);
7733 	ptr = buf;
7734 	int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
7735 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7736 
7737 		memcpy(ptr, &sampler, 4); ptr += 4;
7738 		memcpy(ptr, &pname, 4); ptr += 4;
7739 		memcpy(ptr, &param, 4); ptr += 4;
7740 
7741 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7742 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7743 
7744 }
7745 
glSamplerParameteri_enc(void * self,GLuint sampler,GLenum pname,GLint param)7746 void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param)
7747 {
7748 
7749 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7750 	IOStream *stream = ctx->m_stream;
7751 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7752 	bool useChecksum = checksumCalculator->getVersion() > 0;
7753 
7754 	 unsigned char *ptr;
7755 	 unsigned char *buf;
7756 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7757 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7758 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7759 	buf = stream->alloc(totalSize);
7760 	ptr = buf;
7761 	int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
7762 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7763 
7764 		memcpy(ptr, &sampler, 4); ptr += 4;
7765 		memcpy(ptr, &pname, 4); ptr += 4;
7766 		memcpy(ptr, &param, 4); ptr += 4;
7767 
7768 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7769 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7770 
7771 }
7772 
glSamplerParameterfv_enc(void * self,GLuint sampler,GLenum pname,const GLfloat * params)7773 void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params)
7774 {
7775 
7776 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7777 	IOStream *stream = ctx->m_stream;
7778 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7779 	bool useChecksum = checksumCalculator->getVersion() > 0;
7780 
7781 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
7782 	 unsigned char *ptr;
7783 	 unsigned char *buf;
7784 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7785 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7786 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7787 	buf = stream->alloc(totalSize);
7788 	ptr = buf;
7789 	int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7790 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7791 
7792 		memcpy(ptr, &sampler, 4); ptr += 4;
7793 		memcpy(ptr, &pname, 4); ptr += 4;
7794 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7795 	memcpy(ptr, params, __size_params);ptr += __size_params;
7796 
7797 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7798 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7799 
7800 }
7801 
glSamplerParameteriv_enc(void * self,GLuint sampler,GLenum pname,const GLint * params)7802 void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params)
7803 {
7804 
7805 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7806 	IOStream *stream = ctx->m_stream;
7807 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7808 	bool useChecksum = checksumCalculator->getVersion() > 0;
7809 
7810 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
7811 	 unsigned char *ptr;
7812 	 unsigned char *buf;
7813 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7814 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7815 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7816 	buf = stream->alloc(totalSize);
7817 	ptr = buf;
7818 	int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7819 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7820 
7821 		memcpy(ptr, &sampler, 4); ptr += 4;
7822 		memcpy(ptr, &pname, 4); ptr += 4;
7823 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7824 	memcpy(ptr, params, __size_params);ptr += __size_params;
7825 
7826 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7827 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7828 
7829 }
7830 
glGetSamplerParameterfv_enc(void * self,GLuint sampler,GLenum pname,GLfloat * params)7831 void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params)
7832 {
7833 
7834 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7835 	IOStream *stream = ctx->m_stream;
7836 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7837 	bool useChecksum = checksumCalculator->getVersion() > 0;
7838 
7839 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
7840 	 unsigned char *ptr;
7841 	 unsigned char *buf;
7842 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7843 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7844 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7845 	buf = stream->alloc(totalSize);
7846 	ptr = buf;
7847 	int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7848 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7849 
7850 		memcpy(ptr, &sampler, 4); ptr += 4;
7851 		memcpy(ptr, &pname, 4); ptr += 4;
7852 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7853 
7854 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7855 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7856 
7857 	stream->readback(params, __size_params);
7858 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7859 	if (useChecksum) {
7860 		unsigned char *checksumBufPtr = NULL;
7861 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7862 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7863 		stream->readback(checksumBufPtr, checksumSize);
7864 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7865 			ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n");
7866 			abort();
7867 		}
7868 	}
7869 }
7870 
glGetSamplerParameteriv_enc(void * self,GLuint sampler,GLenum pname,GLint * params)7871 void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params)
7872 {
7873 
7874 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7875 	IOStream *stream = ctx->m_stream;
7876 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7877 	bool useChecksum = checksumCalculator->getVersion() > 0;
7878 
7879 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
7880 	 unsigned char *ptr;
7881 	 unsigned char *buf;
7882 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7883 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7884 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7885 	buf = stream->alloc(totalSize);
7886 	ptr = buf;
7887 	int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7888 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7889 
7890 		memcpy(ptr, &sampler, 4); ptr += 4;
7891 		memcpy(ptr, &pname, 4); ptr += 4;
7892 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7893 
7894 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7895 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7896 
7897 	stream->readback(params, __size_params);
7898 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7899 	if (useChecksum) {
7900 		unsigned char *checksumBufPtr = NULL;
7901 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7902 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7903 		stream->readback(checksumBufPtr, checksumSize);
7904 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7905 			ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n");
7906 			abort();
7907 		}
7908 	}
7909 }
7910 
glIsSampler_enc(void * self,GLuint sampler)7911 GLboolean glIsSampler_enc(void *self , GLuint sampler)
7912 {
7913 
7914 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7915 	IOStream *stream = ctx->m_stream;
7916 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7917 	bool useChecksum = checksumCalculator->getVersion() > 0;
7918 
7919 	 unsigned char *ptr;
7920 	 unsigned char *buf;
7921 	 const size_t sizeWithoutChecksum = 8 + 4;
7922 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7923 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7924 	buf = stream->alloc(totalSize);
7925 	ptr = buf;
7926 	int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7927 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7928 
7929 		memcpy(ptr, &sampler, 4); ptr += 4;
7930 
7931 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7932 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7933 
7934 
7935 	GLboolean retval;
7936 	stream->readback(&retval, 1);
7937 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7938 	if (useChecksum) {
7939 		unsigned char *checksumBufPtr = NULL;
7940 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7941 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7942 		stream->readback(checksumBufPtr, checksumSize);
7943 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7944 			ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n");
7945 			abort();
7946 		}
7947 	}
7948 	return retval;
7949 }
7950 
glGenQueries_enc(void * self,GLsizei n,GLuint * queries)7951 void glGenQueries_enc(void *self , GLsizei n, GLuint* queries)
7952 {
7953 
7954 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7955 	IOStream *stream = ctx->m_stream;
7956 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7957 	bool useChecksum = checksumCalculator->getVersion() > 0;
7958 
7959 	const unsigned int __size_queries =  (n * sizeof(GLuint));
7960 	 unsigned char *ptr;
7961 	 unsigned char *buf;
7962 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7963 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7964 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7965 	buf = stream->alloc(totalSize);
7966 	ptr = buf;
7967 	int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4;
7968 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7969 
7970 		memcpy(ptr, &n, 4); ptr += 4;
7971 	*(unsigned int *)(ptr) = __size_queries; ptr += 4;
7972 
7973 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7974 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7975 
7976 	stream->readback(queries, __size_queries);
7977 	if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries);
7978 	if (useChecksum) {
7979 		unsigned char *checksumBufPtr = NULL;
7980 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7981 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7982 		stream->readback(checksumBufPtr, checksumSize);
7983 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7984 			ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n");
7985 			abort();
7986 		}
7987 	}
7988 }
7989 
glDeleteQueries_enc(void * self,GLsizei n,const GLuint * queries)7990 void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries)
7991 {
7992 
7993 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7994 	IOStream *stream = ctx->m_stream;
7995 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7996 	bool useChecksum = checksumCalculator->getVersion() > 0;
7997 
7998 	const unsigned int __size_queries =  (n * sizeof(GLuint));
7999 	 unsigned char *ptr;
8000 	 unsigned char *buf;
8001 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4;
8002 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8003 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8004 	buf = stream->alloc(totalSize);
8005 	ptr = buf;
8006 	int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4;
8007 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8008 
8009 		memcpy(ptr, &n, 4); ptr += 4;
8010 	*(unsigned int *)(ptr) = __size_queries; ptr += 4;
8011 	memcpy(ptr, queries, __size_queries);ptr += __size_queries;
8012 
8013 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8014 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8015 
8016 }
8017 
glBeginQuery_enc(void * self,GLenum target,GLuint query)8018 void glBeginQuery_enc(void *self , GLenum target, GLuint query)
8019 {
8020 
8021 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8022 	IOStream *stream = ctx->m_stream;
8023 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8024 	bool useChecksum = checksumCalculator->getVersion() > 0;
8025 
8026 	 unsigned char *ptr;
8027 	 unsigned char *buf;
8028 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
8029 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8030 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8031 	buf = stream->alloc(totalSize);
8032 	ptr = buf;
8033 	int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8034 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8035 
8036 		memcpy(ptr, &target, 4); ptr += 4;
8037 		memcpy(ptr, &query, 4); ptr += 4;
8038 
8039 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8040 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8041 
8042 }
8043 
glEndQuery_enc(void * self,GLenum target)8044 void glEndQuery_enc(void *self , GLenum target)
8045 {
8046 
8047 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8048 	IOStream *stream = ctx->m_stream;
8049 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8050 	bool useChecksum = checksumCalculator->getVersion() > 0;
8051 
8052 	 unsigned char *ptr;
8053 	 unsigned char *buf;
8054 	 const size_t sizeWithoutChecksum = 8 + 4;
8055 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8056 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8057 	buf = stream->alloc(totalSize);
8058 	ptr = buf;
8059 	int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8060 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8061 
8062 		memcpy(ptr, &target, 4); ptr += 4;
8063 
8064 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8065 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8066 
8067 }
8068 
glGetQueryiv_enc(void * self,GLenum target,GLenum pname,GLint * params)8069 void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params)
8070 {
8071 
8072 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8073 	IOStream *stream = ctx->m_stream;
8074 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8075 	bool useChecksum = checksumCalculator->getVersion() > 0;
8076 
8077 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
8078 	 unsigned char *ptr;
8079 	 unsigned char *buf;
8080 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8081 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8082 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8083 	buf = stream->alloc(totalSize);
8084 	ptr = buf;
8085 	int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4;
8086 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8087 
8088 		memcpy(ptr, &target, 4); ptr += 4;
8089 		memcpy(ptr, &pname, 4); ptr += 4;
8090 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
8091 
8092 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8093 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8094 
8095 	stream->readback(params, __size_params);
8096 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8097 	if (useChecksum) {
8098 		unsigned char *checksumBufPtr = NULL;
8099 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8100 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8101 		stream->readback(checksumBufPtr, checksumSize);
8102 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8103 			ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n");
8104 			abort();
8105 		}
8106 	}
8107 }
8108 
glGetQueryObjectuiv_enc(void * self,GLuint query,GLenum pname,GLuint * params)8109 void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params)
8110 {
8111 
8112 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8113 	IOStream *stream = ctx->m_stream;
8114 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8115 	bool useChecksum = checksumCalculator->getVersion() > 0;
8116 
8117 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLuint));
8118 	 unsigned char *ptr;
8119 	 unsigned char *buf;
8120 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8121 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8122 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8123 	buf = stream->alloc(totalSize);
8124 	ptr = buf;
8125 	int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4;
8126 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8127 
8128 		memcpy(ptr, &query, 4); ptr += 4;
8129 		memcpy(ptr, &pname, 4); ptr += 4;
8130 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
8131 
8132 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8133 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8134 
8135 	stream->readback(params, __size_params);
8136 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8137 	if (useChecksum) {
8138 		unsigned char *checksumBufPtr = NULL;
8139 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8140 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8141 		stream->readback(checksumBufPtr, checksumSize);
8142 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8143 			ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n");
8144 			abort();
8145 		}
8146 	}
8147 }
8148 
glIsQuery_enc(void * self,GLuint query)8149 GLboolean glIsQuery_enc(void *self , GLuint query)
8150 {
8151 
8152 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8153 	IOStream *stream = ctx->m_stream;
8154 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8155 	bool useChecksum = checksumCalculator->getVersion() > 0;
8156 
8157 	 unsigned char *ptr;
8158 	 unsigned char *buf;
8159 	 const size_t sizeWithoutChecksum = 8 + 4;
8160 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8161 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8162 	buf = stream->alloc(totalSize);
8163 	ptr = buf;
8164 	int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8165 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8166 
8167 		memcpy(ptr, &query, 4); ptr += 4;
8168 
8169 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8170 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8171 
8172 
8173 	GLboolean retval;
8174 	stream->readback(&retval, 1);
8175 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
8176 	if (useChecksum) {
8177 		unsigned char *checksumBufPtr = NULL;
8178 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8179 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8180 		stream->readback(checksumBufPtr, checksumSize);
8181 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8182 			ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n");
8183 			abort();
8184 		}
8185 	}
8186 	return retval;
8187 }
8188 
glProgramParameteri_enc(void * self,GLuint program,GLenum pname,GLint value)8189 void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value)
8190 {
8191 
8192 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8193 	IOStream *stream = ctx->m_stream;
8194 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8195 	bool useChecksum = checksumCalculator->getVersion() > 0;
8196 
8197 	 unsigned char *ptr;
8198 	 unsigned char *buf;
8199 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
8200 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8201 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8202 	buf = stream->alloc(totalSize);
8203 	ptr = buf;
8204 	int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
8205 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8206 
8207 		memcpy(ptr, &program, 4); ptr += 4;
8208 		memcpy(ptr, &pname, 4); ptr += 4;
8209 		memcpy(ptr, &value, 4); ptr += 4;
8210 
8211 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8212 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8213 
8214 }
8215 
glProgramBinary_enc(void * self,GLuint program,GLenum binaryFormat,const void * binary,GLsizei length)8216 void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length)
8217 {
8218 
8219 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8220 	IOStream *stream = ctx->m_stream;
8221 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8222 	bool useChecksum = checksumCalculator->getVersion() > 0;
8223 
8224 	const unsigned int __size_binary =  length;
8225 	 unsigned char *ptr;
8226 	 unsigned char *buf;
8227 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4;
8228 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8229 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8230 	buf = stream->alloc(totalSize);
8231 	ptr = buf;
8232 	int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8233 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8234 
8235 		memcpy(ptr, &program, 4); ptr += 4;
8236 		memcpy(ptr, &binaryFormat, 4); ptr += 4;
8237 	*(unsigned int *)(ptr) = __size_binary; ptr += 4;
8238 	memcpy(ptr, binary, __size_binary);ptr += __size_binary;
8239 		memcpy(ptr, &length, 4); ptr += 4;
8240 
8241 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8242 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8243 
8244 }
8245 
glGetProgramBinary_enc(void * self,GLuint program,GLsizei bufSize,GLsizei * length,GLenum * binaryFormat,void * binary)8246 void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary)
8247 {
8248 
8249 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8250 	IOStream *stream = ctx->m_stream;
8251 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8252 	bool useChecksum = checksumCalculator->getVersion() > 0;
8253 
8254 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
8255 	const unsigned int __size_binaryFormat =  (sizeof(GLenum));
8256 	const unsigned int __size_binary =  bufSize;
8257 	 unsigned char *ptr;
8258 	 unsigned char *buf;
8259 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4;
8260 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8261 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8262 	buf = stream->alloc(totalSize);
8263 	ptr = buf;
8264 	int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8265 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8266 
8267 		memcpy(ptr, &program, 4); ptr += 4;
8268 		memcpy(ptr, &bufSize, 4); ptr += 4;
8269 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
8270 	*(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4;
8271 	*(unsigned int *)(ptr) = __size_binary; ptr += 4;
8272 
8273 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8274 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8275 
8276 	if (length != NULL) {
8277 		stream->readback(length, __size_length);
8278 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
8279 	}
8280 	stream->readback(binaryFormat, __size_binaryFormat);
8281 	if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat);
8282 	stream->readback(binary, __size_binary);
8283 	if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary);
8284 	if (useChecksum) {
8285 		unsigned char *checksumBufPtr = NULL;
8286 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8287 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8288 		stream->readback(checksumBufPtr, checksumSize);
8289 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8290 			ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n");
8291 			abort();
8292 		}
8293 	}
8294 }
8295 
glGetFragDataLocation_enc(void * self,GLuint program,const char * name)8296 GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name)
8297 {
8298 
8299 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8300 	IOStream *stream = ctx->m_stream;
8301 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8302 	bool useChecksum = checksumCalculator->getVersion() > 0;
8303 
8304 	const unsigned int __size_name =  (strlen(name) + 1);
8305 	 unsigned char *ptr;
8306 	 unsigned char *buf;
8307 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
8308 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8309 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8310 	buf = stream->alloc(totalSize);
8311 	ptr = buf;
8312 	int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4;
8313 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8314 
8315 		memcpy(ptr, &program, 4); ptr += 4;
8316 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
8317 	memcpy(ptr, name, __size_name);ptr += __size_name;
8318 
8319 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8320 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8321 
8322 
8323 	GLint retval;
8324 	stream->readback(&retval, 4);
8325 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
8326 	if (useChecksum) {
8327 		unsigned char *checksumBufPtr = NULL;
8328 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8329 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8330 		stream->readback(checksumBufPtr, checksumSize);
8331 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8332 			ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n");
8333 			abort();
8334 		}
8335 	}
8336 	return retval;
8337 }
8338 
glGetInteger64v_enc(void * self,GLenum pname,GLint64 * data)8339 void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data)
8340 {
8341 
8342 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8343 	IOStream *stream = ctx->m_stream;
8344 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8345 	bool useChecksum = checksumCalculator->getVersion() > 0;
8346 
8347 	const unsigned int __size_data =  (glUtilsParamSize(pname) * sizeof(GLint64));
8348 	 unsigned char *ptr;
8349 	 unsigned char *buf;
8350 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8351 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8352 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8353 	buf = stream->alloc(totalSize);
8354 	ptr = buf;
8355 	int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4;
8356 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8357 
8358 		memcpy(ptr, &pname, 4); ptr += 4;
8359 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
8360 
8361 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8362 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8363 
8364 	stream->readback(data, __size_data);
8365 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8366 	if (useChecksum) {
8367 		unsigned char *checksumBufPtr = NULL;
8368 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8369 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8370 		stream->readback(checksumBufPtr, checksumSize);
8371 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8372 			ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n");
8373 			abort();
8374 		}
8375 	}
8376 }
8377 
glGetIntegeri_v_enc(void * self,GLenum target,GLuint index,GLint * data)8378 void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data)
8379 {
8380 
8381 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8382 	IOStream *stream = ctx->m_stream;
8383 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8384 	bool useChecksum = checksumCalculator->getVersion() > 0;
8385 
8386 	const unsigned int __size_data =  (sizeof(GLint));
8387 	 unsigned char *ptr;
8388 	 unsigned char *buf;
8389 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8390 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8391 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8392 	buf = stream->alloc(totalSize);
8393 	ptr = buf;
8394 	int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4;
8395 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8396 
8397 		memcpy(ptr, &target, 4); ptr += 4;
8398 		memcpy(ptr, &index, 4); ptr += 4;
8399 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
8400 
8401 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8402 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8403 
8404 	stream->readback(data, __size_data);
8405 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8406 	if (useChecksum) {
8407 		unsigned char *checksumBufPtr = NULL;
8408 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8409 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8410 		stream->readback(checksumBufPtr, checksumSize);
8411 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8412 			ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n");
8413 			abort();
8414 		}
8415 	}
8416 }
8417 
glGetInteger64i_v_enc(void * self,GLenum target,GLuint index,GLint64 * data)8418 void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data)
8419 {
8420 
8421 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8422 	IOStream *stream = ctx->m_stream;
8423 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8424 	bool useChecksum = checksumCalculator->getVersion() > 0;
8425 
8426 	const unsigned int __size_data =  (sizeof(GLint64));
8427 	 unsigned char *ptr;
8428 	 unsigned char *buf;
8429 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8430 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8431 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8432 	buf = stream->alloc(totalSize);
8433 	ptr = buf;
8434 	int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4;
8435 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8436 
8437 		memcpy(ptr, &target, 4); ptr += 4;
8438 		memcpy(ptr, &index, 4); ptr += 4;
8439 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
8440 
8441 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8442 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8443 
8444 	stream->readback(data, __size_data);
8445 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8446 	if (useChecksum) {
8447 		unsigned char *checksumBufPtr = NULL;
8448 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8449 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8450 		stream->readback(checksumBufPtr, checksumSize);
8451 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8452 			ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n");
8453 			abort();
8454 		}
8455 	}
8456 }
8457 
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)8458 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)
8459 {
8460 
8461 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8462 	IOStream *stream = ctx->m_stream;
8463 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8464 	bool useChecksum = checksumCalculator->getVersion() > 0;
8465 
8466 	const unsigned int __size_data = ((data != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8467 	 unsigned char *ptr;
8468 	 unsigned char *buf;
8469 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8470 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8471 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8472 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8473 	ptr = buf;
8474 	int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8475 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8476 
8477 		memcpy(ptr, &target, 4); ptr += 4;
8478 		memcpy(ptr, &level, 4); ptr += 4;
8479 		memcpy(ptr, &internalFormat, 4); ptr += 4;
8480 		memcpy(ptr, &width, 4); ptr += 4;
8481 		memcpy(ptr, &height, 4); ptr += 4;
8482 		memcpy(ptr, &depth, 4); ptr += 4;
8483 		memcpy(ptr, &border, 4); ptr += 4;
8484 		memcpy(ptr, &format, 4); ptr += 4;
8485 		memcpy(ptr, &type, 4); ptr += 4;
8486 
8487 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8488 	stream->flush();
8489 	stream->writeFully(&__size_data,4);
8490 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8491 	if (data != NULL) {
8492 		 stream->uploadPixels(self, width, height, depth, format, type, data);
8493 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8494 	}
8495 	buf = stream->alloc(checksumSize);
8496 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8497 
8498 }
8499 
glTexImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLint internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLenum format,GLenum type,GLuint offset)8500 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)
8501 {
8502 
8503 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8504 	IOStream *stream = ctx->m_stream;
8505 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8506 	bool useChecksum = checksumCalculator->getVersion() > 0;
8507 
8508 	 unsigned char *ptr;
8509 	 unsigned char *buf;
8510 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8511 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8512 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8513 	buf = stream->alloc(totalSize);
8514 	ptr = buf;
8515 	int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8516 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8517 
8518 		memcpy(ptr, &target, 4); ptr += 4;
8519 		memcpy(ptr, &level, 4); ptr += 4;
8520 		memcpy(ptr, &internalFormat, 4); ptr += 4;
8521 		memcpy(ptr, &width, 4); ptr += 4;
8522 		memcpy(ptr, &height, 4); ptr += 4;
8523 		memcpy(ptr, &depth, 4); ptr += 4;
8524 		memcpy(ptr, &border, 4); ptr += 4;
8525 		memcpy(ptr, &format, 4); ptr += 4;
8526 		memcpy(ptr, &type, 4); ptr += 4;
8527 		memcpy(ptr, &offset, 4); ptr += 4;
8528 
8529 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8530 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8531 
8532 }
8533 
glTexStorage3D_enc(void * self,GLenum target,GLsizei levels,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth)8534 void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
8535 {
8536 
8537 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8538 	IOStream *stream = ctx->m_stream;
8539 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8540 	bool useChecksum = checksumCalculator->getVersion() > 0;
8541 
8542 	 unsigned char *ptr;
8543 	 unsigned char *buf;
8544 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
8545 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8546 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8547 	buf = stream->alloc(totalSize);
8548 	ptr = buf;
8549 	int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8550 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8551 
8552 		memcpy(ptr, &target, 4); ptr += 4;
8553 		memcpy(ptr, &levels, 4); ptr += 4;
8554 		memcpy(ptr, &internalformat, 4); ptr += 4;
8555 		memcpy(ptr, &width, 4); ptr += 4;
8556 		memcpy(ptr, &height, 4); ptr += 4;
8557 		memcpy(ptr, &depth, 4); ptr += 4;
8558 
8559 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8560 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8561 
8562 }
8563 
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)8564 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)
8565 {
8566 
8567 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8568 	IOStream *stream = ctx->m_stream;
8569 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8570 	bool useChecksum = checksumCalculator->getVersion() > 0;
8571 
8572 	const unsigned int __size_data = ((data != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8573 	 unsigned char *ptr;
8574 	 unsigned char *buf;
8575 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8576 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8577 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8578 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8579 	ptr = buf;
8580 	int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8581 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8582 
8583 		memcpy(ptr, &target, 4); ptr += 4;
8584 		memcpy(ptr, &level, 4); ptr += 4;
8585 		memcpy(ptr, &xoffset, 4); ptr += 4;
8586 		memcpy(ptr, &yoffset, 4); ptr += 4;
8587 		memcpy(ptr, &zoffset, 4); ptr += 4;
8588 		memcpy(ptr, &width, 4); ptr += 4;
8589 		memcpy(ptr, &height, 4); ptr += 4;
8590 		memcpy(ptr, &depth, 4); ptr += 4;
8591 		memcpy(ptr, &format, 4); ptr += 4;
8592 		memcpy(ptr, &type, 4); ptr += 4;
8593 
8594 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8595 	stream->flush();
8596 	stream->writeFully(&__size_data,4);
8597 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8598 	if (data != NULL) {
8599 		 stream->uploadPixels(self, width, height, depth, format, type, data);
8600 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8601 	}
8602 	buf = stream->alloc(checksumSize);
8603 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8604 
8605 }
8606 
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)8607 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)
8608 {
8609 
8610 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8611 	IOStream *stream = ctx->m_stream;
8612 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8613 	bool useChecksum = checksumCalculator->getVersion() > 0;
8614 
8615 	 unsigned char *ptr;
8616 	 unsigned char *buf;
8617 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8618 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8619 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8620 	buf = stream->alloc(totalSize);
8621 	ptr = buf;
8622 	int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8623 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8624 
8625 		memcpy(ptr, &target, 4); ptr += 4;
8626 		memcpy(ptr, &level, 4); ptr += 4;
8627 		memcpy(ptr, &xoffset, 4); ptr += 4;
8628 		memcpy(ptr, &yoffset, 4); ptr += 4;
8629 		memcpy(ptr, &zoffset, 4); ptr += 4;
8630 		memcpy(ptr, &width, 4); ptr += 4;
8631 		memcpy(ptr, &height, 4); ptr += 4;
8632 		memcpy(ptr, &depth, 4); ptr += 4;
8633 		memcpy(ptr, &format, 4); ptr += 4;
8634 		memcpy(ptr, &type, 4); ptr += 4;
8635 		memcpy(ptr, &offset, 4); ptr += 4;
8636 
8637 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8638 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8639 
8640 }
8641 
glCompressedTexImage3D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,const GLvoid * data)8642 void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
8643 {
8644 
8645 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8646 	IOStream *stream = ctx->m_stream;
8647 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8648 	bool useChecksum = checksumCalculator->getVersion() > 0;
8649 
8650 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
8651 	 unsigned char *ptr;
8652 	 unsigned char *buf;
8653 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8654 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8655 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8656 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8657 	ptr = buf;
8658 	int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8659 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8660 
8661 		memcpy(ptr, &target, 4); ptr += 4;
8662 		memcpy(ptr, &level, 4); ptr += 4;
8663 		memcpy(ptr, &internalformat, 4); ptr += 4;
8664 		memcpy(ptr, &width, 4); ptr += 4;
8665 		memcpy(ptr, &height, 4); ptr += 4;
8666 		memcpy(ptr, &depth, 4); ptr += 4;
8667 		memcpy(ptr, &border, 4); ptr += 4;
8668 		memcpy(ptr, &imageSize, 4); ptr += 4;
8669 
8670 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8671 	stream->flush();
8672 	stream->writeFully(&__size_data,4);
8673 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8674 	if (data != NULL) {
8675 		stream->writeFully(data, __size_data);
8676 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8677 	}
8678 	buf = stream->alloc(checksumSize);
8679 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8680 
8681 }
8682 
glCompressedTexImage3DOffsetAEMU_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint border,GLsizei imageSize,GLuint offset)8683 void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset)
8684 {
8685 
8686 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8687 	IOStream *stream = ctx->m_stream;
8688 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8689 	bool useChecksum = checksumCalculator->getVersion() > 0;
8690 
8691 	 unsigned char *ptr;
8692 	 unsigned char *buf;
8693 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8694 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8695 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8696 	buf = stream->alloc(totalSize);
8697 	ptr = buf;
8698 	int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8699 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8700 
8701 		memcpy(ptr, &target, 4); ptr += 4;
8702 		memcpy(ptr, &level, 4); ptr += 4;
8703 		memcpy(ptr, &internalformat, 4); ptr += 4;
8704 		memcpy(ptr, &width, 4); ptr += 4;
8705 		memcpy(ptr, &height, 4); ptr += 4;
8706 		memcpy(ptr, &depth, 4); ptr += 4;
8707 		memcpy(ptr, &border, 4); ptr += 4;
8708 		memcpy(ptr, &imageSize, 4); ptr += 4;
8709 		memcpy(ptr, &offset, 4); ptr += 4;
8710 
8711 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8712 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8713 
8714 }
8715 
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)8716 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)
8717 {
8718 
8719 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8720 	IOStream *stream = ctx->m_stream;
8721 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8722 	bool useChecksum = checksumCalculator->getVersion() > 0;
8723 
8724 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
8725 	 unsigned char *ptr;
8726 	 unsigned char *buf;
8727 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8728 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8729 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8730 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8731 	ptr = buf;
8732 	int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8733 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8734 
8735 		memcpy(ptr, &target, 4); ptr += 4;
8736 		memcpy(ptr, &level, 4); ptr += 4;
8737 		memcpy(ptr, &xoffset, 4); ptr += 4;
8738 		memcpy(ptr, &yoffset, 4); ptr += 4;
8739 		memcpy(ptr, &zoffset, 4); ptr += 4;
8740 		memcpy(ptr, &width, 4); ptr += 4;
8741 		memcpy(ptr, &height, 4); ptr += 4;
8742 		memcpy(ptr, &depth, 4); ptr += 4;
8743 		memcpy(ptr, &format, 4); ptr += 4;
8744 		memcpy(ptr, &imageSize, 4); ptr += 4;
8745 
8746 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8747 	stream->flush();
8748 	stream->writeFully(&__size_data,4);
8749 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8750 	if (data != NULL) {
8751 		stream->writeFully(data, __size_data);
8752 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8753 	}
8754 	buf = stream->alloc(checksumSize);
8755 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8756 
8757 }
8758 
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)8759 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)
8760 {
8761 
8762 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8763 	IOStream *stream = ctx->m_stream;
8764 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8765 	bool useChecksum = checksumCalculator->getVersion() > 0;
8766 
8767 	 unsigned char *ptr;
8768 	 unsigned char *buf;
8769 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8770 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8771 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8772 	buf = stream->alloc(totalSize);
8773 	ptr = buf;
8774 	int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8775 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8776 
8777 		memcpy(ptr, &target, 4); ptr += 4;
8778 		memcpy(ptr, &level, 4); ptr += 4;
8779 		memcpy(ptr, &xoffset, 4); ptr += 4;
8780 		memcpy(ptr, &yoffset, 4); ptr += 4;
8781 		memcpy(ptr, &zoffset, 4); ptr += 4;
8782 		memcpy(ptr, &width, 4); ptr += 4;
8783 		memcpy(ptr, &height, 4); ptr += 4;
8784 		memcpy(ptr, &depth, 4); ptr += 4;
8785 		memcpy(ptr, &format, 4); ptr += 4;
8786 		memcpy(ptr, &imageSize, 4); ptr += 4;
8787 		memcpy(ptr, &data, 4); ptr += 4;
8788 
8789 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8790 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8791 
8792 }
8793 
glCopyTexSubImage3D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLint x,GLint y,GLsizei width,GLsizei height)8794 void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
8795 {
8796 
8797 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8798 	IOStream *stream = ctx->m_stream;
8799 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8800 	bool useChecksum = checksumCalculator->getVersion() > 0;
8801 
8802 	 unsigned char *ptr;
8803 	 unsigned char *buf;
8804 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8805 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8806 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8807 	buf = stream->alloc(totalSize);
8808 	ptr = buf;
8809 	int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8810 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8811 
8812 		memcpy(ptr, &target, 4); ptr += 4;
8813 		memcpy(ptr, &level, 4); ptr += 4;
8814 		memcpy(ptr, &xoffset, 4); ptr += 4;
8815 		memcpy(ptr, &yoffset, 4); ptr += 4;
8816 		memcpy(ptr, &zoffset, 4); ptr += 4;
8817 		memcpy(ptr, &x, 4); ptr += 4;
8818 		memcpy(ptr, &y, 4); ptr += 4;
8819 		memcpy(ptr, &width, 4); ptr += 4;
8820 		memcpy(ptr, &height, 4); ptr += 4;
8821 
8822 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8823 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8824 
8825 }
8826 
glGetBooleani_v_enc(void * self,GLenum target,GLuint index,GLboolean * data)8827 void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data)
8828 {
8829 
8830 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8831 	IOStream *stream = ctx->m_stream;
8832 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8833 	bool useChecksum = checksumCalculator->getVersion() > 0;
8834 
8835 	const unsigned int __size_data =  (sizeof(GLboolean));
8836 	 unsigned char *ptr;
8837 	 unsigned char *buf;
8838 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8839 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8840 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8841 	buf = stream->alloc(totalSize);
8842 	ptr = buf;
8843 	int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4;
8844 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8845 
8846 		memcpy(ptr, &target, 4); ptr += 4;
8847 		memcpy(ptr, &index, 4); ptr += 4;
8848 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
8849 
8850 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8851 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8852 
8853 	stream->readback(data, __size_data);
8854 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8855 	if (useChecksum) {
8856 		unsigned char *checksumBufPtr = NULL;
8857 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8858 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8859 		stream->readback(checksumBufPtr, checksumSize);
8860 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8861 			ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n");
8862 			abort();
8863 		}
8864 	}
8865 }
8866 
glMemoryBarrier_enc(void * self,GLbitfield barriers)8867 void glMemoryBarrier_enc(void *self , GLbitfield barriers)
8868 {
8869 
8870 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8871 	IOStream *stream = ctx->m_stream;
8872 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8873 	bool useChecksum = checksumCalculator->getVersion() > 0;
8874 
8875 	 unsigned char *ptr;
8876 	 unsigned char *buf;
8877 	 const size_t sizeWithoutChecksum = 8 + 4;
8878 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8879 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8880 	buf = stream->alloc(totalSize);
8881 	ptr = buf;
8882 	int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4;
8883 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8884 
8885 		memcpy(ptr, &barriers, 4); ptr += 4;
8886 
8887 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8888 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8889 
8890 }
8891 
glMemoryBarrierByRegion_enc(void * self,GLbitfield barriers)8892 void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers)
8893 {
8894 
8895 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8896 	IOStream *stream = ctx->m_stream;
8897 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8898 	bool useChecksum = checksumCalculator->getVersion() > 0;
8899 
8900 	 unsigned char *ptr;
8901 	 unsigned char *buf;
8902 	 const size_t sizeWithoutChecksum = 8 + 4;
8903 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8904 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8905 	buf = stream->alloc(totalSize);
8906 	ptr = buf;
8907 	int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4;
8908 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8909 
8910 		memcpy(ptr, &barriers, 4); ptr += 4;
8911 
8912 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8913 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8914 
8915 }
8916 
glGenProgramPipelines_enc(void * self,GLsizei n,GLuint * pipelines)8917 void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines)
8918 {
8919 
8920 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8921 	IOStream *stream = ctx->m_stream;
8922 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8923 	bool useChecksum = checksumCalculator->getVersion() > 0;
8924 
8925 	const unsigned int __size_pipelines =  (n * sizeof(GLuint));
8926 	 unsigned char *ptr;
8927 	 unsigned char *buf;
8928 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8929 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8930 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8931 	buf = stream->alloc(totalSize);
8932 	ptr = buf;
8933 	int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8934 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8935 
8936 		memcpy(ptr, &n, 4); ptr += 4;
8937 	*(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8938 
8939 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8940 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8941 
8942 	stream->readback(pipelines, __size_pipelines);
8943 	if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines);
8944 	if (useChecksum) {
8945 		unsigned char *checksumBufPtr = NULL;
8946 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8947 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8948 		stream->readback(checksumBufPtr, checksumSize);
8949 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8950 			ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n");
8951 			abort();
8952 		}
8953 	}
8954 }
8955 
glDeleteProgramPipelines_enc(void * self,GLsizei n,const GLuint * pipelines)8956 void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines)
8957 {
8958 
8959 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8960 	IOStream *stream = ctx->m_stream;
8961 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8962 	bool useChecksum = checksumCalculator->getVersion() > 0;
8963 
8964 	const unsigned int __size_pipelines =  (n * sizeof(GLuint));
8965 	 unsigned char *ptr;
8966 	 unsigned char *buf;
8967 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4;
8968 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8969 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8970 	buf = stream->alloc(totalSize);
8971 	ptr = buf;
8972 	int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8973 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8974 
8975 		memcpy(ptr, &n, 4); ptr += 4;
8976 	*(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8977 	memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines;
8978 
8979 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8980 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8981 
8982 }
8983 
glBindProgramPipeline_enc(void * self,GLuint pipeline)8984 void glBindProgramPipeline_enc(void *self , GLuint pipeline)
8985 {
8986 
8987 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8988 	IOStream *stream = ctx->m_stream;
8989 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8990 	bool useChecksum = checksumCalculator->getVersion() > 0;
8991 
8992 	 unsigned char *ptr;
8993 	 unsigned char *buf;
8994 	 const size_t sizeWithoutChecksum = 8 + 4;
8995 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8996 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8997 	buf = stream->alloc(totalSize);
8998 	ptr = buf;
8999 	int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9000 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9001 
9002 		memcpy(ptr, &pipeline, 4); ptr += 4;
9003 
9004 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9005 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9006 
9007 }
9008 
glGetProgramPipelineiv_enc(void * self,GLuint pipeline,GLenum pname,GLint * params)9009 void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params)
9010 {
9011 
9012 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9013 	IOStream *stream = ctx->m_stream;
9014 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9015 	bool useChecksum = checksumCalculator->getVersion() > 0;
9016 
9017 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
9018 	 unsigned char *ptr;
9019 	 unsigned char *buf;
9020 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
9021 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9022 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9023 	buf = stream->alloc(totalSize);
9024 	ptr = buf;
9025 	int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4;
9026 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9027 
9028 		memcpy(ptr, &pipeline, 4); ptr += 4;
9029 		memcpy(ptr, &pname, 4); ptr += 4;
9030 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
9031 
9032 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9033 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9034 
9035 	stream->readback(params, __size_params);
9036 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
9037 	if (useChecksum) {
9038 		unsigned char *checksumBufPtr = NULL;
9039 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9040 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9041 		stream->readback(checksumBufPtr, checksumSize);
9042 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9043 			ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n");
9044 			abort();
9045 		}
9046 	}
9047 }
9048 
glGetProgramPipelineInfoLog_enc(void * self,GLuint pipeline,GLsizei bufSize,GLsizei * length,GLchar * infoLog)9049 void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog)
9050 {
9051 
9052 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9053 	IOStream *stream = ctx->m_stream;
9054 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9055 	bool useChecksum = checksumCalculator->getVersion() > 0;
9056 
9057 	const unsigned int __size_length = ((length != NULL) ?  sizeof(GLsizei) : 0);
9058 	const unsigned int __size_infoLog =  bufSize;
9059 	 unsigned char *ptr;
9060 	 unsigned char *buf;
9061 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
9062 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9063 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9064 	buf = stream->alloc(totalSize);
9065 	ptr = buf;
9066 	int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
9067 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9068 
9069 		memcpy(ptr, &pipeline, 4); ptr += 4;
9070 		memcpy(ptr, &bufSize, 4); ptr += 4;
9071 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
9072 	*(unsigned int *)(ptr) = __size_infoLog; ptr += 4;
9073 
9074 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9075 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9076 
9077 	if (length != NULL) {
9078 		stream->readback(length, __size_length);
9079 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
9080 	}
9081 	stream->readback(infoLog, __size_infoLog);
9082 	if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog);
9083 	if (useChecksum) {
9084 		unsigned char *checksumBufPtr = NULL;
9085 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9086 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9087 		stream->readback(checksumBufPtr, checksumSize);
9088 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9089 			ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n");
9090 			abort();
9091 		}
9092 	}
9093 }
9094 
glValidateProgramPipeline_enc(void * self,GLuint pipeline)9095 void glValidateProgramPipeline_enc(void *self , GLuint pipeline)
9096 {
9097 
9098 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9099 	IOStream *stream = ctx->m_stream;
9100 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9101 	bool useChecksum = checksumCalculator->getVersion() > 0;
9102 
9103 	 unsigned char *ptr;
9104 	 unsigned char *buf;
9105 	 const size_t sizeWithoutChecksum = 8 + 4;
9106 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9107 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9108 	buf = stream->alloc(totalSize);
9109 	ptr = buf;
9110 	int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9111 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9112 
9113 		memcpy(ptr, &pipeline, 4); ptr += 4;
9114 
9115 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9116 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9117 
9118 }
9119 
glIsProgramPipeline_enc(void * self,GLuint pipeline)9120 GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline)
9121 {
9122 
9123 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9124 	IOStream *stream = ctx->m_stream;
9125 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9126 	bool useChecksum = checksumCalculator->getVersion() > 0;
9127 
9128 	 unsigned char *ptr;
9129 	 unsigned char *buf;
9130 	 const size_t sizeWithoutChecksum = 8 + 4;
9131 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9132 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9133 	buf = stream->alloc(totalSize);
9134 	ptr = buf;
9135 	int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9136 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9137 
9138 		memcpy(ptr, &pipeline, 4); ptr += 4;
9139 
9140 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9141 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9142 
9143 
9144 	GLboolean retval;
9145 	stream->readback(&retval, 1);
9146 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
9147 	if (useChecksum) {
9148 		unsigned char *checksumBufPtr = NULL;
9149 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9150 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9151 		stream->readback(checksumBufPtr, checksumSize);
9152 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9153 			ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n");
9154 			abort();
9155 		}
9156 	}
9157 	return retval;
9158 }
9159 
glUseProgramStages_enc(void * self,GLuint pipeline,GLbitfield stages,GLuint program)9160 void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program)
9161 {
9162 
9163 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9164 	IOStream *stream = ctx->m_stream;
9165 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9166 	bool useChecksum = checksumCalculator->getVersion() > 0;
9167 
9168 	 unsigned char *ptr;
9169 	 unsigned char *buf;
9170 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9171 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9172 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9173 	buf = stream->alloc(totalSize);
9174 	ptr = buf;
9175 	int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4;
9176 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9177 
9178 		memcpy(ptr, &pipeline, 4); ptr += 4;
9179 		memcpy(ptr, &stages, 4); ptr += 4;
9180 		memcpy(ptr, &program, 4); ptr += 4;
9181 
9182 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9183 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9184 
9185 }
9186 
glActiveShaderProgram_enc(void * self,GLuint pipeline,GLuint program)9187 void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program)
9188 {
9189 
9190 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9191 	IOStream *stream = ctx->m_stream;
9192 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9193 	bool useChecksum = checksumCalculator->getVersion() > 0;
9194 
9195 	 unsigned char *ptr;
9196 	 unsigned char *buf;
9197 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
9198 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9199 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9200 	buf = stream->alloc(totalSize);
9201 	ptr = buf;
9202 	int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4;
9203 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9204 
9205 		memcpy(ptr, &pipeline, 4); ptr += 4;
9206 		memcpy(ptr, &program, 4); ptr += 4;
9207 
9208 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9209 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9210 
9211 }
9212 
glCreateShaderProgramvAEMU_enc(void * self,GLenum type,GLsizei count,const char * packedStrings,GLuint packedLen)9213 GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen)
9214 {
9215 
9216 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9217 	IOStream *stream = ctx->m_stream;
9218 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9219 	bool useChecksum = checksumCalculator->getVersion() > 0;
9220 
9221 	const unsigned int __size_packedStrings =  packedLen;
9222 	 unsigned char *ptr;
9223 	 unsigned char *buf;
9224 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4;
9225 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9226 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9227 	buf = stream->alloc(totalSize);
9228 	ptr = buf;
9229 	int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
9230 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9231 
9232 		memcpy(ptr, &type, 4); ptr += 4;
9233 		memcpy(ptr, &count, 4); ptr += 4;
9234 	*(unsigned int *)(ptr) = __size_packedStrings; ptr += 4;
9235 	memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings;
9236 		memcpy(ptr, &packedLen, 4); ptr += 4;
9237 
9238 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9239 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9240 
9241 
9242 	GLuint retval;
9243 	stream->readback(&retval, 4);
9244 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
9245 	if (useChecksum) {
9246 		unsigned char *checksumBufPtr = NULL;
9247 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9248 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9249 		stream->readback(checksumBufPtr, checksumSize);
9250 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9251 			ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n");
9252 			abort();
9253 		}
9254 	}
9255 	return retval;
9256 }
9257 
glProgramUniform1f_enc(void * self,GLuint program,GLint location,GLfloat v0)9258 void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0)
9259 {
9260 
9261 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9262 	IOStream *stream = ctx->m_stream;
9263 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9264 	bool useChecksum = checksumCalculator->getVersion() > 0;
9265 
9266 	 unsigned char *ptr;
9267 	 unsigned char *buf;
9268 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9269 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9270 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9271 	buf = stream->alloc(totalSize);
9272 	ptr = buf;
9273 	int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
9274 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9275 
9276 		memcpy(ptr, &program, 4); ptr += 4;
9277 		memcpy(ptr, &location, 4); ptr += 4;
9278 		memcpy(ptr, &v0, 4); ptr += 4;
9279 
9280 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9281 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9282 
9283 }
9284 
glProgramUniform2f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1)9285 void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1)
9286 {
9287 
9288 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9289 	IOStream *stream = ctx->m_stream;
9290 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9291 	bool useChecksum = checksumCalculator->getVersion() > 0;
9292 
9293 	 unsigned char *ptr;
9294 	 unsigned char *buf;
9295 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9296 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9297 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9298 	buf = stream->alloc(totalSize);
9299 	ptr = buf;
9300 	int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
9301 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9302 
9303 		memcpy(ptr, &program, 4); ptr += 4;
9304 		memcpy(ptr, &location, 4); ptr += 4;
9305 		memcpy(ptr, &v0, 4); ptr += 4;
9306 		memcpy(ptr, &v1, 4); ptr += 4;
9307 
9308 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9309 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9310 
9311 }
9312 
glProgramUniform3f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2)9313 void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
9314 {
9315 
9316 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9317 	IOStream *stream = ctx->m_stream;
9318 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9319 	bool useChecksum = checksumCalculator->getVersion() > 0;
9320 
9321 	 unsigned char *ptr;
9322 	 unsigned char *buf;
9323 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9324 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9325 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9326 	buf = stream->alloc(totalSize);
9327 	ptr = buf;
9328 	int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
9329 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9330 
9331 		memcpy(ptr, &program, 4); ptr += 4;
9332 		memcpy(ptr, &location, 4); ptr += 4;
9333 		memcpy(ptr, &v0, 4); ptr += 4;
9334 		memcpy(ptr, &v1, 4); ptr += 4;
9335 		memcpy(ptr, &v2, 4); ptr += 4;
9336 
9337 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9338 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9339 
9340 }
9341 
glProgramUniform4f_enc(void * self,GLuint program,GLint location,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)9342 void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
9343 {
9344 
9345 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9346 	IOStream *stream = ctx->m_stream;
9347 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9348 	bool useChecksum = checksumCalculator->getVersion() > 0;
9349 
9350 	 unsigned char *ptr;
9351 	 unsigned char *buf;
9352 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9353 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9354 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9355 	buf = stream->alloc(totalSize);
9356 	ptr = buf;
9357 	int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
9358 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9359 
9360 		memcpy(ptr, &program, 4); ptr += 4;
9361 		memcpy(ptr, &location, 4); ptr += 4;
9362 		memcpy(ptr, &v0, 4); ptr += 4;
9363 		memcpy(ptr, &v1, 4); ptr += 4;
9364 		memcpy(ptr, &v2, 4); ptr += 4;
9365 		memcpy(ptr, &v3, 4); ptr += 4;
9366 
9367 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9368 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9369 
9370 }
9371 
glProgramUniform1i_enc(void * self,GLuint program,GLint location,GLint v0)9372 void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0)
9373 {
9374 
9375 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9376 	IOStream *stream = ctx->m_stream;
9377 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9378 	bool useChecksum = checksumCalculator->getVersion() > 0;
9379 
9380 	 unsigned char *ptr;
9381 	 unsigned char *buf;
9382 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9383 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9384 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9385 	buf = stream->alloc(totalSize);
9386 	ptr = buf;
9387 	int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
9388 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9389 
9390 		memcpy(ptr, &program, 4); ptr += 4;
9391 		memcpy(ptr, &location, 4); ptr += 4;
9392 		memcpy(ptr, &v0, 4); ptr += 4;
9393 
9394 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9395 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9396 
9397 }
9398 
glProgramUniform2i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1)9399 void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1)
9400 {
9401 
9402 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9403 	IOStream *stream = ctx->m_stream;
9404 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9405 	bool useChecksum = checksumCalculator->getVersion() > 0;
9406 
9407 	 unsigned char *ptr;
9408 	 unsigned char *buf;
9409 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9410 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9411 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9412 	buf = stream->alloc(totalSize);
9413 	ptr = buf;
9414 	int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
9415 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9416 
9417 		memcpy(ptr, &program, 4); ptr += 4;
9418 		memcpy(ptr, &location, 4); ptr += 4;
9419 		memcpy(ptr, &v0, 4); ptr += 4;
9420 		memcpy(ptr, &v1, 4); ptr += 4;
9421 
9422 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9423 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9424 
9425 }
9426 
glProgramUniform3i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2)9427 void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
9428 {
9429 
9430 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9431 	IOStream *stream = ctx->m_stream;
9432 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9433 	bool useChecksum = checksumCalculator->getVersion() > 0;
9434 
9435 	 unsigned char *ptr;
9436 	 unsigned char *buf;
9437 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9438 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9439 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9440 	buf = stream->alloc(totalSize);
9441 	ptr = buf;
9442 	int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
9443 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9444 
9445 		memcpy(ptr, &program, 4); ptr += 4;
9446 		memcpy(ptr, &location, 4); ptr += 4;
9447 		memcpy(ptr, &v0, 4); ptr += 4;
9448 		memcpy(ptr, &v1, 4); ptr += 4;
9449 		memcpy(ptr, &v2, 4); ptr += 4;
9450 
9451 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9452 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9453 
9454 }
9455 
glProgramUniform4i_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLint v3)9456 void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
9457 {
9458 
9459 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9460 	IOStream *stream = ctx->m_stream;
9461 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9462 	bool useChecksum = checksumCalculator->getVersion() > 0;
9463 
9464 	 unsigned char *ptr;
9465 	 unsigned char *buf;
9466 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9467 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9468 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9469 	buf = stream->alloc(totalSize);
9470 	ptr = buf;
9471 	int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
9472 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9473 
9474 		memcpy(ptr, &program, 4); ptr += 4;
9475 		memcpy(ptr, &location, 4); ptr += 4;
9476 		memcpy(ptr, &v0, 4); ptr += 4;
9477 		memcpy(ptr, &v1, 4); ptr += 4;
9478 		memcpy(ptr, &v2, 4); ptr += 4;
9479 		memcpy(ptr, &v3, 4); ptr += 4;
9480 
9481 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9482 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9483 
9484 }
9485 
glProgramUniform1ui_enc(void * self,GLuint program,GLint location,GLuint v0)9486 void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0)
9487 {
9488 
9489 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9490 	IOStream *stream = ctx->m_stream;
9491 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9492 	bool useChecksum = checksumCalculator->getVersion() > 0;
9493 
9494 	 unsigned char *ptr;
9495 	 unsigned char *buf;
9496 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9497 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9498 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9499 	buf = stream->alloc(totalSize);
9500 	ptr = buf;
9501 	int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
9502 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9503 
9504 		memcpy(ptr, &program, 4); ptr += 4;
9505 		memcpy(ptr, &location, 4); ptr += 4;
9506 		memcpy(ptr, &v0, 4); ptr += 4;
9507 
9508 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9509 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9510 
9511 }
9512 
glProgramUniform2ui_enc(void * self,GLuint program,GLint location,GLint v0,GLuint v1)9513 void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1)
9514 {
9515 
9516 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9517 	IOStream *stream = ctx->m_stream;
9518 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9519 	bool useChecksum = checksumCalculator->getVersion() > 0;
9520 
9521 	 unsigned char *ptr;
9522 	 unsigned char *buf;
9523 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9524 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9525 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9526 	buf = stream->alloc(totalSize);
9527 	ptr = buf;
9528 	int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
9529 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9530 
9531 		memcpy(ptr, &program, 4); ptr += 4;
9532 		memcpy(ptr, &location, 4); ptr += 4;
9533 		memcpy(ptr, &v0, 4); ptr += 4;
9534 		memcpy(ptr, &v1, 4); ptr += 4;
9535 
9536 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9537 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9538 
9539 }
9540 
glProgramUniform3ui_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLuint v2)9541 void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
9542 {
9543 
9544 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9545 	IOStream *stream = ctx->m_stream;
9546 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9547 	bool useChecksum = checksumCalculator->getVersion() > 0;
9548 
9549 	 unsigned char *ptr;
9550 	 unsigned char *buf;
9551 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9552 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9553 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9554 	buf = stream->alloc(totalSize);
9555 	ptr = buf;
9556 	int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
9557 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9558 
9559 		memcpy(ptr, &program, 4); ptr += 4;
9560 		memcpy(ptr, &location, 4); ptr += 4;
9561 		memcpy(ptr, &v0, 4); ptr += 4;
9562 		memcpy(ptr, &v1, 4); ptr += 4;
9563 		memcpy(ptr, &v2, 4); ptr += 4;
9564 
9565 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9566 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9567 
9568 }
9569 
glProgramUniform4ui_enc(void * self,GLuint program,GLint location,GLint v0,GLint v1,GLint v2,GLuint v3)9570 void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
9571 {
9572 
9573 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9574 	IOStream *stream = ctx->m_stream;
9575 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9576 	bool useChecksum = checksumCalculator->getVersion() > 0;
9577 
9578 	 unsigned char *ptr;
9579 	 unsigned char *buf;
9580 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9581 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9582 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9583 	buf = stream->alloc(totalSize);
9584 	ptr = buf;
9585 	int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
9586 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9587 
9588 		memcpy(ptr, &program, 4); ptr += 4;
9589 		memcpy(ptr, &location, 4); ptr += 4;
9590 		memcpy(ptr, &v0, 4); ptr += 4;
9591 		memcpy(ptr, &v1, 4); ptr += 4;
9592 		memcpy(ptr, &v2, 4); ptr += 4;
9593 		memcpy(ptr, &v3, 4); ptr += 4;
9594 
9595 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9596 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9597 
9598 }
9599 
glProgramUniform1fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9600 void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9601 {
9602 
9603 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9604 	IOStream *stream = ctx->m_stream;
9605 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9606 	bool useChecksum = checksumCalculator->getVersion() > 0;
9607 
9608 	const unsigned int __size_value =  (count * sizeof(GLfloat));
9609 	 unsigned char *ptr;
9610 	 unsigned char *buf;
9611 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9612 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9613 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9614 	buf = stream->alloc(totalSize);
9615 	ptr = buf;
9616 	int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
9617 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9618 
9619 		memcpy(ptr, &program, 4); ptr += 4;
9620 		memcpy(ptr, &location, 4); ptr += 4;
9621 		memcpy(ptr, &count, 4); ptr += 4;
9622 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9623 	memcpy(ptr, value, __size_value);ptr += __size_value;
9624 
9625 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9626 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9627 
9628 }
9629 
glProgramUniform2fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9630 void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9631 {
9632 
9633 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9634 	IOStream *stream = ctx->m_stream;
9635 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9636 	bool useChecksum = checksumCalculator->getVersion() > 0;
9637 
9638 	const unsigned int __size_value =  (count * 2 * sizeof(GLfloat));
9639 	 unsigned char *ptr;
9640 	 unsigned char *buf;
9641 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9642 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9643 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9644 	buf = stream->alloc(totalSize);
9645 	ptr = buf;
9646 	int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9647 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9648 
9649 		memcpy(ptr, &program, 4); ptr += 4;
9650 		memcpy(ptr, &location, 4); ptr += 4;
9651 		memcpy(ptr, &count, 4); ptr += 4;
9652 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9653 	memcpy(ptr, value, __size_value);ptr += __size_value;
9654 
9655 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9656 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9657 
9658 }
9659 
glProgramUniform3fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9660 void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9661 {
9662 
9663 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9664 	IOStream *stream = ctx->m_stream;
9665 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9666 	bool useChecksum = checksumCalculator->getVersion() > 0;
9667 
9668 	const unsigned int __size_value =  (count * 3 * sizeof(GLfloat));
9669 	 unsigned char *ptr;
9670 	 unsigned char *buf;
9671 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9672 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9673 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9674 	buf = stream->alloc(totalSize);
9675 	ptr = buf;
9676 	int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
9677 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9678 
9679 		memcpy(ptr, &program, 4); ptr += 4;
9680 		memcpy(ptr, &location, 4); ptr += 4;
9681 		memcpy(ptr, &count, 4); ptr += 4;
9682 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9683 	memcpy(ptr, value, __size_value);ptr += __size_value;
9684 
9685 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9686 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9687 
9688 }
9689 
glProgramUniform4fv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLfloat * value)9690 void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9691 {
9692 
9693 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9694 	IOStream *stream = ctx->m_stream;
9695 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9696 	bool useChecksum = checksumCalculator->getVersion() > 0;
9697 
9698 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
9699 	 unsigned char *ptr;
9700 	 unsigned char *buf;
9701 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9702 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9703 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9704 	buf = stream->alloc(totalSize);
9705 	ptr = buf;
9706 	int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
9707 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9708 
9709 		memcpy(ptr, &program, 4); ptr += 4;
9710 		memcpy(ptr, &location, 4); ptr += 4;
9711 		memcpy(ptr, &count, 4); ptr += 4;
9712 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9713 	memcpy(ptr, value, __size_value);ptr += __size_value;
9714 
9715 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9716 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9717 
9718 }
9719 
glProgramUniform1iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9720 void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9721 {
9722 
9723 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9724 	IOStream *stream = ctx->m_stream;
9725 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9726 	bool useChecksum = checksumCalculator->getVersion() > 0;
9727 
9728 	const unsigned int __size_value =  (count * sizeof(GLint));
9729 	 unsigned char *ptr;
9730 	 unsigned char *buf;
9731 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9732 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9733 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9734 	buf = stream->alloc(totalSize);
9735 	ptr = buf;
9736 	int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
9737 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9738 
9739 		memcpy(ptr, &program, 4); ptr += 4;
9740 		memcpy(ptr, &location, 4); ptr += 4;
9741 		memcpy(ptr, &count, 4); ptr += 4;
9742 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9743 	memcpy(ptr, value, __size_value);ptr += __size_value;
9744 
9745 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9746 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9747 
9748 }
9749 
glProgramUniform2iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9750 void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9751 {
9752 
9753 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9754 	IOStream *stream = ctx->m_stream;
9755 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9756 	bool useChecksum = checksumCalculator->getVersion() > 0;
9757 
9758 	const unsigned int __size_value =  (count * 2 * sizeof(GLint));
9759 	 unsigned char *ptr;
9760 	 unsigned char *buf;
9761 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9762 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9763 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9764 	buf = stream->alloc(totalSize);
9765 	ptr = buf;
9766 	int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
9767 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9768 
9769 		memcpy(ptr, &program, 4); ptr += 4;
9770 		memcpy(ptr, &location, 4); ptr += 4;
9771 		memcpy(ptr, &count, 4); ptr += 4;
9772 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9773 	memcpy(ptr, value, __size_value);ptr += __size_value;
9774 
9775 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9776 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9777 
9778 }
9779 
glProgramUniform3iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9780 void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9781 {
9782 
9783 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9784 	IOStream *stream = ctx->m_stream;
9785 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9786 	bool useChecksum = checksumCalculator->getVersion() > 0;
9787 
9788 	const unsigned int __size_value =  (count * 3 * sizeof(GLint));
9789 	 unsigned char *ptr;
9790 	 unsigned char *buf;
9791 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9792 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9793 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9794 	buf = stream->alloc(totalSize);
9795 	ptr = buf;
9796 	int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
9797 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9798 
9799 		memcpy(ptr, &program, 4); ptr += 4;
9800 		memcpy(ptr, &location, 4); ptr += 4;
9801 		memcpy(ptr, &count, 4); ptr += 4;
9802 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9803 	memcpy(ptr, value, __size_value);ptr += __size_value;
9804 
9805 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9806 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9807 
9808 }
9809 
glProgramUniform4iv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLint * value)9810 void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9811 {
9812 
9813 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9814 	IOStream *stream = ctx->m_stream;
9815 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9816 	bool useChecksum = checksumCalculator->getVersion() > 0;
9817 
9818 	const unsigned int __size_value =  (count * 4 * sizeof(GLint));
9819 	 unsigned char *ptr;
9820 	 unsigned char *buf;
9821 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9822 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9823 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9824 	buf = stream->alloc(totalSize);
9825 	ptr = buf;
9826 	int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
9827 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9828 
9829 		memcpy(ptr, &program, 4); ptr += 4;
9830 		memcpy(ptr, &location, 4); ptr += 4;
9831 		memcpy(ptr, &count, 4); ptr += 4;
9832 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9833 	memcpy(ptr, value, __size_value);ptr += __size_value;
9834 
9835 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9836 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9837 
9838 }
9839 
glProgramUniform1uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9840 void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9841 {
9842 
9843 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9844 	IOStream *stream = ctx->m_stream;
9845 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9846 	bool useChecksum = checksumCalculator->getVersion() > 0;
9847 
9848 	const unsigned int __size_value =  (count * sizeof(GLuint));
9849 	 unsigned char *ptr;
9850 	 unsigned char *buf;
9851 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9852 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9853 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9854 	buf = stream->alloc(totalSize);
9855 	ptr = buf;
9856 	int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9857 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9858 
9859 		memcpy(ptr, &program, 4); ptr += 4;
9860 		memcpy(ptr, &location, 4); ptr += 4;
9861 		memcpy(ptr, &count, 4); ptr += 4;
9862 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9863 	memcpy(ptr, value, __size_value);ptr += __size_value;
9864 
9865 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9866 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9867 
9868 }
9869 
glProgramUniform2uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9870 void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9871 {
9872 
9873 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9874 	IOStream *stream = ctx->m_stream;
9875 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9876 	bool useChecksum = checksumCalculator->getVersion() > 0;
9877 
9878 	const unsigned int __size_value =  (count * 2 * sizeof(GLuint));
9879 	 unsigned char *ptr;
9880 	 unsigned char *buf;
9881 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9882 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9883 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9884 	buf = stream->alloc(totalSize);
9885 	ptr = buf;
9886 	int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9887 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9888 
9889 		memcpy(ptr, &program, 4); ptr += 4;
9890 		memcpy(ptr, &location, 4); ptr += 4;
9891 		memcpy(ptr, &count, 4); ptr += 4;
9892 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9893 	memcpy(ptr, value, __size_value);ptr += __size_value;
9894 
9895 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9896 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9897 
9898 }
9899 
glProgramUniform3uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9900 void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9901 {
9902 
9903 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9904 	IOStream *stream = ctx->m_stream;
9905 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9906 	bool useChecksum = checksumCalculator->getVersion() > 0;
9907 
9908 	const unsigned int __size_value =  (count * 3 * sizeof(GLuint));
9909 	 unsigned char *ptr;
9910 	 unsigned char *buf;
9911 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9912 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9913 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9914 	buf = stream->alloc(totalSize);
9915 	ptr = buf;
9916 	int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9917 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9918 
9919 		memcpy(ptr, &program, 4); ptr += 4;
9920 		memcpy(ptr, &location, 4); ptr += 4;
9921 		memcpy(ptr, &count, 4); ptr += 4;
9922 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9923 	memcpy(ptr, value, __size_value);ptr += __size_value;
9924 
9925 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9926 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9927 
9928 }
9929 
glProgramUniform4uiv_enc(void * self,GLuint program,GLint location,GLsizei count,const GLuint * value)9930 void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9931 {
9932 
9933 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9934 	IOStream *stream = ctx->m_stream;
9935 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9936 	bool useChecksum = checksumCalculator->getVersion() > 0;
9937 
9938 	const unsigned int __size_value =  (count * 4 * sizeof(GLuint));
9939 	 unsigned char *ptr;
9940 	 unsigned char *buf;
9941 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9942 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9943 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9944 	buf = stream->alloc(totalSize);
9945 	ptr = buf;
9946 	int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9947 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9948 
9949 		memcpy(ptr, &program, 4); ptr += 4;
9950 		memcpy(ptr, &location, 4); ptr += 4;
9951 		memcpy(ptr, &count, 4); ptr += 4;
9952 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9953 	memcpy(ptr, value, __size_value);ptr += __size_value;
9954 
9955 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9956 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9957 
9958 }
9959 
glProgramUniformMatrix2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9960 void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9961 {
9962 
9963 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9964 	IOStream *stream = ctx->m_stream;
9965 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9966 	bool useChecksum = checksumCalculator->getVersion() > 0;
9967 
9968 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
9969 	 unsigned char *ptr;
9970 	 unsigned char *buf;
9971 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
9972 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
9973 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9974 	buf = stream->alloc(totalSize);
9975 	ptr = buf;
9976 	int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9977 	memcpy(ptr, &totalSize, 4);  ptr += 4;
9978 
9979 		memcpy(ptr, &program, 4); ptr += 4;
9980 		memcpy(ptr, &location, 4); ptr += 4;
9981 		memcpy(ptr, &count, 4); ptr += 4;
9982 		memcpy(ptr, &transpose, 1); ptr += 1;
9983 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
9984 	memcpy(ptr, value, __size_value);ptr += __size_value;
9985 
9986 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9987 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9988 
9989 }
9990 
glProgramUniformMatrix3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)9991 void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9992 {
9993 
9994 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9995 	IOStream *stream = ctx->m_stream;
9996 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9997 	bool useChecksum = checksumCalculator->getVersion() > 0;
9998 
9999 	const unsigned int __size_value =  (count * 9 * sizeof(GLfloat));
10000 	 unsigned char *ptr;
10001 	 unsigned char *buf;
10002 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10003 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10004 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10005 	buf = stream->alloc(totalSize);
10006 	ptr = buf;
10007 	int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10008 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10009 
10010 		memcpy(ptr, &program, 4); ptr += 4;
10011 		memcpy(ptr, &location, 4); ptr += 4;
10012 		memcpy(ptr, &count, 4); ptr += 4;
10013 		memcpy(ptr, &transpose, 1); ptr += 1;
10014 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10015 	memcpy(ptr, value, __size_value);ptr += __size_value;
10016 
10017 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10018 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10019 
10020 }
10021 
glProgramUniformMatrix4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10022 void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10023 {
10024 
10025 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10026 	IOStream *stream = ctx->m_stream;
10027 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10028 	bool useChecksum = checksumCalculator->getVersion() > 0;
10029 
10030 	const unsigned int __size_value =  (count * 16 * sizeof(GLfloat));
10031 	 unsigned char *ptr;
10032 	 unsigned char *buf;
10033 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10034 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10035 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10036 	buf = stream->alloc(totalSize);
10037 	ptr = buf;
10038 	int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10039 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10040 
10041 		memcpy(ptr, &program, 4); ptr += 4;
10042 		memcpy(ptr, &location, 4); ptr += 4;
10043 		memcpy(ptr, &count, 4); ptr += 4;
10044 		memcpy(ptr, &transpose, 1); ptr += 1;
10045 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10046 	memcpy(ptr, value, __size_value);ptr += __size_value;
10047 
10048 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10049 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10050 
10051 }
10052 
glProgramUniformMatrix2x3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10053 void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10054 {
10055 
10056 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10057 	IOStream *stream = ctx->m_stream;
10058 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10059 	bool useChecksum = checksumCalculator->getVersion() > 0;
10060 
10061 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
10062 	 unsigned char *ptr;
10063 	 unsigned char *buf;
10064 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10065 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10066 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10067 	buf = stream->alloc(totalSize);
10068 	ptr = buf;
10069 	int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10070 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10071 
10072 		memcpy(ptr, &program, 4); ptr += 4;
10073 		memcpy(ptr, &location, 4); ptr += 4;
10074 		memcpy(ptr, &count, 4); ptr += 4;
10075 		memcpy(ptr, &transpose, 1); ptr += 1;
10076 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10077 	memcpy(ptr, value, __size_value);ptr += __size_value;
10078 
10079 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10080 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10081 
10082 }
10083 
glProgramUniformMatrix3x2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10084 void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10085 {
10086 
10087 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10088 	IOStream *stream = ctx->m_stream;
10089 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10090 	bool useChecksum = checksumCalculator->getVersion() > 0;
10091 
10092 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
10093 	 unsigned char *ptr;
10094 	 unsigned char *buf;
10095 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10096 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10097 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10098 	buf = stream->alloc(totalSize);
10099 	ptr = buf;
10100 	int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10101 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10102 
10103 		memcpy(ptr, &program, 4); ptr += 4;
10104 		memcpy(ptr, &location, 4); ptr += 4;
10105 		memcpy(ptr, &count, 4); ptr += 4;
10106 		memcpy(ptr, &transpose, 1); ptr += 1;
10107 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10108 	memcpy(ptr, value, __size_value);ptr += __size_value;
10109 
10110 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10111 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10112 
10113 }
10114 
glProgramUniformMatrix2x4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10115 void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10116 {
10117 
10118 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10119 	IOStream *stream = ctx->m_stream;
10120 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10121 	bool useChecksum = checksumCalculator->getVersion() > 0;
10122 
10123 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
10124 	 unsigned char *ptr;
10125 	 unsigned char *buf;
10126 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10127 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10128 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10129 	buf = stream->alloc(totalSize);
10130 	ptr = buf;
10131 	int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10132 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10133 
10134 		memcpy(ptr, &program, 4); ptr += 4;
10135 		memcpy(ptr, &location, 4); ptr += 4;
10136 		memcpy(ptr, &count, 4); ptr += 4;
10137 		memcpy(ptr, &transpose, 1); ptr += 1;
10138 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10139 	memcpy(ptr, value, __size_value);ptr += __size_value;
10140 
10141 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10142 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10143 
10144 }
10145 
glProgramUniformMatrix4x2fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10146 void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10147 {
10148 
10149 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10150 	IOStream *stream = ctx->m_stream;
10151 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10152 	bool useChecksum = checksumCalculator->getVersion() > 0;
10153 
10154 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
10155 	 unsigned char *ptr;
10156 	 unsigned char *buf;
10157 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10158 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10159 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10160 	buf = stream->alloc(totalSize);
10161 	ptr = buf;
10162 	int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10163 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10164 
10165 		memcpy(ptr, &program, 4); ptr += 4;
10166 		memcpy(ptr, &location, 4); ptr += 4;
10167 		memcpy(ptr, &count, 4); ptr += 4;
10168 		memcpy(ptr, &transpose, 1); ptr += 1;
10169 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10170 	memcpy(ptr, value, __size_value);ptr += __size_value;
10171 
10172 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10173 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10174 
10175 }
10176 
glProgramUniformMatrix3x4fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10177 void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10178 {
10179 
10180 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10181 	IOStream *stream = ctx->m_stream;
10182 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10183 	bool useChecksum = checksumCalculator->getVersion() > 0;
10184 
10185 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
10186 	 unsigned char *ptr;
10187 	 unsigned char *buf;
10188 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10189 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10190 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10191 	buf = stream->alloc(totalSize);
10192 	ptr = buf;
10193 	int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10194 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10195 
10196 		memcpy(ptr, &program, 4); ptr += 4;
10197 		memcpy(ptr, &location, 4); ptr += 4;
10198 		memcpy(ptr, &count, 4); ptr += 4;
10199 		memcpy(ptr, &transpose, 1); ptr += 1;
10200 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10201 	memcpy(ptr, value, __size_value);ptr += __size_value;
10202 
10203 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10204 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10205 
10206 }
10207 
glProgramUniformMatrix4x3fv_enc(void * self,GLuint program,GLint location,GLsizei count,GLboolean transpose,const GLfloat * value)10208 void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10209 {
10210 
10211 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10212 	IOStream *stream = ctx->m_stream;
10213 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10214 	bool useChecksum = checksumCalculator->getVersion() > 0;
10215 
10216 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
10217 	 unsigned char *ptr;
10218 	 unsigned char *buf;
10219 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10220 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10221 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10222 	buf = stream->alloc(totalSize);
10223 	ptr = buf;
10224 	int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10225 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10226 
10227 		memcpy(ptr, &program, 4); ptr += 4;
10228 		memcpy(ptr, &location, 4); ptr += 4;
10229 		memcpy(ptr, &count, 4); ptr += 4;
10230 		memcpy(ptr, &transpose, 1); ptr += 1;
10231 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
10232 	memcpy(ptr, value, __size_value);ptr += __size_value;
10233 
10234 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10235 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10236 
10237 }
10238 
glGetProgramInterfaceiv_enc(void * self,GLuint program,GLenum programInterface,GLenum pname,GLint * params)10239 void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params)
10240 {
10241 
10242 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10243 	IOStream *stream = ctx->m_stream;
10244 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10245 	bool useChecksum = checksumCalculator->getVersion() > 0;
10246 
10247 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
10248 	 unsigned char *ptr;
10249 	 unsigned char *buf;
10250 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10251 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10252 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10253 	buf = stream->alloc(totalSize);
10254 	ptr = buf;
10255 	int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10256 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10257 
10258 		memcpy(ptr, &program, 4); ptr += 4;
10259 		memcpy(ptr, &programInterface, 4); ptr += 4;
10260 		memcpy(ptr, &pname, 4); ptr += 4;
10261 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
10262 
10263 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10264 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10265 
10266 	stream->readback(params, __size_params);
10267 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10268 	if (useChecksum) {
10269 		unsigned char *checksumBufPtr = NULL;
10270 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10271 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10272 		stream->readback(checksumBufPtr, checksumSize);
10273 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10274 			ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n");
10275 			abort();
10276 		}
10277 	}
10278 }
10279 
glGetProgramResourceiv_enc(void * self,GLuint program,GLenum programInterface,GLuint index,GLsizei propCount,const GLenum * props,GLsizei bufSize,GLsizei * length,GLint * params)10280 void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params)
10281 {
10282 
10283 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10284 	IOStream *stream = ctx->m_stream;
10285 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10286 	bool useChecksum = checksumCalculator->getVersion() > 0;
10287 
10288 	const unsigned int __size_props =  (propCount * sizeof(GLenum));
10289 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
10290 	const unsigned int __size_params =  (bufSize * sizeof(GLint));
10291 	 unsigned char *ptr;
10292 	 unsigned char *buf;
10293 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4;
10294 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10295 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10296 	buf = stream->alloc(totalSize);
10297 	ptr = buf;
10298 	int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10299 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10300 
10301 		memcpy(ptr, &program, 4); ptr += 4;
10302 		memcpy(ptr, &programInterface, 4); ptr += 4;
10303 		memcpy(ptr, &index, 4); ptr += 4;
10304 		memcpy(ptr, &propCount, 4); ptr += 4;
10305 	*(unsigned int *)(ptr) = __size_props; ptr += 4;
10306 	memcpy(ptr, props, __size_props);ptr += __size_props;
10307 		memcpy(ptr, &bufSize, 4); ptr += 4;
10308 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
10309 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
10310 
10311 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10312 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10313 
10314 	if (length != NULL) {
10315 		stream->readback(length, __size_length);
10316 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10317 	}
10318 	stream->readback(params, __size_params);
10319 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10320 	if (useChecksum) {
10321 		unsigned char *checksumBufPtr = NULL;
10322 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10323 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10324 		stream->readback(checksumBufPtr, checksumSize);
10325 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10326 			ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n");
10327 			abort();
10328 		}
10329 	}
10330 }
10331 
glGetProgramResourceIndex_enc(void * self,GLuint program,GLenum programInterface,const char * name)10332 GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10333 {
10334 
10335 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10336 	IOStream *stream = ctx->m_stream;
10337 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10338 	bool useChecksum = checksumCalculator->getVersion() > 0;
10339 
10340 	const unsigned int __size_name =  (strlen(name) + 1);
10341 	 unsigned char *ptr;
10342 	 unsigned char *buf;
10343 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10344 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10345 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10346 	buf = stream->alloc(totalSize);
10347 	ptr = buf;
10348 	int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4;
10349 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10350 
10351 		memcpy(ptr, &program, 4); ptr += 4;
10352 		memcpy(ptr, &programInterface, 4); ptr += 4;
10353 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
10354 	memcpy(ptr, name, __size_name);ptr += __size_name;
10355 
10356 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10357 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10358 
10359 
10360 	GLuint retval;
10361 	stream->readback(&retval, 4);
10362 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10363 	if (useChecksum) {
10364 		unsigned char *checksumBufPtr = NULL;
10365 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10366 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10367 		stream->readback(checksumBufPtr, checksumSize);
10368 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10369 			ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n");
10370 			abort();
10371 		}
10372 	}
10373 	return retval;
10374 }
10375 
glGetProgramResourceLocation_enc(void * self,GLuint program,GLenum programInterface,const char * name)10376 GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10377 {
10378 
10379 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10380 	IOStream *stream = ctx->m_stream;
10381 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10382 	bool useChecksum = checksumCalculator->getVersion() > 0;
10383 
10384 	const unsigned int __size_name =  (strlen(name) + 1);
10385 	 unsigned char *ptr;
10386 	 unsigned char *buf;
10387 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10388 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10389 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10390 	buf = stream->alloc(totalSize);
10391 	ptr = buf;
10392 	int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4;
10393 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10394 
10395 		memcpy(ptr, &program, 4); ptr += 4;
10396 		memcpy(ptr, &programInterface, 4); ptr += 4;
10397 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
10398 	memcpy(ptr, name, __size_name);ptr += __size_name;
10399 
10400 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10401 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10402 
10403 
10404 	GLint retval;
10405 	stream->readback(&retval, 4);
10406 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10407 	if (useChecksum) {
10408 		unsigned char *checksumBufPtr = NULL;
10409 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10410 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10411 		stream->readback(checksumBufPtr, checksumSize);
10412 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10413 			ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n");
10414 			abort();
10415 		}
10416 	}
10417 	return retval;
10418 }
10419 
glGetProgramResourceName_enc(void * self,GLuint program,GLenum programInterface,GLuint index,GLsizei bufSize,GLsizei * length,char * name)10420 void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name)
10421 {
10422 
10423 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10424 	IOStream *stream = ctx->m_stream;
10425 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10426 	bool useChecksum = checksumCalculator->getVersion() > 0;
10427 
10428 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
10429 	const unsigned int __size_name =  bufSize;
10430 	 unsigned char *ptr;
10431 	 unsigned char *buf;
10432 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4;
10433 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10434 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10435 	buf = stream->alloc(totalSize);
10436 	ptr = buf;
10437 	int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4;
10438 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10439 
10440 		memcpy(ptr, &program, 4); ptr += 4;
10441 		memcpy(ptr, &programInterface, 4); ptr += 4;
10442 		memcpy(ptr, &index, 4); ptr += 4;
10443 		memcpy(ptr, &bufSize, 4); ptr += 4;
10444 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
10445 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
10446 
10447 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10448 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10449 
10450 	if (length != NULL) {
10451 		stream->readback(length, __size_length);
10452 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10453 	}
10454 	stream->readback(name, __size_name);
10455 	if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
10456 	if (useChecksum) {
10457 		unsigned char *checksumBufPtr = NULL;
10458 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10459 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10460 		stream->readback(checksumBufPtr, checksumSize);
10461 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10462 			ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n");
10463 			abort();
10464 		}
10465 	}
10466 }
10467 
glBindImageTexture_enc(void * self,GLuint unit,GLuint texture,GLint level,GLboolean layered,GLint layer,GLenum access,GLenum format)10468 void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
10469 {
10470 
10471 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10472 	IOStream *stream = ctx->m_stream;
10473 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10474 	bool useChecksum = checksumCalculator->getVersion() > 0;
10475 
10476 	 unsigned char *ptr;
10477 	 unsigned char *buf;
10478 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4;
10479 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10480 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10481 	buf = stream->alloc(totalSize);
10482 	ptr = buf;
10483 	int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4;
10484 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10485 
10486 		memcpy(ptr, &unit, 4); ptr += 4;
10487 		memcpy(ptr, &texture, 4); ptr += 4;
10488 		memcpy(ptr, &level, 4); ptr += 4;
10489 		memcpy(ptr, &layered, 1); ptr += 1;
10490 		memcpy(ptr, &layer, 4); ptr += 4;
10491 		memcpy(ptr, &access, 4); ptr += 4;
10492 		memcpy(ptr, &format, 4); ptr += 4;
10493 
10494 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10495 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10496 
10497 }
10498 
glDispatchCompute_enc(void * self,GLuint num_groups_x,GLuint num_groups_y,GLuint num_groups_z)10499 void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
10500 {
10501 
10502 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10503 	IOStream *stream = ctx->m_stream;
10504 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10505 	bool useChecksum = checksumCalculator->getVersion() > 0;
10506 
10507 	 unsigned char *ptr;
10508 	 unsigned char *buf;
10509 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10510 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10511 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10512 	buf = stream->alloc(totalSize);
10513 	ptr = buf;
10514 	int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4;
10515 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10516 
10517 		memcpy(ptr, &num_groups_x, 4); ptr += 4;
10518 		memcpy(ptr, &num_groups_y, 4); ptr += 4;
10519 		memcpy(ptr, &num_groups_z, 4); ptr += 4;
10520 
10521 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10522 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10523 
10524 }
10525 
glDispatchComputeIndirect_enc(void * self,GLintptr indirect)10526 void glDispatchComputeIndirect_enc(void *self , GLintptr indirect)
10527 {
10528 
10529 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10530 	IOStream *stream = ctx->m_stream;
10531 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10532 	bool useChecksum = checksumCalculator->getVersion() > 0;
10533 
10534 	 unsigned char *ptr;
10535 	 unsigned char *buf;
10536 	 const size_t sizeWithoutChecksum = 8 + 4;
10537 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10538 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10539 	buf = stream->alloc(totalSize);
10540 	ptr = buf;
10541 	int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4;
10542 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10543 
10544 		memcpy(ptr, &indirect, 4); ptr += 4;
10545 
10546 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10547 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10548 
10549 }
10550 
glBindVertexBuffer_enc(void * self,GLuint bindingindex,GLuint buffer,GLintptr offset,GLintptr stride)10551 void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride)
10552 {
10553 
10554 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10555 	IOStream *stream = ctx->m_stream;
10556 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10557 	bool useChecksum = checksumCalculator->getVersion() > 0;
10558 
10559 	 unsigned char *ptr;
10560 	 unsigned char *buf;
10561 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10562 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10563 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10564 	buf = stream->alloc(totalSize);
10565 	ptr = buf;
10566 	int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
10567 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10568 
10569 		memcpy(ptr, &bindingindex, 4); ptr += 4;
10570 		memcpy(ptr, &buffer, 4); ptr += 4;
10571 		memcpy(ptr, &offset, 4); ptr += 4;
10572 		memcpy(ptr, &stride, 4); ptr += 4;
10573 
10574 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10575 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10576 
10577 }
10578 
glVertexAttribBinding_enc(void * self,GLuint attribindex,GLuint bindingindex)10579 void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex)
10580 {
10581 
10582 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10583 	IOStream *stream = ctx->m_stream;
10584 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10585 	bool useChecksum = checksumCalculator->getVersion() > 0;
10586 
10587 	 unsigned char *ptr;
10588 	 unsigned char *buf;
10589 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10590 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10591 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10592 	buf = stream->alloc(totalSize);
10593 	ptr = buf;
10594 	int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4;
10595 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10596 
10597 		memcpy(ptr, &attribindex, 4); ptr += 4;
10598 		memcpy(ptr, &bindingindex, 4); ptr += 4;
10599 
10600 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10601 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10602 
10603 }
10604 
glVertexAttribFormat_enc(void * self,GLuint attribindex,GLint size,GLenum type,GLboolean normalized,GLuint relativeoffset)10605 void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
10606 {
10607 
10608 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10609 	IOStream *stream = ctx->m_stream;
10610 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10611 	bool useChecksum = checksumCalculator->getVersion() > 0;
10612 
10613 	 unsigned char *ptr;
10614 	 unsigned char *buf;
10615 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4;
10616 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10617 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10618 	buf = stream->alloc(totalSize);
10619 	ptr = buf;
10620 	int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10621 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10622 
10623 		memcpy(ptr, &attribindex, 4); ptr += 4;
10624 		memcpy(ptr, &size, 4); ptr += 4;
10625 		memcpy(ptr, &type, 4); ptr += 4;
10626 		memcpy(ptr, &normalized, 1); ptr += 1;
10627 		memcpy(ptr, &relativeoffset, 4); ptr += 4;
10628 
10629 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10630 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10631 
10632 }
10633 
glVertexAttribIFormat_enc(void * self,GLuint attribindex,GLint size,GLenum type,GLuint relativeoffset)10634 void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
10635 {
10636 
10637 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10638 	IOStream *stream = ctx->m_stream;
10639 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10640 	bool useChecksum = checksumCalculator->getVersion() > 0;
10641 
10642 	 unsigned char *ptr;
10643 	 unsigned char *buf;
10644 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10645 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10646 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10647 	buf = stream->alloc(totalSize);
10648 	ptr = buf;
10649 	int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10650 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10651 
10652 		memcpy(ptr, &attribindex, 4); ptr += 4;
10653 		memcpy(ptr, &size, 4); ptr += 4;
10654 		memcpy(ptr, &type, 4); ptr += 4;
10655 		memcpy(ptr, &relativeoffset, 4); ptr += 4;
10656 
10657 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10658 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10659 
10660 }
10661 
glVertexBindingDivisor_enc(void * self,GLuint bindingindex,GLuint divisor)10662 void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor)
10663 {
10664 
10665 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10666 	IOStream *stream = ctx->m_stream;
10667 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10668 	bool useChecksum = checksumCalculator->getVersion() > 0;
10669 
10670 	 unsigned char *ptr;
10671 	 unsigned char *buf;
10672 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10673 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10674 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10675 	buf = stream->alloc(totalSize);
10676 	ptr = buf;
10677 	int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
10678 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10679 
10680 		memcpy(ptr, &bindingindex, 4); ptr += 4;
10681 		memcpy(ptr, &divisor, 4); ptr += 4;
10682 
10683 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10684 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10685 
10686 }
10687 
glDrawArraysIndirectDataAEMU_enc(void * self,GLenum mode,const void * indirect,GLuint datalen)10688 void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen)
10689 {
10690 
10691 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10692 	IOStream *stream = ctx->m_stream;
10693 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10694 	bool useChecksum = checksumCalculator->getVersion() > 0;
10695 
10696 	const unsigned int __size_indirect =  datalen;
10697 	 unsigned char *ptr;
10698 	 unsigned char *buf;
10699 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4;
10700 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10701 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10702 	buf = stream->alloc(totalSize);
10703 	ptr = buf;
10704 	int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10705 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10706 
10707 		memcpy(ptr, &mode, 4); ptr += 4;
10708 	*(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10709 	memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10710 		memcpy(ptr, &datalen, 4); ptr += 4;
10711 
10712 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10713 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10714 
10715 }
10716 
glDrawArraysIndirectOffsetAEMU_enc(void * self,GLenum mode,GLuint offset)10717 void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset)
10718 {
10719 
10720 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10721 	IOStream *stream = ctx->m_stream;
10722 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10723 	bool useChecksum = checksumCalculator->getVersion() > 0;
10724 
10725 	 unsigned char *ptr;
10726 	 unsigned char *buf;
10727 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10728 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10729 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10730 	buf = stream->alloc(totalSize);
10731 	ptr = buf;
10732 	int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10733 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10734 
10735 		memcpy(ptr, &mode, 4); ptr += 4;
10736 		memcpy(ptr, &offset, 4); ptr += 4;
10737 
10738 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10739 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10740 
10741 }
10742 
glDrawElementsIndirectDataAEMU_enc(void * self,GLenum mode,GLenum type,const void * indirect,GLuint datalen)10743 void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen)
10744 {
10745 
10746 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10747 	IOStream *stream = ctx->m_stream;
10748 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10749 	bool useChecksum = checksumCalculator->getVersion() > 0;
10750 
10751 	const unsigned int __size_indirect =  datalen;
10752 	 unsigned char *ptr;
10753 	 unsigned char *buf;
10754 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4;
10755 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10756 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10757 	buf = stream->alloc(totalSize);
10758 	ptr = buf;
10759 	int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10760 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10761 
10762 		memcpy(ptr, &mode, 4); ptr += 4;
10763 		memcpy(ptr, &type, 4); ptr += 4;
10764 	*(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10765 	memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10766 		memcpy(ptr, &datalen, 4); ptr += 4;
10767 
10768 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10769 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10770 
10771 }
10772 
glDrawElementsIndirectOffsetAEMU_enc(void * self,GLenum mode,GLenum type,GLuint offset)10773 void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset)
10774 {
10775 
10776 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10777 	IOStream *stream = ctx->m_stream;
10778 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10779 	bool useChecksum = checksumCalculator->getVersion() > 0;
10780 
10781 	 unsigned char *ptr;
10782 	 unsigned char *buf;
10783 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10784 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10785 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10786 	buf = stream->alloc(totalSize);
10787 	ptr = buf;
10788 	int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10789 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10790 
10791 		memcpy(ptr, &mode, 4); ptr += 4;
10792 		memcpy(ptr, &type, 4); ptr += 4;
10793 		memcpy(ptr, &offset, 4); ptr += 4;
10794 
10795 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10796 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10797 
10798 }
10799 
glTexStorage2DMultisample_enc(void * self,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLboolean fixedsamplelocations)10800 void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
10801 {
10802 
10803 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10804 	IOStream *stream = ctx->m_stream;
10805 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10806 	bool useChecksum = checksumCalculator->getVersion() > 0;
10807 
10808 	 unsigned char *ptr;
10809 	 unsigned char *buf;
10810 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1;
10811 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10812 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10813 	buf = stream->alloc(totalSize);
10814 	ptr = buf;
10815 	int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
10816 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10817 
10818 		memcpy(ptr, &target, 4); ptr += 4;
10819 		memcpy(ptr, &samples, 4); ptr += 4;
10820 		memcpy(ptr, &internalformat, 4); ptr += 4;
10821 		memcpy(ptr, &width, 4); ptr += 4;
10822 		memcpy(ptr, &height, 4); ptr += 4;
10823 		memcpy(ptr, &fixedsamplelocations, 1); ptr += 1;
10824 
10825 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10826 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10827 
10828 }
10829 
glSampleMaski_enc(void * self,GLuint maskNumber,GLbitfield mask)10830 void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask)
10831 {
10832 
10833 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10834 	IOStream *stream = ctx->m_stream;
10835 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10836 	bool useChecksum = checksumCalculator->getVersion() > 0;
10837 
10838 	 unsigned char *ptr;
10839 	 unsigned char *buf;
10840 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10841 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10842 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10843 	buf = stream->alloc(totalSize);
10844 	ptr = buf;
10845 	int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4;
10846 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10847 
10848 		memcpy(ptr, &maskNumber, 4); ptr += 4;
10849 		memcpy(ptr, &mask, 4); ptr += 4;
10850 
10851 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10852 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10853 
10854 }
10855 
glGetMultisamplefv_enc(void * self,GLenum pname,GLuint index,GLfloat * val)10856 void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val)
10857 {
10858 
10859 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10860 	IOStream *stream = ctx->m_stream;
10861 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10862 	bool useChecksum = checksumCalculator->getVersion() > 0;
10863 
10864 	const unsigned int __size_val =  (glUtilsParamSize(pname) * sizeof(GLfloat));
10865 	 unsigned char *ptr;
10866 	 unsigned char *buf;
10867 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10868 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10869 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10870 	buf = stream->alloc(totalSize);
10871 	ptr = buf;
10872 	int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4;
10873 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10874 
10875 		memcpy(ptr, &pname, 4); ptr += 4;
10876 		memcpy(ptr, &index, 4); ptr += 4;
10877 	*(unsigned int *)(ptr) = __size_val; ptr += 4;
10878 
10879 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10880 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10881 
10882 	stream->readback(val, __size_val);
10883 	if (useChecksum) checksumCalculator->addBuffer(val, __size_val);
10884 	if (useChecksum) {
10885 		unsigned char *checksumBufPtr = NULL;
10886 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10887 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10888 		stream->readback(checksumBufPtr, checksumSize);
10889 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10890 			ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n");
10891 			abort();
10892 		}
10893 	}
10894 }
10895 
glFramebufferParameteri_enc(void * self,GLenum target,GLenum pname,GLint param)10896 void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
10897 {
10898 
10899 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10900 	IOStream *stream = ctx->m_stream;
10901 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10902 	bool useChecksum = checksumCalculator->getVersion() > 0;
10903 
10904 	 unsigned char *ptr;
10905 	 unsigned char *buf;
10906 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10907 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10908 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10909 	buf = stream->alloc(totalSize);
10910 	ptr = buf;
10911 	int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
10912 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10913 
10914 		memcpy(ptr, &target, 4); ptr += 4;
10915 		memcpy(ptr, &pname, 4); ptr += 4;
10916 		memcpy(ptr, &param, 4); ptr += 4;
10917 
10918 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10919 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10920 
10921 }
10922 
glGetFramebufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)10923 void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
10924 {
10925 
10926 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10927 	IOStream *stream = ctx->m_stream;
10928 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10929 	bool useChecksum = checksumCalculator->getVersion() > 0;
10930 
10931 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
10932 	 unsigned char *ptr;
10933 	 unsigned char *buf;
10934 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10935 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10936 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10937 	buf = stream->alloc(totalSize);
10938 	ptr = buf;
10939 	int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
10940 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10941 
10942 		memcpy(ptr, &target, 4); ptr += 4;
10943 		memcpy(ptr, &pname, 4); ptr += 4;
10944 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
10945 
10946 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10947 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10948 
10949 	stream->readback(params, __size_params);
10950 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10951 	if (useChecksum) {
10952 		unsigned char *checksumBufPtr = NULL;
10953 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10954 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10955 		stream->readback(checksumBufPtr, checksumSize);
10956 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10957 			ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
10958 			abort();
10959 		}
10960 	}
10961 }
10962 
glGetTexLevelParameterfv_enc(void * self,GLenum target,GLint level,GLenum pname,GLfloat * params)10963 void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params)
10964 {
10965 
10966 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10967 	IOStream *stream = ctx->m_stream;
10968 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10969 	bool useChecksum = checksumCalculator->getVersion() > 0;
10970 
10971 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
10972 	 unsigned char *ptr;
10973 	 unsigned char *buf;
10974 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10975 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
10976 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10977 	buf = stream->alloc(totalSize);
10978 	ptr = buf;
10979 	int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
10980 	memcpy(ptr, &totalSize, 4);  ptr += 4;
10981 
10982 		memcpy(ptr, &target, 4); ptr += 4;
10983 		memcpy(ptr, &level, 4); ptr += 4;
10984 		memcpy(ptr, &pname, 4); ptr += 4;
10985 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
10986 
10987 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10988 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10989 
10990 	stream->readback(params, __size_params);
10991 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10992 	if (useChecksum) {
10993 		unsigned char *checksumBufPtr = NULL;
10994 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10995 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10996 		stream->readback(checksumBufPtr, checksumSize);
10997 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10998 			ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n");
10999 			abort();
11000 		}
11001 	}
11002 }
11003 
glGetTexLevelParameteriv_enc(void * self,GLenum target,GLint level,GLenum pname,GLint * params)11004 void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params)
11005 {
11006 
11007 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11008 	IOStream *stream = ctx->m_stream;
11009 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11010 	bool useChecksum = checksumCalculator->getVersion() > 0;
11011 
11012 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
11013 	 unsigned char *ptr;
11014 	 unsigned char *buf;
11015 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11016 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11017 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11018 	buf = stream->alloc(totalSize);
11019 	ptr = buf;
11020 	int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
11021 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11022 
11023 		memcpy(ptr, &target, 4); ptr += 4;
11024 		memcpy(ptr, &level, 4); ptr += 4;
11025 		memcpy(ptr, &pname, 4); ptr += 4;
11026 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
11027 
11028 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11029 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11030 
11031 	stream->readback(params, __size_params);
11032 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11033 	if (useChecksum) {
11034 		unsigned char *checksumBufPtr = NULL;
11035 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11036 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11037 		stream->readback(checksumBufPtr, checksumSize);
11038 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11039 			ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n");
11040 			abort();
11041 		}
11042 	}
11043 }
11044 
glMapBufferRangeDMA_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,uint64_t paddr)11045 void glMapBufferRangeDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr)
11046 {
11047 
11048 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11049 	IOStream *stream = ctx->m_stream;
11050 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11051 	bool useChecksum = checksumCalculator->getVersion() > 0;
11052 
11053 	 unsigned char *ptr;
11054 	 unsigned char *buf;
11055 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8;
11056 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11057 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11058 	buf = stream->alloc(totalSize);
11059 	ptr = buf;
11060 	int tmp = OP_glMapBufferRangeDMA;memcpy(ptr, &tmp, 4); ptr += 4;
11061 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11062 
11063 		memcpy(ptr, &target, 4); ptr += 4;
11064 		memcpy(ptr, &offset, 4); ptr += 4;
11065 		memcpy(ptr, &length, 4); ptr += 4;
11066 		memcpy(ptr, &access, 4); ptr += 4;
11067 		memcpy(ptr, &paddr, 8); ptr += 8;
11068 
11069 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11070 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11071 
11072 }
11073 
glUnmapBufferDMA_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,uint64_t paddr,GLboolean * out_res)11074 void glUnmapBufferDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, GLboolean* out_res)
11075 {
11076 
11077 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11078 	IOStream *stream = ctx->m_stream;
11079 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11080 	bool useChecksum = checksumCalculator->getVersion() > 0;
11081 
11082 	const unsigned int __size_out_res =  (sizeof(GLboolean));
11083 	 unsigned char *ptr;
11084 	 unsigned char *buf;
11085 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 0 + 1*4;
11086 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11087 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11088 	buf = stream->alloc(totalSize);
11089 	ptr = buf;
11090 	int tmp = OP_glUnmapBufferDMA;memcpy(ptr, &tmp, 4); ptr += 4;
11091 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11092 
11093 		memcpy(ptr, &target, 4); ptr += 4;
11094 		memcpy(ptr, &offset, 4); ptr += 4;
11095 		memcpy(ptr, &length, 4); ptr += 4;
11096 		memcpy(ptr, &access, 4); ptr += 4;
11097 		memcpy(ptr, &paddr, 8); ptr += 8;
11098 	*(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11099 
11100 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11101 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11102 
11103 	stream->readback(out_res, __size_out_res);
11104 	if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
11105 	if (useChecksum) {
11106 		unsigned char *checksumBufPtr = NULL;
11107 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11108 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11109 		stream->readback(checksumBufPtr, checksumSize);
11110 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11111 			ALOGE("glUnmapBufferDMA: GL communication error, please report this issue to b.android.com.\n");
11112 			abort();
11113 		}
11114 	}
11115 }
11116 
glMapBufferRangeDirect_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,uint64_t paddr)11117 uint64_t glMapBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr)
11118 {
11119 
11120 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11121 	IOStream *stream = ctx->m_stream;
11122 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11123 	bool useChecksum = checksumCalculator->getVersion() > 0;
11124 
11125 	 unsigned char *ptr;
11126 	 unsigned char *buf;
11127 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8;
11128 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11129 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11130 	buf = stream->alloc(totalSize);
11131 	ptr = buf;
11132 	int tmp = OP_glMapBufferRangeDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11133 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11134 
11135 		memcpy(ptr, &target, 4); ptr += 4;
11136 		memcpy(ptr, &offset, 4); ptr += 4;
11137 		memcpy(ptr, &length, 4); ptr += 4;
11138 		memcpy(ptr, &access, 4); ptr += 4;
11139 		memcpy(ptr, &paddr, 8); ptr += 8;
11140 
11141 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11142 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11143 
11144 
11145 	uint64_t retval;
11146 	stream->readback(&retval, 8);
11147 	if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
11148 	if (useChecksum) {
11149 		unsigned char *checksumBufPtr = NULL;
11150 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11151 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11152 		stream->readback(checksumBufPtr, checksumSize);
11153 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11154 			ALOGE("glMapBufferRangeDirect: GL communication error, please report this issue to b.android.com.\n");
11155 			abort();
11156 		}
11157 	}
11158 	return retval;
11159 }
11160 
glUnmapBufferDirect_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,uint64_t paddr,uint64_t guest_ptr,GLboolean * out_res)11161 void glUnmapBufferDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, uint64_t guest_ptr, GLboolean* out_res)
11162 {
11163 
11164 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11165 	IOStream *stream = ctx->m_stream;
11166 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11167 	bool useChecksum = checksumCalculator->getVersion() > 0;
11168 
11169 	const unsigned int __size_out_res =  (sizeof(GLboolean));
11170 	 unsigned char *ptr;
11171 	 unsigned char *buf;
11172 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 8 + 0 + 1*4;
11173 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11174 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11175 	buf = stream->alloc(totalSize);
11176 	ptr = buf;
11177 	int tmp = OP_glUnmapBufferDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11178 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11179 
11180 		memcpy(ptr, &target, 4); ptr += 4;
11181 		memcpy(ptr, &offset, 4); ptr += 4;
11182 		memcpy(ptr, &length, 4); ptr += 4;
11183 		memcpy(ptr, &access, 4); ptr += 4;
11184 		memcpy(ptr, &paddr, 8); ptr += 8;
11185 		memcpy(ptr, &guest_ptr, 8); ptr += 8;
11186 	*(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11187 
11188 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11189 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11190 
11191 	stream->readback(out_res, __size_out_res);
11192 	if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
11193 	if (useChecksum) {
11194 		unsigned char *checksumBufPtr = NULL;
11195 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11196 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11197 		stream->readback(checksumBufPtr, checksumSize);
11198 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11199 			ALOGE("glUnmapBufferDirect: GL communication error, please report this issue to b.android.com.\n");
11200 			abort();
11201 		}
11202 	}
11203 }
11204 
glFlushMappedBufferRangeDirect_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access)11205 void glFlushMappedBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
11206 {
11207 
11208 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11209 	IOStream *stream = ctx->m_stream;
11210 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11211 	bool useChecksum = checksumCalculator->getVersion() > 0;
11212 
11213 	 unsigned char *ptr;
11214 	 unsigned char *buf;
11215 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
11216 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11217 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11218 	buf = stream->alloc(totalSize);
11219 	ptr = buf;
11220 	int tmp = OP_glFlushMappedBufferRangeDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11221 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11222 
11223 		memcpy(ptr, &target, 4); ptr += 4;
11224 		memcpy(ptr, &offset, 4); ptr += 4;
11225 		memcpy(ptr, &length, 4); ptr += 4;
11226 		memcpy(ptr, &access, 4); ptr += 4;
11227 
11228 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11229 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11230 
11231 }
11232 
glGetGraphicsResetStatusEXT_enc(void * self)11233 GLenum glGetGraphicsResetStatusEXT_enc(void *self )
11234 {
11235 
11236 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11237 	IOStream *stream = ctx->m_stream;
11238 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11239 	bool useChecksum = checksumCalculator->getVersion() > 0;
11240 
11241 	 unsigned char *ptr;
11242 	 unsigned char *buf;
11243 	 const size_t sizeWithoutChecksum = 8;
11244 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11245 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11246 	buf = stream->alloc(totalSize);
11247 	ptr = buf;
11248 	int tmp = OP_glGetGraphicsResetStatusEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11249 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11250 
11251 
11252 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11253 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11254 
11255 
11256 	GLenum retval;
11257 	stream->readback(&retval, 4);
11258 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
11259 	if (useChecksum) {
11260 		unsigned char *checksumBufPtr = NULL;
11261 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11262 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11263 		stream->readback(checksumBufPtr, checksumSize);
11264 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11265 			ALOGE("glGetGraphicsResetStatusEXT: GL communication error, please report this issue to b.android.com.\n");
11266 			abort();
11267 		}
11268 	}
11269 	return retval;
11270 }
11271 
glReadnPixelsEXT_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,GLvoid * data)11272 void glReadnPixelsEXT_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid* data)
11273 {
11274 
11275 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11276 	IOStream *stream = ctx->m_stream;
11277 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11278 	bool useChecksum = checksumCalculator->getVersion() > 0;
11279 
11280 	const unsigned int __size_data =  bufSize;
11281 	 unsigned char *ptr;
11282 	 unsigned char *buf;
11283 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
11284 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11285 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11286 	buf = stream->alloc(totalSize);
11287 	ptr = buf;
11288 	int tmp = OP_glReadnPixelsEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11289 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11290 
11291 		memcpy(ptr, &x, 4); ptr += 4;
11292 		memcpy(ptr, &y, 4); ptr += 4;
11293 		memcpy(ptr, &width, 4); ptr += 4;
11294 		memcpy(ptr, &height, 4); ptr += 4;
11295 		memcpy(ptr, &format, 4); ptr += 4;
11296 		memcpy(ptr, &type, 4); ptr += 4;
11297 		memcpy(ptr, &bufSize, 4); ptr += 4;
11298 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
11299 
11300 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11301 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11302 
11303 	stream->readback(data, __size_data);
11304 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
11305 	if (useChecksum) {
11306 		unsigned char *checksumBufPtr = NULL;
11307 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11308 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11309 		stream->readback(checksumBufPtr, checksumSize);
11310 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11311 			ALOGE("glReadnPixelsEXT: GL communication error, please report this issue to b.android.com.\n");
11312 			abort();
11313 		}
11314 	}
11315 }
11316 
glGetnUniformfvEXT_enc(void * self,GLuint program,GLint location,GLsizei bufSize,GLfloat * params)11317 void glGetnUniformfvEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
11318 {
11319 
11320 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11321 	IOStream *stream = ctx->m_stream;
11322 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11323 	bool useChecksum = checksumCalculator->getVersion() > 0;
11324 
11325 	const unsigned int __size_params =  bufSize;
11326 	 unsigned char *ptr;
11327 	 unsigned char *buf;
11328 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11329 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11330 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11331 	buf = stream->alloc(totalSize);
11332 	ptr = buf;
11333 	int tmp = OP_glGetnUniformfvEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11334 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11335 
11336 		memcpy(ptr, &program, 4); ptr += 4;
11337 		memcpy(ptr, &location, 4); ptr += 4;
11338 		memcpy(ptr, &bufSize, 4); ptr += 4;
11339 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
11340 
11341 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11342 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11343 
11344 	stream->readback(params, __size_params);
11345 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11346 	if (useChecksum) {
11347 		unsigned char *checksumBufPtr = NULL;
11348 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11349 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11350 		stream->readback(checksumBufPtr, checksumSize);
11351 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11352 			ALOGE("glGetnUniformfvEXT: GL communication error, please report this issue to b.android.com.\n");
11353 			abort();
11354 		}
11355 	}
11356 }
11357 
glGetnUniformivEXT_enc(void * self,GLuint program,GLint location,GLsizei bufSize,GLint * params)11358 void glGetnUniformivEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLint* params)
11359 {
11360 
11361 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11362 	IOStream *stream = ctx->m_stream;
11363 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11364 	bool useChecksum = checksumCalculator->getVersion() > 0;
11365 
11366 	const unsigned int __size_params =  bufSize;
11367 	 unsigned char *ptr;
11368 	 unsigned char *buf;
11369 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11370 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11371 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11372 	buf = stream->alloc(totalSize);
11373 	ptr = buf;
11374 	int tmp = OP_glGetnUniformivEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11375 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11376 
11377 		memcpy(ptr, &program, 4); ptr += 4;
11378 		memcpy(ptr, &location, 4); ptr += 4;
11379 		memcpy(ptr, &bufSize, 4); ptr += 4;
11380 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
11381 
11382 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11383 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11384 
11385 	stream->readback(params, __size_params);
11386 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11387 	if (useChecksum) {
11388 		unsigned char *checksumBufPtr = NULL;
11389 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11390 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11391 		stream->readback(checksumBufPtr, checksumSize);
11392 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11393 			ALOGE("glGetnUniformivEXT: GL communication error, please report this issue to b.android.com.\n");
11394 			abort();
11395 		}
11396 	}
11397 }
11398 
glDrawArraysNullAEMU_enc(void * self,GLenum mode,GLint first,GLsizei count)11399 void glDrawArraysNullAEMU_enc(void *self , GLenum mode, GLint first, GLsizei count)
11400 {
11401 
11402 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11403 	IOStream *stream = ctx->m_stream;
11404 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11405 	bool useChecksum = checksumCalculator->getVersion() > 0;
11406 
11407 	 unsigned char *ptr;
11408 	 unsigned char *buf;
11409 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
11410 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11411 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11412 	buf = stream->alloc(totalSize);
11413 	ptr = buf;
11414 	int tmp = OP_glDrawArraysNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11415 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11416 
11417 		memcpy(ptr, &mode, 4); ptr += 4;
11418 		memcpy(ptr, &first, 4); ptr += 4;
11419 		memcpy(ptr, &count, 4); ptr += 4;
11420 
11421 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11422 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11423 
11424 }
11425 
glDrawElementsOffsetNullAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset)11426 void glDrawElementsOffsetNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
11427 {
11428 
11429 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11430 	IOStream *stream = ctx->m_stream;
11431 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11432 	bool useChecksum = checksumCalculator->getVersion() > 0;
11433 
11434 	 unsigned char *ptr;
11435 	 unsigned char *buf;
11436 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
11437 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11438 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11439 	buf = stream->alloc(totalSize);
11440 	ptr = buf;
11441 	int tmp = OP_glDrawElementsOffsetNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11442 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11443 
11444 		memcpy(ptr, &mode, 4); ptr += 4;
11445 		memcpy(ptr, &count, 4); ptr += 4;
11446 		memcpy(ptr, &type, 4); ptr += 4;
11447 		memcpy(ptr, &offset, 4); ptr += 4;
11448 
11449 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11450 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11451 
11452 }
11453 
glDrawElementsDataNullAEMU_enc(void * self,GLenum mode,GLsizei count,GLenum type,void * data,GLuint datalen)11454 void glDrawElementsDataNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
11455 {
11456 
11457 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11458 	IOStream *stream = ctx->m_stream;
11459 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11460 	bool useChecksum = checksumCalculator->getVersion() > 0;
11461 
11462 	const unsigned int __size_data =  datalen;
11463 	 unsigned char *ptr;
11464 	 unsigned char *buf;
11465 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
11466 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11467 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11468 	buf = stream->alloc(totalSize);
11469 	ptr = buf;
11470 	int tmp = OP_glDrawElementsDataNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11471 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11472 
11473 		memcpy(ptr, &mode, 4); ptr += 4;
11474 		memcpy(ptr, &count, 4); ptr += 4;
11475 		memcpy(ptr, &type, 4); ptr += 4;
11476 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
11477 	memcpy(ptr, data, __size_data);ptr += __size_data;
11478 		memcpy(ptr, &datalen, 4); ptr += 4;
11479 
11480 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11481 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11482 
11483 }
11484 
glUnmapBufferAsyncAEMU_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer,GLboolean * out_res)11485 void glUnmapBufferAsyncAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
11486 {
11487 
11488 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11489 	IOStream *stream = ctx->m_stream;
11490 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11491 	bool useChecksum = checksumCalculator->getVersion() > 0;
11492 
11493 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
11494 	const unsigned int __size_out_res =  (sizeof(GLboolean));
11495 	 unsigned char *ptr;
11496 	 unsigned char *buf;
11497 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + __size_out_res + 2*4;
11498 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11499 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11500 	buf = stream->alloc(8 + 4 + 4 + 4 + 4);
11501 	ptr = buf;
11502 	int tmp = OP_glUnmapBufferAsyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11503 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11504 
11505 		memcpy(ptr, &target, 4); ptr += 4;
11506 		memcpy(ptr, &offset, 4); ptr += 4;
11507 		memcpy(ptr, &length, 4); ptr += 4;
11508 		memcpy(ptr, &access, 4); ptr += 4;
11509 
11510 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11511 	stream->flush();
11512 	stream->writeFully(&__size_guest_buffer,4);
11513 	if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4);
11514 	if (guest_buffer != NULL) {
11515 		stream->writeFully(guest_buffer, __size_guest_buffer);
11516 		if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer);
11517 	}
11518 	buf = stream->alloc(__size_out_res + 1*4);
11519 	ptr = buf;
11520 	*(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11521 	memcpy(ptr, out_res, __size_out_res);ptr += __size_out_res;
11522 
11523 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11524 	buf = stream->alloc(checksumSize);
11525 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
11526 
11527 }
11528 
glFlushMappedBufferRangeAEMU2_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr length,GLbitfield access,void * guest_buffer)11529 void glFlushMappedBufferRangeAEMU2_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
11530 {
11531 
11532 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11533 	IOStream *stream = ctx->m_stream;
11534 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11535 	bool useChecksum = checksumCalculator->getVersion() > 0;
11536 
11537 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
11538 	 unsigned char *ptr;
11539 	 unsigned char *buf;
11540 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
11541 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
11542 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11543 	buf = stream->alloc(8 + 4 + 4 + 4 + 4);
11544 	ptr = buf;
11545 	int tmp = OP_glFlushMappedBufferRangeAEMU2;memcpy(ptr, &tmp, 4); ptr += 4;
11546 	memcpy(ptr, &totalSize, 4);  ptr += 4;
11547 
11548 		memcpy(ptr, &target, 4); ptr += 4;
11549 		memcpy(ptr, &offset, 4); ptr += 4;
11550 		memcpy(ptr, &length, 4); ptr += 4;
11551 		memcpy(ptr, &access, 4); ptr += 4;
11552 
11553 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11554 	stream->flush();
11555 	stream->writeFully(&__size_guest_buffer,4);
11556 	if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4);
11557 	if (guest_buffer != NULL) {
11558 		stream->writeFully(guest_buffer, __size_guest_buffer);
11559 		if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer);
11560 	}
11561 	buf = stream->alloc(checksumSize);
11562 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
11563 
11564 }
11565 
11566 }  // namespace
11567 
gl2_encoder_context_t(IOStream * stream,ChecksumCalculator * checksumCalculator)11568 gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
11569 {
11570 	m_stream = stream;
11571 	m_checksumCalculator = checksumCalculator;
11572 
11573 	this->glActiveTexture = &glActiveTexture_enc;
11574 	this->glAttachShader = &glAttachShader_enc;
11575 	this->glBindAttribLocation = &glBindAttribLocation_enc;
11576 	this->glBindBuffer = &glBindBuffer_enc;
11577 	this->glBindFramebuffer = &glBindFramebuffer_enc;
11578 	this->glBindRenderbuffer = &glBindRenderbuffer_enc;
11579 	this->glBindTexture = &glBindTexture_enc;
11580 	this->glBlendColor = &glBlendColor_enc;
11581 	this->glBlendEquation = &glBlendEquation_enc;
11582 	this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
11583 	this->glBlendFunc = &glBlendFunc_enc;
11584 	this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
11585 	this->glBufferData = &glBufferData_enc;
11586 	this->glBufferSubData = &glBufferSubData_enc;
11587 	this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
11588 	this->glClear = &glClear_enc;
11589 	this->glClearColor = &glClearColor_enc;
11590 	this->glClearDepthf = &glClearDepthf_enc;
11591 	this->glClearStencil = &glClearStencil_enc;
11592 	this->glColorMask = &glColorMask_enc;
11593 	this->glCompileShader = &glCompileShader_enc;
11594 	this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
11595 	this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
11596 	this->glCopyTexImage2D = &glCopyTexImage2D_enc;
11597 	this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
11598 	this->glCreateProgram = &glCreateProgram_enc;
11599 	this->glCreateShader = &glCreateShader_enc;
11600 	this->glCullFace = &glCullFace_enc;
11601 	this->glDeleteBuffers = &glDeleteBuffers_enc;
11602 	this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
11603 	this->glDeleteProgram = &glDeleteProgram_enc;
11604 	this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
11605 	this->glDeleteShader = &glDeleteShader_enc;
11606 	this->glDeleteTextures = &glDeleteTextures_enc;
11607 	this->glDepthFunc = &glDepthFunc_enc;
11608 	this->glDepthMask = &glDepthMask_enc;
11609 	this->glDepthRangef = &glDepthRangef_enc;
11610 	this->glDetachShader = &glDetachShader_enc;
11611 	this->glDisable = &glDisable_enc;
11612 	this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
11613 	this->glDrawArrays = &glDrawArrays_enc;
11614 	this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
11615 	this->glEnable = &glEnable_enc;
11616 	this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
11617 	this->glFinish = &glFinish_enc;
11618 	this->glFlush = &glFlush_enc;
11619 	this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
11620 	this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
11621 	this->glFrontFace = &glFrontFace_enc;
11622 	this->glGenBuffers = &glGenBuffers_enc;
11623 	this->glGenerateMipmap = &glGenerateMipmap_enc;
11624 	this->glGenFramebuffers = &glGenFramebuffers_enc;
11625 	this->glGenRenderbuffers = &glGenRenderbuffers_enc;
11626 	this->glGenTextures = &glGenTextures_enc;
11627 	this->glGetActiveAttrib = &glGetActiveAttrib_enc;
11628 	this->glGetActiveUniform = &glGetActiveUniform_enc;
11629 	this->glGetAttachedShaders = &glGetAttachedShaders_enc;
11630 	this->glGetAttribLocation = &glGetAttribLocation_enc;
11631 	this->glGetBooleanv = &glGetBooleanv_enc;
11632 	this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
11633 	this->glGetError = &glGetError_enc;
11634 	this->glGetFloatv = &glGetFloatv_enc;
11635 	this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
11636 	this->glGetIntegerv = &glGetIntegerv_enc;
11637 	this->glGetProgramiv = &glGetProgramiv_enc;
11638 	this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
11639 	this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
11640 	this->glGetShaderiv = &glGetShaderiv_enc;
11641 	this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
11642 	this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
11643 	this->glGetShaderSource = &glGetShaderSource_enc;
11644 	this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
11645 	this->glGetTexParameterfv = &glGetTexParameterfv_enc;
11646 	this->glGetTexParameteriv = &glGetTexParameteriv_enc;
11647 	this->glGetUniformfv = &glGetUniformfv_enc;
11648 	this->glGetUniformiv = &glGetUniformiv_enc;
11649 	this->glGetUniformLocation = &glGetUniformLocation_enc;
11650 	this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
11651 	this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
11652 	this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
11653 	this->glHint = &glHint_enc;
11654 	this->glIsBuffer = &glIsBuffer_enc;
11655 	this->glIsEnabled = &glIsEnabled_enc;
11656 	this->glIsFramebuffer = &glIsFramebuffer_enc;
11657 	this->glIsProgram = &glIsProgram_enc;
11658 	this->glIsRenderbuffer = &glIsRenderbuffer_enc;
11659 	this->glIsShader = &glIsShader_enc;
11660 	this->glIsTexture = &glIsTexture_enc;
11661 	this->glLineWidth = &glLineWidth_enc;
11662 	this->glLinkProgram = &glLinkProgram_enc;
11663 	this->glPixelStorei = &glPixelStorei_enc;
11664 	this->glPolygonOffset = &glPolygonOffset_enc;
11665 	this->glReadPixels = &glReadPixels_enc;
11666 	this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
11667 	this->glRenderbufferStorage = &glRenderbufferStorage_enc;
11668 	this->glSampleCoverage = &glSampleCoverage_enc;
11669 	this->glScissor = &glScissor_enc;
11670 	this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
11671 	this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
11672 	this->glStencilFunc = &glStencilFunc_enc;
11673 	this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
11674 	this->glStencilMask = &glStencilMask_enc;
11675 	this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
11676 	this->glStencilOp = &glStencilOp_enc;
11677 	this->glStencilOpSeparate = &glStencilOpSeparate_enc;
11678 	this->glTexImage2D = &glTexImage2D_enc;
11679 	this->glTexParameterf = &glTexParameterf_enc;
11680 	this->glTexParameterfv = &glTexParameterfv_enc;
11681 	this->glTexParameteri = &glTexParameteri_enc;
11682 	this->glTexParameteriv = &glTexParameteriv_enc;
11683 	this->glTexSubImage2D = &glTexSubImage2D_enc;
11684 	this->glUniform1f = &glUniform1f_enc;
11685 	this->glUniform1fv = &glUniform1fv_enc;
11686 	this->glUniform1i = &glUniform1i_enc;
11687 	this->glUniform1iv = &glUniform1iv_enc;
11688 	this->glUniform2f = &glUniform2f_enc;
11689 	this->glUniform2fv = &glUniform2fv_enc;
11690 	this->glUniform2i = &glUniform2i_enc;
11691 	this->glUniform2iv = &glUniform2iv_enc;
11692 	this->glUniform3f = &glUniform3f_enc;
11693 	this->glUniform3fv = &glUniform3fv_enc;
11694 	this->glUniform3i = &glUniform3i_enc;
11695 	this->glUniform3iv = &glUniform3iv_enc;
11696 	this->glUniform4f = &glUniform4f_enc;
11697 	this->glUniform4fv = &glUniform4fv_enc;
11698 	this->glUniform4i = &glUniform4i_enc;
11699 	this->glUniform4iv = &glUniform4iv_enc;
11700 	this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
11701 	this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
11702 	this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
11703 	this->glUseProgram = &glUseProgram_enc;
11704 	this->glValidateProgram = &glValidateProgram_enc;
11705 	this->glVertexAttrib1f = &glVertexAttrib1f_enc;
11706 	this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
11707 	this->glVertexAttrib2f = &glVertexAttrib2f_enc;
11708 	this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
11709 	this->glVertexAttrib3f = &glVertexAttrib3f_enc;
11710 	this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
11711 	this->glVertexAttrib4f = &glVertexAttrib4f_enc;
11712 	this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
11713 	this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
11714 	this->glViewport = &glViewport_enc;
11715 	this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
11716 	this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
11717 	this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
11718 	this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
11719 	this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
11720 	this->glUnmapBufferOES = &glUnmapBufferOES_enc;
11721 	this->glTexImage3DOES = &glTexImage3DOES_enc;
11722 	this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
11723 	this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
11724 	this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
11725 	this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
11726 	this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
11727 	this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
11728 	this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
11729 	this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
11730 	this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
11731 	this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
11732 	this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
11733 	this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
11734 	this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
11735 	this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11736 	this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
11737 	this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
11738 	this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
11739 	this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
11740 	this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
11741 	this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11742 	this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
11743 	this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
11744 	this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
11745 	this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
11746 	this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
11747 	this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
11748 	this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
11749 	this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
11750 	this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
11751 	this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
11752 	this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
11753 	this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
11754 	this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
11755 	this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
11756 	this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
11757 	this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
11758 	this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
11759 	this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
11760 	this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
11761 	this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
11762 	this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
11763 	this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
11764 	this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
11765 	this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
11766 	this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
11767 	this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
11768 	this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
11769 	this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
11770 	this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
11771 	this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
11772 	this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
11773 	this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
11774 	this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
11775 	this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
11776 	this->glDrawElementsOffset = &glDrawElementsOffset_enc;
11777 	this->glDrawElementsData = &glDrawElementsData_enc;
11778 	this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
11779 	this->glShaderString = &glShaderString_enc;
11780 	this->glFinishRoundTrip = &glFinishRoundTrip_enc;
11781 	this->glGenVertexArrays = &glGenVertexArrays_enc;
11782 	this->glBindVertexArray = &glBindVertexArray_enc;
11783 	this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
11784 	this->glIsVertexArray = &glIsVertexArray_enc;
11785 	this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
11786 	this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
11787 	this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
11788 	this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
11789 	this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
11790 	this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
11791 	this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
11792 	this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
11793 	this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
11794 	this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
11795 	this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
11796 	this->glBindBufferRange = &glBindBufferRange_enc;
11797 	this->glBindBufferBase = &glBindBufferBase_enc;
11798 	this->glCopyBufferSubData = &glCopyBufferSubData_enc;
11799 	this->glClearBufferiv = &glClearBufferiv_enc;
11800 	this->glClearBufferuiv = &glClearBufferuiv_enc;
11801 	this->glClearBufferfv = &glClearBufferfv_enc;
11802 	this->glClearBufferfi = &glClearBufferfi_enc;
11803 	this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
11804 	this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
11805 	this->glUniformBlockBinding = &glUniformBlockBinding_enc;
11806 	this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
11807 	this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
11808 	this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
11809 	this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
11810 	this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
11811 	this->glUniform1ui = &glUniform1ui_enc;
11812 	this->glUniform2ui = &glUniform2ui_enc;
11813 	this->glUniform3ui = &glUniform3ui_enc;
11814 	this->glUniform4ui = &glUniform4ui_enc;
11815 	this->glUniform1uiv = &glUniform1uiv_enc;
11816 	this->glUniform2uiv = &glUniform2uiv_enc;
11817 	this->glUniform3uiv = &glUniform3uiv_enc;
11818 	this->glUniform4uiv = &glUniform4uiv_enc;
11819 	this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
11820 	this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
11821 	this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
11822 	this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
11823 	this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
11824 	this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
11825 	this->glGetUniformuiv = &glGetUniformuiv_enc;
11826 	this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
11827 	this->glVertexAttribI4i = &glVertexAttribI4i_enc;
11828 	this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
11829 	this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
11830 	this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
11831 	this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
11832 	this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
11833 	this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
11834 	this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
11835 	this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
11836 	this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
11837 	this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
11838 	this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
11839 	this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
11840 	this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
11841 	this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
11842 	this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
11843 	this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
11844 	this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
11845 	this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
11846 	this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
11847 	this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
11848 	this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
11849 	this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
11850 	this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
11851 	this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
11852 	this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
11853 	this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
11854 	this->glIsSyncAEMU = &glIsSyncAEMU_enc;
11855 	this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
11856 	this->glDrawBuffers = &glDrawBuffers_enc;
11857 	this->glReadBuffer = &glReadBuffer_enc;
11858 	this->glBlitFramebuffer = &glBlitFramebuffer_enc;
11859 	this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
11860 	this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
11861 	this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
11862 	this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
11863 	this->glTexStorage2D = &glTexStorage2D_enc;
11864 	this->glGetInternalformativ = &glGetInternalformativ_enc;
11865 	this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
11866 	this->glEndTransformFeedback = &glEndTransformFeedback_enc;
11867 	this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
11868 	this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
11869 	this->glBindTransformFeedback = &glBindTransformFeedback_enc;
11870 	this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
11871 	this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
11872 	this->glIsTransformFeedback = &glIsTransformFeedback_enc;
11873 	this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
11874 	this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
11875 	this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
11876 	this->glGenSamplers = &glGenSamplers_enc;
11877 	this->glDeleteSamplers = &glDeleteSamplers_enc;
11878 	this->glBindSampler = &glBindSampler_enc;
11879 	this->glSamplerParameterf = &glSamplerParameterf_enc;
11880 	this->glSamplerParameteri = &glSamplerParameteri_enc;
11881 	this->glSamplerParameterfv = &glSamplerParameterfv_enc;
11882 	this->glSamplerParameteriv = &glSamplerParameteriv_enc;
11883 	this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
11884 	this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
11885 	this->glIsSampler = &glIsSampler_enc;
11886 	this->glGenQueries = &glGenQueries_enc;
11887 	this->glDeleteQueries = &glDeleteQueries_enc;
11888 	this->glBeginQuery = &glBeginQuery_enc;
11889 	this->glEndQuery = &glEndQuery_enc;
11890 	this->glGetQueryiv = &glGetQueryiv_enc;
11891 	this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
11892 	this->glIsQuery = &glIsQuery_enc;
11893 	this->glProgramParameteri = &glProgramParameteri_enc;
11894 	this->glProgramBinary = &glProgramBinary_enc;
11895 	this->glGetProgramBinary = &glGetProgramBinary_enc;
11896 	this->glGetFragDataLocation = &glGetFragDataLocation_enc;
11897 	this->glGetInteger64v = &glGetInteger64v_enc;
11898 	this->glGetIntegeri_v = &glGetIntegeri_v_enc;
11899 	this->glGetInteger64i_v = &glGetInteger64i_v_enc;
11900 	this->glTexImage3D = &glTexImage3D_enc;
11901 	this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
11902 	this->glTexStorage3D = &glTexStorage3D_enc;
11903 	this->glTexSubImage3D = &glTexSubImage3D_enc;
11904 	this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
11905 	this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
11906 	this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
11907 	this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
11908 	this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
11909 	this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
11910 	this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
11911 	this->glGetBooleani_v = &glGetBooleani_v_enc;
11912 	this->glMemoryBarrier = &glMemoryBarrier_enc;
11913 	this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
11914 	this->glGenProgramPipelines = &glGenProgramPipelines_enc;
11915 	this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
11916 	this->glBindProgramPipeline = &glBindProgramPipeline_enc;
11917 	this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
11918 	this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
11919 	this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
11920 	this->glIsProgramPipeline = &glIsProgramPipeline_enc;
11921 	this->glUseProgramStages = &glUseProgramStages_enc;
11922 	this->glActiveShaderProgram = &glActiveShaderProgram_enc;
11923 	this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
11924 	this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
11925 	this->glProgramUniform1f = &glProgramUniform1f_enc;
11926 	this->glProgramUniform2f = &glProgramUniform2f_enc;
11927 	this->glProgramUniform3f = &glProgramUniform3f_enc;
11928 	this->glProgramUniform4f = &glProgramUniform4f_enc;
11929 	this->glProgramUniform1i = &glProgramUniform1i_enc;
11930 	this->glProgramUniform2i = &glProgramUniform2i_enc;
11931 	this->glProgramUniform3i = &glProgramUniform3i_enc;
11932 	this->glProgramUniform4i = &glProgramUniform4i_enc;
11933 	this->glProgramUniform1ui = &glProgramUniform1ui_enc;
11934 	this->glProgramUniform2ui = &glProgramUniform2ui_enc;
11935 	this->glProgramUniform3ui = &glProgramUniform3ui_enc;
11936 	this->glProgramUniform4ui = &glProgramUniform4ui_enc;
11937 	this->glProgramUniform1fv = &glProgramUniform1fv_enc;
11938 	this->glProgramUniform2fv = &glProgramUniform2fv_enc;
11939 	this->glProgramUniform3fv = &glProgramUniform3fv_enc;
11940 	this->glProgramUniform4fv = &glProgramUniform4fv_enc;
11941 	this->glProgramUniform1iv = &glProgramUniform1iv_enc;
11942 	this->glProgramUniform2iv = &glProgramUniform2iv_enc;
11943 	this->glProgramUniform3iv = &glProgramUniform3iv_enc;
11944 	this->glProgramUniform4iv = &glProgramUniform4iv_enc;
11945 	this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
11946 	this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
11947 	this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
11948 	this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
11949 	this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
11950 	this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
11951 	this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
11952 	this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
11953 	this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
11954 	this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
11955 	this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
11956 	this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
11957 	this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
11958 	this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
11959 	this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
11960 	this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
11961 	this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
11962 	this->glGetProgramResourceName = &glGetProgramResourceName_enc;
11963 	this->glBindImageTexture = &glBindImageTexture_enc;
11964 	this->glDispatchCompute = &glDispatchCompute_enc;
11965 	this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
11966 	this->glBindVertexBuffer = &glBindVertexBuffer_enc;
11967 	this->glVertexAttribBinding = &glVertexAttribBinding_enc;
11968 	this->glVertexAttribFormat = &glVertexAttribFormat_enc;
11969 	this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
11970 	this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
11971 	this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
11972 	this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
11973 	this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
11974 	this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
11975 	this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
11976 	this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
11977 	this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
11978 	this->glSampleMaski = &glSampleMaski_enc;
11979 	this->glGetMultisamplefv = &glGetMultisamplefv_enc;
11980 	this->glFramebufferParameteri = &glFramebufferParameteri_enc;
11981 	this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
11982 	this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
11983 	this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
11984 	this->glMapBufferRangeDMA = &glMapBufferRangeDMA_enc;
11985 	this->glUnmapBufferDMA = &glUnmapBufferDMA_enc;
11986 	this->glMapBufferRangeDirect = &glMapBufferRangeDirect_enc;
11987 	this->glUnmapBufferDirect = &glUnmapBufferDirect_enc;
11988 	this->glFlushMappedBufferRangeDirect = &glFlushMappedBufferRangeDirect_enc;
11989 	this->glGetGraphicsResetStatusEXT = &glGetGraphicsResetStatusEXT_enc;
11990 	this->glReadnPixelsEXT = &glReadnPixelsEXT_enc;
11991 	this->glGetnUniformfvEXT = &glGetnUniformfvEXT_enc;
11992 	this->glGetnUniformivEXT = &glGetnUniformivEXT_enc;
11993 	this->glDrawArraysNullAEMU = &glDrawArraysNullAEMU_enc;
11994 	this->glDrawElementsNullAEMU = (glDrawElementsNullAEMU_client_proc_t) &enc_unsupported;
11995 	this->glDrawElementsOffsetNullAEMU = &glDrawElementsOffsetNullAEMU_enc;
11996 	this->glDrawElementsDataNullAEMU = &glDrawElementsDataNullAEMU_enc;
11997 	this->glUnmapBufferAsyncAEMU = &glUnmapBufferAsyncAEMU_enc;
11998 	this->glFlushMappedBufferRangeAEMU2 = &glFlushMappedBufferRangeAEMU2_enc;
11999 }
12000 
12001