1 // Generated Code - DO NOT EDIT !!
2 // generated by 'emugen'
3 
4 
5 #include <memory>
6 #include <string.h>
7 #include "gl_opcodes.h"
8 
9 #include "gl_enc.h"
10 
11 
12 #include <stdio.h>
13 
14 namespace {
15 
enc_unsupported()16 void enc_unsupported()
17 {
18 	ALOGE("Function is unsupported\n");
19 }
20 
glAlphaFunc_enc(void * self,GLenum func,GLclampf ref)21 void glAlphaFunc_enc(void *self , GLenum func, GLclampf ref)
22 {
23 
24 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
25 	IOStream *stream = ctx->m_stream;
26 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
27 	bool useChecksum = checksumCalculator->getVersion() > 0;
28 
29 	 unsigned char *ptr;
30 	 unsigned char *buf;
31 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
32 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
33 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
34 	buf = stream->alloc(totalSize);
35 	ptr = buf;
36 	int tmp = OP_glAlphaFunc;memcpy(ptr, &tmp, 4); ptr += 4;
37 	memcpy(ptr, &totalSize, 4);  ptr += 4;
38 
39 		memcpy(ptr, &func, 4); ptr += 4;
40 		memcpy(ptr, &ref, 4); ptr += 4;
41 
42 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
43 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
44 
45 }
46 
glClearColor_enc(void * self,GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)47 void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
48 {
49 
50 	gl_encoder_context_t *ctx = (gl_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 + 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_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
63 	memcpy(ptr, &totalSize, 4);  ptr += 4;
64 
65 		memcpy(ptr, &red, 4); ptr += 4;
66 		memcpy(ptr, &green, 4); ptr += 4;
67 		memcpy(ptr, &blue, 4); ptr += 4;
68 		memcpy(ptr, &alpha, 4); ptr += 4;
69 
70 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
71 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
72 
73 }
74 
glClearDepthf_enc(void * self,GLclampf depth)75 void glClearDepthf_enc(void *self , GLclampf depth)
76 {
77 
78 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
79 	IOStream *stream = ctx->m_stream;
80 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
81 	bool useChecksum = checksumCalculator->getVersion() > 0;
82 
83 	 unsigned char *ptr;
84 	 unsigned char *buf;
85 	 const size_t sizeWithoutChecksum = 8 + 4;
86 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
87 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
88 	buf = stream->alloc(totalSize);
89 	ptr = buf;
90 	int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
91 	memcpy(ptr, &totalSize, 4);  ptr += 4;
92 
93 		memcpy(ptr, &depth, 4); ptr += 4;
94 
95 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
96 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
97 
98 }
99 
glClipPlanef_enc(void * self,GLenum plane,const GLfloat * equation)100 void glClipPlanef_enc(void *self , GLenum plane, const GLfloat* equation)
101 {
102 
103 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
104 	IOStream *stream = ctx->m_stream;
105 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
106 	bool useChecksum = checksumCalculator->getVersion() > 0;
107 
108 	const unsigned int __size_equation =  (4 * sizeof(float));
109 	 unsigned char *ptr;
110 	 unsigned char *buf;
111 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4;
112 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
113 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
114 	buf = stream->alloc(totalSize);
115 	ptr = buf;
116 	int tmp = OP_glClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4;
117 	memcpy(ptr, &totalSize, 4);  ptr += 4;
118 
119 		memcpy(ptr, &plane, 4); ptr += 4;
120 	*(unsigned int *)(ptr) = __size_equation; ptr += 4;
121 	memcpy(ptr, equation, __size_equation);ptr += __size_equation;
122 
123 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
124 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
125 
126 }
127 
glColor4f_enc(void * self,GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)128 void glColor4f_enc(void *self , GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
129 {
130 
131 	gl_encoder_context_t *ctx = (gl_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 + 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_glColor4f;memcpy(ptr, &tmp, 4); ptr += 4;
144 	memcpy(ptr, &totalSize, 4);  ptr += 4;
145 
146 		memcpy(ptr, &red, 4); ptr += 4;
147 		memcpy(ptr, &green, 4); ptr += 4;
148 		memcpy(ptr, &blue, 4); ptr += 4;
149 		memcpy(ptr, &alpha, 4); ptr += 4;
150 
151 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
152 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
153 
154 }
155 
glDepthRangef_enc(void * self,GLclampf zNear,GLclampf zFar)156 void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
157 {
158 
159 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
160 	IOStream *stream = ctx->m_stream;
161 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
162 	bool useChecksum = checksumCalculator->getVersion() > 0;
163 
164 	 unsigned char *ptr;
165 	 unsigned char *buf;
166 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
167 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
168 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
169 	buf = stream->alloc(totalSize);
170 	ptr = buf;
171 	int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
172 	memcpy(ptr, &totalSize, 4);  ptr += 4;
173 
174 		memcpy(ptr, &zNear, 4); ptr += 4;
175 		memcpy(ptr, &zFar, 4); ptr += 4;
176 
177 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
178 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
179 
180 }
181 
glFogf_enc(void * self,GLenum pname,GLfloat param)182 void glFogf_enc(void *self , GLenum pname, GLfloat param)
183 {
184 
185 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
186 	IOStream *stream = ctx->m_stream;
187 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
188 	bool useChecksum = checksumCalculator->getVersion() > 0;
189 
190 	 unsigned char *ptr;
191 	 unsigned char *buf;
192 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
193 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
194 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
195 	buf = stream->alloc(totalSize);
196 	ptr = buf;
197 	int tmp = OP_glFogf;memcpy(ptr, &tmp, 4); ptr += 4;
198 	memcpy(ptr, &totalSize, 4);  ptr += 4;
199 
200 		memcpy(ptr, &pname, 4); ptr += 4;
201 		memcpy(ptr, &param, 4); ptr += 4;
202 
203 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
204 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
205 
206 }
207 
glFogfv_enc(void * self,GLenum pname,const GLfloat * params)208 void glFogfv_enc(void *self , GLenum pname, const GLfloat* params)
209 {
210 
211 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
212 	IOStream *stream = ctx->m_stream;
213 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
214 	bool useChecksum = checksumCalculator->getVersion() > 0;
215 
216 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
217 	 unsigned char *ptr;
218 	 unsigned char *buf;
219 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
220 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
221 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
222 	buf = stream->alloc(totalSize);
223 	ptr = buf;
224 	int tmp = OP_glFogfv;memcpy(ptr, &tmp, 4); ptr += 4;
225 	memcpy(ptr, &totalSize, 4);  ptr += 4;
226 
227 		memcpy(ptr, &pname, 4); ptr += 4;
228 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
229 	memcpy(ptr, params, __size_params);ptr += __size_params;
230 
231 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
232 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
233 
234 }
235 
glFrustumf_enc(void * self,GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat zNear,GLfloat zFar)236 void glFrustumf_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
237 {
238 
239 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
240 	IOStream *stream = ctx->m_stream;
241 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
242 	bool useChecksum = checksumCalculator->getVersion() > 0;
243 
244 	 unsigned char *ptr;
245 	 unsigned char *buf;
246 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
247 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
248 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
249 	buf = stream->alloc(totalSize);
250 	ptr = buf;
251 	int tmp = OP_glFrustumf;memcpy(ptr, &tmp, 4); ptr += 4;
252 	memcpy(ptr, &totalSize, 4);  ptr += 4;
253 
254 		memcpy(ptr, &left, 4); ptr += 4;
255 		memcpy(ptr, &right, 4); ptr += 4;
256 		memcpy(ptr, &bottom, 4); ptr += 4;
257 		memcpy(ptr, &top, 4); ptr += 4;
258 		memcpy(ptr, &zNear, 4); ptr += 4;
259 		memcpy(ptr, &zFar, 4); ptr += 4;
260 
261 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
262 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
263 
264 }
265 
glGetClipPlanef_enc(void * self,GLenum pname,GLfloat * eqn)266 void glGetClipPlanef_enc(void *self , GLenum pname, GLfloat* eqn)
267 {
268 
269 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
270 	IOStream *stream = ctx->m_stream;
271 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
272 	bool useChecksum = checksumCalculator->getVersion() > 0;
273 
274 	const unsigned int __size_eqn =  (4 * sizeof(GLfloat));
275 	 unsigned char *ptr;
276 	 unsigned char *buf;
277 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_eqn + 1*4;
278 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
279 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
280 	buf = stream->alloc(totalSize);
281 	ptr = buf;
282 	int tmp = OP_glGetClipPlanef;memcpy(ptr, &tmp, 4); ptr += 4;
283 	memcpy(ptr, &totalSize, 4);  ptr += 4;
284 
285 		memcpy(ptr, &pname, 4); ptr += 4;
286 	*(unsigned int *)(ptr) = __size_eqn; ptr += 4;
287 
288 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
289 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
290 
291 	stream->readback(eqn, __size_eqn);
292 	if (useChecksum) checksumCalculator->addBuffer(eqn, __size_eqn);
293 	if (useChecksum) {
294 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
295 		stream->readback(checksumBuf.get(), checksumSize);
296 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
297 			ALOGE("glGetClipPlanef: GL communication error, please report this issue to b.android.com.\n");
298 			abort();
299 		}
300 	}
301 }
302 
glGetFloatv_enc(void * self,GLenum pname,GLfloat * params)303 void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
304 {
305 
306 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
307 	IOStream *stream = ctx->m_stream;
308 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
309 	bool useChecksum = checksumCalculator->getVersion() > 0;
310 
311 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
312 	 unsigned char *ptr;
313 	 unsigned char *buf;
314 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
315 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
316 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
317 	buf = stream->alloc(totalSize);
318 	ptr = buf;
319 	int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
320 	memcpy(ptr, &totalSize, 4);  ptr += 4;
321 
322 		memcpy(ptr, &pname, 4); ptr += 4;
323 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
324 
325 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
326 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
327 
328 	stream->readback(params, __size_params);
329 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
330 	if (useChecksum) {
331 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
332 		stream->readback(checksumBuf.get(), checksumSize);
333 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
334 			ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
335 			abort();
336 		}
337 	}
338 }
339 
glGetLightfv_enc(void * self,GLenum light,GLenum pname,GLfloat * params)340 void glGetLightfv_enc(void *self , GLenum light, GLenum pname, GLfloat* params)
341 {
342 
343 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
344 	IOStream *stream = ctx->m_stream;
345 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
346 	bool useChecksum = checksumCalculator->getVersion() > 0;
347 
348 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
349 	 unsigned char *ptr;
350 	 unsigned char *buf;
351 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
352 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
353 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
354 	buf = stream->alloc(totalSize);
355 	ptr = buf;
356 	int tmp = OP_glGetLightfv;memcpy(ptr, &tmp, 4); ptr += 4;
357 	memcpy(ptr, &totalSize, 4);  ptr += 4;
358 
359 		memcpy(ptr, &light, 4); ptr += 4;
360 		memcpy(ptr, &pname, 4); ptr += 4;
361 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
362 
363 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
364 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
365 
366 	stream->readback(params, __size_params);
367 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
368 	if (useChecksum) {
369 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
370 		stream->readback(checksumBuf.get(), checksumSize);
371 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
372 			ALOGE("glGetLightfv: GL communication error, please report this issue to b.android.com.\n");
373 			abort();
374 		}
375 	}
376 }
377 
glGetMaterialfv_enc(void * self,GLenum face,GLenum pname,GLfloat * params)378 void glGetMaterialfv_enc(void *self , GLenum face, GLenum pname, GLfloat* params)
379 {
380 
381 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
382 	IOStream *stream = ctx->m_stream;
383 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
384 	bool useChecksum = checksumCalculator->getVersion() > 0;
385 
386 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
387 	 unsigned char *ptr;
388 	 unsigned char *buf;
389 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
390 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
391 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
392 	buf = stream->alloc(totalSize);
393 	ptr = buf;
394 	int tmp = OP_glGetMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4;
395 	memcpy(ptr, &totalSize, 4);  ptr += 4;
396 
397 		memcpy(ptr, &face, 4); ptr += 4;
398 		memcpy(ptr, &pname, 4); ptr += 4;
399 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
400 
401 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
402 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
403 
404 	stream->readback(params, __size_params);
405 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
406 	if (useChecksum) {
407 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
408 		stream->readback(checksumBuf.get(), checksumSize);
409 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
410 			ALOGE("glGetMaterialfv: GL communication error, please report this issue to b.android.com.\n");
411 			abort();
412 		}
413 	}
414 }
415 
glGetTexEnvfv_enc(void * self,GLenum env,GLenum pname,GLfloat * params)416 void glGetTexEnvfv_enc(void *self , GLenum env, GLenum pname, GLfloat* params)
417 {
418 
419 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
420 	IOStream *stream = ctx->m_stream;
421 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
422 	bool useChecksum = checksumCalculator->getVersion() > 0;
423 
424 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
425 	 unsigned char *ptr;
426 	 unsigned char *buf;
427 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
428 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
429 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
430 	buf = stream->alloc(totalSize);
431 	ptr = buf;
432 	int tmp = OP_glGetTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4;
433 	memcpy(ptr, &totalSize, 4);  ptr += 4;
434 
435 		memcpy(ptr, &env, 4); ptr += 4;
436 		memcpy(ptr, &pname, 4); ptr += 4;
437 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
438 
439 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
440 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
441 
442 	stream->readback(params, __size_params);
443 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
444 	if (useChecksum) {
445 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
446 		stream->readback(checksumBuf.get(), checksumSize);
447 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
448 			ALOGE("glGetTexEnvfv: GL communication error, please report this issue to b.android.com.\n");
449 			abort();
450 		}
451 	}
452 }
453 
glGetTexParameterfv_enc(void * self,GLenum target,GLenum pname,GLfloat * params)454 void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
455 {
456 
457 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
458 	IOStream *stream = ctx->m_stream;
459 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
460 	bool useChecksum = checksumCalculator->getVersion() > 0;
461 
462 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
463 	 unsigned char *ptr;
464 	 unsigned char *buf;
465 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*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_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
471 	memcpy(ptr, &totalSize, 4);  ptr += 4;
472 
473 		memcpy(ptr, &target, 4); ptr += 4;
474 		memcpy(ptr, &pname, 4); ptr += 4;
475 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
476 
477 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
478 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
479 
480 	stream->readback(params, __size_params);
481 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
482 	if (useChecksum) {
483 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
484 		stream->readback(checksumBuf.get(), checksumSize);
485 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
486 			ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
487 			abort();
488 		}
489 	}
490 }
491 
glLightModelf_enc(void * self,GLenum pname,GLfloat param)492 void glLightModelf_enc(void *self , GLenum pname, GLfloat param)
493 {
494 
495 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
496 	IOStream *stream = ctx->m_stream;
497 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
498 	bool useChecksum = checksumCalculator->getVersion() > 0;
499 
500 	 unsigned char *ptr;
501 	 unsigned char *buf;
502 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
503 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
504 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
505 	buf = stream->alloc(totalSize);
506 	ptr = buf;
507 	int tmp = OP_glLightModelf;memcpy(ptr, &tmp, 4); ptr += 4;
508 	memcpy(ptr, &totalSize, 4);  ptr += 4;
509 
510 		memcpy(ptr, &pname, 4); ptr += 4;
511 		memcpy(ptr, &param, 4); ptr += 4;
512 
513 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
514 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
515 
516 }
517 
glLightModelfv_enc(void * self,GLenum pname,const GLfloat * params)518 void glLightModelfv_enc(void *self , GLenum pname, const GLfloat* params)
519 {
520 
521 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
522 	IOStream *stream = ctx->m_stream;
523 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
524 	bool useChecksum = checksumCalculator->getVersion() > 0;
525 
526 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
527 	 unsigned char *ptr;
528 	 unsigned char *buf;
529 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
530 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
531 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
532 	buf = stream->alloc(totalSize);
533 	ptr = buf;
534 	int tmp = OP_glLightModelfv;memcpy(ptr, &tmp, 4); ptr += 4;
535 	memcpy(ptr, &totalSize, 4);  ptr += 4;
536 
537 		memcpy(ptr, &pname, 4); ptr += 4;
538 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
539 	memcpy(ptr, params, __size_params);ptr += __size_params;
540 
541 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
542 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
543 
544 }
545 
glLightf_enc(void * self,GLenum light,GLenum pname,GLfloat param)546 void glLightf_enc(void *self , GLenum light, GLenum pname, GLfloat param)
547 {
548 
549 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
550 	IOStream *stream = ctx->m_stream;
551 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
552 	bool useChecksum = checksumCalculator->getVersion() > 0;
553 
554 	 unsigned char *ptr;
555 	 unsigned char *buf;
556 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
557 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
558 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
559 	buf = stream->alloc(totalSize);
560 	ptr = buf;
561 	int tmp = OP_glLightf;memcpy(ptr, &tmp, 4); ptr += 4;
562 	memcpy(ptr, &totalSize, 4);  ptr += 4;
563 
564 		memcpy(ptr, &light, 4); ptr += 4;
565 		memcpy(ptr, &pname, 4); ptr += 4;
566 		memcpy(ptr, &param, 4); ptr += 4;
567 
568 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
569 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
570 
571 }
572 
glLightfv_enc(void * self,GLenum light,GLenum pname,const GLfloat * params)573 void glLightfv_enc(void *self , GLenum light, GLenum pname, const GLfloat* params)
574 {
575 
576 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
577 	IOStream *stream = ctx->m_stream;
578 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
579 	bool useChecksum = checksumCalculator->getVersion() > 0;
580 
581 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
582 	 unsigned char *ptr;
583 	 unsigned char *buf;
584 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
585 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
586 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
587 	buf = stream->alloc(totalSize);
588 	ptr = buf;
589 	int tmp = OP_glLightfv;memcpy(ptr, &tmp, 4); ptr += 4;
590 	memcpy(ptr, &totalSize, 4);  ptr += 4;
591 
592 		memcpy(ptr, &light, 4); ptr += 4;
593 		memcpy(ptr, &pname, 4); ptr += 4;
594 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
595 	memcpy(ptr, params, __size_params);ptr += __size_params;
596 
597 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
598 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
599 
600 }
601 
glLineWidth_enc(void * self,GLfloat width)602 void glLineWidth_enc(void *self , GLfloat width)
603 {
604 
605 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
606 	IOStream *stream = ctx->m_stream;
607 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
608 	bool useChecksum = checksumCalculator->getVersion() > 0;
609 
610 	 unsigned char *ptr;
611 	 unsigned char *buf;
612 	 const size_t sizeWithoutChecksum = 8 + 4;
613 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
614 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
615 	buf = stream->alloc(totalSize);
616 	ptr = buf;
617 	int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
618 	memcpy(ptr, &totalSize, 4);  ptr += 4;
619 
620 		memcpy(ptr, &width, 4); ptr += 4;
621 
622 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
623 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
624 
625 }
626 
glLoadMatrixf_enc(void * self,const GLfloat * m)627 void glLoadMatrixf_enc(void *self , const GLfloat* m)
628 {
629 
630 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
631 	IOStream *stream = ctx->m_stream;
632 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
633 	bool useChecksum = checksumCalculator->getVersion() > 0;
634 
635 	const unsigned int __size_m =  (16 * sizeof(GLfloat));
636 	 unsigned char *ptr;
637 	 unsigned char *buf;
638 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
639 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
640 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
641 	buf = stream->alloc(totalSize);
642 	ptr = buf;
643 	int tmp = OP_glLoadMatrixf;memcpy(ptr, &tmp, 4); ptr += 4;
644 	memcpy(ptr, &totalSize, 4);  ptr += 4;
645 
646 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
647 	memcpy(ptr, m, __size_m);ptr += __size_m;
648 
649 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
650 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
651 
652 }
653 
glMaterialf_enc(void * self,GLenum face,GLenum pname,GLfloat param)654 void glMaterialf_enc(void *self , GLenum face, GLenum pname, GLfloat param)
655 {
656 
657 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
658 	IOStream *stream = ctx->m_stream;
659 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
660 	bool useChecksum = checksumCalculator->getVersion() > 0;
661 
662 	 unsigned char *ptr;
663 	 unsigned char *buf;
664 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
665 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
666 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
667 	buf = stream->alloc(totalSize);
668 	ptr = buf;
669 	int tmp = OP_glMaterialf;memcpy(ptr, &tmp, 4); ptr += 4;
670 	memcpy(ptr, &totalSize, 4);  ptr += 4;
671 
672 		memcpy(ptr, &face, 4); ptr += 4;
673 		memcpy(ptr, &pname, 4); ptr += 4;
674 		memcpy(ptr, &param, 4); ptr += 4;
675 
676 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
677 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
678 
679 }
680 
glMaterialfv_enc(void * self,GLenum face,GLenum pname,const GLfloat * params)681 void glMaterialfv_enc(void *self , GLenum face, GLenum pname, const GLfloat* params)
682 {
683 
684 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
685 	IOStream *stream = ctx->m_stream;
686 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
687 	bool useChecksum = checksumCalculator->getVersion() > 0;
688 
689 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
690 	 unsigned char *ptr;
691 	 unsigned char *buf;
692 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
693 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
694 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
695 	buf = stream->alloc(totalSize);
696 	ptr = buf;
697 	int tmp = OP_glMaterialfv;memcpy(ptr, &tmp, 4); ptr += 4;
698 	memcpy(ptr, &totalSize, 4);  ptr += 4;
699 
700 		memcpy(ptr, &face, 4); ptr += 4;
701 		memcpy(ptr, &pname, 4); ptr += 4;
702 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
703 	memcpy(ptr, params, __size_params);ptr += __size_params;
704 
705 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
706 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
707 
708 }
709 
glMultMatrixf_enc(void * self,const GLfloat * m)710 void glMultMatrixf_enc(void *self , const GLfloat* m)
711 {
712 
713 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
714 	IOStream *stream = ctx->m_stream;
715 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
716 	bool useChecksum = checksumCalculator->getVersion() > 0;
717 
718 	const unsigned int __size_m =  (16 * sizeof(GLfloat));
719 	 unsigned char *ptr;
720 	 unsigned char *buf;
721 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
722 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
723 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
724 	buf = stream->alloc(totalSize);
725 	ptr = buf;
726 	int tmp = OP_glMultMatrixf;memcpy(ptr, &tmp, 4); ptr += 4;
727 	memcpy(ptr, &totalSize, 4);  ptr += 4;
728 
729 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
730 	memcpy(ptr, m, __size_m);ptr += __size_m;
731 
732 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
733 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
734 
735 }
736 
glMultiTexCoord4f_enc(void * self,GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)737 void glMultiTexCoord4f_enc(void *self , GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
738 {
739 
740 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
741 	IOStream *stream = ctx->m_stream;
742 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
743 	bool useChecksum = checksumCalculator->getVersion() > 0;
744 
745 	 unsigned char *ptr;
746 	 unsigned char *buf;
747 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
748 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
749 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
750 	buf = stream->alloc(totalSize);
751 	ptr = buf;
752 	int tmp = OP_glMultiTexCoord4f;memcpy(ptr, &tmp, 4); ptr += 4;
753 	memcpy(ptr, &totalSize, 4);  ptr += 4;
754 
755 		memcpy(ptr, &target, 4); ptr += 4;
756 		memcpy(ptr, &s, 4); ptr += 4;
757 		memcpy(ptr, &t, 4); ptr += 4;
758 		memcpy(ptr, &r, 4); ptr += 4;
759 		memcpy(ptr, &q, 4); ptr += 4;
760 
761 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
762 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
763 
764 }
765 
glNormal3f_enc(void * self,GLfloat nx,GLfloat ny,GLfloat nz)766 void glNormal3f_enc(void *self , GLfloat nx, GLfloat ny, GLfloat nz)
767 {
768 
769 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
770 	IOStream *stream = ctx->m_stream;
771 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
772 	bool useChecksum = checksumCalculator->getVersion() > 0;
773 
774 	 unsigned char *ptr;
775 	 unsigned char *buf;
776 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
777 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
778 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
779 	buf = stream->alloc(totalSize);
780 	ptr = buf;
781 	int tmp = OP_glNormal3f;memcpy(ptr, &tmp, 4); ptr += 4;
782 	memcpy(ptr, &totalSize, 4);  ptr += 4;
783 
784 		memcpy(ptr, &nx, 4); ptr += 4;
785 		memcpy(ptr, &ny, 4); ptr += 4;
786 		memcpy(ptr, &nz, 4); ptr += 4;
787 
788 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
789 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
790 
791 }
792 
glOrthof_enc(void * self,GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat zNear,GLfloat zFar)793 void glOrthof_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
794 {
795 
796 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
797 	IOStream *stream = ctx->m_stream;
798 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
799 	bool useChecksum = checksumCalculator->getVersion() > 0;
800 
801 	 unsigned char *ptr;
802 	 unsigned char *buf;
803 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
804 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
805 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
806 	buf = stream->alloc(totalSize);
807 	ptr = buf;
808 	int tmp = OP_glOrthof;memcpy(ptr, &tmp, 4); ptr += 4;
809 	memcpy(ptr, &totalSize, 4);  ptr += 4;
810 
811 		memcpy(ptr, &left, 4); ptr += 4;
812 		memcpy(ptr, &right, 4); ptr += 4;
813 		memcpy(ptr, &bottom, 4); ptr += 4;
814 		memcpy(ptr, &top, 4); ptr += 4;
815 		memcpy(ptr, &zNear, 4); ptr += 4;
816 		memcpy(ptr, &zFar, 4); ptr += 4;
817 
818 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
819 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
820 
821 }
822 
glPointParameterf_enc(void * self,GLenum pname,GLfloat param)823 void glPointParameterf_enc(void *self , GLenum pname, GLfloat param)
824 {
825 
826 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
827 	IOStream *stream = ctx->m_stream;
828 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
829 	bool useChecksum = checksumCalculator->getVersion() > 0;
830 
831 	 unsigned char *ptr;
832 	 unsigned char *buf;
833 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
834 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
835 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
836 	buf = stream->alloc(totalSize);
837 	ptr = buf;
838 	int tmp = OP_glPointParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
839 	memcpy(ptr, &totalSize, 4);  ptr += 4;
840 
841 		memcpy(ptr, &pname, 4); ptr += 4;
842 		memcpy(ptr, &param, 4); ptr += 4;
843 
844 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
845 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
846 
847 }
848 
glPointParameterfv_enc(void * self,GLenum pname,const GLfloat * params)849 void glPointParameterfv_enc(void *self , GLenum pname, const GLfloat* params)
850 {
851 
852 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
853 	IOStream *stream = ctx->m_stream;
854 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
855 	bool useChecksum = checksumCalculator->getVersion() > 0;
856 
857 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
858 	 unsigned char *ptr;
859 	 unsigned char *buf;
860 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
861 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
862 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
863 	buf = stream->alloc(totalSize);
864 	ptr = buf;
865 	int tmp = OP_glPointParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
866 	memcpy(ptr, &totalSize, 4);  ptr += 4;
867 
868 		memcpy(ptr, &pname, 4); ptr += 4;
869 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
870 	memcpy(ptr, params, __size_params);ptr += __size_params;
871 
872 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
873 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
874 
875 }
876 
glPointSize_enc(void * self,GLfloat size)877 void glPointSize_enc(void *self , GLfloat size)
878 {
879 
880 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
881 	IOStream *stream = ctx->m_stream;
882 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
883 	bool useChecksum = checksumCalculator->getVersion() > 0;
884 
885 	 unsigned char *ptr;
886 	 unsigned char *buf;
887 	 const size_t sizeWithoutChecksum = 8 + 4;
888 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
889 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
890 	buf = stream->alloc(totalSize);
891 	ptr = buf;
892 	int tmp = OP_glPointSize;memcpy(ptr, &tmp, 4); ptr += 4;
893 	memcpy(ptr, &totalSize, 4);  ptr += 4;
894 
895 		memcpy(ptr, &size, 4); ptr += 4;
896 
897 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
898 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
899 
900 }
901 
glPolygonOffset_enc(void * self,GLfloat factor,GLfloat units)902 void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
903 {
904 
905 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
906 	IOStream *stream = ctx->m_stream;
907 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
908 	bool useChecksum = checksumCalculator->getVersion() > 0;
909 
910 	 unsigned char *ptr;
911 	 unsigned char *buf;
912 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
913 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
914 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
915 	buf = stream->alloc(totalSize);
916 	ptr = buf;
917 	int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
918 	memcpy(ptr, &totalSize, 4);  ptr += 4;
919 
920 		memcpy(ptr, &factor, 4); ptr += 4;
921 		memcpy(ptr, &units, 4); ptr += 4;
922 
923 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
924 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
925 
926 }
927 
glRotatef_enc(void * self,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)928 void glRotatef_enc(void *self , GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
929 {
930 
931 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
932 	IOStream *stream = ctx->m_stream;
933 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
934 	bool useChecksum = checksumCalculator->getVersion() > 0;
935 
936 	 unsigned char *ptr;
937 	 unsigned char *buf;
938 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
939 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
940 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
941 	buf = stream->alloc(totalSize);
942 	ptr = buf;
943 	int tmp = OP_glRotatef;memcpy(ptr, &tmp, 4); ptr += 4;
944 	memcpy(ptr, &totalSize, 4);  ptr += 4;
945 
946 		memcpy(ptr, &angle, 4); ptr += 4;
947 		memcpy(ptr, &x, 4); ptr += 4;
948 		memcpy(ptr, &y, 4); ptr += 4;
949 		memcpy(ptr, &z, 4); ptr += 4;
950 
951 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
952 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
953 
954 }
955 
glScalef_enc(void * self,GLfloat x,GLfloat y,GLfloat z)956 void glScalef_enc(void *self , GLfloat x, GLfloat y, GLfloat z)
957 {
958 
959 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
960 	IOStream *stream = ctx->m_stream;
961 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
962 	bool useChecksum = checksumCalculator->getVersion() > 0;
963 
964 	 unsigned char *ptr;
965 	 unsigned char *buf;
966 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
967 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
968 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
969 	buf = stream->alloc(totalSize);
970 	ptr = buf;
971 	int tmp = OP_glScalef;memcpy(ptr, &tmp, 4); ptr += 4;
972 	memcpy(ptr, &totalSize, 4);  ptr += 4;
973 
974 		memcpy(ptr, &x, 4); ptr += 4;
975 		memcpy(ptr, &y, 4); ptr += 4;
976 		memcpy(ptr, &z, 4); ptr += 4;
977 
978 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
979 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
980 
981 }
982 
glTexEnvf_enc(void * self,GLenum target,GLenum pname,GLfloat param)983 void glTexEnvf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
984 {
985 
986 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
987 	IOStream *stream = ctx->m_stream;
988 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
989 	bool useChecksum = checksumCalculator->getVersion() > 0;
990 
991 	 unsigned char *ptr;
992 	 unsigned char *buf;
993 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
994 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
995 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
996 	buf = stream->alloc(totalSize);
997 	ptr = buf;
998 	int tmp = OP_glTexEnvf;memcpy(ptr, &tmp, 4); ptr += 4;
999 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1000 
1001 		memcpy(ptr, &target, 4); ptr += 4;
1002 		memcpy(ptr, &pname, 4); ptr += 4;
1003 		memcpy(ptr, &param, 4); ptr += 4;
1004 
1005 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1006 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1007 
1008 }
1009 
glTexEnvfv_enc(void * self,GLenum target,GLenum pname,const GLfloat * params)1010 void glTexEnvfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
1011 {
1012 
1013 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1014 	IOStream *stream = ctx->m_stream;
1015 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1016 	bool useChecksum = checksumCalculator->getVersion() > 0;
1017 
1018 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
1019 	 unsigned char *ptr;
1020 	 unsigned char *buf;
1021 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
1022 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1023 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1024 	buf = stream->alloc(totalSize);
1025 	ptr = buf;
1026 	int tmp = OP_glTexEnvfv;memcpy(ptr, &tmp, 4); ptr += 4;
1027 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1028 
1029 		memcpy(ptr, &target, 4); ptr += 4;
1030 		memcpy(ptr, &pname, 4); ptr += 4;
1031 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1032 	memcpy(ptr, params, __size_params);ptr += __size_params;
1033 
1034 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1035 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1036 
1037 }
1038 
glTexParameterf_enc(void * self,GLenum target,GLenum pname,GLfloat param)1039 void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
1040 {
1041 
1042 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1043 	IOStream *stream = ctx->m_stream;
1044 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1045 	bool useChecksum = checksumCalculator->getVersion() > 0;
1046 
1047 	 unsigned char *ptr;
1048 	 unsigned char *buf;
1049 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1050 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1051 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1052 	buf = stream->alloc(totalSize);
1053 	ptr = buf;
1054 	int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
1055 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1056 
1057 		memcpy(ptr, &target, 4); ptr += 4;
1058 		memcpy(ptr, &pname, 4); ptr += 4;
1059 		memcpy(ptr, &param, 4); ptr += 4;
1060 
1061 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1062 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1063 
1064 }
1065 
glTexParameterfv_enc(void * self,GLenum target,GLenum pname,const GLfloat * params)1066 void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
1067 {
1068 
1069 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1070 	IOStream *stream = ctx->m_stream;
1071 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1072 	bool useChecksum = checksumCalculator->getVersion() > 0;
1073 
1074 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
1075 	 unsigned char *ptr;
1076 	 unsigned char *buf;
1077 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
1078 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1079 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1080 	buf = stream->alloc(totalSize);
1081 	ptr = buf;
1082 	int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
1083 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1084 
1085 		memcpy(ptr, &target, 4); ptr += 4;
1086 		memcpy(ptr, &pname, 4); ptr += 4;
1087 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
1088 	memcpy(ptr, params, __size_params);ptr += __size_params;
1089 
1090 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1091 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1092 
1093 }
1094 
glTranslatef_enc(void * self,GLfloat x,GLfloat y,GLfloat z)1095 void glTranslatef_enc(void *self , GLfloat x, GLfloat y, GLfloat z)
1096 {
1097 
1098 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1099 	IOStream *stream = ctx->m_stream;
1100 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1101 	bool useChecksum = checksumCalculator->getVersion() > 0;
1102 
1103 	 unsigned char *ptr;
1104 	 unsigned char *buf;
1105 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1106 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1107 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1108 	buf = stream->alloc(totalSize);
1109 	ptr = buf;
1110 	int tmp = OP_glTranslatef;memcpy(ptr, &tmp, 4); ptr += 4;
1111 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1112 
1113 		memcpy(ptr, &x, 4); ptr += 4;
1114 		memcpy(ptr, &y, 4); ptr += 4;
1115 		memcpy(ptr, &z, 4); ptr += 4;
1116 
1117 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1118 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1119 
1120 }
1121 
glActiveTexture_enc(void * self,GLenum texture)1122 void glActiveTexture_enc(void *self , GLenum texture)
1123 {
1124 
1125 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1126 	IOStream *stream = ctx->m_stream;
1127 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1128 	bool useChecksum = checksumCalculator->getVersion() > 0;
1129 
1130 	 unsigned char *ptr;
1131 	 unsigned char *buf;
1132 	 const size_t sizeWithoutChecksum = 8 + 4;
1133 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1134 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1135 	buf = stream->alloc(totalSize);
1136 	ptr = buf;
1137 	int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
1138 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1139 
1140 		memcpy(ptr, &texture, 4); ptr += 4;
1141 
1142 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1143 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1144 
1145 }
1146 
glAlphaFuncx_enc(void * self,GLenum func,GLclampx ref)1147 void glAlphaFuncx_enc(void *self , GLenum func, GLclampx ref)
1148 {
1149 
1150 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1151 	IOStream *stream = ctx->m_stream;
1152 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1153 	bool useChecksum = checksumCalculator->getVersion() > 0;
1154 
1155 	 unsigned char *ptr;
1156 	 unsigned char *buf;
1157 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1158 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1159 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1160 	buf = stream->alloc(totalSize);
1161 	ptr = buf;
1162 	int tmp = OP_glAlphaFuncx;memcpy(ptr, &tmp, 4); ptr += 4;
1163 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1164 
1165 		memcpy(ptr, &func, 4); ptr += 4;
1166 		memcpy(ptr, &ref, 4); ptr += 4;
1167 
1168 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1169 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1170 
1171 }
1172 
glBindBuffer_enc(void * self,GLenum target,GLuint buffer)1173 void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
1174 {
1175 
1176 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1177 	IOStream *stream = ctx->m_stream;
1178 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1179 	bool useChecksum = checksumCalculator->getVersion() > 0;
1180 
1181 	 unsigned char *ptr;
1182 	 unsigned char *buf;
1183 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1184 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1185 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1186 	buf = stream->alloc(totalSize);
1187 	ptr = buf;
1188 	int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
1189 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1190 
1191 		memcpy(ptr, &target, 4); ptr += 4;
1192 		memcpy(ptr, &buffer, 4); ptr += 4;
1193 
1194 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1195 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1196 
1197 }
1198 
glBindTexture_enc(void * self,GLenum target,GLuint texture)1199 void glBindTexture_enc(void *self , GLenum target, GLuint texture)
1200 {
1201 
1202 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1203 	IOStream *stream = ctx->m_stream;
1204 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1205 	bool useChecksum = checksumCalculator->getVersion() > 0;
1206 
1207 	 unsigned char *ptr;
1208 	 unsigned char *buf;
1209 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1210 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1211 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1212 	buf = stream->alloc(totalSize);
1213 	ptr = buf;
1214 	int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
1215 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1216 
1217 		memcpy(ptr, &target, 4); ptr += 4;
1218 		memcpy(ptr, &texture, 4); ptr += 4;
1219 
1220 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1221 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1222 
1223 }
1224 
glBlendFunc_enc(void * self,GLenum sfactor,GLenum dfactor)1225 void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
1226 {
1227 
1228 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1229 	IOStream *stream = ctx->m_stream;
1230 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1231 	bool useChecksum = checksumCalculator->getVersion() > 0;
1232 
1233 	 unsigned char *ptr;
1234 	 unsigned char *buf;
1235 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1236 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1237 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1238 	buf = stream->alloc(totalSize);
1239 	ptr = buf;
1240 	int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
1241 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1242 
1243 		memcpy(ptr, &sfactor, 4); ptr += 4;
1244 		memcpy(ptr, &dfactor, 4); ptr += 4;
1245 
1246 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1247 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1248 
1249 }
1250 
glBufferData_enc(void * self,GLenum target,GLsizeiptr size,const GLvoid * data,GLenum usage)1251 void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
1252 {
1253 
1254 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1255 	IOStream *stream = ctx->m_stream;
1256 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1257 	bool useChecksum = checksumCalculator->getVersion() > 0;
1258 
1259 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
1260 	 unsigned char *ptr;
1261 	 unsigned char *buf;
1262 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
1263 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1264 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1265 	buf = stream->alloc(totalSize);
1266 	ptr = buf;
1267 	int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
1268 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1269 
1270 		memcpy(ptr, &target, 4); ptr += 4;
1271 		memcpy(ptr, &size, 4); ptr += 4;
1272 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
1273 	if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data;
1274 		memcpy(ptr, &usage, 4); ptr += 4;
1275 
1276 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1277 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1278 
1279 }
1280 
glBufferSubData_enc(void * self,GLenum target,GLintptr offset,GLsizeiptr size,const GLvoid * data)1281 void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
1282 {
1283 
1284 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1285 	IOStream *stream = ctx->m_stream;
1286 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1287 	bool useChecksum = checksumCalculator->getVersion() > 0;
1288 
1289 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
1290 	 unsigned char *ptr;
1291 	 unsigned char *buf;
1292 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
1293 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1294 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1295 	buf = stream->alloc(totalSize);
1296 	ptr = buf;
1297 	int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
1298 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1299 
1300 		memcpy(ptr, &target, 4); ptr += 4;
1301 		memcpy(ptr, &offset, 4); ptr += 4;
1302 		memcpy(ptr, &size, 4); ptr += 4;
1303 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
1304 	if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data;
1305 
1306 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1307 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1308 
1309 }
1310 
glClear_enc(void * self,GLbitfield mask)1311 void glClear_enc(void *self , GLbitfield mask)
1312 {
1313 
1314 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1315 	IOStream *stream = ctx->m_stream;
1316 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1317 	bool useChecksum = checksumCalculator->getVersion() > 0;
1318 
1319 	 unsigned char *ptr;
1320 	 unsigned char *buf;
1321 	 const size_t sizeWithoutChecksum = 8 + 4;
1322 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1323 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1324 	buf = stream->alloc(totalSize);
1325 	ptr = buf;
1326 	int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
1327 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1328 
1329 		memcpy(ptr, &mask, 4); ptr += 4;
1330 
1331 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1332 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1333 
1334 }
1335 
glClearColorx_enc(void * self,GLclampx red,GLclampx green,GLclampx blue,GLclampx alpha)1336 void glClearColorx_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
1337 {
1338 
1339 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1340 	IOStream *stream = ctx->m_stream;
1341 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1342 	bool useChecksum = checksumCalculator->getVersion() > 0;
1343 
1344 	 unsigned char *ptr;
1345 	 unsigned char *buf;
1346 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
1347 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1348 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1349 	buf = stream->alloc(totalSize);
1350 	ptr = buf;
1351 	int tmp = OP_glClearColorx;memcpy(ptr, &tmp, 4); ptr += 4;
1352 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1353 
1354 		memcpy(ptr, &red, 4); ptr += 4;
1355 		memcpy(ptr, &green, 4); ptr += 4;
1356 		memcpy(ptr, &blue, 4); ptr += 4;
1357 		memcpy(ptr, &alpha, 4); ptr += 4;
1358 
1359 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1360 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1361 
1362 }
1363 
glClearDepthx_enc(void * self,GLclampx depth)1364 void glClearDepthx_enc(void *self , GLclampx depth)
1365 {
1366 
1367 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1368 	IOStream *stream = ctx->m_stream;
1369 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1370 	bool useChecksum = checksumCalculator->getVersion() > 0;
1371 
1372 	 unsigned char *ptr;
1373 	 unsigned char *buf;
1374 	 const size_t sizeWithoutChecksum = 8 + 4;
1375 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1376 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1377 	buf = stream->alloc(totalSize);
1378 	ptr = buf;
1379 	int tmp = OP_glClearDepthx;memcpy(ptr, &tmp, 4); ptr += 4;
1380 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1381 
1382 		memcpy(ptr, &depth, 4); ptr += 4;
1383 
1384 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1385 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1386 
1387 }
1388 
glClearStencil_enc(void * self,GLint s)1389 void glClearStencil_enc(void *self , GLint s)
1390 {
1391 
1392 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1393 	IOStream *stream = ctx->m_stream;
1394 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1395 	bool useChecksum = checksumCalculator->getVersion() > 0;
1396 
1397 	 unsigned char *ptr;
1398 	 unsigned char *buf;
1399 	 const size_t sizeWithoutChecksum = 8 + 4;
1400 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1401 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1402 	buf = stream->alloc(totalSize);
1403 	ptr = buf;
1404 	int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
1405 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1406 
1407 		memcpy(ptr, &s, 4); ptr += 4;
1408 
1409 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1410 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1411 
1412 }
1413 
glClientActiveTexture_enc(void * self,GLenum texture)1414 void glClientActiveTexture_enc(void *self , GLenum texture)
1415 {
1416 
1417 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1418 	IOStream *stream = ctx->m_stream;
1419 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1420 	bool useChecksum = checksumCalculator->getVersion() > 0;
1421 
1422 	 unsigned char *ptr;
1423 	 unsigned char *buf;
1424 	 const size_t sizeWithoutChecksum = 8 + 4;
1425 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1426 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1427 	buf = stream->alloc(totalSize);
1428 	ptr = buf;
1429 	int tmp = OP_glClientActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
1430 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1431 
1432 		memcpy(ptr, &texture, 4); ptr += 4;
1433 
1434 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1435 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1436 
1437 }
1438 
glColor4ub_enc(void * self,GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)1439 void glColor4ub_enc(void *self , GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
1440 {
1441 
1442 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1443 	IOStream *stream = ctx->m_stream;
1444 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1445 	bool useChecksum = checksumCalculator->getVersion() > 0;
1446 
1447 	 unsigned char *ptr;
1448 	 unsigned char *buf;
1449 	 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
1450 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1451 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1452 	buf = stream->alloc(totalSize);
1453 	ptr = buf;
1454 	int tmp = OP_glColor4ub;memcpy(ptr, &tmp, 4); ptr += 4;
1455 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1456 
1457 		memcpy(ptr, &red, 1); ptr += 1;
1458 		memcpy(ptr, &green, 1); ptr += 1;
1459 		memcpy(ptr, &blue, 1); ptr += 1;
1460 		memcpy(ptr, &alpha, 1); ptr += 1;
1461 
1462 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1463 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1464 
1465 }
1466 
glColor4x_enc(void * self,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)1467 void glColor4x_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
1468 {
1469 
1470 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1471 	IOStream *stream = ctx->m_stream;
1472 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1473 	bool useChecksum = checksumCalculator->getVersion() > 0;
1474 
1475 	 unsigned char *ptr;
1476 	 unsigned char *buf;
1477 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
1478 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1479 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1480 	buf = stream->alloc(totalSize);
1481 	ptr = buf;
1482 	int tmp = OP_glColor4x;memcpy(ptr, &tmp, 4); ptr += 4;
1483 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1484 
1485 		memcpy(ptr, &red, 4); ptr += 4;
1486 		memcpy(ptr, &green, 4); ptr += 4;
1487 		memcpy(ptr, &blue, 4); ptr += 4;
1488 		memcpy(ptr, &alpha, 4); ptr += 4;
1489 
1490 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1491 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1492 
1493 }
1494 
glColorMask_enc(void * self,GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)1495 void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
1496 {
1497 
1498 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1499 	IOStream *stream = ctx->m_stream;
1500 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1501 	bool useChecksum = checksumCalculator->getVersion() > 0;
1502 
1503 	 unsigned char *ptr;
1504 	 unsigned char *buf;
1505 	 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
1506 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1507 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1508 	buf = stream->alloc(totalSize);
1509 	ptr = buf;
1510 	int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
1511 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1512 
1513 		memcpy(ptr, &red, 1); ptr += 1;
1514 		memcpy(ptr, &green, 1); ptr += 1;
1515 		memcpy(ptr, &blue, 1); ptr += 1;
1516 		memcpy(ptr, &alpha, 1); ptr += 1;
1517 
1518 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1519 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1520 
1521 }
1522 
glCompressedTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid * data)1523 void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
1524 {
1525 
1526 	gl_encoder_context_t *ctx = (gl_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_data = ((data != NULL) ?  imageSize : 0);
1532 	 unsigned char *ptr;
1533 	 unsigned char *buf;
1534 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 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_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
1540 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1541 
1542 		memcpy(ptr, &target, 4); ptr += 4;
1543 		memcpy(ptr, &level, 4); ptr += 4;
1544 		memcpy(ptr, &internalformat, 4); ptr += 4;
1545 		memcpy(ptr, &width, 4); ptr += 4;
1546 		memcpy(ptr, &height, 4); ptr += 4;
1547 		memcpy(ptr, &border, 4); ptr += 4;
1548 		memcpy(ptr, &imageSize, 4); ptr += 4;
1549 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
1550 	if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data;
1551 
1552 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1553 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1554 
1555 }
1556 
glCompressedTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid * data)1557 void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
1558 {
1559 
1560 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1561 	IOStream *stream = ctx->m_stream;
1562 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1563 	bool useChecksum = checksumCalculator->getVersion() > 0;
1564 
1565 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
1566 	 unsigned char *ptr;
1567 	 unsigned char *buf;
1568 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
1569 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1570 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1571 	buf = stream->alloc(totalSize);
1572 	ptr = buf;
1573 	int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
1574 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1575 
1576 		memcpy(ptr, &target, 4); ptr += 4;
1577 		memcpy(ptr, &level, 4); ptr += 4;
1578 		memcpy(ptr, &xoffset, 4); ptr += 4;
1579 		memcpy(ptr, &yoffset, 4); ptr += 4;
1580 		memcpy(ptr, &width, 4); ptr += 4;
1581 		memcpy(ptr, &height, 4); ptr += 4;
1582 		memcpy(ptr, &format, 4); ptr += 4;
1583 		memcpy(ptr, &imageSize, 4); ptr += 4;
1584 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
1585 	if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data;
1586 
1587 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1588 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1589 
1590 }
1591 
glCopyTexImage2D_enc(void * self,GLenum target,GLint level,GLenum internalformat,GLint x,GLint y,GLsizei width,GLsizei height,GLint border)1592 void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
1593 {
1594 
1595 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1596 	IOStream *stream = ctx->m_stream;
1597 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1598 	bool useChecksum = checksumCalculator->getVersion() > 0;
1599 
1600 	 unsigned char *ptr;
1601 	 unsigned char *buf;
1602 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
1603 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1604 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1605 	buf = stream->alloc(totalSize);
1606 	ptr = buf;
1607 	int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
1608 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1609 
1610 		memcpy(ptr, &target, 4); ptr += 4;
1611 		memcpy(ptr, &level, 4); ptr += 4;
1612 		memcpy(ptr, &internalformat, 4); ptr += 4;
1613 		memcpy(ptr, &x, 4); ptr += 4;
1614 		memcpy(ptr, &y, 4); ptr += 4;
1615 		memcpy(ptr, &width, 4); ptr += 4;
1616 		memcpy(ptr, &height, 4); ptr += 4;
1617 		memcpy(ptr, &border, 4); ptr += 4;
1618 
1619 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1620 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1621 
1622 }
1623 
glCopyTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint x,GLint y,GLsizei width,GLsizei height)1624 void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
1625 {
1626 
1627 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1628 	IOStream *stream = ctx->m_stream;
1629 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1630 	bool useChecksum = checksumCalculator->getVersion() > 0;
1631 
1632 	 unsigned char *ptr;
1633 	 unsigned char *buf;
1634 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
1635 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1636 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1637 	buf = stream->alloc(totalSize);
1638 	ptr = buf;
1639 	int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
1640 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1641 
1642 		memcpy(ptr, &target, 4); ptr += 4;
1643 		memcpy(ptr, &level, 4); ptr += 4;
1644 		memcpy(ptr, &xoffset, 4); ptr += 4;
1645 		memcpy(ptr, &yoffset, 4); ptr += 4;
1646 		memcpy(ptr, &x, 4); ptr += 4;
1647 		memcpy(ptr, &y, 4); ptr += 4;
1648 		memcpy(ptr, &width, 4); ptr += 4;
1649 		memcpy(ptr, &height, 4); ptr += 4;
1650 
1651 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1652 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1653 
1654 }
1655 
glCullFace_enc(void * self,GLenum mode)1656 void glCullFace_enc(void *self , GLenum mode)
1657 {
1658 
1659 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1660 	IOStream *stream = ctx->m_stream;
1661 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1662 	bool useChecksum = checksumCalculator->getVersion() > 0;
1663 
1664 	 unsigned char *ptr;
1665 	 unsigned char *buf;
1666 	 const size_t sizeWithoutChecksum = 8 + 4;
1667 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1668 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1669 	buf = stream->alloc(totalSize);
1670 	ptr = buf;
1671 	int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
1672 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1673 
1674 		memcpy(ptr, &mode, 4); ptr += 4;
1675 
1676 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1677 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1678 
1679 }
1680 
glDeleteBuffers_enc(void * self,GLsizei n,const GLuint * buffers)1681 void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
1682 {
1683 
1684 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1685 	IOStream *stream = ctx->m_stream;
1686 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1687 	bool useChecksum = checksumCalculator->getVersion() > 0;
1688 
1689 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
1690 	 unsigned char *ptr;
1691 	 unsigned char *buf;
1692 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
1693 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1694 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1695 	buf = stream->alloc(totalSize);
1696 	ptr = buf;
1697 	int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
1698 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1699 
1700 		memcpy(ptr, &n, 4); ptr += 4;
1701 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
1702 	memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
1703 
1704 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1705 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1706 
1707 }
1708 
glDeleteTextures_enc(void * self,GLsizei n,const GLuint * textures)1709 void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
1710 {
1711 
1712 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1713 	IOStream *stream = ctx->m_stream;
1714 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1715 	bool useChecksum = checksumCalculator->getVersion() > 0;
1716 
1717 	const unsigned int __size_textures =  (n * sizeof(GLuint));
1718 	 unsigned char *ptr;
1719 	 unsigned char *buf;
1720 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
1721 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1722 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1723 	buf = stream->alloc(totalSize);
1724 	ptr = buf;
1725 	int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
1726 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1727 
1728 		memcpy(ptr, &n, 4); ptr += 4;
1729 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
1730 	memcpy(ptr, textures, __size_textures);ptr += __size_textures;
1731 
1732 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1733 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1734 
1735 }
1736 
glDepthFunc_enc(void * self,GLenum func)1737 void glDepthFunc_enc(void *self , GLenum func)
1738 {
1739 
1740 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1741 	IOStream *stream = ctx->m_stream;
1742 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1743 	bool useChecksum = checksumCalculator->getVersion() > 0;
1744 
1745 	 unsigned char *ptr;
1746 	 unsigned char *buf;
1747 	 const size_t sizeWithoutChecksum = 8 + 4;
1748 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1749 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1750 	buf = stream->alloc(totalSize);
1751 	ptr = buf;
1752 	int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
1753 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1754 
1755 		memcpy(ptr, &func, 4); ptr += 4;
1756 
1757 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1758 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1759 
1760 }
1761 
glDepthMask_enc(void * self,GLboolean flag)1762 void glDepthMask_enc(void *self , GLboolean flag)
1763 {
1764 
1765 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1766 	IOStream *stream = ctx->m_stream;
1767 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1768 	bool useChecksum = checksumCalculator->getVersion() > 0;
1769 
1770 	 unsigned char *ptr;
1771 	 unsigned char *buf;
1772 	 const size_t sizeWithoutChecksum = 8 + 1;
1773 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1774 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1775 	buf = stream->alloc(totalSize);
1776 	ptr = buf;
1777 	int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
1778 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1779 
1780 		memcpy(ptr, &flag, 1); ptr += 1;
1781 
1782 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1783 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1784 
1785 }
1786 
glDepthRangex_enc(void * self,GLclampx zNear,GLclampx zFar)1787 void glDepthRangex_enc(void *self , GLclampx zNear, GLclampx zFar)
1788 {
1789 
1790 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1791 	IOStream *stream = ctx->m_stream;
1792 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1793 	bool useChecksum = checksumCalculator->getVersion() > 0;
1794 
1795 	 unsigned char *ptr;
1796 	 unsigned char *buf;
1797 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1798 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1799 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1800 	buf = stream->alloc(totalSize);
1801 	ptr = buf;
1802 	int tmp = OP_glDepthRangex;memcpy(ptr, &tmp, 4); ptr += 4;
1803 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1804 
1805 		memcpy(ptr, &zNear, 4); ptr += 4;
1806 		memcpy(ptr, &zFar, 4); ptr += 4;
1807 
1808 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1809 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1810 
1811 }
1812 
glDisable_enc(void * self,GLenum cap)1813 void glDisable_enc(void *self , GLenum cap)
1814 {
1815 
1816 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1817 	IOStream *stream = ctx->m_stream;
1818 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1819 	bool useChecksum = checksumCalculator->getVersion() > 0;
1820 
1821 	 unsigned char *ptr;
1822 	 unsigned char *buf;
1823 	 const size_t sizeWithoutChecksum = 8 + 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_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
1829 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1830 
1831 		memcpy(ptr, &cap, 4); ptr += 4;
1832 
1833 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1834 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1835 
1836 }
1837 
glDisableClientState_enc(void * self,GLenum array)1838 void glDisableClientState_enc(void *self , GLenum array)
1839 {
1840 
1841 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1842 	IOStream *stream = ctx->m_stream;
1843 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1844 	bool useChecksum = checksumCalculator->getVersion() > 0;
1845 
1846 	 unsigned char *ptr;
1847 	 unsigned char *buf;
1848 	 const size_t sizeWithoutChecksum = 8 + 4;
1849 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1850 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1851 	buf = stream->alloc(totalSize);
1852 	ptr = buf;
1853 	int tmp = OP_glDisableClientState;memcpy(ptr, &tmp, 4); ptr += 4;
1854 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1855 
1856 		memcpy(ptr, &array, 4); ptr += 4;
1857 
1858 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1859 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1860 
1861 }
1862 
glDrawArrays_enc(void * self,GLenum mode,GLint first,GLsizei count)1863 void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
1864 {
1865 
1866 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1867 	IOStream *stream = ctx->m_stream;
1868 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1869 	bool useChecksum = checksumCalculator->getVersion() > 0;
1870 
1871 	 unsigned char *ptr;
1872 	 unsigned char *buf;
1873 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1874 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1875 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1876 	buf = stream->alloc(totalSize);
1877 	ptr = buf;
1878 	int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
1879 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1880 
1881 		memcpy(ptr, &mode, 4); ptr += 4;
1882 		memcpy(ptr, &first, 4); ptr += 4;
1883 		memcpy(ptr, &count, 4); ptr += 4;
1884 
1885 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1886 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1887 
1888 }
1889 
glEnable_enc(void * self,GLenum cap)1890 void glEnable_enc(void *self , GLenum cap)
1891 {
1892 
1893 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1894 	IOStream *stream = ctx->m_stream;
1895 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1896 	bool useChecksum = checksumCalculator->getVersion() > 0;
1897 
1898 	 unsigned char *ptr;
1899 	 unsigned char *buf;
1900 	 const size_t sizeWithoutChecksum = 8 + 4;
1901 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1902 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1903 	buf = stream->alloc(totalSize);
1904 	ptr = buf;
1905 	int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
1906 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1907 
1908 		memcpy(ptr, &cap, 4); ptr += 4;
1909 
1910 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1911 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1912 
1913 }
1914 
glEnableClientState_enc(void * self,GLenum array)1915 void glEnableClientState_enc(void *self , GLenum array)
1916 {
1917 
1918 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1919 	IOStream *stream = ctx->m_stream;
1920 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1921 	bool useChecksum = checksumCalculator->getVersion() > 0;
1922 
1923 	 unsigned char *ptr;
1924 	 unsigned char *buf;
1925 	 const size_t sizeWithoutChecksum = 8 + 4;
1926 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1927 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1928 	buf = stream->alloc(totalSize);
1929 	ptr = buf;
1930 	int tmp = OP_glEnableClientState;memcpy(ptr, &tmp, 4); ptr += 4;
1931 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1932 
1933 		memcpy(ptr, &array, 4); ptr += 4;
1934 
1935 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1936 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1937 
1938 }
1939 
glFinish_enc(void * self)1940 void glFinish_enc(void *self )
1941 {
1942 
1943 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1944 	IOStream *stream = ctx->m_stream;
1945 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1946 	bool useChecksum = checksumCalculator->getVersion() > 0;
1947 
1948 	 unsigned char *ptr;
1949 	 unsigned char *buf;
1950 	 const size_t sizeWithoutChecksum = 8;
1951 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1952 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1953 	buf = stream->alloc(totalSize);
1954 	ptr = buf;
1955 	int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
1956 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1957 
1958 
1959 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1960 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1961 
1962 }
1963 
glFlush_enc(void * self)1964 void glFlush_enc(void *self )
1965 {
1966 
1967 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1968 	IOStream *stream = ctx->m_stream;
1969 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1970 	bool useChecksum = checksumCalculator->getVersion() > 0;
1971 
1972 	 unsigned char *ptr;
1973 	 unsigned char *buf;
1974 	 const size_t sizeWithoutChecksum = 8;
1975 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
1976 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1977 	buf = stream->alloc(totalSize);
1978 	ptr = buf;
1979 	int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
1980 	memcpy(ptr, &totalSize, 4);  ptr += 4;
1981 
1982 
1983 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1984 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1985 
1986 }
1987 
glFogx_enc(void * self,GLenum pname,GLfixed param)1988 void glFogx_enc(void *self , GLenum pname, GLfixed param)
1989 {
1990 
1991 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
1992 	IOStream *stream = ctx->m_stream;
1993 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
1994 	bool useChecksum = checksumCalculator->getVersion() > 0;
1995 
1996 	 unsigned char *ptr;
1997 	 unsigned char *buf;
1998 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1999 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2000 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2001 	buf = stream->alloc(totalSize);
2002 	ptr = buf;
2003 	int tmp = OP_glFogx;memcpy(ptr, &tmp, 4); ptr += 4;
2004 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2005 
2006 		memcpy(ptr, &pname, 4); ptr += 4;
2007 		memcpy(ptr, &param, 4); ptr += 4;
2008 
2009 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2010 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2011 
2012 }
2013 
glFogxv_enc(void * self,GLenum pname,const GLfixed * params)2014 void glFogxv_enc(void *self , GLenum pname, const GLfixed* params)
2015 {
2016 
2017 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2018 	IOStream *stream = ctx->m_stream;
2019 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2020 	bool useChecksum = checksumCalculator->getVersion() > 0;
2021 
2022 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2023 	 unsigned char *ptr;
2024 	 unsigned char *buf;
2025 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
2026 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2027 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2028 	buf = stream->alloc(totalSize);
2029 	ptr = buf;
2030 	int tmp = OP_glFogxv;memcpy(ptr, &tmp, 4); ptr += 4;
2031 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2032 
2033 		memcpy(ptr, &pname, 4); ptr += 4;
2034 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2035 	memcpy(ptr, params, __size_params);ptr += __size_params;
2036 
2037 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2038 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2039 
2040 }
2041 
glFrontFace_enc(void * self,GLenum mode)2042 void glFrontFace_enc(void *self , GLenum mode)
2043 {
2044 
2045 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2046 	IOStream *stream = ctx->m_stream;
2047 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2048 	bool useChecksum = checksumCalculator->getVersion() > 0;
2049 
2050 	 unsigned char *ptr;
2051 	 unsigned char *buf;
2052 	 const size_t sizeWithoutChecksum = 8 + 4;
2053 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2054 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2055 	buf = stream->alloc(totalSize);
2056 	ptr = buf;
2057 	int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
2058 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2059 
2060 		memcpy(ptr, &mode, 4); ptr += 4;
2061 
2062 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2063 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2064 
2065 }
2066 
glFrustumx_enc(void * self,GLfixed left,GLfixed right,GLfixed bottom,GLfixed top,GLfixed zNear,GLfixed zFar)2067 void glFrustumx_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
2068 {
2069 
2070 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2071 	IOStream *stream = ctx->m_stream;
2072 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2073 	bool useChecksum = checksumCalculator->getVersion() > 0;
2074 
2075 	 unsigned char *ptr;
2076 	 unsigned char *buf;
2077 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
2078 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2079 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2080 	buf = stream->alloc(totalSize);
2081 	ptr = buf;
2082 	int tmp = OP_glFrustumx;memcpy(ptr, &tmp, 4); ptr += 4;
2083 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2084 
2085 		memcpy(ptr, &left, 4); ptr += 4;
2086 		memcpy(ptr, &right, 4); ptr += 4;
2087 		memcpy(ptr, &bottom, 4); ptr += 4;
2088 		memcpy(ptr, &top, 4); ptr += 4;
2089 		memcpy(ptr, &zNear, 4); ptr += 4;
2090 		memcpy(ptr, &zFar, 4); ptr += 4;
2091 
2092 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2093 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2094 
2095 }
2096 
glGetBooleanv_enc(void * self,GLenum pname,GLboolean * params)2097 void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
2098 {
2099 
2100 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2101 	IOStream *stream = ctx->m_stream;
2102 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2103 	bool useChecksum = checksumCalculator->getVersion() > 0;
2104 
2105 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLboolean));
2106 	 unsigned char *ptr;
2107 	 unsigned char *buf;
2108 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
2109 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2110 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2111 	buf = stream->alloc(totalSize);
2112 	ptr = buf;
2113 	int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
2114 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2115 
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 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2126 		stream->readback(checksumBuf.get(), checksumSize);
2127 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2128 			ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
2129 			abort();
2130 		}
2131 	}
2132 }
2133 
glGetBufferParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2134 void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2135 {
2136 
2137 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2138 	IOStream *stream = ctx->m_stream;
2139 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2140 	bool useChecksum = checksumCalculator->getVersion() > 0;
2141 
2142 	const unsigned int __size_params =  (sizeof(GLint));
2143 	 unsigned char *ptr;
2144 	 unsigned char *buf;
2145 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2146 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2147 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2148 	buf = stream->alloc(totalSize);
2149 	ptr = buf;
2150 	int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2151 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2152 
2153 		memcpy(ptr, &target, 4); ptr += 4;
2154 		memcpy(ptr, &pname, 4); ptr += 4;
2155 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2156 
2157 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2158 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2159 
2160 	stream->readback(params, __size_params);
2161 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2162 	if (useChecksum) {
2163 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2164 		stream->readback(checksumBuf.get(), checksumSize);
2165 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2166 			ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
2167 			abort();
2168 		}
2169 	}
2170 }
2171 
glClipPlanex_enc(void * self,GLenum pname,const GLfixed * eqn)2172 void glClipPlanex_enc(void *self , GLenum pname, const GLfixed* eqn)
2173 {
2174 
2175 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2176 	IOStream *stream = ctx->m_stream;
2177 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2178 	bool useChecksum = checksumCalculator->getVersion() > 0;
2179 
2180 	const unsigned int __size_eqn =  (4 * sizeof(GLfixed));
2181 	 unsigned char *ptr;
2182 	 unsigned char *buf;
2183 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_eqn + 1*4;
2184 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2185 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2186 	buf = stream->alloc(totalSize);
2187 	ptr = buf;
2188 	int tmp = OP_glClipPlanex;memcpy(ptr, &tmp, 4); ptr += 4;
2189 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2190 
2191 		memcpy(ptr, &pname, 4); ptr += 4;
2192 	*(unsigned int *)(ptr) = __size_eqn; ptr += 4;
2193 	memcpy(ptr, eqn, __size_eqn);ptr += __size_eqn;
2194 
2195 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2196 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2197 
2198 }
2199 
glGenBuffers_enc(void * self,GLsizei n,GLuint * buffers)2200 void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
2201 {
2202 
2203 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2204 	IOStream *stream = ctx->m_stream;
2205 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2206 	bool useChecksum = checksumCalculator->getVersion() > 0;
2207 
2208 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
2209 	 unsigned char *ptr;
2210 	 unsigned char *buf;
2211 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
2212 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2213 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2214 	buf = stream->alloc(totalSize);
2215 	ptr = buf;
2216 	int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
2217 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2218 
2219 		memcpy(ptr, &n, 4); ptr += 4;
2220 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
2221 
2222 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2223 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2224 
2225 	stream->readback(buffers, __size_buffers);
2226 	if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
2227 	if (useChecksum) {
2228 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2229 		stream->readback(checksumBuf.get(), checksumSize);
2230 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2231 			ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
2232 			abort();
2233 		}
2234 	}
2235 }
2236 
glGenTextures_enc(void * self,GLsizei n,GLuint * textures)2237 void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
2238 {
2239 
2240 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2241 	IOStream *stream = ctx->m_stream;
2242 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2243 	bool useChecksum = checksumCalculator->getVersion() > 0;
2244 
2245 	const unsigned int __size_textures =  (n * sizeof(GLuint));
2246 	 unsigned char *ptr;
2247 	 unsigned char *buf;
2248 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
2249 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2250 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2251 	buf = stream->alloc(totalSize);
2252 	ptr = buf;
2253 	int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
2254 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2255 
2256 		memcpy(ptr, &n, 4); ptr += 4;
2257 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
2258 
2259 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2260 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2261 
2262 	stream->readback(textures, __size_textures);
2263 	if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
2264 	if (useChecksum) {
2265 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2266 		stream->readback(checksumBuf.get(), checksumSize);
2267 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2268 			ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
2269 			abort();
2270 		}
2271 	}
2272 }
2273 
glGetError_enc(void * self)2274 GLenum glGetError_enc(void *self )
2275 {
2276 
2277 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2278 	IOStream *stream = ctx->m_stream;
2279 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2280 	bool useChecksum = checksumCalculator->getVersion() > 0;
2281 
2282 	 unsigned char *ptr;
2283 	 unsigned char *buf;
2284 	 const size_t sizeWithoutChecksum = 8;
2285 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2286 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2287 	buf = stream->alloc(totalSize);
2288 	ptr = buf;
2289 	int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
2290 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2291 
2292 
2293 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2294 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2295 
2296 
2297 	GLenum retval;
2298 	stream->readback(&retval, 4);
2299 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
2300 	if (useChecksum) {
2301 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2302 		stream->readback(checksumBuf.get(), checksumSize);
2303 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2304 			ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
2305 			abort();
2306 		}
2307 	}
2308 	return retval;
2309 }
2310 
glGetFixedv_enc(void * self,GLenum pname,GLfixed * params)2311 void glGetFixedv_enc(void *self , GLenum pname, GLfixed* params)
2312 {
2313 
2314 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2315 	IOStream *stream = ctx->m_stream;
2316 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2317 	bool useChecksum = checksumCalculator->getVersion() > 0;
2318 
2319 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2320 	 unsigned char *ptr;
2321 	 unsigned char *buf;
2322 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
2323 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2324 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2325 	buf = stream->alloc(totalSize);
2326 	ptr = buf;
2327 	int tmp = OP_glGetFixedv;memcpy(ptr, &tmp, 4); ptr += 4;
2328 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2329 
2330 		memcpy(ptr, &pname, 4); ptr += 4;
2331 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2332 
2333 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2334 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2335 
2336 	stream->readback(params, __size_params);
2337 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2338 	if (useChecksum) {
2339 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2340 		stream->readback(checksumBuf.get(), checksumSize);
2341 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2342 			ALOGE("glGetFixedv: GL communication error, please report this issue to b.android.com.\n");
2343 			abort();
2344 		}
2345 	}
2346 }
2347 
glGetIntegerv_enc(void * self,GLenum pname,GLint * params)2348 void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
2349 {
2350 
2351 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2352 	IOStream *stream = ctx->m_stream;
2353 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2354 	bool useChecksum = checksumCalculator->getVersion() > 0;
2355 
2356 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
2357 	 unsigned char *ptr;
2358 	 unsigned char *buf;
2359 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
2360 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2361 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2362 	buf = stream->alloc(totalSize);
2363 	ptr = buf;
2364 	int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
2365 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2366 
2367 		memcpy(ptr, &pname, 4); ptr += 4;
2368 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2369 
2370 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2371 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2372 
2373 	stream->readback(params, __size_params);
2374 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2375 	if (useChecksum) {
2376 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2377 		stream->readback(checksumBuf.get(), checksumSize);
2378 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2379 			ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
2380 			abort();
2381 		}
2382 	}
2383 }
2384 
glGetLightxv_enc(void * self,GLenum light,GLenum pname,GLfixed * params)2385 void glGetLightxv_enc(void *self , GLenum light, GLenum pname, GLfixed* params)
2386 {
2387 
2388 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2389 	IOStream *stream = ctx->m_stream;
2390 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2391 	bool useChecksum = checksumCalculator->getVersion() > 0;
2392 
2393 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2394 	 unsigned char *ptr;
2395 	 unsigned char *buf;
2396 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2397 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2398 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2399 	buf = stream->alloc(totalSize);
2400 	ptr = buf;
2401 	int tmp = OP_glGetLightxv;memcpy(ptr, &tmp, 4); ptr += 4;
2402 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2403 
2404 		memcpy(ptr, &light, 4); ptr += 4;
2405 		memcpy(ptr, &pname, 4); ptr += 4;
2406 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2407 
2408 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2409 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2410 
2411 	stream->readback(params, __size_params);
2412 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2413 	if (useChecksum) {
2414 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2415 		stream->readback(checksumBuf.get(), checksumSize);
2416 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2417 			ALOGE("glGetLightxv: GL communication error, please report this issue to b.android.com.\n");
2418 			abort();
2419 		}
2420 	}
2421 }
2422 
glGetMaterialxv_enc(void * self,GLenum face,GLenum pname,GLfixed * params)2423 void glGetMaterialxv_enc(void *self , GLenum face, GLenum pname, GLfixed* params)
2424 {
2425 
2426 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2427 	IOStream *stream = ctx->m_stream;
2428 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2429 	bool useChecksum = checksumCalculator->getVersion() > 0;
2430 
2431 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2432 	 unsigned char *ptr;
2433 	 unsigned char *buf;
2434 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2435 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2436 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2437 	buf = stream->alloc(totalSize);
2438 	ptr = buf;
2439 	int tmp = OP_glGetMaterialxv;memcpy(ptr, &tmp, 4); ptr += 4;
2440 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2441 
2442 		memcpy(ptr, &face, 4); ptr += 4;
2443 		memcpy(ptr, &pname, 4); ptr += 4;
2444 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2445 
2446 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2447 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2448 
2449 	stream->readback(params, __size_params);
2450 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2451 	if (useChecksum) {
2452 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2453 		stream->readback(checksumBuf.get(), checksumSize);
2454 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2455 			ALOGE("glGetMaterialxv: GL communication error, please report this issue to b.android.com.\n");
2456 			abort();
2457 		}
2458 	}
2459 }
2460 
glGetTexEnviv_enc(void * self,GLenum env,GLenum pname,GLint * params)2461 void glGetTexEnviv_enc(void *self , GLenum env, GLenum pname, GLint* params)
2462 {
2463 
2464 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2465 	IOStream *stream = ctx->m_stream;
2466 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2467 	bool useChecksum = checksumCalculator->getVersion() > 0;
2468 
2469 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
2470 	 unsigned char *ptr;
2471 	 unsigned char *buf;
2472 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2473 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2474 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2475 	buf = stream->alloc(totalSize);
2476 	ptr = buf;
2477 	int tmp = OP_glGetTexEnviv;memcpy(ptr, &tmp, 4); ptr += 4;
2478 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2479 
2480 		memcpy(ptr, &env, 4); ptr += 4;
2481 		memcpy(ptr, &pname, 4); ptr += 4;
2482 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2483 
2484 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2485 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2486 
2487 	stream->readback(params, __size_params);
2488 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2489 	if (useChecksum) {
2490 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2491 		stream->readback(checksumBuf.get(), checksumSize);
2492 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2493 			ALOGE("glGetTexEnviv: GL communication error, please report this issue to b.android.com.\n");
2494 			abort();
2495 		}
2496 	}
2497 }
2498 
glGetTexEnvxv_enc(void * self,GLenum env,GLenum pname,GLfixed * params)2499 void glGetTexEnvxv_enc(void *self , GLenum env, GLenum pname, GLfixed* params)
2500 {
2501 
2502 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2503 	IOStream *stream = ctx->m_stream;
2504 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2505 	bool useChecksum = checksumCalculator->getVersion() > 0;
2506 
2507 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2508 	 unsigned char *ptr;
2509 	 unsigned char *buf;
2510 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2511 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2512 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2513 	buf = stream->alloc(totalSize);
2514 	ptr = buf;
2515 	int tmp = OP_glGetTexEnvxv;memcpy(ptr, &tmp, 4); ptr += 4;
2516 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2517 
2518 		memcpy(ptr, &env, 4); ptr += 4;
2519 		memcpy(ptr, &pname, 4); ptr += 4;
2520 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2521 
2522 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2523 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2524 
2525 	stream->readback(params, __size_params);
2526 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2527 	if (useChecksum) {
2528 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2529 		stream->readback(checksumBuf.get(), checksumSize);
2530 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2531 			ALOGE("glGetTexEnvxv: GL communication error, please report this issue to b.android.com.\n");
2532 			abort();
2533 		}
2534 	}
2535 }
2536 
glGetTexParameteriv_enc(void * self,GLenum target,GLenum pname,GLint * params)2537 void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2538 {
2539 
2540 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2541 	IOStream *stream = ctx->m_stream;
2542 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2543 	bool useChecksum = checksumCalculator->getVersion() > 0;
2544 
2545 	const unsigned int __size_params =  (sizeof(GLint));
2546 	 unsigned char *ptr;
2547 	 unsigned char *buf;
2548 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2549 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2550 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2551 	buf = stream->alloc(totalSize);
2552 	ptr = buf;
2553 	int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
2554 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2555 
2556 		memcpy(ptr, &target, 4); ptr += 4;
2557 		memcpy(ptr, &pname, 4); ptr += 4;
2558 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2559 
2560 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2561 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2562 
2563 	stream->readback(params, __size_params);
2564 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2565 	if (useChecksum) {
2566 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2567 		stream->readback(checksumBuf.get(), checksumSize);
2568 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2569 			ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
2570 			abort();
2571 		}
2572 	}
2573 }
2574 
glGetTexParameterxv_enc(void * self,GLenum target,GLenum pname,GLfixed * params)2575 void glGetTexParameterxv_enc(void *self , GLenum target, GLenum pname, GLfixed* params)
2576 {
2577 
2578 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2579 	IOStream *stream = ctx->m_stream;
2580 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2581 	bool useChecksum = checksumCalculator->getVersion() > 0;
2582 
2583 	const unsigned int __size_params =  (sizeof(GLfixed));
2584 	 unsigned char *ptr;
2585 	 unsigned char *buf;
2586 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2587 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2588 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2589 	buf = stream->alloc(totalSize);
2590 	ptr = buf;
2591 	int tmp = OP_glGetTexParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
2592 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2593 
2594 		memcpy(ptr, &target, 4); ptr += 4;
2595 		memcpy(ptr, &pname, 4); ptr += 4;
2596 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2597 
2598 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2599 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2600 
2601 	stream->readback(params, __size_params);
2602 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2603 	if (useChecksum) {
2604 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2605 		stream->readback(checksumBuf.get(), checksumSize);
2606 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2607 			ALOGE("glGetTexParameterxv: GL communication error, please report this issue to b.android.com.\n");
2608 			abort();
2609 		}
2610 	}
2611 }
2612 
glHint_enc(void * self,GLenum target,GLenum mode)2613 void glHint_enc(void *self , GLenum target, GLenum mode)
2614 {
2615 
2616 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2617 	IOStream *stream = ctx->m_stream;
2618 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2619 	bool useChecksum = checksumCalculator->getVersion() > 0;
2620 
2621 	 unsigned char *ptr;
2622 	 unsigned char *buf;
2623 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2624 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2625 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2626 	buf = stream->alloc(totalSize);
2627 	ptr = buf;
2628 	int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
2629 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2630 
2631 		memcpy(ptr, &target, 4); ptr += 4;
2632 		memcpy(ptr, &mode, 4); ptr += 4;
2633 
2634 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2635 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2636 
2637 }
2638 
glIsBuffer_enc(void * self,GLuint buffer)2639 GLboolean glIsBuffer_enc(void *self , GLuint buffer)
2640 {
2641 
2642 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2643 	IOStream *stream = ctx->m_stream;
2644 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2645 	bool useChecksum = checksumCalculator->getVersion() > 0;
2646 
2647 	 unsigned char *ptr;
2648 	 unsigned char *buf;
2649 	 const size_t sizeWithoutChecksum = 8 + 4;
2650 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2651 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2652 	buf = stream->alloc(totalSize);
2653 	ptr = buf;
2654 	int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
2655 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2656 
2657 		memcpy(ptr, &buffer, 4); ptr += 4;
2658 
2659 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2660 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2661 
2662 
2663 	GLboolean retval;
2664 	stream->readback(&retval, 1);
2665 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2666 	if (useChecksum) {
2667 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2668 		stream->readback(checksumBuf.get(), checksumSize);
2669 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2670 			ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
2671 			abort();
2672 		}
2673 	}
2674 	return retval;
2675 }
2676 
glIsEnabled_enc(void * self,GLenum cap)2677 GLboolean glIsEnabled_enc(void *self , GLenum cap)
2678 {
2679 
2680 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2681 	IOStream *stream = ctx->m_stream;
2682 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2683 	bool useChecksum = checksumCalculator->getVersion() > 0;
2684 
2685 	 unsigned char *ptr;
2686 	 unsigned char *buf;
2687 	 const size_t sizeWithoutChecksum = 8 + 4;
2688 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2689 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2690 	buf = stream->alloc(totalSize);
2691 	ptr = buf;
2692 	int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
2693 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2694 
2695 		memcpy(ptr, &cap, 4); ptr += 4;
2696 
2697 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2698 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2699 
2700 
2701 	GLboolean retval;
2702 	stream->readback(&retval, 1);
2703 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2704 	if (useChecksum) {
2705 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2706 		stream->readback(checksumBuf.get(), checksumSize);
2707 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2708 			ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
2709 			abort();
2710 		}
2711 	}
2712 	return retval;
2713 }
2714 
glIsTexture_enc(void * self,GLuint texture)2715 GLboolean glIsTexture_enc(void *self , GLuint texture)
2716 {
2717 
2718 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2719 	IOStream *stream = ctx->m_stream;
2720 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2721 	bool useChecksum = checksumCalculator->getVersion() > 0;
2722 
2723 	 unsigned char *ptr;
2724 	 unsigned char *buf;
2725 	 const size_t sizeWithoutChecksum = 8 + 4;
2726 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2727 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2728 	buf = stream->alloc(totalSize);
2729 	ptr = buf;
2730 	int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
2731 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2732 
2733 		memcpy(ptr, &texture, 4); ptr += 4;
2734 
2735 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2736 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2737 
2738 
2739 	GLboolean retval;
2740 	stream->readback(&retval, 1);
2741 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2742 	if (useChecksum) {
2743 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
2744 		stream->readback(checksumBuf.get(), checksumSize);
2745 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
2746 			ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
2747 			abort();
2748 		}
2749 	}
2750 	return retval;
2751 }
2752 
glLightModelx_enc(void * self,GLenum pname,GLfixed param)2753 void glLightModelx_enc(void *self , GLenum pname, GLfixed param)
2754 {
2755 
2756 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2757 	IOStream *stream = ctx->m_stream;
2758 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2759 	bool useChecksum = checksumCalculator->getVersion() > 0;
2760 
2761 	 unsigned char *ptr;
2762 	 unsigned char *buf;
2763 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2764 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2765 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2766 	buf = stream->alloc(totalSize);
2767 	ptr = buf;
2768 	int tmp = OP_glLightModelx;memcpy(ptr, &tmp, 4); ptr += 4;
2769 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2770 
2771 		memcpy(ptr, &pname, 4); ptr += 4;
2772 		memcpy(ptr, &param, 4); ptr += 4;
2773 
2774 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2775 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2776 
2777 }
2778 
glLightModelxv_enc(void * self,GLenum pname,const GLfixed * params)2779 void glLightModelxv_enc(void *self , GLenum pname, const GLfixed* params)
2780 {
2781 
2782 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2783 	IOStream *stream = ctx->m_stream;
2784 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2785 	bool useChecksum = checksumCalculator->getVersion() > 0;
2786 
2787 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2788 	 unsigned char *ptr;
2789 	 unsigned char *buf;
2790 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
2791 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2792 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2793 	buf = stream->alloc(totalSize);
2794 	ptr = buf;
2795 	int tmp = OP_glLightModelxv;memcpy(ptr, &tmp, 4); ptr += 4;
2796 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2797 
2798 		memcpy(ptr, &pname, 4); ptr += 4;
2799 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2800 	memcpy(ptr, params, __size_params);ptr += __size_params;
2801 
2802 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2803 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2804 
2805 }
2806 
glLightx_enc(void * self,GLenum light,GLenum pname,GLfixed param)2807 void glLightx_enc(void *self , GLenum light, GLenum pname, GLfixed param)
2808 {
2809 
2810 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2811 	IOStream *stream = ctx->m_stream;
2812 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2813 	bool useChecksum = checksumCalculator->getVersion() > 0;
2814 
2815 	 unsigned char *ptr;
2816 	 unsigned char *buf;
2817 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
2818 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2819 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2820 	buf = stream->alloc(totalSize);
2821 	ptr = buf;
2822 	int tmp = OP_glLightx;memcpy(ptr, &tmp, 4); ptr += 4;
2823 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2824 
2825 		memcpy(ptr, &light, 4); ptr += 4;
2826 		memcpy(ptr, &pname, 4); ptr += 4;
2827 		memcpy(ptr, &param, 4); ptr += 4;
2828 
2829 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2830 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2831 
2832 }
2833 
glLightxv_enc(void * self,GLenum light,GLenum pname,const GLfixed * params)2834 void glLightxv_enc(void *self , GLenum light, GLenum pname, const GLfixed* params)
2835 {
2836 
2837 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2838 	IOStream *stream = ctx->m_stream;
2839 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2840 	bool useChecksum = checksumCalculator->getVersion() > 0;
2841 
2842 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
2843 	 unsigned char *ptr;
2844 	 unsigned char *buf;
2845 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
2846 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2847 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2848 	buf = stream->alloc(totalSize);
2849 	ptr = buf;
2850 	int tmp = OP_glLightxv;memcpy(ptr, &tmp, 4); ptr += 4;
2851 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2852 
2853 		memcpy(ptr, &light, 4); ptr += 4;
2854 		memcpy(ptr, &pname, 4); ptr += 4;
2855 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
2856 	memcpy(ptr, params, __size_params);ptr += __size_params;
2857 
2858 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2859 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2860 
2861 }
2862 
glLineWidthx_enc(void * self,GLfixed width)2863 void glLineWidthx_enc(void *self , GLfixed width)
2864 {
2865 
2866 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2867 	IOStream *stream = ctx->m_stream;
2868 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2869 	bool useChecksum = checksumCalculator->getVersion() > 0;
2870 
2871 	 unsigned char *ptr;
2872 	 unsigned char *buf;
2873 	 const size_t sizeWithoutChecksum = 8 + 4;
2874 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2875 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2876 	buf = stream->alloc(totalSize);
2877 	ptr = buf;
2878 	int tmp = OP_glLineWidthx;memcpy(ptr, &tmp, 4); ptr += 4;
2879 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2880 
2881 		memcpy(ptr, &width, 4); ptr += 4;
2882 
2883 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2884 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2885 
2886 }
2887 
glLoadIdentity_enc(void * self)2888 void glLoadIdentity_enc(void *self )
2889 {
2890 
2891 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2892 	IOStream *stream = ctx->m_stream;
2893 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2894 	bool useChecksum = checksumCalculator->getVersion() > 0;
2895 
2896 	 unsigned char *ptr;
2897 	 unsigned char *buf;
2898 	 const size_t sizeWithoutChecksum = 8;
2899 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2900 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2901 	buf = stream->alloc(totalSize);
2902 	ptr = buf;
2903 	int tmp = OP_glLoadIdentity;memcpy(ptr, &tmp, 4); ptr += 4;
2904 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2905 
2906 
2907 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2908 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2909 
2910 }
2911 
glLoadMatrixx_enc(void * self,const GLfixed * m)2912 void glLoadMatrixx_enc(void *self , const GLfixed* m)
2913 {
2914 
2915 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2916 	IOStream *stream = ctx->m_stream;
2917 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2918 	bool useChecksum = checksumCalculator->getVersion() > 0;
2919 
2920 	const unsigned int __size_m =  (16 * sizeof(GLfixed));
2921 	 unsigned char *ptr;
2922 	 unsigned char *buf;
2923 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
2924 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2925 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2926 	buf = stream->alloc(totalSize);
2927 	ptr = buf;
2928 	int tmp = OP_glLoadMatrixx;memcpy(ptr, &tmp, 4); ptr += 4;
2929 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2930 
2931 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
2932 	memcpy(ptr, m, __size_m);ptr += __size_m;
2933 
2934 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2935 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2936 
2937 }
2938 
glLogicOp_enc(void * self,GLenum opcode)2939 void glLogicOp_enc(void *self , GLenum opcode)
2940 {
2941 
2942 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2943 	IOStream *stream = ctx->m_stream;
2944 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2945 	bool useChecksum = checksumCalculator->getVersion() > 0;
2946 
2947 	 unsigned char *ptr;
2948 	 unsigned char *buf;
2949 	 const size_t sizeWithoutChecksum = 8 + 4;
2950 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2951 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2952 	buf = stream->alloc(totalSize);
2953 	ptr = buf;
2954 	int tmp = OP_glLogicOp;memcpy(ptr, &tmp, 4); ptr += 4;
2955 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2956 
2957 		memcpy(ptr, &opcode, 4); ptr += 4;
2958 
2959 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2960 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2961 
2962 }
2963 
glMaterialx_enc(void * self,GLenum face,GLenum pname,GLfixed param)2964 void glMaterialx_enc(void *self , GLenum face, GLenum pname, GLfixed param)
2965 {
2966 
2967 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2968 	IOStream *stream = ctx->m_stream;
2969 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2970 	bool useChecksum = checksumCalculator->getVersion() > 0;
2971 
2972 	 unsigned char *ptr;
2973 	 unsigned char *buf;
2974 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
2975 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
2976 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2977 	buf = stream->alloc(totalSize);
2978 	ptr = buf;
2979 	int tmp = OP_glMaterialx;memcpy(ptr, &tmp, 4); ptr += 4;
2980 	memcpy(ptr, &totalSize, 4);  ptr += 4;
2981 
2982 		memcpy(ptr, &face, 4); ptr += 4;
2983 		memcpy(ptr, &pname, 4); ptr += 4;
2984 		memcpy(ptr, &param, 4); ptr += 4;
2985 
2986 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2987 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2988 
2989 }
2990 
glMaterialxv_enc(void * self,GLenum face,GLenum pname,const GLfixed * params)2991 void glMaterialxv_enc(void *self , GLenum face, GLenum pname, const GLfixed* params)
2992 {
2993 
2994 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
2995 	IOStream *stream = ctx->m_stream;
2996 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
2997 	bool useChecksum = checksumCalculator->getVersion() > 0;
2998 
2999 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
3000 	 unsigned char *ptr;
3001 	 unsigned char *buf;
3002 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3003 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3004 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3005 	buf = stream->alloc(totalSize);
3006 	ptr = buf;
3007 	int tmp = OP_glMaterialxv;memcpy(ptr, &tmp, 4); ptr += 4;
3008 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3009 
3010 		memcpy(ptr, &face, 4); ptr += 4;
3011 		memcpy(ptr, &pname, 4); ptr += 4;
3012 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3013 	memcpy(ptr, params, __size_params);ptr += __size_params;
3014 
3015 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3016 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3017 
3018 }
3019 
glMatrixMode_enc(void * self,GLenum mode)3020 void glMatrixMode_enc(void *self , GLenum mode)
3021 {
3022 
3023 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3024 	IOStream *stream = ctx->m_stream;
3025 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3026 	bool useChecksum = checksumCalculator->getVersion() > 0;
3027 
3028 	 unsigned char *ptr;
3029 	 unsigned char *buf;
3030 	 const size_t sizeWithoutChecksum = 8 + 4;
3031 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3032 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3033 	buf = stream->alloc(totalSize);
3034 	ptr = buf;
3035 	int tmp = OP_glMatrixMode;memcpy(ptr, &tmp, 4); ptr += 4;
3036 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3037 
3038 		memcpy(ptr, &mode, 4); ptr += 4;
3039 
3040 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3041 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3042 
3043 }
3044 
glMultMatrixx_enc(void * self,const GLfixed * m)3045 void glMultMatrixx_enc(void *self , const GLfixed* m)
3046 {
3047 
3048 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3049 	IOStream *stream = ctx->m_stream;
3050 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3051 	bool useChecksum = checksumCalculator->getVersion() > 0;
3052 
3053 	const unsigned int __size_m =  (16 * sizeof(GLfixed));
3054 	 unsigned char *ptr;
3055 	 unsigned char *buf;
3056 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
3057 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3058 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3059 	buf = stream->alloc(totalSize);
3060 	ptr = buf;
3061 	int tmp = OP_glMultMatrixx;memcpy(ptr, &tmp, 4); ptr += 4;
3062 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3063 
3064 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
3065 	memcpy(ptr, m, __size_m);ptr += __size_m;
3066 
3067 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3068 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3069 
3070 }
3071 
glMultiTexCoord4x_enc(void * self,GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)3072 void glMultiTexCoord4x_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
3073 {
3074 
3075 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3076 	IOStream *stream = ctx->m_stream;
3077 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3078 	bool useChecksum = checksumCalculator->getVersion() > 0;
3079 
3080 	 unsigned char *ptr;
3081 	 unsigned char *buf;
3082 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3083 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3084 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3085 	buf = stream->alloc(totalSize);
3086 	ptr = buf;
3087 	int tmp = OP_glMultiTexCoord4x;memcpy(ptr, &tmp, 4); ptr += 4;
3088 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3089 
3090 		memcpy(ptr, &target, 4); ptr += 4;
3091 		memcpy(ptr, &s, 4); ptr += 4;
3092 		memcpy(ptr, &t, 4); ptr += 4;
3093 		memcpy(ptr, &r, 4); ptr += 4;
3094 		memcpy(ptr, &q, 4); ptr += 4;
3095 
3096 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3097 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3098 
3099 }
3100 
glNormal3x_enc(void * self,GLfixed nx,GLfixed ny,GLfixed nz)3101 void glNormal3x_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz)
3102 {
3103 
3104 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3105 	IOStream *stream = ctx->m_stream;
3106 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3107 	bool useChecksum = checksumCalculator->getVersion() > 0;
3108 
3109 	 unsigned char *ptr;
3110 	 unsigned char *buf;
3111 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3112 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3113 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3114 	buf = stream->alloc(totalSize);
3115 	ptr = buf;
3116 	int tmp = OP_glNormal3x;memcpy(ptr, &tmp, 4); ptr += 4;
3117 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3118 
3119 		memcpy(ptr, &nx, 4); ptr += 4;
3120 		memcpy(ptr, &ny, 4); ptr += 4;
3121 		memcpy(ptr, &nz, 4); ptr += 4;
3122 
3123 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3124 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3125 
3126 }
3127 
glOrthox_enc(void * self,GLfixed left,GLfixed right,GLfixed bottom,GLfixed top,GLfixed zNear,GLfixed zFar)3128 void glOrthox_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
3129 {
3130 
3131 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3132 	IOStream *stream = ctx->m_stream;
3133 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3134 	bool useChecksum = checksumCalculator->getVersion() > 0;
3135 
3136 	 unsigned char *ptr;
3137 	 unsigned char *buf;
3138 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
3139 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3140 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3141 	buf = stream->alloc(totalSize);
3142 	ptr = buf;
3143 	int tmp = OP_glOrthox;memcpy(ptr, &tmp, 4); ptr += 4;
3144 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3145 
3146 		memcpy(ptr, &left, 4); ptr += 4;
3147 		memcpy(ptr, &right, 4); ptr += 4;
3148 		memcpy(ptr, &bottom, 4); ptr += 4;
3149 		memcpy(ptr, &top, 4); ptr += 4;
3150 		memcpy(ptr, &zNear, 4); ptr += 4;
3151 		memcpy(ptr, &zFar, 4); ptr += 4;
3152 
3153 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3154 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3155 
3156 }
3157 
glPixelStorei_enc(void * self,GLenum pname,GLint param)3158 void glPixelStorei_enc(void *self , GLenum pname, GLint param)
3159 {
3160 
3161 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3162 	IOStream *stream = ctx->m_stream;
3163 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3164 	bool useChecksum = checksumCalculator->getVersion() > 0;
3165 
3166 	 unsigned char *ptr;
3167 	 unsigned char *buf;
3168 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3169 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3170 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3171 	buf = stream->alloc(totalSize);
3172 	ptr = buf;
3173 	int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
3174 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3175 
3176 		memcpy(ptr, &pname, 4); ptr += 4;
3177 		memcpy(ptr, &param, 4); ptr += 4;
3178 
3179 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3180 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3181 
3182 }
3183 
glPointParameterx_enc(void * self,GLenum pname,GLfixed param)3184 void glPointParameterx_enc(void *self , GLenum pname, GLfixed param)
3185 {
3186 
3187 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3188 	IOStream *stream = ctx->m_stream;
3189 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3190 	bool useChecksum = checksumCalculator->getVersion() > 0;
3191 
3192 	 unsigned char *ptr;
3193 	 unsigned char *buf;
3194 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3195 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3196 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3197 	buf = stream->alloc(totalSize);
3198 	ptr = buf;
3199 	int tmp = OP_glPointParameterx;memcpy(ptr, &tmp, 4); ptr += 4;
3200 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3201 
3202 		memcpy(ptr, &pname, 4); ptr += 4;
3203 		memcpy(ptr, &param, 4); ptr += 4;
3204 
3205 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3206 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3207 
3208 }
3209 
glPointParameterxv_enc(void * self,GLenum pname,const GLfixed * params)3210 void glPointParameterxv_enc(void *self , GLenum pname, const GLfixed* params)
3211 {
3212 
3213 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3214 	IOStream *stream = ctx->m_stream;
3215 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3216 	bool useChecksum = checksumCalculator->getVersion() > 0;
3217 
3218 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
3219 	 unsigned char *ptr;
3220 	 unsigned char *buf;
3221 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
3222 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3223 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3224 	buf = stream->alloc(totalSize);
3225 	ptr = buf;
3226 	int tmp = OP_glPointParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
3227 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3228 
3229 		memcpy(ptr, &pname, 4); ptr += 4;
3230 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3231 	memcpy(ptr, params, __size_params);ptr += __size_params;
3232 
3233 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3234 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3235 
3236 }
3237 
glPointSizex_enc(void * self,GLfixed size)3238 void glPointSizex_enc(void *self , GLfixed size)
3239 {
3240 
3241 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3242 	IOStream *stream = ctx->m_stream;
3243 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3244 	bool useChecksum = checksumCalculator->getVersion() > 0;
3245 
3246 	 unsigned char *ptr;
3247 	 unsigned char *buf;
3248 	 const size_t sizeWithoutChecksum = 8 + 4;
3249 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3250 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3251 	buf = stream->alloc(totalSize);
3252 	ptr = buf;
3253 	int tmp = OP_glPointSizex;memcpy(ptr, &tmp, 4); ptr += 4;
3254 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3255 
3256 		memcpy(ptr, &size, 4); ptr += 4;
3257 
3258 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3259 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3260 
3261 }
3262 
glPolygonOffsetx_enc(void * self,GLfixed factor,GLfixed units)3263 void glPolygonOffsetx_enc(void *self , GLfixed factor, GLfixed units)
3264 {
3265 
3266 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3267 	IOStream *stream = ctx->m_stream;
3268 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3269 	bool useChecksum = checksumCalculator->getVersion() > 0;
3270 
3271 	 unsigned char *ptr;
3272 	 unsigned char *buf;
3273 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3274 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3275 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3276 	buf = stream->alloc(totalSize);
3277 	ptr = buf;
3278 	int tmp = OP_glPolygonOffsetx;memcpy(ptr, &tmp, 4); ptr += 4;
3279 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3280 
3281 		memcpy(ptr, &factor, 4); ptr += 4;
3282 		memcpy(ptr, &units, 4); ptr += 4;
3283 
3284 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3285 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3286 
3287 }
3288 
glPopMatrix_enc(void * self)3289 void glPopMatrix_enc(void *self )
3290 {
3291 
3292 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3293 	IOStream *stream = ctx->m_stream;
3294 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3295 	bool useChecksum = checksumCalculator->getVersion() > 0;
3296 
3297 	 unsigned char *ptr;
3298 	 unsigned char *buf;
3299 	 const size_t sizeWithoutChecksum = 8;
3300 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3301 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3302 	buf = stream->alloc(totalSize);
3303 	ptr = buf;
3304 	int tmp = OP_glPopMatrix;memcpy(ptr, &tmp, 4); ptr += 4;
3305 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3306 
3307 
3308 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3309 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3310 
3311 }
3312 
glPushMatrix_enc(void * self)3313 void glPushMatrix_enc(void *self )
3314 {
3315 
3316 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3317 	IOStream *stream = ctx->m_stream;
3318 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3319 	bool useChecksum = checksumCalculator->getVersion() > 0;
3320 
3321 	 unsigned char *ptr;
3322 	 unsigned char *buf;
3323 	 const size_t sizeWithoutChecksum = 8;
3324 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3325 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3326 	buf = stream->alloc(totalSize);
3327 	ptr = buf;
3328 	int tmp = OP_glPushMatrix;memcpy(ptr, &tmp, 4); ptr += 4;
3329 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3330 
3331 
3332 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3333 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3334 
3335 }
3336 
glReadPixels_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLvoid * pixels)3337 void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
3338 {
3339 
3340 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3341 	IOStream *stream = ctx->m_stream;
3342 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3343 	bool useChecksum = checksumCalculator->getVersion() > 0;
3344 
3345 	const unsigned int __size_pixels =  glesv1_enc::pixelDataSize(self, width, height, format, type, 1);
3346 	 unsigned char *ptr;
3347 	 unsigned char *buf;
3348 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3349 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3350 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3351 	buf = stream->alloc(totalSize);
3352 	ptr = buf;
3353 	int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
3354 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3355 
3356 		memcpy(ptr, &x, 4); ptr += 4;
3357 		memcpy(ptr, &y, 4); ptr += 4;
3358 		memcpy(ptr, &width, 4); ptr += 4;
3359 		memcpy(ptr, &height, 4); ptr += 4;
3360 		memcpy(ptr, &format, 4); ptr += 4;
3361 		memcpy(ptr, &type, 4); ptr += 4;
3362 	*(unsigned int *)(ptr) = __size_pixels; ptr += 4;
3363 
3364 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3365 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3366 
3367 	stream->readback(pixels, __size_pixels);
3368 	if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3369 	if (useChecksum) {
3370 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
3371 		stream->readback(checksumBuf.get(), checksumSize);
3372 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
3373 			ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3374 			abort();
3375 		}
3376 	}
3377 }
3378 
glRotatex_enc(void * self,GLfixed angle,GLfixed x,GLfixed y,GLfixed z)3379 void glRotatex_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
3380 {
3381 
3382 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3383 	IOStream *stream = ctx->m_stream;
3384 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3385 	bool useChecksum = checksumCalculator->getVersion() > 0;
3386 
3387 	 unsigned char *ptr;
3388 	 unsigned char *buf;
3389 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3390 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3391 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3392 	buf = stream->alloc(totalSize);
3393 	ptr = buf;
3394 	int tmp = OP_glRotatex;memcpy(ptr, &tmp, 4); ptr += 4;
3395 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3396 
3397 		memcpy(ptr, &angle, 4); ptr += 4;
3398 		memcpy(ptr, &x, 4); ptr += 4;
3399 		memcpy(ptr, &y, 4); ptr += 4;
3400 		memcpy(ptr, &z, 4); ptr += 4;
3401 
3402 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3403 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3404 
3405 }
3406 
glSampleCoverage_enc(void * self,GLclampf value,GLboolean invert)3407 void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
3408 {
3409 
3410 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3411 	IOStream *stream = ctx->m_stream;
3412 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3413 	bool useChecksum = checksumCalculator->getVersion() > 0;
3414 
3415 	 unsigned char *ptr;
3416 	 unsigned char *buf;
3417 	 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3418 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3419 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3420 	buf = stream->alloc(totalSize);
3421 	ptr = buf;
3422 	int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
3423 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3424 
3425 		memcpy(ptr, &value, 4); ptr += 4;
3426 		memcpy(ptr, &invert, 1); ptr += 1;
3427 
3428 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3429 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3430 
3431 }
3432 
glSampleCoveragex_enc(void * self,GLclampx value,GLboolean invert)3433 void glSampleCoveragex_enc(void *self , GLclampx value, GLboolean invert)
3434 {
3435 
3436 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3437 	IOStream *stream = ctx->m_stream;
3438 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3439 	bool useChecksum = checksumCalculator->getVersion() > 0;
3440 
3441 	 unsigned char *ptr;
3442 	 unsigned char *buf;
3443 	 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3444 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3445 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3446 	buf = stream->alloc(totalSize);
3447 	ptr = buf;
3448 	int tmp = OP_glSampleCoveragex;memcpy(ptr, &tmp, 4); ptr += 4;
3449 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3450 
3451 		memcpy(ptr, &value, 4); ptr += 4;
3452 		memcpy(ptr, &invert, 1); ptr += 1;
3453 
3454 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3455 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3456 
3457 }
3458 
glScalex_enc(void * self,GLfixed x,GLfixed y,GLfixed z)3459 void glScalex_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
3460 {
3461 
3462 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3463 	IOStream *stream = ctx->m_stream;
3464 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3465 	bool useChecksum = checksumCalculator->getVersion() > 0;
3466 
3467 	 unsigned char *ptr;
3468 	 unsigned char *buf;
3469 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3470 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3471 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3472 	buf = stream->alloc(totalSize);
3473 	ptr = buf;
3474 	int tmp = OP_glScalex;memcpy(ptr, &tmp, 4); ptr += 4;
3475 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3476 
3477 		memcpy(ptr, &x, 4); ptr += 4;
3478 		memcpy(ptr, &y, 4); ptr += 4;
3479 		memcpy(ptr, &z, 4); ptr += 4;
3480 
3481 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3482 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3483 
3484 }
3485 
glScissor_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)3486 void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3487 {
3488 
3489 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3490 	IOStream *stream = ctx->m_stream;
3491 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3492 	bool useChecksum = checksumCalculator->getVersion() > 0;
3493 
3494 	 unsigned char *ptr;
3495 	 unsigned char *buf;
3496 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3497 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3498 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3499 	buf = stream->alloc(totalSize);
3500 	ptr = buf;
3501 	int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
3502 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3503 
3504 		memcpy(ptr, &x, 4); ptr += 4;
3505 		memcpy(ptr, &y, 4); ptr += 4;
3506 		memcpy(ptr, &width, 4); ptr += 4;
3507 		memcpy(ptr, &height, 4); ptr += 4;
3508 
3509 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3510 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3511 
3512 }
3513 
glShadeModel_enc(void * self,GLenum mode)3514 void glShadeModel_enc(void *self , GLenum mode)
3515 {
3516 
3517 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3518 	IOStream *stream = ctx->m_stream;
3519 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3520 	bool useChecksum = checksumCalculator->getVersion() > 0;
3521 
3522 	 unsigned char *ptr;
3523 	 unsigned char *buf;
3524 	 const size_t sizeWithoutChecksum = 8 + 4;
3525 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3526 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3527 	buf = stream->alloc(totalSize);
3528 	ptr = buf;
3529 	int tmp = OP_glShadeModel;memcpy(ptr, &tmp, 4); ptr += 4;
3530 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3531 
3532 		memcpy(ptr, &mode, 4); ptr += 4;
3533 
3534 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3535 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3536 
3537 }
3538 
glStencilFunc_enc(void * self,GLenum func,GLint ref,GLuint mask)3539 void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
3540 {
3541 
3542 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3543 	IOStream *stream = ctx->m_stream;
3544 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3545 	bool useChecksum = checksumCalculator->getVersion() > 0;
3546 
3547 	 unsigned char *ptr;
3548 	 unsigned char *buf;
3549 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3550 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3551 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3552 	buf = stream->alloc(totalSize);
3553 	ptr = buf;
3554 	int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
3555 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3556 
3557 		memcpy(ptr, &func, 4); ptr += 4;
3558 		memcpy(ptr, &ref, 4); ptr += 4;
3559 		memcpy(ptr, &mask, 4); ptr += 4;
3560 
3561 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3562 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3563 
3564 }
3565 
glStencilMask_enc(void * self,GLuint mask)3566 void glStencilMask_enc(void *self , GLuint mask)
3567 {
3568 
3569 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3570 	IOStream *stream = ctx->m_stream;
3571 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3572 	bool useChecksum = checksumCalculator->getVersion() > 0;
3573 
3574 	 unsigned char *ptr;
3575 	 unsigned char *buf;
3576 	 const size_t sizeWithoutChecksum = 8 + 4;
3577 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3578 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3579 	buf = stream->alloc(totalSize);
3580 	ptr = buf;
3581 	int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
3582 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3583 
3584 		memcpy(ptr, &mask, 4); ptr += 4;
3585 
3586 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3587 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3588 
3589 }
3590 
glStencilOp_enc(void * self,GLenum fail,GLenum zfail,GLenum zpass)3591 void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
3592 {
3593 
3594 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3595 	IOStream *stream = ctx->m_stream;
3596 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3597 	bool useChecksum = checksumCalculator->getVersion() > 0;
3598 
3599 	 unsigned char *ptr;
3600 	 unsigned char *buf;
3601 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3602 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3603 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3604 	buf = stream->alloc(totalSize);
3605 	ptr = buf;
3606 	int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
3607 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3608 
3609 		memcpy(ptr, &fail, 4); ptr += 4;
3610 		memcpy(ptr, &zfail, 4); ptr += 4;
3611 		memcpy(ptr, &zpass, 4); ptr += 4;
3612 
3613 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3614 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3615 
3616 }
3617 
glTexEnvi_enc(void * self,GLenum target,GLenum pname,GLint param)3618 void glTexEnvi_enc(void *self , GLenum target, GLenum pname, GLint param)
3619 {
3620 
3621 	gl_encoder_context_t *ctx = (gl_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_glTexEnvi;memcpy(ptr, &tmp, 4); ptr += 4;
3634 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3635 
3636 		memcpy(ptr, &target, 4); ptr += 4;
3637 		memcpy(ptr, &pname, 4); ptr += 4;
3638 		memcpy(ptr, &param, 4); ptr += 4;
3639 
3640 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3641 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3642 
3643 }
3644 
glTexEnvx_enc(void * self,GLenum target,GLenum pname,GLfixed param)3645 void glTexEnvx_enc(void *self , GLenum target, GLenum pname, GLfixed param)
3646 {
3647 
3648 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3649 	IOStream *stream = ctx->m_stream;
3650 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3651 	bool useChecksum = checksumCalculator->getVersion() > 0;
3652 
3653 	 unsigned char *ptr;
3654 	 unsigned char *buf;
3655 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3656 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3657 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3658 	buf = stream->alloc(totalSize);
3659 	ptr = buf;
3660 	int tmp = OP_glTexEnvx;memcpy(ptr, &tmp, 4); ptr += 4;
3661 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3662 
3663 		memcpy(ptr, &target, 4); ptr += 4;
3664 		memcpy(ptr, &pname, 4); ptr += 4;
3665 		memcpy(ptr, &param, 4); ptr += 4;
3666 
3667 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3668 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3669 
3670 }
3671 
glTexEnviv_enc(void * self,GLenum target,GLenum pname,const GLint * params)3672 void glTexEnviv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3673 {
3674 
3675 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3676 	IOStream *stream = ctx->m_stream;
3677 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3678 	bool useChecksum = checksumCalculator->getVersion() > 0;
3679 
3680 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
3681 	 unsigned char *ptr;
3682 	 unsigned char *buf;
3683 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3684 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3685 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3686 	buf = stream->alloc(totalSize);
3687 	ptr = buf;
3688 	int tmp = OP_glTexEnviv;memcpy(ptr, &tmp, 4); ptr += 4;
3689 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3690 
3691 		memcpy(ptr, &target, 4); ptr += 4;
3692 		memcpy(ptr, &pname, 4); ptr += 4;
3693 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3694 	memcpy(ptr, params, __size_params);ptr += __size_params;
3695 
3696 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3697 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3698 
3699 }
3700 
glTexEnvxv_enc(void * self,GLenum target,GLenum pname,const GLfixed * params)3701 void glTexEnvxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
3702 {
3703 
3704 	gl_encoder_context_t *ctx = (gl_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_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
3710 	 unsigned char *ptr;
3711 	 unsigned char *buf;
3712 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 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_glTexEnvxv;memcpy(ptr, &tmp, 4); ptr += 4;
3718 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3719 
3720 		memcpy(ptr, &target, 4); ptr += 4;
3721 		memcpy(ptr, &pname, 4); ptr += 4;
3722 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3723 	memcpy(ptr, params, __size_params);ptr += __size_params;
3724 
3725 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3726 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3727 
3728 }
3729 
glTexImage2D_enc(void * self,GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,GLint border,GLenum format,GLenum type,const GLvoid * pixels)3730 void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
3731 {
3732 
3733 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3734 	IOStream *stream = ctx->m_stream;
3735 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3736 	bool useChecksum = checksumCalculator->getVersion() > 0;
3737 
3738 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv1_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3739 	 unsigned char *ptr;
3740 	 unsigned char *buf;
3741 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3742 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3743 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3744 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3745 	ptr = buf;
3746 	int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3747 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3748 
3749 		memcpy(ptr, &target, 4); ptr += 4;
3750 		memcpy(ptr, &level, 4); ptr += 4;
3751 		memcpy(ptr, &internalformat, 4); ptr += 4;
3752 		memcpy(ptr, &width, 4); ptr += 4;
3753 		memcpy(ptr, &height, 4); ptr += 4;
3754 		memcpy(ptr, &border, 4); ptr += 4;
3755 		memcpy(ptr, &format, 4); ptr += 4;
3756 		memcpy(ptr, &type, 4); ptr += 4;
3757 
3758 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3759 	stream->flush();
3760 	stream->writeFully(&__size_pixels,4);
3761 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3762 	if (pixels != NULL) {
3763 		stream->writeFully(pixels, __size_pixels);
3764 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3765 	}
3766 	buf = stream->alloc(checksumSize);
3767 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3768 
3769 }
3770 
glTexParameteri_enc(void * self,GLenum target,GLenum pname,GLint param)3771 void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
3772 {
3773 
3774 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3775 	IOStream *stream = ctx->m_stream;
3776 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3777 	bool useChecksum = checksumCalculator->getVersion() > 0;
3778 
3779 	 unsigned char *ptr;
3780 	 unsigned char *buf;
3781 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3782 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3783 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3784 	buf = stream->alloc(totalSize);
3785 	ptr = buf;
3786 	int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
3787 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3788 
3789 		memcpy(ptr, &target, 4); ptr += 4;
3790 		memcpy(ptr, &pname, 4); ptr += 4;
3791 		memcpy(ptr, &param, 4); ptr += 4;
3792 
3793 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3794 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3795 
3796 }
3797 
glTexParameterx_enc(void * self,GLenum target,GLenum pname,GLfixed param)3798 void glTexParameterx_enc(void *self , GLenum target, GLenum pname, GLfixed param)
3799 {
3800 
3801 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3802 	IOStream *stream = ctx->m_stream;
3803 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3804 	bool useChecksum = checksumCalculator->getVersion() > 0;
3805 
3806 	 unsigned char *ptr;
3807 	 unsigned char *buf;
3808 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3809 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3810 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3811 	buf = stream->alloc(totalSize);
3812 	ptr = buf;
3813 	int tmp = OP_glTexParameterx;memcpy(ptr, &tmp, 4); ptr += 4;
3814 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3815 
3816 		memcpy(ptr, &target, 4); ptr += 4;
3817 		memcpy(ptr, &pname, 4); ptr += 4;
3818 		memcpy(ptr, &param, 4); ptr += 4;
3819 
3820 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3821 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3822 
3823 }
3824 
glTexParameteriv_enc(void * self,GLenum target,GLenum pname,const GLint * params)3825 void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3826 {
3827 
3828 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3829 	IOStream *stream = ctx->m_stream;
3830 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3831 	bool useChecksum = checksumCalculator->getVersion() > 0;
3832 
3833 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
3834 	 unsigned char *ptr;
3835 	 unsigned char *buf;
3836 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3837 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3838 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3839 	buf = stream->alloc(totalSize);
3840 	ptr = buf;
3841 	int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
3842 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3843 
3844 		memcpy(ptr, &target, 4); ptr += 4;
3845 		memcpy(ptr, &pname, 4); ptr += 4;
3846 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3847 	memcpy(ptr, params, __size_params);ptr += __size_params;
3848 
3849 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3850 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3851 
3852 }
3853 
glTexParameterxv_enc(void * self,GLenum target,GLenum pname,const GLfixed * params)3854 void glTexParameterxv_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
3855 {
3856 
3857 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3858 	IOStream *stream = ctx->m_stream;
3859 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3860 	bool useChecksum = checksumCalculator->getVersion() > 0;
3861 
3862 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
3863 	 unsigned char *ptr;
3864 	 unsigned char *buf;
3865 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3866 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3867 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3868 	buf = stream->alloc(totalSize);
3869 	ptr = buf;
3870 	int tmp = OP_glTexParameterxv;memcpy(ptr, &tmp, 4); ptr += 4;
3871 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3872 
3873 		memcpy(ptr, &target, 4); ptr += 4;
3874 		memcpy(ptr, &pname, 4); ptr += 4;
3875 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
3876 	memcpy(ptr, params, __size_params);ptr += __size_params;
3877 
3878 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3879 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3880 
3881 }
3882 
glTexSubImage2D_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * pixels)3883 void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
3884 {
3885 
3886 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3887 	IOStream *stream = ctx->m_stream;
3888 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3889 	bool useChecksum = checksumCalculator->getVersion() > 0;
3890 
3891 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv1_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
3892 	 unsigned char *ptr;
3893 	 unsigned char *buf;
3894 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3895 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3896 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3897 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3898 	ptr = buf;
3899 	int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
3900 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3901 
3902 		memcpy(ptr, &target, 4); ptr += 4;
3903 		memcpy(ptr, &level, 4); ptr += 4;
3904 		memcpy(ptr, &xoffset, 4); ptr += 4;
3905 		memcpy(ptr, &yoffset, 4); ptr += 4;
3906 		memcpy(ptr, &width, 4); ptr += 4;
3907 		memcpy(ptr, &height, 4); ptr += 4;
3908 		memcpy(ptr, &format, 4); ptr += 4;
3909 		memcpy(ptr, &type, 4); ptr += 4;
3910 
3911 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3912 	stream->flush();
3913 	stream->writeFully(&__size_pixels,4);
3914 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
3915 	if (pixels != NULL) {
3916 		stream->writeFully(pixels, __size_pixels);
3917 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3918 	}
3919 	buf = stream->alloc(checksumSize);
3920 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3921 
3922 }
3923 
glTranslatex_enc(void * self,GLfixed x,GLfixed y,GLfixed z)3924 void glTranslatex_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
3925 {
3926 
3927 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3928 	IOStream *stream = ctx->m_stream;
3929 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3930 	bool useChecksum = checksumCalculator->getVersion() > 0;
3931 
3932 	 unsigned char *ptr;
3933 	 unsigned char *buf;
3934 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3935 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3936 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3937 	buf = stream->alloc(totalSize);
3938 	ptr = buf;
3939 	int tmp = OP_glTranslatex;memcpy(ptr, &tmp, 4); ptr += 4;
3940 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3941 
3942 		memcpy(ptr, &x, 4); ptr += 4;
3943 		memcpy(ptr, &y, 4); ptr += 4;
3944 		memcpy(ptr, &z, 4); ptr += 4;
3945 
3946 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3947 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3948 
3949 }
3950 
glViewport_enc(void * self,GLint x,GLint y,GLsizei width,GLsizei height)3951 void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3952 {
3953 
3954 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3955 	IOStream *stream = ctx->m_stream;
3956 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3957 	bool useChecksum = checksumCalculator->getVersion() > 0;
3958 
3959 	 unsigned char *ptr;
3960 	 unsigned char *buf;
3961 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3962 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3963 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3964 	buf = stream->alloc(totalSize);
3965 	ptr = buf;
3966 	int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
3967 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3968 
3969 		memcpy(ptr, &x, 4); ptr += 4;
3970 		memcpy(ptr, &y, 4); ptr += 4;
3971 		memcpy(ptr, &width, 4); ptr += 4;
3972 		memcpy(ptr, &height, 4); ptr += 4;
3973 
3974 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3975 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3976 
3977 }
3978 
glVertexPointerOffset_enc(void * self,GLint size,GLenum type,GLsizei stride,GLuint offset)3979 void glVertexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
3980 {
3981 
3982 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
3983 	IOStream *stream = ctx->m_stream;
3984 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
3985 	bool useChecksum = checksumCalculator->getVersion() > 0;
3986 
3987 	 unsigned char *ptr;
3988 	 unsigned char *buf;
3989 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3990 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
3991 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3992 	buf = stream->alloc(totalSize);
3993 	ptr = buf;
3994 	int tmp = OP_glVertexPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
3995 	memcpy(ptr, &totalSize, 4);  ptr += 4;
3996 
3997 		memcpy(ptr, &size, 4); ptr += 4;
3998 		memcpy(ptr, &type, 4); ptr += 4;
3999 		memcpy(ptr, &stride, 4); ptr += 4;
4000 		memcpy(ptr, &offset, 4); ptr += 4;
4001 
4002 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4003 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4004 
4005 }
4006 
glColorPointerOffset_enc(void * self,GLint size,GLenum type,GLsizei stride,GLuint offset)4007 void glColorPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
4008 {
4009 
4010 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4011 	IOStream *stream = ctx->m_stream;
4012 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4013 	bool useChecksum = checksumCalculator->getVersion() > 0;
4014 
4015 	 unsigned char *ptr;
4016 	 unsigned char *buf;
4017 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4018 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4019 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4020 	buf = stream->alloc(totalSize);
4021 	ptr = buf;
4022 	int tmp = OP_glColorPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4023 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4024 
4025 		memcpy(ptr, &size, 4); ptr += 4;
4026 		memcpy(ptr, &type, 4); ptr += 4;
4027 		memcpy(ptr, &stride, 4); ptr += 4;
4028 		memcpy(ptr, &offset, 4); ptr += 4;
4029 
4030 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4031 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4032 
4033 }
4034 
glNormalPointerOffset_enc(void * self,GLenum type,GLsizei stride,GLuint offset)4035 void glNormalPointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset)
4036 {
4037 
4038 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4039 	IOStream *stream = ctx->m_stream;
4040 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4041 	bool useChecksum = checksumCalculator->getVersion() > 0;
4042 
4043 	 unsigned char *ptr;
4044 	 unsigned char *buf;
4045 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4046 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4047 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4048 	buf = stream->alloc(totalSize);
4049 	ptr = buf;
4050 	int tmp = OP_glNormalPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4051 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4052 
4053 		memcpy(ptr, &type, 4); ptr += 4;
4054 		memcpy(ptr, &stride, 4); ptr += 4;
4055 		memcpy(ptr, &offset, 4); ptr += 4;
4056 
4057 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4058 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4059 
4060 }
4061 
glPointSizePointerOffset_enc(void * self,GLenum type,GLsizei stride,GLuint offset)4062 void glPointSizePointerOffset_enc(void *self , GLenum type, GLsizei stride, GLuint offset)
4063 {
4064 
4065 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4066 	IOStream *stream = ctx->m_stream;
4067 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4068 	bool useChecksum = checksumCalculator->getVersion() > 0;
4069 
4070 	 unsigned char *ptr;
4071 	 unsigned char *buf;
4072 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4073 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4074 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4075 	buf = stream->alloc(totalSize);
4076 	ptr = buf;
4077 	int tmp = OP_glPointSizePointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4078 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4079 
4080 		memcpy(ptr, &type, 4); ptr += 4;
4081 		memcpy(ptr, &stride, 4); ptr += 4;
4082 		memcpy(ptr, &offset, 4); ptr += 4;
4083 
4084 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4085 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4086 
4087 }
4088 
glTexCoordPointerOffset_enc(void * self,GLint size,GLenum type,GLsizei stride,GLuint offset)4089 void glTexCoordPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
4090 {
4091 
4092 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4093 	IOStream *stream = ctx->m_stream;
4094 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4095 	bool useChecksum = checksumCalculator->getVersion() > 0;
4096 
4097 	 unsigned char *ptr;
4098 	 unsigned char *buf;
4099 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4100 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4101 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4102 	buf = stream->alloc(totalSize);
4103 	ptr = buf;
4104 	int tmp = OP_glTexCoordPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4105 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4106 
4107 		memcpy(ptr, &size, 4); ptr += 4;
4108 		memcpy(ptr, &type, 4); ptr += 4;
4109 		memcpy(ptr, &stride, 4); ptr += 4;
4110 		memcpy(ptr, &offset, 4); ptr += 4;
4111 
4112 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4113 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4114 
4115 }
4116 
glWeightPointerOffset_enc(void * self,GLint size,GLenum type,GLsizei stride,GLuint offset)4117 void glWeightPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
4118 {
4119 
4120 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4121 	IOStream *stream = ctx->m_stream;
4122 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4123 	bool useChecksum = checksumCalculator->getVersion() > 0;
4124 
4125 	 unsigned char *ptr;
4126 	 unsigned char *buf;
4127 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4128 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4129 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4130 	buf = stream->alloc(totalSize);
4131 	ptr = buf;
4132 	int tmp = OP_glWeightPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4133 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4134 
4135 		memcpy(ptr, &size, 4); ptr += 4;
4136 		memcpy(ptr, &type, 4); ptr += 4;
4137 		memcpy(ptr, &stride, 4); ptr += 4;
4138 		memcpy(ptr, &offset, 4); ptr += 4;
4139 
4140 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4141 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4142 
4143 }
4144 
glMatrixIndexPointerOffset_enc(void * self,GLint size,GLenum type,GLsizei stride,GLuint offset)4145 void glMatrixIndexPointerOffset_enc(void *self , GLint size, GLenum type, GLsizei stride, GLuint offset)
4146 {
4147 
4148 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4149 	IOStream *stream = ctx->m_stream;
4150 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4151 	bool useChecksum = checksumCalculator->getVersion() > 0;
4152 
4153 	 unsigned char *ptr;
4154 	 unsigned char *buf;
4155 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4156 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4157 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4158 	buf = stream->alloc(totalSize);
4159 	ptr = buf;
4160 	int tmp = OP_glMatrixIndexPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4161 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4162 
4163 		memcpy(ptr, &size, 4); ptr += 4;
4164 		memcpy(ptr, &type, 4); ptr += 4;
4165 		memcpy(ptr, &stride, 4); ptr += 4;
4166 		memcpy(ptr, &offset, 4); ptr += 4;
4167 
4168 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4169 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4170 
4171 }
4172 
glVertexPointerData_enc(void * self,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)4173 void glVertexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
4174 {
4175 
4176 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4177 	IOStream *stream = ctx->m_stream;
4178 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4179 	bool useChecksum = checksumCalculator->getVersion() > 0;
4180 
4181 	const unsigned int __size_data =  datalen;
4182 	 unsigned char *ptr;
4183 	 unsigned char *buf;
4184 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4185 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4186 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4187 	buf = stream->alloc(totalSize);
4188 	ptr = buf;
4189 	int tmp = OP_glVertexPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4190 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4191 
4192 		memcpy(ptr, &size, 4); ptr += 4;
4193 		memcpy(ptr, &type, 4); ptr += 4;
4194 		memcpy(ptr, &stride, 4); ptr += 4;
4195 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4196 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4197 		memcpy(ptr, &datalen, 4); ptr += 4;
4198 
4199 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4200 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4201 
4202 }
4203 
glColorPointerData_enc(void * self,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)4204 void glColorPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
4205 {
4206 
4207 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4208 	IOStream *stream = ctx->m_stream;
4209 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4210 	bool useChecksum = checksumCalculator->getVersion() > 0;
4211 
4212 	const unsigned int __size_data =  datalen;
4213 	 unsigned char *ptr;
4214 	 unsigned char *buf;
4215 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4216 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4217 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4218 	buf = stream->alloc(totalSize);
4219 	ptr = buf;
4220 	int tmp = OP_glColorPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4221 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4222 
4223 		memcpy(ptr, &size, 4); ptr += 4;
4224 		memcpy(ptr, &type, 4); ptr += 4;
4225 		memcpy(ptr, &stride, 4); ptr += 4;
4226 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4227 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4228 		memcpy(ptr, &datalen, 4); ptr += 4;
4229 
4230 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4231 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4232 
4233 }
4234 
glNormalPointerData_enc(void * self,GLenum type,GLsizei stride,void * data,GLuint datalen)4235 void glNormalPointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen)
4236 {
4237 
4238 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4239 	IOStream *stream = ctx->m_stream;
4240 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4241 	bool useChecksum = checksumCalculator->getVersion() > 0;
4242 
4243 	const unsigned int __size_data =  datalen;
4244 	 unsigned char *ptr;
4245 	 unsigned char *buf;
4246 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
4247 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4248 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4249 	buf = stream->alloc(totalSize);
4250 	ptr = buf;
4251 	int tmp = OP_glNormalPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4252 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4253 
4254 		memcpy(ptr, &type, 4); ptr += 4;
4255 		memcpy(ptr, &stride, 4); ptr += 4;
4256 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4257 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 3, type, stride, datalen);ptr += __size_data;
4258 		memcpy(ptr, &datalen, 4); ptr += 4;
4259 
4260 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4261 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4262 
4263 }
4264 
glTexCoordPointerData_enc(void * self,GLint unit,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)4265 void glTexCoordPointerData_enc(void *self , GLint unit, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
4266 {
4267 
4268 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4269 	IOStream *stream = ctx->m_stream;
4270 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4271 	bool useChecksum = checksumCalculator->getVersion() > 0;
4272 
4273 	const unsigned int __size_data =  datalen;
4274 	 unsigned char *ptr;
4275 	 unsigned char *buf;
4276 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4277 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4278 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4279 	buf = stream->alloc(totalSize);
4280 	ptr = buf;
4281 	int tmp = OP_glTexCoordPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4282 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4283 
4284 		memcpy(ptr, &unit, 4); ptr += 4;
4285 		memcpy(ptr, &size, 4); ptr += 4;
4286 		memcpy(ptr, &type, 4); ptr += 4;
4287 		memcpy(ptr, &stride, 4); ptr += 4;
4288 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4289 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4290 		memcpy(ptr, &datalen, 4); ptr += 4;
4291 
4292 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4293 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4294 
4295 }
4296 
glPointSizePointerData_enc(void * self,GLenum type,GLsizei stride,void * data,GLuint datalen)4297 void glPointSizePointerData_enc(void *self , GLenum type, GLsizei stride, void* data, GLuint datalen)
4298 {
4299 
4300 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4301 	IOStream *stream = ctx->m_stream;
4302 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4303 	bool useChecksum = checksumCalculator->getVersion() > 0;
4304 
4305 	const unsigned int __size_data =  datalen;
4306 	 unsigned char *ptr;
4307 	 unsigned char *buf;
4308 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
4309 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4310 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4311 	buf = stream->alloc(totalSize);
4312 	ptr = buf;
4313 	int tmp = OP_glPointSizePointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4314 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4315 
4316 		memcpy(ptr, &type, 4); ptr += 4;
4317 		memcpy(ptr, &stride, 4); ptr += 4;
4318 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4319 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, 1, type, stride, datalen);ptr += __size_data;
4320 		memcpy(ptr, &datalen, 4); ptr += 4;
4321 
4322 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4323 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4324 
4325 }
4326 
glWeightPointerData_enc(void * self,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)4327 void glWeightPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
4328 {
4329 
4330 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4331 	IOStream *stream = ctx->m_stream;
4332 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4333 	bool useChecksum = checksumCalculator->getVersion() > 0;
4334 
4335 	const unsigned int __size_data =  datalen;
4336 	 unsigned char *ptr;
4337 	 unsigned char *buf;
4338 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4339 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4340 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4341 	buf = stream->alloc(totalSize);
4342 	ptr = buf;
4343 	int tmp = OP_glWeightPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4344 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4345 
4346 		memcpy(ptr, &size, 4); ptr += 4;
4347 		memcpy(ptr, &type, 4); ptr += 4;
4348 		memcpy(ptr, &stride, 4); ptr += 4;
4349 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4350 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen);ptr += __size_data;
4351 		memcpy(ptr, &datalen, 4); ptr += 4;
4352 
4353 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4354 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4355 
4356 }
4357 
glMatrixIndexPointerData_enc(void * self,GLint size,GLenum type,GLsizei stride,void * data,GLuint datalen)4358 void glMatrixIndexPointerData_enc(void *self , GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
4359 {
4360 
4361 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4362 	IOStream *stream = ctx->m_stream;
4363 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4364 	bool useChecksum = checksumCalculator->getVersion() > 0;
4365 
4366 	const unsigned int __size_data =  datalen;
4367 	 unsigned char *ptr;
4368 	 unsigned char *buf;
4369 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4370 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4371 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4372 	buf = stream->alloc(totalSize);
4373 	ptr = buf;
4374 	int tmp = OP_glMatrixIndexPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
4375 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4376 
4377 		memcpy(ptr, &size, 4); ptr += 4;
4378 		memcpy(ptr, &type, 4); ptr += 4;
4379 		memcpy(ptr, &stride, 4); ptr += 4;
4380 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4381 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen);ptr += __size_data;
4382 		memcpy(ptr, &datalen, 4); ptr += 4;
4383 
4384 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4385 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4386 
4387 }
4388 
glDrawElementsOffset_enc(void * self,GLenum mode,GLsizei count,GLenum type,GLuint offset)4389 void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
4390 {
4391 
4392 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4393 	IOStream *stream = ctx->m_stream;
4394 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4395 	bool useChecksum = checksumCalculator->getVersion() > 0;
4396 
4397 	 unsigned char *ptr;
4398 	 unsigned char *buf;
4399 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4400 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4401 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4402 	buf = stream->alloc(totalSize);
4403 	ptr = buf;
4404 	int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
4405 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4406 
4407 		memcpy(ptr, &mode, 4); ptr += 4;
4408 		memcpy(ptr, &count, 4); ptr += 4;
4409 		memcpy(ptr, &type, 4); ptr += 4;
4410 		memcpy(ptr, &offset, 4); ptr += 4;
4411 
4412 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4413 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4414 
4415 }
4416 
glDrawElementsData_enc(void * self,GLenum mode,GLsizei count,GLenum type,void * data,GLuint datalen)4417 void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
4418 {
4419 
4420 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4421 	IOStream *stream = ctx->m_stream;
4422 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4423 	bool useChecksum = checksumCalculator->getVersion() > 0;
4424 
4425 	const unsigned int __size_data =  datalen;
4426 	 unsigned char *ptr;
4427 	 unsigned char *buf;
4428 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4429 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4430 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4431 	buf = stream->alloc(totalSize);
4432 	ptr = buf;
4433 	int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
4434 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4435 
4436 		memcpy(ptr, &mode, 4); ptr += 4;
4437 		memcpy(ptr, &count, 4); ptr += 4;
4438 		memcpy(ptr, &type, 4); ptr += 4;
4439 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
4440 	memcpy(ptr, data, __size_data);ptr += __size_data;
4441 		memcpy(ptr, &datalen, 4); ptr += 4;
4442 
4443 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4444 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4445 
4446 }
4447 
glGetCompressedTextureFormats_enc(void * self,int count,GLint * formats)4448 void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
4449 {
4450 
4451 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4452 	IOStream *stream = ctx->m_stream;
4453 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4454 	bool useChecksum = checksumCalculator->getVersion() > 0;
4455 
4456 	const unsigned int __size_formats =  (count * sizeof(GLint));
4457 	 unsigned char *ptr;
4458 	 unsigned char *buf;
4459 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_formats + 1*4;
4460 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4461 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4462 	buf = stream->alloc(totalSize);
4463 	ptr = buf;
4464 	int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
4465 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4466 
4467 		memcpy(ptr, &count, 4); ptr += 4;
4468 	*(unsigned int *)(ptr) = __size_formats; ptr += 4;
4469 
4470 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4471 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4472 
4473 	stream->readback(formats, __size_formats);
4474 	if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4475 	if (useChecksum) {
4476 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
4477 		stream->readback(checksumBuf.get(), checksumSize);
4478 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
4479 			ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4480 			abort();
4481 		}
4482 	}
4483 }
4484 
glFinishRoundTrip_enc(void * self)4485 int glFinishRoundTrip_enc(void *self )
4486 {
4487 
4488 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4489 	IOStream *stream = ctx->m_stream;
4490 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4491 	bool useChecksum = checksumCalculator->getVersion() > 0;
4492 
4493 	 unsigned char *ptr;
4494 	 unsigned char *buf;
4495 	 const size_t sizeWithoutChecksum = 8;
4496 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4497 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4498 	buf = stream->alloc(totalSize);
4499 	ptr = buf;
4500 	int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
4501 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4502 
4503 
4504 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4505 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4506 
4507 
4508 	int retval;
4509 	stream->readback(&retval, 4);
4510 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
4511 	if (useChecksum) {
4512 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
4513 		stream->readback(checksumBuf.get(), checksumSize);
4514 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
4515 			ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
4516 			abort();
4517 		}
4518 	}
4519 	return retval;
4520 }
4521 
glBlendEquationSeparateOES_enc(void * self,GLenum modeRGB,GLenum modeAlpha)4522 void glBlendEquationSeparateOES_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
4523 {
4524 
4525 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4526 	IOStream *stream = ctx->m_stream;
4527 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4528 	bool useChecksum = checksumCalculator->getVersion() > 0;
4529 
4530 	 unsigned char *ptr;
4531 	 unsigned char *buf;
4532 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4533 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4534 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4535 	buf = stream->alloc(totalSize);
4536 	ptr = buf;
4537 	int tmp = OP_glBlendEquationSeparateOES;memcpy(ptr, &tmp, 4); ptr += 4;
4538 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4539 
4540 		memcpy(ptr, &modeRGB, 4); ptr += 4;
4541 		memcpy(ptr, &modeAlpha, 4); ptr += 4;
4542 
4543 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4544 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4545 
4546 }
4547 
glBlendFuncSeparateOES_enc(void * self,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)4548 void glBlendFuncSeparateOES_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
4549 {
4550 
4551 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4552 	IOStream *stream = ctx->m_stream;
4553 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4554 	bool useChecksum = checksumCalculator->getVersion() > 0;
4555 
4556 	 unsigned char *ptr;
4557 	 unsigned char *buf;
4558 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4559 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4560 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4561 	buf = stream->alloc(totalSize);
4562 	ptr = buf;
4563 	int tmp = OP_glBlendFuncSeparateOES;memcpy(ptr, &tmp, 4); ptr += 4;
4564 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4565 
4566 		memcpy(ptr, &srcRGB, 4); ptr += 4;
4567 		memcpy(ptr, &dstRGB, 4); ptr += 4;
4568 		memcpy(ptr, &srcAlpha, 4); ptr += 4;
4569 		memcpy(ptr, &dstAlpha, 4); ptr += 4;
4570 
4571 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4572 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4573 
4574 }
4575 
glBlendEquationOES_enc(void * self,GLenum mode)4576 void glBlendEquationOES_enc(void *self , GLenum mode)
4577 {
4578 
4579 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4580 	IOStream *stream = ctx->m_stream;
4581 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4582 	bool useChecksum = checksumCalculator->getVersion() > 0;
4583 
4584 	 unsigned char *ptr;
4585 	 unsigned char *buf;
4586 	 const size_t sizeWithoutChecksum = 8 + 4;
4587 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4588 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4589 	buf = stream->alloc(totalSize);
4590 	ptr = buf;
4591 	int tmp = OP_glBlendEquationOES;memcpy(ptr, &tmp, 4); ptr += 4;
4592 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4593 
4594 		memcpy(ptr, &mode, 4); ptr += 4;
4595 
4596 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4597 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4598 
4599 }
4600 
glDrawTexsOES_enc(void * self,GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)4601 void glDrawTexsOES_enc(void *self , GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
4602 {
4603 
4604 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4605 	IOStream *stream = ctx->m_stream;
4606 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4607 	bool useChecksum = checksumCalculator->getVersion() > 0;
4608 
4609 	 unsigned char *ptr;
4610 	 unsigned char *buf;
4611 	 const size_t sizeWithoutChecksum = 8 + 2 + 2 + 2 + 2 + 2;
4612 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4613 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4614 	buf = stream->alloc(totalSize);
4615 	ptr = buf;
4616 	int tmp = OP_glDrawTexsOES;memcpy(ptr, &tmp, 4); ptr += 4;
4617 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4618 
4619 		memcpy(ptr, &x, 2); ptr += 2;
4620 		memcpy(ptr, &y, 2); ptr += 2;
4621 		memcpy(ptr, &z, 2); ptr += 2;
4622 		memcpy(ptr, &width, 2); ptr += 2;
4623 		memcpy(ptr, &height, 2); ptr += 2;
4624 
4625 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4626 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4627 
4628 }
4629 
glDrawTexiOES_enc(void * self,GLint x,GLint y,GLint z,GLint width,GLint height)4630 void glDrawTexiOES_enc(void *self , GLint x, GLint y, GLint z, GLint width, GLint height)
4631 {
4632 
4633 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4634 	IOStream *stream = ctx->m_stream;
4635 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4636 	bool useChecksum = checksumCalculator->getVersion() > 0;
4637 
4638 	 unsigned char *ptr;
4639 	 unsigned char *buf;
4640 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4641 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4642 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4643 	buf = stream->alloc(totalSize);
4644 	ptr = buf;
4645 	int tmp = OP_glDrawTexiOES;memcpy(ptr, &tmp, 4); ptr += 4;
4646 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4647 
4648 		memcpy(ptr, &x, 4); ptr += 4;
4649 		memcpy(ptr, &y, 4); ptr += 4;
4650 		memcpy(ptr, &z, 4); ptr += 4;
4651 		memcpy(ptr, &width, 4); ptr += 4;
4652 		memcpy(ptr, &height, 4); ptr += 4;
4653 
4654 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4655 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4656 
4657 }
4658 
glDrawTexxOES_enc(void * self,GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)4659 void glDrawTexxOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
4660 {
4661 
4662 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4663 	IOStream *stream = ctx->m_stream;
4664 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4665 	bool useChecksum = checksumCalculator->getVersion() > 0;
4666 
4667 	 unsigned char *ptr;
4668 	 unsigned char *buf;
4669 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4670 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4671 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4672 	buf = stream->alloc(totalSize);
4673 	ptr = buf;
4674 	int tmp = OP_glDrawTexxOES;memcpy(ptr, &tmp, 4); ptr += 4;
4675 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4676 
4677 		memcpy(ptr, &x, 4); ptr += 4;
4678 		memcpy(ptr, &y, 4); ptr += 4;
4679 		memcpy(ptr, &z, 4); ptr += 4;
4680 		memcpy(ptr, &width, 4); ptr += 4;
4681 		memcpy(ptr, &height, 4); ptr += 4;
4682 
4683 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4684 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4685 
4686 }
4687 
glDrawTexsvOES_enc(void * self,const GLshort * coords)4688 void glDrawTexsvOES_enc(void *self , const GLshort* coords)
4689 {
4690 
4691 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4692 	IOStream *stream = ctx->m_stream;
4693 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4694 	bool useChecksum = checksumCalculator->getVersion() > 0;
4695 
4696 	const unsigned int __size_coords =  (5 * sizeof(GLshort));
4697 	 unsigned char *ptr;
4698 	 unsigned char *buf;
4699 	 const size_t sizeWithoutChecksum = 8 + __size_coords + 1*4;
4700 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4701 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4702 	buf = stream->alloc(totalSize);
4703 	ptr = buf;
4704 	int tmp = OP_glDrawTexsvOES;memcpy(ptr, &tmp, 4); ptr += 4;
4705 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4706 
4707 	*(unsigned int *)(ptr) = __size_coords; ptr += 4;
4708 	memcpy(ptr, coords, __size_coords);ptr += __size_coords;
4709 
4710 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4711 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4712 
4713 }
4714 
glDrawTexivOES_enc(void * self,const GLint * coords)4715 void glDrawTexivOES_enc(void *self , const GLint* coords)
4716 {
4717 
4718 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4719 	IOStream *stream = ctx->m_stream;
4720 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4721 	bool useChecksum = checksumCalculator->getVersion() > 0;
4722 
4723 	const unsigned int __size_coords =  (5 * sizeof(GLint));
4724 	 unsigned char *ptr;
4725 	 unsigned char *buf;
4726 	 const size_t sizeWithoutChecksum = 8 + __size_coords + 1*4;
4727 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4728 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4729 	buf = stream->alloc(totalSize);
4730 	ptr = buf;
4731 	int tmp = OP_glDrawTexivOES;memcpy(ptr, &tmp, 4); ptr += 4;
4732 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4733 
4734 	*(unsigned int *)(ptr) = __size_coords; ptr += 4;
4735 	memcpy(ptr, coords, __size_coords);ptr += __size_coords;
4736 
4737 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4738 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4739 
4740 }
4741 
glDrawTexxvOES_enc(void * self,const GLfixed * coords)4742 void glDrawTexxvOES_enc(void *self , const GLfixed* coords)
4743 {
4744 
4745 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4746 	IOStream *stream = ctx->m_stream;
4747 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4748 	bool useChecksum = checksumCalculator->getVersion() > 0;
4749 
4750 	const unsigned int __size_coords =  (5 * sizeof(GLfixed));
4751 	 unsigned char *ptr;
4752 	 unsigned char *buf;
4753 	 const size_t sizeWithoutChecksum = 8 + __size_coords + 1*4;
4754 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4755 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4756 	buf = stream->alloc(totalSize);
4757 	ptr = buf;
4758 	int tmp = OP_glDrawTexxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
4759 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4760 
4761 	*(unsigned int *)(ptr) = __size_coords; ptr += 4;
4762 	memcpy(ptr, coords, __size_coords);ptr += __size_coords;
4763 
4764 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4765 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4766 
4767 }
4768 
glDrawTexfOES_enc(void * self,GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)4769 void glDrawTexfOES_enc(void *self , GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
4770 {
4771 
4772 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4773 	IOStream *stream = ctx->m_stream;
4774 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4775 	bool useChecksum = checksumCalculator->getVersion() > 0;
4776 
4777 	 unsigned char *ptr;
4778 	 unsigned char *buf;
4779 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4780 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4781 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4782 	buf = stream->alloc(totalSize);
4783 	ptr = buf;
4784 	int tmp = OP_glDrawTexfOES;memcpy(ptr, &tmp, 4); ptr += 4;
4785 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4786 
4787 		memcpy(ptr, &x, 4); ptr += 4;
4788 		memcpy(ptr, &y, 4); ptr += 4;
4789 		memcpy(ptr, &z, 4); ptr += 4;
4790 		memcpy(ptr, &width, 4); ptr += 4;
4791 		memcpy(ptr, &height, 4); ptr += 4;
4792 
4793 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4794 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4795 
4796 }
4797 
glDrawTexfvOES_enc(void * self,const GLfloat * coords)4798 void glDrawTexfvOES_enc(void *self , const GLfloat* coords)
4799 {
4800 
4801 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4802 	IOStream *stream = ctx->m_stream;
4803 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4804 	bool useChecksum = checksumCalculator->getVersion() > 0;
4805 
4806 	const unsigned int __size_coords =  (5 * sizeof(GLfloat));
4807 	 unsigned char *ptr;
4808 	 unsigned char *buf;
4809 	 const size_t sizeWithoutChecksum = 8 + __size_coords + 1*4;
4810 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4811 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4812 	buf = stream->alloc(totalSize);
4813 	ptr = buf;
4814 	int tmp = OP_glDrawTexfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
4815 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4816 
4817 	*(unsigned int *)(ptr) = __size_coords; ptr += 4;
4818 	memcpy(ptr, coords, __size_coords);ptr += __size_coords;
4819 
4820 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4821 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4822 
4823 }
4824 
glEGLImageTargetTexture2DOES_enc(void * self,GLenum target,GLeglImageOES image)4825 void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
4826 {
4827 
4828 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4829 	IOStream *stream = ctx->m_stream;
4830 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4831 	bool useChecksum = checksumCalculator->getVersion() > 0;
4832 
4833 	 unsigned char *ptr;
4834 	 unsigned char *buf;
4835 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4836 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4837 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4838 	buf = stream->alloc(totalSize);
4839 	ptr = buf;
4840 	int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
4841 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4842 
4843 		memcpy(ptr, &target, 4); ptr += 4;
4844 		memcpy(ptr, &image, 4); ptr += 4;
4845 
4846 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4847 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4848 
4849 }
4850 
glEGLImageTargetRenderbufferStorageOES_enc(void * self,GLenum target,GLeglImageOES image)4851 void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
4852 {
4853 
4854 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4855 	IOStream *stream = ctx->m_stream;
4856 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4857 	bool useChecksum = checksumCalculator->getVersion() > 0;
4858 
4859 	 unsigned char *ptr;
4860 	 unsigned char *buf;
4861 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4862 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4863 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4864 	buf = stream->alloc(totalSize);
4865 	ptr = buf;
4866 	int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
4867 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4868 
4869 		memcpy(ptr, &target, 4); ptr += 4;
4870 		memcpy(ptr, &image, 4); ptr += 4;
4871 
4872 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4873 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4874 
4875 }
4876 
glAlphaFuncxOES_enc(void * self,GLenum func,GLclampx ref)4877 void glAlphaFuncxOES_enc(void *self , GLenum func, GLclampx ref)
4878 {
4879 
4880 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4881 	IOStream *stream = ctx->m_stream;
4882 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4883 	bool useChecksum = checksumCalculator->getVersion() > 0;
4884 
4885 	 unsigned char *ptr;
4886 	 unsigned char *buf;
4887 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4888 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4889 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4890 	buf = stream->alloc(totalSize);
4891 	ptr = buf;
4892 	int tmp = OP_glAlphaFuncxOES;memcpy(ptr, &tmp, 4); ptr += 4;
4893 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4894 
4895 		memcpy(ptr, &func, 4); ptr += 4;
4896 		memcpy(ptr, &ref, 4); ptr += 4;
4897 
4898 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4899 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4900 
4901 }
4902 
glClearColorxOES_enc(void * self,GLclampx red,GLclampx green,GLclampx blue,GLclampx alpha)4903 void glClearColorxOES_enc(void *self , GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
4904 {
4905 
4906 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4907 	IOStream *stream = ctx->m_stream;
4908 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4909 	bool useChecksum = checksumCalculator->getVersion() > 0;
4910 
4911 	 unsigned char *ptr;
4912 	 unsigned char *buf;
4913 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4914 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4915 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4916 	buf = stream->alloc(totalSize);
4917 	ptr = buf;
4918 	int tmp = OP_glClearColorxOES;memcpy(ptr, &tmp, 4); ptr += 4;
4919 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4920 
4921 		memcpy(ptr, &red, 4); ptr += 4;
4922 		memcpy(ptr, &green, 4); ptr += 4;
4923 		memcpy(ptr, &blue, 4); ptr += 4;
4924 		memcpy(ptr, &alpha, 4); ptr += 4;
4925 
4926 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4927 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4928 
4929 }
4930 
glClearDepthxOES_enc(void * self,GLclampx depth)4931 void glClearDepthxOES_enc(void *self , GLclampx depth)
4932 {
4933 
4934 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4935 	IOStream *stream = ctx->m_stream;
4936 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4937 	bool useChecksum = checksumCalculator->getVersion() > 0;
4938 
4939 	 unsigned char *ptr;
4940 	 unsigned char *buf;
4941 	 const size_t sizeWithoutChecksum = 8 + 4;
4942 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4943 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4944 	buf = stream->alloc(totalSize);
4945 	ptr = buf;
4946 	int tmp = OP_glClearDepthxOES;memcpy(ptr, &tmp, 4); ptr += 4;
4947 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4948 
4949 		memcpy(ptr, &depth, 4); ptr += 4;
4950 
4951 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4952 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4953 
4954 }
4955 
glClipPlanexOES_enc(void * self,GLenum plane,const GLfixed * equation)4956 void glClipPlanexOES_enc(void *self , GLenum plane, const GLfixed* equation)
4957 {
4958 
4959 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4960 	IOStream *stream = ctx->m_stream;
4961 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4962 	bool useChecksum = checksumCalculator->getVersion() > 0;
4963 
4964 	const unsigned int __size_equation =  (4 * sizeof(GLfixed));
4965 	 unsigned char *ptr;
4966 	 unsigned char *buf;
4967 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4;
4968 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4969 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4970 	buf = stream->alloc(totalSize);
4971 	ptr = buf;
4972 	int tmp = OP_glClipPlanexOES;memcpy(ptr, &tmp, 4); ptr += 4;
4973 	memcpy(ptr, &totalSize, 4);  ptr += 4;
4974 
4975 		memcpy(ptr, &plane, 4); ptr += 4;
4976 	*(unsigned int *)(ptr) = __size_equation; ptr += 4;
4977 	memcpy(ptr, equation, __size_equation);ptr += __size_equation;
4978 
4979 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4980 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4981 
4982 }
4983 
glClipPlanexIMG_enc(void * self,GLenum plane,const GLfixed * equation)4984 void glClipPlanexIMG_enc(void *self , GLenum plane, const GLfixed* equation)
4985 {
4986 
4987 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
4988 	IOStream *stream = ctx->m_stream;
4989 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
4990 	bool useChecksum = checksumCalculator->getVersion() > 0;
4991 
4992 	const unsigned int __size_equation =  (4 * sizeof(GLfixed));
4993 	 unsigned char *ptr;
4994 	 unsigned char *buf;
4995 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4;
4996 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
4997 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4998 	buf = stream->alloc(totalSize);
4999 	ptr = buf;
5000 	int tmp = OP_glClipPlanexIMG;memcpy(ptr, &tmp, 4); ptr += 4;
5001 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5002 
5003 		memcpy(ptr, &plane, 4); ptr += 4;
5004 	*(unsigned int *)(ptr) = __size_equation; ptr += 4;
5005 	memcpy(ptr, equation, __size_equation);ptr += __size_equation;
5006 
5007 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5008 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5009 
5010 }
5011 
glColor4xOES_enc(void * self,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)5012 void glColor4xOES_enc(void *self , GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
5013 {
5014 
5015 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5016 	IOStream *stream = ctx->m_stream;
5017 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5018 	bool useChecksum = checksumCalculator->getVersion() > 0;
5019 
5020 	 unsigned char *ptr;
5021 	 unsigned char *buf;
5022 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5023 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5024 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5025 	buf = stream->alloc(totalSize);
5026 	ptr = buf;
5027 	int tmp = OP_glColor4xOES;memcpy(ptr, &tmp, 4); ptr += 4;
5028 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5029 
5030 		memcpy(ptr, &red, 4); ptr += 4;
5031 		memcpy(ptr, &green, 4); ptr += 4;
5032 		memcpy(ptr, &blue, 4); ptr += 4;
5033 		memcpy(ptr, &alpha, 4); ptr += 4;
5034 
5035 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5036 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5037 
5038 }
5039 
glDepthRangexOES_enc(void * self,GLclampx zNear,GLclampx zFar)5040 void glDepthRangexOES_enc(void *self , GLclampx zNear, GLclampx zFar)
5041 {
5042 
5043 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5044 	IOStream *stream = ctx->m_stream;
5045 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5046 	bool useChecksum = checksumCalculator->getVersion() > 0;
5047 
5048 	 unsigned char *ptr;
5049 	 unsigned char *buf;
5050 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5051 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5052 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5053 	buf = stream->alloc(totalSize);
5054 	ptr = buf;
5055 	int tmp = OP_glDepthRangexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5056 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5057 
5058 		memcpy(ptr, &zNear, 4); ptr += 4;
5059 		memcpy(ptr, &zFar, 4); ptr += 4;
5060 
5061 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5062 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5063 
5064 }
5065 
glFogxOES_enc(void * self,GLenum pname,GLfixed param)5066 void glFogxOES_enc(void *self , GLenum pname, GLfixed param)
5067 {
5068 
5069 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5070 	IOStream *stream = ctx->m_stream;
5071 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5072 	bool useChecksum = checksumCalculator->getVersion() > 0;
5073 
5074 	 unsigned char *ptr;
5075 	 unsigned char *buf;
5076 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5077 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5078 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5079 	buf = stream->alloc(totalSize);
5080 	ptr = buf;
5081 	int tmp = OP_glFogxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5082 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5083 
5084 		memcpy(ptr, &pname, 4); ptr += 4;
5085 		memcpy(ptr, &param, 4); ptr += 4;
5086 
5087 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5088 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5089 
5090 }
5091 
glFogxvOES_enc(void * self,GLenum pname,const GLfixed * params)5092 void glFogxvOES_enc(void *self , GLenum pname, const GLfixed* params)
5093 {
5094 
5095 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5096 	IOStream *stream = ctx->m_stream;
5097 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5098 	bool useChecksum = checksumCalculator->getVersion() > 0;
5099 
5100 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5101 	 unsigned char *ptr;
5102 	 unsigned char *buf;
5103 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
5104 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5105 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5106 	buf = stream->alloc(totalSize);
5107 	ptr = buf;
5108 	int tmp = OP_glFogxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5109 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5110 
5111 		memcpy(ptr, &pname, 4); ptr += 4;
5112 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5113 	memcpy(ptr, params, __size_params);ptr += __size_params;
5114 
5115 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5116 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5117 
5118 }
5119 
glFrustumxOES_enc(void * self,GLfixed left,GLfixed right,GLfixed bottom,GLfixed top,GLfixed zNear,GLfixed zFar)5120 void glFrustumxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
5121 {
5122 
5123 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5124 	IOStream *stream = ctx->m_stream;
5125 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5126 	bool useChecksum = checksumCalculator->getVersion() > 0;
5127 
5128 	 unsigned char *ptr;
5129 	 unsigned char *buf;
5130 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
5131 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5132 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5133 	buf = stream->alloc(totalSize);
5134 	ptr = buf;
5135 	int tmp = OP_glFrustumxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5136 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5137 
5138 		memcpy(ptr, &left, 4); ptr += 4;
5139 		memcpy(ptr, &right, 4); ptr += 4;
5140 		memcpy(ptr, &bottom, 4); ptr += 4;
5141 		memcpy(ptr, &top, 4); ptr += 4;
5142 		memcpy(ptr, &zNear, 4); ptr += 4;
5143 		memcpy(ptr, &zFar, 4); ptr += 4;
5144 
5145 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5146 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5147 
5148 }
5149 
glGetClipPlanexOES_enc(void * self,GLenum pname,GLfixed * eqn)5150 void glGetClipPlanexOES_enc(void *self , GLenum pname, GLfixed* eqn)
5151 {
5152 
5153 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5154 	IOStream *stream = ctx->m_stream;
5155 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5156 	bool useChecksum = checksumCalculator->getVersion() > 0;
5157 
5158 	const unsigned int __size_eqn =  (4 * sizeof(GLfixed));
5159 	 unsigned char *ptr;
5160 	 unsigned char *buf;
5161 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_eqn + 1*4;
5162 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5163 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5164 	buf = stream->alloc(totalSize);
5165 	ptr = buf;
5166 	int tmp = OP_glGetClipPlanexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5167 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5168 
5169 		memcpy(ptr, &pname, 4); ptr += 4;
5170 	*(unsigned int *)(ptr) = __size_eqn; ptr += 4;
5171 
5172 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5173 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5174 
5175 	stream->readback(eqn, __size_eqn);
5176 	if (useChecksum) checksumCalculator->addBuffer(eqn, __size_eqn);
5177 	if (useChecksum) {
5178 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5179 		stream->readback(checksumBuf.get(), checksumSize);
5180 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5181 			ALOGE("glGetClipPlanexOES: GL communication error, please report this issue to b.android.com.\n");
5182 			abort();
5183 		}
5184 	}
5185 }
5186 
glGetClipPlanex_enc(void * self,GLenum pname,GLfixed * eqn)5187 void glGetClipPlanex_enc(void *self , GLenum pname, GLfixed* eqn)
5188 {
5189 
5190 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5191 	IOStream *stream = ctx->m_stream;
5192 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5193 	bool useChecksum = checksumCalculator->getVersion() > 0;
5194 
5195 	const unsigned int __size_eqn =  (4 * sizeof(GLfixed));
5196 	 unsigned char *ptr;
5197 	 unsigned char *buf;
5198 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_eqn + 1*4;
5199 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5200 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5201 	buf = stream->alloc(totalSize);
5202 	ptr = buf;
5203 	int tmp = OP_glGetClipPlanex;memcpy(ptr, &tmp, 4); ptr += 4;
5204 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5205 
5206 		memcpy(ptr, &pname, 4); ptr += 4;
5207 	*(unsigned int *)(ptr) = __size_eqn; ptr += 4;
5208 
5209 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5210 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5211 
5212 	stream->readback(eqn, __size_eqn);
5213 	if (useChecksum) checksumCalculator->addBuffer(eqn, __size_eqn);
5214 	if (useChecksum) {
5215 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5216 		stream->readback(checksumBuf.get(), checksumSize);
5217 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5218 			ALOGE("glGetClipPlanex: GL communication error, please report this issue to b.android.com.\n");
5219 			abort();
5220 		}
5221 	}
5222 }
5223 
glGetFixedvOES_enc(void * self,GLenum pname,GLfixed * params)5224 void glGetFixedvOES_enc(void *self , GLenum pname, GLfixed* params)
5225 {
5226 
5227 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5228 	IOStream *stream = ctx->m_stream;
5229 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5230 	bool useChecksum = checksumCalculator->getVersion() > 0;
5231 
5232 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5233 	 unsigned char *ptr;
5234 	 unsigned char *buf;
5235 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
5236 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5237 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5238 	buf = stream->alloc(totalSize);
5239 	ptr = buf;
5240 	int tmp = OP_glGetFixedvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5241 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5242 
5243 		memcpy(ptr, &pname, 4); ptr += 4;
5244 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5245 
5246 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5247 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5248 
5249 	stream->readback(params, __size_params);
5250 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5251 	if (useChecksum) {
5252 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5253 		stream->readback(checksumBuf.get(), checksumSize);
5254 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5255 			ALOGE("glGetFixedvOES: GL communication error, please report this issue to b.android.com.\n");
5256 			abort();
5257 		}
5258 	}
5259 }
5260 
glGetLightxvOES_enc(void * self,GLenum light,GLenum pname,GLfixed * params)5261 void glGetLightxvOES_enc(void *self , GLenum light, GLenum pname, GLfixed* params)
5262 {
5263 
5264 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5265 	IOStream *stream = ctx->m_stream;
5266 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5267 	bool useChecksum = checksumCalculator->getVersion() > 0;
5268 
5269 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5270 	 unsigned char *ptr;
5271 	 unsigned char *buf;
5272 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5273 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5274 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5275 	buf = stream->alloc(totalSize);
5276 	ptr = buf;
5277 	int tmp = OP_glGetLightxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5278 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5279 
5280 		memcpy(ptr, &light, 4); ptr += 4;
5281 		memcpy(ptr, &pname, 4); ptr += 4;
5282 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5283 
5284 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5285 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5286 
5287 	stream->readback(params, __size_params);
5288 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5289 	if (useChecksum) {
5290 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5291 		stream->readback(checksumBuf.get(), checksumSize);
5292 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5293 			ALOGE("glGetLightxvOES: GL communication error, please report this issue to b.android.com.\n");
5294 			abort();
5295 		}
5296 	}
5297 }
5298 
glGetMaterialxvOES_enc(void * self,GLenum face,GLenum pname,GLfixed * params)5299 void glGetMaterialxvOES_enc(void *self , GLenum face, GLenum pname, GLfixed* params)
5300 {
5301 
5302 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5303 	IOStream *stream = ctx->m_stream;
5304 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5305 	bool useChecksum = checksumCalculator->getVersion() > 0;
5306 
5307 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5308 	 unsigned char *ptr;
5309 	 unsigned char *buf;
5310 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5311 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5312 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5313 	buf = stream->alloc(totalSize);
5314 	ptr = buf;
5315 	int tmp = OP_glGetMaterialxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5316 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5317 
5318 		memcpy(ptr, &face, 4); ptr += 4;
5319 		memcpy(ptr, &pname, 4); ptr += 4;
5320 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5321 
5322 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5323 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5324 
5325 	stream->readback(params, __size_params);
5326 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5327 	if (useChecksum) {
5328 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5329 		stream->readback(checksumBuf.get(), checksumSize);
5330 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5331 			ALOGE("glGetMaterialxvOES: GL communication error, please report this issue to b.android.com.\n");
5332 			abort();
5333 		}
5334 	}
5335 }
5336 
glGetTexEnvxvOES_enc(void * self,GLenum env,GLenum pname,GLfixed * params)5337 void glGetTexEnvxvOES_enc(void *self , GLenum env, GLenum pname, GLfixed* params)
5338 {
5339 
5340 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5341 	IOStream *stream = ctx->m_stream;
5342 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5343 	bool useChecksum = checksumCalculator->getVersion() > 0;
5344 
5345 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5346 	 unsigned char *ptr;
5347 	 unsigned char *buf;
5348 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5349 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5350 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5351 	buf = stream->alloc(totalSize);
5352 	ptr = buf;
5353 	int tmp = OP_glGetTexEnvxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5354 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5355 
5356 		memcpy(ptr, &env, 4); ptr += 4;
5357 		memcpy(ptr, &pname, 4); ptr += 4;
5358 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5359 
5360 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5361 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5362 
5363 	stream->readback(params, __size_params);
5364 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5365 	if (useChecksum) {
5366 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5367 		stream->readback(checksumBuf.get(), checksumSize);
5368 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5369 			ALOGE("glGetTexEnvxvOES: GL communication error, please report this issue to b.android.com.\n");
5370 			abort();
5371 		}
5372 	}
5373 }
5374 
glGetTexParameterxvOES_enc(void * self,GLenum target,GLenum pname,GLfixed * params)5375 void glGetTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, GLfixed* params)
5376 {
5377 
5378 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5379 	IOStream *stream = ctx->m_stream;
5380 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5381 	bool useChecksum = checksumCalculator->getVersion() > 0;
5382 
5383 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5384 	 unsigned char *ptr;
5385 	 unsigned char *buf;
5386 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5387 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5388 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5389 	buf = stream->alloc(totalSize);
5390 	ptr = buf;
5391 	int tmp = OP_glGetTexParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5392 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5393 
5394 		memcpy(ptr, &target, 4); ptr += 4;
5395 		memcpy(ptr, &pname, 4); ptr += 4;
5396 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5397 
5398 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5399 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5400 
5401 	stream->readback(params, __size_params);
5402 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5403 	if (useChecksum) {
5404 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
5405 		stream->readback(checksumBuf.get(), checksumSize);
5406 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
5407 			ALOGE("glGetTexParameterxvOES: GL communication error, please report this issue to b.android.com.\n");
5408 			abort();
5409 		}
5410 	}
5411 }
5412 
glLightModelxOES_enc(void * self,GLenum pname,GLfixed param)5413 void glLightModelxOES_enc(void *self , GLenum pname, GLfixed param)
5414 {
5415 
5416 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5417 	IOStream *stream = ctx->m_stream;
5418 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5419 	bool useChecksum = checksumCalculator->getVersion() > 0;
5420 
5421 	 unsigned char *ptr;
5422 	 unsigned char *buf;
5423 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5424 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5425 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5426 	buf = stream->alloc(totalSize);
5427 	ptr = buf;
5428 	int tmp = OP_glLightModelxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5429 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5430 
5431 		memcpy(ptr, &pname, 4); ptr += 4;
5432 		memcpy(ptr, &param, 4); ptr += 4;
5433 
5434 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5435 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5436 
5437 }
5438 
glLightModelxvOES_enc(void * self,GLenum pname,const GLfixed * params)5439 void glLightModelxvOES_enc(void *self , GLenum pname, const GLfixed* params)
5440 {
5441 
5442 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5443 	IOStream *stream = ctx->m_stream;
5444 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5445 	bool useChecksum = checksumCalculator->getVersion() > 0;
5446 
5447 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5448 	 unsigned char *ptr;
5449 	 unsigned char *buf;
5450 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
5451 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5452 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5453 	buf = stream->alloc(totalSize);
5454 	ptr = buf;
5455 	int tmp = OP_glLightModelxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5456 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5457 
5458 		memcpy(ptr, &pname, 4); ptr += 4;
5459 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5460 	memcpy(ptr, params, __size_params);ptr += __size_params;
5461 
5462 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5463 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5464 
5465 }
5466 
glLightxOES_enc(void * self,GLenum light,GLenum pname,GLfixed param)5467 void glLightxOES_enc(void *self , GLenum light, GLenum pname, GLfixed param)
5468 {
5469 
5470 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5471 	IOStream *stream = ctx->m_stream;
5472 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5473 	bool useChecksum = checksumCalculator->getVersion() > 0;
5474 
5475 	 unsigned char *ptr;
5476 	 unsigned char *buf;
5477 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5478 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5479 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5480 	buf = stream->alloc(totalSize);
5481 	ptr = buf;
5482 	int tmp = OP_glLightxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5483 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5484 
5485 		memcpy(ptr, &light, 4); ptr += 4;
5486 		memcpy(ptr, &pname, 4); ptr += 4;
5487 		memcpy(ptr, &param, 4); ptr += 4;
5488 
5489 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5490 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5491 
5492 }
5493 
glLightxvOES_enc(void * self,GLenum light,GLenum pname,const GLfixed * params)5494 void glLightxvOES_enc(void *self , GLenum light, GLenum pname, const GLfixed* params)
5495 {
5496 
5497 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5498 	IOStream *stream = ctx->m_stream;
5499 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5500 	bool useChecksum = checksumCalculator->getVersion() > 0;
5501 
5502 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5503 	 unsigned char *ptr;
5504 	 unsigned char *buf;
5505 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5506 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5507 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5508 	buf = stream->alloc(totalSize);
5509 	ptr = buf;
5510 	int tmp = OP_glLightxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5511 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5512 
5513 		memcpy(ptr, &light, 4); ptr += 4;
5514 		memcpy(ptr, &pname, 4); ptr += 4;
5515 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5516 	memcpy(ptr, params, __size_params);ptr += __size_params;
5517 
5518 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5519 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5520 
5521 }
5522 
glLineWidthxOES_enc(void * self,GLfixed width)5523 void glLineWidthxOES_enc(void *self , GLfixed width)
5524 {
5525 
5526 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5527 	IOStream *stream = ctx->m_stream;
5528 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5529 	bool useChecksum = checksumCalculator->getVersion() > 0;
5530 
5531 	 unsigned char *ptr;
5532 	 unsigned char *buf;
5533 	 const size_t sizeWithoutChecksum = 8 + 4;
5534 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5535 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5536 	buf = stream->alloc(totalSize);
5537 	ptr = buf;
5538 	int tmp = OP_glLineWidthxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5539 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5540 
5541 		memcpy(ptr, &width, 4); ptr += 4;
5542 
5543 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5544 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5545 
5546 }
5547 
glLoadMatrixxOES_enc(void * self,const GLfixed * m)5548 void glLoadMatrixxOES_enc(void *self , const GLfixed* m)
5549 {
5550 
5551 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5552 	IOStream *stream = ctx->m_stream;
5553 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5554 	bool useChecksum = checksumCalculator->getVersion() > 0;
5555 
5556 	const unsigned int __size_m =  (16 * sizeof(GLfixed));
5557 	 unsigned char *ptr;
5558 	 unsigned char *buf;
5559 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
5560 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5561 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5562 	buf = stream->alloc(totalSize);
5563 	ptr = buf;
5564 	int tmp = OP_glLoadMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5565 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5566 
5567 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
5568 	memcpy(ptr, m, __size_m);ptr += __size_m;
5569 
5570 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5571 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5572 
5573 }
5574 
glMaterialxOES_enc(void * self,GLenum face,GLenum pname,GLfixed param)5575 void glMaterialxOES_enc(void *self , GLenum face, GLenum pname, GLfixed param)
5576 {
5577 
5578 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5579 	IOStream *stream = ctx->m_stream;
5580 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5581 	bool useChecksum = checksumCalculator->getVersion() > 0;
5582 
5583 	 unsigned char *ptr;
5584 	 unsigned char *buf;
5585 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5586 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5587 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5588 	buf = stream->alloc(totalSize);
5589 	ptr = buf;
5590 	int tmp = OP_glMaterialxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5591 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5592 
5593 		memcpy(ptr, &face, 4); ptr += 4;
5594 		memcpy(ptr, &pname, 4); ptr += 4;
5595 		memcpy(ptr, &param, 4); ptr += 4;
5596 
5597 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5598 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5599 
5600 }
5601 
glMaterialxvOES_enc(void * self,GLenum face,GLenum pname,const GLfixed * params)5602 void glMaterialxvOES_enc(void *self , GLenum face, GLenum pname, const GLfixed* params)
5603 {
5604 
5605 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5606 	IOStream *stream = ctx->m_stream;
5607 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5608 	bool useChecksum = checksumCalculator->getVersion() > 0;
5609 
5610 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5611 	 unsigned char *ptr;
5612 	 unsigned char *buf;
5613 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5614 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5615 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5616 	buf = stream->alloc(totalSize);
5617 	ptr = buf;
5618 	int tmp = OP_glMaterialxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5619 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5620 
5621 		memcpy(ptr, &face, 4); ptr += 4;
5622 		memcpy(ptr, &pname, 4); ptr += 4;
5623 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5624 	memcpy(ptr, params, __size_params);ptr += __size_params;
5625 
5626 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5627 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5628 
5629 }
5630 
glMultMatrixxOES_enc(void * self,const GLfixed * m)5631 void glMultMatrixxOES_enc(void *self , const GLfixed* m)
5632 {
5633 
5634 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5635 	IOStream *stream = ctx->m_stream;
5636 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5637 	bool useChecksum = checksumCalculator->getVersion() > 0;
5638 
5639 	const unsigned int __size_m =  (16 * sizeof(GLfixed));
5640 	 unsigned char *ptr;
5641 	 unsigned char *buf;
5642 	 const size_t sizeWithoutChecksum = 8 + __size_m + 1*4;
5643 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5644 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5645 	buf = stream->alloc(totalSize);
5646 	ptr = buf;
5647 	int tmp = OP_glMultMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5648 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5649 
5650 	*(unsigned int *)(ptr) = __size_m; ptr += 4;
5651 	memcpy(ptr, m, __size_m);ptr += __size_m;
5652 
5653 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5654 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5655 
5656 }
5657 
glMultiTexCoord4xOES_enc(void * self,GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)5658 void glMultiTexCoord4xOES_enc(void *self , GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
5659 {
5660 
5661 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5662 	IOStream *stream = ctx->m_stream;
5663 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5664 	bool useChecksum = checksumCalculator->getVersion() > 0;
5665 
5666 	 unsigned char *ptr;
5667 	 unsigned char *buf;
5668 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5669 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5670 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5671 	buf = stream->alloc(totalSize);
5672 	ptr = buf;
5673 	int tmp = OP_glMultiTexCoord4xOES;memcpy(ptr, &tmp, 4); ptr += 4;
5674 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5675 
5676 		memcpy(ptr, &target, 4); ptr += 4;
5677 		memcpy(ptr, &s, 4); ptr += 4;
5678 		memcpy(ptr, &t, 4); ptr += 4;
5679 		memcpy(ptr, &r, 4); ptr += 4;
5680 		memcpy(ptr, &q, 4); ptr += 4;
5681 
5682 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5683 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5684 
5685 }
5686 
glNormal3xOES_enc(void * self,GLfixed nx,GLfixed ny,GLfixed nz)5687 void glNormal3xOES_enc(void *self , GLfixed nx, GLfixed ny, GLfixed nz)
5688 {
5689 
5690 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5691 	IOStream *stream = ctx->m_stream;
5692 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5693 	bool useChecksum = checksumCalculator->getVersion() > 0;
5694 
5695 	 unsigned char *ptr;
5696 	 unsigned char *buf;
5697 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5698 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5699 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5700 	buf = stream->alloc(totalSize);
5701 	ptr = buf;
5702 	int tmp = OP_glNormal3xOES;memcpy(ptr, &tmp, 4); ptr += 4;
5703 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5704 
5705 		memcpy(ptr, &nx, 4); ptr += 4;
5706 		memcpy(ptr, &ny, 4); ptr += 4;
5707 		memcpy(ptr, &nz, 4); ptr += 4;
5708 
5709 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5710 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5711 
5712 }
5713 
glOrthoxOES_enc(void * self,GLfixed left,GLfixed right,GLfixed bottom,GLfixed top,GLfixed zNear,GLfixed zFar)5714 void glOrthoxOES_enc(void *self , GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
5715 {
5716 
5717 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5718 	IOStream *stream = ctx->m_stream;
5719 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5720 	bool useChecksum = checksumCalculator->getVersion() > 0;
5721 
5722 	 unsigned char *ptr;
5723 	 unsigned char *buf;
5724 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
5725 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5726 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5727 	buf = stream->alloc(totalSize);
5728 	ptr = buf;
5729 	int tmp = OP_glOrthoxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5730 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5731 
5732 		memcpy(ptr, &left, 4); ptr += 4;
5733 		memcpy(ptr, &right, 4); ptr += 4;
5734 		memcpy(ptr, &bottom, 4); ptr += 4;
5735 		memcpy(ptr, &top, 4); ptr += 4;
5736 		memcpy(ptr, &zNear, 4); ptr += 4;
5737 		memcpy(ptr, &zFar, 4); ptr += 4;
5738 
5739 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5740 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5741 
5742 }
5743 
glPointParameterxOES_enc(void * self,GLenum pname,GLfixed param)5744 void glPointParameterxOES_enc(void *self , GLenum pname, GLfixed param)
5745 {
5746 
5747 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5748 	IOStream *stream = ctx->m_stream;
5749 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5750 	bool useChecksum = checksumCalculator->getVersion() > 0;
5751 
5752 	 unsigned char *ptr;
5753 	 unsigned char *buf;
5754 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5755 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5756 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5757 	buf = stream->alloc(totalSize);
5758 	ptr = buf;
5759 	int tmp = OP_glPointParameterxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5760 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5761 
5762 		memcpy(ptr, &pname, 4); ptr += 4;
5763 		memcpy(ptr, &param, 4); ptr += 4;
5764 
5765 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5766 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5767 
5768 }
5769 
glPointParameterxvOES_enc(void * self,GLenum pname,const GLfixed * params)5770 void glPointParameterxvOES_enc(void *self , GLenum pname, const GLfixed* params)
5771 {
5772 
5773 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5774 	IOStream *stream = ctx->m_stream;
5775 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5776 	bool useChecksum = checksumCalculator->getVersion() > 0;
5777 
5778 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5779 	 unsigned char *ptr;
5780 	 unsigned char *buf;
5781 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_params + 1*4;
5782 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5783 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5784 	buf = stream->alloc(totalSize);
5785 	ptr = buf;
5786 	int tmp = OP_glPointParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5787 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5788 
5789 		memcpy(ptr, &pname, 4); ptr += 4;
5790 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5791 	memcpy(ptr, params, __size_params);ptr += __size_params;
5792 
5793 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5794 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5795 
5796 }
5797 
glPointSizexOES_enc(void * self,GLfixed size)5798 void glPointSizexOES_enc(void *self , GLfixed size)
5799 {
5800 
5801 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5802 	IOStream *stream = ctx->m_stream;
5803 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5804 	bool useChecksum = checksumCalculator->getVersion() > 0;
5805 
5806 	 unsigned char *ptr;
5807 	 unsigned char *buf;
5808 	 const size_t sizeWithoutChecksum = 8 + 4;
5809 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5810 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5811 	buf = stream->alloc(totalSize);
5812 	ptr = buf;
5813 	int tmp = OP_glPointSizexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5814 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5815 
5816 		memcpy(ptr, &size, 4); ptr += 4;
5817 
5818 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5819 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5820 
5821 }
5822 
glPolygonOffsetxOES_enc(void * self,GLfixed factor,GLfixed units)5823 void glPolygonOffsetxOES_enc(void *self , GLfixed factor, GLfixed units)
5824 {
5825 
5826 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5827 	IOStream *stream = ctx->m_stream;
5828 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5829 	bool useChecksum = checksumCalculator->getVersion() > 0;
5830 
5831 	 unsigned char *ptr;
5832 	 unsigned char *buf;
5833 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5834 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5835 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5836 	buf = stream->alloc(totalSize);
5837 	ptr = buf;
5838 	int tmp = OP_glPolygonOffsetxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5839 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5840 
5841 		memcpy(ptr, &factor, 4); ptr += 4;
5842 		memcpy(ptr, &units, 4); ptr += 4;
5843 
5844 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5845 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5846 
5847 }
5848 
glRotatexOES_enc(void * self,GLfixed angle,GLfixed x,GLfixed y,GLfixed z)5849 void glRotatexOES_enc(void *self , GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
5850 {
5851 
5852 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5853 	IOStream *stream = ctx->m_stream;
5854 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5855 	bool useChecksum = checksumCalculator->getVersion() > 0;
5856 
5857 	 unsigned char *ptr;
5858 	 unsigned char *buf;
5859 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5860 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5861 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5862 	buf = stream->alloc(totalSize);
5863 	ptr = buf;
5864 	int tmp = OP_glRotatexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5865 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5866 
5867 		memcpy(ptr, &angle, 4); ptr += 4;
5868 		memcpy(ptr, &x, 4); ptr += 4;
5869 		memcpy(ptr, &y, 4); ptr += 4;
5870 		memcpy(ptr, &z, 4); ptr += 4;
5871 
5872 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5873 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5874 
5875 }
5876 
glSampleCoveragexOES_enc(void * self,GLclampx value,GLboolean invert)5877 void glSampleCoveragexOES_enc(void *self , GLclampx value, GLboolean invert)
5878 {
5879 
5880 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5881 	IOStream *stream = ctx->m_stream;
5882 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5883 	bool useChecksum = checksumCalculator->getVersion() > 0;
5884 
5885 	 unsigned char *ptr;
5886 	 unsigned char *buf;
5887 	 const size_t sizeWithoutChecksum = 8 + 4 + 1;
5888 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5889 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5890 	buf = stream->alloc(totalSize);
5891 	ptr = buf;
5892 	int tmp = OP_glSampleCoveragexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5893 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5894 
5895 		memcpy(ptr, &value, 4); ptr += 4;
5896 		memcpy(ptr, &invert, 1); ptr += 1;
5897 
5898 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5899 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5900 
5901 }
5902 
glScalexOES_enc(void * self,GLfixed x,GLfixed y,GLfixed z)5903 void glScalexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
5904 {
5905 
5906 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5907 	IOStream *stream = ctx->m_stream;
5908 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5909 	bool useChecksum = checksumCalculator->getVersion() > 0;
5910 
5911 	 unsigned char *ptr;
5912 	 unsigned char *buf;
5913 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5914 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5915 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5916 	buf = stream->alloc(totalSize);
5917 	ptr = buf;
5918 	int tmp = OP_glScalexOES;memcpy(ptr, &tmp, 4); ptr += 4;
5919 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5920 
5921 		memcpy(ptr, &x, 4); ptr += 4;
5922 		memcpy(ptr, &y, 4); ptr += 4;
5923 		memcpy(ptr, &z, 4); ptr += 4;
5924 
5925 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5926 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5927 
5928 }
5929 
glTexEnvxOES_enc(void * self,GLenum target,GLenum pname,GLfixed param)5930 void glTexEnvxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param)
5931 {
5932 
5933 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5934 	IOStream *stream = ctx->m_stream;
5935 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5936 	bool useChecksum = checksumCalculator->getVersion() > 0;
5937 
5938 	 unsigned char *ptr;
5939 	 unsigned char *buf;
5940 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5941 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5942 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5943 	buf = stream->alloc(totalSize);
5944 	ptr = buf;
5945 	int tmp = OP_glTexEnvxOES;memcpy(ptr, &tmp, 4); ptr += 4;
5946 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5947 
5948 		memcpy(ptr, &target, 4); ptr += 4;
5949 		memcpy(ptr, &pname, 4); ptr += 4;
5950 		memcpy(ptr, &param, 4); ptr += 4;
5951 
5952 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5953 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5954 
5955 }
5956 
glTexEnvxvOES_enc(void * self,GLenum target,GLenum pname,const GLfixed * params)5957 void glTexEnvxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
5958 {
5959 
5960 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5961 	IOStream *stream = ctx->m_stream;
5962 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5963 	bool useChecksum = checksumCalculator->getVersion() > 0;
5964 
5965 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
5966 	 unsigned char *ptr;
5967 	 unsigned char *buf;
5968 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
5969 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5970 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5971 	buf = stream->alloc(totalSize);
5972 	ptr = buf;
5973 	int tmp = OP_glTexEnvxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
5974 	memcpy(ptr, &totalSize, 4);  ptr += 4;
5975 
5976 		memcpy(ptr, &target, 4); ptr += 4;
5977 		memcpy(ptr, &pname, 4); ptr += 4;
5978 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
5979 	memcpy(ptr, params, __size_params);ptr += __size_params;
5980 
5981 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5982 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5983 
5984 }
5985 
glTexParameterxOES_enc(void * self,GLenum target,GLenum pname,GLfixed param)5986 void glTexParameterxOES_enc(void *self , GLenum target, GLenum pname, GLfixed param)
5987 {
5988 
5989 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
5990 	IOStream *stream = ctx->m_stream;
5991 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5992 	bool useChecksum = checksumCalculator->getVersion() > 0;
5993 
5994 	 unsigned char *ptr;
5995 	 unsigned char *buf;
5996 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5997 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
5998 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5999 	buf = stream->alloc(totalSize);
6000 	ptr = buf;
6001 	int tmp = OP_glTexParameterxOES;memcpy(ptr, &tmp, 4); ptr += 4;
6002 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6003 
6004 		memcpy(ptr, &target, 4); ptr += 4;
6005 		memcpy(ptr, &pname, 4); ptr += 4;
6006 		memcpy(ptr, &param, 4); ptr += 4;
6007 
6008 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6009 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6010 
6011 }
6012 
glTexParameterxvOES_enc(void * self,GLenum target,GLenum pname,const GLfixed * params)6013 void glTexParameterxvOES_enc(void *self , GLenum target, GLenum pname, const GLfixed* params)
6014 {
6015 
6016 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6017 	IOStream *stream = ctx->m_stream;
6018 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6019 	bool useChecksum = checksumCalculator->getVersion() > 0;
6020 
6021 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
6022 	 unsigned char *ptr;
6023 	 unsigned char *buf;
6024 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
6025 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6026 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6027 	buf = stream->alloc(totalSize);
6028 	ptr = buf;
6029 	int tmp = OP_glTexParameterxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
6030 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6031 
6032 		memcpy(ptr, &target, 4); ptr += 4;
6033 		memcpy(ptr, &pname, 4); ptr += 4;
6034 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6035 	memcpy(ptr, params, __size_params);ptr += __size_params;
6036 
6037 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6038 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6039 
6040 }
6041 
glTranslatexOES_enc(void * self,GLfixed x,GLfixed y,GLfixed z)6042 void glTranslatexOES_enc(void *self , GLfixed x, GLfixed y, GLfixed z)
6043 {
6044 
6045 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6046 	IOStream *stream = ctx->m_stream;
6047 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6048 	bool useChecksum = checksumCalculator->getVersion() > 0;
6049 
6050 	 unsigned char *ptr;
6051 	 unsigned char *buf;
6052 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
6053 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6054 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6055 	buf = stream->alloc(totalSize);
6056 	ptr = buf;
6057 	int tmp = OP_glTranslatexOES;memcpy(ptr, &tmp, 4); ptr += 4;
6058 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6059 
6060 		memcpy(ptr, &x, 4); ptr += 4;
6061 		memcpy(ptr, &y, 4); ptr += 4;
6062 		memcpy(ptr, &z, 4); ptr += 4;
6063 
6064 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6065 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6066 
6067 }
6068 
glIsRenderbufferOES_enc(void * self,GLuint renderbuffer)6069 GLboolean glIsRenderbufferOES_enc(void *self , GLuint renderbuffer)
6070 {
6071 
6072 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6073 	IOStream *stream = ctx->m_stream;
6074 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6075 	bool useChecksum = checksumCalculator->getVersion() > 0;
6076 
6077 	 unsigned char *ptr;
6078 	 unsigned char *buf;
6079 	 const size_t sizeWithoutChecksum = 8 + 4;
6080 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6081 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6082 	buf = stream->alloc(totalSize);
6083 	ptr = buf;
6084 	int tmp = OP_glIsRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6085 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6086 
6087 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
6088 
6089 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6090 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6091 
6092 
6093 	GLboolean retval;
6094 	stream->readback(&retval, 1);
6095 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6096 	if (useChecksum) {
6097 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6098 		stream->readback(checksumBuf.get(), checksumSize);
6099 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6100 			ALOGE("glIsRenderbufferOES: GL communication error, please report this issue to b.android.com.\n");
6101 			abort();
6102 		}
6103 	}
6104 	return retval;
6105 }
6106 
glBindRenderbufferOES_enc(void * self,GLenum target,GLuint renderbuffer)6107 void glBindRenderbufferOES_enc(void *self , GLenum target, GLuint renderbuffer)
6108 {
6109 
6110 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6111 	IOStream *stream = ctx->m_stream;
6112 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6113 	bool useChecksum = checksumCalculator->getVersion() > 0;
6114 
6115 	 unsigned char *ptr;
6116 	 unsigned char *buf;
6117 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6118 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6119 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6120 	buf = stream->alloc(totalSize);
6121 	ptr = buf;
6122 	int tmp = OP_glBindRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6123 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6124 
6125 		memcpy(ptr, &target, 4); ptr += 4;
6126 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
6127 
6128 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6129 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6130 
6131 }
6132 
glDeleteRenderbuffersOES_enc(void * self,GLsizei n,const GLuint * renderbuffers)6133 void glDeleteRenderbuffersOES_enc(void *self , GLsizei n, const GLuint* renderbuffers)
6134 {
6135 
6136 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6137 	IOStream *stream = ctx->m_stream;
6138 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6139 	bool useChecksum = checksumCalculator->getVersion() > 0;
6140 
6141 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
6142 	 unsigned char *ptr;
6143 	 unsigned char *buf;
6144 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
6145 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6146 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6147 	buf = stream->alloc(totalSize);
6148 	ptr = buf;
6149 	int tmp = OP_glDeleteRenderbuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
6150 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6151 
6152 		memcpy(ptr, &n, 4); ptr += 4;
6153 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
6154 	memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
6155 
6156 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6157 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6158 
6159 }
6160 
glGenRenderbuffersOES_enc(void * self,GLsizei n,GLuint * renderbuffers)6161 void glGenRenderbuffersOES_enc(void *self , GLsizei n, GLuint* renderbuffers)
6162 {
6163 
6164 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6165 	IOStream *stream = ctx->m_stream;
6166 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6167 	bool useChecksum = checksumCalculator->getVersion() > 0;
6168 
6169 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
6170 	 unsigned char *ptr;
6171 	 unsigned char *buf;
6172 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
6173 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6174 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6175 	buf = stream->alloc(totalSize);
6176 	ptr = buf;
6177 	int tmp = OP_glGenRenderbuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
6178 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6179 
6180 		memcpy(ptr, &n, 4); ptr += 4;
6181 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
6182 
6183 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6184 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6185 
6186 	stream->readback(renderbuffers, __size_renderbuffers);
6187 	if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
6188 	if (useChecksum) {
6189 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6190 		stream->readback(checksumBuf.get(), checksumSize);
6191 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6192 			ALOGE("glGenRenderbuffersOES: GL communication error, please report this issue to b.android.com.\n");
6193 			abort();
6194 		}
6195 	}
6196 }
6197 
glRenderbufferStorageOES_enc(void * self,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)6198 void glRenderbufferStorageOES_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
6199 {
6200 
6201 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6202 	IOStream *stream = ctx->m_stream;
6203 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6204 	bool useChecksum = checksumCalculator->getVersion() > 0;
6205 
6206 	 unsigned char *ptr;
6207 	 unsigned char *buf;
6208 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6209 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6210 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6211 	buf = stream->alloc(totalSize);
6212 	ptr = buf;
6213 	int tmp = OP_glRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
6214 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6215 
6216 		memcpy(ptr, &target, 4); ptr += 4;
6217 		memcpy(ptr, &internalformat, 4); ptr += 4;
6218 		memcpy(ptr, &width, 4); ptr += 4;
6219 		memcpy(ptr, &height, 4); ptr += 4;
6220 
6221 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6222 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6223 
6224 }
6225 
glGetRenderbufferParameterivOES_enc(void * self,GLenum target,GLenum pname,GLint * params)6226 void glGetRenderbufferParameterivOES_enc(void *self , GLenum target, GLenum pname, GLint* params)
6227 {
6228 
6229 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6230 	IOStream *stream = ctx->m_stream;
6231 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6232 	bool useChecksum = checksumCalculator->getVersion() > 0;
6233 
6234 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
6235 	 unsigned char *ptr;
6236 	 unsigned char *buf;
6237 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
6238 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6239 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6240 	buf = stream->alloc(totalSize);
6241 	ptr = buf;
6242 	int tmp = OP_glGetRenderbufferParameterivOES;memcpy(ptr, &tmp, 4); ptr += 4;
6243 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6244 
6245 		memcpy(ptr, &target, 4); ptr += 4;
6246 		memcpy(ptr, &pname, 4); ptr += 4;
6247 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6248 
6249 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6250 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6251 
6252 	stream->readback(params, __size_params);
6253 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6254 	if (useChecksum) {
6255 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6256 		stream->readback(checksumBuf.get(), checksumSize);
6257 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6258 			ALOGE("glGetRenderbufferParameterivOES: GL communication error, please report this issue to b.android.com.\n");
6259 			abort();
6260 		}
6261 	}
6262 }
6263 
glIsFramebufferOES_enc(void * self,GLuint framebuffer)6264 GLboolean glIsFramebufferOES_enc(void *self , GLuint framebuffer)
6265 {
6266 
6267 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6268 	IOStream *stream = ctx->m_stream;
6269 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6270 	bool useChecksum = checksumCalculator->getVersion() > 0;
6271 
6272 	 unsigned char *ptr;
6273 	 unsigned char *buf;
6274 	 const size_t sizeWithoutChecksum = 8 + 4;
6275 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6276 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6277 	buf = stream->alloc(totalSize);
6278 	ptr = buf;
6279 	int tmp = OP_glIsFramebufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6280 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6281 
6282 		memcpy(ptr, &framebuffer, 4); ptr += 4;
6283 
6284 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6285 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6286 
6287 
6288 	GLboolean retval;
6289 	stream->readback(&retval, 1);
6290 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6291 	if (useChecksum) {
6292 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6293 		stream->readback(checksumBuf.get(), checksumSize);
6294 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6295 			ALOGE("glIsFramebufferOES: GL communication error, please report this issue to b.android.com.\n");
6296 			abort();
6297 		}
6298 	}
6299 	return retval;
6300 }
6301 
glBindFramebufferOES_enc(void * self,GLenum target,GLuint framebuffer)6302 void glBindFramebufferOES_enc(void *self , GLenum target, GLuint framebuffer)
6303 {
6304 
6305 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6306 	IOStream *stream = ctx->m_stream;
6307 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6308 	bool useChecksum = checksumCalculator->getVersion() > 0;
6309 
6310 	 unsigned char *ptr;
6311 	 unsigned char *buf;
6312 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6313 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6314 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6315 	buf = stream->alloc(totalSize);
6316 	ptr = buf;
6317 	int tmp = OP_glBindFramebufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6318 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6319 
6320 		memcpy(ptr, &target, 4); ptr += 4;
6321 		memcpy(ptr, &framebuffer, 4); ptr += 4;
6322 
6323 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6324 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6325 
6326 }
6327 
glDeleteFramebuffersOES_enc(void * self,GLsizei n,const GLuint * framebuffers)6328 void glDeleteFramebuffersOES_enc(void *self , GLsizei n, const GLuint* framebuffers)
6329 {
6330 
6331 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6332 	IOStream *stream = ctx->m_stream;
6333 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6334 	bool useChecksum = checksumCalculator->getVersion() > 0;
6335 
6336 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
6337 	 unsigned char *ptr;
6338 	 unsigned char *buf;
6339 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
6340 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6341 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6342 	buf = stream->alloc(totalSize);
6343 	ptr = buf;
6344 	int tmp = OP_glDeleteFramebuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
6345 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6346 
6347 		memcpy(ptr, &n, 4); ptr += 4;
6348 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
6349 	memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
6350 
6351 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6352 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6353 
6354 }
6355 
glGenFramebuffersOES_enc(void * self,GLsizei n,GLuint * framebuffers)6356 void glGenFramebuffersOES_enc(void *self , GLsizei n, GLuint* framebuffers)
6357 {
6358 
6359 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6360 	IOStream *stream = ctx->m_stream;
6361 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6362 	bool useChecksum = checksumCalculator->getVersion() > 0;
6363 
6364 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
6365 	 unsigned char *ptr;
6366 	 unsigned char *buf;
6367 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
6368 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6369 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6370 	buf = stream->alloc(totalSize);
6371 	ptr = buf;
6372 	int tmp = OP_glGenFramebuffersOES;memcpy(ptr, &tmp, 4); ptr += 4;
6373 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6374 
6375 		memcpy(ptr, &n, 4); ptr += 4;
6376 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
6377 
6378 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6379 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6380 
6381 	stream->readback(framebuffers, __size_framebuffers);
6382 	if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
6383 	if (useChecksum) {
6384 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6385 		stream->readback(checksumBuf.get(), checksumSize);
6386 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6387 			ALOGE("glGenFramebuffersOES: GL communication error, please report this issue to b.android.com.\n");
6388 			abort();
6389 		}
6390 	}
6391 }
6392 
glCheckFramebufferStatusOES_enc(void * self,GLenum target)6393 GLenum glCheckFramebufferStatusOES_enc(void *self , GLenum target)
6394 {
6395 
6396 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6397 	IOStream *stream = ctx->m_stream;
6398 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6399 	bool useChecksum = checksumCalculator->getVersion() > 0;
6400 
6401 	 unsigned char *ptr;
6402 	 unsigned char *buf;
6403 	 const size_t sizeWithoutChecksum = 8 + 4;
6404 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6405 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6406 	buf = stream->alloc(totalSize);
6407 	ptr = buf;
6408 	int tmp = OP_glCheckFramebufferStatusOES;memcpy(ptr, &tmp, 4); ptr += 4;
6409 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6410 
6411 		memcpy(ptr, &target, 4); ptr += 4;
6412 
6413 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6414 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6415 
6416 
6417 	GLenum retval;
6418 	stream->readback(&retval, 4);
6419 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6420 	if (useChecksum) {
6421 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6422 		stream->readback(checksumBuf.get(), checksumSize);
6423 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6424 			ALOGE("glCheckFramebufferStatusOES: GL communication error, please report this issue to b.android.com.\n");
6425 			abort();
6426 		}
6427 	}
6428 	return retval;
6429 }
6430 
glFramebufferRenderbufferOES_enc(void * self,GLenum target,GLenum attachment,GLenum renderbuffertarget,GLuint renderbuffer)6431 void glFramebufferRenderbufferOES_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
6432 {
6433 
6434 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6435 	IOStream *stream = ctx->m_stream;
6436 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6437 	bool useChecksum = checksumCalculator->getVersion() > 0;
6438 
6439 	 unsigned char *ptr;
6440 	 unsigned char *buf;
6441 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6442 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6443 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6444 	buf = stream->alloc(totalSize);
6445 	ptr = buf;
6446 	int tmp = OP_glFramebufferRenderbufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6447 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6448 
6449 		memcpy(ptr, &target, 4); ptr += 4;
6450 		memcpy(ptr, &attachment, 4); ptr += 4;
6451 		memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
6452 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
6453 
6454 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6455 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6456 
6457 }
6458 
glFramebufferTexture2DOES_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level)6459 void glFramebufferTexture2DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
6460 {
6461 
6462 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6463 	IOStream *stream = ctx->m_stream;
6464 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6465 	bool useChecksum = checksumCalculator->getVersion() > 0;
6466 
6467 	 unsigned char *ptr;
6468 	 unsigned char *buf;
6469 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6470 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6471 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6472 	buf = stream->alloc(totalSize);
6473 	ptr = buf;
6474 	int tmp = OP_glFramebufferTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
6475 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6476 
6477 		memcpy(ptr, &target, 4); ptr += 4;
6478 		memcpy(ptr, &attachment, 4); ptr += 4;
6479 		memcpy(ptr, &textarget, 4); ptr += 4;
6480 		memcpy(ptr, &texture, 4); ptr += 4;
6481 		memcpy(ptr, &level, 4); ptr += 4;
6482 
6483 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6484 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6485 
6486 }
6487 
glGetFramebufferAttachmentParameterivOES_enc(void * self,GLenum target,GLenum attachment,GLenum pname,GLint * params)6488 void glGetFramebufferAttachmentParameterivOES_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
6489 {
6490 
6491 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6492 	IOStream *stream = ctx->m_stream;
6493 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6494 	bool useChecksum = checksumCalculator->getVersion() > 0;
6495 
6496 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
6497 	 unsigned char *ptr;
6498 	 unsigned char *buf;
6499 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_params + 1*4;
6500 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6501 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6502 	buf = stream->alloc(totalSize);
6503 	ptr = buf;
6504 	int tmp = OP_glGetFramebufferAttachmentParameterivOES;memcpy(ptr, &tmp, 4); ptr += 4;
6505 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6506 
6507 		memcpy(ptr, &target, 4); ptr += 4;
6508 		memcpy(ptr, &attachment, 4); ptr += 4;
6509 		memcpy(ptr, &pname, 4); ptr += 4;
6510 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6511 
6512 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6513 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6514 
6515 	stream->readback(params, __size_params);
6516 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6517 	if (useChecksum) {
6518 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6519 		stream->readback(checksumBuf.get(), checksumSize);
6520 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6521 			ALOGE("glGetFramebufferAttachmentParameterivOES: GL communication error, please report this issue to b.android.com.\n");
6522 			abort();
6523 		}
6524 	}
6525 }
6526 
glGenerateMipmapOES_enc(void * self,GLenum target)6527 void glGenerateMipmapOES_enc(void *self , GLenum target)
6528 {
6529 
6530 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6531 	IOStream *stream = ctx->m_stream;
6532 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6533 	bool useChecksum = checksumCalculator->getVersion() > 0;
6534 
6535 	 unsigned char *ptr;
6536 	 unsigned char *buf;
6537 	 const size_t sizeWithoutChecksum = 8 + 4;
6538 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6539 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6540 	buf = stream->alloc(totalSize);
6541 	ptr = buf;
6542 	int tmp = OP_glGenerateMipmapOES;memcpy(ptr, &tmp, 4); ptr += 4;
6543 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6544 
6545 		memcpy(ptr, &target, 4); ptr += 4;
6546 
6547 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6548 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6549 
6550 }
6551 
glUnmapBufferOES_enc(void * self,GLenum target)6552 GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
6553 {
6554 
6555 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6556 	IOStream *stream = ctx->m_stream;
6557 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6558 	bool useChecksum = checksumCalculator->getVersion() > 0;
6559 
6560 	 unsigned char *ptr;
6561 	 unsigned char *buf;
6562 	 const size_t sizeWithoutChecksum = 8 + 4;
6563 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6564 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6565 	buf = stream->alloc(totalSize);
6566 	ptr = buf;
6567 	int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
6568 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6569 
6570 		memcpy(ptr, &target, 4); ptr += 4;
6571 
6572 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6573 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6574 
6575 
6576 	GLboolean retval;
6577 	stream->readback(&retval, 1);
6578 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6579 	if (useChecksum) {
6580 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6581 		stream->readback(checksumBuf.get(), checksumSize);
6582 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6583 			ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
6584 			abort();
6585 		}
6586 	}
6587 	return retval;
6588 }
6589 
glCurrentPaletteMatrixOES_enc(void * self,GLuint matrixpaletteindex)6590 void glCurrentPaletteMatrixOES_enc(void *self , GLuint matrixpaletteindex)
6591 {
6592 
6593 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6594 	IOStream *stream = ctx->m_stream;
6595 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6596 	bool useChecksum = checksumCalculator->getVersion() > 0;
6597 
6598 	 unsigned char *ptr;
6599 	 unsigned char *buf;
6600 	 const size_t sizeWithoutChecksum = 8 + 4;
6601 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6602 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6603 	buf = stream->alloc(totalSize);
6604 	ptr = buf;
6605 	int tmp = OP_glCurrentPaletteMatrixOES;memcpy(ptr, &tmp, 4); ptr += 4;
6606 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6607 
6608 		memcpy(ptr, &matrixpaletteindex, 4); ptr += 4;
6609 
6610 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6611 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6612 
6613 }
6614 
glLoadPaletteFromModelViewMatrixOES_enc(void * self)6615 void glLoadPaletteFromModelViewMatrixOES_enc(void *self )
6616 {
6617 
6618 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6619 	IOStream *stream = ctx->m_stream;
6620 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6621 	bool useChecksum = checksumCalculator->getVersion() > 0;
6622 
6623 	 unsigned char *ptr;
6624 	 unsigned char *buf;
6625 	 const size_t sizeWithoutChecksum = 8;
6626 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6627 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6628 	buf = stream->alloc(totalSize);
6629 	ptr = buf;
6630 	int tmp = OP_glLoadPaletteFromModelViewMatrixOES;memcpy(ptr, &tmp, 4); ptr += 4;
6631 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6632 
6633 
6634 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6635 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6636 
6637 }
6638 
glQueryMatrixxOES_enc(void * self,GLfixed * mantissa,GLint * exponent)6639 GLbitfield glQueryMatrixxOES_enc(void *self , GLfixed* mantissa, GLint* exponent)
6640 {
6641 
6642 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6643 	IOStream *stream = ctx->m_stream;
6644 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6645 	bool useChecksum = checksumCalculator->getVersion() > 0;
6646 
6647 	const unsigned int __size_mantissa =  (16 * sizeof(GLfixed));
6648 	const unsigned int __size_exponent =  (16 * sizeof(GLfixed));
6649 	 unsigned char *ptr;
6650 	 unsigned char *buf;
6651 	 const size_t sizeWithoutChecksum = 8 + __size_mantissa + __size_exponent + 2*4;
6652 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6653 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6654 	buf = stream->alloc(totalSize);
6655 	ptr = buf;
6656 	int tmp = OP_glQueryMatrixxOES;memcpy(ptr, &tmp, 4); ptr += 4;
6657 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6658 
6659 	*(unsigned int *)(ptr) = __size_mantissa; ptr += 4;
6660 	*(unsigned int *)(ptr) = __size_exponent; ptr += 4;
6661 
6662 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6663 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6664 
6665 	stream->readback(mantissa, __size_mantissa);
6666 	if (useChecksum) checksumCalculator->addBuffer(mantissa, __size_mantissa);
6667 	stream->readback(exponent, __size_exponent);
6668 	if (useChecksum) checksumCalculator->addBuffer(exponent, __size_exponent);
6669 
6670 	GLbitfield retval;
6671 	stream->readback(&retval, 4);
6672 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6673 	if (useChecksum) {
6674 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6675 		stream->readback(checksumBuf.get(), checksumSize);
6676 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6677 			ALOGE("glQueryMatrixxOES: GL communication error, please report this issue to b.android.com.\n");
6678 			abort();
6679 		}
6680 	}
6681 	return retval;
6682 }
6683 
glDepthRangefOES_enc(void * self,GLclampf zNear,GLclampf zFar)6684 void glDepthRangefOES_enc(void *self , GLclampf zNear, GLclampf zFar)
6685 {
6686 
6687 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6688 	IOStream *stream = ctx->m_stream;
6689 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6690 	bool useChecksum = checksumCalculator->getVersion() > 0;
6691 
6692 	 unsigned char *ptr;
6693 	 unsigned char *buf;
6694 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6695 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6696 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6697 	buf = stream->alloc(totalSize);
6698 	ptr = buf;
6699 	int tmp = OP_glDepthRangefOES;memcpy(ptr, &tmp, 4); ptr += 4;
6700 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6701 
6702 		memcpy(ptr, &zNear, 4); ptr += 4;
6703 		memcpy(ptr, &zFar, 4); ptr += 4;
6704 
6705 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6706 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6707 
6708 }
6709 
glFrustumfOES_enc(void * self,GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat zNear,GLfloat zFar)6710 void glFrustumfOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
6711 {
6712 
6713 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6714 	IOStream *stream = ctx->m_stream;
6715 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6716 	bool useChecksum = checksumCalculator->getVersion() > 0;
6717 
6718 	 unsigned char *ptr;
6719 	 unsigned char *buf;
6720 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6721 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6722 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6723 	buf = stream->alloc(totalSize);
6724 	ptr = buf;
6725 	int tmp = OP_glFrustumfOES;memcpy(ptr, &tmp, 4); ptr += 4;
6726 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6727 
6728 		memcpy(ptr, &left, 4); ptr += 4;
6729 		memcpy(ptr, &right, 4); ptr += 4;
6730 		memcpy(ptr, &bottom, 4); ptr += 4;
6731 		memcpy(ptr, &top, 4); ptr += 4;
6732 		memcpy(ptr, &zNear, 4); ptr += 4;
6733 		memcpy(ptr, &zFar, 4); ptr += 4;
6734 
6735 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6736 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6737 
6738 }
6739 
glOrthofOES_enc(void * self,GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat zNear,GLfloat zFar)6740 void glOrthofOES_enc(void *self , GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
6741 {
6742 
6743 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6744 	IOStream *stream = ctx->m_stream;
6745 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6746 	bool useChecksum = checksumCalculator->getVersion() > 0;
6747 
6748 	 unsigned char *ptr;
6749 	 unsigned char *buf;
6750 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6751 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6752 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6753 	buf = stream->alloc(totalSize);
6754 	ptr = buf;
6755 	int tmp = OP_glOrthofOES;memcpy(ptr, &tmp, 4); ptr += 4;
6756 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6757 
6758 		memcpy(ptr, &left, 4); ptr += 4;
6759 		memcpy(ptr, &right, 4); ptr += 4;
6760 		memcpy(ptr, &bottom, 4); ptr += 4;
6761 		memcpy(ptr, &top, 4); ptr += 4;
6762 		memcpy(ptr, &zNear, 4); ptr += 4;
6763 		memcpy(ptr, &zFar, 4); ptr += 4;
6764 
6765 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6766 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6767 
6768 }
6769 
glClipPlanefOES_enc(void * self,GLenum plane,const GLfloat * equation)6770 void glClipPlanefOES_enc(void *self , GLenum plane, const GLfloat* equation)
6771 {
6772 
6773 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6774 	IOStream *stream = ctx->m_stream;
6775 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6776 	bool useChecksum = checksumCalculator->getVersion() > 0;
6777 
6778 	const unsigned int __size_equation =  (4 * sizeof(GLfloat));
6779 	 unsigned char *ptr;
6780 	 unsigned char *buf;
6781 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4;
6782 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6783 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6784 	buf = stream->alloc(totalSize);
6785 	ptr = buf;
6786 	int tmp = OP_glClipPlanefOES;memcpy(ptr, &tmp, 4); ptr += 4;
6787 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6788 
6789 		memcpy(ptr, &plane, 4); ptr += 4;
6790 	*(unsigned int *)(ptr) = __size_equation; ptr += 4;
6791 	memcpy(ptr, equation, __size_equation);ptr += __size_equation;
6792 
6793 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6794 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6795 
6796 }
6797 
glClipPlanefIMG_enc(void * self,GLenum plane,const GLfloat * equation)6798 void glClipPlanefIMG_enc(void *self , GLenum plane, const GLfloat* equation)
6799 {
6800 
6801 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6802 	IOStream *stream = ctx->m_stream;
6803 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6804 	bool useChecksum = checksumCalculator->getVersion() > 0;
6805 
6806 	const unsigned int __size_equation =  (4 * sizeof(GLfloat));
6807 	 unsigned char *ptr;
6808 	 unsigned char *buf;
6809 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_equation + 1*4;
6810 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6811 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6812 	buf = stream->alloc(totalSize);
6813 	ptr = buf;
6814 	int tmp = OP_glClipPlanefIMG;memcpy(ptr, &tmp, 4); ptr += 4;
6815 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6816 
6817 		memcpy(ptr, &plane, 4); ptr += 4;
6818 	*(unsigned int *)(ptr) = __size_equation; ptr += 4;
6819 	memcpy(ptr, equation, __size_equation);ptr += __size_equation;
6820 
6821 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6822 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6823 
6824 }
6825 
glGetClipPlanefOES_enc(void * self,GLenum pname,GLfloat * eqn)6826 void glGetClipPlanefOES_enc(void *self , GLenum pname, GLfloat* eqn)
6827 {
6828 
6829 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6830 	IOStream *stream = ctx->m_stream;
6831 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6832 	bool useChecksum = checksumCalculator->getVersion() > 0;
6833 
6834 	const unsigned int __size_eqn =  (4 * sizeof(GLfloat));
6835 	 unsigned char *ptr;
6836 	 unsigned char *buf;
6837 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_eqn + 1*4;
6838 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6839 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6840 	buf = stream->alloc(totalSize);
6841 	ptr = buf;
6842 	int tmp = OP_glGetClipPlanefOES;memcpy(ptr, &tmp, 4); ptr += 4;
6843 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6844 
6845 		memcpy(ptr, &pname, 4); ptr += 4;
6846 	*(unsigned int *)(ptr) = __size_eqn; ptr += 4;
6847 
6848 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6849 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6850 
6851 	stream->readback(eqn, __size_eqn);
6852 	if (useChecksum) checksumCalculator->addBuffer(eqn, __size_eqn);
6853 	if (useChecksum) {
6854 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
6855 		stream->readback(checksumBuf.get(), checksumSize);
6856 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
6857 			ALOGE("glGetClipPlanefOES: GL communication error, please report this issue to b.android.com.\n");
6858 			abort();
6859 		}
6860 	}
6861 }
6862 
glClearDepthfOES_enc(void * self,GLclampf depth)6863 void glClearDepthfOES_enc(void *self , GLclampf depth)
6864 {
6865 
6866 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6867 	IOStream *stream = ctx->m_stream;
6868 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6869 	bool useChecksum = checksumCalculator->getVersion() > 0;
6870 
6871 	 unsigned char *ptr;
6872 	 unsigned char *buf;
6873 	 const size_t sizeWithoutChecksum = 8 + 4;
6874 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6875 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6876 	buf = stream->alloc(totalSize);
6877 	ptr = buf;
6878 	int tmp = OP_glClearDepthfOES;memcpy(ptr, &tmp, 4); ptr += 4;
6879 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6880 
6881 		memcpy(ptr, &depth, 4); ptr += 4;
6882 
6883 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6884 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6885 
6886 }
6887 
glTexGenfOES_enc(void * self,GLenum coord,GLenum pname,GLfloat param)6888 void glTexGenfOES_enc(void *self , GLenum coord, GLenum pname, GLfloat param)
6889 {
6890 
6891 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6892 	IOStream *stream = ctx->m_stream;
6893 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6894 	bool useChecksum = checksumCalculator->getVersion() > 0;
6895 
6896 	 unsigned char *ptr;
6897 	 unsigned char *buf;
6898 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
6899 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6900 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6901 	buf = stream->alloc(totalSize);
6902 	ptr = buf;
6903 	int tmp = OP_glTexGenfOES;memcpy(ptr, &tmp, 4); ptr += 4;
6904 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6905 
6906 		memcpy(ptr, &coord, 4); ptr += 4;
6907 		memcpy(ptr, &pname, 4); ptr += 4;
6908 		memcpy(ptr, &param, 4); ptr += 4;
6909 
6910 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6911 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6912 
6913 }
6914 
glTexGenfvOES_enc(void * self,GLenum coord,GLenum pname,const GLfloat * params)6915 void glTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, const GLfloat* params)
6916 {
6917 
6918 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6919 	IOStream *stream = ctx->m_stream;
6920 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6921 	bool useChecksum = checksumCalculator->getVersion() > 0;
6922 
6923 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
6924 	 unsigned char *ptr;
6925 	 unsigned char *buf;
6926 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
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_glTexGenfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
6932 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6933 
6934 		memcpy(ptr, &coord, 4); ptr += 4;
6935 		memcpy(ptr, &pname, 4); ptr += 4;
6936 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6937 	memcpy(ptr, params, __size_params);ptr += __size_params;
6938 
6939 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6940 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6941 
6942 }
6943 
glTexGeniOES_enc(void * self,GLenum coord,GLenum pname,GLint param)6944 void glTexGeniOES_enc(void *self , GLenum coord, GLenum pname, GLint param)
6945 {
6946 
6947 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6948 	IOStream *stream = ctx->m_stream;
6949 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6950 	bool useChecksum = checksumCalculator->getVersion() > 0;
6951 
6952 	 unsigned char *ptr;
6953 	 unsigned char *buf;
6954 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
6955 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6956 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6957 	buf = stream->alloc(totalSize);
6958 	ptr = buf;
6959 	int tmp = OP_glTexGeniOES;memcpy(ptr, &tmp, 4); ptr += 4;
6960 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6961 
6962 		memcpy(ptr, &coord, 4); ptr += 4;
6963 		memcpy(ptr, &pname, 4); ptr += 4;
6964 		memcpy(ptr, &param, 4); ptr += 4;
6965 
6966 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6967 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6968 
6969 }
6970 
glTexGenivOES_enc(void * self,GLenum coord,GLenum pname,const GLint * params)6971 void glTexGenivOES_enc(void *self , GLenum coord, GLenum pname, const GLint* params)
6972 {
6973 
6974 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
6975 	IOStream *stream = ctx->m_stream;
6976 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6977 	bool useChecksum = checksumCalculator->getVersion() > 0;
6978 
6979 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
6980 	 unsigned char *ptr;
6981 	 unsigned char *buf;
6982 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
6983 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
6984 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6985 	buf = stream->alloc(totalSize);
6986 	ptr = buf;
6987 	int tmp = OP_glTexGenivOES;memcpy(ptr, &tmp, 4); ptr += 4;
6988 	memcpy(ptr, &totalSize, 4);  ptr += 4;
6989 
6990 		memcpy(ptr, &coord, 4); ptr += 4;
6991 		memcpy(ptr, &pname, 4); ptr += 4;
6992 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
6993 	memcpy(ptr, params, __size_params);ptr += __size_params;
6994 
6995 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6996 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6997 
6998 }
6999 
glTexGenxOES_enc(void * self,GLenum coord,GLenum pname,GLfixed param)7000 void glTexGenxOES_enc(void *self , GLenum coord, GLenum pname, GLfixed param)
7001 {
7002 
7003 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7004 	IOStream *stream = ctx->m_stream;
7005 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7006 	bool useChecksum = checksumCalculator->getVersion() > 0;
7007 
7008 	 unsigned char *ptr;
7009 	 unsigned char *buf;
7010 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7011 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7012 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7013 	buf = stream->alloc(totalSize);
7014 	ptr = buf;
7015 	int tmp = OP_glTexGenxOES;memcpy(ptr, &tmp, 4); ptr += 4;
7016 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7017 
7018 		memcpy(ptr, &coord, 4); ptr += 4;
7019 		memcpy(ptr, &pname, 4); ptr += 4;
7020 		memcpy(ptr, &param, 4); ptr += 4;
7021 
7022 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7023 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7024 
7025 }
7026 
glTexGenxvOES_enc(void * self,GLenum coord,GLenum pname,const GLfixed * params)7027 void glTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, const GLfixed* params)
7028 {
7029 
7030 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7031 	IOStream *stream = ctx->m_stream;
7032 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7033 	bool useChecksum = checksumCalculator->getVersion() > 0;
7034 
7035 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
7036 	 unsigned char *ptr;
7037 	 unsigned char *buf;
7038 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7039 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7040 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7041 	buf = stream->alloc(totalSize);
7042 	ptr = buf;
7043 	int tmp = OP_glTexGenxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
7044 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7045 
7046 		memcpy(ptr, &coord, 4); ptr += 4;
7047 		memcpy(ptr, &pname, 4); ptr += 4;
7048 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7049 	memcpy(ptr, params, __size_params);ptr += __size_params;
7050 
7051 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7052 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7053 
7054 }
7055 
glGetTexGenfvOES_enc(void * self,GLenum coord,GLenum pname,GLfloat * params)7056 void glGetTexGenfvOES_enc(void *self , GLenum coord, GLenum pname, GLfloat* params)
7057 {
7058 
7059 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7060 	IOStream *stream = ctx->m_stream;
7061 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7062 	bool useChecksum = checksumCalculator->getVersion() > 0;
7063 
7064 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
7065 	 unsigned char *ptr;
7066 	 unsigned char *buf;
7067 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7068 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7069 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7070 	buf = stream->alloc(totalSize);
7071 	ptr = buf;
7072 	int tmp = OP_glGetTexGenfvOES;memcpy(ptr, &tmp, 4); ptr += 4;
7073 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7074 
7075 		memcpy(ptr, &coord, 4); ptr += 4;
7076 		memcpy(ptr, &pname, 4); ptr += 4;
7077 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7078 	memcpy(ptr, params, __size_params);ptr += __size_params;
7079 
7080 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7081 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7082 
7083 }
7084 
glGetTexGenivOES_enc(void * self,GLenum coord,GLenum pname,GLint * params)7085 void glGetTexGenivOES_enc(void *self , GLenum coord, GLenum pname, GLint* params)
7086 {
7087 
7088 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7089 	IOStream *stream = ctx->m_stream;
7090 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7091 	bool useChecksum = checksumCalculator->getVersion() > 0;
7092 
7093 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
7094 	 unsigned char *ptr;
7095 	 unsigned char *buf;
7096 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7097 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7098 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7099 	buf = stream->alloc(totalSize);
7100 	ptr = buf;
7101 	int tmp = OP_glGetTexGenivOES;memcpy(ptr, &tmp, 4); ptr += 4;
7102 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7103 
7104 		memcpy(ptr, &coord, 4); ptr += 4;
7105 		memcpy(ptr, &pname, 4); ptr += 4;
7106 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7107 	memcpy(ptr, params, __size_params);ptr += __size_params;
7108 
7109 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7110 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7111 
7112 }
7113 
glGetTexGenxvOES_enc(void * self,GLenum coord,GLenum pname,GLfixed * params)7114 void glGetTexGenxvOES_enc(void *self , GLenum coord, GLenum pname, GLfixed* params)
7115 {
7116 
7117 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7118 	IOStream *stream = ctx->m_stream;
7119 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7120 	bool useChecksum = checksumCalculator->getVersion() > 0;
7121 
7122 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfixed));
7123 	 unsigned char *ptr;
7124 	 unsigned char *buf;
7125 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7126 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7127 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7128 	buf = stream->alloc(totalSize);
7129 	ptr = buf;
7130 	int tmp = OP_glGetTexGenxvOES;memcpy(ptr, &tmp, 4); ptr += 4;
7131 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7132 
7133 		memcpy(ptr, &coord, 4); ptr += 4;
7134 		memcpy(ptr, &pname, 4); ptr += 4;
7135 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7136 	memcpy(ptr, params, __size_params);ptr += __size_params;
7137 
7138 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7139 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7140 
7141 }
7142 
glBindVertexArrayOES_enc(void * self,GLuint array)7143 void glBindVertexArrayOES_enc(void *self , GLuint array)
7144 {
7145 
7146 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7147 	IOStream *stream = ctx->m_stream;
7148 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7149 	bool useChecksum = checksumCalculator->getVersion() > 0;
7150 
7151 	 unsigned char *ptr;
7152 	 unsigned char *buf;
7153 	 const size_t sizeWithoutChecksum = 8 + 4;
7154 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7155 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7156 	buf = stream->alloc(totalSize);
7157 	ptr = buf;
7158 	int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
7159 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7160 
7161 		memcpy(ptr, &array, 4); ptr += 4;
7162 
7163 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7164 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7165 
7166 }
7167 
glDeleteVertexArraysOES_enc(void * self,GLsizei n,const GLuint * arrays)7168 void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
7169 {
7170 
7171 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7172 	IOStream *stream = ctx->m_stream;
7173 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7174 	bool useChecksum = checksumCalculator->getVersion() > 0;
7175 
7176 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
7177 	 unsigned char *ptr;
7178 	 unsigned char *buf;
7179 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
7180 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7181 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7182 	buf = stream->alloc(totalSize);
7183 	ptr = buf;
7184 	int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
7185 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7186 
7187 		memcpy(ptr, &n, 4); ptr += 4;
7188 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
7189 	memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
7190 
7191 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7192 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7193 
7194 }
7195 
glGenVertexArraysOES_enc(void * self,GLsizei n,GLuint * arrays)7196 void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
7197 {
7198 
7199 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7200 	IOStream *stream = ctx->m_stream;
7201 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7202 	bool useChecksum = checksumCalculator->getVersion() > 0;
7203 
7204 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
7205 	 unsigned char *ptr;
7206 	 unsigned char *buf;
7207 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
7208 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7209 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7210 	buf = stream->alloc(totalSize);
7211 	ptr = buf;
7212 	int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
7213 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7214 
7215 		memcpy(ptr, &n, 4); ptr += 4;
7216 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
7217 
7218 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7219 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7220 
7221 	stream->readback(arrays, __size_arrays);
7222 	if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
7223 	if (useChecksum) {
7224 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7225 		stream->readback(checksumBuf.get(), checksumSize);
7226 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7227 			ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
7228 			abort();
7229 		}
7230 	}
7231 }
7232 
glIsVertexArrayOES_enc(void * self,GLuint array)7233 GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
7234 {
7235 
7236 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7237 	IOStream *stream = ctx->m_stream;
7238 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7239 	bool useChecksum = checksumCalculator->getVersion() > 0;
7240 
7241 	 unsigned char *ptr;
7242 	 unsigned char *buf;
7243 	 const size_t sizeWithoutChecksum = 8 + 4;
7244 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7245 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7246 	buf = stream->alloc(totalSize);
7247 	ptr = buf;
7248 	int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
7249 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7250 
7251 		memcpy(ptr, &array, 4); ptr += 4;
7252 
7253 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7254 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7255 
7256 
7257 	GLboolean retval;
7258 	stream->readback(&retval, 1);
7259 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7260 	if (useChecksum) {
7261 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7262 		stream->readback(checksumBuf.get(), checksumSize);
7263 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7264 			ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
7265 			abort();
7266 		}
7267 	}
7268 	return retval;
7269 }
7270 
glDiscardFramebufferEXT_enc(void * self,GLenum target,GLsizei numAttachments,const GLenum * attachments)7271 void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
7272 {
7273 
7274 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7275 	IOStream *stream = ctx->m_stream;
7276 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7277 	bool useChecksum = checksumCalculator->getVersion() > 0;
7278 
7279 	const unsigned int __size_attachments =  (numAttachments * sizeof(const GLenum));
7280 	 unsigned char *ptr;
7281 	 unsigned char *buf;
7282 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
7283 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7284 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7285 	buf = stream->alloc(totalSize);
7286 	ptr = buf;
7287 	int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
7288 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7289 
7290 		memcpy(ptr, &target, 4); ptr += 4;
7291 		memcpy(ptr, &numAttachments, 4); ptr += 4;
7292 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7293 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7294 
7295 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7296 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7297 
7298 }
7299 
glRenderbufferStorageMultisampleIMG_enc(void * self,GLenum target,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height)7300 void glRenderbufferStorageMultisampleIMG_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
7301 {
7302 
7303 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7304 	IOStream *stream = ctx->m_stream;
7305 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7306 	bool useChecksum = checksumCalculator->getVersion() > 0;
7307 
7308 	 unsigned char *ptr;
7309 	 unsigned char *buf;
7310 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7311 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7312 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7313 	buf = stream->alloc(totalSize);
7314 	ptr = buf;
7315 	int tmp = OP_glRenderbufferStorageMultisampleIMG;memcpy(ptr, &tmp, 4); ptr += 4;
7316 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7317 
7318 		memcpy(ptr, &target, 4); ptr += 4;
7319 		memcpy(ptr, &samples, 4); ptr += 4;
7320 		memcpy(ptr, &internalformat, 4); ptr += 4;
7321 		memcpy(ptr, &width, 4); ptr += 4;
7322 		memcpy(ptr, &height, 4); ptr += 4;
7323 
7324 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7325 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7326 
7327 }
7328 
glFramebufferTexture2DMultisampleIMG_enc(void * self,GLenum target,GLenum attachment,GLenum textarget,GLuint texture,GLint level,GLsizei samples)7329 void glFramebufferTexture2DMultisampleIMG_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
7330 {
7331 
7332 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7333 	IOStream *stream = ctx->m_stream;
7334 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7335 	bool useChecksum = checksumCalculator->getVersion() > 0;
7336 
7337 	 unsigned char *ptr;
7338 	 unsigned char *buf;
7339 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
7340 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7341 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7342 	buf = stream->alloc(totalSize);
7343 	ptr = buf;
7344 	int tmp = OP_glFramebufferTexture2DMultisampleIMG;memcpy(ptr, &tmp, 4); ptr += 4;
7345 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7346 
7347 		memcpy(ptr, &target, 4); ptr += 4;
7348 		memcpy(ptr, &attachment, 4); ptr += 4;
7349 		memcpy(ptr, &textarget, 4); ptr += 4;
7350 		memcpy(ptr, &texture, 4); ptr += 4;
7351 		memcpy(ptr, &level, 4); ptr += 4;
7352 		memcpy(ptr, &samples, 4); ptr += 4;
7353 
7354 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7355 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7356 
7357 }
7358 
glDeleteFencesNV_enc(void * self,GLsizei n,const GLuint * fences)7359 void glDeleteFencesNV_enc(void *self , GLsizei n, const GLuint* fences)
7360 {
7361 
7362 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7363 	IOStream *stream = ctx->m_stream;
7364 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7365 	bool useChecksum = checksumCalculator->getVersion() > 0;
7366 
7367 	const unsigned int __size_fences =  (n * sizeof(GLuint));
7368 	 unsigned char *ptr;
7369 	 unsigned char *buf;
7370 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_fences + 1*4;
7371 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7372 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7373 	buf = stream->alloc(totalSize);
7374 	ptr = buf;
7375 	int tmp = OP_glDeleteFencesNV;memcpy(ptr, &tmp, 4); ptr += 4;
7376 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7377 
7378 		memcpy(ptr, &n, 4); ptr += 4;
7379 	*(unsigned int *)(ptr) = __size_fences; ptr += 4;
7380 	memcpy(ptr, fences, __size_fences);ptr += __size_fences;
7381 
7382 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7383 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7384 
7385 }
7386 
glGenFencesNV_enc(void * self,GLsizei n,GLuint * fences)7387 void glGenFencesNV_enc(void *self , GLsizei n, GLuint* fences)
7388 {
7389 
7390 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7391 	IOStream *stream = ctx->m_stream;
7392 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7393 	bool useChecksum = checksumCalculator->getVersion() > 0;
7394 
7395 	const unsigned int __size_fences =  (n * sizeof(GLuint));
7396 	 unsigned char *ptr;
7397 	 unsigned char *buf;
7398 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_fences + 1*4;
7399 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7400 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7401 	buf = stream->alloc(totalSize);
7402 	ptr = buf;
7403 	int tmp = OP_glGenFencesNV;memcpy(ptr, &tmp, 4); ptr += 4;
7404 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7405 
7406 		memcpy(ptr, &n, 4); ptr += 4;
7407 	*(unsigned int *)(ptr) = __size_fences; ptr += 4;
7408 	memcpy(ptr, fences, __size_fences);ptr += __size_fences;
7409 
7410 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7411 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7412 
7413 }
7414 
glIsFenceNV_enc(void * self,GLuint fence)7415 GLboolean glIsFenceNV_enc(void *self , GLuint fence)
7416 {
7417 
7418 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7419 	IOStream *stream = ctx->m_stream;
7420 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7421 	bool useChecksum = checksumCalculator->getVersion() > 0;
7422 
7423 	 unsigned char *ptr;
7424 	 unsigned char *buf;
7425 	 const size_t sizeWithoutChecksum = 8 + 4;
7426 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7427 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7428 	buf = stream->alloc(totalSize);
7429 	ptr = buf;
7430 	int tmp = OP_glIsFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
7431 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7432 
7433 		memcpy(ptr, &fence, 4); ptr += 4;
7434 
7435 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7436 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7437 
7438 
7439 	GLboolean retval;
7440 	stream->readback(&retval, 1);
7441 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7442 	if (useChecksum) {
7443 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7444 		stream->readback(checksumBuf.get(), checksumSize);
7445 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7446 			ALOGE("glIsFenceNV: GL communication error, please report this issue to b.android.com.\n");
7447 			abort();
7448 		}
7449 	}
7450 	return retval;
7451 }
7452 
glTestFenceNV_enc(void * self,GLuint fence)7453 GLboolean glTestFenceNV_enc(void *self , GLuint fence)
7454 {
7455 
7456 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7457 	IOStream *stream = ctx->m_stream;
7458 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7459 	bool useChecksum = checksumCalculator->getVersion() > 0;
7460 
7461 	 unsigned char *ptr;
7462 	 unsigned char *buf;
7463 	 const size_t sizeWithoutChecksum = 8 + 4;
7464 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7465 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7466 	buf = stream->alloc(totalSize);
7467 	ptr = buf;
7468 	int tmp = OP_glTestFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
7469 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7470 
7471 		memcpy(ptr, &fence, 4); ptr += 4;
7472 
7473 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7474 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7475 
7476 
7477 	GLboolean retval;
7478 	stream->readback(&retval, 1);
7479 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7480 	if (useChecksum) {
7481 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7482 		stream->readback(checksumBuf.get(), checksumSize);
7483 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7484 			ALOGE("glTestFenceNV: GL communication error, please report this issue to b.android.com.\n");
7485 			abort();
7486 		}
7487 	}
7488 	return retval;
7489 }
7490 
glGetFenceivNV_enc(void * self,GLuint fence,GLenum pname,GLint * params)7491 void glGetFenceivNV_enc(void *self , GLuint fence, GLenum pname, GLint* params)
7492 {
7493 
7494 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7495 	IOStream *stream = ctx->m_stream;
7496 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7497 	bool useChecksum = checksumCalculator->getVersion() > 0;
7498 
7499 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
7500 	 unsigned char *ptr;
7501 	 unsigned char *buf;
7502 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7503 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7504 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7505 	buf = stream->alloc(totalSize);
7506 	ptr = buf;
7507 	int tmp = OP_glGetFenceivNV;memcpy(ptr, &tmp, 4); ptr += 4;
7508 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7509 
7510 		memcpy(ptr, &fence, 4); ptr += 4;
7511 		memcpy(ptr, &pname, 4); ptr += 4;
7512 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7513 
7514 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7515 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7516 
7517 	stream->readback(params, __size_params);
7518 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7519 	if (useChecksum) {
7520 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7521 		stream->readback(checksumBuf.get(), checksumSize);
7522 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7523 			ALOGE("glGetFenceivNV: GL communication error, please report this issue to b.android.com.\n");
7524 			abort();
7525 		}
7526 	}
7527 }
7528 
glFinishFenceNV_enc(void * self,GLuint fence)7529 void glFinishFenceNV_enc(void *self , GLuint fence)
7530 {
7531 
7532 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7533 	IOStream *stream = ctx->m_stream;
7534 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7535 	bool useChecksum = checksumCalculator->getVersion() > 0;
7536 
7537 	 unsigned char *ptr;
7538 	 unsigned char *buf;
7539 	 const size_t sizeWithoutChecksum = 8 + 4;
7540 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7541 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7542 	buf = stream->alloc(totalSize);
7543 	ptr = buf;
7544 	int tmp = OP_glFinishFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
7545 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7546 
7547 		memcpy(ptr, &fence, 4); ptr += 4;
7548 
7549 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7550 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7551 
7552 }
7553 
glSetFenceNV_enc(void * self,GLuint fence,GLenum condition)7554 void glSetFenceNV_enc(void *self , GLuint fence, GLenum condition)
7555 {
7556 
7557 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7558 	IOStream *stream = ctx->m_stream;
7559 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7560 	bool useChecksum = checksumCalculator->getVersion() > 0;
7561 
7562 	 unsigned char *ptr;
7563 	 unsigned char *buf;
7564 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7565 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7566 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7567 	buf = stream->alloc(totalSize);
7568 	ptr = buf;
7569 	int tmp = OP_glSetFenceNV;memcpy(ptr, &tmp, 4); ptr += 4;
7570 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7571 
7572 		memcpy(ptr, &fence, 4); ptr += 4;
7573 		memcpy(ptr, &condition, 4); ptr += 4;
7574 
7575 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7576 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7577 
7578 }
7579 
glGetDriverControlsQCOM_enc(void * self,GLint * num,GLsizei size,GLuint * driverControls)7580 void glGetDriverControlsQCOM_enc(void *self , GLint* num, GLsizei size, GLuint* driverControls)
7581 {
7582 
7583 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7584 	IOStream *stream = ctx->m_stream;
7585 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7586 	bool useChecksum = checksumCalculator->getVersion() > 0;
7587 
7588 	const unsigned int __size_num =  (1 * sizeof(GLint));
7589 	const unsigned int __size_driverControls =  (size * sizeof(GLuint));
7590 	 unsigned char *ptr;
7591 	 unsigned char *buf;
7592 	 const size_t sizeWithoutChecksum = 8 + __size_num + 4 + __size_driverControls + 2*4;
7593 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7594 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7595 	buf = stream->alloc(totalSize);
7596 	ptr = buf;
7597 	int tmp = OP_glGetDriverControlsQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7598 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7599 
7600 	*(unsigned int *)(ptr) = __size_num; ptr += 4;
7601 		memcpy(ptr, &size, 4); ptr += 4;
7602 	*(unsigned int *)(ptr) = __size_driverControls; ptr += 4;
7603 
7604 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7605 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7606 
7607 	stream->readback(num, __size_num);
7608 	if (useChecksum) checksumCalculator->addBuffer(num, __size_num);
7609 	stream->readback(driverControls, __size_driverControls);
7610 	if (useChecksum) checksumCalculator->addBuffer(driverControls, __size_driverControls);
7611 	if (useChecksum) {
7612 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7613 		stream->readback(checksumBuf.get(), checksumSize);
7614 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7615 			ALOGE("glGetDriverControlsQCOM: GL communication error, please report this issue to b.android.com.\n");
7616 			abort();
7617 		}
7618 	}
7619 }
7620 
glGetDriverControlStringQCOM_enc(void * self,GLuint driverControl,GLsizei bufSize,GLsizei * length,GLchar * driverControlString)7621 void glGetDriverControlStringQCOM_enc(void *self , GLuint driverControl, GLsizei bufSize, GLsizei* length, GLchar* driverControlString)
7622 {
7623 
7624 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7625 	IOStream *stream = ctx->m_stream;
7626 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7627 	bool useChecksum = checksumCalculator->getVersion() > 0;
7628 
7629 	const unsigned int __size_length =  (1 * sizeof(GLsizei));
7630 	const unsigned int __size_driverControlString =  (1 * sizeof(GLchar));
7631 	 unsigned char *ptr;
7632 	 unsigned char *buf;
7633 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_length + __size_driverControlString + 2*4;
7634 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7635 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7636 	buf = stream->alloc(totalSize);
7637 	ptr = buf;
7638 	int tmp = OP_glGetDriverControlStringQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7639 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7640 
7641 		memcpy(ptr, &driverControl, 4); ptr += 4;
7642 		memcpy(ptr, &bufSize, 4); ptr += 4;
7643 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
7644 	*(unsigned int *)(ptr) = __size_driverControlString; ptr += 4;
7645 
7646 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7647 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7648 
7649 	stream->readback(length, __size_length);
7650 	if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7651 	stream->readback(driverControlString, __size_driverControlString);
7652 	if (useChecksum) checksumCalculator->addBuffer(driverControlString, __size_driverControlString);
7653 	if (useChecksum) {
7654 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7655 		stream->readback(checksumBuf.get(), checksumSize);
7656 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7657 			ALOGE("glGetDriverControlStringQCOM: GL communication error, please report this issue to b.android.com.\n");
7658 			abort();
7659 		}
7660 	}
7661 }
7662 
glEnableDriverControlQCOM_enc(void * self,GLuint driverControl)7663 void glEnableDriverControlQCOM_enc(void *self , GLuint driverControl)
7664 {
7665 
7666 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7667 	IOStream *stream = ctx->m_stream;
7668 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7669 	bool useChecksum = checksumCalculator->getVersion() > 0;
7670 
7671 	 unsigned char *ptr;
7672 	 unsigned char *buf;
7673 	 const size_t sizeWithoutChecksum = 8 + 4;
7674 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7675 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7676 	buf = stream->alloc(totalSize);
7677 	ptr = buf;
7678 	int tmp = OP_glEnableDriverControlQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7679 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7680 
7681 		memcpy(ptr, &driverControl, 4); ptr += 4;
7682 
7683 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7684 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7685 
7686 }
7687 
glDisableDriverControlQCOM_enc(void * self,GLuint driverControl)7688 void glDisableDriverControlQCOM_enc(void *self , GLuint driverControl)
7689 {
7690 
7691 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7692 	IOStream *stream = ctx->m_stream;
7693 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7694 	bool useChecksum = checksumCalculator->getVersion() > 0;
7695 
7696 	 unsigned char *ptr;
7697 	 unsigned char *buf;
7698 	 const size_t sizeWithoutChecksum = 8 + 4;
7699 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7700 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7701 	buf = stream->alloc(totalSize);
7702 	ptr = buf;
7703 	int tmp = OP_glDisableDriverControlQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7704 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7705 
7706 		memcpy(ptr, &driverControl, 4); ptr += 4;
7707 
7708 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7709 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7710 
7711 }
7712 
glExtGetTexturesQCOM_enc(void * self,GLuint * textures,GLint maxTextures,GLint * numTextures)7713 void glExtGetTexturesQCOM_enc(void *self , GLuint* textures, GLint maxTextures, GLint* numTextures)
7714 {
7715 
7716 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7717 	IOStream *stream = ctx->m_stream;
7718 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7719 	bool useChecksum = checksumCalculator->getVersion() > 0;
7720 
7721 	const unsigned int __size_textures =  (maxTextures * sizeof(GLuint));
7722 	const unsigned int __size_numTextures =  (1 * sizeof(GLint));
7723 	 unsigned char *ptr;
7724 	 unsigned char *buf;
7725 	 const size_t sizeWithoutChecksum = 8 + __size_textures + 4 + __size_numTextures + 2*4;
7726 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7727 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7728 	buf = stream->alloc(totalSize);
7729 	ptr = buf;
7730 	int tmp = OP_glExtGetTexturesQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7731 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7732 
7733 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
7734 		memcpy(ptr, &maxTextures, 4); ptr += 4;
7735 	*(unsigned int *)(ptr) = __size_numTextures; ptr += 4;
7736 
7737 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7738 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7739 
7740 	stream->readback(textures, __size_textures);
7741 	if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
7742 	stream->readback(numTextures, __size_numTextures);
7743 	if (useChecksum) checksumCalculator->addBuffer(numTextures, __size_numTextures);
7744 	if (useChecksum) {
7745 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7746 		stream->readback(checksumBuf.get(), checksumSize);
7747 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7748 			ALOGE("glExtGetTexturesQCOM: GL communication error, please report this issue to b.android.com.\n");
7749 			abort();
7750 		}
7751 	}
7752 }
7753 
glExtGetBuffersQCOM_enc(void * self,GLuint * buffers,GLint maxBuffers,GLint * numBuffers)7754 void glExtGetBuffersQCOM_enc(void *self , GLuint* buffers, GLint maxBuffers, GLint* numBuffers)
7755 {
7756 
7757 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7758 	IOStream *stream = ctx->m_stream;
7759 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7760 	bool useChecksum = checksumCalculator->getVersion() > 0;
7761 
7762 	const unsigned int __size_buffers =  (maxBuffers * sizeof(GLuint));
7763 	const unsigned int __size_numBuffers =  (1 * sizeof(GLint));
7764 	 unsigned char *ptr;
7765 	 unsigned char *buf;
7766 	 const size_t sizeWithoutChecksum = 8 + __size_buffers + 4 + __size_numBuffers + 2*4;
7767 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7768 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7769 	buf = stream->alloc(totalSize);
7770 	ptr = buf;
7771 	int tmp = OP_glExtGetBuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7772 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7773 
7774 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
7775 		memcpy(ptr, &maxBuffers, 4); ptr += 4;
7776 	*(unsigned int *)(ptr) = __size_numBuffers; ptr += 4;
7777 
7778 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7779 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7780 
7781 	stream->readback(buffers, __size_buffers);
7782 	if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
7783 	stream->readback(numBuffers, __size_numBuffers);
7784 	if (useChecksum) checksumCalculator->addBuffer(numBuffers, __size_numBuffers);
7785 	if (useChecksum) {
7786 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7787 		stream->readback(checksumBuf.get(), checksumSize);
7788 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7789 			ALOGE("glExtGetBuffersQCOM: GL communication error, please report this issue to b.android.com.\n");
7790 			abort();
7791 		}
7792 	}
7793 }
7794 
glExtGetRenderbuffersQCOM_enc(void * self,GLuint * renderbuffers,GLint maxRenderbuffers,GLint * numRenderbuffers)7795 void glExtGetRenderbuffersQCOM_enc(void *self , GLuint* renderbuffers, GLint maxRenderbuffers, GLint* numRenderbuffers)
7796 {
7797 
7798 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7799 	IOStream *stream = ctx->m_stream;
7800 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7801 	bool useChecksum = checksumCalculator->getVersion() > 0;
7802 
7803 	const unsigned int __size_renderbuffers =  (maxRenderbuffers * sizeof(GLuint));
7804 	const unsigned int __size_numRenderbuffers =  (1 * sizeof(GLint));
7805 	 unsigned char *ptr;
7806 	 unsigned char *buf;
7807 	 const size_t sizeWithoutChecksum = 8 + __size_renderbuffers + 4 + __size_numRenderbuffers + 2*4;
7808 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7809 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7810 	buf = stream->alloc(totalSize);
7811 	ptr = buf;
7812 	int tmp = OP_glExtGetRenderbuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7813 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7814 
7815 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
7816 		memcpy(ptr, &maxRenderbuffers, 4); ptr += 4;
7817 	*(unsigned int *)(ptr) = __size_numRenderbuffers; ptr += 4;
7818 
7819 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7820 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7821 
7822 	stream->readback(renderbuffers, __size_renderbuffers);
7823 	if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
7824 	stream->readback(numRenderbuffers, __size_numRenderbuffers);
7825 	if (useChecksum) checksumCalculator->addBuffer(numRenderbuffers, __size_numRenderbuffers);
7826 	if (useChecksum) {
7827 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7828 		stream->readback(checksumBuf.get(), checksumSize);
7829 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7830 			ALOGE("glExtGetRenderbuffersQCOM: GL communication error, please report this issue to b.android.com.\n");
7831 			abort();
7832 		}
7833 	}
7834 }
7835 
glExtGetFramebuffersQCOM_enc(void * self,GLuint * framebuffers,GLint maxFramebuffers,GLint * numFramebuffers)7836 void glExtGetFramebuffersQCOM_enc(void *self , GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers)
7837 {
7838 
7839 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7840 	IOStream *stream = ctx->m_stream;
7841 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7842 	bool useChecksum = checksumCalculator->getVersion() > 0;
7843 
7844 	const unsigned int __size_framebuffers =  (maxFramebuffers * sizeof(GLuint));
7845 	const unsigned int __size_numFramebuffers =  (1 * sizeof(GLint));
7846 	 unsigned char *ptr;
7847 	 unsigned char *buf;
7848 	 const size_t sizeWithoutChecksum = 8 + __size_framebuffers + 4 + __size_numFramebuffers + 2*4;
7849 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7850 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7851 	buf = stream->alloc(totalSize);
7852 	ptr = buf;
7853 	int tmp = OP_glExtGetFramebuffersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7854 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7855 
7856 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
7857 		memcpy(ptr, &maxFramebuffers, 4); ptr += 4;
7858 	*(unsigned int *)(ptr) = __size_numFramebuffers; ptr += 4;
7859 
7860 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7861 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7862 
7863 	stream->readback(framebuffers, __size_framebuffers);
7864 	if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
7865 	stream->readback(numFramebuffers, __size_numFramebuffers);
7866 	if (useChecksum) checksumCalculator->addBuffer(numFramebuffers, __size_numFramebuffers);
7867 	if (useChecksum) {
7868 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7869 		stream->readback(checksumBuf.get(), checksumSize);
7870 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7871 			ALOGE("glExtGetFramebuffersQCOM: GL communication error, please report this issue to b.android.com.\n");
7872 			abort();
7873 		}
7874 	}
7875 }
7876 
glExtGetTexLevelParameterivQCOM_enc(void * self,GLuint texture,GLenum face,GLint level,GLenum pname,GLint * params)7877 void glExtGetTexLevelParameterivQCOM_enc(void *self , GLuint texture, GLenum face, GLint level, GLenum pname, GLint* params)
7878 {
7879 
7880 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7881 	IOStream *stream = ctx->m_stream;
7882 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7883 	bool useChecksum = checksumCalculator->getVersion() > 0;
7884 
7885 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
7886 	 unsigned char *ptr;
7887 	 unsigned char *buf;
7888 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_params + 1*4;
7889 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7890 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7891 	buf = stream->alloc(totalSize);
7892 	ptr = buf;
7893 	int tmp = OP_glExtGetTexLevelParameterivQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7894 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7895 
7896 		memcpy(ptr, &texture, 4); ptr += 4;
7897 		memcpy(ptr, &face, 4); ptr += 4;
7898 		memcpy(ptr, &level, 4); ptr += 4;
7899 		memcpy(ptr, &pname, 4); ptr += 4;
7900 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
7901 
7902 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7903 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7904 
7905 	stream->readback(params, __size_params);
7906 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7907 	if (useChecksum) {
7908 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7909 		stream->readback(checksumBuf.get(), checksumSize);
7910 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7911 			ALOGE("glExtGetTexLevelParameterivQCOM: GL communication error, please report this issue to b.android.com.\n");
7912 			abort();
7913 		}
7914 	}
7915 }
7916 
glExtTexObjectStateOverrideiQCOM_enc(void * self,GLenum target,GLenum pname,GLint param)7917 void glExtTexObjectStateOverrideiQCOM_enc(void *self , GLenum target, GLenum pname, GLint param)
7918 {
7919 
7920 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7921 	IOStream *stream = ctx->m_stream;
7922 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7923 	bool useChecksum = checksumCalculator->getVersion() > 0;
7924 
7925 	 unsigned char *ptr;
7926 	 unsigned char *buf;
7927 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7928 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7929 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7930 	buf = stream->alloc(totalSize);
7931 	ptr = buf;
7932 	int tmp = OP_glExtTexObjectStateOverrideiQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7933 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7934 
7935 		memcpy(ptr, &target, 4); ptr += 4;
7936 		memcpy(ptr, &pname, 4); ptr += 4;
7937 		memcpy(ptr, &param, 4); ptr += 4;
7938 
7939 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7940 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7941 
7942 }
7943 
glExtGetTexSubImageQCOM_enc(void * self,GLenum target,GLint level,GLint xoffset,GLint yoffset,GLint zoffset,GLsizei width,GLsizei height,GLsizei depth,GLenum format,GLenum type,GLvoid * texels)7944 void glExtGetTexSubImageQCOM_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid* texels)
7945 {
7946 
7947 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
7948 	IOStream *stream = ctx->m_stream;
7949 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7950 	bool useChecksum = checksumCalculator->getVersion() > 0;
7951 
7952 	const unsigned int __size_texels =  (depth * glesv1_enc::pixelDataSize(self, width, height, format, type, 0));
7953 	 unsigned char *ptr;
7954 	 unsigned char *buf;
7955 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_texels + 1*4;
7956 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
7957 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7958 	buf = stream->alloc(totalSize);
7959 	ptr = buf;
7960 	int tmp = OP_glExtGetTexSubImageQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
7961 	memcpy(ptr, &totalSize, 4);  ptr += 4;
7962 
7963 		memcpy(ptr, &target, 4); ptr += 4;
7964 		memcpy(ptr, &level, 4); ptr += 4;
7965 		memcpy(ptr, &xoffset, 4); ptr += 4;
7966 		memcpy(ptr, &yoffset, 4); ptr += 4;
7967 		memcpy(ptr, &zoffset, 4); ptr += 4;
7968 		memcpy(ptr, &width, 4); ptr += 4;
7969 		memcpy(ptr, &height, 4); ptr += 4;
7970 		memcpy(ptr, &depth, 4); ptr += 4;
7971 		memcpy(ptr, &format, 4); ptr += 4;
7972 		memcpy(ptr, &type, 4); ptr += 4;
7973 	*(unsigned int *)(ptr) = __size_texels; ptr += 4;
7974 
7975 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7976 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7977 
7978 	stream->readback(texels, __size_texels);
7979 	if (useChecksum) checksumCalculator->addBuffer(texels, __size_texels);
7980 	if (useChecksum) {
7981 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
7982 		stream->readback(checksumBuf.get(), checksumSize);
7983 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
7984 			ALOGE("glExtGetTexSubImageQCOM: GL communication error, please report this issue to b.android.com.\n");
7985 			abort();
7986 		}
7987 	}
7988 }
7989 
glExtGetShadersQCOM_enc(void * self,GLuint * shaders,GLint maxShaders,GLint * numShaders)7990 void glExtGetShadersQCOM_enc(void *self , GLuint* shaders, GLint maxShaders, GLint* numShaders)
7991 {
7992 
7993 	gl_encoder_context_t *ctx = (gl_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_shaders =  (maxShaders * sizeof(GLuint));
7999 	const unsigned int __size_numShaders =  (1 * sizeof(GLint));
8000 	 unsigned char *ptr;
8001 	 unsigned char *buf;
8002 	 const size_t sizeWithoutChecksum = 8 + __size_shaders + 4 + __size_numShaders + 2*4;
8003 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8004 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8005 	buf = stream->alloc(totalSize);
8006 	ptr = buf;
8007 	int tmp = OP_glExtGetShadersQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
8008 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8009 
8010 	*(unsigned int *)(ptr) = __size_shaders; ptr += 4;
8011 		memcpy(ptr, &maxShaders, 4); ptr += 4;
8012 	*(unsigned int *)(ptr) = __size_numShaders; ptr += 4;
8013 
8014 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8015 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8016 
8017 	stream->readback(shaders, __size_shaders);
8018 	if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
8019 	stream->readback(numShaders, __size_numShaders);
8020 	if (useChecksum) checksumCalculator->addBuffer(numShaders, __size_numShaders);
8021 	if (useChecksum) {
8022 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
8023 		stream->readback(checksumBuf.get(), checksumSize);
8024 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
8025 			ALOGE("glExtGetShadersQCOM: GL communication error, please report this issue to b.android.com.\n");
8026 			abort();
8027 		}
8028 	}
8029 }
8030 
glExtGetProgramsQCOM_enc(void * self,GLuint * programs,GLint maxPrograms,GLint * numPrograms)8031 void glExtGetProgramsQCOM_enc(void *self , GLuint* programs, GLint maxPrograms, GLint* numPrograms)
8032 {
8033 
8034 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
8035 	IOStream *stream = ctx->m_stream;
8036 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8037 	bool useChecksum = checksumCalculator->getVersion() > 0;
8038 
8039 	const unsigned int __size_programs =  (maxPrograms * sizeof(GLuint));
8040 	const unsigned int __size_numPrograms =  (1 * sizeof(GLint));
8041 	 unsigned char *ptr;
8042 	 unsigned char *buf;
8043 	 const size_t sizeWithoutChecksum = 8 + __size_programs + 4 + __size_numPrograms + 2*4;
8044 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8045 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8046 	buf = stream->alloc(totalSize);
8047 	ptr = buf;
8048 	int tmp = OP_glExtGetProgramsQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
8049 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8050 
8051 	*(unsigned int *)(ptr) = __size_programs; ptr += 4;
8052 		memcpy(ptr, &maxPrograms, 4); ptr += 4;
8053 	*(unsigned int *)(ptr) = __size_numPrograms; ptr += 4;
8054 
8055 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8056 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8057 
8058 	stream->readback(programs, __size_programs);
8059 	if (useChecksum) checksumCalculator->addBuffer(programs, __size_programs);
8060 	stream->readback(numPrograms, __size_numPrograms);
8061 	if (useChecksum) checksumCalculator->addBuffer(numPrograms, __size_numPrograms);
8062 	if (useChecksum) {
8063 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
8064 		stream->readback(checksumBuf.get(), checksumSize);
8065 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
8066 			ALOGE("glExtGetProgramsQCOM: GL communication error, please report this issue to b.android.com.\n");
8067 			abort();
8068 		}
8069 	}
8070 }
8071 
glExtIsProgramBinaryQCOM_enc(void * self,GLuint program)8072 GLboolean glExtIsProgramBinaryQCOM_enc(void *self , GLuint program)
8073 {
8074 
8075 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
8076 	IOStream *stream = ctx->m_stream;
8077 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8078 	bool useChecksum = checksumCalculator->getVersion() > 0;
8079 
8080 	 unsigned char *ptr;
8081 	 unsigned char *buf;
8082 	 const size_t sizeWithoutChecksum = 8 + 4;
8083 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8084 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8085 	buf = stream->alloc(totalSize);
8086 	ptr = buf;
8087 	int tmp = OP_glExtIsProgramBinaryQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
8088 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8089 
8090 		memcpy(ptr, &program, 4); ptr += 4;
8091 
8092 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8093 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8094 
8095 
8096 	GLboolean retval;
8097 	stream->readback(&retval, 1);
8098 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
8099 	if (useChecksum) {
8100 		std::unique_ptr<unsigned char[]> checksumBuf(new unsigned char[checksumSize]);
8101 		stream->readback(checksumBuf.get(), checksumSize);
8102 		if (!checksumCalculator->validate(checksumBuf.get(), checksumSize)) {
8103 			ALOGE("glExtIsProgramBinaryQCOM: GL communication error, please report this issue to b.android.com.\n");
8104 			abort();
8105 		}
8106 	}
8107 	return retval;
8108 }
8109 
glStartTilingQCOM_enc(void * self,GLuint x,GLuint y,GLuint width,GLuint height,GLbitfield preserveMask)8110 void glStartTilingQCOM_enc(void *self , GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
8111 {
8112 
8113 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
8114 	IOStream *stream = ctx->m_stream;
8115 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8116 	bool useChecksum = checksumCalculator->getVersion() > 0;
8117 
8118 	 unsigned char *ptr;
8119 	 unsigned char *buf;
8120 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 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_glStartTilingQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
8126 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8127 
8128 		memcpy(ptr, &x, 4); ptr += 4;
8129 		memcpy(ptr, &y, 4); ptr += 4;
8130 		memcpy(ptr, &width, 4); ptr += 4;
8131 		memcpy(ptr, &height, 4); ptr += 4;
8132 		memcpy(ptr, &preserveMask, 4); ptr += 4;
8133 
8134 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8135 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8136 
8137 }
8138 
glEndTilingQCOM_enc(void * self,GLbitfield preserveMask)8139 void glEndTilingQCOM_enc(void *self , GLbitfield preserveMask)
8140 {
8141 
8142 	gl_encoder_context_t *ctx = (gl_encoder_context_t *)self;
8143 	IOStream *stream = ctx->m_stream;
8144 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8145 	bool useChecksum = checksumCalculator->getVersion() > 0;
8146 
8147 	 unsigned char *ptr;
8148 	 unsigned char *buf;
8149 	 const size_t sizeWithoutChecksum = 8 + 4;
8150 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
8151 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8152 	buf = stream->alloc(totalSize);
8153 	ptr = buf;
8154 	int tmp = OP_glEndTilingQCOM;memcpy(ptr, &tmp, 4); ptr += 4;
8155 	memcpy(ptr, &totalSize, 4);  ptr += 4;
8156 
8157 		memcpy(ptr, &preserveMask, 4); ptr += 4;
8158 
8159 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8160 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8161 
8162 }
8163 
8164 }  // namespace
8165 
gl_encoder_context_t(IOStream * stream,ChecksumCalculator * checksumCalculator)8166 gl_encoder_context_t::gl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
8167 {
8168 	m_stream = stream;
8169 	m_checksumCalculator = checksumCalculator;
8170 
8171 	this->glAlphaFunc = &glAlphaFunc_enc;
8172 	this->glClearColor = &glClearColor_enc;
8173 	this->glClearDepthf = &glClearDepthf_enc;
8174 	this->glClipPlanef = &glClipPlanef_enc;
8175 	this->glColor4f = &glColor4f_enc;
8176 	this->glDepthRangef = &glDepthRangef_enc;
8177 	this->glFogf = &glFogf_enc;
8178 	this->glFogfv = &glFogfv_enc;
8179 	this->glFrustumf = &glFrustumf_enc;
8180 	this->glGetClipPlanef = &glGetClipPlanef_enc;
8181 	this->glGetFloatv = &glGetFloatv_enc;
8182 	this->glGetLightfv = &glGetLightfv_enc;
8183 	this->glGetMaterialfv = &glGetMaterialfv_enc;
8184 	this->glGetTexEnvfv = &glGetTexEnvfv_enc;
8185 	this->glGetTexParameterfv = &glGetTexParameterfv_enc;
8186 	this->glLightModelf = &glLightModelf_enc;
8187 	this->glLightModelfv = &glLightModelfv_enc;
8188 	this->glLightf = &glLightf_enc;
8189 	this->glLightfv = &glLightfv_enc;
8190 	this->glLineWidth = &glLineWidth_enc;
8191 	this->glLoadMatrixf = &glLoadMatrixf_enc;
8192 	this->glMaterialf = &glMaterialf_enc;
8193 	this->glMaterialfv = &glMaterialfv_enc;
8194 	this->glMultMatrixf = &glMultMatrixf_enc;
8195 	this->glMultiTexCoord4f = &glMultiTexCoord4f_enc;
8196 	this->glNormal3f = &glNormal3f_enc;
8197 	this->glOrthof = &glOrthof_enc;
8198 	this->glPointParameterf = &glPointParameterf_enc;
8199 	this->glPointParameterfv = &glPointParameterfv_enc;
8200 	this->glPointSize = &glPointSize_enc;
8201 	this->glPolygonOffset = &glPolygonOffset_enc;
8202 	this->glRotatef = &glRotatef_enc;
8203 	this->glScalef = &glScalef_enc;
8204 	this->glTexEnvf = &glTexEnvf_enc;
8205 	this->glTexEnvfv = &glTexEnvfv_enc;
8206 	this->glTexParameterf = &glTexParameterf_enc;
8207 	this->glTexParameterfv = &glTexParameterfv_enc;
8208 	this->glTranslatef = &glTranslatef_enc;
8209 	this->glActiveTexture = &glActiveTexture_enc;
8210 	this->glAlphaFuncx = &glAlphaFuncx_enc;
8211 	this->glBindBuffer = &glBindBuffer_enc;
8212 	this->glBindTexture = &glBindTexture_enc;
8213 	this->glBlendFunc = &glBlendFunc_enc;
8214 	this->glBufferData = &glBufferData_enc;
8215 	this->glBufferSubData = &glBufferSubData_enc;
8216 	this->glClear = &glClear_enc;
8217 	this->glClearColorx = &glClearColorx_enc;
8218 	this->glClearDepthx = &glClearDepthx_enc;
8219 	this->glClearStencil = &glClearStencil_enc;
8220 	this->glClientActiveTexture = &glClientActiveTexture_enc;
8221 	this->glColor4ub = &glColor4ub_enc;
8222 	this->glColor4x = &glColor4x_enc;
8223 	this->glColorMask = &glColorMask_enc;
8224 	this->glColorPointer = (glColorPointer_client_proc_t) &enc_unsupported;
8225 	this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
8226 	this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
8227 	this->glCopyTexImage2D = &glCopyTexImage2D_enc;
8228 	this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
8229 	this->glCullFace = &glCullFace_enc;
8230 	this->glDeleteBuffers = &glDeleteBuffers_enc;
8231 	this->glDeleteTextures = &glDeleteTextures_enc;
8232 	this->glDepthFunc = &glDepthFunc_enc;
8233 	this->glDepthMask = &glDepthMask_enc;
8234 	this->glDepthRangex = &glDepthRangex_enc;
8235 	this->glDisable = &glDisable_enc;
8236 	this->glDisableClientState = &glDisableClientState_enc;
8237 	this->glDrawArrays = &glDrawArrays_enc;
8238 	this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
8239 	this->glEnable = &glEnable_enc;
8240 	this->glEnableClientState = &glEnableClientState_enc;
8241 	this->glFinish = &glFinish_enc;
8242 	this->glFlush = &glFlush_enc;
8243 	this->glFogx = &glFogx_enc;
8244 	this->glFogxv = &glFogxv_enc;
8245 	this->glFrontFace = &glFrontFace_enc;
8246 	this->glFrustumx = &glFrustumx_enc;
8247 	this->glGetBooleanv = &glGetBooleanv_enc;
8248 	this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
8249 	this->glClipPlanex = &glClipPlanex_enc;
8250 	this->glGenBuffers = &glGenBuffers_enc;
8251 	this->glGenTextures = &glGenTextures_enc;
8252 	this->glGetError = &glGetError_enc;
8253 	this->glGetFixedv = &glGetFixedv_enc;
8254 	this->glGetIntegerv = &glGetIntegerv_enc;
8255 	this->glGetLightxv = &glGetLightxv_enc;
8256 	this->glGetMaterialxv = &glGetMaterialxv_enc;
8257 	this->glGetPointerv = (glGetPointerv_client_proc_t) &enc_unsupported;
8258 	this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
8259 	this->glGetTexEnviv = &glGetTexEnviv_enc;
8260 	this->glGetTexEnvxv = &glGetTexEnvxv_enc;
8261 	this->glGetTexParameteriv = &glGetTexParameteriv_enc;
8262 	this->glGetTexParameterxv = &glGetTexParameterxv_enc;
8263 	this->glHint = &glHint_enc;
8264 	this->glIsBuffer = &glIsBuffer_enc;
8265 	this->glIsEnabled = &glIsEnabled_enc;
8266 	this->glIsTexture = &glIsTexture_enc;
8267 	this->glLightModelx = &glLightModelx_enc;
8268 	this->glLightModelxv = &glLightModelxv_enc;
8269 	this->glLightx = &glLightx_enc;
8270 	this->glLightxv = &glLightxv_enc;
8271 	this->glLineWidthx = &glLineWidthx_enc;
8272 	this->glLoadIdentity = &glLoadIdentity_enc;
8273 	this->glLoadMatrixx = &glLoadMatrixx_enc;
8274 	this->glLogicOp = &glLogicOp_enc;
8275 	this->glMaterialx = &glMaterialx_enc;
8276 	this->glMaterialxv = &glMaterialxv_enc;
8277 	this->glMatrixMode = &glMatrixMode_enc;
8278 	this->glMultMatrixx = &glMultMatrixx_enc;
8279 	this->glMultiTexCoord4x = &glMultiTexCoord4x_enc;
8280 	this->glNormal3x = &glNormal3x_enc;
8281 	this->glNormalPointer = (glNormalPointer_client_proc_t) &enc_unsupported;
8282 	this->glOrthox = &glOrthox_enc;
8283 	this->glPixelStorei = &glPixelStorei_enc;
8284 	this->glPointParameterx = &glPointParameterx_enc;
8285 	this->glPointParameterxv = &glPointParameterxv_enc;
8286 	this->glPointSizex = &glPointSizex_enc;
8287 	this->glPolygonOffsetx = &glPolygonOffsetx_enc;
8288 	this->glPopMatrix = &glPopMatrix_enc;
8289 	this->glPushMatrix = &glPushMatrix_enc;
8290 	this->glReadPixels = &glReadPixels_enc;
8291 	this->glRotatex = &glRotatex_enc;
8292 	this->glSampleCoverage = &glSampleCoverage_enc;
8293 	this->glSampleCoveragex = &glSampleCoveragex_enc;
8294 	this->glScalex = &glScalex_enc;
8295 	this->glScissor = &glScissor_enc;
8296 	this->glShadeModel = &glShadeModel_enc;
8297 	this->glStencilFunc = &glStencilFunc_enc;
8298 	this->glStencilMask = &glStencilMask_enc;
8299 	this->glStencilOp = &glStencilOp_enc;
8300 	this->glTexCoordPointer = (glTexCoordPointer_client_proc_t) &enc_unsupported;
8301 	this->glTexEnvi = &glTexEnvi_enc;
8302 	this->glTexEnvx = &glTexEnvx_enc;
8303 	this->glTexEnviv = &glTexEnviv_enc;
8304 	this->glTexEnvxv = &glTexEnvxv_enc;
8305 	this->glTexImage2D = &glTexImage2D_enc;
8306 	this->glTexParameteri = &glTexParameteri_enc;
8307 	this->glTexParameterx = &glTexParameterx_enc;
8308 	this->glTexParameteriv = &glTexParameteriv_enc;
8309 	this->glTexParameterxv = &glTexParameterxv_enc;
8310 	this->glTexSubImage2D = &glTexSubImage2D_enc;
8311 	this->glTranslatex = &glTranslatex_enc;
8312 	this->glVertexPointer = (glVertexPointer_client_proc_t) &enc_unsupported;
8313 	this->glViewport = &glViewport_enc;
8314 	this->glPointSizePointerOES = (glPointSizePointerOES_client_proc_t) &enc_unsupported;
8315 	this->glVertexPointerOffset = &glVertexPointerOffset_enc;
8316 	this->glColorPointerOffset = &glColorPointerOffset_enc;
8317 	this->glNormalPointerOffset = &glNormalPointerOffset_enc;
8318 	this->glPointSizePointerOffset = &glPointSizePointerOffset_enc;
8319 	this->glTexCoordPointerOffset = &glTexCoordPointerOffset_enc;
8320 	this->glWeightPointerOffset = &glWeightPointerOffset_enc;
8321 	this->glMatrixIndexPointerOffset = &glMatrixIndexPointerOffset_enc;
8322 	this->glVertexPointerData = &glVertexPointerData_enc;
8323 	this->glColorPointerData = &glColorPointerData_enc;
8324 	this->glNormalPointerData = &glNormalPointerData_enc;
8325 	this->glTexCoordPointerData = &glTexCoordPointerData_enc;
8326 	this->glPointSizePointerData = &glPointSizePointerData_enc;
8327 	this->glWeightPointerData = &glWeightPointerData_enc;
8328 	this->glMatrixIndexPointerData = &glMatrixIndexPointerData_enc;
8329 	this->glDrawElementsOffset = &glDrawElementsOffset_enc;
8330 	this->glDrawElementsData = &glDrawElementsData_enc;
8331 	this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
8332 	this->glFinishRoundTrip = &glFinishRoundTrip_enc;
8333 	this->glBlendEquationSeparateOES = &glBlendEquationSeparateOES_enc;
8334 	this->glBlendFuncSeparateOES = &glBlendFuncSeparateOES_enc;
8335 	this->glBlendEquationOES = &glBlendEquationOES_enc;
8336 	this->glDrawTexsOES = &glDrawTexsOES_enc;
8337 	this->glDrawTexiOES = &glDrawTexiOES_enc;
8338 	this->glDrawTexxOES = &glDrawTexxOES_enc;
8339 	this->glDrawTexsvOES = &glDrawTexsvOES_enc;
8340 	this->glDrawTexivOES = &glDrawTexivOES_enc;
8341 	this->glDrawTexxvOES = &glDrawTexxvOES_enc;
8342 	this->glDrawTexfOES = &glDrawTexfOES_enc;
8343 	this->glDrawTexfvOES = &glDrawTexfvOES_enc;
8344 	this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
8345 	this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
8346 	this->glAlphaFuncxOES = &glAlphaFuncxOES_enc;
8347 	this->glClearColorxOES = &glClearColorxOES_enc;
8348 	this->glClearDepthxOES = &glClearDepthxOES_enc;
8349 	this->glClipPlanexOES = &glClipPlanexOES_enc;
8350 	this->glClipPlanexIMG = &glClipPlanexIMG_enc;
8351 	this->glColor4xOES = &glColor4xOES_enc;
8352 	this->glDepthRangexOES = &glDepthRangexOES_enc;
8353 	this->glFogxOES = &glFogxOES_enc;
8354 	this->glFogxvOES = &glFogxvOES_enc;
8355 	this->glFrustumxOES = &glFrustumxOES_enc;
8356 	this->glGetClipPlanexOES = &glGetClipPlanexOES_enc;
8357 	this->glGetClipPlanex = &glGetClipPlanex_enc;
8358 	this->glGetFixedvOES = &glGetFixedvOES_enc;
8359 	this->glGetLightxvOES = &glGetLightxvOES_enc;
8360 	this->glGetMaterialxvOES = &glGetMaterialxvOES_enc;
8361 	this->glGetTexEnvxvOES = &glGetTexEnvxvOES_enc;
8362 	this->glGetTexParameterxvOES = &glGetTexParameterxvOES_enc;
8363 	this->glLightModelxOES = &glLightModelxOES_enc;
8364 	this->glLightModelxvOES = &glLightModelxvOES_enc;
8365 	this->glLightxOES = &glLightxOES_enc;
8366 	this->glLightxvOES = &glLightxvOES_enc;
8367 	this->glLineWidthxOES = &glLineWidthxOES_enc;
8368 	this->glLoadMatrixxOES = &glLoadMatrixxOES_enc;
8369 	this->glMaterialxOES = &glMaterialxOES_enc;
8370 	this->glMaterialxvOES = &glMaterialxvOES_enc;
8371 	this->glMultMatrixxOES = &glMultMatrixxOES_enc;
8372 	this->glMultiTexCoord4xOES = &glMultiTexCoord4xOES_enc;
8373 	this->glNormal3xOES = &glNormal3xOES_enc;
8374 	this->glOrthoxOES = &glOrthoxOES_enc;
8375 	this->glPointParameterxOES = &glPointParameterxOES_enc;
8376 	this->glPointParameterxvOES = &glPointParameterxvOES_enc;
8377 	this->glPointSizexOES = &glPointSizexOES_enc;
8378 	this->glPolygonOffsetxOES = &glPolygonOffsetxOES_enc;
8379 	this->glRotatexOES = &glRotatexOES_enc;
8380 	this->glSampleCoveragexOES = &glSampleCoveragexOES_enc;
8381 	this->glScalexOES = &glScalexOES_enc;
8382 	this->glTexEnvxOES = &glTexEnvxOES_enc;
8383 	this->glTexEnvxvOES = &glTexEnvxvOES_enc;
8384 	this->glTexParameterxOES = &glTexParameterxOES_enc;
8385 	this->glTexParameterxvOES = &glTexParameterxvOES_enc;
8386 	this->glTranslatexOES = &glTranslatexOES_enc;
8387 	this->glIsRenderbufferOES = &glIsRenderbufferOES_enc;
8388 	this->glBindRenderbufferOES = &glBindRenderbufferOES_enc;
8389 	this->glDeleteRenderbuffersOES = &glDeleteRenderbuffersOES_enc;
8390 	this->glGenRenderbuffersOES = &glGenRenderbuffersOES_enc;
8391 	this->glRenderbufferStorageOES = &glRenderbufferStorageOES_enc;
8392 	this->glGetRenderbufferParameterivOES = &glGetRenderbufferParameterivOES_enc;
8393 	this->glIsFramebufferOES = &glIsFramebufferOES_enc;
8394 	this->glBindFramebufferOES = &glBindFramebufferOES_enc;
8395 	this->glDeleteFramebuffersOES = &glDeleteFramebuffersOES_enc;
8396 	this->glGenFramebuffersOES = &glGenFramebuffersOES_enc;
8397 	this->glCheckFramebufferStatusOES = &glCheckFramebufferStatusOES_enc;
8398 	this->glFramebufferRenderbufferOES = &glFramebufferRenderbufferOES_enc;
8399 	this->glFramebufferTexture2DOES = &glFramebufferTexture2DOES_enc;
8400 	this->glGetFramebufferAttachmentParameterivOES = &glGetFramebufferAttachmentParameterivOES_enc;
8401 	this->glGenerateMipmapOES = &glGenerateMipmapOES_enc;
8402 	this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
8403 	this->glUnmapBufferOES = &glUnmapBufferOES_enc;
8404 	this->glGetBufferPointervOES = (glGetBufferPointervOES_client_proc_t) &enc_unsupported;
8405 	this->glCurrentPaletteMatrixOES = &glCurrentPaletteMatrixOES_enc;
8406 	this->glLoadPaletteFromModelViewMatrixOES = &glLoadPaletteFromModelViewMatrixOES_enc;
8407 	this->glMatrixIndexPointerOES = (glMatrixIndexPointerOES_client_proc_t) &enc_unsupported;
8408 	this->glWeightPointerOES = (glWeightPointerOES_client_proc_t) &enc_unsupported;
8409 	this->glQueryMatrixxOES = &glQueryMatrixxOES_enc;
8410 	this->glDepthRangefOES = &glDepthRangefOES_enc;
8411 	this->glFrustumfOES = &glFrustumfOES_enc;
8412 	this->glOrthofOES = &glOrthofOES_enc;
8413 	this->glClipPlanefOES = &glClipPlanefOES_enc;
8414 	this->glClipPlanefIMG = &glClipPlanefIMG_enc;
8415 	this->glGetClipPlanefOES = &glGetClipPlanefOES_enc;
8416 	this->glClearDepthfOES = &glClearDepthfOES_enc;
8417 	this->glTexGenfOES = &glTexGenfOES_enc;
8418 	this->glTexGenfvOES = &glTexGenfvOES_enc;
8419 	this->glTexGeniOES = &glTexGeniOES_enc;
8420 	this->glTexGenivOES = &glTexGenivOES_enc;
8421 	this->glTexGenxOES = &glTexGenxOES_enc;
8422 	this->glTexGenxvOES = &glTexGenxvOES_enc;
8423 	this->glGetTexGenfvOES = &glGetTexGenfvOES_enc;
8424 	this->glGetTexGenivOES = &glGetTexGenivOES_enc;
8425 	this->glGetTexGenxvOES = &glGetTexGenxvOES_enc;
8426 	this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
8427 	this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
8428 	this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
8429 	this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
8430 	this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
8431 	this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
8432 	this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
8433 	this->glMultiDrawArraysSUN = (glMultiDrawArraysSUN_client_proc_t) &enc_unsupported;
8434 	this->glMultiDrawElementsSUN = (glMultiDrawElementsSUN_client_proc_t) &enc_unsupported;
8435 	this->glRenderbufferStorageMultisampleIMG = &glRenderbufferStorageMultisampleIMG_enc;
8436 	this->glFramebufferTexture2DMultisampleIMG = &glFramebufferTexture2DMultisampleIMG_enc;
8437 	this->glDeleteFencesNV = &glDeleteFencesNV_enc;
8438 	this->glGenFencesNV = &glGenFencesNV_enc;
8439 	this->glIsFenceNV = &glIsFenceNV_enc;
8440 	this->glTestFenceNV = &glTestFenceNV_enc;
8441 	this->glGetFenceivNV = &glGetFenceivNV_enc;
8442 	this->glFinishFenceNV = &glFinishFenceNV_enc;
8443 	this->glSetFenceNV = &glSetFenceNV_enc;
8444 	this->glGetDriverControlsQCOM = &glGetDriverControlsQCOM_enc;
8445 	this->glGetDriverControlStringQCOM = &glGetDriverControlStringQCOM_enc;
8446 	this->glEnableDriverControlQCOM = &glEnableDriverControlQCOM_enc;
8447 	this->glDisableDriverControlQCOM = &glDisableDriverControlQCOM_enc;
8448 	this->glExtGetTexturesQCOM = &glExtGetTexturesQCOM_enc;
8449 	this->glExtGetBuffersQCOM = &glExtGetBuffersQCOM_enc;
8450 	this->glExtGetRenderbuffersQCOM = &glExtGetRenderbuffersQCOM_enc;
8451 	this->glExtGetFramebuffersQCOM = &glExtGetFramebuffersQCOM_enc;
8452 	this->glExtGetTexLevelParameterivQCOM = &glExtGetTexLevelParameterivQCOM_enc;
8453 	this->glExtTexObjectStateOverrideiQCOM = &glExtTexObjectStateOverrideiQCOM_enc;
8454 	this->glExtGetTexSubImageQCOM = &glExtGetTexSubImageQCOM_enc;
8455 	this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
8456 	this->glExtGetShadersQCOM = &glExtGetShadersQCOM_enc;
8457 	this->glExtGetProgramsQCOM = &glExtGetProgramsQCOM_enc;
8458 	this->glExtIsProgramBinaryQCOM = &glExtIsProgramBinaryQCOM_enc;
8459 	this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
8460 	this->glStartTilingQCOM = &glStartTilingQCOM_enc;
8461 	this->glEndTilingQCOM = &glEndTilingQCOM_enc;
8462 }
8463 
8464