blob: 814021bb615b2e191d72dec164d2755ea5cad00c [file] [log] [blame]
// Generated Code - DO NOT EDIT !!
// generated by 'emugen'
#include <string.h>
#include "gl2_opcodes.h"
#include "gl2_enc.h"
#include <vector>
#include <stdio.h>
namespace {
void enc_unsupported()
{
ALOGE("Function is unsupported\n");
}
void glActiveTexture_enc(void *self , GLenum texture)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &texture, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glAttachShader_enc(void *self , GLuint program, GLuint shader)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &shader, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_name = (strlen(name) + 1);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &index, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
memcpy(ptr, name, __size_name);ptr += __size_name;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &buffer, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &framebuffer, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &renderbuffer, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBindTexture_enc(void *self , GLenum target, GLuint texture)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &texture, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &red, 4); ptr += 4;
memcpy(ptr, &green, 4); ptr += 4;
memcpy(ptr, &blue, 4); ptr += 4;
memcpy(ptr, &alpha, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBlendEquation_enc(void *self , GLenum mode)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &mode, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &modeRGB, 4); ptr += 4;
memcpy(ptr, &modeAlpha, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &sfactor, 4); ptr += 4;
memcpy(ptr, &dfactor, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &srcRGB, 4); ptr += 4;
memcpy(ptr, &dstRGB, 4); ptr += 4;
memcpy(ptr, &srcAlpha, 4); ptr += 4;
memcpy(ptr, &dstAlpha, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_data = ((data != NULL) ? size : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(8 + 4 + 4);
ptr = buf;
int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &size, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
stream->flush();
stream->writeFully(&__size_data,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
if (data != NULL) {
stream->writeFully(data, __size_data);
if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
}
buf = stream->alloc(4);
ptr = buf;
memcpy(ptr, &usage, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
buf = stream->alloc(checksumSize);
if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
}
void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_data = ((data != NULL) ? size : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(8 + 4 + 4 + 4);
ptr = buf;
int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &offset, 4); ptr += 4;
memcpy(ptr, &size, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
stream->flush();
stream->writeFully(&__size_data,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
if (data != NULL) {
stream->writeFully(data, __size_data);
if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
}
buf = stream->alloc(checksumSize);
if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
}
GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
GLenum retval;
stream->readback(&retval, 4);
if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
return retval;
}
void glClear_enc(void *self , GLbitfield mask)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &mask, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &red, 4); ptr += 4;
memcpy(ptr, &green, 4); ptr += 4;
memcpy(ptr, &blue, 4); ptr += 4;
memcpy(ptr, &alpha, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glClearDepthf_enc(void *self , GLclampf depth)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &depth, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glClearStencil_enc(void *self , GLint s)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &s, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &red, 1); ptr += 1;
memcpy(ptr, &green, 1); ptr += 1;
memcpy(ptr, &blue, 1); ptr += 1;
memcpy(ptr, &alpha, 1); ptr += 1;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glCompileShader_enc(void *self , GLuint shader)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &shader, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
ptr = buf;
int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &level, 4); ptr += 4;
memcpy(ptr, &internalformat, 4); ptr += 4;
memcpy(ptr, &width, 4); ptr += 4;
memcpy(ptr, &height, 4); ptr += 4;
memcpy(ptr, &border, 4); ptr += 4;
memcpy(ptr, &imageSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
stream->flush();
stream->writeFully(&__size_data,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
if (data != NULL) {
stream->writeFully(data, __size_data);
if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
}
buf = stream->alloc(checksumSize);
if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
}
void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
ptr = buf;
int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &level, 4); ptr += 4;
memcpy(ptr, &xoffset, 4); ptr += 4;
memcpy(ptr, &yoffset, 4); ptr += 4;
memcpy(ptr, &width, 4); ptr += 4;
memcpy(ptr, &height, 4); ptr += 4;
memcpy(ptr, &format, 4); ptr += 4;
memcpy(ptr, &imageSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
stream->flush();
stream->writeFully(&__size_data,4);
if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
if (data != NULL) {
stream->writeFully(data, __size_data);
if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
}
buf = stream->alloc(checksumSize);
if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
}
void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &level, 4); ptr += 4;
memcpy(ptr, &internalformat, 4); ptr += 4;
memcpy(ptr, &x, 4); ptr += 4;
memcpy(ptr, &y, 4); ptr += 4;
memcpy(ptr, &width, 4); ptr += 4;
memcpy(ptr, &height, 4); ptr += 4;
memcpy(ptr, &border, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &level, 4); ptr += 4;
memcpy(ptr, &xoffset, 4); ptr += 4;
memcpy(ptr, &yoffset, 4); ptr += 4;
memcpy(ptr, &x, 4); ptr += 4;
memcpy(ptr, &y, 4); ptr += 4;
memcpy(ptr, &width, 4); ptr += 4;
memcpy(ptr, &height, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
GLuint glCreateProgram_enc(void *self )
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
GLuint retval;
stream->readback(&retval, 4);
if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
return retval;
}
GLuint glCreateShader_enc(void *self , GLenum type)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &type, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
GLuint retval;
stream->readback(&retval, 4);
if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
return retval;
}
void glCullFace_enc(void *self , GLenum mode)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &mode, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_buffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_framebuffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteProgram_enc(void *self , GLuint program)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteShader_enc(void *self , GLuint shader)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &shader, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_textures = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_textures; ptr += 4;
memcpy(ptr, textures, __size_textures);ptr += __size_textures;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDepthFunc_enc(void *self , GLenum func)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &func, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDepthMask_enc(void *self , GLboolean flag)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 1;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &flag, 1); ptr += 1;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &zNear, 4); ptr += 4;
memcpy(ptr, &zFar, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDetachShader_enc(void *self , GLuint program, GLuint shader)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &shader, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDisable_enc(void *self , GLenum cap)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &cap, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDisableVertexAttribArray_enc(void *self , GLuint index)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &index, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &mode, 4); ptr += 4;
memcpy(ptr, &first, 4); ptr += 4;
memcpy(ptr, &count, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glEnable_enc(void *self , GLenum cap)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &cap, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glEnableVertexAttribArray_enc(void *self , GLuint index)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &index, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glFinish_enc(void *self )
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glFlush_enc(void *self )
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &attachment, 4); ptr += 4;
memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
memcpy(ptr, &renderbuffer, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &attachment, 4); ptr += 4;
memcpy(ptr, &textarget, 4); ptr += 4;
memcpy(ptr, &texture, 4); ptr += 4;
memcpy(ptr, &level, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glFrontFace_enc(void *self , GLenum mode)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &mode, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_buffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_buffers; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(buffers, __size_buffers);
if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGenerateMipmap_enc(void *self , GLenum target)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
}
void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_framebuffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(framebuffers, __size_framebuffers);
if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(renderbuffers, __size_renderbuffers);
if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_textures = (n * sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &n, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_textures; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(textures, __size_textures);
if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &index, 4); ptr += 4;
memcpy(ptr, &bufsize, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_length; ptr += 4;
*(unsigned int *)(ptr) = __size_size; ptr += 4;
*(unsigned int *)(ptr) = __size_type; ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
if (length != NULL) {
stream->readback(length, __size_length);
if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
}
if (size != NULL) {
stream->readback(size, __size_size);
if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
}
if (type != NULL) {
stream->readback(type, __size_type);
if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
}
if (name != NULL) {
stream->readback(name, __size_name);
if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
}
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &index, 4); ptr += 4;
memcpy(ptr, &bufsize, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_length; ptr += 4;
*(unsigned int *)(ptr) = __size_size; ptr += 4;
*(unsigned int *)(ptr) = __size_type; ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
if (length != NULL) {
stream->readback(length, __size_length);
if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
}
if (size != NULL) {
stream->readback(size, __size_size);
if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
}
if (type != NULL) {
stream->readback(type, __size_type);
if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
}
if (name != NULL) {
stream->readback(name, __size_name);
if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
}
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_count = ((count != NULL) ? (sizeof(GLsizei)) : 0);
const unsigned int __size_shaders = (maxcount*sizeof(GLuint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &maxcount, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_count; ptr += 4;
*(unsigned int *)(ptr) = __size_shaders; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
if (count != NULL) {
stream->readback(count, __size_count);
if (useChecksum) checksumCalculator->addBuffer(count, __size_count);
}
stream->readback(shaders, __size_shaders);
if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_name = (strlen(name) + 1);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_name; ptr += 4;
memcpy(ptr, name, __size_name);ptr += __size_name;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
int retval;
stream->readback(&retval, 4);
if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
return retval;
}
void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (sizeof(GLint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
GLenum glGetError_enc(void *self )
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
GLenum retval;
stream->readback(&retval, 4);
if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
return retval;
}
void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (sizeof(GLint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &attachment, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_params; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
stream->readback(params, __size_params);
if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
const unsigned int __size_infolog = bufsize;
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
const size_t checksumSize = checksumCalculator->checksumByteSize();
const size_t totalSize = sizeWithoutChecksum + checksumSize;
buf = stream->alloc(totalSize);
ptr = buf;
int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &program, 4); ptr += 4;
memcpy(ptr, &bufsize, 4); ptr += 4;
*(unsigned int *)(ptr) = __size_length; ptr += 4;
*(unsigned int *)(ptr) = __size_infolog; ptr += 4;
if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
if (length != NULL) {
stream->readback(length, __size_length);
if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
}
stream->readback(infolog, __size_infolog);
if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
if (useChecksum) {
unsigned char *checksumBufPtr = NULL;
unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
stream->readback(checksumBufPtr, checksumSize);
if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
{
gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
IOStream *stream = ctx->m_stream;
ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
bool useChecksum = checksumCalculator->getVersion() > 0;
const unsigned int __size_params = sizeof(GLint);
unsigned char *ptr;
unsigned char *buf;
const size_t sizeWithoutChecksum = 8 + <