Home | History | Annotate | Download | only in GLESv2_enc
      1 // Generated Code - DO NOT EDIT !!
      2 // generated by 'emugen'
      3 
      4 
      5 #include <string.h>
      6 #include "gl2_opcodes.h"
      7 
      8 #include "gl2_enc.h"
      9 
     10 
     11 #include <stdio.h>
     12 
     13 namespace {
     14 
     15 void enc_unsupported()
     16 {
     17 	ALOGE("Function is unsupported\n");
     18 }
     19 
     20 void glActiveTexture_enc(void *self , GLenum texture)
     21 {
     22 
     23 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
     24 	IOStream *stream = ctx->m_stream;
     25 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
     26 	bool useChecksum = checksumCalculator->getVersion() > 0;
     27 
     28 	 unsigned char *ptr;
     29 	 unsigned char *buf;
     30 	 const size_t sizeWithoutChecksum = 8 + 4;
     31 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
     32 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
     33 	buf = stream->alloc(totalSize);
     34 	ptr = buf;
     35 	int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
     36 	memcpy(ptr, &totalSize, 4);  ptr += 4;
     37 
     38 		memcpy(ptr, &texture, 4); ptr += 4;
     39 
     40 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
     41 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
     42 
     43 }
     44 
     45 void glAttachShader_enc(void *self , GLuint program, GLuint shader)
     46 {
     47 
     48 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
     49 	IOStream *stream = ctx->m_stream;
     50 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
     51 	bool useChecksum = checksumCalculator->getVersion() > 0;
     52 
     53 	 unsigned char *ptr;
     54 	 unsigned char *buf;
     55 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
     56 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
     57 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
     58 	buf = stream->alloc(totalSize);
     59 	ptr = buf;
     60 	int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
     61 	memcpy(ptr, &totalSize, 4);  ptr += 4;
     62 
     63 		memcpy(ptr, &program, 4); ptr += 4;
     64 		memcpy(ptr, &shader, 4); ptr += 4;
     65 
     66 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
     67 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
     68 
     69 }
     70 
     71 void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
     72 {
     73 
     74 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
     75 	IOStream *stream = ctx->m_stream;
     76 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
     77 	bool useChecksum = checksumCalculator->getVersion() > 0;
     78 
     79 	const unsigned int __size_name =  (strlen(name) + 1);
     80 	 unsigned char *ptr;
     81 	 unsigned char *buf;
     82 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
     83 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
     84 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
     85 	buf = stream->alloc(totalSize);
     86 	ptr = buf;
     87 	int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
     88 	memcpy(ptr, &totalSize, 4);  ptr += 4;
     89 
     90 		memcpy(ptr, &program, 4); ptr += 4;
     91 		memcpy(ptr, &index, 4); ptr += 4;
     92 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
     93 	memcpy(ptr, name, __size_name);ptr += __size_name;
     94 
     95 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
     96 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
     97 
     98 }
     99 
    100 void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
    101 {
    102 
    103 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    104 	IOStream *stream = ctx->m_stream;
    105 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    106 	bool useChecksum = checksumCalculator->getVersion() > 0;
    107 
    108 	 unsigned char *ptr;
    109 	 unsigned char *buf;
    110 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    111 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    112 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    113 	buf = stream->alloc(totalSize);
    114 	ptr = buf;
    115 	int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
    116 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    117 
    118 		memcpy(ptr, &target, 4); ptr += 4;
    119 		memcpy(ptr, &buffer, 4); ptr += 4;
    120 
    121 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    122 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    123 
    124 }
    125 
    126 void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
    127 {
    128 
    129 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    130 	IOStream *stream = ctx->m_stream;
    131 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    132 	bool useChecksum = checksumCalculator->getVersion() > 0;
    133 
    134 	 unsigned char *ptr;
    135 	 unsigned char *buf;
    136 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    137 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    138 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    139 	buf = stream->alloc(totalSize);
    140 	ptr = buf;
    141 	int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
    142 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    143 
    144 		memcpy(ptr, &target, 4); ptr += 4;
    145 		memcpy(ptr, &framebuffer, 4); ptr += 4;
    146 
    147 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    148 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    149 
    150 }
    151 
    152 void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
    153 {
    154 
    155 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    156 	IOStream *stream = ctx->m_stream;
    157 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    158 	bool useChecksum = checksumCalculator->getVersion() > 0;
    159 
    160 	 unsigned char *ptr;
    161 	 unsigned char *buf;
    162 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    163 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    164 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    165 	buf = stream->alloc(totalSize);
    166 	ptr = buf;
    167 	int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
    168 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    169 
    170 		memcpy(ptr, &target, 4); ptr += 4;
    171 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
    172 
    173 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    174 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    175 
    176 }
    177 
    178 void glBindTexture_enc(void *self , GLenum target, GLuint texture)
    179 {
    180 
    181 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    182 	IOStream *stream = ctx->m_stream;
    183 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    184 	bool useChecksum = checksumCalculator->getVersion() > 0;
    185 
    186 	 unsigned char *ptr;
    187 	 unsigned char *buf;
    188 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    189 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    190 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    191 	buf = stream->alloc(totalSize);
    192 	ptr = buf;
    193 	int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
    194 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    195 
    196 		memcpy(ptr, &target, 4); ptr += 4;
    197 		memcpy(ptr, &texture, 4); ptr += 4;
    198 
    199 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    200 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    201 
    202 }
    203 
    204 void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    205 {
    206 
    207 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    208 	IOStream *stream = ctx->m_stream;
    209 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    210 	bool useChecksum = checksumCalculator->getVersion() > 0;
    211 
    212 	 unsigned char *ptr;
    213 	 unsigned char *buf;
    214 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
    215 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    216 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    217 	buf = stream->alloc(totalSize);
    218 	ptr = buf;
    219 	int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
    220 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    221 
    222 		memcpy(ptr, &red, 4); ptr += 4;
    223 		memcpy(ptr, &green, 4); ptr += 4;
    224 		memcpy(ptr, &blue, 4); ptr += 4;
    225 		memcpy(ptr, &alpha, 4); ptr += 4;
    226 
    227 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    228 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    229 
    230 }
    231 
    232 void glBlendEquation_enc(void *self , GLenum mode)
    233 {
    234 
    235 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    236 	IOStream *stream = ctx->m_stream;
    237 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    238 	bool useChecksum = checksumCalculator->getVersion() > 0;
    239 
    240 	 unsigned char *ptr;
    241 	 unsigned char *buf;
    242 	 const size_t sizeWithoutChecksum = 8 + 4;
    243 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    244 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    245 	buf = stream->alloc(totalSize);
    246 	ptr = buf;
    247 	int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
    248 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    249 
    250 		memcpy(ptr, &mode, 4); ptr += 4;
    251 
    252 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    253 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    254 
    255 }
    256 
    257 void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
    258 {
    259 
    260 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    261 	IOStream *stream = ctx->m_stream;
    262 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    263 	bool useChecksum = checksumCalculator->getVersion() > 0;
    264 
    265 	 unsigned char *ptr;
    266 	 unsigned char *buf;
    267 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    268 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    269 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    270 	buf = stream->alloc(totalSize);
    271 	ptr = buf;
    272 	int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
    273 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    274 
    275 		memcpy(ptr, &modeRGB, 4); ptr += 4;
    276 		memcpy(ptr, &modeAlpha, 4); ptr += 4;
    277 
    278 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    279 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    280 
    281 }
    282 
    283 void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
    284 {
    285 
    286 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    287 	IOStream *stream = ctx->m_stream;
    288 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    289 	bool useChecksum = checksumCalculator->getVersion() > 0;
    290 
    291 	 unsigned char *ptr;
    292 	 unsigned char *buf;
    293 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
    294 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    295 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    296 	buf = stream->alloc(totalSize);
    297 	ptr = buf;
    298 	int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
    299 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    300 
    301 		memcpy(ptr, &sfactor, 4); ptr += 4;
    302 		memcpy(ptr, &dfactor, 4); ptr += 4;
    303 
    304 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    305 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    306 
    307 }
    308 
    309 void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
    310 {
    311 
    312 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    313 	IOStream *stream = ctx->m_stream;
    314 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    315 	bool useChecksum = checksumCalculator->getVersion() > 0;
    316 
    317 	 unsigned char *ptr;
    318 	 unsigned char *buf;
    319 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
    320 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    321 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    322 	buf = stream->alloc(totalSize);
    323 	ptr = buf;
    324 	int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
    325 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    326 
    327 		memcpy(ptr, &srcRGB, 4); ptr += 4;
    328 		memcpy(ptr, &dstRGB, 4); ptr += 4;
    329 		memcpy(ptr, &srcAlpha, 4); ptr += 4;
    330 		memcpy(ptr, &dstAlpha, 4); ptr += 4;
    331 
    332 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    333 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    334 
    335 }
    336 
    337 void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
    338 {
    339 
    340 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    341 	IOStream *stream = ctx->m_stream;
    342 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    343 	bool useChecksum = checksumCalculator->getVersion() > 0;
    344 
    345 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
    346 	 unsigned char *ptr;
    347 	 unsigned char *buf;
    348 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
    349 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    350 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    351 	buf = stream->alloc(8 + 4 + 4);
    352 	ptr = buf;
    353 	int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
    354 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    355 
    356 		memcpy(ptr, &target, 4); ptr += 4;
    357 		memcpy(ptr, &size, 4); ptr += 4;
    358 
    359 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    360 	stream->flush();
    361 	stream->writeFully(&__size_data,4);
    362 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
    363 	if (data != NULL) {
    364 		stream->writeFully(data, __size_data);
    365 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
    366 	}
    367 	buf = stream->alloc(4);
    368 	ptr = buf;
    369 		memcpy(ptr, &usage, 4); ptr += 4;
    370 
    371 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    372 	buf = stream->alloc(checksumSize);
    373 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
    374 
    375 }
    376 
    377 void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
    378 {
    379 
    380 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    381 	IOStream *stream = ctx->m_stream;
    382 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    383 	bool useChecksum = checksumCalculator->getVersion() > 0;
    384 
    385 	const unsigned int __size_data = ((data != NULL) ?  size : 0);
    386 	 unsigned char *ptr;
    387 	 unsigned char *buf;
    388 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
    389 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    390 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    391 	buf = stream->alloc(8 + 4 + 4 + 4);
    392 	ptr = buf;
    393 	int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
    394 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    395 
    396 		memcpy(ptr, &target, 4); ptr += 4;
    397 		memcpy(ptr, &offset, 4); ptr += 4;
    398 		memcpy(ptr, &size, 4); ptr += 4;
    399 
    400 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    401 	stream->flush();
    402 	stream->writeFully(&__size_data,4);
    403 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
    404 	if (data != NULL) {
    405 		stream->writeFully(data, __size_data);
    406 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
    407 	}
    408 	buf = stream->alloc(checksumSize);
    409 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
    410 
    411 }
    412 
    413 GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
    414 {
    415 
    416 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    417 	IOStream *stream = ctx->m_stream;
    418 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    419 	bool useChecksum = checksumCalculator->getVersion() > 0;
    420 
    421 	 unsigned char *ptr;
    422 	 unsigned char *buf;
    423 	 const size_t sizeWithoutChecksum = 8 + 4;
    424 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    425 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    426 	buf = stream->alloc(totalSize);
    427 	ptr = buf;
    428 	int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
    429 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    430 
    431 		memcpy(ptr, &target, 4); ptr += 4;
    432 
    433 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    434 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    435 
    436 
    437 	GLenum retval;
    438 	stream->readback(&retval, 4);
    439 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
    440 	if (useChecksum) {
    441 		unsigned char *checksumBufPtr = NULL;
    442 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
    443 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
    444 		stream->readback(checksumBufPtr, checksumSize);
    445 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
    446 			ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
    447 			abort();
    448 		}
    449 	}
    450 	return retval;
    451 }
    452 
    453 void glClear_enc(void *self , GLbitfield mask)
    454 {
    455 
    456 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    457 	IOStream *stream = ctx->m_stream;
    458 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    459 	bool useChecksum = checksumCalculator->getVersion() > 0;
    460 
    461 	 unsigned char *ptr;
    462 	 unsigned char *buf;
    463 	 const size_t sizeWithoutChecksum = 8 + 4;
    464 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    465 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    466 	buf = stream->alloc(totalSize);
    467 	ptr = buf;
    468 	int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
    469 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    470 
    471 		memcpy(ptr, &mask, 4); ptr += 4;
    472 
    473 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    474 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    475 
    476 }
    477 
    478 void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    479 {
    480 
    481 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    482 	IOStream *stream = ctx->m_stream;
    483 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    484 	bool useChecksum = checksumCalculator->getVersion() > 0;
    485 
    486 	 unsigned char *ptr;
    487 	 unsigned char *buf;
    488 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
    489 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    490 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    491 	buf = stream->alloc(totalSize);
    492 	ptr = buf;
    493 	int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
    494 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    495 
    496 		memcpy(ptr, &red, 4); ptr += 4;
    497 		memcpy(ptr, &green, 4); ptr += 4;
    498 		memcpy(ptr, &blue, 4); ptr += 4;
    499 		memcpy(ptr, &alpha, 4); ptr += 4;
    500 
    501 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    502 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    503 
    504 }
    505 
    506 void glClearDepthf_enc(void *self , GLclampf depth)
    507 {
    508 
    509 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    510 	IOStream *stream = ctx->m_stream;
    511 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    512 	bool useChecksum = checksumCalculator->getVersion() > 0;
    513 
    514 	 unsigned char *ptr;
    515 	 unsigned char *buf;
    516 	 const size_t sizeWithoutChecksum = 8 + 4;
    517 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    518 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    519 	buf = stream->alloc(totalSize);
    520 	ptr = buf;
    521 	int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
    522 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    523 
    524 		memcpy(ptr, &depth, 4); ptr += 4;
    525 
    526 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    527 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    528 
    529 }
    530 
    531 void glClearStencil_enc(void *self , GLint s)
    532 {
    533 
    534 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    535 	IOStream *stream = ctx->m_stream;
    536 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    537 	bool useChecksum = checksumCalculator->getVersion() > 0;
    538 
    539 	 unsigned char *ptr;
    540 	 unsigned char *buf;
    541 	 const size_t sizeWithoutChecksum = 8 + 4;
    542 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    543 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    544 	buf = stream->alloc(totalSize);
    545 	ptr = buf;
    546 	int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
    547 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    548 
    549 		memcpy(ptr, &s, 4); ptr += 4;
    550 
    551 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    552 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    553 
    554 }
    555 
    556 void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
    557 {
    558 
    559 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    560 	IOStream *stream = ctx->m_stream;
    561 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    562 	bool useChecksum = checksumCalculator->getVersion() > 0;
    563 
    564 	 unsigned char *ptr;
    565 	 unsigned char *buf;
    566 	 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
    567 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    568 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    569 	buf = stream->alloc(totalSize);
    570 	ptr = buf;
    571 	int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
    572 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    573 
    574 		memcpy(ptr, &red, 1); ptr += 1;
    575 		memcpy(ptr, &green, 1); ptr += 1;
    576 		memcpy(ptr, &blue, 1); ptr += 1;
    577 		memcpy(ptr, &alpha, 1); ptr += 1;
    578 
    579 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    580 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    581 
    582 }
    583 
    584 void glCompileShader_enc(void *self , GLuint shader)
    585 {
    586 
    587 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    588 	IOStream *stream = ctx->m_stream;
    589 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    590 	bool useChecksum = checksumCalculator->getVersion() > 0;
    591 
    592 	 unsigned char *ptr;
    593 	 unsigned char *buf;
    594 	 const size_t sizeWithoutChecksum = 8 + 4;
    595 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    596 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    597 	buf = stream->alloc(totalSize);
    598 	ptr = buf;
    599 	int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
    600 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    601 
    602 		memcpy(ptr, &shader, 4); ptr += 4;
    603 
    604 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    605 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    606 
    607 }
    608 
    609 void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
    610 {
    611 
    612 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    613 	IOStream *stream = ctx->m_stream;
    614 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    615 	bool useChecksum = checksumCalculator->getVersion() > 0;
    616 
    617 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
    618 	 unsigned char *ptr;
    619 	 unsigned char *buf;
    620 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
    621 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    622 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    623 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
    624 	ptr = buf;
    625 	int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
    626 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    627 
    628 		memcpy(ptr, &target, 4); ptr += 4;
    629 		memcpy(ptr, &level, 4); ptr += 4;
    630 		memcpy(ptr, &internalformat, 4); ptr += 4;
    631 		memcpy(ptr, &width, 4); ptr += 4;
    632 		memcpy(ptr, &height, 4); ptr += 4;
    633 		memcpy(ptr, &border, 4); ptr += 4;
    634 		memcpy(ptr, &imageSize, 4); ptr += 4;
    635 
    636 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    637 	stream->flush();
    638 	stream->writeFully(&__size_data,4);
    639 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
    640 	if (data != NULL) {
    641 		stream->writeFully(data, __size_data);
    642 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
    643 	}
    644 	buf = stream->alloc(checksumSize);
    645 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
    646 
    647 }
    648 
    649 void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
    650 {
    651 
    652 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    653 	IOStream *stream = ctx->m_stream;
    654 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    655 	bool useChecksum = checksumCalculator->getVersion() > 0;
    656 
    657 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
    658 	 unsigned char *ptr;
    659 	 unsigned char *buf;
    660 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
    661 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    662 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    663 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
    664 	ptr = buf;
    665 	int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
    666 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    667 
    668 		memcpy(ptr, &target, 4); ptr += 4;
    669 		memcpy(ptr, &level, 4); ptr += 4;
    670 		memcpy(ptr, &xoffset, 4); ptr += 4;
    671 		memcpy(ptr, &yoffset, 4); ptr += 4;
    672 		memcpy(ptr, &width, 4); ptr += 4;
    673 		memcpy(ptr, &height, 4); ptr += 4;
    674 		memcpy(ptr, &format, 4); ptr += 4;
    675 		memcpy(ptr, &imageSize, 4); ptr += 4;
    676 
    677 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    678 	stream->flush();
    679 	stream->writeFully(&__size_data,4);
    680 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
    681 	if (data != NULL) {
    682 		stream->writeFully(data, __size_data);
    683 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
    684 	}
    685 	buf = stream->alloc(checksumSize);
    686 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
    687 
    688 }
    689 
    690 void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
    691 {
    692 
    693 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    694 	IOStream *stream = ctx->m_stream;
    695 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    696 	bool useChecksum = checksumCalculator->getVersion() > 0;
    697 
    698 	 unsigned char *ptr;
    699 	 unsigned char *buf;
    700 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
    701 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    702 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    703 	buf = stream->alloc(totalSize);
    704 	ptr = buf;
    705 	int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
    706 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    707 
    708 		memcpy(ptr, &target, 4); ptr += 4;
    709 		memcpy(ptr, &level, 4); ptr += 4;
    710 		memcpy(ptr, &internalformat, 4); ptr += 4;
    711 		memcpy(ptr, &x, 4); ptr += 4;
    712 		memcpy(ptr, &y, 4); ptr += 4;
    713 		memcpy(ptr, &width, 4); ptr += 4;
    714 		memcpy(ptr, &height, 4); ptr += 4;
    715 		memcpy(ptr, &border, 4); ptr += 4;
    716 
    717 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    718 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    719 
    720 }
    721 
    722 void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
    723 {
    724 
    725 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    726 	IOStream *stream = ctx->m_stream;
    727 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    728 	bool useChecksum = checksumCalculator->getVersion() > 0;
    729 
    730 	 unsigned char *ptr;
    731 	 unsigned char *buf;
    732 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
    733 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    734 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    735 	buf = stream->alloc(totalSize);
    736 	ptr = buf;
    737 	int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
    738 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    739 
    740 		memcpy(ptr, &target, 4); ptr += 4;
    741 		memcpy(ptr, &level, 4); ptr += 4;
    742 		memcpy(ptr, &xoffset, 4); ptr += 4;
    743 		memcpy(ptr, &yoffset, 4); ptr += 4;
    744 		memcpy(ptr, &x, 4); ptr += 4;
    745 		memcpy(ptr, &y, 4); ptr += 4;
    746 		memcpy(ptr, &width, 4); ptr += 4;
    747 		memcpy(ptr, &height, 4); ptr += 4;
    748 
    749 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    750 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    751 
    752 }
    753 
    754 GLuint glCreateProgram_enc(void *self )
    755 {
    756 
    757 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    758 	IOStream *stream = ctx->m_stream;
    759 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    760 	bool useChecksum = checksumCalculator->getVersion() > 0;
    761 
    762 	 unsigned char *ptr;
    763 	 unsigned char *buf;
    764 	 const size_t sizeWithoutChecksum = 8;
    765 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    766 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    767 	buf = stream->alloc(totalSize);
    768 	ptr = buf;
    769 	int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
    770 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    771 
    772 
    773 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    774 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    775 
    776 
    777 	GLuint retval;
    778 	stream->readback(&retval, 4);
    779 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
    780 	if (useChecksum) {
    781 		unsigned char *checksumBufPtr = NULL;
    782 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
    783 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
    784 		stream->readback(checksumBufPtr, checksumSize);
    785 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
    786 			ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
    787 			abort();
    788 		}
    789 	}
    790 	return retval;
    791 }
    792 
    793 GLuint glCreateShader_enc(void *self , GLenum type)
    794 {
    795 
    796 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    797 	IOStream *stream = ctx->m_stream;
    798 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    799 	bool useChecksum = checksumCalculator->getVersion() > 0;
    800 
    801 	 unsigned char *ptr;
    802 	 unsigned char *buf;
    803 	 const size_t sizeWithoutChecksum = 8 + 4;
    804 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    805 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    806 	buf = stream->alloc(totalSize);
    807 	ptr = buf;
    808 	int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
    809 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    810 
    811 		memcpy(ptr, &type, 4); ptr += 4;
    812 
    813 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    814 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    815 
    816 
    817 	GLuint retval;
    818 	stream->readback(&retval, 4);
    819 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
    820 	if (useChecksum) {
    821 		unsigned char *checksumBufPtr = NULL;
    822 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
    823 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
    824 		stream->readback(checksumBufPtr, checksumSize);
    825 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
    826 			ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
    827 			abort();
    828 		}
    829 	}
    830 	return retval;
    831 }
    832 
    833 void glCullFace_enc(void *self , GLenum mode)
    834 {
    835 
    836 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    837 	IOStream *stream = ctx->m_stream;
    838 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    839 	bool useChecksum = checksumCalculator->getVersion() > 0;
    840 
    841 	 unsigned char *ptr;
    842 	 unsigned char *buf;
    843 	 const size_t sizeWithoutChecksum = 8 + 4;
    844 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    845 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    846 	buf = stream->alloc(totalSize);
    847 	ptr = buf;
    848 	int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
    849 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    850 
    851 		memcpy(ptr, &mode, 4); ptr += 4;
    852 
    853 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    854 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    855 
    856 }
    857 
    858 void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
    859 {
    860 
    861 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    862 	IOStream *stream = ctx->m_stream;
    863 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    864 	bool useChecksum = checksumCalculator->getVersion() > 0;
    865 
    866 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
    867 	 unsigned char *ptr;
    868 	 unsigned char *buf;
    869 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
    870 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    871 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    872 	buf = stream->alloc(totalSize);
    873 	ptr = buf;
    874 	int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
    875 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    876 
    877 		memcpy(ptr, &n, 4); ptr += 4;
    878 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
    879 	memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
    880 
    881 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    882 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    883 
    884 }
    885 
    886 void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
    887 {
    888 
    889 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    890 	IOStream *stream = ctx->m_stream;
    891 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    892 	bool useChecksum = checksumCalculator->getVersion() > 0;
    893 
    894 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
    895 	 unsigned char *ptr;
    896 	 unsigned char *buf;
    897 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
    898 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    899 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    900 	buf = stream->alloc(totalSize);
    901 	ptr = buf;
    902 	int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
    903 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    904 
    905 		memcpy(ptr, &n, 4); ptr += 4;
    906 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
    907 	memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
    908 
    909 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    910 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    911 
    912 }
    913 
    914 void glDeleteProgram_enc(void *self , GLuint program)
    915 {
    916 
    917 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    918 	IOStream *stream = ctx->m_stream;
    919 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    920 	bool useChecksum = checksumCalculator->getVersion() > 0;
    921 
    922 	 unsigned char *ptr;
    923 	 unsigned char *buf;
    924 	 const size_t sizeWithoutChecksum = 8 + 4;
    925 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    926 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    927 	buf = stream->alloc(totalSize);
    928 	ptr = buf;
    929 	int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
    930 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    931 
    932 		memcpy(ptr, &program, 4); ptr += 4;
    933 
    934 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    935 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    936 
    937 }
    938 
    939 void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
    940 {
    941 
    942 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    943 	IOStream *stream = ctx->m_stream;
    944 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    945 	bool useChecksum = checksumCalculator->getVersion() > 0;
    946 
    947 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
    948 	 unsigned char *ptr;
    949 	 unsigned char *buf;
    950 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
    951 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    952 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    953 	buf = stream->alloc(totalSize);
    954 	ptr = buf;
    955 	int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
    956 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    957 
    958 		memcpy(ptr, &n, 4); ptr += 4;
    959 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
    960 	memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
    961 
    962 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    963 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    964 
    965 }
    966 
    967 void glDeleteShader_enc(void *self , GLuint shader)
    968 {
    969 
    970 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    971 	IOStream *stream = ctx->m_stream;
    972 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    973 	bool useChecksum = checksumCalculator->getVersion() > 0;
    974 
    975 	 unsigned char *ptr;
    976 	 unsigned char *buf;
    977 	 const size_t sizeWithoutChecksum = 8 + 4;
    978 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
    979 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
    980 	buf = stream->alloc(totalSize);
    981 	ptr = buf;
    982 	int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
    983 	memcpy(ptr, &totalSize, 4);  ptr += 4;
    984 
    985 		memcpy(ptr, &shader, 4); ptr += 4;
    986 
    987 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
    988 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
    989 
    990 }
    991 
    992 void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
    993 {
    994 
    995 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
    996 	IOStream *stream = ctx->m_stream;
    997 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
    998 	bool useChecksum = checksumCalculator->getVersion() > 0;
    999 
   1000 	const unsigned int __size_textures =  (n * sizeof(GLuint));
   1001 	 unsigned char *ptr;
   1002 	 unsigned char *buf;
   1003 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
   1004 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1005 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1006 	buf = stream->alloc(totalSize);
   1007 	ptr = buf;
   1008 	int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
   1009 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1010 
   1011 		memcpy(ptr, &n, 4); ptr += 4;
   1012 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
   1013 	memcpy(ptr, textures, __size_textures);ptr += __size_textures;
   1014 
   1015 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1016 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1017 
   1018 }
   1019 
   1020 void glDepthFunc_enc(void *self , GLenum func)
   1021 {
   1022 
   1023 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1024 	IOStream *stream = ctx->m_stream;
   1025 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1026 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1027 
   1028 	 unsigned char *ptr;
   1029 	 unsigned char *buf;
   1030 	 const size_t sizeWithoutChecksum = 8 + 4;
   1031 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1032 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1033 	buf = stream->alloc(totalSize);
   1034 	ptr = buf;
   1035 	int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
   1036 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1037 
   1038 		memcpy(ptr, &func, 4); ptr += 4;
   1039 
   1040 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1041 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1042 
   1043 }
   1044 
   1045 void glDepthMask_enc(void *self , GLboolean flag)
   1046 {
   1047 
   1048 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1049 	IOStream *stream = ctx->m_stream;
   1050 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1051 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1052 
   1053 	 unsigned char *ptr;
   1054 	 unsigned char *buf;
   1055 	 const size_t sizeWithoutChecksum = 8 + 1;
   1056 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1057 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1058 	buf = stream->alloc(totalSize);
   1059 	ptr = buf;
   1060 	int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
   1061 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1062 
   1063 		memcpy(ptr, &flag, 1); ptr += 1;
   1064 
   1065 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1066 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1067 
   1068 }
   1069 
   1070 void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
   1071 {
   1072 
   1073 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1074 	IOStream *stream = ctx->m_stream;
   1075 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1076 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1077 
   1078 	 unsigned char *ptr;
   1079 	 unsigned char *buf;
   1080 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   1081 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1082 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1083 	buf = stream->alloc(totalSize);
   1084 	ptr = buf;
   1085 	int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
   1086 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1087 
   1088 		memcpy(ptr, &zNear, 4); ptr += 4;
   1089 		memcpy(ptr, &zFar, 4); ptr += 4;
   1090 
   1091 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1092 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1093 
   1094 }
   1095 
   1096 void glDetachShader_enc(void *self , GLuint program, GLuint shader)
   1097 {
   1098 
   1099 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1100 	IOStream *stream = ctx->m_stream;
   1101 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1102 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1103 
   1104 	 unsigned char *ptr;
   1105 	 unsigned char *buf;
   1106 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   1107 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1108 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1109 	buf = stream->alloc(totalSize);
   1110 	ptr = buf;
   1111 	int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
   1112 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1113 
   1114 		memcpy(ptr, &program, 4); ptr += 4;
   1115 		memcpy(ptr, &shader, 4); ptr += 4;
   1116 
   1117 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1118 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1119 
   1120 }
   1121 
   1122 void glDisable_enc(void *self , GLenum cap)
   1123 {
   1124 
   1125 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1126 	IOStream *stream = ctx->m_stream;
   1127 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1128 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1129 
   1130 	 unsigned char *ptr;
   1131 	 unsigned char *buf;
   1132 	 const size_t sizeWithoutChecksum = 8 + 4;
   1133 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1134 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1135 	buf = stream->alloc(totalSize);
   1136 	ptr = buf;
   1137 	int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
   1138 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1139 
   1140 		memcpy(ptr, &cap, 4); ptr += 4;
   1141 
   1142 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1143 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1144 
   1145 }
   1146 
   1147 void glDisableVertexAttribArray_enc(void *self , GLuint index)
   1148 {
   1149 
   1150 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1151 	IOStream *stream = ctx->m_stream;
   1152 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1153 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1154 
   1155 	 unsigned char *ptr;
   1156 	 unsigned char *buf;
   1157 	 const size_t sizeWithoutChecksum = 8 + 4;
   1158 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1159 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1160 	buf = stream->alloc(totalSize);
   1161 	ptr = buf;
   1162 	int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
   1163 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1164 
   1165 		memcpy(ptr, &index, 4); ptr += 4;
   1166 
   1167 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1168 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1169 
   1170 }
   1171 
   1172 void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
   1173 {
   1174 
   1175 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1176 	IOStream *stream = ctx->m_stream;
   1177 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1178 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1179 
   1180 	 unsigned char *ptr;
   1181 	 unsigned char *buf;
   1182 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   1183 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1184 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1185 	buf = stream->alloc(totalSize);
   1186 	ptr = buf;
   1187 	int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
   1188 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1189 
   1190 		memcpy(ptr, &mode, 4); ptr += 4;
   1191 		memcpy(ptr, &first, 4); ptr += 4;
   1192 		memcpy(ptr, &count, 4); ptr += 4;
   1193 
   1194 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1195 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1196 
   1197 }
   1198 
   1199 void glEnable_enc(void *self , GLenum cap)
   1200 {
   1201 
   1202 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1203 	IOStream *stream = ctx->m_stream;
   1204 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1205 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1206 
   1207 	 unsigned char *ptr;
   1208 	 unsigned char *buf;
   1209 	 const size_t sizeWithoutChecksum = 8 + 4;
   1210 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1211 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1212 	buf = stream->alloc(totalSize);
   1213 	ptr = buf;
   1214 	int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
   1215 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1216 
   1217 		memcpy(ptr, &cap, 4); ptr += 4;
   1218 
   1219 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1220 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1221 
   1222 }
   1223 
   1224 void glEnableVertexAttribArray_enc(void *self , GLuint index)
   1225 {
   1226 
   1227 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1228 	IOStream *stream = ctx->m_stream;
   1229 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1230 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1231 
   1232 	 unsigned char *ptr;
   1233 	 unsigned char *buf;
   1234 	 const size_t sizeWithoutChecksum = 8 + 4;
   1235 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1236 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1237 	buf = stream->alloc(totalSize);
   1238 	ptr = buf;
   1239 	int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
   1240 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1241 
   1242 		memcpy(ptr, &index, 4); ptr += 4;
   1243 
   1244 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1245 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1246 
   1247 }
   1248 
   1249 void glFinish_enc(void *self )
   1250 {
   1251 
   1252 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1253 	IOStream *stream = ctx->m_stream;
   1254 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1255 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1256 
   1257 	 unsigned char *ptr;
   1258 	 unsigned char *buf;
   1259 	 const size_t sizeWithoutChecksum = 8;
   1260 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1261 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1262 	buf = stream->alloc(totalSize);
   1263 	ptr = buf;
   1264 	int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
   1265 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1266 
   1267 
   1268 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1269 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1270 
   1271 }
   1272 
   1273 void glFlush_enc(void *self )
   1274 {
   1275 
   1276 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1277 	IOStream *stream = ctx->m_stream;
   1278 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1279 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1280 
   1281 	 unsigned char *ptr;
   1282 	 unsigned char *buf;
   1283 	 const size_t sizeWithoutChecksum = 8;
   1284 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1285 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1286 	buf = stream->alloc(totalSize);
   1287 	ptr = buf;
   1288 	int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
   1289 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1290 
   1291 
   1292 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1293 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1294 
   1295 }
   1296 
   1297 void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
   1298 {
   1299 
   1300 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1301 	IOStream *stream = ctx->m_stream;
   1302 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1303 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1304 
   1305 	 unsigned char *ptr;
   1306 	 unsigned char *buf;
   1307 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   1308 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1309 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1310 	buf = stream->alloc(totalSize);
   1311 	ptr = buf;
   1312 	int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   1313 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1314 
   1315 		memcpy(ptr, &target, 4); ptr += 4;
   1316 		memcpy(ptr, &attachment, 4); ptr += 4;
   1317 		memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
   1318 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
   1319 
   1320 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1321 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1322 
   1323 }
   1324 
   1325 void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
   1326 {
   1327 
   1328 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1329 	IOStream *stream = ctx->m_stream;
   1330 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1331 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1332 
   1333 	 unsigned char *ptr;
   1334 	 unsigned char *buf;
   1335 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   1336 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1337 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1338 	buf = stream->alloc(totalSize);
   1339 	ptr = buf;
   1340 	int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
   1341 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1342 
   1343 		memcpy(ptr, &target, 4); ptr += 4;
   1344 		memcpy(ptr, &attachment, 4); ptr += 4;
   1345 		memcpy(ptr, &textarget, 4); ptr += 4;
   1346 		memcpy(ptr, &texture, 4); ptr += 4;
   1347 		memcpy(ptr, &level, 4); ptr += 4;
   1348 
   1349 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1350 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1351 
   1352 }
   1353 
   1354 void glFrontFace_enc(void *self , GLenum mode)
   1355 {
   1356 
   1357 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1358 	IOStream *stream = ctx->m_stream;
   1359 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1360 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1361 
   1362 	 unsigned char *ptr;
   1363 	 unsigned char *buf;
   1364 	 const size_t sizeWithoutChecksum = 8 + 4;
   1365 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1366 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1367 	buf = stream->alloc(totalSize);
   1368 	ptr = buf;
   1369 	int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
   1370 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1371 
   1372 		memcpy(ptr, &mode, 4); ptr += 4;
   1373 
   1374 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1375 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1376 
   1377 }
   1378 
   1379 void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
   1380 {
   1381 
   1382 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1383 	IOStream *stream = ctx->m_stream;
   1384 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1385 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1386 
   1387 	const unsigned int __size_buffers =  (n * sizeof(GLuint));
   1388 	 unsigned char *ptr;
   1389 	 unsigned char *buf;
   1390 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1391 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1392 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1393 	buf = stream->alloc(totalSize);
   1394 	ptr = buf;
   1395 	int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
   1396 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1397 
   1398 		memcpy(ptr, &n, 4); ptr += 4;
   1399 	*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
   1400 
   1401 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1402 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1403 
   1404 	stream->readback(buffers, __size_buffers);
   1405 	if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
   1406 	if (useChecksum) {
   1407 		unsigned char *checksumBufPtr = NULL;
   1408 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1409 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1410 		stream->readback(checksumBufPtr, checksumSize);
   1411 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1412 			ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
   1413 			abort();
   1414 		}
   1415 	}
   1416 }
   1417 
   1418 void glGenerateMipmap_enc(void *self , GLenum target)
   1419 {
   1420 
   1421 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1422 	IOStream *stream = ctx->m_stream;
   1423 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1424 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1425 
   1426 	 unsigned char *ptr;
   1427 	 unsigned char *buf;
   1428 	 const size_t sizeWithoutChecksum = 8 + 4;
   1429 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1430 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1431 	buf = stream->alloc(totalSize);
   1432 	ptr = buf;
   1433 	int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
   1434 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1435 
   1436 		memcpy(ptr, &target, 4); ptr += 4;
   1437 
   1438 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1439 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1440 
   1441 }
   1442 
   1443 void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
   1444 {
   1445 
   1446 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1447 	IOStream *stream = ctx->m_stream;
   1448 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1449 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1450 
   1451 	const unsigned int __size_framebuffers =  (n * sizeof(GLuint));
   1452 	 unsigned char *ptr;
   1453 	 unsigned char *buf;
   1454 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1455 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1456 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1457 	buf = stream->alloc(totalSize);
   1458 	ptr = buf;
   1459 	int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
   1460 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1461 
   1462 		memcpy(ptr, &n, 4); ptr += 4;
   1463 	*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
   1464 
   1465 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1466 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1467 
   1468 	stream->readback(framebuffers, __size_framebuffers);
   1469 	if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
   1470 	if (useChecksum) {
   1471 		unsigned char *checksumBufPtr = NULL;
   1472 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1473 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1474 		stream->readback(checksumBufPtr, checksumSize);
   1475 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1476 			ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
   1477 			abort();
   1478 		}
   1479 	}
   1480 }
   1481 
   1482 void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
   1483 {
   1484 
   1485 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1486 	IOStream *stream = ctx->m_stream;
   1487 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1488 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1489 
   1490 	const unsigned int __size_renderbuffers =  (n * sizeof(GLuint));
   1491 	 unsigned char *ptr;
   1492 	 unsigned char *buf;
   1493 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1494 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1495 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1496 	buf = stream->alloc(totalSize);
   1497 	ptr = buf;
   1498 	int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
   1499 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1500 
   1501 		memcpy(ptr, &n, 4); ptr += 4;
   1502 	*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
   1503 
   1504 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1505 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1506 
   1507 	stream->readback(renderbuffers, __size_renderbuffers);
   1508 	if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
   1509 	if (useChecksum) {
   1510 		unsigned char *checksumBufPtr = NULL;
   1511 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1512 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1513 		stream->readback(checksumBufPtr, checksumSize);
   1514 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1515 			ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
   1516 			abort();
   1517 		}
   1518 	}
   1519 }
   1520 
   1521 void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
   1522 {
   1523 
   1524 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1525 	IOStream *stream = ctx->m_stream;
   1526 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1527 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1528 
   1529 	const unsigned int __size_textures =  (n * sizeof(GLuint));
   1530 	 unsigned char *ptr;
   1531 	 unsigned char *buf;
   1532 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1533 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1534 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1535 	buf = stream->alloc(totalSize);
   1536 	ptr = buf;
   1537 	int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
   1538 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1539 
   1540 		memcpy(ptr, &n, 4); ptr += 4;
   1541 	*(unsigned int *)(ptr) = __size_textures; ptr += 4;
   1542 
   1543 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1544 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1545 
   1546 	stream->readback(textures, __size_textures);
   1547 	if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
   1548 	if (useChecksum) {
   1549 		unsigned char *checksumBufPtr = NULL;
   1550 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1551 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1552 		stream->readback(checksumBufPtr, checksumSize);
   1553 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1554 			ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
   1555 			abort();
   1556 		}
   1557 	}
   1558 }
   1559 
   1560 void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
   1561 {
   1562 
   1563 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1564 	IOStream *stream = ctx->m_stream;
   1565 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1566 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1567 
   1568 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   1569 	const unsigned int __size_size = ((size != NULL) ?  (sizeof(GLint)) : 0);
   1570 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
   1571 	const unsigned int __size_name = ((name != NULL) ?  bufsize : 0);
   1572 	 unsigned char *ptr;
   1573 	 unsigned char *buf;
   1574 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
   1575 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1576 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1577 	buf = stream->alloc(totalSize);
   1578 	ptr = buf;
   1579 	int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
   1580 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1581 
   1582 		memcpy(ptr, &program, 4); ptr += 4;
   1583 		memcpy(ptr, &index, 4); ptr += 4;
   1584 		memcpy(ptr, &bufsize, 4); ptr += 4;
   1585 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   1586 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
   1587 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
   1588 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   1589 
   1590 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1591 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1592 
   1593 	if (length != NULL) {
   1594 		stream->readback(length, __size_length);
   1595 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   1596 	}
   1597 	if (size != NULL) {
   1598 		stream->readback(size, __size_size);
   1599 		if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
   1600 	}
   1601 	if (type != NULL) {
   1602 		stream->readback(type, __size_type);
   1603 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
   1604 	}
   1605 	if (name != NULL) {
   1606 		stream->readback(name, __size_name);
   1607 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
   1608 	}
   1609 	if (useChecksum) {
   1610 		unsigned char *checksumBufPtr = NULL;
   1611 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1612 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1613 		stream->readback(checksumBufPtr, checksumSize);
   1614 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1615 			ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
   1616 			abort();
   1617 		}
   1618 	}
   1619 }
   1620 
   1621 void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
   1622 {
   1623 
   1624 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1625 	IOStream *stream = ctx->m_stream;
   1626 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1627 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1628 
   1629 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   1630 	const unsigned int __size_size = ((size != NULL) ?  (sizeof(GLint)) : 0);
   1631 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
   1632 	const unsigned int __size_name = ((name != NULL) ?  bufsize : 0);
   1633 	 unsigned char *ptr;
   1634 	 unsigned char *buf;
   1635 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
   1636 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1637 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1638 	buf = stream->alloc(totalSize);
   1639 	ptr = buf;
   1640 	int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
   1641 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1642 
   1643 		memcpy(ptr, &program, 4); ptr += 4;
   1644 		memcpy(ptr, &index, 4); ptr += 4;
   1645 		memcpy(ptr, &bufsize, 4); ptr += 4;
   1646 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   1647 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
   1648 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
   1649 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   1650 
   1651 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1652 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1653 
   1654 	if (length != NULL) {
   1655 		stream->readback(length, __size_length);
   1656 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   1657 	}
   1658 	if (size != NULL) {
   1659 		stream->readback(size, __size_size);
   1660 		if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
   1661 	}
   1662 	if (type != NULL) {
   1663 		stream->readback(type, __size_type);
   1664 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
   1665 	}
   1666 	if (name != NULL) {
   1667 		stream->readback(name, __size_name);
   1668 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
   1669 	}
   1670 	if (useChecksum) {
   1671 		unsigned char *checksumBufPtr = NULL;
   1672 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1673 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1674 		stream->readback(checksumBufPtr, checksumSize);
   1675 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1676 			ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
   1677 			abort();
   1678 		}
   1679 	}
   1680 }
   1681 
   1682 void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
   1683 {
   1684 
   1685 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1686 	IOStream *stream = ctx->m_stream;
   1687 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1688 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1689 
   1690 	const unsigned int __size_count = ((count != NULL) ?  (sizeof(GLsizei)) : 0);
   1691 	const unsigned int __size_shaders =  (maxcount*sizeof(GLuint));
   1692 	 unsigned char *ptr;
   1693 	 unsigned char *buf;
   1694 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   1695 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1696 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1697 	buf = stream->alloc(totalSize);
   1698 	ptr = buf;
   1699 	int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
   1700 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1701 
   1702 		memcpy(ptr, &program, 4); ptr += 4;
   1703 		memcpy(ptr, &maxcount, 4); ptr += 4;
   1704 	*(unsigned int *)(ptr) = __size_count; ptr += 4;
   1705 	*(unsigned int *)(ptr) = __size_shaders; ptr += 4;
   1706 
   1707 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1708 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1709 
   1710 	if (count != NULL) {
   1711 		stream->readback(count, __size_count);
   1712 		if (useChecksum) checksumCalculator->addBuffer(count, __size_count);
   1713 	}
   1714 	stream->readback(shaders, __size_shaders);
   1715 	if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
   1716 	if (useChecksum) {
   1717 		unsigned char *checksumBufPtr = NULL;
   1718 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1719 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1720 		stream->readback(checksumBufPtr, checksumSize);
   1721 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1722 			ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
   1723 			abort();
   1724 		}
   1725 	}
   1726 }
   1727 
   1728 int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
   1729 {
   1730 
   1731 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1732 	IOStream *stream = ctx->m_stream;
   1733 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1734 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1735 
   1736 	const unsigned int __size_name =  (strlen(name) + 1);
   1737 	 unsigned char *ptr;
   1738 	 unsigned char *buf;
   1739 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
   1740 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1741 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1742 	buf = stream->alloc(totalSize);
   1743 	ptr = buf;
   1744 	int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
   1745 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1746 
   1747 		memcpy(ptr, &program, 4); ptr += 4;
   1748 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   1749 	memcpy(ptr, name, __size_name);ptr += __size_name;
   1750 
   1751 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1752 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1753 
   1754 
   1755 	int retval;
   1756 	stream->readback(&retval, 4);
   1757 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   1758 	if (useChecksum) {
   1759 		unsigned char *checksumBufPtr = NULL;
   1760 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1761 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1762 		stream->readback(checksumBufPtr, checksumSize);
   1763 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1764 			ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
   1765 			abort();
   1766 		}
   1767 	}
   1768 	return retval;
   1769 }
   1770 
   1771 void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
   1772 {
   1773 
   1774 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1775 	IOStream *stream = ctx->m_stream;
   1776 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1777 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1778 
   1779 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLboolean));
   1780 	 unsigned char *ptr;
   1781 	 unsigned char *buf;
   1782 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1783 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1784 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1785 	buf = stream->alloc(totalSize);
   1786 	ptr = buf;
   1787 	int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
   1788 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1789 
   1790 		memcpy(ptr, &pname, 4); ptr += 4;
   1791 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   1792 
   1793 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1794 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1795 
   1796 	stream->readback(params, __size_params);
   1797 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   1798 	if (useChecksum) {
   1799 		unsigned char *checksumBufPtr = NULL;
   1800 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1801 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1802 		stream->readback(checksumBufPtr, checksumSize);
   1803 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1804 			ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
   1805 			abort();
   1806 		}
   1807 	}
   1808 }
   1809 
   1810 void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
   1811 {
   1812 
   1813 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1814 	IOStream *stream = ctx->m_stream;
   1815 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1816 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1817 
   1818 	const unsigned int __size_params =  (sizeof(GLint));
   1819 	 unsigned char *ptr;
   1820 	 unsigned char *buf;
   1821 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   1822 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1823 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1824 	buf = stream->alloc(totalSize);
   1825 	ptr = buf;
   1826 	int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   1827 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1828 
   1829 		memcpy(ptr, &target, 4); ptr += 4;
   1830 		memcpy(ptr, &pname, 4); ptr += 4;
   1831 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   1832 
   1833 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1834 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1835 
   1836 	stream->readback(params, __size_params);
   1837 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   1838 	if (useChecksum) {
   1839 		unsigned char *checksumBufPtr = NULL;
   1840 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1841 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1842 		stream->readback(checksumBufPtr, checksumSize);
   1843 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1844 			ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
   1845 			abort();
   1846 		}
   1847 	}
   1848 }
   1849 
   1850 GLenum glGetError_enc(void *self )
   1851 {
   1852 
   1853 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1854 	IOStream *stream = ctx->m_stream;
   1855 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1856 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1857 
   1858 	 unsigned char *ptr;
   1859 	 unsigned char *buf;
   1860 	 const size_t sizeWithoutChecksum = 8;
   1861 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1862 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1863 	buf = stream->alloc(totalSize);
   1864 	ptr = buf;
   1865 	int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
   1866 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1867 
   1868 
   1869 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1870 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1871 
   1872 
   1873 	GLenum retval;
   1874 	stream->readback(&retval, 4);
   1875 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   1876 	if (useChecksum) {
   1877 		unsigned char *checksumBufPtr = NULL;
   1878 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1879 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1880 		stream->readback(checksumBufPtr, checksumSize);
   1881 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1882 			ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
   1883 			abort();
   1884 		}
   1885 	}
   1886 	return retval;
   1887 }
   1888 
   1889 void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
   1890 {
   1891 
   1892 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1893 	IOStream *stream = ctx->m_stream;
   1894 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1895 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1896 
   1897 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   1898 	 unsigned char *ptr;
   1899 	 unsigned char *buf;
   1900 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1901 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1902 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1903 	buf = stream->alloc(totalSize);
   1904 	ptr = buf;
   1905 	int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
   1906 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1907 
   1908 		memcpy(ptr, &pname, 4); ptr += 4;
   1909 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   1910 
   1911 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1912 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1913 
   1914 	stream->readback(params, __size_params);
   1915 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   1916 	if (useChecksum) {
   1917 		unsigned char *checksumBufPtr = NULL;
   1918 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1919 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1920 		stream->readback(checksumBufPtr, checksumSize);
   1921 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1922 			ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
   1923 			abort();
   1924 		}
   1925 	}
   1926 }
   1927 
   1928 void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
   1929 {
   1930 
   1931 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1932 	IOStream *stream = ctx->m_stream;
   1933 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1934 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1935 
   1936 	const unsigned int __size_params =  (sizeof(GLint));
   1937 	 unsigned char *ptr;
   1938 	 unsigned char *buf;
   1939 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
   1940 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1941 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1942 	buf = stream->alloc(totalSize);
   1943 	ptr = buf;
   1944 	int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   1945 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1946 
   1947 		memcpy(ptr, &target, 4); ptr += 4;
   1948 		memcpy(ptr, &attachment, 4); ptr += 4;
   1949 		memcpy(ptr, &pname, 4); ptr += 4;
   1950 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   1951 
   1952 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1953 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1954 
   1955 	stream->readback(params, __size_params);
   1956 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   1957 	if (useChecksum) {
   1958 		unsigned char *checksumBufPtr = NULL;
   1959 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1960 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   1961 		stream->readback(checksumBufPtr, checksumSize);
   1962 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   1963 			ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
   1964 			abort();
   1965 		}
   1966 	}
   1967 }
   1968 
   1969 void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
   1970 {
   1971 
   1972 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   1973 	IOStream *stream = ctx->m_stream;
   1974 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   1975 	bool useChecksum = checksumCalculator->getVersion() > 0;
   1976 
   1977 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   1978 	 unsigned char *ptr;
   1979 	 unsigned char *buf;
   1980 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   1981 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   1982 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   1983 	buf = stream->alloc(totalSize);
   1984 	ptr = buf;
   1985 	int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
   1986 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   1987 
   1988 		memcpy(ptr, &pname, 4); ptr += 4;
   1989 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   1990 
   1991 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   1992 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   1993 
   1994 	stream->readback(params, __size_params);
   1995 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   1996 	if (useChecksum) {
   1997 		unsigned char *checksumBufPtr = NULL;
   1998 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   1999 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2000 		stream->readback(checksumBufPtr, checksumSize);
   2001 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2002 			ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
   2003 			abort();
   2004 		}
   2005 	}
   2006 }
   2007 
   2008 void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
   2009 {
   2010 
   2011 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2012 	IOStream *stream = ctx->m_stream;
   2013 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2014 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2015 
   2016 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   2017 	 unsigned char *ptr;
   2018 	 unsigned char *buf;
   2019 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2020 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2021 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2022 	buf = stream->alloc(totalSize);
   2023 	ptr = buf;
   2024 	int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
   2025 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2026 
   2027 		memcpy(ptr, &program, 4); ptr += 4;
   2028 		memcpy(ptr, &pname, 4); ptr += 4;
   2029 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2030 
   2031 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2032 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2033 
   2034 	stream->readback(params, __size_params);
   2035 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2036 	if (useChecksum) {
   2037 		unsigned char *checksumBufPtr = NULL;
   2038 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2039 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2040 		stream->readback(checksumBufPtr, checksumSize);
   2041 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2042 			ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
   2043 			abort();
   2044 		}
   2045 	}
   2046 }
   2047 
   2048 void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
   2049 {
   2050 
   2051 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2052 	IOStream *stream = ctx->m_stream;
   2053 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2054 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2055 
   2056 	const unsigned int __size_length = ((length != NULL) ?  sizeof(GLsizei) : 0);
   2057 	const unsigned int __size_infolog =  bufsize;
   2058 	 unsigned char *ptr;
   2059 	 unsigned char *buf;
   2060 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   2061 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2062 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2063 	buf = stream->alloc(totalSize);
   2064 	ptr = buf;
   2065 	int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
   2066 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2067 
   2068 		memcpy(ptr, &program, 4); ptr += 4;
   2069 		memcpy(ptr, &bufsize, 4); ptr += 4;
   2070 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   2071 	*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
   2072 
   2073 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2074 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2075 
   2076 	if (length != NULL) {
   2077 		stream->readback(length, __size_length);
   2078 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   2079 	}
   2080 	stream->readback(infolog, __size_infolog);
   2081 	if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
   2082 	if (useChecksum) {
   2083 		unsigned char *checksumBufPtr = NULL;
   2084 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2085 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2086 		stream->readback(checksumBufPtr, checksumSize);
   2087 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2088 			ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
   2089 			abort();
   2090 		}
   2091 	}
   2092 }
   2093 
   2094 void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
   2095 {
   2096 
   2097 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2098 	IOStream *stream = ctx->m_stream;
   2099 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2100 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2101 
   2102 	const unsigned int __size_params =  sizeof(GLint);
   2103 	 unsigned char *ptr;
   2104 	 unsigned char *buf;
   2105 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2106 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2107 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2108 	buf = stream->alloc(totalSize);
   2109 	ptr = buf;
   2110 	int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   2111 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2112 
   2113 		memcpy(ptr, &target, 4); ptr += 4;
   2114 		memcpy(ptr, &pname, 4); ptr += 4;
   2115 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2116 
   2117 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2118 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2119 
   2120 	stream->readback(params, __size_params);
   2121 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2122 	if (useChecksum) {
   2123 		unsigned char *checksumBufPtr = NULL;
   2124 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2125 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2126 		stream->readback(checksumBufPtr, checksumSize);
   2127 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2128 			ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
   2129 			abort();
   2130 		}
   2131 	}
   2132 }
   2133 
   2134 void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
   2135 {
   2136 
   2137 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2138 	IOStream *stream = ctx->m_stream;
   2139 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2140 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2141 
   2142 	const unsigned int __size_params =  sizeof(GLint);
   2143 	 unsigned char *ptr;
   2144 	 unsigned char *buf;
   2145 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2146 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2147 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2148 	buf = stream->alloc(totalSize);
   2149 	ptr = buf;
   2150 	int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
   2151 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2152 
   2153 		memcpy(ptr, &shader, 4); ptr += 4;
   2154 		memcpy(ptr, &pname, 4); ptr += 4;
   2155 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2156 
   2157 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2158 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2159 
   2160 	stream->readback(params, __size_params);
   2161 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2162 	if (useChecksum) {
   2163 		unsigned char *checksumBufPtr = NULL;
   2164 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2165 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2166 		stream->readback(checksumBufPtr, checksumSize);
   2167 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2168 			ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n");
   2169 			abort();
   2170 		}
   2171 	}
   2172 }
   2173 
   2174 void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
   2175 {
   2176 
   2177 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2178 	IOStream *stream = ctx->m_stream;
   2179 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2180 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2181 
   2182 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   2183 	const unsigned int __size_infolog =  bufsize;
   2184 	 unsigned char *ptr;
   2185 	 unsigned char *buf;
   2186 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   2187 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2188 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2189 	buf = stream->alloc(totalSize);
   2190 	ptr = buf;
   2191 	int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
   2192 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2193 
   2194 		memcpy(ptr, &shader, 4); ptr += 4;
   2195 		memcpy(ptr, &bufsize, 4); ptr += 4;
   2196 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   2197 	*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
   2198 
   2199 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2200 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2201 
   2202 	if (length != NULL) {
   2203 		stream->readback(length, __size_length);
   2204 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   2205 	}
   2206 	stream->readback(infolog, __size_infolog);
   2207 	if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
   2208 	if (useChecksum) {
   2209 		unsigned char *checksumBufPtr = NULL;
   2210 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2211 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2212 		stream->readback(checksumBufPtr, checksumSize);
   2213 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2214 			ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n");
   2215 			abort();
   2216 		}
   2217 	}
   2218 }
   2219 
   2220 void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
   2221 {
   2222 
   2223 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2224 	IOStream *stream = ctx->m_stream;
   2225 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2226 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2227 
   2228 	const unsigned int __size_range =  (2 * sizeof(GLint));
   2229 	const unsigned int __size_precision =  (sizeof(GLint));
   2230 	 unsigned char *ptr;
   2231 	 unsigned char *buf;
   2232 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   2233 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2234 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2235 	buf = stream->alloc(totalSize);
   2236 	ptr = buf;
   2237 	int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
   2238 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2239 
   2240 		memcpy(ptr, &shadertype, 4); ptr += 4;
   2241 		memcpy(ptr, &precisiontype, 4); ptr += 4;
   2242 	*(unsigned int *)(ptr) = __size_range; ptr += 4;
   2243 	*(unsigned int *)(ptr) = __size_precision; ptr += 4;
   2244 
   2245 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2246 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2247 
   2248 	stream->readback(range, __size_range);
   2249 	if (useChecksum) checksumCalculator->addBuffer(range, __size_range);
   2250 	stream->readback(precision, __size_precision);
   2251 	if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision);
   2252 	if (useChecksum) {
   2253 		unsigned char *checksumBufPtr = NULL;
   2254 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2255 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2256 		stream->readback(checksumBufPtr, checksumSize);
   2257 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2258 			ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n");
   2259 			abort();
   2260 		}
   2261 	}
   2262 }
   2263 
   2264 void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
   2265 {
   2266 
   2267 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2268 	IOStream *stream = ctx->m_stream;
   2269 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2270 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2271 
   2272 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   2273 	const unsigned int __size_source =  bufsize;
   2274 	 unsigned char *ptr;
   2275 	 unsigned char *buf;
   2276 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   2277 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2278 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2279 	buf = stream->alloc(totalSize);
   2280 	ptr = buf;
   2281 	int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
   2282 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2283 
   2284 		memcpy(ptr, &shader, 4); ptr += 4;
   2285 		memcpy(ptr, &bufsize, 4); ptr += 4;
   2286 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   2287 	*(unsigned int *)(ptr) = __size_source; ptr += 4;
   2288 
   2289 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2290 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2291 
   2292 	if (length != NULL) {
   2293 		stream->readback(length, __size_length);
   2294 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   2295 	}
   2296 	stream->readback(source, __size_source);
   2297 	if (useChecksum) checksumCalculator->addBuffer(source, __size_source);
   2298 	if (useChecksum) {
   2299 		unsigned char *checksumBufPtr = NULL;
   2300 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2301 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2302 		stream->readback(checksumBufPtr, checksumSize);
   2303 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2304 			ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n");
   2305 			abort();
   2306 		}
   2307 	}
   2308 }
   2309 
   2310 void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
   2311 {
   2312 
   2313 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2314 	IOStream *stream = ctx->m_stream;
   2315 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2316 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2317 
   2318 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   2319 	 unsigned char *ptr;
   2320 	 unsigned char *buf;
   2321 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2322 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2323 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2324 	buf = stream->alloc(totalSize);
   2325 	ptr = buf;
   2326 	int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
   2327 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2328 
   2329 		memcpy(ptr, &target, 4); ptr += 4;
   2330 		memcpy(ptr, &pname, 4); ptr += 4;
   2331 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2332 
   2333 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2334 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2335 
   2336 	stream->readback(params, __size_params);
   2337 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2338 	if (useChecksum) {
   2339 		unsigned char *checksumBufPtr = NULL;
   2340 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2341 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2342 		stream->readback(checksumBufPtr, checksumSize);
   2343 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2344 			ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
   2345 			abort();
   2346 		}
   2347 	}
   2348 }
   2349 
   2350 void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
   2351 {
   2352 
   2353 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2354 	IOStream *stream = ctx->m_stream;
   2355 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2356 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2357 
   2358 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   2359 	 unsigned char *ptr;
   2360 	 unsigned char *buf;
   2361 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2362 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2363 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2364 	buf = stream->alloc(totalSize);
   2365 	ptr = buf;
   2366 	int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   2367 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2368 
   2369 		memcpy(ptr, &target, 4); ptr += 4;
   2370 		memcpy(ptr, &pname, 4); ptr += 4;
   2371 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2372 
   2373 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2374 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2375 
   2376 	stream->readback(params, __size_params);
   2377 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2378 	if (useChecksum) {
   2379 		unsigned char *checksumBufPtr = NULL;
   2380 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2381 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2382 		stream->readback(checksumBufPtr, checksumSize);
   2383 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2384 			ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
   2385 			abort();
   2386 		}
   2387 	}
   2388 }
   2389 
   2390 void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params)
   2391 {
   2392 
   2393 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2394 	IOStream *stream = ctx->m_stream;
   2395 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2396 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2397 
   2398 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
   2399 	 unsigned char *ptr;
   2400 	 unsigned char *buf;
   2401 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2402 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2403 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2404 	buf = stream->alloc(totalSize);
   2405 	ptr = buf;
   2406 	int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
   2407 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2408 
   2409 		memcpy(ptr, &program, 4); ptr += 4;
   2410 		memcpy(ptr, &location, 4); ptr += 4;
   2411 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2412 
   2413 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2414 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2415 
   2416 	stream->readback(params, __size_params);
   2417 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2418 	if (useChecksum) {
   2419 		unsigned char *checksumBufPtr = NULL;
   2420 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2421 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2422 		stream->readback(checksumBufPtr, checksumSize);
   2423 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2424 			ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n");
   2425 			abort();
   2426 		}
   2427 	}
   2428 }
   2429 
   2430 void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params)
   2431 {
   2432 
   2433 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2434 	IOStream *stream = ctx->m_stream;
   2435 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2436 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2437 
   2438 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
   2439 	 unsigned char *ptr;
   2440 	 unsigned char *buf;
   2441 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2442 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2443 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2444 	buf = stream->alloc(totalSize);
   2445 	ptr = buf;
   2446 	int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
   2447 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2448 
   2449 		memcpy(ptr, &program, 4); ptr += 4;
   2450 		memcpy(ptr, &location, 4); ptr += 4;
   2451 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2452 
   2453 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2454 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2455 
   2456 	stream->readback(params, __size_params);
   2457 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2458 	if (useChecksum) {
   2459 		unsigned char *checksumBufPtr = NULL;
   2460 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2461 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2462 		stream->readback(checksumBufPtr, checksumSize);
   2463 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2464 			ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n");
   2465 			abort();
   2466 		}
   2467 	}
   2468 }
   2469 
   2470 int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name)
   2471 {
   2472 
   2473 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2474 	IOStream *stream = ctx->m_stream;
   2475 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2476 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2477 
   2478 	const unsigned int __size_name =  (strlen(name) + 1);
   2479 	 unsigned char *ptr;
   2480 	 unsigned char *buf;
   2481 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
   2482 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2483 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2484 	buf = stream->alloc(totalSize);
   2485 	ptr = buf;
   2486 	int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
   2487 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2488 
   2489 		memcpy(ptr, &program, 4); ptr += 4;
   2490 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   2491 	memcpy(ptr, name, __size_name);ptr += __size_name;
   2492 
   2493 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2494 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2495 
   2496 
   2497 	int retval;
   2498 	stream->readback(&retval, 4);
   2499 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   2500 	if (useChecksum) {
   2501 		unsigned char *checksumBufPtr = NULL;
   2502 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2503 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2504 		stream->readback(checksumBufPtr, checksumSize);
   2505 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2506 			ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n");
   2507 			abort();
   2508 		}
   2509 	}
   2510 	return retval;
   2511 }
   2512 
   2513 void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params)
   2514 {
   2515 
   2516 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2517 	IOStream *stream = ctx->m_stream;
   2518 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2519 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2520 
   2521 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   2522 	 unsigned char *ptr;
   2523 	 unsigned char *buf;
   2524 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2525 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2526 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2527 	buf = stream->alloc(totalSize);
   2528 	ptr = buf;
   2529 	int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
   2530 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2531 
   2532 		memcpy(ptr, &index, 4); ptr += 4;
   2533 		memcpy(ptr, &pname, 4); ptr += 4;
   2534 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2535 
   2536 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2537 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2538 
   2539 	stream->readback(params, __size_params);
   2540 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2541 	if (useChecksum) {
   2542 		unsigned char *checksumBufPtr = NULL;
   2543 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2544 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2545 		stream->readback(checksumBufPtr, checksumSize);
   2546 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2547 			ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n");
   2548 			abort();
   2549 		}
   2550 	}
   2551 }
   2552 
   2553 void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
   2554 {
   2555 
   2556 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2557 	IOStream *stream = ctx->m_stream;
   2558 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2559 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2560 
   2561 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   2562 	 unsigned char *ptr;
   2563 	 unsigned char *buf;
   2564 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   2565 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2566 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2567 	buf = stream->alloc(totalSize);
   2568 	ptr = buf;
   2569 	int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
   2570 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2571 
   2572 		memcpy(ptr, &index, 4); ptr += 4;
   2573 		memcpy(ptr, &pname, 4); ptr += 4;
   2574 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   2575 
   2576 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2577 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2578 
   2579 	stream->readback(params, __size_params);
   2580 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   2581 	if (useChecksum) {
   2582 		unsigned char *checksumBufPtr = NULL;
   2583 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2584 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2585 		stream->readback(checksumBufPtr, checksumSize);
   2586 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2587 			ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n");
   2588 			abort();
   2589 		}
   2590 	}
   2591 }
   2592 
   2593 void glHint_enc(void *self , GLenum target, GLenum mode)
   2594 {
   2595 
   2596 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2597 	IOStream *stream = ctx->m_stream;
   2598 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2599 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2600 
   2601 	 unsigned char *ptr;
   2602 	 unsigned char *buf;
   2603 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   2604 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2605 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2606 	buf = stream->alloc(totalSize);
   2607 	ptr = buf;
   2608 	int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
   2609 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2610 
   2611 		memcpy(ptr, &target, 4); ptr += 4;
   2612 		memcpy(ptr, &mode, 4); ptr += 4;
   2613 
   2614 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2615 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2616 
   2617 }
   2618 
   2619 GLboolean glIsBuffer_enc(void *self , GLuint buffer)
   2620 {
   2621 
   2622 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2623 	IOStream *stream = ctx->m_stream;
   2624 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2625 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2626 
   2627 	 unsigned char *ptr;
   2628 	 unsigned char *buf;
   2629 	 const size_t sizeWithoutChecksum = 8 + 4;
   2630 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2631 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2632 	buf = stream->alloc(totalSize);
   2633 	ptr = buf;
   2634 	int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   2635 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2636 
   2637 		memcpy(ptr, &buffer, 4); ptr += 4;
   2638 
   2639 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2640 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2641 
   2642 
   2643 	GLboolean retval;
   2644 	stream->readback(&retval, 1);
   2645 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2646 	if (useChecksum) {
   2647 		unsigned char *checksumBufPtr = NULL;
   2648 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2649 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2650 		stream->readback(checksumBufPtr, checksumSize);
   2651 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2652 			ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
   2653 			abort();
   2654 		}
   2655 	}
   2656 	return retval;
   2657 }
   2658 
   2659 GLboolean glIsEnabled_enc(void *self , GLenum cap)
   2660 {
   2661 
   2662 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2663 	IOStream *stream = ctx->m_stream;
   2664 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2665 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2666 
   2667 	 unsigned char *ptr;
   2668 	 unsigned char *buf;
   2669 	 const size_t sizeWithoutChecksum = 8 + 4;
   2670 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2671 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2672 	buf = stream->alloc(totalSize);
   2673 	ptr = buf;
   2674 	int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
   2675 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2676 
   2677 		memcpy(ptr, &cap, 4); ptr += 4;
   2678 
   2679 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2680 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2681 
   2682 
   2683 	GLboolean retval;
   2684 	stream->readback(&retval, 1);
   2685 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2686 	if (useChecksum) {
   2687 		unsigned char *checksumBufPtr = NULL;
   2688 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2689 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2690 		stream->readback(checksumBufPtr, checksumSize);
   2691 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2692 			ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
   2693 			abort();
   2694 		}
   2695 	}
   2696 	return retval;
   2697 }
   2698 
   2699 GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer)
   2700 {
   2701 
   2702 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2703 	IOStream *stream = ctx->m_stream;
   2704 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2705 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2706 
   2707 	 unsigned char *ptr;
   2708 	 unsigned char *buf;
   2709 	 const size_t sizeWithoutChecksum = 8 + 4;
   2710 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2711 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2712 	buf = stream->alloc(totalSize);
   2713 	ptr = buf;
   2714 	int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   2715 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2716 
   2717 		memcpy(ptr, &framebuffer, 4); ptr += 4;
   2718 
   2719 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2720 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2721 
   2722 
   2723 	GLboolean retval;
   2724 	stream->readback(&retval, 1);
   2725 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2726 	if (useChecksum) {
   2727 		unsigned char *checksumBufPtr = NULL;
   2728 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2729 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2730 		stream->readback(checksumBufPtr, checksumSize);
   2731 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2732 			ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n");
   2733 			abort();
   2734 		}
   2735 	}
   2736 	return retval;
   2737 }
   2738 
   2739 GLboolean glIsProgram_enc(void *self , GLuint program)
   2740 {
   2741 
   2742 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2743 	IOStream *stream = ctx->m_stream;
   2744 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2745 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2746 
   2747 	 unsigned char *ptr;
   2748 	 unsigned char *buf;
   2749 	 const size_t sizeWithoutChecksum = 8 + 4;
   2750 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2751 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2752 	buf = stream->alloc(totalSize);
   2753 	ptr = buf;
   2754 	int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
   2755 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2756 
   2757 		memcpy(ptr, &program, 4); ptr += 4;
   2758 
   2759 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2760 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2761 
   2762 
   2763 	GLboolean retval;
   2764 	stream->readback(&retval, 1);
   2765 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2766 	if (useChecksum) {
   2767 		unsigned char *checksumBufPtr = NULL;
   2768 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2769 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2770 		stream->readback(checksumBufPtr, checksumSize);
   2771 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2772 			ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n");
   2773 			abort();
   2774 		}
   2775 	}
   2776 	return retval;
   2777 }
   2778 
   2779 GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer)
   2780 {
   2781 
   2782 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2783 	IOStream *stream = ctx->m_stream;
   2784 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2785 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2786 
   2787 	 unsigned char *ptr;
   2788 	 unsigned char *buf;
   2789 	 const size_t sizeWithoutChecksum = 8 + 4;
   2790 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2791 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2792 	buf = stream->alloc(totalSize);
   2793 	ptr = buf;
   2794 	int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   2795 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2796 
   2797 		memcpy(ptr, &renderbuffer, 4); ptr += 4;
   2798 
   2799 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2800 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2801 
   2802 
   2803 	GLboolean retval;
   2804 	stream->readback(&retval, 1);
   2805 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2806 	if (useChecksum) {
   2807 		unsigned char *checksumBufPtr = NULL;
   2808 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2809 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2810 		stream->readback(checksumBufPtr, checksumSize);
   2811 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2812 			ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n");
   2813 			abort();
   2814 		}
   2815 	}
   2816 	return retval;
   2817 }
   2818 
   2819 GLboolean glIsShader_enc(void *self , GLuint shader)
   2820 {
   2821 
   2822 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2823 	IOStream *stream = ctx->m_stream;
   2824 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2825 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2826 
   2827 	 unsigned char *ptr;
   2828 	 unsigned char *buf;
   2829 	 const size_t sizeWithoutChecksum = 8 + 4;
   2830 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2831 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2832 	buf = stream->alloc(totalSize);
   2833 	ptr = buf;
   2834 	int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
   2835 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2836 
   2837 		memcpy(ptr, &shader, 4); ptr += 4;
   2838 
   2839 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2840 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2841 
   2842 
   2843 	GLboolean retval;
   2844 	stream->readback(&retval, 1);
   2845 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2846 	if (useChecksum) {
   2847 		unsigned char *checksumBufPtr = NULL;
   2848 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2849 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2850 		stream->readback(checksumBufPtr, checksumSize);
   2851 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2852 			ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n");
   2853 			abort();
   2854 		}
   2855 	}
   2856 	return retval;
   2857 }
   2858 
   2859 GLboolean glIsTexture_enc(void *self , GLuint texture)
   2860 {
   2861 
   2862 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2863 	IOStream *stream = ctx->m_stream;
   2864 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2865 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2866 
   2867 	 unsigned char *ptr;
   2868 	 unsigned char *buf;
   2869 	 const size_t sizeWithoutChecksum = 8 + 4;
   2870 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2871 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2872 	buf = stream->alloc(totalSize);
   2873 	ptr = buf;
   2874 	int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
   2875 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2876 
   2877 		memcpy(ptr, &texture, 4); ptr += 4;
   2878 
   2879 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2880 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2881 
   2882 
   2883 	GLboolean retval;
   2884 	stream->readback(&retval, 1);
   2885 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   2886 	if (useChecksum) {
   2887 		unsigned char *checksumBufPtr = NULL;
   2888 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   2889 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   2890 		stream->readback(checksumBufPtr, checksumSize);
   2891 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   2892 			ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
   2893 			abort();
   2894 		}
   2895 	}
   2896 	return retval;
   2897 }
   2898 
   2899 void glLineWidth_enc(void *self , GLfloat width)
   2900 {
   2901 
   2902 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2903 	IOStream *stream = ctx->m_stream;
   2904 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2905 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2906 
   2907 	 unsigned char *ptr;
   2908 	 unsigned char *buf;
   2909 	 const size_t sizeWithoutChecksum = 8 + 4;
   2910 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2911 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2912 	buf = stream->alloc(totalSize);
   2913 	ptr = buf;
   2914 	int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
   2915 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2916 
   2917 		memcpy(ptr, &width, 4); ptr += 4;
   2918 
   2919 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2920 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2921 
   2922 }
   2923 
   2924 void glLinkProgram_enc(void *self , GLuint program)
   2925 {
   2926 
   2927 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2928 	IOStream *stream = ctx->m_stream;
   2929 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2930 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2931 
   2932 	 unsigned char *ptr;
   2933 	 unsigned char *buf;
   2934 	 const size_t sizeWithoutChecksum = 8 + 4;
   2935 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2936 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2937 	buf = stream->alloc(totalSize);
   2938 	ptr = buf;
   2939 	int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
   2940 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2941 
   2942 		memcpy(ptr, &program, 4); ptr += 4;
   2943 
   2944 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2945 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2946 
   2947 }
   2948 
   2949 void glPixelStorei_enc(void *self , GLenum pname, GLint param)
   2950 {
   2951 
   2952 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2953 	IOStream *stream = ctx->m_stream;
   2954 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2955 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2956 
   2957 	 unsigned char *ptr;
   2958 	 unsigned char *buf;
   2959 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   2960 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2961 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2962 	buf = stream->alloc(totalSize);
   2963 	ptr = buf;
   2964 	int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
   2965 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2966 
   2967 		memcpy(ptr, &pname, 4); ptr += 4;
   2968 		memcpy(ptr, &param, 4); ptr += 4;
   2969 
   2970 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2971 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2972 
   2973 }
   2974 
   2975 void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
   2976 {
   2977 
   2978 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   2979 	IOStream *stream = ctx->m_stream;
   2980 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   2981 	bool useChecksum = checksumCalculator->getVersion() > 0;
   2982 
   2983 	 unsigned char *ptr;
   2984 	 unsigned char *buf;
   2985 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   2986 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   2987 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   2988 	buf = stream->alloc(totalSize);
   2989 	ptr = buf;
   2990 	int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
   2991 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   2992 
   2993 		memcpy(ptr, &factor, 4); ptr += 4;
   2994 		memcpy(ptr, &units, 4); ptr += 4;
   2995 
   2996 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   2997 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   2998 
   2999 }
   3000 
   3001 void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
   3002 {
   3003 
   3004 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3005 	IOStream *stream = ctx->m_stream;
   3006 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3007 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3008 
   3009 	const unsigned int __size_pixels =  glesv2_enc::pixelDataSize(self, width, height, format, type, 1);
   3010 	 unsigned char *ptr;
   3011 	 unsigned char *buf;
   3012 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
   3013 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3014 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3015 	buf = stream->alloc(totalSize);
   3016 	ptr = buf;
   3017 	int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
   3018 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3019 
   3020 		memcpy(ptr, &x, 4); ptr += 4;
   3021 		memcpy(ptr, &y, 4); ptr += 4;
   3022 		memcpy(ptr, &width, 4); ptr += 4;
   3023 		memcpy(ptr, &height, 4); ptr += 4;
   3024 		memcpy(ptr, &format, 4); ptr += 4;
   3025 		memcpy(ptr, &type, 4); ptr += 4;
   3026 	*(unsigned int *)(ptr) = __size_pixels; ptr += 4;
   3027 
   3028 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3029 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3030 
   3031     // TODO: make this part of autogenerated pipe code.
   3032     // b/79208762
   3033 	stream->readbackPixels(self, width, height, format, type, pixels);
   3034 
   3035 	if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
   3036 	if (useChecksum) {
   3037 		unsigned char *checksumBufPtr = NULL;
   3038 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   3039 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   3040 		stream->readback(checksumBufPtr, checksumSize);
   3041 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   3042 			ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
   3043 			abort();
   3044 		}
   3045 	}
   3046 }
   3047 
   3048 void glReleaseShaderCompiler_enc(void *self )
   3049 {
   3050 
   3051 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3052 	IOStream *stream = ctx->m_stream;
   3053 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3054 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3055 
   3056 	 unsigned char *ptr;
   3057 	 unsigned char *buf;
   3058 	 const size_t sizeWithoutChecksum = 8;
   3059 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3060 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3061 	buf = stream->alloc(totalSize);
   3062 	ptr = buf;
   3063 	int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
   3064 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3065 
   3066 
   3067 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3068 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3069 
   3070 }
   3071 
   3072 void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
   3073 {
   3074 
   3075 	gl2_encoder_context_t *ctx = (gl2_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;
   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_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
   3088 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3089 
   3090 		memcpy(ptr, &target, 4); ptr += 4;
   3091 		memcpy(ptr, &internalformat, 4); ptr += 4;
   3092 		memcpy(ptr, &width, 4); ptr += 4;
   3093 		memcpy(ptr, &height, 4); ptr += 4;
   3094 
   3095 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3096 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3097 
   3098 }
   3099 
   3100 void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
   3101 {
   3102 
   3103 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3104 	IOStream *stream = ctx->m_stream;
   3105 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3106 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3107 
   3108 	 unsigned char *ptr;
   3109 	 unsigned char *buf;
   3110 	 const size_t sizeWithoutChecksum = 8 + 4 + 1;
   3111 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3112 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3113 	buf = stream->alloc(totalSize);
   3114 	ptr = buf;
   3115 	int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
   3116 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3117 
   3118 		memcpy(ptr, &value, 4); ptr += 4;
   3119 		memcpy(ptr, &invert, 1); ptr += 1;
   3120 
   3121 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3122 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3123 
   3124 }
   3125 
   3126 void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
   3127 {
   3128 
   3129 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3130 	IOStream *stream = ctx->m_stream;
   3131 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3132 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3133 
   3134 	 unsigned char *ptr;
   3135 	 unsigned char *buf;
   3136 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   3137 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3138 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3139 	buf = stream->alloc(totalSize);
   3140 	ptr = buf;
   3141 	int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
   3142 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3143 
   3144 		memcpy(ptr, &x, 4); ptr += 4;
   3145 		memcpy(ptr, &y, 4); ptr += 4;
   3146 		memcpy(ptr, &width, 4); ptr += 4;
   3147 		memcpy(ptr, &height, 4); ptr += 4;
   3148 
   3149 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3150 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3151 
   3152 }
   3153 
   3154 void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
   3155 {
   3156 
   3157 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3158 	IOStream *stream = ctx->m_stream;
   3159 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3160 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3161 
   3162 	 unsigned char *ptr;
   3163 	 unsigned char *buf;
   3164 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3165 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3166 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3167 	buf = stream->alloc(totalSize);
   3168 	ptr = buf;
   3169 	int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
   3170 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3171 
   3172 		memcpy(ptr, &func, 4); ptr += 4;
   3173 		memcpy(ptr, &ref, 4); ptr += 4;
   3174 		memcpy(ptr, &mask, 4); ptr += 4;
   3175 
   3176 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3177 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3178 
   3179 }
   3180 
   3181 void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
   3182 {
   3183 
   3184 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3185 	IOStream *stream = ctx->m_stream;
   3186 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3187 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3188 
   3189 	 unsigned char *ptr;
   3190 	 unsigned char *buf;
   3191 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   3192 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3193 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3194 	buf = stream->alloc(totalSize);
   3195 	ptr = buf;
   3196 	int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
   3197 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3198 
   3199 		memcpy(ptr, &face, 4); ptr += 4;
   3200 		memcpy(ptr, &func, 4); ptr += 4;
   3201 		memcpy(ptr, &ref, 4); ptr += 4;
   3202 		memcpy(ptr, &mask, 4); ptr += 4;
   3203 
   3204 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3205 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3206 
   3207 }
   3208 
   3209 void glStencilMask_enc(void *self , GLuint mask)
   3210 {
   3211 
   3212 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3213 	IOStream *stream = ctx->m_stream;
   3214 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3215 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3216 
   3217 	 unsigned char *ptr;
   3218 	 unsigned char *buf;
   3219 	 const size_t sizeWithoutChecksum = 8 + 4;
   3220 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3221 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3222 	buf = stream->alloc(totalSize);
   3223 	ptr = buf;
   3224 	int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
   3225 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3226 
   3227 		memcpy(ptr, &mask, 4); ptr += 4;
   3228 
   3229 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3230 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3231 
   3232 }
   3233 
   3234 void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
   3235 {
   3236 
   3237 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3238 	IOStream *stream = ctx->m_stream;
   3239 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3240 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3241 
   3242 	 unsigned char *ptr;
   3243 	 unsigned char *buf;
   3244 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   3245 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3246 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3247 	buf = stream->alloc(totalSize);
   3248 	ptr = buf;
   3249 	int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
   3250 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3251 
   3252 		memcpy(ptr, &face, 4); ptr += 4;
   3253 		memcpy(ptr, &mask, 4); ptr += 4;
   3254 
   3255 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3256 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3257 
   3258 }
   3259 
   3260 void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
   3261 {
   3262 
   3263 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3264 	IOStream *stream = ctx->m_stream;
   3265 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3266 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3267 
   3268 	 unsigned char *ptr;
   3269 	 unsigned char *buf;
   3270 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3271 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3272 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3273 	buf = stream->alloc(totalSize);
   3274 	ptr = buf;
   3275 	int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
   3276 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3277 
   3278 		memcpy(ptr, &fail, 4); ptr += 4;
   3279 		memcpy(ptr, &zfail, 4); ptr += 4;
   3280 		memcpy(ptr, &zpass, 4); ptr += 4;
   3281 
   3282 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3283 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3284 
   3285 }
   3286 
   3287 void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
   3288 {
   3289 
   3290 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3291 	IOStream *stream = ctx->m_stream;
   3292 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3293 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3294 
   3295 	 unsigned char *ptr;
   3296 	 unsigned char *buf;
   3297 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   3298 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3299 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3300 	buf = stream->alloc(totalSize);
   3301 	ptr = buf;
   3302 	int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
   3303 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3304 
   3305 		memcpy(ptr, &face, 4); ptr += 4;
   3306 		memcpy(ptr, &fail, 4); ptr += 4;
   3307 		memcpy(ptr, &zfail, 4); ptr += 4;
   3308 		memcpy(ptr, &zpass, 4); ptr += 4;
   3309 
   3310 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3311 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3312 
   3313 }
   3314 
   3315 void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
   3316 {
   3317 
   3318 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3319 	IOStream *stream = ctx->m_stream;
   3320 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3321 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3322 
   3323 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
   3324 	 unsigned char *ptr;
   3325 	 unsigned char *buf;
   3326 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
   3327 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3328 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3329 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   3330 	ptr = buf;
   3331 	int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
   3332 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3333 
   3334 		memcpy(ptr, &target, 4); ptr += 4;
   3335 		memcpy(ptr, &level, 4); ptr += 4;
   3336 		memcpy(ptr, &internalformat, 4); ptr += 4;
   3337 		memcpy(ptr, &width, 4); ptr += 4;
   3338 		memcpy(ptr, &height, 4); ptr += 4;
   3339 		memcpy(ptr, &border, 4); ptr += 4;
   3340 		memcpy(ptr, &format, 4); ptr += 4;
   3341 		memcpy(ptr, &type, 4); ptr += 4;
   3342 
   3343 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3344 	stream->flush();
   3345 	stream->writeFully(&__size_pixels,4);
   3346 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
   3347 	if (pixels != NULL) {
   3348 		stream->writeFully(pixels, __size_pixels);
   3349 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
   3350 	}
   3351 	buf = stream->alloc(checksumSize);
   3352 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   3353 
   3354 }
   3355 
   3356 void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
   3357 {
   3358 
   3359 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3360 	IOStream *stream = ctx->m_stream;
   3361 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3362 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3363 
   3364 	 unsigned char *ptr;
   3365 	 unsigned char *buf;
   3366 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3367 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3368 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3369 	buf = stream->alloc(totalSize);
   3370 	ptr = buf;
   3371 	int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
   3372 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3373 
   3374 		memcpy(ptr, &target, 4); ptr += 4;
   3375 		memcpy(ptr, &pname, 4); ptr += 4;
   3376 		memcpy(ptr, &param, 4); ptr += 4;
   3377 
   3378 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3379 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3380 
   3381 }
   3382 
   3383 void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
   3384 {
   3385 
   3386 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3387 	IOStream *stream = ctx->m_stream;
   3388 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3389 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3390 
   3391 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   3392 	 unsigned char *ptr;
   3393 	 unsigned char *buf;
   3394 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
   3395 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3396 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3397 	buf = stream->alloc(totalSize);
   3398 	ptr = buf;
   3399 	int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
   3400 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3401 
   3402 		memcpy(ptr, &target, 4); ptr += 4;
   3403 		memcpy(ptr, &pname, 4); ptr += 4;
   3404 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   3405 	memcpy(ptr, params, __size_params);ptr += __size_params;
   3406 
   3407 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3408 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3409 
   3410 }
   3411 
   3412 void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
   3413 {
   3414 
   3415 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3416 	IOStream *stream = ctx->m_stream;
   3417 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3418 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3419 
   3420 	 unsigned char *ptr;
   3421 	 unsigned char *buf;
   3422 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3423 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3424 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3425 	buf = stream->alloc(totalSize);
   3426 	ptr = buf;
   3427 	int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
   3428 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3429 
   3430 		memcpy(ptr, &target, 4); ptr += 4;
   3431 		memcpy(ptr, &pname, 4); ptr += 4;
   3432 		memcpy(ptr, &param, 4); ptr += 4;
   3433 
   3434 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3435 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3436 
   3437 }
   3438 
   3439 void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
   3440 {
   3441 
   3442 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3443 	IOStream *stream = ctx->m_stream;
   3444 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3445 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3446 
   3447 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   3448 	 unsigned char *ptr;
   3449 	 unsigned char *buf;
   3450 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
   3451 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3452 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3453 	buf = stream->alloc(totalSize);
   3454 	ptr = buf;
   3455 	int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   3456 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3457 
   3458 		memcpy(ptr, &target, 4); ptr += 4;
   3459 		memcpy(ptr, &pname, 4); ptr += 4;
   3460 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   3461 	memcpy(ptr, params, __size_params);ptr += __size_params;
   3462 
   3463 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3464 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3465 
   3466 }
   3467 
   3468 void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
   3469 {
   3470 
   3471 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3472 	IOStream *stream = ctx->m_stream;
   3473 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3474 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3475 
   3476 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
   3477 	 unsigned char *ptr;
   3478 	 unsigned char *buf;
   3479 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
   3480 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3481 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3482 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   3483 	ptr = buf;
   3484 	int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
   3485 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3486 
   3487 		memcpy(ptr, &target, 4); ptr += 4;
   3488 		memcpy(ptr, &level, 4); ptr += 4;
   3489 		memcpy(ptr, &xoffset, 4); ptr += 4;
   3490 		memcpy(ptr, &yoffset, 4); ptr += 4;
   3491 		memcpy(ptr, &width, 4); ptr += 4;
   3492 		memcpy(ptr, &height, 4); ptr += 4;
   3493 		memcpy(ptr, &format, 4); ptr += 4;
   3494 		memcpy(ptr, &type, 4); ptr += 4;
   3495 
   3496 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3497 	stream->flush();
   3498 	stream->writeFully(&__size_pixels,4);
   3499 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
   3500 	if (pixels != NULL) {
   3501 		stream->writeFully(pixels, __size_pixels);
   3502 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
   3503 	}
   3504 	buf = stream->alloc(checksumSize);
   3505 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   3506 
   3507 }
   3508 
   3509 void glUniform1f_enc(void *self , GLint location, GLfloat x)
   3510 {
   3511 
   3512 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3513 	IOStream *stream = ctx->m_stream;
   3514 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3515 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3516 
   3517 	 unsigned char *ptr;
   3518 	 unsigned char *buf;
   3519 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   3520 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3521 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3522 	buf = stream->alloc(totalSize);
   3523 	ptr = buf;
   3524 	int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
   3525 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3526 
   3527 		memcpy(ptr, &location, 4); ptr += 4;
   3528 		memcpy(ptr, &x, 4); ptr += 4;
   3529 
   3530 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3531 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3532 
   3533 }
   3534 
   3535 void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
   3536 {
   3537 
   3538 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3539 	IOStream *stream = ctx->m_stream;
   3540 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3541 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3542 
   3543 	const unsigned int __size_v =  (count * sizeof(GLfloat));
   3544 	 unsigned char *ptr;
   3545 	 unsigned char *buf;
   3546 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3547 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3548 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3549 	buf = stream->alloc(totalSize);
   3550 	ptr = buf;
   3551 	int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
   3552 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3553 
   3554 		memcpy(ptr, &location, 4); ptr += 4;
   3555 		memcpy(ptr, &count, 4); ptr += 4;
   3556 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3557 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3558 
   3559 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3560 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3561 
   3562 }
   3563 
   3564 void glUniform1i_enc(void *self , GLint location, GLint x)
   3565 {
   3566 
   3567 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3568 	IOStream *stream = ctx->m_stream;
   3569 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3570 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3571 
   3572 	 unsigned char *ptr;
   3573 	 unsigned char *buf;
   3574 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   3575 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3576 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3577 	buf = stream->alloc(totalSize);
   3578 	ptr = buf;
   3579 	int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
   3580 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3581 
   3582 		memcpy(ptr, &location, 4); ptr += 4;
   3583 		memcpy(ptr, &x, 4); ptr += 4;
   3584 
   3585 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3586 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3587 
   3588 }
   3589 
   3590 void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
   3591 {
   3592 
   3593 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3594 	IOStream *stream = ctx->m_stream;
   3595 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3596 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3597 
   3598 	const unsigned int __size_v =  (count * sizeof(GLint));
   3599 	 unsigned char *ptr;
   3600 	 unsigned char *buf;
   3601 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*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_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
   3607 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3608 
   3609 		memcpy(ptr, &location, 4); ptr += 4;
   3610 		memcpy(ptr, &count, 4); ptr += 4;
   3611 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3612 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3613 
   3614 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3615 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3616 
   3617 }
   3618 
   3619 void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
   3620 {
   3621 
   3622 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3623 	IOStream *stream = ctx->m_stream;
   3624 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3625 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3626 
   3627 	 unsigned char *ptr;
   3628 	 unsigned char *buf;
   3629 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3630 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3631 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3632 	buf = stream->alloc(totalSize);
   3633 	ptr = buf;
   3634 	int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
   3635 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3636 
   3637 		memcpy(ptr, &location, 4); ptr += 4;
   3638 		memcpy(ptr, &x, 4); ptr += 4;
   3639 		memcpy(ptr, &y, 4); ptr += 4;
   3640 
   3641 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3642 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3643 
   3644 }
   3645 
   3646 void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
   3647 {
   3648 
   3649 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3650 	IOStream *stream = ctx->m_stream;
   3651 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3652 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3653 
   3654 	const unsigned int __size_v =  (count * 2 * sizeof(GLfloat));
   3655 	 unsigned char *ptr;
   3656 	 unsigned char *buf;
   3657 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3658 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3659 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3660 	buf = stream->alloc(totalSize);
   3661 	ptr = buf;
   3662 	int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   3663 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3664 
   3665 		memcpy(ptr, &location, 4); ptr += 4;
   3666 		memcpy(ptr, &count, 4); ptr += 4;
   3667 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3668 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3669 
   3670 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3671 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3672 
   3673 }
   3674 
   3675 void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
   3676 {
   3677 
   3678 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3679 	IOStream *stream = ctx->m_stream;
   3680 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3681 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3682 
   3683 	 unsigned char *ptr;
   3684 	 unsigned char *buf;
   3685 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   3686 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3687 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3688 	buf = stream->alloc(totalSize);
   3689 	ptr = buf;
   3690 	int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
   3691 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3692 
   3693 		memcpy(ptr, &location, 4); ptr += 4;
   3694 		memcpy(ptr, &x, 4); ptr += 4;
   3695 		memcpy(ptr, &y, 4); ptr += 4;
   3696 
   3697 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3698 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3699 
   3700 }
   3701 
   3702 void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
   3703 {
   3704 
   3705 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3706 	IOStream *stream = ctx->m_stream;
   3707 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3708 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3709 
   3710 	const unsigned int __size_v =  (count * 2 * sizeof(GLint));
   3711 	 unsigned char *ptr;
   3712 	 unsigned char *buf;
   3713 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3714 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3715 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3716 	buf = stream->alloc(totalSize);
   3717 	ptr = buf;
   3718 	int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
   3719 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3720 
   3721 		memcpy(ptr, &location, 4); ptr += 4;
   3722 		memcpy(ptr, &count, 4); ptr += 4;
   3723 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3724 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3725 
   3726 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3727 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3728 
   3729 }
   3730 
   3731 void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
   3732 {
   3733 
   3734 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3735 	IOStream *stream = ctx->m_stream;
   3736 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3737 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3738 
   3739 	 unsigned char *ptr;
   3740 	 unsigned char *buf;
   3741 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   3742 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3743 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3744 	buf = stream->alloc(totalSize);
   3745 	ptr = buf;
   3746 	int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
   3747 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3748 
   3749 		memcpy(ptr, &location, 4); ptr += 4;
   3750 		memcpy(ptr, &x, 4); ptr += 4;
   3751 		memcpy(ptr, &y, 4); ptr += 4;
   3752 		memcpy(ptr, &z, 4); ptr += 4;
   3753 
   3754 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3755 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3756 
   3757 }
   3758 
   3759 void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
   3760 {
   3761 
   3762 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3763 	IOStream *stream = ctx->m_stream;
   3764 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3765 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3766 
   3767 	const unsigned int __size_v =  (count * 3 * sizeof(GLfloat));
   3768 	 unsigned char *ptr;
   3769 	 unsigned char *buf;
   3770 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3771 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3772 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3773 	buf = stream->alloc(totalSize);
   3774 	ptr = buf;
   3775 	int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   3776 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3777 
   3778 		memcpy(ptr, &location, 4); ptr += 4;
   3779 		memcpy(ptr, &count, 4); ptr += 4;
   3780 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3781 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3782 
   3783 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3784 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3785 
   3786 }
   3787 
   3788 void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
   3789 {
   3790 
   3791 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3792 	IOStream *stream = ctx->m_stream;
   3793 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3794 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3795 
   3796 	 unsigned char *ptr;
   3797 	 unsigned char *buf;
   3798 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   3799 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3800 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3801 	buf = stream->alloc(totalSize);
   3802 	ptr = buf;
   3803 	int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
   3804 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3805 
   3806 		memcpy(ptr, &location, 4); ptr += 4;
   3807 		memcpy(ptr, &x, 4); ptr += 4;
   3808 		memcpy(ptr, &y, 4); ptr += 4;
   3809 		memcpy(ptr, &z, 4); ptr += 4;
   3810 
   3811 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3812 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3813 
   3814 }
   3815 
   3816 void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
   3817 {
   3818 
   3819 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3820 	IOStream *stream = ctx->m_stream;
   3821 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3822 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3823 
   3824 	const unsigned int __size_v =  (3 * count * sizeof(GLint));
   3825 	 unsigned char *ptr;
   3826 	 unsigned char *buf;
   3827 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3828 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3829 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3830 	buf = stream->alloc(totalSize);
   3831 	ptr = buf;
   3832 	int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
   3833 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3834 
   3835 		memcpy(ptr, &location, 4); ptr += 4;
   3836 		memcpy(ptr, &count, 4); ptr += 4;
   3837 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3838 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3839 
   3840 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3841 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3842 
   3843 }
   3844 
   3845 void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
   3846 {
   3847 
   3848 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3849 	IOStream *stream = ctx->m_stream;
   3850 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3851 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3852 
   3853 	 unsigned char *ptr;
   3854 	 unsigned char *buf;
   3855 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   3856 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3857 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3858 	buf = stream->alloc(totalSize);
   3859 	ptr = buf;
   3860 	int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
   3861 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3862 
   3863 		memcpy(ptr, &location, 4); ptr += 4;
   3864 		memcpy(ptr, &x, 4); ptr += 4;
   3865 		memcpy(ptr, &y, 4); ptr += 4;
   3866 		memcpy(ptr, &z, 4); ptr += 4;
   3867 		memcpy(ptr, &w, 4); ptr += 4;
   3868 
   3869 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3870 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3871 
   3872 }
   3873 
   3874 void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
   3875 {
   3876 
   3877 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3878 	IOStream *stream = ctx->m_stream;
   3879 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3880 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3881 
   3882 	const unsigned int __size_v =  (4 * count * sizeof(GLfloat));
   3883 	 unsigned char *ptr;
   3884 	 unsigned char *buf;
   3885 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3886 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3887 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3888 	buf = stream->alloc(totalSize);
   3889 	ptr = buf;
   3890 	int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   3891 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3892 
   3893 		memcpy(ptr, &location, 4); ptr += 4;
   3894 		memcpy(ptr, &count, 4); ptr += 4;
   3895 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3896 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3897 
   3898 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3899 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3900 
   3901 }
   3902 
   3903 void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
   3904 {
   3905 
   3906 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3907 	IOStream *stream = ctx->m_stream;
   3908 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3909 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3910 
   3911 	 unsigned char *ptr;
   3912 	 unsigned char *buf;
   3913 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   3914 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3915 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3916 	buf = stream->alloc(totalSize);
   3917 	ptr = buf;
   3918 	int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
   3919 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3920 
   3921 		memcpy(ptr, &location, 4); ptr += 4;
   3922 		memcpy(ptr, &x, 4); ptr += 4;
   3923 		memcpy(ptr, &y, 4); ptr += 4;
   3924 		memcpy(ptr, &z, 4); ptr += 4;
   3925 		memcpy(ptr, &w, 4); ptr += 4;
   3926 
   3927 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3928 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3929 
   3930 }
   3931 
   3932 void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
   3933 {
   3934 
   3935 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3936 	IOStream *stream = ctx->m_stream;
   3937 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3938 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3939 
   3940 	const unsigned int __size_v =  (4 * count * sizeof(GLint));
   3941 	 unsigned char *ptr;
   3942 	 unsigned char *buf;
   3943 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
   3944 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3945 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3946 	buf = stream->alloc(totalSize);
   3947 	ptr = buf;
   3948 	int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
   3949 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3950 
   3951 		memcpy(ptr, &location, 4); ptr += 4;
   3952 		memcpy(ptr, &count, 4); ptr += 4;
   3953 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   3954 	memcpy(ptr, v, __size_v);ptr += __size_v;
   3955 
   3956 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3957 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3958 
   3959 }
   3960 
   3961 void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   3962 {
   3963 
   3964 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3965 	IOStream *stream = ctx->m_stream;
   3966 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3967 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3968 
   3969 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
   3970 	 unsigned char *ptr;
   3971 	 unsigned char *buf;
   3972 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   3973 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   3974 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   3975 	buf = stream->alloc(totalSize);
   3976 	ptr = buf;
   3977 	int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   3978 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   3979 
   3980 		memcpy(ptr, &location, 4); ptr += 4;
   3981 		memcpy(ptr, &count, 4); ptr += 4;
   3982 		memcpy(ptr, &transpose, 1); ptr += 1;
   3983 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   3984 	memcpy(ptr, value, __size_value);ptr += __size_value;
   3985 
   3986 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   3987 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   3988 
   3989 }
   3990 
   3991 void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   3992 {
   3993 
   3994 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   3995 	IOStream *stream = ctx->m_stream;
   3996 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   3997 	bool useChecksum = checksumCalculator->getVersion() > 0;
   3998 
   3999 	const unsigned int __size_value =  (count * 9 * sizeof(GLfloat));
   4000 	 unsigned char *ptr;
   4001 	 unsigned char *buf;
   4002 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   4003 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4004 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4005 	buf = stream->alloc(totalSize);
   4006 	ptr = buf;
   4007 	int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4008 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4009 
   4010 		memcpy(ptr, &location, 4); ptr += 4;
   4011 		memcpy(ptr, &count, 4); ptr += 4;
   4012 		memcpy(ptr, &transpose, 1); ptr += 1;
   4013 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   4014 	memcpy(ptr, value, __size_value);ptr += __size_value;
   4015 
   4016 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4017 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4018 
   4019 }
   4020 
   4021 void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   4022 {
   4023 
   4024 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4025 	IOStream *stream = ctx->m_stream;
   4026 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4027 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4028 
   4029 	const unsigned int __size_value =  (count * 16 * sizeof(GLfloat));
   4030 	 unsigned char *ptr;
   4031 	 unsigned char *buf;
   4032 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   4033 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4034 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4035 	buf = stream->alloc(totalSize);
   4036 	ptr = buf;
   4037 	int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4038 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4039 
   4040 		memcpy(ptr, &location, 4); ptr += 4;
   4041 		memcpy(ptr, &count, 4); ptr += 4;
   4042 		memcpy(ptr, &transpose, 1); ptr += 1;
   4043 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   4044 	memcpy(ptr, value, __size_value);ptr += __size_value;
   4045 
   4046 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4047 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4048 
   4049 }
   4050 
   4051 void glUseProgram_enc(void *self , GLuint program)
   4052 {
   4053 
   4054 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4055 	IOStream *stream = ctx->m_stream;
   4056 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4057 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4058 
   4059 	 unsigned char *ptr;
   4060 	 unsigned char *buf;
   4061 	 const size_t sizeWithoutChecksum = 8 + 4;
   4062 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4063 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4064 	buf = stream->alloc(totalSize);
   4065 	ptr = buf;
   4066 	int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
   4067 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4068 
   4069 		memcpy(ptr, &program, 4); ptr += 4;
   4070 
   4071 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4072 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4073 
   4074 }
   4075 
   4076 void glValidateProgram_enc(void *self , GLuint program)
   4077 {
   4078 
   4079 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4080 	IOStream *stream = ctx->m_stream;
   4081 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4082 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4083 
   4084 	 unsigned char *ptr;
   4085 	 unsigned char *buf;
   4086 	 const size_t sizeWithoutChecksum = 8 + 4;
   4087 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4088 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4089 	buf = stream->alloc(totalSize);
   4090 	ptr = buf;
   4091 	int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
   4092 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4093 
   4094 		memcpy(ptr, &program, 4); ptr += 4;
   4095 
   4096 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4097 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4098 
   4099 }
   4100 
   4101 void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
   4102 {
   4103 
   4104 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4105 	IOStream *stream = ctx->m_stream;
   4106 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4107 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4108 
   4109 	 unsigned char *ptr;
   4110 	 unsigned char *buf;
   4111 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   4112 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4113 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4114 	buf = stream->alloc(totalSize);
   4115 	ptr = buf;
   4116 	int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
   4117 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4118 
   4119 		memcpy(ptr, &indx, 4); ptr += 4;
   4120 		memcpy(ptr, &x, 4); ptr += 4;
   4121 
   4122 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4123 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4124 
   4125 }
   4126 
   4127 void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
   4128 {
   4129 
   4130 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4131 	IOStream *stream = ctx->m_stream;
   4132 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4133 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4134 
   4135 	const unsigned int __size_values =  (sizeof(GLfloat));
   4136 	 unsigned char *ptr;
   4137 	 unsigned char *buf;
   4138 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
   4139 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4140 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4141 	buf = stream->alloc(totalSize);
   4142 	ptr = buf;
   4143 	int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4144 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4145 
   4146 		memcpy(ptr, &indx, 4); ptr += 4;
   4147 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
   4148 	memcpy(ptr, values, __size_values);ptr += __size_values;
   4149 
   4150 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4151 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4152 
   4153 }
   4154 
   4155 void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
   4156 {
   4157 
   4158 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4159 	IOStream *stream = ctx->m_stream;
   4160 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4161 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4162 
   4163 	 unsigned char *ptr;
   4164 	 unsigned char *buf;
   4165 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   4166 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4167 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4168 	buf = stream->alloc(totalSize);
   4169 	ptr = buf;
   4170 	int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
   4171 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4172 
   4173 		memcpy(ptr, &indx, 4); ptr += 4;
   4174 		memcpy(ptr, &x, 4); ptr += 4;
   4175 		memcpy(ptr, &y, 4); ptr += 4;
   4176 
   4177 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4178 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4179 
   4180 }
   4181 
   4182 void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
   4183 {
   4184 
   4185 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4186 	IOStream *stream = ctx->m_stream;
   4187 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4188 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4189 
   4190 	const unsigned int __size_values =  (2 * sizeof(GLfloat));
   4191 	 unsigned char *ptr;
   4192 	 unsigned char *buf;
   4193 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
   4194 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4195 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4196 	buf = stream->alloc(totalSize);
   4197 	ptr = buf;
   4198 	int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4199 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4200 
   4201 		memcpy(ptr, &indx, 4); ptr += 4;
   4202 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
   4203 	memcpy(ptr, values, __size_values);ptr += __size_values;
   4204 
   4205 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4206 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4207 
   4208 }
   4209 
   4210 void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
   4211 {
   4212 
   4213 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4214 	IOStream *stream = ctx->m_stream;
   4215 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4216 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4217 
   4218 	 unsigned char *ptr;
   4219 	 unsigned char *buf;
   4220 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   4221 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4222 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4223 	buf = stream->alloc(totalSize);
   4224 	ptr = buf;
   4225 	int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
   4226 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4227 
   4228 		memcpy(ptr, &indx, 4); ptr += 4;
   4229 		memcpy(ptr, &x, 4); ptr += 4;
   4230 		memcpy(ptr, &y, 4); ptr += 4;
   4231 		memcpy(ptr, &z, 4); ptr += 4;
   4232 
   4233 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4234 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4235 
   4236 }
   4237 
   4238 void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
   4239 {
   4240 
   4241 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4242 	IOStream *stream = ctx->m_stream;
   4243 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4244 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4245 
   4246 	const unsigned int __size_values =  (3 * sizeof(GLfloat));
   4247 	 unsigned char *ptr;
   4248 	 unsigned char *buf;
   4249 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
   4250 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4251 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4252 	buf = stream->alloc(totalSize);
   4253 	ptr = buf;
   4254 	int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4255 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4256 
   4257 		memcpy(ptr, &indx, 4); ptr += 4;
   4258 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
   4259 	memcpy(ptr, values, __size_values);ptr += __size_values;
   4260 
   4261 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4262 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4263 
   4264 }
   4265 
   4266 void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
   4267 {
   4268 
   4269 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4270 	IOStream *stream = ctx->m_stream;
   4271 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4272 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4273 
   4274 	 unsigned char *ptr;
   4275 	 unsigned char *buf;
   4276 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 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_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
   4282 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4283 
   4284 		memcpy(ptr, &indx, 4); ptr += 4;
   4285 		memcpy(ptr, &x, 4); ptr += 4;
   4286 		memcpy(ptr, &y, 4); ptr += 4;
   4287 		memcpy(ptr, &z, 4); ptr += 4;
   4288 		memcpy(ptr, &w, 4); ptr += 4;
   4289 
   4290 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4291 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4292 
   4293 }
   4294 
   4295 void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
   4296 {
   4297 
   4298 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4299 	IOStream *stream = ctx->m_stream;
   4300 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4301 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4302 
   4303 	const unsigned int __size_values =  (4 * sizeof(GLfloat));
   4304 	 unsigned char *ptr;
   4305 	 unsigned char *buf;
   4306 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
   4307 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4308 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4309 	buf = stream->alloc(totalSize);
   4310 	ptr = buf;
   4311 	int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   4312 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4313 
   4314 		memcpy(ptr, &indx, 4); ptr += 4;
   4315 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
   4316 	memcpy(ptr, values, __size_values);ptr += __size_values;
   4317 
   4318 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4319 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4320 
   4321 }
   4322 
   4323 void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
   4324 {
   4325 
   4326 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4327 	IOStream *stream = ctx->m_stream;
   4328 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4329 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4330 
   4331 	 unsigned char *ptr;
   4332 	 unsigned char *buf;
   4333 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   4334 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4335 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4336 	buf = stream->alloc(totalSize);
   4337 	ptr = buf;
   4338 	int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
   4339 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4340 
   4341 		memcpy(ptr, &x, 4); ptr += 4;
   4342 		memcpy(ptr, &y, 4); ptr += 4;
   4343 		memcpy(ptr, &width, 4); ptr += 4;
   4344 		memcpy(ptr, &height, 4); ptr += 4;
   4345 
   4346 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4347 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4348 
   4349 }
   4350 
   4351 void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
   4352 {
   4353 
   4354 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4355 	IOStream *stream = ctx->m_stream;
   4356 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4357 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4358 
   4359 	 unsigned char *ptr;
   4360 	 unsigned char *buf;
   4361 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   4362 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4363 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4364 	buf = stream->alloc(totalSize);
   4365 	ptr = buf;
   4366 	int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4367 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4368 
   4369 		memcpy(ptr, &target, 4); ptr += 4;
   4370 		memcpy(ptr, &image, 4); ptr += 4;
   4371 
   4372 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4373 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4374 
   4375 }
   4376 
   4377 void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
   4378 {
   4379 
   4380 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4381 	IOStream *stream = ctx->m_stream;
   4382 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4383 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4384 
   4385 	 unsigned char *ptr;
   4386 	 unsigned char *buf;
   4387 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   4388 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4389 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4390 	buf = stream->alloc(totalSize);
   4391 	ptr = buf;
   4392 	int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4393 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4394 
   4395 		memcpy(ptr, &target, 4); ptr += 4;
   4396 		memcpy(ptr, &image, 4); ptr += 4;
   4397 
   4398 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4399 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4400 
   4401 }
   4402 
   4403 GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
   4404 {
   4405 
   4406 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4407 	IOStream *stream = ctx->m_stream;
   4408 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4409 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4410 
   4411 	 unsigned char *ptr;
   4412 	 unsigned char *buf;
   4413 	 const size_t sizeWithoutChecksum = 8 + 4;
   4414 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4415 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4416 	buf = stream->alloc(totalSize);
   4417 	ptr = buf;
   4418 	int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4419 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4420 
   4421 		memcpy(ptr, &target, 4); ptr += 4;
   4422 
   4423 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4424 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4425 
   4426 
   4427 	GLboolean retval;
   4428 	stream->readback(&retval, 1);
   4429 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   4430 	if (useChecksum) {
   4431 		unsigned char *checksumBufPtr = NULL;
   4432 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   4433 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   4434 		stream->readback(checksumBufPtr, checksumSize);
   4435 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   4436 			ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
   4437 			abort();
   4438 		}
   4439 	}
   4440 	return retval;
   4441 }
   4442 
   4443 void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
   4444 {
   4445 
   4446 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4447 	IOStream *stream = ctx->m_stream;
   4448 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4449 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4450 
   4451 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
   4452 	 unsigned char *ptr;
   4453 	 unsigned char *buf;
   4454 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
   4455 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4456 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4457 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   4458 	ptr = buf;
   4459 	int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4460 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4461 
   4462 		memcpy(ptr, &target, 4); ptr += 4;
   4463 		memcpy(ptr, &level, 4); ptr += 4;
   4464 		memcpy(ptr, &internalformat, 4); ptr += 4;
   4465 		memcpy(ptr, &width, 4); ptr += 4;
   4466 		memcpy(ptr, &height, 4); ptr += 4;
   4467 		memcpy(ptr, &depth, 4); ptr += 4;
   4468 		memcpy(ptr, &border, 4); ptr += 4;
   4469 		memcpy(ptr, &format, 4); ptr += 4;
   4470 		memcpy(ptr, &type, 4); ptr += 4;
   4471 
   4472 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4473 	stream->flush();
   4474 	stream->writeFully(&__size_pixels,4);
   4475 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
   4476 	if (pixels != NULL) {
   4477 		stream->writeFully(pixels, __size_pixels);
   4478 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
   4479 	}
   4480 	buf = stream->alloc(checksumSize);
   4481 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   4482 
   4483 }
   4484 
   4485 void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
   4486 {
   4487 
   4488 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4489 	IOStream *stream = ctx->m_stream;
   4490 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4491 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4492 
   4493 	const unsigned int __size_pixels = ((pixels != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
   4494 	 unsigned char *ptr;
   4495 	 unsigned char *buf;
   4496 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
   4497 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4498 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4499 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   4500 	ptr = buf;
   4501 	int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4502 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4503 
   4504 		memcpy(ptr, &target, 4); ptr += 4;
   4505 		memcpy(ptr, &level, 4); ptr += 4;
   4506 		memcpy(ptr, &xoffset, 4); ptr += 4;
   4507 		memcpy(ptr, &yoffset, 4); ptr += 4;
   4508 		memcpy(ptr, &zoffset, 4); ptr += 4;
   4509 		memcpy(ptr, &width, 4); ptr += 4;
   4510 		memcpy(ptr, &height, 4); ptr += 4;
   4511 		memcpy(ptr, &depth, 4); ptr += 4;
   4512 		memcpy(ptr, &format, 4); ptr += 4;
   4513 		memcpy(ptr, &type, 4); ptr += 4;
   4514 
   4515 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4516 	stream->flush();
   4517 	stream->writeFully(&__size_pixels,4);
   4518 	if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
   4519 	if (pixels != NULL) {
   4520 		stream->writeFully(pixels, __size_pixels);
   4521 		if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
   4522 	}
   4523 	buf = stream->alloc(checksumSize);
   4524 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   4525 
   4526 }
   4527 
   4528 void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
   4529 {
   4530 
   4531 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4532 	IOStream *stream = ctx->m_stream;
   4533 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4534 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4535 
   4536 	 unsigned char *ptr;
   4537 	 unsigned char *buf;
   4538 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   4539 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4540 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4541 	buf = stream->alloc(totalSize);
   4542 	ptr = buf;
   4543 	int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4544 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4545 
   4546 		memcpy(ptr, &target, 4); ptr += 4;
   4547 		memcpy(ptr, &level, 4); ptr += 4;
   4548 		memcpy(ptr, &xoffset, 4); ptr += 4;
   4549 		memcpy(ptr, &yoffset, 4); ptr += 4;
   4550 		memcpy(ptr, &zoffset, 4); ptr += 4;
   4551 		memcpy(ptr, &x, 4); ptr += 4;
   4552 		memcpy(ptr, &y, 4); ptr += 4;
   4553 		memcpy(ptr, &width, 4); ptr += 4;
   4554 		memcpy(ptr, &height, 4); ptr += 4;
   4555 
   4556 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4557 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4558 
   4559 }
   4560 
   4561 void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
   4562 {
   4563 
   4564 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4565 	IOStream *stream = ctx->m_stream;
   4566 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4567 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4568 
   4569 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
   4570 	 unsigned char *ptr;
   4571 	 unsigned char *buf;
   4572 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   4573 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4574 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4575 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   4576 	ptr = buf;
   4577 	int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4578 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4579 
   4580 		memcpy(ptr, &target, 4); ptr += 4;
   4581 		memcpy(ptr, &level, 4); ptr += 4;
   4582 		memcpy(ptr, &internalformat, 4); ptr += 4;
   4583 		memcpy(ptr, &width, 4); ptr += 4;
   4584 		memcpy(ptr, &height, 4); ptr += 4;
   4585 		memcpy(ptr, &depth, 4); ptr += 4;
   4586 		memcpy(ptr, &border, 4); ptr += 4;
   4587 		memcpy(ptr, &imageSize, 4); ptr += 4;
   4588 
   4589 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4590 	stream->flush();
   4591 	stream->writeFully(&__size_data,4);
   4592 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   4593 	if (data != NULL) {
   4594 		stream->writeFully(data, __size_data);
   4595 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   4596 	}
   4597 	buf = stream->alloc(checksumSize);
   4598 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   4599 
   4600 }
   4601 
   4602 void glCompressedTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
   4603 {
   4604 
   4605 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4606 	IOStream *stream = ctx->m_stream;
   4607 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4608 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4609 
   4610 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
   4611 	 unsigned char *ptr;
   4612 	 unsigned char *buf;
   4613 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   4614 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4615 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4616 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   4617 	ptr = buf;
   4618 	int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4619 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4620 
   4621 		memcpy(ptr, &target, 4); ptr += 4;
   4622 		memcpy(ptr, &level, 4); ptr += 4;
   4623 		memcpy(ptr, &xoffset, 4); ptr += 4;
   4624 		memcpy(ptr, &yoffset, 4); ptr += 4;
   4625 		memcpy(ptr, &zoffset, 4); ptr += 4;
   4626 		memcpy(ptr, &width, 4); ptr += 4;
   4627 		memcpy(ptr, &height, 4); ptr += 4;
   4628 		memcpy(ptr, &depth, 4); ptr += 4;
   4629 		memcpy(ptr, &format, 4); ptr += 4;
   4630 		memcpy(ptr, &imageSize, 4); ptr += 4;
   4631 
   4632 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4633 	stream->flush();
   4634 	stream->writeFully(&__size_data,4);
   4635 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   4636 	if (data != NULL) {
   4637 		stream->writeFully(data, __size_data);
   4638 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   4639 	}
   4640 	buf = stream->alloc(checksumSize);
   4641 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   4642 
   4643 }
   4644 
   4645 void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
   4646 {
   4647 
   4648 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4649 	IOStream *stream = ctx->m_stream;
   4650 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4651 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4652 
   4653 	 unsigned char *ptr;
   4654 	 unsigned char *buf;
   4655 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   4656 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4657 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4658 	buf = stream->alloc(totalSize);
   4659 	ptr = buf;
   4660 	int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4661 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4662 
   4663 		memcpy(ptr, &target, 4); ptr += 4;
   4664 		memcpy(ptr, &attachment, 4); ptr += 4;
   4665 		memcpy(ptr, &textarget, 4); ptr += 4;
   4666 		memcpy(ptr, &texture, 4); ptr += 4;
   4667 		memcpy(ptr, &level, 4); ptr += 4;
   4668 		memcpy(ptr, &zoffset, 4); ptr += 4;
   4669 
   4670 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4671 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4672 
   4673 }
   4674 
   4675 void glBindVertexArrayOES_enc(void *self , GLuint array)
   4676 {
   4677 
   4678 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4679 	IOStream *stream = ctx->m_stream;
   4680 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4681 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4682 
   4683 	 unsigned char *ptr;
   4684 	 unsigned char *buf;
   4685 	 const size_t sizeWithoutChecksum = 8 + 4;
   4686 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4687 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4688 	buf = stream->alloc(totalSize);
   4689 	ptr = buf;
   4690 	int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4691 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4692 
   4693 		memcpy(ptr, &array, 4); ptr += 4;
   4694 
   4695 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4696 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4697 
   4698 }
   4699 
   4700 void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
   4701 {
   4702 
   4703 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4704 	IOStream *stream = ctx->m_stream;
   4705 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4706 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4707 
   4708 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
   4709 	 unsigned char *ptr;
   4710 	 unsigned char *buf;
   4711 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
   4712 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4713 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4714 	buf = stream->alloc(totalSize);
   4715 	ptr = buf;
   4716 	int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4717 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4718 
   4719 		memcpy(ptr, &n, 4); ptr += 4;
   4720 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
   4721 	memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
   4722 
   4723 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4724 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4725 
   4726 }
   4727 
   4728 void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
   4729 {
   4730 
   4731 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4732 	IOStream *stream = ctx->m_stream;
   4733 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4734 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4735 
   4736 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
   4737 	 unsigned char *ptr;
   4738 	 unsigned char *buf;
   4739 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   4740 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4741 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4742 	buf = stream->alloc(totalSize);
   4743 	ptr = buf;
   4744 	int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4745 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4746 
   4747 		memcpy(ptr, &n, 4); ptr += 4;
   4748 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
   4749 
   4750 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4751 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4752 
   4753 	stream->readback(arrays, __size_arrays);
   4754 	if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
   4755 	if (useChecksum) {
   4756 		unsigned char *checksumBufPtr = NULL;
   4757 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   4758 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   4759 		stream->readback(checksumBufPtr, checksumSize);
   4760 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   4761 			ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
   4762 			abort();
   4763 		}
   4764 	}
   4765 }
   4766 
   4767 GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
   4768 {
   4769 
   4770 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4771 	IOStream *stream = ctx->m_stream;
   4772 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4773 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4774 
   4775 	 unsigned char *ptr;
   4776 	 unsigned char *buf;
   4777 	 const size_t sizeWithoutChecksum = 8 + 4;
   4778 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4779 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4780 	buf = stream->alloc(totalSize);
   4781 	ptr = buf;
   4782 	int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
   4783 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4784 
   4785 		memcpy(ptr, &array, 4); ptr += 4;
   4786 
   4787 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4788 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4789 
   4790 
   4791 	GLboolean retval;
   4792 	stream->readback(&retval, 1);
   4793 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   4794 	if (useChecksum) {
   4795 		unsigned char *checksumBufPtr = NULL;
   4796 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   4797 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   4798 		stream->readback(checksumBufPtr, checksumSize);
   4799 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   4800 			ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
   4801 			abort();
   4802 		}
   4803 	}
   4804 	return retval;
   4805 }
   4806 
   4807 void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
   4808 {
   4809 
   4810 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4811 	IOStream *stream = ctx->m_stream;
   4812 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4813 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4814 
   4815 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
   4816 	 unsigned char *ptr;
   4817 	 unsigned char *buf;
   4818 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
   4819 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4820 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4821 	buf = stream->alloc(totalSize);
   4822 	ptr = buf;
   4823 	int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
   4824 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4825 
   4826 		memcpy(ptr, &target, 4); ptr += 4;
   4827 		memcpy(ptr, &numAttachments, 4); ptr += 4;
   4828 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
   4829 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
   4830 
   4831 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4832 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4833 
   4834 }
   4835 
   4836 void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
   4837 {
   4838 
   4839 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4840 	IOStream *stream = ctx->m_stream;
   4841 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4842 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4843 
   4844 	const unsigned int __size_data =  datalen;
   4845 	 unsigned char *ptr;
   4846 	 unsigned char *buf;
   4847 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
   4848 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4849 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4850 	buf = stream->alloc(totalSize);
   4851 	ptr = buf;
   4852 	int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
   4853 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4854 
   4855 		memcpy(ptr, &indx, 4); ptr += 4;
   4856 		memcpy(ptr, &size, 4); ptr += 4;
   4857 		memcpy(ptr, &type, 4); ptr += 4;
   4858 		memcpy(ptr, &normalized, 1); ptr += 1;
   4859 		memcpy(ptr, &stride, 4); ptr += 4;
   4860 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   4861 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
   4862 		memcpy(ptr, &datalen, 4); ptr += 4;
   4863 
   4864 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4865 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4866 
   4867 }
   4868 
   4869 void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
   4870 {
   4871 
   4872 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4873 	IOStream *stream = ctx->m_stream;
   4874 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4875 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4876 
   4877 	 unsigned char *ptr;
   4878 	 unsigned char *buf;
   4879 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4;
   4880 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4881 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4882 	buf = stream->alloc(totalSize);
   4883 	ptr = buf;
   4884 	int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
   4885 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4886 
   4887 		memcpy(ptr, &indx, 4); ptr += 4;
   4888 		memcpy(ptr, &size, 4); ptr += 4;
   4889 		memcpy(ptr, &type, 4); ptr += 4;
   4890 		memcpy(ptr, &normalized, 1); ptr += 1;
   4891 		memcpy(ptr, &stride, 4); ptr += 4;
   4892 		memcpy(ptr, &offset, 4); ptr += 4;
   4893 
   4894 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4895 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4896 
   4897 }
   4898 
   4899 void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
   4900 {
   4901 
   4902 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4903 	IOStream *stream = ctx->m_stream;
   4904 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4905 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4906 
   4907 	 unsigned char *ptr;
   4908 	 unsigned char *buf;
   4909 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   4910 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4911 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4912 	buf = stream->alloc(totalSize);
   4913 	ptr = buf;
   4914 	int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
   4915 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4916 
   4917 		memcpy(ptr, &mode, 4); ptr += 4;
   4918 		memcpy(ptr, &count, 4); ptr += 4;
   4919 		memcpy(ptr, &type, 4); ptr += 4;
   4920 		memcpy(ptr, &offset, 4); ptr += 4;
   4921 
   4922 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4923 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4924 
   4925 }
   4926 
   4927 void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
   4928 {
   4929 
   4930 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4931 	IOStream *stream = ctx->m_stream;
   4932 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4933 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4934 
   4935 	const unsigned int __size_data =  datalen;
   4936 	 unsigned char *ptr;
   4937 	 unsigned char *buf;
   4938 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
   4939 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4940 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4941 	buf = stream->alloc(totalSize);
   4942 	ptr = buf;
   4943 	int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
   4944 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4945 
   4946 		memcpy(ptr, &mode, 4); ptr += 4;
   4947 		memcpy(ptr, &count, 4); ptr += 4;
   4948 		memcpy(ptr, &type, 4); ptr += 4;
   4949 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   4950 	memcpy(ptr, data, __size_data);ptr += __size_data;
   4951 		memcpy(ptr, &datalen, 4); ptr += 4;
   4952 
   4953 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4954 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4955 
   4956 }
   4957 
   4958 void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
   4959 {
   4960 
   4961 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   4962 	IOStream *stream = ctx->m_stream;
   4963 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   4964 	bool useChecksum = checksumCalculator->getVersion() > 0;
   4965 
   4966 	const unsigned int __size_formats =  (count * sizeof(GLint));
   4967 	 unsigned char *ptr;
   4968 	 unsigned char *buf;
   4969 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   4970 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   4971 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   4972 	buf = stream->alloc(totalSize);
   4973 	ptr = buf;
   4974 	int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
   4975 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   4976 
   4977 		memcpy(ptr, &count, 4); ptr += 4;
   4978 	*(unsigned int *)(ptr) = __size_formats; ptr += 4;
   4979 
   4980 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   4981 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   4982 
   4983 	stream->readback(formats, __size_formats);
   4984 	if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
   4985 	if (useChecksum) {
   4986 		unsigned char *checksumBufPtr = NULL;
   4987 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   4988 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   4989 		stream->readback(checksumBufPtr, checksumSize);
   4990 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   4991 			ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
   4992 			abort();
   4993 		}
   4994 	}
   4995 }
   4996 
   4997 void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
   4998 {
   4999 
   5000 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5001 	IOStream *stream = ctx->m_stream;
   5002 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5003 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5004 
   5005 	const unsigned int __size_string =  len;
   5006 	 unsigned char *ptr;
   5007 	 unsigned char *buf;
   5008 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4;
   5009 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5010 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5011 	buf = stream->alloc(totalSize);
   5012 	ptr = buf;
   5013 	int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
   5014 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5015 
   5016 		memcpy(ptr, &shader, 4); ptr += 4;
   5017 	*(unsigned int *)(ptr) = __size_string; ptr += 4;
   5018 	memcpy(ptr, string, __size_string);ptr += __size_string;
   5019 		memcpy(ptr, &len, 4); ptr += 4;
   5020 
   5021 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5022 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5023 
   5024 }
   5025 
   5026 int glFinishRoundTrip_enc(void *self )
   5027 {
   5028 
   5029 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5030 	IOStream *stream = ctx->m_stream;
   5031 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5032 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5033 
   5034 	 unsigned char *ptr;
   5035 	 unsigned char *buf;
   5036 	 const size_t sizeWithoutChecksum = 8;
   5037 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5038 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5039 	buf = stream->alloc(totalSize);
   5040 	ptr = buf;
   5041 	int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
   5042 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5043 
   5044 
   5045 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5046 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5047 
   5048 
   5049 	int retval;
   5050 	stream->readback(&retval, 4);
   5051 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   5052 	if (useChecksum) {
   5053 		unsigned char *checksumBufPtr = NULL;
   5054 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5055 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5056 		stream->readback(checksumBufPtr, checksumSize);
   5057 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5058 			ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
   5059 			abort();
   5060 		}
   5061 	}
   5062 	return retval;
   5063 }
   5064 
   5065 void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays)
   5066 {
   5067 
   5068 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5069 	IOStream *stream = ctx->m_stream;
   5070 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5071 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5072 
   5073 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
   5074 	 unsigned char *ptr;
   5075 	 unsigned char *buf;
   5076 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*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_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
   5082 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5083 
   5084 		memcpy(ptr, &n, 4); ptr += 4;
   5085 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
   5086 
   5087 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5088 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5089 
   5090 	stream->readback(arrays, __size_arrays);
   5091 	if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
   5092 	if (useChecksum) {
   5093 		unsigned char *checksumBufPtr = NULL;
   5094 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5095 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5096 		stream->readback(checksumBufPtr, checksumSize);
   5097 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5098 			ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n");
   5099 			abort();
   5100 		}
   5101 	}
   5102 }
   5103 
   5104 void glBindVertexArray_enc(void *self , GLuint array)
   5105 {
   5106 
   5107 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5108 	IOStream *stream = ctx->m_stream;
   5109 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5110 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5111 
   5112 	 unsigned char *ptr;
   5113 	 unsigned char *buf;
   5114 	 const size_t sizeWithoutChecksum = 8 + 4;
   5115 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5116 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5117 	buf = stream->alloc(totalSize);
   5118 	ptr = buf;
   5119 	int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
   5120 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5121 
   5122 		memcpy(ptr, &array, 4); ptr += 4;
   5123 
   5124 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5125 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5126 
   5127 }
   5128 
   5129 void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays)
   5130 {
   5131 
   5132 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5133 	IOStream *stream = ctx->m_stream;
   5134 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5135 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5136 
   5137 	const unsigned int __size_arrays =  (n * sizeof(GLuint));
   5138 	 unsigned char *ptr;
   5139 	 unsigned char *buf;
   5140 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
   5141 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5142 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5143 	buf = stream->alloc(totalSize);
   5144 	ptr = buf;
   5145 	int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
   5146 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5147 
   5148 		memcpy(ptr, &n, 4); ptr += 4;
   5149 	*(unsigned int *)(ptr) = __size_arrays; ptr += 4;
   5150 	memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
   5151 
   5152 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5153 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5154 
   5155 }
   5156 
   5157 GLboolean glIsVertexArray_enc(void *self , GLuint array)
   5158 {
   5159 
   5160 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5161 	IOStream *stream = ctx->m_stream;
   5162 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5163 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5164 
   5165 	 unsigned char *ptr;
   5166 	 unsigned char *buf;
   5167 	 const size_t sizeWithoutChecksum = 8 + 4;
   5168 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5169 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5170 	buf = stream->alloc(totalSize);
   5171 	ptr = buf;
   5172 	int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
   5173 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5174 
   5175 		memcpy(ptr, &array, 4); ptr += 4;
   5176 
   5177 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5178 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5179 
   5180 
   5181 	GLboolean retval;
   5182 	stream->readback(&retval, 1);
   5183 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   5184 	if (useChecksum) {
   5185 		unsigned char *checksumBufPtr = NULL;
   5186 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5187 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5188 		stream->readback(checksumBufPtr, checksumSize);
   5189 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5190 			ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n");
   5191 			abort();
   5192 		}
   5193 	}
   5194 	return retval;
   5195 }
   5196 
   5197 void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped)
   5198 {
   5199 
   5200 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5201 	IOStream *stream = ctx->m_stream;
   5202 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5203 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5204 
   5205 	const unsigned int __size_mapped = ((mapped != NULL) ?  length : 0);
   5206 	 unsigned char *ptr;
   5207 	 unsigned char *buf;
   5208 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
   5209 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5210 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5211 	buf = stream->alloc(totalSize);
   5212 	ptr = buf;
   5213 	int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5214 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5215 
   5216 		memcpy(ptr, &target, 4); ptr += 4;
   5217 		memcpy(ptr, &offset, 4); ptr += 4;
   5218 		memcpy(ptr, &length, 4); ptr += 4;
   5219 		memcpy(ptr, &access, 4); ptr += 4;
   5220 	*(unsigned int *)(ptr) = __size_mapped; ptr += 4;
   5221 
   5222 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5223 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5224 
   5225 	if (mapped != NULL) {
   5226 		stream->readback(mapped, __size_mapped);
   5227 		if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped);
   5228 	}
   5229 	if (useChecksum) {
   5230 		unsigned char *checksumBufPtr = NULL;
   5231 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5232 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5233 		stream->readback(checksumBufPtr, checksumSize);
   5234 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5235 			ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n");
   5236 			abort();
   5237 		}
   5238 	}
   5239 }
   5240 
   5241 void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
   5242 {
   5243 
   5244 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5245 	IOStream *stream = ctx->m_stream;
   5246 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5247 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5248 
   5249 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
   5250 	const unsigned int __size_out_res =  (sizeof(GLboolean));
   5251 	 unsigned char *ptr;
   5252 	 unsigned char *buf;
   5253 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4;
   5254 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5255 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5256 	buf = stream->alloc(totalSize);
   5257 	ptr = buf;
   5258 	int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5259 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5260 
   5261 		memcpy(ptr, &target, 4); ptr += 4;
   5262 		memcpy(ptr, &offset, 4); ptr += 4;
   5263 		memcpy(ptr, &length, 4); ptr += 4;
   5264 		memcpy(ptr, &access, 4); ptr += 4;
   5265 	*(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
   5266 	if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
   5267 	*(unsigned int *)(ptr) = __size_out_res; ptr += 4;
   5268 
   5269 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5270 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5271 
   5272 	stream->readback(out_res, __size_out_res);
   5273 	if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
   5274 	if (useChecksum) {
   5275 		unsigned char *checksumBufPtr = NULL;
   5276 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5277 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5278 		stream->readback(checksumBufPtr, checksumSize);
   5279 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5280 			ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n");
   5281 			abort();
   5282 		}
   5283 	}
   5284 }
   5285 
   5286 void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
   5287 {
   5288 
   5289 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5290 	IOStream *stream = ctx->m_stream;
   5291 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5292 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5293 
   5294 	const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ?  length : 0);
   5295 	 unsigned char *ptr;
   5296 	 unsigned char *buf;
   5297 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
   5298 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5299 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5300 	buf = stream->alloc(totalSize);
   5301 	ptr = buf;
   5302 	int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5303 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5304 
   5305 		memcpy(ptr, &target, 4); ptr += 4;
   5306 		memcpy(ptr, &offset, 4); ptr += 4;
   5307 		memcpy(ptr, &length, 4); ptr += 4;
   5308 		memcpy(ptr, &access, 4); ptr += 4;
   5309 	*(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
   5310 	if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
   5311 
   5312 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5313 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5314 
   5315 }
   5316 
   5317 void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
   5318 {
   5319 
   5320 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5321 	IOStream *stream = ctx->m_stream;
   5322 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5323 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5324 
   5325 	 unsigned char *ptr;
   5326 	 unsigned char *buf;
   5327 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   5328 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5329 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5330 	buf = stream->alloc(totalSize);
   5331 	ptr = buf;
   5332 	int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5333 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5334 
   5335 		memcpy(ptr, &x, 4); ptr += 4;
   5336 		memcpy(ptr, &y, 4); ptr += 4;
   5337 		memcpy(ptr, &width, 4); ptr += 4;
   5338 		memcpy(ptr, &height, 4); ptr += 4;
   5339 		memcpy(ptr, &format, 4); ptr += 4;
   5340 		memcpy(ptr, &type, 4); ptr += 4;
   5341 		memcpy(ptr, &offset, 4); ptr += 4;
   5342 
   5343 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5344 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5345 
   5346 }
   5347 
   5348 void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset)
   5349 {
   5350 
   5351 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5352 	IOStream *stream = ctx->m_stream;
   5353 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5354 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5355 
   5356 	 unsigned char *ptr;
   5357 	 unsigned char *buf;
   5358 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   5359 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5360 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5361 	buf = stream->alloc(totalSize);
   5362 	ptr = buf;
   5363 	int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5364 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5365 
   5366 		memcpy(ptr, &target, 4); ptr += 4;
   5367 		memcpy(ptr, &level, 4); ptr += 4;
   5368 		memcpy(ptr, &internalformat, 4); ptr += 4;
   5369 		memcpy(ptr, &width, 4); ptr += 4;
   5370 		memcpy(ptr, &height, 4); ptr += 4;
   5371 		memcpy(ptr, &border, 4); ptr += 4;
   5372 		memcpy(ptr, &imageSize, 4); ptr += 4;
   5373 		memcpy(ptr, &offset, 4); ptr += 4;
   5374 
   5375 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5376 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5377 
   5378 }
   5379 
   5380 void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset)
   5381 {
   5382 
   5383 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5384 	IOStream *stream = ctx->m_stream;
   5385 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5386 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5387 
   5388 	 unsigned char *ptr;
   5389 	 unsigned char *buf;
   5390 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   5391 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5392 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5393 	buf = stream->alloc(totalSize);
   5394 	ptr = buf;
   5395 	int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5396 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5397 
   5398 		memcpy(ptr, &target, 4); ptr += 4;
   5399 		memcpy(ptr, &level, 4); ptr += 4;
   5400 		memcpy(ptr, &xoffset, 4); ptr += 4;
   5401 		memcpy(ptr, &yoffset, 4); ptr += 4;
   5402 		memcpy(ptr, &width, 4); ptr += 4;
   5403 		memcpy(ptr, &height, 4); ptr += 4;
   5404 		memcpy(ptr, &format, 4); ptr += 4;
   5405 		memcpy(ptr, &imageSize, 4); ptr += 4;
   5406 		memcpy(ptr, &offset, 4); ptr += 4;
   5407 
   5408 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5409 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5410 
   5411 }
   5412 
   5413 void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset)
   5414 {
   5415 
   5416 	gl2_encoder_context_t *ctx = (gl2_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 + 4 + 4 + 4 + 4 + 4 + 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_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5429 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5430 
   5431 		memcpy(ptr, &target, 4); ptr += 4;
   5432 		memcpy(ptr, &level, 4); ptr += 4;
   5433 		memcpy(ptr, &internalformat, 4); ptr += 4;
   5434 		memcpy(ptr, &width, 4); ptr += 4;
   5435 		memcpy(ptr, &height, 4); ptr += 4;
   5436 		memcpy(ptr, &border, 4); ptr += 4;
   5437 		memcpy(ptr, &format, 4); ptr += 4;
   5438 		memcpy(ptr, &type, 4); ptr += 4;
   5439 		memcpy(ptr, &offset, 4); ptr += 4;
   5440 
   5441 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5442 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5443 
   5444 }
   5445 
   5446 void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
   5447 {
   5448 
   5449 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5450 	IOStream *stream = ctx->m_stream;
   5451 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5452 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5453 
   5454 	 unsigned char *ptr;
   5455 	 unsigned char *buf;
   5456 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   5457 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5458 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5459 	buf = stream->alloc(totalSize);
   5460 	ptr = buf;
   5461 	int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5462 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5463 
   5464 		memcpy(ptr, &target, 4); ptr += 4;
   5465 		memcpy(ptr, &level, 4); ptr += 4;
   5466 		memcpy(ptr, &xoffset, 4); ptr += 4;
   5467 		memcpy(ptr, &yoffset, 4); ptr += 4;
   5468 		memcpy(ptr, &width, 4); ptr += 4;
   5469 		memcpy(ptr, &height, 4); ptr += 4;
   5470 		memcpy(ptr, &format, 4); ptr += 4;
   5471 		memcpy(ptr, &type, 4); ptr += 4;
   5472 		memcpy(ptr, &offset, 4); ptr += 4;
   5473 
   5474 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5475 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5476 
   5477 }
   5478 
   5479 void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
   5480 {
   5481 
   5482 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5483 	IOStream *stream = ctx->m_stream;
   5484 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5485 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5486 
   5487 	 unsigned char *ptr;
   5488 	 unsigned char *buf;
   5489 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   5490 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5491 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5492 	buf = stream->alloc(totalSize);
   5493 	ptr = buf;
   5494 	int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4;
   5495 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5496 
   5497 		memcpy(ptr, &target, 4); ptr += 4;
   5498 		memcpy(ptr, &index, 4); ptr += 4;
   5499 		memcpy(ptr, &buffer, 4); ptr += 4;
   5500 		memcpy(ptr, &offset, 4); ptr += 4;
   5501 		memcpy(ptr, &size, 4); ptr += 4;
   5502 
   5503 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5504 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5505 
   5506 }
   5507 
   5508 void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer)
   5509 {
   5510 
   5511 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5512 	IOStream *stream = ctx->m_stream;
   5513 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5514 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5515 
   5516 	 unsigned char *ptr;
   5517 	 unsigned char *buf;
   5518 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   5519 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5520 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5521 	buf = stream->alloc(totalSize);
   5522 	ptr = buf;
   5523 	int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4;
   5524 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5525 
   5526 		memcpy(ptr, &target, 4); ptr += 4;
   5527 		memcpy(ptr, &index, 4); ptr += 4;
   5528 		memcpy(ptr, &buffer, 4); ptr += 4;
   5529 
   5530 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5531 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5532 
   5533 }
   5534 
   5535 void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
   5536 {
   5537 
   5538 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5539 	IOStream *stream = ctx->m_stream;
   5540 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5541 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5542 
   5543 	 unsigned char *ptr;
   5544 	 unsigned char *buf;
   5545 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   5546 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5547 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5548 	buf = stream->alloc(totalSize);
   5549 	ptr = buf;
   5550 	int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
   5551 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5552 
   5553 		memcpy(ptr, &readtarget, 4); ptr += 4;
   5554 		memcpy(ptr, &writetarget, 4); ptr += 4;
   5555 		memcpy(ptr, &readoffset, 4); ptr += 4;
   5556 		memcpy(ptr, &writeoffset, 4); ptr += 4;
   5557 		memcpy(ptr, &size, 4); ptr += 4;
   5558 
   5559 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5560 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5561 
   5562 	stream->flush();
   5563 }
   5564 
   5565 void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value)
   5566 {
   5567 
   5568 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5569 	IOStream *stream = ctx->m_stream;
   5570 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5571 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5572 
   5573 	const unsigned int __size_value =  (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer));
   5574 	 unsigned char *ptr;
   5575 	 unsigned char *buf;
   5576 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   5577 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5578 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5579 	buf = stream->alloc(totalSize);
   5580 	ptr = buf;
   5581 	int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4;
   5582 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5583 
   5584 		memcpy(ptr, &buffer, 4); ptr += 4;
   5585 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
   5586 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   5587 	memcpy(ptr, value, __size_value);ptr += __size_value;
   5588 
   5589 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5590 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5591 
   5592 }
   5593 
   5594 void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value)
   5595 {
   5596 
   5597 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5598 	IOStream *stream = ctx->m_stream;
   5599 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5600 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5601 
   5602 	const unsigned int __size_value =  (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer));
   5603 	 unsigned char *ptr;
   5604 	 unsigned char *buf;
   5605 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   5606 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5607 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5608 	buf = stream->alloc(totalSize);
   5609 	ptr = buf;
   5610 	int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4;
   5611 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5612 
   5613 		memcpy(ptr, &buffer, 4); ptr += 4;
   5614 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
   5615 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   5616 	memcpy(ptr, value, __size_value);ptr += __size_value;
   5617 
   5618 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5619 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5620 
   5621 }
   5622 
   5623 void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value)
   5624 {
   5625 
   5626 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5627 	IOStream *stream = ctx->m_stream;
   5628 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5629 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5630 
   5631 	const unsigned int __size_value =  (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer));
   5632 	 unsigned char *ptr;
   5633 	 unsigned char *buf;
   5634 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   5635 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5636 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5637 	buf = stream->alloc(totalSize);
   5638 	ptr = buf;
   5639 	int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4;
   5640 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5641 
   5642 		memcpy(ptr, &buffer, 4); ptr += 4;
   5643 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
   5644 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   5645 	memcpy(ptr, value, __size_value);ptr += __size_value;
   5646 
   5647 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5648 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5649 
   5650 }
   5651 
   5652 void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
   5653 {
   5654 
   5655 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5656 	IOStream *stream = ctx->m_stream;
   5657 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5658 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5659 
   5660 	 unsigned char *ptr;
   5661 	 unsigned char *buf;
   5662 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   5663 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5664 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5665 	buf = stream->alloc(totalSize);
   5666 	ptr = buf;
   5667 	int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4;
   5668 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5669 
   5670 		memcpy(ptr, &buffer, 4); ptr += 4;
   5671 		memcpy(ptr, &drawBuffer, 4); ptr += 4;
   5672 		memcpy(ptr, &depth, 4); ptr += 4;
   5673 		memcpy(ptr, &stencil, 4); ptr += 4;
   5674 
   5675 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5676 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5677 
   5678 }
   5679 
   5680 void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
   5681 {
   5682 
   5683 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5684 	IOStream *stream = ctx->m_stream;
   5685 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5686 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5687 
   5688 	 unsigned char *ptr;
   5689 	 unsigned char *buf;
   5690 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   5691 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5692 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5693 	buf = stream->alloc(totalSize);
   5694 	ptr = buf;
   5695 	int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4;
   5696 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5697 
   5698 		memcpy(ptr, &program, 4); ptr += 4;
   5699 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
   5700 		memcpy(ptr, &uniformBlockBinding, 4); ptr += 4;
   5701 
   5702 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5703 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5704 
   5705 }
   5706 
   5707 GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName)
   5708 {
   5709 
   5710 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5711 	IOStream *stream = ctx->m_stream;
   5712 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5713 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5714 
   5715 	const unsigned int __size_uniformBlockName =  (strlen(uniformBlockName) + 1);
   5716 	 unsigned char *ptr;
   5717 	 unsigned char *buf;
   5718 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4;
   5719 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5720 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5721 	buf = stream->alloc(totalSize);
   5722 	ptr = buf;
   5723 	int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4;
   5724 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5725 
   5726 		memcpy(ptr, &program, 4); ptr += 4;
   5727 	*(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
   5728 	memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName;
   5729 
   5730 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5731 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5732 
   5733 
   5734 	GLuint retval;
   5735 	stream->readback(&retval, 4);
   5736 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   5737 	if (useChecksum) {
   5738 		unsigned char *checksumBufPtr = NULL;
   5739 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5740 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5741 		stream->readback(checksumBufPtr, checksumSize);
   5742 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5743 			ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n");
   5744 			abort();
   5745 		}
   5746 	}
   5747 	return retval;
   5748 }
   5749 
   5750 void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices)
   5751 {
   5752 
   5753 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5754 	IOStream *stream = ctx->m_stream;
   5755 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5756 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5757 
   5758 	const unsigned int __size_packedUniformNames =  packedLen;
   5759 	const unsigned int __size_uniformIndices =  (uniformCount * sizeof(GLuint));
   5760 	 unsigned char *ptr;
   5761 	 unsigned char *buf;
   5762 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4;
   5763 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5764 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5765 	buf = stream->alloc(totalSize);
   5766 	ptr = buf;
   5767 	int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   5768 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5769 
   5770 		memcpy(ptr, &program, 4); ptr += 4;
   5771 		memcpy(ptr, &uniformCount, 4); ptr += 4;
   5772 	*(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4;
   5773 	memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames;
   5774 		memcpy(ptr, &packedLen, 4); ptr += 4;
   5775 	*(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
   5776 
   5777 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5778 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5779 
   5780 	stream->readback(uniformIndices, __size_uniformIndices);
   5781 	if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices);
   5782 	if (useChecksum) {
   5783 		unsigned char *checksumBufPtr = NULL;
   5784 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5785 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5786 		stream->readback(checksumBufPtr, checksumSize);
   5787 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5788 			ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n");
   5789 			abort();
   5790 		}
   5791 	}
   5792 }
   5793 
   5794 void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
   5795 {
   5796 
   5797 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5798 	IOStream *stream = ctx->m_stream;
   5799 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5800 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5801 
   5802 	const unsigned int __size_params =  (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint));
   5803 	 unsigned char *ptr;
   5804 	 unsigned char *buf;
   5805 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
   5806 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5807 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5808 	buf = stream->alloc(totalSize);
   5809 	ptr = buf;
   5810 	int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4;
   5811 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5812 
   5813 		memcpy(ptr, &program, 4); ptr += 4;
   5814 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
   5815 		memcpy(ptr, &pname, 4); ptr += 4;
   5816 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   5817 
   5818 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5819 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5820 
   5821 	stream->readback(params, __size_params);
   5822 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   5823 	if (useChecksum) {
   5824 		unsigned char *checksumBufPtr = NULL;
   5825 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5826 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5827 		stream->readback(checksumBufPtr, checksumSize);
   5828 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5829 			ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n");
   5830 			abort();
   5831 		}
   5832 	}
   5833 }
   5834 
   5835 void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
   5836 {
   5837 
   5838 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5839 	IOStream *stream = ctx->m_stream;
   5840 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5841 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5842 
   5843 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   5844 	const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ?  bufSize : 0);
   5845 	 unsigned char *ptr;
   5846 	 unsigned char *buf;
   5847 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4;
   5848 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5849 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5850 	buf = stream->alloc(totalSize);
   5851 	ptr = buf;
   5852 	int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4;
   5853 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5854 
   5855 		memcpy(ptr, &program, 4); ptr += 4;
   5856 		memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
   5857 		memcpy(ptr, &bufSize, 4); ptr += 4;
   5858 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   5859 	*(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
   5860 
   5861 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5862 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5863 
   5864 	if (length != NULL) {
   5865 		stream->readback(length, __size_length);
   5866 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   5867 	}
   5868 	if (uniformBlockName != NULL) {
   5869 		stream->readback(uniformBlockName, __size_uniformBlockName);
   5870 		if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName);
   5871 	}
   5872 	if (useChecksum) {
   5873 		unsigned char *checksumBufPtr = NULL;
   5874 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   5875 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   5876 		stream->readback(checksumBufPtr, checksumSize);
   5877 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   5878 			ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n");
   5879 			abort();
   5880 		}
   5881 	}
   5882 }
   5883 
   5884 void glUniform1ui_enc(void *self , GLint location, GLuint v0)
   5885 {
   5886 
   5887 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5888 	IOStream *stream = ctx->m_stream;
   5889 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5890 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5891 
   5892 	 unsigned char *ptr;
   5893 	 unsigned char *buf;
   5894 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   5895 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5896 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5897 	buf = stream->alloc(totalSize);
   5898 	ptr = buf;
   5899 	int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
   5900 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5901 
   5902 		memcpy(ptr, &location, 4); ptr += 4;
   5903 		memcpy(ptr, &v0, 4); ptr += 4;
   5904 
   5905 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5906 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5907 
   5908 }
   5909 
   5910 void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1)
   5911 {
   5912 
   5913 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5914 	IOStream *stream = ctx->m_stream;
   5915 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5916 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5917 
   5918 	 unsigned char *ptr;
   5919 	 unsigned char *buf;
   5920 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   5921 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5922 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5923 	buf = stream->alloc(totalSize);
   5924 	ptr = buf;
   5925 	int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
   5926 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5927 
   5928 		memcpy(ptr, &location, 4); ptr += 4;
   5929 		memcpy(ptr, &v0, 4); ptr += 4;
   5930 		memcpy(ptr, &v1, 4); ptr += 4;
   5931 
   5932 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5933 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5934 
   5935 }
   5936 
   5937 void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2)
   5938 {
   5939 
   5940 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5941 	IOStream *stream = ctx->m_stream;
   5942 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5943 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5944 
   5945 	 unsigned char *ptr;
   5946 	 unsigned char *buf;
   5947 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   5948 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5949 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5950 	buf = stream->alloc(totalSize);
   5951 	ptr = buf;
   5952 	int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
   5953 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5954 
   5955 		memcpy(ptr, &location, 4); ptr += 4;
   5956 		memcpy(ptr, &v0, 4); ptr += 4;
   5957 		memcpy(ptr, &v1, 4); ptr += 4;
   5958 		memcpy(ptr, &v2, 4); ptr += 4;
   5959 
   5960 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5961 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5962 
   5963 }
   5964 
   5965 void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3)
   5966 {
   5967 
   5968 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5969 	IOStream *stream = ctx->m_stream;
   5970 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   5971 	bool useChecksum = checksumCalculator->getVersion() > 0;
   5972 
   5973 	 unsigned char *ptr;
   5974 	 unsigned char *buf;
   5975 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   5976 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   5977 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   5978 	buf = stream->alloc(totalSize);
   5979 	ptr = buf;
   5980 	int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
   5981 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   5982 
   5983 		memcpy(ptr, &location, 4); ptr += 4;
   5984 		memcpy(ptr, &v0, 4); ptr += 4;
   5985 		memcpy(ptr, &v1, 4); ptr += 4;
   5986 		memcpy(ptr, &v2, 4); ptr += 4;
   5987 		memcpy(ptr, &v3, 4); ptr += 4;
   5988 
   5989 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   5990 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   5991 
   5992 }
   5993 
   5994 void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
   5995 {
   5996 
   5997 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   5998 	IOStream *stream = ctx->m_stream;
   5999 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6000 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6001 
   6002 	const unsigned int __size_value =  (count * sizeof(GLuint));
   6003 	 unsigned char *ptr;
   6004 	 unsigned char *buf;
   6005 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   6006 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6007 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6008 	buf = stream->alloc(totalSize);
   6009 	ptr = buf;
   6010 	int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6011 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6012 
   6013 		memcpy(ptr, &location, 4); ptr += 4;
   6014 		memcpy(ptr, &count, 4); ptr += 4;
   6015 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6016 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6017 
   6018 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6019 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6020 
   6021 }
   6022 
   6023 void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
   6024 {
   6025 
   6026 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6027 	IOStream *stream = ctx->m_stream;
   6028 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6029 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6030 
   6031 	const unsigned int __size_value =  (count * 2 * sizeof(GLuint));
   6032 	 unsigned char *ptr;
   6033 	 unsigned char *buf;
   6034 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   6035 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6036 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6037 	buf = stream->alloc(totalSize);
   6038 	ptr = buf;
   6039 	int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6040 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6041 
   6042 		memcpy(ptr, &location, 4); ptr += 4;
   6043 		memcpy(ptr, &count, 4); ptr += 4;
   6044 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6045 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6046 
   6047 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6048 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6049 
   6050 }
   6051 
   6052 void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
   6053 {
   6054 
   6055 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6056 	IOStream *stream = ctx->m_stream;
   6057 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6058 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6059 
   6060 	const unsigned int __size_value =  (count * 3 * sizeof(GLuint));
   6061 	 unsigned char *ptr;
   6062 	 unsigned char *buf;
   6063 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   6064 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6065 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6066 	buf = stream->alloc(totalSize);
   6067 	ptr = buf;
   6068 	int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6069 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6070 
   6071 		memcpy(ptr, &location, 4); ptr += 4;
   6072 		memcpy(ptr, &count, 4); ptr += 4;
   6073 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6074 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6075 
   6076 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6077 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6078 
   6079 }
   6080 
   6081 void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
   6082 {
   6083 
   6084 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6085 	IOStream *stream = ctx->m_stream;
   6086 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6087 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6088 
   6089 	const unsigned int __size_value =  (count * 4 * sizeof(GLuint));
   6090 	 unsigned char *ptr;
   6091 	 unsigned char *buf;
   6092 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
   6093 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6094 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6095 	buf = stream->alloc(totalSize);
   6096 	ptr = buf;
   6097 	int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6098 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6099 
   6100 		memcpy(ptr, &location, 4); ptr += 4;
   6101 		memcpy(ptr, &count, 4); ptr += 4;
   6102 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6103 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6104 
   6105 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6106 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6107 
   6108 }
   6109 
   6110 void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6111 {
   6112 
   6113 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6114 	IOStream *stream = ctx->m_stream;
   6115 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6116 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6117 
   6118 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
   6119 	 unsigned char *ptr;
   6120 	 unsigned char *buf;
   6121 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6122 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6123 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6124 	buf = stream->alloc(totalSize);
   6125 	ptr = buf;
   6126 	int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6127 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6128 
   6129 		memcpy(ptr, &location, 4); ptr += 4;
   6130 		memcpy(ptr, &count, 4); ptr += 4;
   6131 		memcpy(ptr, &transpose, 1); ptr += 1;
   6132 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6133 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6134 
   6135 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6136 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6137 
   6138 }
   6139 
   6140 void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6141 {
   6142 
   6143 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6144 	IOStream *stream = ctx->m_stream;
   6145 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6146 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6147 
   6148 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
   6149 	 unsigned char *ptr;
   6150 	 unsigned char *buf;
   6151 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6152 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6153 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6154 	buf = stream->alloc(totalSize);
   6155 	ptr = buf;
   6156 	int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6157 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6158 
   6159 		memcpy(ptr, &location, 4); ptr += 4;
   6160 		memcpy(ptr, &count, 4); ptr += 4;
   6161 		memcpy(ptr, &transpose, 1); ptr += 1;
   6162 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6163 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6164 
   6165 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6166 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6167 
   6168 }
   6169 
   6170 void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6171 {
   6172 
   6173 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6174 	IOStream *stream = ctx->m_stream;
   6175 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6176 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6177 
   6178 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
   6179 	 unsigned char *ptr;
   6180 	 unsigned char *buf;
   6181 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6182 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6183 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6184 	buf = stream->alloc(totalSize);
   6185 	ptr = buf;
   6186 	int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6187 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6188 
   6189 		memcpy(ptr, &location, 4); ptr += 4;
   6190 		memcpy(ptr, &count, 4); ptr += 4;
   6191 		memcpy(ptr, &transpose, 1); ptr += 1;
   6192 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6193 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6194 
   6195 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6196 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6197 
   6198 }
   6199 
   6200 void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6201 {
   6202 
   6203 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6204 	IOStream *stream = ctx->m_stream;
   6205 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6206 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6207 
   6208 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
   6209 	 unsigned char *ptr;
   6210 	 unsigned char *buf;
   6211 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6212 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6213 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6214 	buf = stream->alloc(totalSize);
   6215 	ptr = buf;
   6216 	int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6217 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6218 
   6219 		memcpy(ptr, &location, 4); ptr += 4;
   6220 		memcpy(ptr, &count, 4); ptr += 4;
   6221 		memcpy(ptr, &transpose, 1); ptr += 1;
   6222 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6223 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6224 
   6225 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6226 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6227 
   6228 }
   6229 
   6230 void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6231 {
   6232 
   6233 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6234 	IOStream *stream = ctx->m_stream;
   6235 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6236 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6237 
   6238 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
   6239 	 unsigned char *ptr;
   6240 	 unsigned char *buf;
   6241 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6242 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6243 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6244 	buf = stream->alloc(totalSize);
   6245 	ptr = buf;
   6246 	int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6247 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6248 
   6249 		memcpy(ptr, &location, 4); ptr += 4;
   6250 		memcpy(ptr, &count, 4); ptr += 4;
   6251 		memcpy(ptr, &transpose, 1); ptr += 1;
   6252 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6253 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6254 
   6255 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6256 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6257 
   6258 }
   6259 
   6260 void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   6261 {
   6262 
   6263 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6264 	IOStream *stream = ctx->m_stream;
   6265 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6266 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6267 
   6268 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
   6269 	 unsigned char *ptr;
   6270 	 unsigned char *buf;
   6271 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
   6272 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6273 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6274 	buf = stream->alloc(totalSize);
   6275 	ptr = buf;
   6276 	int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   6277 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6278 
   6279 		memcpy(ptr, &location, 4); ptr += 4;
   6280 		memcpy(ptr, &count, 4); ptr += 4;
   6281 		memcpy(ptr, &transpose, 1); ptr += 1;
   6282 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   6283 	memcpy(ptr, value, __size_value);ptr += __size_value;
   6284 
   6285 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6286 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6287 
   6288 }
   6289 
   6290 void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params)
   6291 {
   6292 
   6293 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6294 	IOStream *stream = ctx->m_stream;
   6295 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6296 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6297 
   6298 	const unsigned int __size_params =  glSizeof(glesv2_enc::uniformType(self, program, location));
   6299 	 unsigned char *ptr;
   6300 	 unsigned char *buf;
   6301 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   6302 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6303 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6304 	buf = stream->alloc(totalSize);
   6305 	ptr = buf;
   6306 	int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6307 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6308 
   6309 		memcpy(ptr, &program, 4); ptr += 4;
   6310 		memcpy(ptr, &location, 4); ptr += 4;
   6311 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   6312 
   6313 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6314 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6315 
   6316 	stream->readback(params, __size_params);
   6317 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   6318 	if (useChecksum) {
   6319 		unsigned char *checksumBufPtr = NULL;
   6320 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6321 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6322 		stream->readback(checksumBufPtr, checksumSize);
   6323 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6324 			ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n");
   6325 			abort();
   6326 		}
   6327 	}
   6328 }
   6329 
   6330 void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
   6331 {
   6332 
   6333 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6334 	IOStream *stream = ctx->m_stream;
   6335 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6336 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6337 
   6338 	const unsigned int __size_uniformIndices =  (uniformCount * sizeof(GLuint));
   6339 	const unsigned int __size_params =  (uniformCount * sizeof(GLint));
   6340 	 unsigned char *ptr;
   6341 	 unsigned char *buf;
   6342 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4;
   6343 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6344 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6345 	buf = stream->alloc(totalSize);
   6346 	ptr = buf;
   6347 	int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6348 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6349 
   6350 		memcpy(ptr, &program, 4); ptr += 4;
   6351 		memcpy(ptr, &uniformCount, 4); ptr += 4;
   6352 	*(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
   6353 	memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices;
   6354 		memcpy(ptr, &pname, 4); ptr += 4;
   6355 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   6356 
   6357 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6358 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6359 
   6360 	stream->readback(params, __size_params);
   6361 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   6362 	if (useChecksum) {
   6363 		unsigned char *checksumBufPtr = NULL;
   6364 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6365 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6366 		stream->readback(checksumBufPtr, checksumSize);
   6367 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6368 			ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n");
   6369 			abort();
   6370 		}
   6371 	}
   6372 }
   6373 
   6374 void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3)
   6375 {
   6376 
   6377 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6378 	IOStream *stream = ctx->m_stream;
   6379 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6380 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6381 
   6382 	 unsigned char *ptr;
   6383 	 unsigned char *buf;
   6384 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   6385 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6386 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6387 	buf = stream->alloc(totalSize);
   6388 	ptr = buf;
   6389 	int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4;
   6390 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6391 
   6392 		memcpy(ptr, &index, 4); ptr += 4;
   6393 		memcpy(ptr, &v0, 4); ptr += 4;
   6394 		memcpy(ptr, &v1, 4); ptr += 4;
   6395 		memcpy(ptr, &v2, 4); ptr += 4;
   6396 		memcpy(ptr, &v3, 4); ptr += 4;
   6397 
   6398 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6399 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6400 
   6401 }
   6402 
   6403 void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
   6404 {
   6405 
   6406 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6407 	IOStream *stream = ctx->m_stream;
   6408 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6409 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6410 
   6411 	 unsigned char *ptr;
   6412 	 unsigned char *buf;
   6413 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   6414 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6415 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6416 	buf = stream->alloc(totalSize);
   6417 	ptr = buf;
   6418 	int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4;
   6419 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6420 
   6421 		memcpy(ptr, &index, 4); ptr += 4;
   6422 		memcpy(ptr, &v0, 4); ptr += 4;
   6423 		memcpy(ptr, &v1, 4); ptr += 4;
   6424 		memcpy(ptr, &v2, 4); ptr += 4;
   6425 		memcpy(ptr, &v3, 4); ptr += 4;
   6426 
   6427 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6428 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6429 
   6430 }
   6431 
   6432 void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v)
   6433 {
   6434 
   6435 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6436 	IOStream *stream = ctx->m_stream;
   6437 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6438 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6439 
   6440 	const unsigned int __size_v =  (4 * sizeof(GLint));
   6441 	 unsigned char *ptr;
   6442 	 unsigned char *buf;
   6443 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
   6444 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6445 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6446 	buf = stream->alloc(totalSize);
   6447 	ptr = buf;
   6448 	int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4;
   6449 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6450 
   6451 		memcpy(ptr, &index, 4); ptr += 4;
   6452 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   6453 	memcpy(ptr, v, __size_v);ptr += __size_v;
   6454 
   6455 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6456 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6457 
   6458 }
   6459 
   6460 void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v)
   6461 {
   6462 
   6463 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6464 	IOStream *stream = ctx->m_stream;
   6465 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6466 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6467 
   6468 	const unsigned int __size_v =  (4 * sizeof(GLuint));
   6469 	 unsigned char *ptr;
   6470 	 unsigned char *buf;
   6471 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
   6472 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6473 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6474 	buf = stream->alloc(totalSize);
   6475 	ptr = buf;
   6476 	int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6477 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6478 
   6479 		memcpy(ptr, &index, 4); ptr += 4;
   6480 	*(unsigned int *)(ptr) = __size_v; ptr += 4;
   6481 	memcpy(ptr, v, __size_v);ptr += __size_v;
   6482 
   6483 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6484 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6485 
   6486 }
   6487 
   6488 void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset)
   6489 {
   6490 
   6491 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6492 	IOStream *stream = ctx->m_stream;
   6493 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6494 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6495 
   6496 	 unsigned char *ptr;
   6497 	 unsigned char *buf;
   6498 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   6499 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6500 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6501 	buf = stream->alloc(totalSize);
   6502 	ptr = buf;
   6503 	int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6504 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6505 
   6506 		memcpy(ptr, &index, 4); ptr += 4;
   6507 		memcpy(ptr, &size, 4); ptr += 4;
   6508 		memcpy(ptr, &type, 4); ptr += 4;
   6509 		memcpy(ptr, &stride, 4); ptr += 4;
   6510 		memcpy(ptr, &offset, 4); ptr += 4;
   6511 
   6512 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6513 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6514 
   6515 }
   6516 
   6517 void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
   6518 {
   6519 
   6520 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6521 	IOStream *stream = ctx->m_stream;
   6522 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6523 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6524 
   6525 	const unsigned int __size_data =  datalen;
   6526 	 unsigned char *ptr;
   6527 	 unsigned char *buf;
   6528 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
   6529 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6530 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6531 	buf = stream->alloc(totalSize);
   6532 	ptr = buf;
   6533 	int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6534 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6535 
   6536 		memcpy(ptr, &index, 4); ptr += 4;
   6537 		memcpy(ptr, &size, 4); ptr += 4;
   6538 		memcpy(ptr, &type, 4); ptr += 4;
   6539 		memcpy(ptr, &stride, 4); ptr += 4;
   6540 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   6541 	 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
   6542 		memcpy(ptr, &datalen, 4); ptr += 4;
   6543 
   6544 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6545 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6546 
   6547 }
   6548 
   6549 void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
   6550 {
   6551 
   6552 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6553 	IOStream *stream = ctx->m_stream;
   6554 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6555 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6556 
   6557 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   6558 	 unsigned char *ptr;
   6559 	 unsigned char *buf;
   6560 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   6561 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6562 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6563 	buf = stream->alloc(totalSize);
   6564 	ptr = buf;
   6565 	int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6566 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6567 
   6568 		memcpy(ptr, &index, 4); ptr += 4;
   6569 		memcpy(ptr, &pname, 4); ptr += 4;
   6570 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   6571 
   6572 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6573 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6574 
   6575 	stream->readback(params, __size_params);
   6576 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   6577 	if (useChecksum) {
   6578 		unsigned char *checksumBufPtr = NULL;
   6579 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6580 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6581 		stream->readback(checksumBufPtr, checksumSize);
   6582 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6583 			ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n");
   6584 			abort();
   6585 		}
   6586 	}
   6587 }
   6588 
   6589 void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params)
   6590 {
   6591 
   6592 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6593 	IOStream *stream = ctx->m_stream;
   6594 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6595 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6596 
   6597 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLuint));
   6598 	 unsigned char *ptr;
   6599 	 unsigned char *buf;
   6600 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*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_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4;
   6606 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6607 
   6608 		memcpy(ptr, &index, 4); ptr += 4;
   6609 		memcpy(ptr, &pname, 4); ptr += 4;
   6610 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   6611 
   6612 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6613 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6614 
   6615 	stream->readback(params, __size_params);
   6616 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   6617 	if (useChecksum) {
   6618 		unsigned char *checksumBufPtr = NULL;
   6619 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6620 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6621 		stream->readback(checksumBufPtr, checksumSize);
   6622 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6623 			ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n");
   6624 			abort();
   6625 		}
   6626 	}
   6627 }
   6628 
   6629 void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor)
   6630 {
   6631 
   6632 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6633 	IOStream *stream = ctx->m_stream;
   6634 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6635 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6636 
   6637 	 unsigned char *ptr;
   6638 	 unsigned char *buf;
   6639 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   6640 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6641 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6642 	buf = stream->alloc(totalSize);
   6643 	ptr = buf;
   6644 	int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
   6645 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6646 
   6647 		memcpy(ptr, &index, 4); ptr += 4;
   6648 		memcpy(ptr, &divisor, 4); ptr += 4;
   6649 
   6650 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6651 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6652 
   6653 }
   6654 
   6655 void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount)
   6656 {
   6657 
   6658 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6659 	IOStream *stream = ctx->m_stream;
   6660 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6661 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6662 
   6663 	 unsigned char *ptr;
   6664 	 unsigned char *buf;
   6665 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   6666 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6667 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6668 	buf = stream->alloc(totalSize);
   6669 	ptr = buf;
   6670 	int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4;
   6671 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6672 
   6673 		memcpy(ptr, &mode, 4); ptr += 4;
   6674 		memcpy(ptr, &first, 4); ptr += 4;
   6675 		memcpy(ptr, &count, 4); ptr += 4;
   6676 		memcpy(ptr, &primcount, 4); ptr += 4;
   6677 
   6678 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6679 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6680 
   6681 }
   6682 
   6683 void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen)
   6684 {
   6685 
   6686 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6687 	IOStream *stream = ctx->m_stream;
   6688 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6689 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6690 
   6691 	const unsigned int __size_indices =  datalen;
   6692 	 unsigned char *ptr;
   6693 	 unsigned char *buf;
   6694 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*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_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6700 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6701 
   6702 		memcpy(ptr, &mode, 4); ptr += 4;
   6703 		memcpy(ptr, &count, 4); ptr += 4;
   6704 		memcpy(ptr, &type, 4); ptr += 4;
   6705 	*(unsigned int *)(ptr) = __size_indices; ptr += 4;
   6706 	memcpy(ptr, indices, __size_indices);ptr += __size_indices;
   6707 		memcpy(ptr, &primcount, 4); ptr += 4;
   6708 		memcpy(ptr, &datalen, 4); ptr += 4;
   6709 
   6710 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6711 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6712 
   6713 }
   6714 
   6715 void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount)
   6716 {
   6717 
   6718 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6719 	IOStream *stream = ctx->m_stream;
   6720 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6721 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6722 
   6723 	 unsigned char *ptr;
   6724 	 unsigned char *buf;
   6725 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   6726 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6727 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6728 	buf = stream->alloc(totalSize);
   6729 	ptr = buf;
   6730 	int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6731 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6732 
   6733 		memcpy(ptr, &mode, 4); ptr += 4;
   6734 		memcpy(ptr, &count, 4); ptr += 4;
   6735 		memcpy(ptr, &type, 4); ptr += 4;
   6736 		memcpy(ptr, &offset, 4); ptr += 4;
   6737 		memcpy(ptr, &primcount, 4); ptr += 4;
   6738 
   6739 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6740 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6741 
   6742 }
   6743 
   6744 void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen)
   6745 {
   6746 
   6747 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6748 	IOStream *stream = ctx->m_stream;
   6749 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6750 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6751 
   6752 	const unsigned int __size_indices =  datalen;
   6753 	 unsigned char *ptr;
   6754 	 unsigned char *buf;
   6755 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4;
   6756 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6757 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6758 	buf = stream->alloc(totalSize);
   6759 	ptr = buf;
   6760 	int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6761 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6762 
   6763 		memcpy(ptr, &mode, 4); ptr += 4;
   6764 		memcpy(ptr, &start, 4); ptr += 4;
   6765 		memcpy(ptr, &end, 4); ptr += 4;
   6766 		memcpy(ptr, &count, 4); ptr += 4;
   6767 		memcpy(ptr, &type, 4); ptr += 4;
   6768 	*(unsigned int *)(ptr) = __size_indices; ptr += 4;
   6769 	memcpy(ptr, indices, __size_indices);ptr += __size_indices;
   6770 		memcpy(ptr, &datalen, 4); ptr += 4;
   6771 
   6772 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6773 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6774 
   6775 }
   6776 
   6777 void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset)
   6778 {
   6779 
   6780 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6781 	IOStream *stream = ctx->m_stream;
   6782 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6783 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6784 
   6785 	 unsigned char *ptr;
   6786 	 unsigned char *buf;
   6787 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   6788 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6789 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6790 	buf = stream->alloc(totalSize);
   6791 	ptr = buf;
   6792 	int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6793 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6794 
   6795 		memcpy(ptr, &mode, 4); ptr += 4;
   6796 		memcpy(ptr, &start, 4); ptr += 4;
   6797 		memcpy(ptr, &end, 4); ptr += 4;
   6798 		memcpy(ptr, &count, 4); ptr += 4;
   6799 		memcpy(ptr, &type, 4); ptr += 4;
   6800 		memcpy(ptr, &offset, 4); ptr += 4;
   6801 
   6802 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6803 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6804 
   6805 }
   6806 
   6807 uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
   6808 {
   6809 
   6810 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6811 	IOStream *stream = ctx->m_stream;
   6812 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6813 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6814 
   6815 	 unsigned char *ptr;
   6816 	 unsigned char *buf;
   6817 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   6818 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6819 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6820 	buf = stream->alloc(totalSize);
   6821 	ptr = buf;
   6822 	int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6823 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6824 
   6825 		memcpy(ptr, &condition, 4); ptr += 4;
   6826 		memcpy(ptr, &flags, 4); ptr += 4;
   6827 
   6828 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6829 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6830 
   6831 
   6832 	uint64_t retval;
   6833 	stream->readback(&retval, 8);
   6834 	if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
   6835 	if (useChecksum) {
   6836 		unsigned char *checksumBufPtr = NULL;
   6837 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6838 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6839 		stream->readback(checksumBufPtr, checksumSize);
   6840 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6841 			ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
   6842 			abort();
   6843 		}
   6844 	}
   6845 	return retval;
   6846 }
   6847 
   6848 GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
   6849 {
   6850 
   6851 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6852 	IOStream *stream = ctx->m_stream;
   6853 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6854 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6855 
   6856 	 unsigned char *ptr;
   6857 	 unsigned char *buf;
   6858 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
   6859 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6860 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6861 	buf = stream->alloc(totalSize);
   6862 	ptr = buf;
   6863 	int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6864 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6865 
   6866 		memcpy(ptr, &wait_on, 8); ptr += 8;
   6867 		memcpy(ptr, &flags, 4); ptr += 4;
   6868 		memcpy(ptr, &timeout, 8); ptr += 8;
   6869 
   6870 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6871 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6872 
   6873 
   6874 	GLenum retval;
   6875 	stream->readback(&retval, 4);
   6876 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   6877 	if (useChecksum) {
   6878 		unsigned char *checksumBufPtr = NULL;
   6879 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6880 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6881 		stream->readback(checksumBufPtr, checksumSize);
   6882 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6883 			ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
   6884 			abort();
   6885 		}
   6886 	}
   6887 	return retval;
   6888 }
   6889 
   6890 void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
   6891 {
   6892 
   6893 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6894 	IOStream *stream = ctx->m_stream;
   6895 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6896 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6897 
   6898 	 unsigned char *ptr;
   6899 	 unsigned char *buf;
   6900 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
   6901 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6902 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6903 	buf = stream->alloc(totalSize);
   6904 	ptr = buf;
   6905 	int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6906 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6907 
   6908 		memcpy(ptr, &wait_on, 8); ptr += 8;
   6909 		memcpy(ptr, &flags, 4); ptr += 4;
   6910 		memcpy(ptr, &timeout, 8); ptr += 8;
   6911 
   6912 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6913 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6914 
   6915 }
   6916 
   6917 void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
   6918 {
   6919 
   6920 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6921 	IOStream *stream = ctx->m_stream;
   6922 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6923 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6924 
   6925 	 unsigned char *ptr;
   6926 	 unsigned char *buf;
   6927 	 const size_t sizeWithoutChecksum = 8 + 8;
   6928 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6929 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6930 	buf = stream->alloc(totalSize);
   6931 	ptr = buf;
   6932 	int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6933 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6934 
   6935 		memcpy(ptr, &to_delete, 8); ptr += 8;
   6936 
   6937 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6938 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6939 
   6940 }
   6941 
   6942 GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
   6943 {
   6944 
   6945 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6946 	IOStream *stream = ctx->m_stream;
   6947 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6948 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6949 
   6950 	 unsigned char *ptr;
   6951 	 unsigned char *buf;
   6952 	 const size_t sizeWithoutChecksum = 8 + 8;
   6953 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6954 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6955 	buf = stream->alloc(totalSize);
   6956 	ptr = buf;
   6957 	int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   6958 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   6959 
   6960 		memcpy(ptr, &sync, 8); ptr += 8;
   6961 
   6962 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   6963 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   6964 
   6965 
   6966 	GLboolean retval;
   6967 	stream->readback(&retval, 1);
   6968 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   6969 	if (useChecksum) {
   6970 		unsigned char *checksumBufPtr = NULL;
   6971 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   6972 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   6973 		stream->readback(checksumBufPtr, checksumSize);
   6974 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   6975 			ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
   6976 			abort();
   6977 		}
   6978 	}
   6979 	return retval;
   6980 }
   6981 
   6982 void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
   6983 {
   6984 
   6985 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   6986 	IOStream *stream = ctx->m_stream;
   6987 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   6988 	bool useChecksum = checksumCalculator->getVersion() > 0;
   6989 
   6990 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   6991 	const unsigned int __size_values =  (bufSize * sizeof(GLint));
   6992 	 unsigned char *ptr;
   6993 	 unsigned char *buf;
   6994 	 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4;
   6995 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   6996 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   6997 	buf = stream->alloc(totalSize);
   6998 	ptr = buf;
   6999 	int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   7000 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7001 
   7002 		memcpy(ptr, &sync, 8); ptr += 8;
   7003 		memcpy(ptr, &pname, 4); ptr += 4;
   7004 		memcpy(ptr, &bufSize, 4); ptr += 4;
   7005 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   7006 	*(unsigned int *)(ptr) = __size_values; ptr += 4;
   7007 
   7008 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7009 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7010 
   7011 	if (length != NULL) {
   7012 		stream->readback(length, __size_length);
   7013 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   7014 	}
   7015 	stream->readback(values, __size_values);
   7016 	if (useChecksum) checksumCalculator->addBuffer(values, __size_values);
   7017 	if (useChecksum) {
   7018 		unsigned char *checksumBufPtr = NULL;
   7019 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7020 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7021 		stream->readback(checksumBufPtr, checksumSize);
   7022 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7023 			ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
   7024 			abort();
   7025 		}
   7026 	}
   7027 }
   7028 
   7029 void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs)
   7030 {
   7031 
   7032 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7033 	IOStream *stream = ctx->m_stream;
   7034 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7035 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7036 
   7037 	const unsigned int __size_bufs =  (n * sizeof(GLenum));
   7038 	 unsigned char *ptr;
   7039 	 unsigned char *buf;
   7040 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4;
   7041 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7042 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7043 	buf = stream->alloc(totalSize);
   7044 	ptr = buf;
   7045 	int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
   7046 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7047 
   7048 		memcpy(ptr, &n, 4); ptr += 4;
   7049 	*(unsigned int *)(ptr) = __size_bufs; ptr += 4;
   7050 	memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs;
   7051 
   7052 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7053 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7054 
   7055 }
   7056 
   7057 void glReadBuffer_enc(void *self , GLenum src)
   7058 {
   7059 
   7060 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7061 	IOStream *stream = ctx->m_stream;
   7062 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7063 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7064 
   7065 	 unsigned char *ptr;
   7066 	 unsigned char *buf;
   7067 	 const size_t sizeWithoutChecksum = 8 + 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_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   7073 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7074 
   7075 		memcpy(ptr, &src, 4); ptr += 4;
   7076 
   7077 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7078 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7079 
   7080 }
   7081 
   7082 void glBlitFramebuffer_enc(void *self , GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
   7083 {
   7084 
   7085 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7086 	IOStream *stream = ctx->m_stream;
   7087 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7088 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7089 
   7090 	 unsigned char *ptr;
   7091 	 unsigned char *buf;
   7092 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   7093 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7094 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7095 	buf = stream->alloc(totalSize);
   7096 	ptr = buf;
   7097 	int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   7098 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7099 
   7100 		memcpy(ptr, &srcX0, 4); ptr += 4;
   7101 		memcpy(ptr, &srcY0, 4); ptr += 4;
   7102 		memcpy(ptr, &srcX1, 4); ptr += 4;
   7103 		memcpy(ptr, &srcY1, 4); ptr += 4;
   7104 		memcpy(ptr, &dstX0, 4); ptr += 4;
   7105 		memcpy(ptr, &dstY0, 4); ptr += 4;
   7106 		memcpy(ptr, &dstX1, 4); ptr += 4;
   7107 		memcpy(ptr, &dstY1, 4); ptr += 4;
   7108 		memcpy(ptr, &mask, 4); ptr += 4;
   7109 		memcpy(ptr, &filter, 4); ptr += 4;
   7110 
   7111 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7112 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7113 
   7114 }
   7115 
   7116 void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
   7117 {
   7118 
   7119 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7120 	IOStream *stream = ctx->m_stream;
   7121 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7122 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7123 
   7124 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
   7125 	 unsigned char *ptr;
   7126 	 unsigned char *buf;
   7127 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
   7128 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7129 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7130 	buf = stream->alloc(totalSize);
   7131 	ptr = buf;
   7132 	int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   7133 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7134 
   7135 		memcpy(ptr, &target, 4); ptr += 4;
   7136 		memcpy(ptr, &numAttachments, 4); ptr += 4;
   7137 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
   7138 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
   7139 
   7140 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7141 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7142 
   7143 }
   7144 
   7145 void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
   7146 {
   7147 
   7148 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7149 	IOStream *stream = ctx->m_stream;
   7150 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7151 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7152 
   7153 	const unsigned int __size_attachments =  (numAttachments * sizeof(GLenum));
   7154 	 unsigned char *ptr;
   7155 	 unsigned char *buf;
   7156 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4;
   7157 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7158 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7159 	buf = stream->alloc(totalSize);
   7160 	ptr = buf;
   7161 	int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   7162 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7163 
   7164 		memcpy(ptr, &target, 4); ptr += 4;
   7165 		memcpy(ptr, &numAttachments, 4); ptr += 4;
   7166 	*(unsigned int *)(ptr) = __size_attachments; ptr += 4;
   7167 	memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
   7168 		memcpy(ptr, &x, 4); ptr += 4;
   7169 		memcpy(ptr, &y, 4); ptr += 4;
   7170 		memcpy(ptr, &width, 4); ptr += 4;
   7171 		memcpy(ptr, &height, 4); ptr += 4;
   7172 
   7173 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7174 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7175 
   7176 }
   7177 
   7178 void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
   7179 {
   7180 
   7181 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7182 	IOStream *stream = ctx->m_stream;
   7183 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7184 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7185 
   7186 	 unsigned char *ptr;
   7187 	 unsigned char *buf;
   7188 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   7189 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7190 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7191 	buf = stream->alloc(totalSize);
   7192 	ptr = buf;
   7193 	int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4;
   7194 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7195 
   7196 		memcpy(ptr, &target, 4); ptr += 4;
   7197 		memcpy(ptr, &attachment, 4); ptr += 4;
   7198 		memcpy(ptr, &texture, 4); ptr += 4;
   7199 		memcpy(ptr, &level, 4); ptr += 4;
   7200 		memcpy(ptr, &layer, 4); ptr += 4;
   7201 
   7202 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7203 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7204 
   7205 }
   7206 
   7207 void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
   7208 {
   7209 
   7210 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7211 	IOStream *stream = ctx->m_stream;
   7212 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7213 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7214 
   7215 	 unsigned char *ptr;
   7216 	 unsigned char *buf;
   7217 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   7218 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7219 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7220 	buf = stream->alloc(totalSize);
   7221 	ptr = buf;
   7222 	int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
   7223 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7224 
   7225 		memcpy(ptr, &target, 4); ptr += 4;
   7226 		memcpy(ptr, &samples, 4); ptr += 4;
   7227 		memcpy(ptr, &internalformat, 4); ptr += 4;
   7228 		memcpy(ptr, &width, 4); ptr += 4;
   7229 		memcpy(ptr, &height, 4); ptr += 4;
   7230 
   7231 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7232 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7233 
   7234 }
   7235 
   7236 void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
   7237 {
   7238 
   7239 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7240 	IOStream *stream = ctx->m_stream;
   7241 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7242 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7243 
   7244 	 unsigned char *ptr;
   7245 	 unsigned char *buf;
   7246 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   7247 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7248 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7249 	buf = stream->alloc(totalSize);
   7250 	ptr = buf;
   7251 	int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4;
   7252 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7253 
   7254 		memcpy(ptr, &target, 4); ptr += 4;
   7255 		memcpy(ptr, &levels, 4); ptr += 4;
   7256 		memcpy(ptr, &internalformat, 4); ptr += 4;
   7257 		memcpy(ptr, &width, 4); ptr += 4;
   7258 		memcpy(ptr, &height, 4); ptr += 4;
   7259 
   7260 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7261 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7262 
   7263 }
   7264 
   7265 void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
   7266 {
   7267 
   7268 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7269 	IOStream *stream = ctx->m_stream;
   7270 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7271 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7272 
   7273 	const unsigned int __size_params =  (sizeof(GLint) * bufSize);
   7274 	 unsigned char *ptr;
   7275 	 unsigned char *buf;
   7276 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
   7277 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7278 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7279 	buf = stream->alloc(totalSize);
   7280 	ptr = buf;
   7281 	int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4;
   7282 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7283 
   7284 		memcpy(ptr, &target, 4); ptr += 4;
   7285 		memcpy(ptr, &internalformat, 4); ptr += 4;
   7286 		memcpy(ptr, &pname, 4); ptr += 4;
   7287 		memcpy(ptr, &bufSize, 4); ptr += 4;
   7288 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   7289 
   7290 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7291 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7292 
   7293 	stream->readback(params, __size_params);
   7294 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   7295 	if (useChecksum) {
   7296 		unsigned char *checksumBufPtr = NULL;
   7297 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7298 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7299 		stream->readback(checksumBufPtr, checksumSize);
   7300 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7301 			ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n");
   7302 			abort();
   7303 		}
   7304 	}
   7305 }
   7306 
   7307 void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode)
   7308 {
   7309 
   7310 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7311 	IOStream *stream = ctx->m_stream;
   7312 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7313 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7314 
   7315 	 unsigned char *ptr;
   7316 	 unsigned char *buf;
   7317 	 const size_t sizeWithoutChecksum = 8 + 4;
   7318 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7319 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7320 	buf = stream->alloc(totalSize);
   7321 	ptr = buf;
   7322 	int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7323 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7324 
   7325 		memcpy(ptr, &primitiveMode, 4); ptr += 4;
   7326 
   7327 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7328 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7329 
   7330 }
   7331 
   7332 void glEndTransformFeedback_enc(void *self )
   7333 {
   7334 
   7335 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7336 	IOStream *stream = ctx->m_stream;
   7337 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7338 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7339 
   7340 	 unsigned char *ptr;
   7341 	 unsigned char *buf;
   7342 	 const size_t sizeWithoutChecksum = 8;
   7343 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7344 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7345 	buf = stream->alloc(totalSize);
   7346 	ptr = buf;
   7347 	int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7348 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7349 
   7350 
   7351 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7352 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7353 
   7354 }
   7355 
   7356 void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids)
   7357 {
   7358 
   7359 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7360 	IOStream *stream = ctx->m_stream;
   7361 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7362 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7363 
   7364 	const unsigned int __size_ids =  (n * sizeof(GLuint));
   7365 	 unsigned char *ptr;
   7366 	 unsigned char *buf;
   7367 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   7368 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7369 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7370 	buf = stream->alloc(totalSize);
   7371 	ptr = buf;
   7372 	int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
   7373 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7374 
   7375 		memcpy(ptr, &n, 4); ptr += 4;
   7376 	*(unsigned int *)(ptr) = __size_ids; ptr += 4;
   7377 
   7378 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7379 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7380 
   7381 	stream->readback(ids, __size_ids);
   7382 	if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids);
   7383 	if (useChecksum) {
   7384 		unsigned char *checksumBufPtr = NULL;
   7385 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7386 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7387 		stream->readback(checksumBufPtr, checksumSize);
   7388 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7389 			ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n");
   7390 			abort();
   7391 		}
   7392 	}
   7393 }
   7394 
   7395 void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids)
   7396 {
   7397 
   7398 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7399 	IOStream *stream = ctx->m_stream;
   7400 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7401 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7402 
   7403 	const unsigned int __size_ids =  (n * sizeof(GLuint));
   7404 	 unsigned char *ptr;
   7405 	 unsigned char *buf;
   7406 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4;
   7407 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7408 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7409 	buf = stream->alloc(totalSize);
   7410 	ptr = buf;
   7411 	int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
   7412 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7413 
   7414 		memcpy(ptr, &n, 4); ptr += 4;
   7415 	*(unsigned int *)(ptr) = __size_ids; ptr += 4;
   7416 	memcpy(ptr, ids, __size_ids);ptr += __size_ids;
   7417 
   7418 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7419 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7420 
   7421 }
   7422 
   7423 void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id)
   7424 {
   7425 
   7426 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7427 	IOStream *stream = ctx->m_stream;
   7428 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7429 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7430 
   7431 	 unsigned char *ptr;
   7432 	 unsigned char *buf;
   7433 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   7434 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7435 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7436 	buf = stream->alloc(totalSize);
   7437 	ptr = buf;
   7438 	int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7439 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7440 
   7441 		memcpy(ptr, &target, 4); ptr += 4;
   7442 		memcpy(ptr, &id, 4); ptr += 4;
   7443 
   7444 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7445 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7446 
   7447 }
   7448 
   7449 void glPauseTransformFeedback_enc(void *self )
   7450 {
   7451 
   7452 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7453 	IOStream *stream = ctx->m_stream;
   7454 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7455 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7456 
   7457 	 unsigned char *ptr;
   7458 	 unsigned char *buf;
   7459 	 const size_t sizeWithoutChecksum = 8;
   7460 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7461 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7462 	buf = stream->alloc(totalSize);
   7463 	ptr = buf;
   7464 	int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7465 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7466 
   7467 
   7468 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7469 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7470 
   7471 }
   7472 
   7473 void glResumeTransformFeedback_enc(void *self )
   7474 {
   7475 
   7476 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7477 	IOStream *stream = ctx->m_stream;
   7478 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7479 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7480 
   7481 	 unsigned char *ptr;
   7482 	 unsigned char *buf;
   7483 	 const size_t sizeWithoutChecksum = 8;
   7484 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7485 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7486 	buf = stream->alloc(totalSize);
   7487 	ptr = buf;
   7488 	int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7489 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7490 
   7491 
   7492 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7493 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7494 
   7495 }
   7496 
   7497 GLboolean glIsTransformFeedback_enc(void *self , GLuint id)
   7498 {
   7499 
   7500 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7501 	IOStream *stream = ctx->m_stream;
   7502 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7503 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7504 
   7505 	 unsigned char *ptr;
   7506 	 unsigned char *buf;
   7507 	 const size_t sizeWithoutChecksum = 8 + 4;
   7508 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7509 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7510 	buf = stream->alloc(totalSize);
   7511 	ptr = buf;
   7512 	int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
   7513 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7514 
   7515 		memcpy(ptr, &id, 4); ptr += 4;
   7516 
   7517 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7518 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7519 
   7520 
   7521 	GLboolean retval;
   7522 	stream->readback(&retval, 1);
   7523 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   7524 	if (useChecksum) {
   7525 		unsigned char *checksumBufPtr = NULL;
   7526 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7527 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7528 		stream->readback(checksumBufPtr, checksumSize);
   7529 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7530 			ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n");
   7531 			abort();
   7532 		}
   7533 	}
   7534 	return retval;
   7535 }
   7536 
   7537 void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode)
   7538 {
   7539 
   7540 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7541 	IOStream *stream = ctx->m_stream;
   7542 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7543 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7544 
   7545 	const unsigned int __size_packedVaryings =  packedVaryingsLen;
   7546 	 unsigned char *ptr;
   7547 	 unsigned char *buf;
   7548 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4;
   7549 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7550 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7551 	buf = stream->alloc(totalSize);
   7552 	ptr = buf;
   7553 	int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   7554 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7555 
   7556 		memcpy(ptr, &program, 4); ptr += 4;
   7557 		memcpy(ptr, &count, 4); ptr += 4;
   7558 	*(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4;
   7559 	memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings;
   7560 		memcpy(ptr, &packedVaryingsLen, 4); ptr += 4;
   7561 		memcpy(ptr, &bufferMode, 4); ptr += 4;
   7562 
   7563 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7564 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7565 
   7566 }
   7567 
   7568 void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name)
   7569 {
   7570 
   7571 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7572 	IOStream *stream = ctx->m_stream;
   7573 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7574 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7575 
   7576 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   7577 	const unsigned int __size_size =  (sizeof(GLsizei));
   7578 	const unsigned int __size_type = ((type != NULL) ?  (sizeof(GLenum)) : 0);
   7579 	const unsigned int __size_name = ((name != NULL) ?  bufSize : 0);
   7580 	 unsigned char *ptr;
   7581 	 unsigned char *buf;
   7582 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
   7583 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7584 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7585 	buf = stream->alloc(totalSize);
   7586 	ptr = buf;
   7587 	int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4;
   7588 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7589 
   7590 		memcpy(ptr, &program, 4); ptr += 4;
   7591 		memcpy(ptr, &index, 4); ptr += 4;
   7592 		memcpy(ptr, &bufSize, 4); ptr += 4;
   7593 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   7594 	*(unsigned int *)(ptr) = __size_size; ptr += 4;
   7595 	*(unsigned int *)(ptr) = __size_type; ptr += 4;
   7596 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   7597 
   7598 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7599 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7600 
   7601 	if (length != NULL) {
   7602 		stream->readback(length, __size_length);
   7603 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   7604 	}
   7605 	stream->readback(size, __size_size);
   7606 	if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
   7607 	if (type != NULL) {
   7608 		stream->readback(type, __size_type);
   7609 		if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
   7610 	}
   7611 	if (name != NULL) {
   7612 		stream->readback(name, __size_name);
   7613 		if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
   7614 	}
   7615 	if (useChecksum) {
   7616 		unsigned char *checksumBufPtr = NULL;
   7617 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7618 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7619 		stream->readback(checksumBufPtr, checksumSize);
   7620 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7621 			ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n");
   7622 			abort();
   7623 		}
   7624 	}
   7625 }
   7626 
   7627 void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers)
   7628 {
   7629 
   7630 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7631 	IOStream *stream = ctx->m_stream;
   7632 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7633 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7634 
   7635 	const unsigned int __size_samplers =  (n * sizeof(GLuint));
   7636 	 unsigned char *ptr;
   7637 	 unsigned char *buf;
   7638 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   7639 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7640 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7641 	buf = stream->alloc(totalSize);
   7642 	ptr = buf;
   7643 	int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
   7644 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7645 
   7646 		memcpy(ptr, &n, 4); ptr += 4;
   7647 	*(unsigned int *)(ptr) = __size_samplers; ptr += 4;
   7648 
   7649 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7650 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7651 
   7652 	stream->readback(samplers, __size_samplers);
   7653 	if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers);
   7654 	if (useChecksum) {
   7655 		unsigned char *checksumBufPtr = NULL;
   7656 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7657 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7658 		stream->readback(checksumBufPtr, checksumSize);
   7659 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7660 			ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n");
   7661 			abort();
   7662 		}
   7663 	}
   7664 }
   7665 
   7666 void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers)
   7667 {
   7668 
   7669 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7670 	IOStream *stream = ctx->m_stream;
   7671 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7672 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7673 
   7674 	const unsigned int __size_samplers =  (n * sizeof(GLuint));
   7675 	 unsigned char *ptr;
   7676 	 unsigned char *buf;
   7677 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4;
   7678 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7679 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7680 	buf = stream->alloc(totalSize);
   7681 	ptr = buf;
   7682 	int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
   7683 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7684 
   7685 		memcpy(ptr, &n, 4); ptr += 4;
   7686 	*(unsigned int *)(ptr) = __size_samplers; ptr += 4;
   7687 	memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers;
   7688 
   7689 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7690 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7691 
   7692 }
   7693 
   7694 void glBindSampler_enc(void *self , GLuint unit, GLuint sampler)
   7695 {
   7696 
   7697 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7698 	IOStream *stream = ctx->m_stream;
   7699 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7700 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7701 
   7702 	 unsigned char *ptr;
   7703 	 unsigned char *buf;
   7704 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   7705 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7706 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7707 	buf = stream->alloc(totalSize);
   7708 	ptr = buf;
   7709 	int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4;
   7710 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7711 
   7712 		memcpy(ptr, &unit, 4); ptr += 4;
   7713 		memcpy(ptr, &sampler, 4); ptr += 4;
   7714 
   7715 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7716 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7717 
   7718 }
   7719 
   7720 void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param)
   7721 {
   7722 
   7723 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7724 	IOStream *stream = ctx->m_stream;
   7725 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7726 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7727 
   7728 	 unsigned char *ptr;
   7729 	 unsigned char *buf;
   7730 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   7731 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7732 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7733 	buf = stream->alloc(totalSize);
   7734 	ptr = buf;
   7735 	int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
   7736 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7737 
   7738 		memcpy(ptr, &sampler, 4); ptr += 4;
   7739 		memcpy(ptr, &pname, 4); ptr += 4;
   7740 		memcpy(ptr, &param, 4); ptr += 4;
   7741 
   7742 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7743 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7744 
   7745 }
   7746 
   7747 void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param)
   7748 {
   7749 
   7750 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7751 	IOStream *stream = ctx->m_stream;
   7752 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7753 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7754 
   7755 	 unsigned char *ptr;
   7756 	 unsigned char *buf;
   7757 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   7758 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7759 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7760 	buf = stream->alloc(totalSize);
   7761 	ptr = buf;
   7762 	int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
   7763 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7764 
   7765 		memcpy(ptr, &sampler, 4); ptr += 4;
   7766 		memcpy(ptr, &pname, 4); ptr += 4;
   7767 		memcpy(ptr, &param, 4); ptr += 4;
   7768 
   7769 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7770 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7771 
   7772 }
   7773 
   7774 void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params)
   7775 {
   7776 
   7777 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7778 	IOStream *stream = ctx->m_stream;
   7779 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7780 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7781 
   7782 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   7783 	 unsigned char *ptr;
   7784 	 unsigned char *buf;
   7785 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
   7786 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7787 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7788 	buf = stream->alloc(totalSize);
   7789 	ptr = buf;
   7790 	int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
   7791 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7792 
   7793 		memcpy(ptr, &sampler, 4); ptr += 4;
   7794 		memcpy(ptr, &pname, 4); ptr += 4;
   7795 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   7796 	memcpy(ptr, params, __size_params);ptr += __size_params;
   7797 
   7798 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7799 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7800 
   7801 }
   7802 
   7803 void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params)
   7804 {
   7805 
   7806 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7807 	IOStream *stream = ctx->m_stream;
   7808 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7809 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7810 
   7811 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   7812 	 unsigned char *ptr;
   7813 	 unsigned char *buf;
   7814 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
   7815 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7816 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7817 	buf = stream->alloc(totalSize);
   7818 	ptr = buf;
   7819 	int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   7820 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7821 
   7822 		memcpy(ptr, &sampler, 4); ptr += 4;
   7823 		memcpy(ptr, &pname, 4); ptr += 4;
   7824 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   7825 	memcpy(ptr, params, __size_params);ptr += __size_params;
   7826 
   7827 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7828 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7829 
   7830 }
   7831 
   7832 void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params)
   7833 {
   7834 
   7835 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7836 	IOStream *stream = ctx->m_stream;
   7837 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7838 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7839 
   7840 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   7841 	 unsigned char *ptr;
   7842 	 unsigned char *buf;
   7843 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   7844 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7845 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7846 	buf = stream->alloc(totalSize);
   7847 	ptr = buf;
   7848 	int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
   7849 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7850 
   7851 		memcpy(ptr, &sampler, 4); ptr += 4;
   7852 		memcpy(ptr, &pname, 4); ptr += 4;
   7853 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   7854 
   7855 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7856 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7857 
   7858 	stream->readback(params, __size_params);
   7859 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   7860 	if (useChecksum) {
   7861 		unsigned char *checksumBufPtr = NULL;
   7862 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7863 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7864 		stream->readback(checksumBufPtr, checksumSize);
   7865 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7866 			ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n");
   7867 			abort();
   7868 		}
   7869 	}
   7870 }
   7871 
   7872 void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params)
   7873 {
   7874 
   7875 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7876 	IOStream *stream = ctx->m_stream;
   7877 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7878 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7879 
   7880 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   7881 	 unsigned char *ptr;
   7882 	 unsigned char *buf;
   7883 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   7884 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7885 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7886 	buf = stream->alloc(totalSize);
   7887 	ptr = buf;
   7888 	int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   7889 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7890 
   7891 		memcpy(ptr, &sampler, 4); ptr += 4;
   7892 		memcpy(ptr, &pname, 4); ptr += 4;
   7893 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   7894 
   7895 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7896 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7897 
   7898 	stream->readback(params, __size_params);
   7899 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   7900 	if (useChecksum) {
   7901 		unsigned char *checksumBufPtr = NULL;
   7902 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7903 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7904 		stream->readback(checksumBufPtr, checksumSize);
   7905 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7906 			ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n");
   7907 			abort();
   7908 		}
   7909 	}
   7910 }
   7911 
   7912 GLboolean glIsSampler_enc(void *self , GLuint sampler)
   7913 {
   7914 
   7915 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7916 	IOStream *stream = ctx->m_stream;
   7917 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7918 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7919 
   7920 	 unsigned char *ptr;
   7921 	 unsigned char *buf;
   7922 	 const size_t sizeWithoutChecksum = 8 + 4;
   7923 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7924 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7925 	buf = stream->alloc(totalSize);
   7926 	ptr = buf;
   7927 	int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4;
   7928 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7929 
   7930 		memcpy(ptr, &sampler, 4); ptr += 4;
   7931 
   7932 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7933 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7934 
   7935 
   7936 	GLboolean retval;
   7937 	stream->readback(&retval, 1);
   7938 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   7939 	if (useChecksum) {
   7940 		unsigned char *checksumBufPtr = NULL;
   7941 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7942 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7943 		stream->readback(checksumBufPtr, checksumSize);
   7944 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7945 			ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n");
   7946 			abort();
   7947 		}
   7948 	}
   7949 	return retval;
   7950 }
   7951 
   7952 void glGenQueries_enc(void *self , GLsizei n, GLuint* queries)
   7953 {
   7954 
   7955 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7956 	IOStream *stream = ctx->m_stream;
   7957 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7958 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7959 
   7960 	const unsigned int __size_queries =  (n * sizeof(GLuint));
   7961 	 unsigned char *ptr;
   7962 	 unsigned char *buf;
   7963 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   7964 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   7965 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   7966 	buf = stream->alloc(totalSize);
   7967 	ptr = buf;
   7968 	int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4;
   7969 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   7970 
   7971 		memcpy(ptr, &n, 4); ptr += 4;
   7972 	*(unsigned int *)(ptr) = __size_queries; ptr += 4;
   7973 
   7974 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   7975 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   7976 
   7977 	stream->readback(queries, __size_queries);
   7978 	if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries);
   7979 	if (useChecksum) {
   7980 		unsigned char *checksumBufPtr = NULL;
   7981 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   7982 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   7983 		stream->readback(checksumBufPtr, checksumSize);
   7984 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   7985 			ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n");
   7986 			abort();
   7987 		}
   7988 	}
   7989 }
   7990 
   7991 void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries)
   7992 {
   7993 
   7994 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   7995 	IOStream *stream = ctx->m_stream;
   7996 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   7997 	bool useChecksum = checksumCalculator->getVersion() > 0;
   7998 
   7999 	const unsigned int __size_queries =  (n * sizeof(GLuint));
   8000 	 unsigned char *ptr;
   8001 	 unsigned char *buf;
   8002 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*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_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4;
   8008 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8009 
   8010 		memcpy(ptr, &n, 4); ptr += 4;
   8011 	*(unsigned int *)(ptr) = __size_queries; ptr += 4;
   8012 	memcpy(ptr, queries, __size_queries);ptr += __size_queries;
   8013 
   8014 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8015 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8016 
   8017 }
   8018 
   8019 void glBeginQuery_enc(void *self , GLenum target, GLuint query)
   8020 {
   8021 
   8022 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8023 	IOStream *stream = ctx->m_stream;
   8024 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8025 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8026 
   8027 	 unsigned char *ptr;
   8028 	 unsigned char *buf;
   8029 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   8030 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8031 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8032 	buf = stream->alloc(totalSize);
   8033 	ptr = buf;
   8034 	int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4;
   8035 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8036 
   8037 		memcpy(ptr, &target, 4); ptr += 4;
   8038 		memcpy(ptr, &query, 4); ptr += 4;
   8039 
   8040 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8041 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8042 
   8043 }
   8044 
   8045 void glEndQuery_enc(void *self , GLenum target)
   8046 {
   8047 
   8048 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8049 	IOStream *stream = ctx->m_stream;
   8050 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8051 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8052 
   8053 	 unsigned char *ptr;
   8054 	 unsigned char *buf;
   8055 	 const size_t sizeWithoutChecksum = 8 + 4;
   8056 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8057 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8058 	buf = stream->alloc(totalSize);
   8059 	ptr = buf;
   8060 	int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4;
   8061 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8062 
   8063 		memcpy(ptr, &target, 4); ptr += 4;
   8064 
   8065 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8066 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8067 
   8068 }
   8069 
   8070 void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params)
   8071 {
   8072 
   8073 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8074 	IOStream *stream = ctx->m_stream;
   8075 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8076 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8077 
   8078 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   8079 	 unsigned char *ptr;
   8080 	 unsigned char *buf;
   8081 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   8082 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8083 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8084 	buf = stream->alloc(totalSize);
   8085 	ptr = buf;
   8086 	int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4;
   8087 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8088 
   8089 		memcpy(ptr, &target, 4); ptr += 4;
   8090 		memcpy(ptr, &pname, 4); ptr += 4;
   8091 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   8092 
   8093 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8094 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8095 
   8096 	stream->readback(params, __size_params);
   8097 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   8098 	if (useChecksum) {
   8099 		unsigned char *checksumBufPtr = NULL;
   8100 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8101 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8102 		stream->readback(checksumBufPtr, checksumSize);
   8103 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8104 			ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n");
   8105 			abort();
   8106 		}
   8107 	}
   8108 }
   8109 
   8110 void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params)
   8111 {
   8112 
   8113 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8114 	IOStream *stream = ctx->m_stream;
   8115 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8116 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8117 
   8118 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLuint));
   8119 	 unsigned char *ptr;
   8120 	 unsigned char *buf;
   8121 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   8122 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8123 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8124 	buf = stream->alloc(totalSize);
   8125 	ptr = buf;
   8126 	int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4;
   8127 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8128 
   8129 		memcpy(ptr, &query, 4); ptr += 4;
   8130 		memcpy(ptr, &pname, 4); ptr += 4;
   8131 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   8132 
   8133 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8134 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8135 
   8136 	stream->readback(params, __size_params);
   8137 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   8138 	if (useChecksum) {
   8139 		unsigned char *checksumBufPtr = NULL;
   8140 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8141 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8142 		stream->readback(checksumBufPtr, checksumSize);
   8143 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8144 			ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n");
   8145 			abort();
   8146 		}
   8147 	}
   8148 }
   8149 
   8150 GLboolean glIsQuery_enc(void *self , GLuint query)
   8151 {
   8152 
   8153 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8154 	IOStream *stream = ctx->m_stream;
   8155 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8156 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8157 
   8158 	 unsigned char *ptr;
   8159 	 unsigned char *buf;
   8160 	 const size_t sizeWithoutChecksum = 8 + 4;
   8161 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8162 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8163 	buf = stream->alloc(totalSize);
   8164 	ptr = buf;
   8165 	int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4;
   8166 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8167 
   8168 		memcpy(ptr, &query, 4); ptr += 4;
   8169 
   8170 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8171 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8172 
   8173 
   8174 	GLboolean retval;
   8175 	stream->readback(&retval, 1);
   8176 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   8177 	if (useChecksum) {
   8178 		unsigned char *checksumBufPtr = NULL;
   8179 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8180 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8181 		stream->readback(checksumBufPtr, checksumSize);
   8182 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8183 			ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n");
   8184 			abort();
   8185 		}
   8186 	}
   8187 	return retval;
   8188 }
   8189 
   8190 void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value)
   8191 {
   8192 
   8193 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8194 	IOStream *stream = ctx->m_stream;
   8195 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8196 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8197 
   8198 	 unsigned char *ptr;
   8199 	 unsigned char *buf;
   8200 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   8201 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8202 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8203 	buf = stream->alloc(totalSize);
   8204 	ptr = buf;
   8205 	int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
   8206 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8207 
   8208 		memcpy(ptr, &program, 4); ptr += 4;
   8209 		memcpy(ptr, &pname, 4); ptr += 4;
   8210 		memcpy(ptr, &value, 4); ptr += 4;
   8211 
   8212 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8213 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8214 
   8215 }
   8216 
   8217 void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length)
   8218 {
   8219 
   8220 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8221 	IOStream *stream = ctx->m_stream;
   8222 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8223 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8224 
   8225 	const unsigned int __size_binary =  length;
   8226 	 unsigned char *ptr;
   8227 	 unsigned char *buf;
   8228 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4;
   8229 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8230 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8231 	buf = stream->alloc(totalSize);
   8232 	ptr = buf;
   8233 	int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
   8234 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8235 
   8236 		memcpy(ptr, &program, 4); ptr += 4;
   8237 		memcpy(ptr, &binaryFormat, 4); ptr += 4;
   8238 	*(unsigned int *)(ptr) = __size_binary; ptr += 4;
   8239 	memcpy(ptr, binary, __size_binary);ptr += __size_binary;
   8240 		memcpy(ptr, &length, 4); ptr += 4;
   8241 
   8242 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8243 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8244 
   8245 }
   8246 
   8247 void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary)
   8248 {
   8249 
   8250 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8251 	IOStream *stream = ctx->m_stream;
   8252 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8253 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8254 
   8255 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   8256 	const unsigned int __size_binaryFormat =  (sizeof(GLenum));
   8257 	const unsigned int __size_binary =  bufSize;
   8258 	 unsigned char *ptr;
   8259 	 unsigned char *buf;
   8260 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4;
   8261 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8262 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8263 	buf = stream->alloc(totalSize);
   8264 	ptr = buf;
   8265 	int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
   8266 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8267 
   8268 		memcpy(ptr, &program, 4); ptr += 4;
   8269 		memcpy(ptr, &bufSize, 4); ptr += 4;
   8270 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   8271 	*(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4;
   8272 	*(unsigned int *)(ptr) = __size_binary; ptr += 4;
   8273 
   8274 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8275 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8276 
   8277 	if (length != NULL) {
   8278 		stream->readback(length, __size_length);
   8279 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   8280 	}
   8281 	stream->readback(binaryFormat, __size_binaryFormat);
   8282 	if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat);
   8283 	stream->readback(binary, __size_binary);
   8284 	if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary);
   8285 	if (useChecksum) {
   8286 		unsigned char *checksumBufPtr = NULL;
   8287 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8288 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8289 		stream->readback(checksumBufPtr, checksumSize);
   8290 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8291 			ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n");
   8292 			abort();
   8293 		}
   8294 	}
   8295 }
   8296 
   8297 GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name)
   8298 {
   8299 
   8300 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8301 	IOStream *stream = ctx->m_stream;
   8302 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8303 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8304 
   8305 	const unsigned int __size_name =  (strlen(name) + 1);
   8306 	 unsigned char *ptr;
   8307 	 unsigned char *buf;
   8308 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
   8309 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8310 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8311 	buf = stream->alloc(totalSize);
   8312 	ptr = buf;
   8313 	int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4;
   8314 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8315 
   8316 		memcpy(ptr, &program, 4); ptr += 4;
   8317 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   8318 	memcpy(ptr, name, __size_name);ptr += __size_name;
   8319 
   8320 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8321 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8322 
   8323 
   8324 	GLint retval;
   8325 	stream->readback(&retval, 4);
   8326 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   8327 	if (useChecksum) {
   8328 		unsigned char *checksumBufPtr = NULL;
   8329 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8330 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8331 		stream->readback(checksumBufPtr, checksumSize);
   8332 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8333 			ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n");
   8334 			abort();
   8335 		}
   8336 	}
   8337 	return retval;
   8338 }
   8339 
   8340 void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data)
   8341 {
   8342 
   8343 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8344 	IOStream *stream = ctx->m_stream;
   8345 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8346 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8347 
   8348 	const unsigned int __size_data =  (glUtilsParamSize(pname) * sizeof(GLint64));
   8349 	 unsigned char *ptr;
   8350 	 unsigned char *buf;
   8351 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   8352 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8353 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8354 	buf = stream->alloc(totalSize);
   8355 	ptr = buf;
   8356 	int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4;
   8357 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8358 
   8359 		memcpy(ptr, &pname, 4); ptr += 4;
   8360 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   8361 
   8362 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8363 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8364 
   8365 	stream->readback(data, __size_data);
   8366 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8367 	if (useChecksum) {
   8368 		unsigned char *checksumBufPtr = NULL;
   8369 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8370 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8371 		stream->readback(checksumBufPtr, checksumSize);
   8372 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8373 			ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n");
   8374 			abort();
   8375 		}
   8376 	}
   8377 }
   8378 
   8379 void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data)
   8380 {
   8381 
   8382 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8383 	IOStream *stream = ctx->m_stream;
   8384 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8385 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8386 
   8387 	const unsigned int __size_data =  (sizeof(GLint));
   8388 	 unsigned char *ptr;
   8389 	 unsigned char *buf;
   8390 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   8391 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8392 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8393 	buf = stream->alloc(totalSize);
   8394 	ptr = buf;
   8395 	int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4;
   8396 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8397 
   8398 		memcpy(ptr, &target, 4); ptr += 4;
   8399 		memcpy(ptr, &index, 4); ptr += 4;
   8400 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   8401 
   8402 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8403 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8404 
   8405 	stream->readback(data, __size_data);
   8406 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8407 	if (useChecksum) {
   8408 		unsigned char *checksumBufPtr = NULL;
   8409 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8410 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8411 		stream->readback(checksumBufPtr, checksumSize);
   8412 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8413 			ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n");
   8414 			abort();
   8415 		}
   8416 	}
   8417 }
   8418 
   8419 void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data)
   8420 {
   8421 
   8422 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8423 	IOStream *stream = ctx->m_stream;
   8424 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8425 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8426 
   8427 	const unsigned int __size_data =  (sizeof(GLint64));
   8428 	 unsigned char *ptr;
   8429 	 unsigned char *buf;
   8430 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   8431 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8432 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8433 	buf = stream->alloc(totalSize);
   8434 	ptr = buf;
   8435 	int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4;
   8436 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8437 
   8438 		memcpy(ptr, &target, 4); ptr += 4;
   8439 		memcpy(ptr, &index, 4); ptr += 4;
   8440 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   8441 
   8442 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8443 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8444 
   8445 	stream->readback(data, __size_data);
   8446 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8447 	if (useChecksum) {
   8448 		unsigned char *checksumBufPtr = NULL;
   8449 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8450 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8451 		stream->readback(checksumBufPtr, checksumSize);
   8452 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8453 			ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n");
   8454 			abort();
   8455 		}
   8456 	}
   8457 }
   8458 
   8459 void glTexImage3D_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data)
   8460 {
   8461 
   8462 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8463 	IOStream *stream = ctx->m_stream;
   8464 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8465 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8466 
   8467 	const unsigned int __size_data = ((data != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
   8468 	 unsigned char *ptr;
   8469 	 unsigned char *buf;
   8470 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   8471 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8472 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8473 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   8474 	ptr = buf;
   8475 	int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8476 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8477 
   8478 		memcpy(ptr, &target, 4); ptr += 4;
   8479 		memcpy(ptr, &level, 4); ptr += 4;
   8480 		memcpy(ptr, &internalFormat, 4); ptr += 4;
   8481 		memcpy(ptr, &width, 4); ptr += 4;
   8482 		memcpy(ptr, &height, 4); ptr += 4;
   8483 		memcpy(ptr, &depth, 4); ptr += 4;
   8484 		memcpy(ptr, &border, 4); ptr += 4;
   8485 		memcpy(ptr, &format, 4); ptr += 4;
   8486 		memcpy(ptr, &type, 4); ptr += 4;
   8487 
   8488 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8489 	stream->flush();
   8490 	stream->writeFully(&__size_data,4);
   8491 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   8492 	if (data != NULL) {
   8493 		stream->writeFully(data, __size_data);
   8494 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8495 	}
   8496 	buf = stream->alloc(checksumSize);
   8497 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   8498 
   8499 }
   8500 
   8501 void glTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLuint offset)
   8502 {
   8503 
   8504 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8505 	IOStream *stream = ctx->m_stream;
   8506 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8507 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8508 
   8509 	 unsigned char *ptr;
   8510 	 unsigned char *buf;
   8511 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   8512 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8513 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8514 	buf = stream->alloc(totalSize);
   8515 	ptr = buf;
   8516 	int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   8517 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8518 
   8519 		memcpy(ptr, &target, 4); ptr += 4;
   8520 		memcpy(ptr, &level, 4); ptr += 4;
   8521 		memcpy(ptr, &internalFormat, 4); ptr += 4;
   8522 		memcpy(ptr, &width, 4); ptr += 4;
   8523 		memcpy(ptr, &height, 4); ptr += 4;
   8524 		memcpy(ptr, &depth, 4); ptr += 4;
   8525 		memcpy(ptr, &border, 4); ptr += 4;
   8526 		memcpy(ptr, &format, 4); ptr += 4;
   8527 		memcpy(ptr, &type, 4); ptr += 4;
   8528 		memcpy(ptr, &offset, 4); ptr += 4;
   8529 
   8530 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8531 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8532 
   8533 }
   8534 
   8535 void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
   8536 {
   8537 
   8538 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8539 	IOStream *stream = ctx->m_stream;
   8540 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8541 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8542 
   8543 	 unsigned char *ptr;
   8544 	 unsigned char *buf;
   8545 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   8546 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8547 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8548 	buf = stream->alloc(totalSize);
   8549 	ptr = buf;
   8550 	int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8551 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8552 
   8553 		memcpy(ptr, &target, 4); ptr += 4;
   8554 		memcpy(ptr, &levels, 4); ptr += 4;
   8555 		memcpy(ptr, &internalformat, 4); ptr += 4;
   8556 		memcpy(ptr, &width, 4); ptr += 4;
   8557 		memcpy(ptr, &height, 4); ptr += 4;
   8558 		memcpy(ptr, &depth, 4); ptr += 4;
   8559 
   8560 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8561 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8562 
   8563 }
   8564 
   8565 void glTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data)
   8566 {
   8567 
   8568 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8569 	IOStream *stream = ctx->m_stream;
   8570 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8571 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8572 
   8573 	const unsigned int __size_data = ((data != NULL) ?  glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
   8574 	 unsigned char *ptr;
   8575 	 unsigned char *buf;
   8576 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   8577 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8578 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8579 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   8580 	ptr = buf;
   8581 	int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8582 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8583 
   8584 		memcpy(ptr, &target, 4); ptr += 4;
   8585 		memcpy(ptr, &level, 4); ptr += 4;
   8586 		memcpy(ptr, &xoffset, 4); ptr += 4;
   8587 		memcpy(ptr, &yoffset, 4); ptr += 4;
   8588 		memcpy(ptr, &zoffset, 4); ptr += 4;
   8589 		memcpy(ptr, &width, 4); ptr += 4;
   8590 		memcpy(ptr, &height, 4); ptr += 4;
   8591 		memcpy(ptr, &depth, 4); ptr += 4;
   8592 		memcpy(ptr, &format, 4); ptr += 4;
   8593 		memcpy(ptr, &type, 4); ptr += 4;
   8594 
   8595 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8596 	stream->flush();
   8597 	stream->writeFully(&__size_data,4);
   8598 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   8599 	if (data != NULL) {
   8600 		stream->writeFully(data, __size_data);
   8601 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8602 	}
   8603 	buf = stream->alloc(checksumSize);
   8604 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   8605 
   8606 }
   8607 
   8608 void glTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLuint offset)
   8609 {
   8610 
   8611 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8612 	IOStream *stream = ctx->m_stream;
   8613 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8614 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8615 
   8616 	 unsigned char *ptr;
   8617 	 unsigned char *buf;
   8618 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   8619 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8620 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8621 	buf = stream->alloc(totalSize);
   8622 	ptr = buf;
   8623 	int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   8624 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8625 
   8626 		memcpy(ptr, &target, 4); ptr += 4;
   8627 		memcpy(ptr, &level, 4); ptr += 4;
   8628 		memcpy(ptr, &xoffset, 4); ptr += 4;
   8629 		memcpy(ptr, &yoffset, 4); ptr += 4;
   8630 		memcpy(ptr, &zoffset, 4); ptr += 4;
   8631 		memcpy(ptr, &width, 4); ptr += 4;
   8632 		memcpy(ptr, &height, 4); ptr += 4;
   8633 		memcpy(ptr, &depth, 4); ptr += 4;
   8634 		memcpy(ptr, &format, 4); ptr += 4;
   8635 		memcpy(ptr, &type, 4); ptr += 4;
   8636 		memcpy(ptr, &offset, 4); ptr += 4;
   8637 
   8638 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8639 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8640 
   8641 }
   8642 
   8643 void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
   8644 {
   8645 
   8646 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8647 	IOStream *stream = ctx->m_stream;
   8648 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8649 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8650 
   8651 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
   8652 	 unsigned char *ptr;
   8653 	 unsigned char *buf;
   8654 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   8655 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8656 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8657 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   8658 	ptr = buf;
   8659 	int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8660 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8661 
   8662 		memcpy(ptr, &target, 4); ptr += 4;
   8663 		memcpy(ptr, &level, 4); ptr += 4;
   8664 		memcpy(ptr, &internalformat, 4); ptr += 4;
   8665 		memcpy(ptr, &width, 4); ptr += 4;
   8666 		memcpy(ptr, &height, 4); ptr += 4;
   8667 		memcpy(ptr, &depth, 4); ptr += 4;
   8668 		memcpy(ptr, &border, 4); ptr += 4;
   8669 		memcpy(ptr, &imageSize, 4); ptr += 4;
   8670 
   8671 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8672 	stream->flush();
   8673 	stream->writeFully(&__size_data,4);
   8674 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   8675 	if (data != NULL) {
   8676 		stream->writeFully(data, __size_data);
   8677 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8678 	}
   8679 	buf = stream->alloc(checksumSize);
   8680 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   8681 
   8682 }
   8683 
   8684 void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset)
   8685 {
   8686 
   8687 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8688 	IOStream *stream = ctx->m_stream;
   8689 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8690 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8691 
   8692 	 unsigned char *ptr;
   8693 	 unsigned char *buf;
   8694 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   8695 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8696 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8697 	buf = stream->alloc(totalSize);
   8698 	ptr = buf;
   8699 	int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   8700 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8701 
   8702 		memcpy(ptr, &target, 4); ptr += 4;
   8703 		memcpy(ptr, &level, 4); ptr += 4;
   8704 		memcpy(ptr, &internalformat, 4); ptr += 4;
   8705 		memcpy(ptr, &width, 4); ptr += 4;
   8706 		memcpy(ptr, &height, 4); ptr += 4;
   8707 		memcpy(ptr, &depth, 4); ptr += 4;
   8708 		memcpy(ptr, &border, 4); ptr += 4;
   8709 		memcpy(ptr, &imageSize, 4); ptr += 4;
   8710 		memcpy(ptr, &offset, 4); ptr += 4;
   8711 
   8712 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8713 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8714 
   8715 }
   8716 
   8717 void glCompressedTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
   8718 {
   8719 
   8720 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8721 	IOStream *stream = ctx->m_stream;
   8722 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8723 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8724 
   8725 	const unsigned int __size_data = ((data != NULL) ?  imageSize : 0);
   8726 	 unsigned char *ptr;
   8727 	 unsigned char *buf;
   8728 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
   8729 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8730 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8731 	buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
   8732 	ptr = buf;
   8733 	int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8734 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8735 
   8736 		memcpy(ptr, &target, 4); ptr += 4;
   8737 		memcpy(ptr, &level, 4); ptr += 4;
   8738 		memcpy(ptr, &xoffset, 4); ptr += 4;
   8739 		memcpy(ptr, &yoffset, 4); ptr += 4;
   8740 		memcpy(ptr, &zoffset, 4); ptr += 4;
   8741 		memcpy(ptr, &width, 4); ptr += 4;
   8742 		memcpy(ptr, &height, 4); ptr += 4;
   8743 		memcpy(ptr, &depth, 4); ptr += 4;
   8744 		memcpy(ptr, &format, 4); ptr += 4;
   8745 		memcpy(ptr, &imageSize, 4); ptr += 4;
   8746 
   8747 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8748 	stream->flush();
   8749 	stream->writeFully(&__size_data,4);
   8750 	if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
   8751 	if (data != NULL) {
   8752 		stream->writeFully(data, __size_data);
   8753 		if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8754 	}
   8755 	buf = stream->alloc(checksumSize);
   8756 	if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
   8757 
   8758 }
   8759 
   8760 void glCompressedTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLuint data)
   8761 {
   8762 
   8763 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8764 	IOStream *stream = ctx->m_stream;
   8765 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8766 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8767 
   8768 	 unsigned char *ptr;
   8769 	 unsigned char *buf;
   8770 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   8771 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8772 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8773 	buf = stream->alloc(totalSize);
   8774 	ptr = buf;
   8775 	int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   8776 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8777 
   8778 		memcpy(ptr, &target, 4); ptr += 4;
   8779 		memcpy(ptr, &level, 4); ptr += 4;
   8780 		memcpy(ptr, &xoffset, 4); ptr += 4;
   8781 		memcpy(ptr, &yoffset, 4); ptr += 4;
   8782 		memcpy(ptr, &zoffset, 4); ptr += 4;
   8783 		memcpy(ptr, &width, 4); ptr += 4;
   8784 		memcpy(ptr, &height, 4); ptr += 4;
   8785 		memcpy(ptr, &depth, 4); ptr += 4;
   8786 		memcpy(ptr, &format, 4); ptr += 4;
   8787 		memcpy(ptr, &imageSize, 4); ptr += 4;
   8788 		memcpy(ptr, &data, 4); ptr += 4;
   8789 
   8790 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8791 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8792 
   8793 }
   8794 
   8795 void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
   8796 {
   8797 
   8798 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8799 	IOStream *stream = ctx->m_stream;
   8800 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8801 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8802 
   8803 	 unsigned char *ptr;
   8804 	 unsigned char *buf;
   8805 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
   8806 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8807 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8808 	buf = stream->alloc(totalSize);
   8809 	ptr = buf;
   8810 	int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
   8811 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8812 
   8813 		memcpy(ptr, &target, 4); ptr += 4;
   8814 		memcpy(ptr, &level, 4); ptr += 4;
   8815 		memcpy(ptr, &xoffset, 4); ptr += 4;
   8816 		memcpy(ptr, &yoffset, 4); ptr += 4;
   8817 		memcpy(ptr, &zoffset, 4); ptr += 4;
   8818 		memcpy(ptr, &x, 4); ptr += 4;
   8819 		memcpy(ptr, &y, 4); ptr += 4;
   8820 		memcpy(ptr, &width, 4); ptr += 4;
   8821 		memcpy(ptr, &height, 4); ptr += 4;
   8822 
   8823 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8824 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8825 
   8826 }
   8827 
   8828 void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data)
   8829 {
   8830 
   8831 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8832 	IOStream *stream = ctx->m_stream;
   8833 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8834 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8835 
   8836 	const unsigned int __size_data =  (sizeof(GLboolean));
   8837 	 unsigned char *ptr;
   8838 	 unsigned char *buf;
   8839 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   8840 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8841 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8842 	buf = stream->alloc(totalSize);
   8843 	ptr = buf;
   8844 	int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4;
   8845 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8846 
   8847 		memcpy(ptr, &target, 4); ptr += 4;
   8848 		memcpy(ptr, &index, 4); ptr += 4;
   8849 	*(unsigned int *)(ptr) = __size_data; ptr += 4;
   8850 
   8851 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8852 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8853 
   8854 	stream->readback(data, __size_data);
   8855 	if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
   8856 	if (useChecksum) {
   8857 		unsigned char *checksumBufPtr = NULL;
   8858 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8859 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8860 		stream->readback(checksumBufPtr, checksumSize);
   8861 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8862 			ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n");
   8863 			abort();
   8864 		}
   8865 	}
   8866 }
   8867 
   8868 void glMemoryBarrier_enc(void *self , GLbitfield barriers)
   8869 {
   8870 
   8871 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8872 	IOStream *stream = ctx->m_stream;
   8873 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8874 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8875 
   8876 	 unsigned char *ptr;
   8877 	 unsigned char *buf;
   8878 	 const size_t sizeWithoutChecksum = 8 + 4;
   8879 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8880 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8881 	buf = stream->alloc(totalSize);
   8882 	ptr = buf;
   8883 	int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4;
   8884 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8885 
   8886 		memcpy(ptr, &barriers, 4); ptr += 4;
   8887 
   8888 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8889 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8890 
   8891 }
   8892 
   8893 void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers)
   8894 {
   8895 
   8896 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8897 	IOStream *stream = ctx->m_stream;
   8898 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8899 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8900 
   8901 	 unsigned char *ptr;
   8902 	 unsigned char *buf;
   8903 	 const size_t sizeWithoutChecksum = 8 + 4;
   8904 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8905 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8906 	buf = stream->alloc(totalSize);
   8907 	ptr = buf;
   8908 	int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4;
   8909 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8910 
   8911 		memcpy(ptr, &barriers, 4); ptr += 4;
   8912 
   8913 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8914 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8915 
   8916 }
   8917 
   8918 void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines)
   8919 {
   8920 
   8921 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8922 	IOStream *stream = ctx->m_stream;
   8923 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8924 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8925 
   8926 	const unsigned int __size_pipelines =  (n * sizeof(GLuint));
   8927 	 unsigned char *ptr;
   8928 	 unsigned char *buf;
   8929 	 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
   8930 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8931 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8932 	buf = stream->alloc(totalSize);
   8933 	ptr = buf;
   8934 	int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
   8935 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8936 
   8937 		memcpy(ptr, &n, 4); ptr += 4;
   8938 	*(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
   8939 
   8940 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8941 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8942 
   8943 	stream->readback(pipelines, __size_pipelines);
   8944 	if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines);
   8945 	if (useChecksum) {
   8946 		unsigned char *checksumBufPtr = NULL;
   8947 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   8948 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   8949 		stream->readback(checksumBufPtr, checksumSize);
   8950 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   8951 			ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n");
   8952 			abort();
   8953 		}
   8954 	}
   8955 }
   8956 
   8957 void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines)
   8958 {
   8959 
   8960 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8961 	IOStream *stream = ctx->m_stream;
   8962 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8963 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8964 
   8965 	const unsigned int __size_pipelines =  (n * sizeof(GLuint));
   8966 	 unsigned char *ptr;
   8967 	 unsigned char *buf;
   8968 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4;
   8969 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8970 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8971 	buf = stream->alloc(totalSize);
   8972 	ptr = buf;
   8973 	int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
   8974 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   8975 
   8976 		memcpy(ptr, &n, 4); ptr += 4;
   8977 	*(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
   8978 	memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines;
   8979 
   8980 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   8981 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   8982 
   8983 }
   8984 
   8985 void glBindProgramPipeline_enc(void *self , GLuint pipeline)
   8986 {
   8987 
   8988 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   8989 	IOStream *stream = ctx->m_stream;
   8990 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   8991 	bool useChecksum = checksumCalculator->getVersion() > 0;
   8992 
   8993 	 unsigned char *ptr;
   8994 	 unsigned char *buf;
   8995 	 const size_t sizeWithoutChecksum = 8 + 4;
   8996 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   8997 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   8998 	buf = stream->alloc(totalSize);
   8999 	ptr = buf;
   9000 	int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
   9001 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9002 
   9003 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9004 
   9005 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9006 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9007 
   9008 }
   9009 
   9010 void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params)
   9011 {
   9012 
   9013 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9014 	IOStream *stream = ctx->m_stream;
   9015 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9016 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9017 
   9018 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   9019 	 unsigned char *ptr;
   9020 	 unsigned char *buf;
   9021 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   9022 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9023 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9024 	buf = stream->alloc(totalSize);
   9025 	ptr = buf;
   9026 	int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4;
   9027 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9028 
   9029 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9030 		memcpy(ptr, &pname, 4); ptr += 4;
   9031 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   9032 
   9033 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9034 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9035 
   9036 	stream->readback(params, __size_params);
   9037 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   9038 	if (useChecksum) {
   9039 		unsigned char *checksumBufPtr = NULL;
   9040 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   9041 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   9042 		stream->readback(checksumBufPtr, checksumSize);
   9043 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   9044 			ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n");
   9045 			abort();
   9046 		}
   9047 	}
   9048 }
   9049 
   9050 void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog)
   9051 {
   9052 
   9053 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9054 	IOStream *stream = ctx->m_stream;
   9055 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9056 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9057 
   9058 	const unsigned int __size_length = ((length != NULL) ?  sizeof(GLsizei) : 0);
   9059 	const unsigned int __size_infoLog =  bufSize;
   9060 	 unsigned char *ptr;
   9061 	 unsigned char *buf;
   9062 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
   9063 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9064 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9065 	buf = stream->alloc(totalSize);
   9066 	ptr = buf;
   9067 	int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
   9068 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9069 
   9070 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9071 		memcpy(ptr, &bufSize, 4); ptr += 4;
   9072 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   9073 	*(unsigned int *)(ptr) = __size_infoLog; ptr += 4;
   9074 
   9075 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9076 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9077 
   9078 	if (length != NULL) {
   9079 		stream->readback(length, __size_length);
   9080 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   9081 	}
   9082 	stream->readback(infoLog, __size_infoLog);
   9083 	if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog);
   9084 	if (useChecksum) {
   9085 		unsigned char *checksumBufPtr = NULL;
   9086 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   9087 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   9088 		stream->readback(checksumBufPtr, checksumSize);
   9089 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   9090 			ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n");
   9091 			abort();
   9092 		}
   9093 	}
   9094 }
   9095 
   9096 void glValidateProgramPipeline_enc(void *self , GLuint pipeline)
   9097 {
   9098 
   9099 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9100 	IOStream *stream = ctx->m_stream;
   9101 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9102 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9103 
   9104 	 unsigned char *ptr;
   9105 	 unsigned char *buf;
   9106 	 const size_t sizeWithoutChecksum = 8 + 4;
   9107 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9108 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9109 	buf = stream->alloc(totalSize);
   9110 	ptr = buf;
   9111 	int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
   9112 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9113 
   9114 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9115 
   9116 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9117 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9118 
   9119 }
   9120 
   9121 GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline)
   9122 {
   9123 
   9124 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9125 	IOStream *stream = ctx->m_stream;
   9126 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9127 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9128 
   9129 	 unsigned char *ptr;
   9130 	 unsigned char *buf;
   9131 	 const size_t sizeWithoutChecksum = 8 + 4;
   9132 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9133 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9134 	buf = stream->alloc(totalSize);
   9135 	ptr = buf;
   9136 	int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
   9137 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9138 
   9139 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9140 
   9141 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9142 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9143 
   9144 
   9145 	GLboolean retval;
   9146 	stream->readback(&retval, 1);
   9147 	if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
   9148 	if (useChecksum) {
   9149 		unsigned char *checksumBufPtr = NULL;
   9150 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   9151 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   9152 		stream->readback(checksumBufPtr, checksumSize);
   9153 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   9154 			ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n");
   9155 			abort();
   9156 		}
   9157 	}
   9158 	return retval;
   9159 }
   9160 
   9161 void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program)
   9162 {
   9163 
   9164 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9165 	IOStream *stream = ctx->m_stream;
   9166 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9167 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9168 
   9169 	 unsigned char *ptr;
   9170 	 unsigned char *buf;
   9171 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   9172 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9173 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9174 	buf = stream->alloc(totalSize);
   9175 	ptr = buf;
   9176 	int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4;
   9177 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9178 
   9179 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9180 		memcpy(ptr, &stages, 4); ptr += 4;
   9181 		memcpy(ptr, &program, 4); ptr += 4;
   9182 
   9183 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9184 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9185 
   9186 }
   9187 
   9188 void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program)
   9189 {
   9190 
   9191 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9192 	IOStream *stream = ctx->m_stream;
   9193 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9194 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9195 
   9196 	 unsigned char *ptr;
   9197 	 unsigned char *buf;
   9198 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   9199 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9200 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9201 	buf = stream->alloc(totalSize);
   9202 	ptr = buf;
   9203 	int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4;
   9204 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9205 
   9206 		memcpy(ptr, &pipeline, 4); ptr += 4;
   9207 		memcpy(ptr, &program, 4); ptr += 4;
   9208 
   9209 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9210 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9211 
   9212 }
   9213 
   9214 GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen)
   9215 {
   9216 
   9217 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9218 	IOStream *stream = ctx->m_stream;
   9219 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9220 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9221 
   9222 	const unsigned int __size_packedStrings =  packedLen;
   9223 	 unsigned char *ptr;
   9224 	 unsigned char *buf;
   9225 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4;
   9226 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9227 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9228 	buf = stream->alloc(totalSize);
   9229 	ptr = buf;
   9230 	int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   9231 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9232 
   9233 		memcpy(ptr, &type, 4); ptr += 4;
   9234 		memcpy(ptr, &count, 4); ptr += 4;
   9235 	*(unsigned int *)(ptr) = __size_packedStrings; ptr += 4;
   9236 	memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings;
   9237 		memcpy(ptr, &packedLen, 4); ptr += 4;
   9238 
   9239 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9240 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9241 
   9242 
   9243 	GLuint retval;
   9244 	stream->readback(&retval, 4);
   9245 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   9246 	if (useChecksum) {
   9247 		unsigned char *checksumBufPtr = NULL;
   9248 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   9249 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   9250 		stream->readback(checksumBufPtr, checksumSize);
   9251 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   9252 			ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n");
   9253 			abort();
   9254 		}
   9255 	}
   9256 	return retval;
   9257 }
   9258 
   9259 void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0)
   9260 {
   9261 
   9262 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9263 	IOStream *stream = ctx->m_stream;
   9264 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9265 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9266 
   9267 	 unsigned char *ptr;
   9268 	 unsigned char *buf;
   9269 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   9270 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9271 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9272 	buf = stream->alloc(totalSize);
   9273 	ptr = buf;
   9274 	int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
   9275 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9276 
   9277 		memcpy(ptr, &program, 4); ptr += 4;
   9278 		memcpy(ptr, &location, 4); ptr += 4;
   9279 		memcpy(ptr, &v0, 4); ptr += 4;
   9280 
   9281 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9282 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9283 
   9284 }
   9285 
   9286 void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1)
   9287 {
   9288 
   9289 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9290 	IOStream *stream = ctx->m_stream;
   9291 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9292 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9293 
   9294 	 unsigned char *ptr;
   9295 	 unsigned char *buf;
   9296 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   9297 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9298 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9299 	buf = stream->alloc(totalSize);
   9300 	ptr = buf;
   9301 	int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
   9302 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9303 
   9304 		memcpy(ptr, &program, 4); ptr += 4;
   9305 		memcpy(ptr, &location, 4); ptr += 4;
   9306 		memcpy(ptr, &v0, 4); ptr += 4;
   9307 		memcpy(ptr, &v1, 4); ptr += 4;
   9308 
   9309 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9310 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9311 
   9312 }
   9313 
   9314 void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
   9315 {
   9316 
   9317 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9318 	IOStream *stream = ctx->m_stream;
   9319 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9320 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9321 
   9322 	 unsigned char *ptr;
   9323 	 unsigned char *buf;
   9324 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   9325 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9326 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9327 	buf = stream->alloc(totalSize);
   9328 	ptr = buf;
   9329 	int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
   9330 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9331 
   9332 		memcpy(ptr, &program, 4); ptr += 4;
   9333 		memcpy(ptr, &location, 4); ptr += 4;
   9334 		memcpy(ptr, &v0, 4); ptr += 4;
   9335 		memcpy(ptr, &v1, 4); ptr += 4;
   9336 		memcpy(ptr, &v2, 4); ptr += 4;
   9337 
   9338 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9339 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9340 
   9341 }
   9342 
   9343 void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
   9344 {
   9345 
   9346 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9347 	IOStream *stream = ctx->m_stream;
   9348 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9349 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9350 
   9351 	 unsigned char *ptr;
   9352 	 unsigned char *buf;
   9353 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   9354 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9355 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9356 	buf = stream->alloc(totalSize);
   9357 	ptr = buf;
   9358 	int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
   9359 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9360 
   9361 		memcpy(ptr, &program, 4); ptr += 4;
   9362 		memcpy(ptr, &location, 4); ptr += 4;
   9363 		memcpy(ptr, &v0, 4); ptr += 4;
   9364 		memcpy(ptr, &v1, 4); ptr += 4;
   9365 		memcpy(ptr, &v2, 4); ptr += 4;
   9366 		memcpy(ptr, &v3, 4); ptr += 4;
   9367 
   9368 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9369 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9370 
   9371 }
   9372 
   9373 void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0)
   9374 {
   9375 
   9376 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9377 	IOStream *stream = ctx->m_stream;
   9378 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9379 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9380 
   9381 	 unsigned char *ptr;
   9382 	 unsigned char *buf;
   9383 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   9384 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9385 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9386 	buf = stream->alloc(totalSize);
   9387 	ptr = buf;
   9388 	int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
   9389 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9390 
   9391 		memcpy(ptr, &program, 4); ptr += 4;
   9392 		memcpy(ptr, &location, 4); ptr += 4;
   9393 		memcpy(ptr, &v0, 4); ptr += 4;
   9394 
   9395 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9396 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9397 
   9398 }
   9399 
   9400 void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1)
   9401 {
   9402 
   9403 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9404 	IOStream *stream = ctx->m_stream;
   9405 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9406 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9407 
   9408 	 unsigned char *ptr;
   9409 	 unsigned char *buf;
   9410 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   9411 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9412 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9413 	buf = stream->alloc(totalSize);
   9414 	ptr = buf;
   9415 	int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
   9416 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9417 
   9418 		memcpy(ptr, &program, 4); ptr += 4;
   9419 		memcpy(ptr, &location, 4); ptr += 4;
   9420 		memcpy(ptr, &v0, 4); ptr += 4;
   9421 		memcpy(ptr, &v1, 4); ptr += 4;
   9422 
   9423 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9424 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9425 
   9426 }
   9427 
   9428 void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
   9429 {
   9430 
   9431 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9432 	IOStream *stream = ctx->m_stream;
   9433 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9434 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9435 
   9436 	 unsigned char *ptr;
   9437 	 unsigned char *buf;
   9438 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   9439 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9440 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9441 	buf = stream->alloc(totalSize);
   9442 	ptr = buf;
   9443 	int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
   9444 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9445 
   9446 		memcpy(ptr, &program, 4); ptr += 4;
   9447 		memcpy(ptr, &location, 4); ptr += 4;
   9448 		memcpy(ptr, &v0, 4); ptr += 4;
   9449 		memcpy(ptr, &v1, 4); ptr += 4;
   9450 		memcpy(ptr, &v2, 4); ptr += 4;
   9451 
   9452 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9453 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9454 
   9455 }
   9456 
   9457 void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
   9458 {
   9459 
   9460 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9461 	IOStream *stream = ctx->m_stream;
   9462 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9463 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9464 
   9465 	 unsigned char *ptr;
   9466 	 unsigned char *buf;
   9467 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   9468 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9469 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9470 	buf = stream->alloc(totalSize);
   9471 	ptr = buf;
   9472 	int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
   9473 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9474 
   9475 		memcpy(ptr, &program, 4); ptr += 4;
   9476 		memcpy(ptr, &location, 4); ptr += 4;
   9477 		memcpy(ptr, &v0, 4); ptr += 4;
   9478 		memcpy(ptr, &v1, 4); ptr += 4;
   9479 		memcpy(ptr, &v2, 4); ptr += 4;
   9480 		memcpy(ptr, &v3, 4); ptr += 4;
   9481 
   9482 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9483 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9484 
   9485 }
   9486 
   9487 void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0)
   9488 {
   9489 
   9490 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9491 	IOStream *stream = ctx->m_stream;
   9492 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9493 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9494 
   9495 	 unsigned char *ptr;
   9496 	 unsigned char *buf;
   9497 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   9498 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9499 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9500 	buf = stream->alloc(totalSize);
   9501 	ptr = buf;
   9502 	int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
   9503 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9504 
   9505 		memcpy(ptr, &program, 4); ptr += 4;
   9506 		memcpy(ptr, &location, 4); ptr += 4;
   9507 		memcpy(ptr, &v0, 4); ptr += 4;
   9508 
   9509 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9510 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9511 
   9512 }
   9513 
   9514 void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1)
   9515 {
   9516 
   9517 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9518 	IOStream *stream = ctx->m_stream;
   9519 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9520 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9521 
   9522 	 unsigned char *ptr;
   9523 	 unsigned char *buf;
   9524 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   9525 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9526 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9527 	buf = stream->alloc(totalSize);
   9528 	ptr = buf;
   9529 	int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
   9530 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9531 
   9532 		memcpy(ptr, &program, 4); ptr += 4;
   9533 		memcpy(ptr, &location, 4); ptr += 4;
   9534 		memcpy(ptr, &v0, 4); ptr += 4;
   9535 		memcpy(ptr, &v1, 4); ptr += 4;
   9536 
   9537 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9538 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9539 
   9540 }
   9541 
   9542 void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
   9543 {
   9544 
   9545 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9546 	IOStream *stream = ctx->m_stream;
   9547 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9548 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9549 
   9550 	 unsigned char *ptr;
   9551 	 unsigned char *buf;
   9552 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
   9553 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9554 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9555 	buf = stream->alloc(totalSize);
   9556 	ptr = buf;
   9557 	int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
   9558 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9559 
   9560 		memcpy(ptr, &program, 4); ptr += 4;
   9561 		memcpy(ptr, &location, 4); ptr += 4;
   9562 		memcpy(ptr, &v0, 4); ptr += 4;
   9563 		memcpy(ptr, &v1, 4); ptr += 4;
   9564 		memcpy(ptr, &v2, 4); ptr += 4;
   9565 
   9566 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9567 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9568 
   9569 }
   9570 
   9571 void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
   9572 {
   9573 
   9574 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9575 	IOStream *stream = ctx->m_stream;
   9576 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9577 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9578 
   9579 	 unsigned char *ptr;
   9580 	 unsigned char *buf;
   9581 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
   9582 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9583 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9584 	buf = stream->alloc(totalSize);
   9585 	ptr = buf;
   9586 	int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
   9587 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9588 
   9589 		memcpy(ptr, &program, 4); ptr += 4;
   9590 		memcpy(ptr, &location, 4); ptr += 4;
   9591 		memcpy(ptr, &v0, 4); ptr += 4;
   9592 		memcpy(ptr, &v1, 4); ptr += 4;
   9593 		memcpy(ptr, &v2, 4); ptr += 4;
   9594 		memcpy(ptr, &v3, 4); ptr += 4;
   9595 
   9596 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9597 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9598 
   9599 }
   9600 
   9601 void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
   9602 {
   9603 
   9604 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9605 	IOStream *stream = ctx->m_stream;
   9606 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9607 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9608 
   9609 	const unsigned int __size_value =  (count * sizeof(GLfloat));
   9610 	 unsigned char *ptr;
   9611 	 unsigned char *buf;
   9612 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9613 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9614 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9615 	buf = stream->alloc(totalSize);
   9616 	ptr = buf;
   9617 	int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
   9618 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9619 
   9620 		memcpy(ptr, &program, 4); ptr += 4;
   9621 		memcpy(ptr, &location, 4); ptr += 4;
   9622 		memcpy(ptr, &count, 4); ptr += 4;
   9623 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9624 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9625 
   9626 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9627 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9628 
   9629 }
   9630 
   9631 void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
   9632 {
   9633 
   9634 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9635 	IOStream *stream = ctx->m_stream;
   9636 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9637 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9638 
   9639 	const unsigned int __size_value =  (count * 2 * sizeof(GLfloat));
   9640 	 unsigned char *ptr;
   9641 	 unsigned char *buf;
   9642 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9643 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9644 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9645 	buf = stream->alloc(totalSize);
   9646 	ptr = buf;
   9647 	int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   9648 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9649 
   9650 		memcpy(ptr, &program, 4); ptr += 4;
   9651 		memcpy(ptr, &location, 4); ptr += 4;
   9652 		memcpy(ptr, &count, 4); ptr += 4;
   9653 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9654 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9655 
   9656 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9657 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9658 
   9659 }
   9660 
   9661 void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
   9662 {
   9663 
   9664 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9665 	IOStream *stream = ctx->m_stream;
   9666 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9667 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9668 
   9669 	const unsigned int __size_value =  (count * 3 * sizeof(GLfloat));
   9670 	 unsigned char *ptr;
   9671 	 unsigned char *buf;
   9672 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9673 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9674 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9675 	buf = stream->alloc(totalSize);
   9676 	ptr = buf;
   9677 	int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   9678 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9679 
   9680 		memcpy(ptr, &program, 4); ptr += 4;
   9681 		memcpy(ptr, &location, 4); ptr += 4;
   9682 		memcpy(ptr, &count, 4); ptr += 4;
   9683 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9684 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9685 
   9686 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9687 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9688 
   9689 }
   9690 
   9691 void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
   9692 {
   9693 
   9694 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9695 	IOStream *stream = ctx->m_stream;
   9696 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9697 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9698 
   9699 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
   9700 	 unsigned char *ptr;
   9701 	 unsigned char *buf;
   9702 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9703 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9704 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9705 	buf = stream->alloc(totalSize);
   9706 	ptr = buf;
   9707 	int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   9708 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9709 
   9710 		memcpy(ptr, &program, 4); ptr += 4;
   9711 		memcpy(ptr, &location, 4); ptr += 4;
   9712 		memcpy(ptr, &count, 4); ptr += 4;
   9713 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9714 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9715 
   9716 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9717 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9718 
   9719 }
   9720 
   9721 void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
   9722 {
   9723 
   9724 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9725 	IOStream *stream = ctx->m_stream;
   9726 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9727 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9728 
   9729 	const unsigned int __size_value =  (count * sizeof(GLint));
   9730 	 unsigned char *ptr;
   9731 	 unsigned char *buf;
   9732 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9733 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9734 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9735 	buf = stream->alloc(totalSize);
   9736 	ptr = buf;
   9737 	int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
   9738 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9739 
   9740 		memcpy(ptr, &program, 4); ptr += 4;
   9741 		memcpy(ptr, &location, 4); ptr += 4;
   9742 		memcpy(ptr, &count, 4); ptr += 4;
   9743 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9744 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9745 
   9746 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9747 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9748 
   9749 }
   9750 
   9751 void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
   9752 {
   9753 
   9754 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9755 	IOStream *stream = ctx->m_stream;
   9756 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9757 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9758 
   9759 	const unsigned int __size_value =  (count * 2 * sizeof(GLint));
   9760 	 unsigned char *ptr;
   9761 	 unsigned char *buf;
   9762 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9763 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9764 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9765 	buf = stream->alloc(totalSize);
   9766 	ptr = buf;
   9767 	int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
   9768 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9769 
   9770 		memcpy(ptr, &program, 4); ptr += 4;
   9771 		memcpy(ptr, &location, 4); ptr += 4;
   9772 		memcpy(ptr, &count, 4); ptr += 4;
   9773 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9774 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9775 
   9776 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9777 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9778 
   9779 }
   9780 
   9781 void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
   9782 {
   9783 
   9784 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9785 	IOStream *stream = ctx->m_stream;
   9786 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9787 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9788 
   9789 	const unsigned int __size_value =  (count * 3 * sizeof(GLint));
   9790 	 unsigned char *ptr;
   9791 	 unsigned char *buf;
   9792 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9793 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9794 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9795 	buf = stream->alloc(totalSize);
   9796 	ptr = buf;
   9797 	int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
   9798 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9799 
   9800 		memcpy(ptr, &program, 4); ptr += 4;
   9801 		memcpy(ptr, &location, 4); ptr += 4;
   9802 		memcpy(ptr, &count, 4); ptr += 4;
   9803 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9804 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9805 
   9806 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9807 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9808 
   9809 }
   9810 
   9811 void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
   9812 {
   9813 
   9814 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9815 	IOStream *stream = ctx->m_stream;
   9816 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9817 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9818 
   9819 	const unsigned int __size_value =  (count * 4 * sizeof(GLint));
   9820 	 unsigned char *ptr;
   9821 	 unsigned char *buf;
   9822 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9823 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9824 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9825 	buf = stream->alloc(totalSize);
   9826 	ptr = buf;
   9827 	int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
   9828 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9829 
   9830 		memcpy(ptr, &program, 4); ptr += 4;
   9831 		memcpy(ptr, &location, 4); ptr += 4;
   9832 		memcpy(ptr, &count, 4); ptr += 4;
   9833 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9834 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9835 
   9836 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9837 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9838 
   9839 }
   9840 
   9841 void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
   9842 {
   9843 
   9844 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9845 	IOStream *stream = ctx->m_stream;
   9846 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9847 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9848 
   9849 	const unsigned int __size_value =  (count * sizeof(GLuint));
   9850 	 unsigned char *ptr;
   9851 	 unsigned char *buf;
   9852 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9853 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9854 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9855 	buf = stream->alloc(totalSize);
   9856 	ptr = buf;
   9857 	int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   9858 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9859 
   9860 		memcpy(ptr, &program, 4); ptr += 4;
   9861 		memcpy(ptr, &location, 4); ptr += 4;
   9862 		memcpy(ptr, &count, 4); ptr += 4;
   9863 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9864 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9865 
   9866 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9867 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9868 
   9869 }
   9870 
   9871 void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
   9872 {
   9873 
   9874 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9875 	IOStream *stream = ctx->m_stream;
   9876 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9877 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9878 
   9879 	const unsigned int __size_value =  (count * 2 * sizeof(GLuint));
   9880 	 unsigned char *ptr;
   9881 	 unsigned char *buf;
   9882 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9883 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9884 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9885 	buf = stream->alloc(totalSize);
   9886 	ptr = buf;
   9887 	int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   9888 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9889 
   9890 		memcpy(ptr, &program, 4); ptr += 4;
   9891 		memcpy(ptr, &location, 4); ptr += 4;
   9892 		memcpy(ptr, &count, 4); ptr += 4;
   9893 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9894 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9895 
   9896 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9897 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9898 
   9899 }
   9900 
   9901 void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
   9902 {
   9903 
   9904 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9905 	IOStream *stream = ctx->m_stream;
   9906 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9907 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9908 
   9909 	const unsigned int __size_value =  (count * 3 * sizeof(GLuint));
   9910 	 unsigned char *ptr;
   9911 	 unsigned char *buf;
   9912 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9913 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9914 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9915 	buf = stream->alloc(totalSize);
   9916 	ptr = buf;
   9917 	int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   9918 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9919 
   9920 		memcpy(ptr, &program, 4); ptr += 4;
   9921 		memcpy(ptr, &location, 4); ptr += 4;
   9922 		memcpy(ptr, &count, 4); ptr += 4;
   9923 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9924 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9925 
   9926 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9927 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9928 
   9929 }
   9930 
   9931 void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
   9932 {
   9933 
   9934 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9935 	IOStream *stream = ctx->m_stream;
   9936 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9937 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9938 
   9939 	const unsigned int __size_value =  (count * 4 * sizeof(GLuint));
   9940 	 unsigned char *ptr;
   9941 	 unsigned char *buf;
   9942 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
   9943 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9944 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9945 	buf = stream->alloc(totalSize);
   9946 	ptr = buf;
   9947 	int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
   9948 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9949 
   9950 		memcpy(ptr, &program, 4); ptr += 4;
   9951 		memcpy(ptr, &location, 4); ptr += 4;
   9952 		memcpy(ptr, &count, 4); ptr += 4;
   9953 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9954 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9955 
   9956 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9957 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9958 
   9959 }
   9960 
   9961 void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   9962 {
   9963 
   9964 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9965 	IOStream *stream = ctx->m_stream;
   9966 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9967 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9968 
   9969 	const unsigned int __size_value =  (count * 4 * sizeof(GLfloat));
   9970 	 unsigned char *ptr;
   9971 	 unsigned char *buf;
   9972 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   9973 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   9974 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   9975 	buf = stream->alloc(totalSize);
   9976 	ptr = buf;
   9977 	int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   9978 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   9979 
   9980 		memcpy(ptr, &program, 4); ptr += 4;
   9981 		memcpy(ptr, &location, 4); ptr += 4;
   9982 		memcpy(ptr, &count, 4); ptr += 4;
   9983 		memcpy(ptr, &transpose, 1); ptr += 1;
   9984 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   9985 	memcpy(ptr, value, __size_value);ptr += __size_value;
   9986 
   9987 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   9988 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   9989 
   9990 }
   9991 
   9992 void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   9993 {
   9994 
   9995 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   9996 	IOStream *stream = ctx->m_stream;
   9997 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   9998 	bool useChecksum = checksumCalculator->getVersion() > 0;
   9999 
   10000 	const unsigned int __size_value =  (count * 9 * sizeof(GLfloat));
   10001 	 unsigned char *ptr;
   10002 	 unsigned char *buf;
   10003 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10004 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10005 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10006 	buf = stream->alloc(totalSize);
   10007 	ptr = buf;
   10008 	int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10009 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10010 
   10011 		memcpy(ptr, &program, 4); ptr += 4;
   10012 		memcpy(ptr, &location, 4); ptr += 4;
   10013 		memcpy(ptr, &count, 4); ptr += 4;
   10014 		memcpy(ptr, &transpose, 1); ptr += 1;
   10015 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10016 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10017 
   10018 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10019 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10020 
   10021 }
   10022 
   10023 void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10024 {
   10025 
   10026 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10027 	IOStream *stream = ctx->m_stream;
   10028 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10029 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10030 
   10031 	const unsigned int __size_value =  (count * 16 * sizeof(GLfloat));
   10032 	 unsigned char *ptr;
   10033 	 unsigned char *buf;
   10034 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10035 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10036 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10037 	buf = stream->alloc(totalSize);
   10038 	ptr = buf;
   10039 	int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10040 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10041 
   10042 		memcpy(ptr, &program, 4); ptr += 4;
   10043 		memcpy(ptr, &location, 4); ptr += 4;
   10044 		memcpy(ptr, &count, 4); ptr += 4;
   10045 		memcpy(ptr, &transpose, 1); ptr += 1;
   10046 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10047 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10048 
   10049 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10050 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10051 
   10052 }
   10053 
   10054 void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10055 {
   10056 
   10057 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10058 	IOStream *stream = ctx->m_stream;
   10059 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10060 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10061 
   10062 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
   10063 	 unsigned char *ptr;
   10064 	 unsigned char *buf;
   10065 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10066 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10067 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10068 	buf = stream->alloc(totalSize);
   10069 	ptr = buf;
   10070 	int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10071 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10072 
   10073 		memcpy(ptr, &program, 4); ptr += 4;
   10074 		memcpy(ptr, &location, 4); ptr += 4;
   10075 		memcpy(ptr, &count, 4); ptr += 4;
   10076 		memcpy(ptr, &transpose, 1); ptr += 1;
   10077 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10078 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10079 
   10080 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10081 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10082 
   10083 }
   10084 
   10085 void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10086 {
   10087 
   10088 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10089 	IOStream *stream = ctx->m_stream;
   10090 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10091 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10092 
   10093 	const unsigned int __size_value =  (count * 6 * sizeof(GLfloat));
   10094 	 unsigned char *ptr;
   10095 	 unsigned char *buf;
   10096 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10097 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10098 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10099 	buf = stream->alloc(totalSize);
   10100 	ptr = buf;
   10101 	int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10102 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10103 
   10104 		memcpy(ptr, &program, 4); ptr += 4;
   10105 		memcpy(ptr, &location, 4); ptr += 4;
   10106 		memcpy(ptr, &count, 4); ptr += 4;
   10107 		memcpy(ptr, &transpose, 1); ptr += 1;
   10108 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10109 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10110 
   10111 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10112 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10113 
   10114 }
   10115 
   10116 void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10117 {
   10118 
   10119 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10120 	IOStream *stream = ctx->m_stream;
   10121 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10122 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10123 
   10124 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
   10125 	 unsigned char *ptr;
   10126 	 unsigned char *buf;
   10127 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10128 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10129 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10130 	buf = stream->alloc(totalSize);
   10131 	ptr = buf;
   10132 	int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10133 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10134 
   10135 		memcpy(ptr, &program, 4); ptr += 4;
   10136 		memcpy(ptr, &location, 4); ptr += 4;
   10137 		memcpy(ptr, &count, 4); ptr += 4;
   10138 		memcpy(ptr, &transpose, 1); ptr += 1;
   10139 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10140 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10141 
   10142 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10143 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10144 
   10145 }
   10146 
   10147 void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10148 {
   10149 
   10150 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10151 	IOStream *stream = ctx->m_stream;
   10152 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10153 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10154 
   10155 	const unsigned int __size_value =  (count * 8 * sizeof(GLfloat));
   10156 	 unsigned char *ptr;
   10157 	 unsigned char *buf;
   10158 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10159 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10160 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10161 	buf = stream->alloc(totalSize);
   10162 	ptr = buf;
   10163 	int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10164 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10165 
   10166 		memcpy(ptr, &program, 4); ptr += 4;
   10167 		memcpy(ptr, &location, 4); ptr += 4;
   10168 		memcpy(ptr, &count, 4); ptr += 4;
   10169 		memcpy(ptr, &transpose, 1); ptr += 1;
   10170 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10171 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10172 
   10173 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10174 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10175 
   10176 }
   10177 
   10178 void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10179 {
   10180 
   10181 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10182 	IOStream *stream = ctx->m_stream;
   10183 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10184 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10185 
   10186 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
   10187 	 unsigned char *ptr;
   10188 	 unsigned char *buf;
   10189 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10190 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10191 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10192 	buf = stream->alloc(totalSize);
   10193 	ptr = buf;
   10194 	int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10195 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10196 
   10197 		memcpy(ptr, &program, 4); ptr += 4;
   10198 		memcpy(ptr, &location, 4); ptr += 4;
   10199 		memcpy(ptr, &count, 4); ptr += 4;
   10200 		memcpy(ptr, &transpose, 1); ptr += 1;
   10201 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10202 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10203 
   10204 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10205 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10206 
   10207 }
   10208 
   10209 void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
   10210 {
   10211 
   10212 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10213 	IOStream *stream = ctx->m_stream;
   10214 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10215 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10216 
   10217 	const unsigned int __size_value =  (count * 12 * sizeof(GLfloat));
   10218 	 unsigned char *ptr;
   10219 	 unsigned char *buf;
   10220 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
   10221 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10222 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10223 	buf = stream->alloc(totalSize);
   10224 	ptr = buf;
   10225 	int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
   10226 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10227 
   10228 		memcpy(ptr, &program, 4); ptr += 4;
   10229 		memcpy(ptr, &location, 4); ptr += 4;
   10230 		memcpy(ptr, &count, 4); ptr += 4;
   10231 		memcpy(ptr, &transpose, 1); ptr += 1;
   10232 	*(unsigned int *)(ptr) = __size_value; ptr += 4;
   10233 	memcpy(ptr, value, __size_value);ptr += __size_value;
   10234 
   10235 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10236 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10237 
   10238 }
   10239 
   10240 void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params)
   10241 {
   10242 
   10243 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10244 	IOStream *stream = ctx->m_stream;
   10245 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10246 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10247 
   10248 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   10249 	 unsigned char *ptr;
   10250 	 unsigned char *buf;
   10251 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
   10252 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10253 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10254 	buf = stream->alloc(totalSize);
   10255 	ptr = buf;
   10256 	int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4;
   10257 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10258 
   10259 		memcpy(ptr, &program, 4); ptr += 4;
   10260 		memcpy(ptr, &programInterface, 4); ptr += 4;
   10261 		memcpy(ptr, &pname, 4); ptr += 4;
   10262 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   10263 
   10264 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10265 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10266 
   10267 	stream->readback(params, __size_params);
   10268 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   10269 	if (useChecksum) {
   10270 		unsigned char *checksumBufPtr = NULL;
   10271 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10272 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10273 		stream->readback(checksumBufPtr, checksumSize);
   10274 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10275 			ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n");
   10276 			abort();
   10277 		}
   10278 	}
   10279 }
   10280 
   10281 void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params)
   10282 {
   10283 
   10284 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10285 	IOStream *stream = ctx->m_stream;
   10286 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10287 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10288 
   10289 	const unsigned int __size_props =  (propCount * sizeof(GLenum));
   10290 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   10291 	const unsigned int __size_params =  (bufSize * sizeof(GLint));
   10292 	 unsigned char *ptr;
   10293 	 unsigned char *buf;
   10294 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4;
   10295 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10296 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10297 	buf = stream->alloc(totalSize);
   10298 	ptr = buf;
   10299 	int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4;
   10300 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10301 
   10302 		memcpy(ptr, &program, 4); ptr += 4;
   10303 		memcpy(ptr, &programInterface, 4); ptr += 4;
   10304 		memcpy(ptr, &index, 4); ptr += 4;
   10305 		memcpy(ptr, &propCount, 4); ptr += 4;
   10306 	*(unsigned int *)(ptr) = __size_props; ptr += 4;
   10307 	memcpy(ptr, props, __size_props);ptr += __size_props;
   10308 		memcpy(ptr, &bufSize, 4); ptr += 4;
   10309 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   10310 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   10311 
   10312 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10313 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10314 
   10315 	if (length != NULL) {
   10316 		stream->readback(length, __size_length);
   10317 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   10318 	}
   10319 	stream->readback(params, __size_params);
   10320 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   10321 	if (useChecksum) {
   10322 		unsigned char *checksumBufPtr = NULL;
   10323 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10324 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10325 		stream->readback(checksumBufPtr, checksumSize);
   10326 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10327 			ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n");
   10328 			abort();
   10329 		}
   10330 	}
   10331 }
   10332 
   10333 GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name)
   10334 {
   10335 
   10336 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10337 	IOStream *stream = ctx->m_stream;
   10338 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10339 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10340 
   10341 	const unsigned int __size_name =  (strlen(name) + 1);
   10342 	 unsigned char *ptr;
   10343 	 unsigned char *buf;
   10344 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
   10345 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10346 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10347 	buf = stream->alloc(totalSize);
   10348 	ptr = buf;
   10349 	int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4;
   10350 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10351 
   10352 		memcpy(ptr, &program, 4); ptr += 4;
   10353 		memcpy(ptr, &programInterface, 4); ptr += 4;
   10354 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   10355 	memcpy(ptr, name, __size_name);ptr += __size_name;
   10356 
   10357 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10358 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10359 
   10360 
   10361 	GLuint retval;
   10362 	stream->readback(&retval, 4);
   10363 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   10364 	if (useChecksum) {
   10365 		unsigned char *checksumBufPtr = NULL;
   10366 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10367 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10368 		stream->readback(checksumBufPtr, checksumSize);
   10369 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10370 			ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n");
   10371 			abort();
   10372 		}
   10373 	}
   10374 	return retval;
   10375 }
   10376 
   10377 GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name)
   10378 {
   10379 
   10380 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10381 	IOStream *stream = ctx->m_stream;
   10382 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10383 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10384 
   10385 	const unsigned int __size_name =  (strlen(name) + 1);
   10386 	 unsigned char *ptr;
   10387 	 unsigned char *buf;
   10388 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
   10389 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10390 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10391 	buf = stream->alloc(totalSize);
   10392 	ptr = buf;
   10393 	int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4;
   10394 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10395 
   10396 		memcpy(ptr, &program, 4); ptr += 4;
   10397 		memcpy(ptr, &programInterface, 4); ptr += 4;
   10398 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   10399 	memcpy(ptr, name, __size_name);ptr += __size_name;
   10400 
   10401 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10402 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10403 
   10404 
   10405 	GLint retval;
   10406 	stream->readback(&retval, 4);
   10407 	if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
   10408 	if (useChecksum) {
   10409 		unsigned char *checksumBufPtr = NULL;
   10410 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10411 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10412 		stream->readback(checksumBufPtr, checksumSize);
   10413 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10414 			ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n");
   10415 			abort();
   10416 		}
   10417 	}
   10418 	return retval;
   10419 }
   10420 
   10421 void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name)
   10422 {
   10423 
   10424 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10425 	IOStream *stream = ctx->m_stream;
   10426 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10427 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10428 
   10429 	const unsigned int __size_length = ((length != NULL) ?  (sizeof(GLsizei)) : 0);
   10430 	const unsigned int __size_name =  bufSize;
   10431 	 unsigned char *ptr;
   10432 	 unsigned char *buf;
   10433 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4;
   10434 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10435 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10436 	buf = stream->alloc(totalSize);
   10437 	ptr = buf;
   10438 	int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4;
   10439 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10440 
   10441 		memcpy(ptr, &program, 4); ptr += 4;
   10442 		memcpy(ptr, &programInterface, 4); ptr += 4;
   10443 		memcpy(ptr, &index, 4); ptr += 4;
   10444 		memcpy(ptr, &bufSize, 4); ptr += 4;
   10445 	*(unsigned int *)(ptr) = __size_length; ptr += 4;
   10446 	*(unsigned int *)(ptr) = __size_name; ptr += 4;
   10447 
   10448 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10449 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10450 
   10451 	if (length != NULL) {
   10452 		stream->readback(length, __size_length);
   10453 		if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
   10454 	}
   10455 	stream->readback(name, __size_name);
   10456 	if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
   10457 	if (useChecksum) {
   10458 		unsigned char *checksumBufPtr = NULL;
   10459 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10460 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10461 		stream->readback(checksumBufPtr, checksumSize);
   10462 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10463 			ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n");
   10464 			abort();
   10465 		}
   10466 	}
   10467 }
   10468 
   10469 void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
   10470 {
   10471 
   10472 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10473 	IOStream *stream = ctx->m_stream;
   10474 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10475 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10476 
   10477 	 unsigned char *ptr;
   10478 	 unsigned char *buf;
   10479 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4;
   10480 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10481 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10482 	buf = stream->alloc(totalSize);
   10483 	ptr = buf;
   10484 	int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4;
   10485 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10486 
   10487 		memcpy(ptr, &unit, 4); ptr += 4;
   10488 		memcpy(ptr, &texture, 4); ptr += 4;
   10489 		memcpy(ptr, &level, 4); ptr += 4;
   10490 		memcpy(ptr, &layered, 1); ptr += 1;
   10491 		memcpy(ptr, &layer, 4); ptr += 4;
   10492 		memcpy(ptr, &access, 4); ptr += 4;
   10493 		memcpy(ptr, &format, 4); ptr += 4;
   10494 
   10495 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10496 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10497 
   10498 }
   10499 
   10500 void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
   10501 {
   10502 
   10503 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10504 	IOStream *stream = ctx->m_stream;
   10505 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10506 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10507 
   10508 	 unsigned char *ptr;
   10509 	 unsigned char *buf;
   10510 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   10511 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10512 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10513 	buf = stream->alloc(totalSize);
   10514 	ptr = buf;
   10515 	int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4;
   10516 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10517 
   10518 		memcpy(ptr, &num_groups_x, 4); ptr += 4;
   10519 		memcpy(ptr, &num_groups_y, 4); ptr += 4;
   10520 		memcpy(ptr, &num_groups_z, 4); ptr += 4;
   10521 
   10522 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10523 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10524 
   10525 }
   10526 
   10527 void glDispatchComputeIndirect_enc(void *self , GLintptr indirect)
   10528 {
   10529 
   10530 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10531 	IOStream *stream = ctx->m_stream;
   10532 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10533 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10534 
   10535 	 unsigned char *ptr;
   10536 	 unsigned char *buf;
   10537 	 const size_t sizeWithoutChecksum = 8 + 4;
   10538 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10539 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10540 	buf = stream->alloc(totalSize);
   10541 	ptr = buf;
   10542 	int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4;
   10543 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10544 
   10545 		memcpy(ptr, &indirect, 4); ptr += 4;
   10546 
   10547 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10548 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10549 
   10550 }
   10551 
   10552 void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride)
   10553 {
   10554 
   10555 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10556 	IOStream *stream = ctx->m_stream;
   10557 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10558 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10559 
   10560 	 unsigned char *ptr;
   10561 	 unsigned char *buf;
   10562 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   10563 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10564 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10565 	buf = stream->alloc(totalSize);
   10566 	ptr = buf;
   10567 	int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
   10568 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10569 
   10570 		memcpy(ptr, &bindingindex, 4); ptr += 4;
   10571 		memcpy(ptr, &buffer, 4); ptr += 4;
   10572 		memcpy(ptr, &offset, 4); ptr += 4;
   10573 		memcpy(ptr, &stride, 4); ptr += 4;
   10574 
   10575 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10576 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10577 
   10578 }
   10579 
   10580 void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex)
   10581 {
   10582 
   10583 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10584 	IOStream *stream = ctx->m_stream;
   10585 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10586 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10587 
   10588 	 unsigned char *ptr;
   10589 	 unsigned char *buf;
   10590 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   10591 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10592 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10593 	buf = stream->alloc(totalSize);
   10594 	ptr = buf;
   10595 	int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4;
   10596 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10597 
   10598 		memcpy(ptr, &attribindex, 4); ptr += 4;
   10599 		memcpy(ptr, &bindingindex, 4); ptr += 4;
   10600 
   10601 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10602 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10603 
   10604 }
   10605 
   10606 void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
   10607 {
   10608 
   10609 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10610 	IOStream *stream = ctx->m_stream;
   10611 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10612 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10613 
   10614 	 unsigned char *ptr;
   10615 	 unsigned char *buf;
   10616 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4;
   10617 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10618 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10619 	buf = stream->alloc(totalSize);
   10620 	ptr = buf;
   10621 	int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4;
   10622 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10623 
   10624 		memcpy(ptr, &attribindex, 4); ptr += 4;
   10625 		memcpy(ptr, &size, 4); ptr += 4;
   10626 		memcpy(ptr, &type, 4); ptr += 4;
   10627 		memcpy(ptr, &normalized, 1); ptr += 1;
   10628 		memcpy(ptr, &relativeoffset, 4); ptr += 4;
   10629 
   10630 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10631 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10632 
   10633 }
   10634 
   10635 void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
   10636 {
   10637 
   10638 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10639 	IOStream *stream = ctx->m_stream;
   10640 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10641 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10642 
   10643 	 unsigned char *ptr;
   10644 	 unsigned char *buf;
   10645 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
   10646 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10647 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10648 	buf = stream->alloc(totalSize);
   10649 	ptr = buf;
   10650 	int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4;
   10651 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10652 
   10653 		memcpy(ptr, &attribindex, 4); ptr += 4;
   10654 		memcpy(ptr, &size, 4); ptr += 4;
   10655 		memcpy(ptr, &type, 4); ptr += 4;
   10656 		memcpy(ptr, &relativeoffset, 4); ptr += 4;
   10657 
   10658 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10659 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10660 
   10661 }
   10662 
   10663 void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor)
   10664 {
   10665 
   10666 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10667 	IOStream *stream = ctx->m_stream;
   10668 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10669 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10670 
   10671 	 unsigned char *ptr;
   10672 	 unsigned char *buf;
   10673 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   10674 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10675 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10676 	buf = stream->alloc(totalSize);
   10677 	ptr = buf;
   10678 	int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
   10679 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10680 
   10681 		memcpy(ptr, &bindingindex, 4); ptr += 4;
   10682 		memcpy(ptr, &divisor, 4); ptr += 4;
   10683 
   10684 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10685 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10686 
   10687 }
   10688 
   10689 void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen)
   10690 {
   10691 
   10692 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10693 	IOStream *stream = ctx->m_stream;
   10694 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10695 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10696 
   10697 	const unsigned int __size_indirect =  datalen;
   10698 	 unsigned char *ptr;
   10699 	 unsigned char *buf;
   10700 	 const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4;
   10701 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10702 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10703 	buf = stream->alloc(totalSize);
   10704 	ptr = buf;
   10705 	int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   10706 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10707 
   10708 		memcpy(ptr, &mode, 4); ptr += 4;
   10709 	*(unsigned int *)(ptr) = __size_indirect; ptr += 4;
   10710 	memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
   10711 		memcpy(ptr, &datalen, 4); ptr += 4;
   10712 
   10713 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10714 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10715 
   10716 }
   10717 
   10718 void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset)
   10719 {
   10720 
   10721 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10722 	IOStream *stream = ctx->m_stream;
   10723 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10724 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10725 
   10726 	 unsigned char *ptr;
   10727 	 unsigned char *buf;
   10728 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   10729 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10730 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10731 	buf = stream->alloc(totalSize);
   10732 	ptr = buf;
   10733 	int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   10734 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10735 
   10736 		memcpy(ptr, &mode, 4); ptr += 4;
   10737 		memcpy(ptr, &offset, 4); ptr += 4;
   10738 
   10739 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10740 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10741 
   10742 }
   10743 
   10744 void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen)
   10745 {
   10746 
   10747 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10748 	IOStream *stream = ctx->m_stream;
   10749 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10750 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10751 
   10752 	const unsigned int __size_indirect =  datalen;
   10753 	 unsigned char *ptr;
   10754 	 unsigned char *buf;
   10755 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4;
   10756 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10757 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10758 	buf = stream->alloc(totalSize);
   10759 	ptr = buf;
   10760 	int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   10761 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10762 
   10763 		memcpy(ptr, &mode, 4); ptr += 4;
   10764 		memcpy(ptr, &type, 4); ptr += 4;
   10765 	*(unsigned int *)(ptr) = __size_indirect; ptr += 4;
   10766 	memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
   10767 		memcpy(ptr, &datalen, 4); ptr += 4;
   10768 
   10769 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10770 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10771 
   10772 }
   10773 
   10774 void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset)
   10775 {
   10776 
   10777 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10778 	IOStream *stream = ctx->m_stream;
   10779 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10780 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10781 
   10782 	 unsigned char *ptr;
   10783 	 unsigned char *buf;
   10784 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   10785 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10786 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10787 	buf = stream->alloc(totalSize);
   10788 	ptr = buf;
   10789 	int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
   10790 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10791 
   10792 		memcpy(ptr, &mode, 4); ptr += 4;
   10793 		memcpy(ptr, &type, 4); ptr += 4;
   10794 		memcpy(ptr, &offset, 4); ptr += 4;
   10795 
   10796 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10797 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10798 
   10799 }
   10800 
   10801 void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
   10802 {
   10803 
   10804 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10805 	IOStream *stream = ctx->m_stream;
   10806 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10807 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10808 
   10809 	 unsigned char *ptr;
   10810 	 unsigned char *buf;
   10811 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1;
   10812 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10813 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10814 	buf = stream->alloc(totalSize);
   10815 	ptr = buf;
   10816 	int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
   10817 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10818 
   10819 		memcpy(ptr, &target, 4); ptr += 4;
   10820 		memcpy(ptr, &samples, 4); ptr += 4;
   10821 		memcpy(ptr, &internalformat, 4); ptr += 4;
   10822 		memcpy(ptr, &width, 4); ptr += 4;
   10823 		memcpy(ptr, &height, 4); ptr += 4;
   10824 		memcpy(ptr, &fixedsamplelocations, 1); ptr += 1;
   10825 
   10826 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10827 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10828 
   10829 }
   10830 
   10831 void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask)
   10832 {
   10833 
   10834 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10835 	IOStream *stream = ctx->m_stream;
   10836 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10837 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10838 
   10839 	 unsigned char *ptr;
   10840 	 unsigned char *buf;
   10841 	 const size_t sizeWithoutChecksum = 8 + 4 + 4;
   10842 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10843 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10844 	buf = stream->alloc(totalSize);
   10845 	ptr = buf;
   10846 	int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4;
   10847 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10848 
   10849 		memcpy(ptr, &maskNumber, 4); ptr += 4;
   10850 		memcpy(ptr, &mask, 4); ptr += 4;
   10851 
   10852 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10853 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10854 
   10855 }
   10856 
   10857 void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val)
   10858 {
   10859 
   10860 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10861 	IOStream *stream = ctx->m_stream;
   10862 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10863 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10864 
   10865 	const unsigned int __size_val =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   10866 	 unsigned char *ptr;
   10867 	 unsigned char *buf;
   10868 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   10869 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10870 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10871 	buf = stream->alloc(totalSize);
   10872 	ptr = buf;
   10873 	int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4;
   10874 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10875 
   10876 		memcpy(ptr, &pname, 4); ptr += 4;
   10877 		memcpy(ptr, &index, 4); ptr += 4;
   10878 	*(unsigned int *)(ptr) = __size_val; ptr += 4;
   10879 
   10880 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10881 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10882 
   10883 	stream->readback(val, __size_val);
   10884 	if (useChecksum) checksumCalculator->addBuffer(val, __size_val);
   10885 	if (useChecksum) {
   10886 		unsigned char *checksumBufPtr = NULL;
   10887 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10888 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10889 		stream->readback(checksumBufPtr, checksumSize);
   10890 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10891 			ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n");
   10892 			abort();
   10893 		}
   10894 	}
   10895 }
   10896 
   10897 void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
   10898 {
   10899 
   10900 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10901 	IOStream *stream = ctx->m_stream;
   10902 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10903 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10904 
   10905 	 unsigned char *ptr;
   10906 	 unsigned char *buf;
   10907 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
   10908 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10909 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10910 	buf = stream->alloc(totalSize);
   10911 	ptr = buf;
   10912 	int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
   10913 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10914 
   10915 		memcpy(ptr, &target, 4); ptr += 4;
   10916 		memcpy(ptr, &pname, 4); ptr += 4;
   10917 		memcpy(ptr, &param, 4); ptr += 4;
   10918 
   10919 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10920 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10921 
   10922 }
   10923 
   10924 void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
   10925 {
   10926 
   10927 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10928 	IOStream *stream = ctx->m_stream;
   10929 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10930 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10931 
   10932 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   10933 	 unsigned char *ptr;
   10934 	 unsigned char *buf;
   10935 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
   10936 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10937 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10938 	buf = stream->alloc(totalSize);
   10939 	ptr = buf;
   10940 	int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   10941 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10942 
   10943 		memcpy(ptr, &target, 4); ptr += 4;
   10944 		memcpy(ptr, &pname, 4); ptr += 4;
   10945 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   10946 
   10947 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10948 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10949 
   10950 	stream->readback(params, __size_params);
   10951 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   10952 	if (useChecksum) {
   10953 		unsigned char *checksumBufPtr = NULL;
   10954 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10955 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10956 		stream->readback(checksumBufPtr, checksumSize);
   10957 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10958 			ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
   10959 			abort();
   10960 		}
   10961 	}
   10962 }
   10963 
   10964 void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params)
   10965 {
   10966 
   10967 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   10968 	IOStream *stream = ctx->m_stream;
   10969 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   10970 	bool useChecksum = checksumCalculator->getVersion() > 0;
   10971 
   10972 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLfloat));
   10973 	 unsigned char *ptr;
   10974 	 unsigned char *buf;
   10975 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
   10976 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   10977 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   10978 	buf = stream->alloc(totalSize);
   10979 	ptr = buf;
   10980 	int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
   10981 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   10982 
   10983 		memcpy(ptr, &target, 4); ptr += 4;
   10984 		memcpy(ptr, &level, 4); ptr += 4;
   10985 		memcpy(ptr, &pname, 4); ptr += 4;
   10986 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   10987 
   10988 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   10989 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   10990 
   10991 	stream->readback(params, __size_params);
   10992 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   10993 	if (useChecksum) {
   10994 		unsigned char *checksumBufPtr = NULL;
   10995 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   10996 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   10997 		stream->readback(checksumBufPtr, checksumSize);
   10998 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   10999 			ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n");
   11000 			abort();
   11001 		}
   11002 	}
   11003 }
   11004 
   11005 void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params)
   11006 {
   11007 
   11008 	gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
   11009 	IOStream *stream = ctx->m_stream;
   11010 	ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
   11011 	bool useChecksum = checksumCalculator->getVersion() > 0;
   11012 
   11013 	const unsigned int __size_params =  (glUtilsParamSize(pname) * sizeof(GLint));
   11014 	 unsigned char *ptr;
   11015 	 unsigned char *buf;
   11016 	 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
   11017 	 const size_t checksumSize = checksumCalculator->checksumByteSize();
   11018 	 const size_t totalSize = sizeWithoutChecksum + checksumSize;
   11019 	buf = stream->alloc(totalSize);
   11020 	ptr = buf;
   11021 	int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
   11022 	memcpy(ptr, &totalSize, 4);  ptr += 4;
   11023 
   11024 		memcpy(ptr, &target, 4); ptr += 4;
   11025 		memcpy(ptr, &level, 4); ptr += 4;
   11026 		memcpy(ptr, &pname, 4); ptr += 4;
   11027 	*(unsigned int *)(ptr) = __size_params; ptr += 4;
   11028 
   11029 	if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
   11030 	if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
   11031 
   11032 	stream->readback(params, __size_params);
   11033 	if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
   11034 	if (useChecksum) {
   11035 		unsigned char *checksumBufPtr = NULL;
   11036 		unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
   11037 		if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
   11038 		stream->readback(checksumBufPtr, checksumSize);
   11039 		if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
   11040 			ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n");
   11041 			abort();
   11042 		}
   11043 	}
   11044 }
   11045 
   11046 }  // namespace
   11047 
   11048 gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
   11049 {
   11050 	m_stream = stream;
   11051 	m_checksumCalculator = checksumCalculator;
   11052 
   11053 	this->glActiveTexture = &glActiveTexture_enc;
   11054 	this->glAttachShader = &glAttachShader_enc;
   11055 	this->glBindAttribLocation = &glBindAttribLocation_enc;
   11056 	this->glBindBuffer = &glBindBuffer_enc;
   11057 	this->glBindFramebuffer = &glBindFramebuffer_enc;
   11058 	this->glBindRenderbuffer = &glBindRenderbuffer_enc;
   11059 	this->glBindTexture = &glBindTexture_enc;
   11060 	this->glBlendColor = &glBlendColor_enc;
   11061 	this->glBlendEquation = &glBlendEquation_enc;
   11062 	this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
   11063 	this->glBlendFunc = &glBlendFunc_enc;
   11064 	this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
   11065 	this->glBufferData = &glBufferData_enc;
   11066 	this->glBufferSubData = &glBufferSubData_enc;
   11067 	this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
   11068 	this->glClear = &glClear_enc;
   11069 	this->glClearColor = &glClearColor_enc;
   11070 	this->glClearDepthf = &glClearDepthf_enc;
   11071 	this->glClearStencil = &glClearStencil_enc;
   11072 	this->glColorMask = &glColorMask_enc;
   11073 	this->glCompileShader = &glCompileShader_enc;
   11074 	this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
   11075 	this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
   11076 	this->glCopyTexImage2D = &glCopyTexImage2D_enc;
   11077 	this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
   11078 	this->glCreateProgram = &glCreateProgram_enc;
   11079 	this->glCreateShader = &glCreateShader_enc;
   11080 	this->glCullFace = &glCullFace_enc;
   11081 	this->glDeleteBuffers = &glDeleteBuffers_enc;
   11082 	this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
   11083 	this->glDeleteProgram = &glDeleteProgram_enc;
   11084 	this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
   11085 	this->glDeleteShader = &glDeleteShader_enc;
   11086 	this->glDeleteTextures = &glDeleteTextures_enc;
   11087 	this->glDepthFunc = &glDepthFunc_enc;
   11088 	this->glDepthMask = &glDepthMask_enc;
   11089 	this->glDepthRangef = &glDepthRangef_enc;
   11090 	this->glDetachShader = &glDetachShader_enc;
   11091 	this->glDisable = &glDisable_enc;
   11092 	this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
   11093 	this->glDrawArrays = &glDrawArrays_enc;
   11094 	this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
   11095 	this->glEnable = &glEnable_enc;
   11096 	this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
   11097 	this->glFinish = &glFinish_enc;
   11098 	this->glFlush = &glFlush_enc;
   11099 	this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
   11100 	this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
   11101 	this->glFrontFace = &glFrontFace_enc;
   11102 	this->glGenBuffers = &glGenBuffers_enc;
   11103 	this->glGenerateMipmap = &glGenerateMipmap_enc;
   11104 	this->glGenFramebuffers = &glGenFramebuffers_enc;
   11105 	this->glGenRenderbuffers = &glGenRenderbuffers_enc;
   11106 	this->glGenTextures = &glGenTextures_enc;
   11107 	this->glGetActiveAttrib = &glGetActiveAttrib_enc;
   11108 	this->glGetActiveUniform = &glGetActiveUniform_enc;
   11109 	this->glGetAttachedShaders = &glGetAttachedShaders_enc;
   11110 	this->glGetAttribLocation = &glGetAttribLocation_enc;
   11111 	this->glGetBooleanv = &glGetBooleanv_enc;
   11112 	this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
   11113 	this->glGetError = &glGetError_enc;
   11114 	this->glGetFloatv = &glGetFloatv_enc;
   11115 	this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
   11116 	this->glGetIntegerv = &glGetIntegerv_enc;
   11117 	this->glGetProgramiv = &glGetProgramiv_enc;
   11118 	this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
   11119 	this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
   11120 	this->glGetShaderiv = &glGetShaderiv_enc;
   11121 	this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
   11122 	this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
   11123 	this->glGetShaderSource = &glGetShaderSource_enc;
   11124 	this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
   11125 	this->glGetTexParameterfv = &glGetTexParameterfv_enc;
   11126 	this->glGetTexParameteriv = &glGetTexParameteriv_enc;
   11127 	this->glGetUniformfv = &glGetUniformfv_enc;
   11128 	this->glGetUniformiv = &glGetUniformiv_enc;
   11129 	this->glGetUniformLocation = &glGetUniformLocation_enc;
   11130 	this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
   11131 	this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
   11132 	this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
   11133 	this->glHint = &glHint_enc;
   11134 	this->glIsBuffer = &glIsBuffer_enc;
   11135 	this->glIsEnabled = &glIsEnabled_enc;
   11136 	this->glIsFramebuffer = &glIsFramebuffer_enc;
   11137 	this->glIsProgram = &glIsProgram_enc;
   11138 	this->glIsRenderbuffer = &glIsRenderbuffer_enc;
   11139 	this->glIsShader = &glIsShader_enc;
   11140 	this->glIsTexture = &glIsTexture_enc;
   11141 	this->glLineWidth = &glLineWidth_enc;
   11142 	this->glLinkProgram = &glLinkProgram_enc;
   11143 	this->glPixelStorei = &glPixelStorei_enc;
   11144 	this->glPolygonOffset = &glPolygonOffset_enc;
   11145 	this->glReadPixels = &glReadPixels_enc;
   11146 	this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
   11147 	this->glRenderbufferStorage = &glRenderbufferStorage_enc;
   11148 	this->glSampleCoverage = &glSampleCoverage_enc;
   11149 	this->glScissor = &glScissor_enc;
   11150 	this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
   11151 	this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
   11152 	this->glStencilFunc = &glStencilFunc_enc;
   11153 	this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
   11154 	this->glStencilMask = &glStencilMask_enc;
   11155 	this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
   11156 	this->glStencilOp = &glStencilOp_enc;
   11157 	this->glStencilOpSeparate = &glStencilOpSeparate_enc;
   11158 	this->glTexImage2D = &glTexImage2D_enc;
   11159 	this->glTexParameterf = &glTexParameterf_enc;
   11160 	this->glTexParameterfv = &glTexParameterfv_enc;
   11161 	this->glTexParameteri = &glTexParameteri_enc;
   11162 	this->glTexParameteriv = &glTexParameteriv_enc;
   11163 	this->glTexSubImage2D = &glTexSubImage2D_enc;
   11164 	this->glUniform1f = &glUniform1f_enc;
   11165 	this->glUniform1fv = &glUniform1fv_enc;
   11166 	this->glUniform1i = &glUniform1i_enc;
   11167 	this->glUniform1iv = &glUniform1iv_enc;
   11168 	this->glUniform2f = &glUniform2f_enc;
   11169 	this->glUniform2fv = &glUniform2fv_enc;
   11170 	this->glUniform2i = &glUniform2i_enc;
   11171 	this->glUniform2iv = &glUniform2iv_enc;
   11172 	this->glUniform3f = &glUniform3f_enc;
   11173 	this->glUniform3fv = &glUniform3fv_enc;
   11174 	this->glUniform3i = &glUniform3i_enc;
   11175 	this->glUniform3iv = &glUniform3iv_enc;
   11176 	this->glUniform4f = &glUniform4f_enc;
   11177 	this->glUniform4fv = &glUniform4fv_enc;
   11178 	this->glUniform4i = &glUniform4i_enc;
   11179 	this->glUniform4iv = &glUniform4iv_enc;
   11180 	this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
   11181 	this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
   11182 	this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
   11183 	this->glUseProgram = &glUseProgram_enc;
   11184 	this->glValidateProgram = &glValidateProgram_enc;
   11185 	this->glVertexAttrib1f = &glVertexAttrib1f_enc;
   11186 	this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
   11187 	this->glVertexAttrib2f = &glVertexAttrib2f_enc;
   11188 	this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
   11189 	this->glVertexAttrib3f = &glVertexAttrib3f_enc;
   11190 	this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
   11191 	this->glVertexAttrib4f = &glVertexAttrib4f_enc;
   11192 	this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
   11193 	this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
   11194 	this->glViewport = &glViewport_enc;
   11195 	this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
   11196 	this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
   11197 	this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
   11198 	this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
   11199 	this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
   11200 	this->glUnmapBufferOES = &glUnmapBufferOES_enc;
   11201 	this->glTexImage3DOES = &glTexImage3DOES_enc;
   11202 	this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
   11203 	this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
   11204 	this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
   11205 	this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
   11206 	this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
   11207 	this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
   11208 	this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
   11209 	this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
   11210 	this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
   11211 	this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
   11212 	this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
   11213 	this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
   11214 	this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
   11215 	this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
   11216 	this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
   11217 	this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
   11218 	this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
   11219 	this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
   11220 	this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
   11221 	this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
   11222 	this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
   11223 	this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
   11224 	this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
   11225 	this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
   11226 	this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
   11227 	this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
   11228 	this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
   11229 	this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
   11230 	this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
   11231 	this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
   11232 	this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
   11233 	this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
   11234 	this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
   11235 	this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
   11236 	this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
   11237 	this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
   11238 	this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
   11239 	this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
   11240 	this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
   11241 	this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
   11242 	this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
   11243 	this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
   11244 	this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
   11245 	this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
   11246 	this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
   11247 	this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
   11248 	this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
   11249 	this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
   11250 	this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
   11251 	this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
   11252 	this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
   11253 	this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
   11254 	this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
   11255 	this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
   11256 	this->glDrawElementsOffset = &glDrawElementsOffset_enc;
   11257 	this->glDrawElementsData = &glDrawElementsData_enc;
   11258 	this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
   11259 	this->glShaderString = &glShaderString_enc;
   11260 	this->glFinishRoundTrip = &glFinishRoundTrip_enc;
   11261 	this->glGenVertexArrays = &glGenVertexArrays_enc;
   11262 	this->glBindVertexArray = &glBindVertexArray_enc;
   11263 	this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
   11264 	this->glIsVertexArray = &glIsVertexArray_enc;
   11265 	this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
   11266 	this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
   11267 	this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
   11268 	this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
   11269 	this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
   11270 	this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
   11271 	this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
   11272 	this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
   11273 	this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
   11274 	this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
   11275 	this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
   11276 	this->glBindBufferRange = &glBindBufferRange_enc;
   11277 	this->glBindBufferBase = &glBindBufferBase_enc;
   11278 	this->glCopyBufferSubData = &glCopyBufferSubData_enc;
   11279 	this->glClearBufferiv = &glClearBufferiv_enc;
   11280 	this->glClearBufferuiv = &glClearBufferuiv_enc;
   11281 	this->glClearBufferfv = &glClearBufferfv_enc;
   11282 	this->glClearBufferfi = &glClearBufferfi_enc;
   11283 	this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
   11284 	this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
   11285 	this->glUniformBlockBinding = &glUniformBlockBinding_enc;
   11286 	this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
   11287 	this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
   11288 	this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
   11289 	this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
   11290 	this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
   11291 	this->glUniform1ui = &glUniform1ui_enc;
   11292 	this->glUniform2ui = &glUniform2ui_enc;
   11293 	this->glUniform3ui = &glUniform3ui_enc;
   11294 	this->glUniform4ui = &glUniform4ui_enc;
   11295 	this->glUniform1uiv = &glUniform1uiv_enc;
   11296 	this->glUniform2uiv = &glUniform2uiv_enc;
   11297 	this->glUniform3uiv = &glUniform3uiv_enc;
   11298 	this->glUniform4uiv = &glUniform4uiv_enc;
   11299 	this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
   11300 	this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
   11301 	this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
   11302 	this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
   11303 	this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
   11304 	this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
   11305 	this->glGetUniformuiv = &glGetUniformuiv_enc;
   11306 	this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
   11307 	this->glVertexAttribI4i = &glVertexAttribI4i_enc;
   11308 	this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
   11309 	this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
   11310 	this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
   11311 	this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
   11312 	this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
   11313 	this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
   11314 	this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
   11315 	this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
   11316 	this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
   11317 	this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
   11318 	this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
   11319 	this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
   11320 	this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
   11321 	this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
   11322 	this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
   11323 	this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
   11324 	this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
   11325 	this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
   11326 	this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
   11327 	this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
   11328 	this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
   11329 	this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
   11330 	this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
   11331 	this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
   11332 	this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
   11333 	this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
   11334 	this->glIsSyncAEMU = &glIsSyncAEMU_enc;
   11335 	this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
   11336 	this->glDrawBuffers = &glDrawBuffers_enc;
   11337 	this->glReadBuffer = &glReadBuffer_enc;
   11338 	this->glBlitFramebuffer = &glBlitFramebuffer_enc;
   11339 	this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
   11340 	this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
   11341 	this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
   11342 	this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
   11343 	this->glTexStorage2D = &glTexStorage2D_enc;
   11344 	this->glGetInternalformativ = &glGetInternalformativ_enc;
   11345 	this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
   11346 	this->glEndTransformFeedback = &glEndTransformFeedback_enc;
   11347 	this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
   11348 	this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
   11349 	this->glBindTransformFeedback = &glBindTransformFeedback_enc;
   11350 	this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
   11351 	this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
   11352 	this->glIsTransformFeedback = &glIsTransformFeedback_enc;
   11353 	this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
   11354 	this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
   11355 	this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
   11356 	this->glGenSamplers = &glGenSamplers_enc;
   11357 	this->glDeleteSamplers = &glDeleteSamplers_enc;
   11358 	this->glBindSampler = &glBindSampler_enc;
   11359 	this->glSamplerParameterf = &glSamplerParameterf_enc;
   11360 	this->glSamplerParameteri = &glSamplerParameteri_enc;
   11361 	this->glSamplerParameterfv = &glSamplerParameterfv_enc;
   11362 	this->glSamplerParameteriv = &glSamplerParameteriv_enc;
   11363 	this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
   11364 	this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
   11365 	this->glIsSampler = &glIsSampler_enc;
   11366 	this->glGenQueries = &glGenQueries_enc;
   11367 	this->glDeleteQueries = &glDeleteQueries_enc;
   11368 	this->glBeginQuery = &glBeginQuery_enc;
   11369 	this->glEndQuery = &glEndQuery_enc;
   11370 	this->glGetQueryiv = &glGetQueryiv_enc;
   11371 	this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
   11372 	this->glIsQuery = &glIsQuery_enc;
   11373 	this->glProgramParameteri = &glProgramParameteri_enc;
   11374 	this->glProgramBinary = &glProgramBinary_enc;
   11375 	this->glGetProgramBinary = &glGetProgramBinary_enc;
   11376 	this->glGetFragDataLocation = &glGetFragDataLocation_enc;
   11377 	this->glGetInteger64v = &glGetInteger64v_enc;
   11378 	this->glGetIntegeri_v = &glGetIntegeri_v_enc;
   11379 	this->glGetInteger64i_v = &glGetInteger64i_v_enc;
   11380 	this->glTexImage3D = &glTexImage3D_enc;
   11381 	this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
   11382 	this->glTexStorage3D = &glTexStorage3D_enc;
   11383 	this->glTexSubImage3D = &glTexSubImage3D_enc;
   11384 	this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
   11385 	this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
   11386 	this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
   11387 	this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
   11388 	this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
   11389 	this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
   11390 	this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
   11391 	this->glGetBooleani_v = &glGetBooleani_v_enc;
   11392 	this->glMemoryBarrier = &glMemoryBarrier_enc;
   11393 	this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
   11394 	this->glGenProgramPipelines = &glGenProgramPipelines_enc;
   11395 	this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
   11396 	this->glBindProgramPipeline = &glBindProgramPipeline_enc;
   11397 	this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
   11398 	this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
   11399 	this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
   11400 	this->glIsProgramPipeline = &glIsProgramPipeline_enc;
   11401 	this->glUseProgramStages = &glUseProgramStages_enc;
   11402 	this->glActiveShaderProgram = &glActiveShaderProgram_enc;
   11403 	this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
   11404 	this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
   11405 	this->glProgramUniform1f = &glProgramUniform1f_enc;
   11406 	this->glProgramUniform2f = &glProgramUniform2f_enc;
   11407 	this->glProgramUniform3f = &glProgramUniform3f_enc;
   11408 	this->glProgramUniform4f = &glProgramUniform4f_enc;
   11409 	this->glProgramUniform1i = &glProgramUniform1i_enc;
   11410 	this->glProgramUniform2i = &glProgramUniform2i_enc;
   11411 	this->glProgramUniform3i = &glProgramUniform3i_enc;
   11412 	this->glProgramUniform4i = &glProgramUniform4i_enc;
   11413 	this->glProgramUniform1ui = &glProgramUniform1ui_enc;
   11414 	this->glProgramUniform2ui = &glProgramUniform2ui_enc;
   11415 	this->glProgramUniform3ui = &glProgramUniform3ui_enc;
   11416 	this->glProgramUniform4ui = &glProgramUniform4ui_enc;
   11417 	this->glProgramUniform1fv = &glProgramUniform1fv_enc;
   11418 	this->glProgramUniform2fv = &glProgramUniform2fv_enc;
   11419 	this->glProgramUniform3fv = &glProgramUniform3fv_enc;
   11420 	this->glProgramUniform4fv = &glProgramUniform4fv_enc;
   11421 	this->glProgramUniform1iv = &glProgramUniform1iv_enc;
   11422 	this->glProgramUniform2iv = &glProgramUniform2iv_enc;
   11423 	this->glProgramUniform3iv = &glProgramUniform3iv_enc;
   11424 	this->glProgramUniform4iv = &glProgramUniform4iv_enc;
   11425 	this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
   11426 	this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
   11427 	this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
   11428 	this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
   11429 	this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
   11430 	this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
   11431 	this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
   11432 	this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
   11433 	this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
   11434 	this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
   11435 	this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
   11436 	this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
   11437 	this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
   11438 	this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
   11439 	this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
   11440 	this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
   11441 	this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
   11442 	this->glGetProgramResourceName = &glGetProgramResourceName_enc;
   11443 	this->glBindImageTexture = &glBindImageTexture_enc;
   11444 	this->glDispatchCompute = &glDispatchCompute_enc;
   11445 	this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
   11446 	this->glBindVertexBuffer = &glBindVertexBuffer_enc;
   11447 	this->glVertexAttribBinding = &glVertexAttribBinding_enc;
   11448 	this->glVertexAttribFormat = &glVertexAttribFormat_enc;
   11449 	this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
   11450 	this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
   11451 	this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
   11452 	this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
   11453 	this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
   11454 	this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
   11455 	this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
   11456 	this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
   11457 	this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
   11458 	this->glSampleMaski = &glSampleMaski_enc;
   11459 	this->glGetMultisamplefv = &glGetMultisamplefv_enc;
   11460 	this->glFramebufferParameteri = &glFramebufferParameteri_enc;
   11461 	this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
   11462 	this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
   11463 	this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
   11464 }
   11465 
   11466