blob: 3bc0162ba3d9ce40f6d150fb14ad3c39ccdb2550 [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>
#include "aemu/base/Tracing.h"
#include "EncoderDebug.h"
namespace {
void enc_unsupported()
{
ALOGE("Function is unsupported\n");
}
void glActiveTexture_enc(void *self , GLenum texture)
{
ENCODER_DEBUG_LOG("glActiveTexture(texture:0x%08x)", texture);
AEMU_SCOPED_TRACE("glActiveTexture encode");
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)
{
ENCODER_DEBUG_LOG("glAttachShader(program:%u, shader:%u)", program, shader);
AEMU_SCOPED_TRACE("glAttachShader encode");
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)
{
ENCODER_DEBUG_LOG("glBindAttribLocation(program:%u, index:%u, name:0x%08x)", program, index, name);
AEMU_SCOPED_TRACE("glBindAttribLocation encode");
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;
memcpy(ptr, &__size_name, 4); 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)
{
ENCODER_DEBUG_LOG("glBindBuffer(target:0x%08x, buffer:%u)", target, buffer);
AEMU_SCOPED_TRACE("glBindBuffer encode");
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)
{
ENCODER_DEBUG_LOG("glBindFramebuffer(target:0x%08x, framebuffer:%u)", target, framebuffer);
AEMU_SCOPED_TRACE("glBindFramebuffer encode");
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)
{
ENCODER_DEBUG_LOG("glBindRenderbuffer(target:0x%08x, renderbuffer:%u)", target, renderbuffer);
AEMU_SCOPED_TRACE("glBindRenderbuffer encode");
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)
{
ENCODER_DEBUG_LOG("glBindTexture(target:0x%08x, texture:%u)", target, texture);
AEMU_SCOPED_TRACE("glBindTexture encode");
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)
{
ENCODER_DEBUG_LOG("glBlendColor(red:%f, green:%f, blue:%f, alpha:%f)", red, green, blue, alpha);
AEMU_SCOPED_TRACE("glBlendColor encode");
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)
{
ENCODER_DEBUG_LOG("glBlendEquation(mode:0x%08x)", mode);
AEMU_SCOPED_TRACE("glBlendEquation encode");
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)
{
ENCODER_DEBUG_LOG("glBlendEquationSeparate(modeRGB:0x%08x, modeAlpha:0x%08x)", modeRGB, modeAlpha);
AEMU_SCOPED_TRACE("glBlendEquationSeparate encode");
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)
{
ENCODER_DEBUG_LOG("glBlendFunc(sfactor:0x%08x, dfactor:0x%08x)", sfactor, dfactor);
AEMU_SCOPED_TRACE("glBlendFunc encode");
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)
{
ENCODER_DEBUG_LOG("glBlendFuncSeparate(srcRGB:0x%08x, dstRGB:0x%08x, srcAlpha:0x%08x, dstAlpha:0x%08x)", srcRGB, dstRGB, srcAlpha, dstAlpha);
AEMU_SCOPED_TRACE("glBlendFuncSeparate encode");
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)
{
ENCODER_DEBUG_LOG("glBufferData(target:0x%08x, size:0x%08lx, data:0x%08x, usage:0x%08x)", target, size, data, usage);
AEMU_SCOPED_TRACE("glBufferData encode");
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)
{
ENCODER_DEBUG_LOG("glBufferSubData(target:0x%08x, offset:0x%08lx, size:0x%08lx, data:0x%08x)", target, offset, size, data);
AEMU_SCOPED_TRACE("glBufferSubData encode");
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)
{
ENCODER_DEBUG_LOG("glCheckFramebufferStatus(target:0x%08x)", target);
AEMU_SCOPED_TRACE("glCheckFramebufferStatus encode");
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)
{
ENCODER_DEBUG_LOG("glClear(mask:0x%08x)", mask);
AEMU_SCOPED_TRACE("glClear encode");
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)
{
ENCODER_DEBUG_LOG("glClearColor(red:%f, green:%f, blue:%f, alpha:%f)", red, green, blue, alpha);
AEMU_SCOPED_TRACE("glClearColor encode");
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)
{
ENCODER_DEBUG_LOG("glClearDepthf(depth:%f)", depth);
AEMU_SCOPED_TRACE("glClearDepthf encode");
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)
{
ENCODER_DEBUG_LOG("glClearStencil(s:%d)", s);
AEMU_SCOPED_TRACE("glClearStencil encode");
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)
{
ENCODER_DEBUG_LOG("glColorMask(red:%d, green:%d, blue:%d, alpha:%d)", red, green, blue, alpha);
AEMU_SCOPED_TRACE("glColorMask encode");
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)
{
ENCODER_DEBUG_LOG("glCompileShader(shader:%u)", shader);
AEMU_SCOPED_TRACE("glCompileShader encode");
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)
{
ENCODER_DEBUG_LOG("glCompressedTexImage2D(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, border:%d, imageSize:%d, data:0x%08x)", target, level, internalformat, width, height, border, imageSize, data);
AEMU_SCOPED_TRACE("glCompressedTexImage2D encode");
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)
{
ENCODER_DEBUG_LOG("glCompressedTexSubImage2D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, width:%d, height:%d, format:0x%08x, imageSize:%d, data:0x%08x)", target, level, xoffset, yoffset, width, height, format, imageSize, data);
AEMU_SCOPED_TRACE("glCompressedTexSubImage2D encode");
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)
{
ENCODER_DEBUG_LOG("glCopyTexImage2D(target:0x%08x, level:%d, internalformat:0x%08x, x:%d, y:%d, width:%d, height:%d, border:%d)", target, level, internalformat, x, y, width, height, border);
AEMU_SCOPED_TRACE("glCopyTexImage2D encode");
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)
{
ENCODER_DEBUG_LOG("glCopyTexSubImage2D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, x:%d, y:%d, width:%d, height:%d)", target, level, xoffset, yoffset, x, y, width, height);
AEMU_SCOPED_TRACE("glCopyTexSubImage2D encode");
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 )
{
ENCODER_DEBUG_LOG("glCreateProgram()");
AEMU_SCOPED_TRACE("glCreateProgram encode");
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)
{
ENCODER_DEBUG_LOG("glCreateShader(type:0x%08x)", type);
AEMU_SCOPED_TRACE("glCreateShader encode");
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)
{
ENCODER_DEBUG_LOG("glCullFace(mode:0x%08x)", mode);
AEMU_SCOPED_TRACE("glCullFace encode");
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)
{
ENCODER_DEBUG_LOG("glDeleteBuffers(n:%d, buffers:0x%08x)", n, buffers);
AEMU_SCOPED_TRACE("glDeleteBuffers encode");
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;
memcpy(ptr, &__size_buffers, 4); 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)
{
ENCODER_DEBUG_LOG("glDeleteFramebuffers(n:%d, framebuffers:0x%08x)", n, framebuffers);
AEMU_SCOPED_TRACE("glDeleteFramebuffers encode");
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;
memcpy(ptr, &__size_framebuffers, 4); 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)
{
ENCODER_DEBUG_LOG("glDeleteProgram(program:%u)", program);
AEMU_SCOPED_TRACE("glDeleteProgram encode");
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)
{
ENCODER_DEBUG_LOG("glDeleteRenderbuffers(n:%d, renderbuffers:0x%08x)", n, renderbuffers);
AEMU_SCOPED_TRACE("glDeleteRenderbuffers encode");
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;
memcpy(ptr, &__size_renderbuffers, 4); 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)
{
ENCODER_DEBUG_LOG("glDeleteShader(shader:%u)", shader);
AEMU_SCOPED_TRACE("glDeleteShader encode");
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)
{
ENCODER_DEBUG_LOG("glDeleteTextures(n:%d, textures:0x%08x)", n, textures);
AEMU_SCOPED_TRACE("glDeleteTextures encode");
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;
memcpy(ptr, &__size_textures, 4); 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)
{
ENCODER_DEBUG_LOG("glDepthFunc(func:0x%08x)", func);
AEMU_SCOPED_TRACE("glDepthFunc encode");
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)
{
ENCODER_DEBUG_LOG("glDepthMask(flag:%d)", flag);
AEMU_SCOPED_TRACE("glDepthMask encode");
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)
{
ENCODER_DEBUG_LOG("glDepthRangef(zNear:%f, zFar:%f)", zNear, zFar);
AEMU_SCOPED_TRACE("glDepthRangef encode");
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)
{
ENCODER_DEBUG_LOG("glDetachShader(program:%u, shader:%u)", program, shader);
AEMU_SCOPED_TRACE("glDetachShader encode");
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)
{
ENCODER_DEBUG_LOG("glDisable(cap:0x%08x)", cap);
AEMU_SCOPED_TRACE("glDisable encode");
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)
{
ENCODER_DEBUG_LOG("glDisableVertexAttribArray(index:%u)", index);
AEMU_SCOPED_TRACE("glDisableVertexAttribArray encode");
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)
{
ENCODER_DEBUG_LOG("glDrawArrays(mode:0x%08x, first:%d, count:%d)", mode, first, count);
AEMU_SCOPED_TRACE("glDrawArrays encode");
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)
{
ENCODER_DEBUG_LOG("glEnable(cap:0x%08x)", cap);
AEMU_SCOPED_TRACE("glEnable encode");
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)
{
ENCODER_DEBUG_LOG("glEnableVertexAttribArray(index:%u)", index);
AEMU_SCOPED_TRACE("glEnableVertexAttribArray encode");
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 )
{
ENCODER_DEBUG_LOG("glFinish()");
AEMU_SCOPED_TRACE("glFinish encode");
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 )
{
ENCODER_DEBUG_LOG("glFlush()");
AEMU_SCOPED_TRACE("glFlush encode");
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)
{
ENCODER_DEBUG_LOG("glFramebufferRenderbuffer(target:0x%08x, attachment:0x%08x, renderbuffertarget:0x%08x, renderbuffer:%u)", target, attachment, renderbuffertarget, renderbuffer);
AEMU_SCOPED_TRACE("glFramebufferRenderbuffer encode");
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)
{
ENCODER_DEBUG_LOG("glFramebufferTexture2D(target:0x%08x, attachment:0x%08x, textarget:0x%08x, texture:%u, level:%d)", target, attachment, textarget, texture, level);
AEMU_SCOPED_TRACE("glFramebufferTexture2D encode");
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)
{
ENCODER_DEBUG_LOG("glFrontFace(mode:0x%08x)", mode);
AEMU_SCOPED_TRACE("glFrontFace encode");
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)
{
ENCODER_DEBUG_LOG("glGenBuffers(n:%d, buffers:0x%08x)", n, buffers);
AEMU_SCOPED_TRACE("glGenBuffers encode");
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;
memcpy(ptr, &__size_buffers, 4); 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)
{
ENCODER_DEBUG_LOG("glGenerateMipmap(target:0x%08x)", target);
AEMU_SCOPED_TRACE("glGenerateMipmap encode");
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)
{
ENCODER_DEBUG_LOG("glGenFramebuffers(n:%d, framebuffers:0x%08x)", n, framebuffers);
AEMU_SCOPED_TRACE("glGenFramebuffers encode");
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;
memcpy(ptr, &__size_framebuffers, 4); 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)
{
ENCODER_DEBUG_LOG("glGenRenderbuffers(n:%d, renderbuffers:0x%08x)", n, renderbuffers);
AEMU_SCOPED_TRACE("glGenRenderbuffers encode");
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;
memcpy(ptr, &__size_renderbuffers, 4); 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)
{
ENCODER_DEBUG_LOG("glGenTextures(n:%d, textures:0x%08x)", n, textures);
AEMU_SCOPED_TRACE("glGenTextures encode");
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;
memcpy(ptr, &__size_textures, 4); 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)
{
ENCODER_DEBUG_LOG("glGetActiveAttrib(program:%u, index:%u, bufsize:%d, length:0x%08x, size:0x%08x, type:0x%08x, name:0x%08x)", program, index, bufsize, length, size, type, name);
AEMU_SCOPED_TRACE("glGetActiveAttrib encode");
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;
memcpy(ptr, &__size_length, 4); ptr += 4;
memcpy(ptr, &__size_size, 4); ptr += 4;
memcpy(ptr, &__size_type, 4); ptr += 4;
memcpy(ptr, &__size_name, 4); 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)
{
ENCODER_DEBUG_LOG("glGetActiveUniform(program:%u, index:%u, bufsize:%d, length:0x%08x, size:0x%08x, type:0x%08x, name:0x%08x)", program, index, bufsize, length, size, type, name);
AEMU_SCOPED_TRACE("glGetActiveUniform encode");
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;
memcpy(ptr, &__size_length, 4); ptr += 4;
memcpy(ptr, &__size_size, 4); ptr += 4;
memcpy(ptr, &__size_type, 4); ptr += 4;
memcpy(ptr, &__size_name, 4); 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)
{
ENCODER_DEBUG_LOG("glGetAttachedShaders(program:%u, maxcount:%d, count:0x%08x, shaders:0x%08x)", program, maxcount, count, shaders);
AEMU_SCOPED_TRACE("glGetAttachedShaders encode");
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;
memcpy(ptr, &__size_count, 4); ptr += 4;
memcpy(ptr, &__size_shaders, 4); 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)
{
ENCODER_DEBUG_LOG("glGetAttribLocation(program:%u, name:0x%08x)", program, name);
AEMU_SCOPED_TRACE("glGetAttribLocation encode");
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;
memcpy(ptr, &__size_name, 4); 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)
{
ENCODER_DEBUG_LOG("glGetBooleanv(pname:0x%08x, params:0x%08x)", pname, params);
AEMU_SCOPED_TRACE("glGetBooleanv encode");
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;
memcpy(ptr, &__size_params, 4); 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)
{
ENCODER_DEBUG_LOG("glGetBufferParameteriv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params);
AEMU_SCOPED_TRACE("glGetBufferParameteriv encode");
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;
memcpy(ptr, &__size_params, 4); 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 )
{
ENCODER_DEBUG_LOG("glGetError()");
AEMU_SCOPED_TRACE("glGetError encode");
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)
{
ENCODER_DEBUG_LOG("glGetFloatv(pname:0x%08x, params:0x%08x)", pname, params);
AEMU_SCOPED_TRACE("glGetFloatv encode");
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;
memcpy(ptr, &__size_params, 4); 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)
{
ENCODER_DEBUG_LOG("glGetFramebufferAttachmentParameteriv(target:0x%08x, attachment:0x%08x, pname:0x%08x, params:0x%08x)", target, attachment, pname, params);
AEMU_SCOPED_TRACE("glGetFramebufferAttachmentParameteriv encode");
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;
memcpy(ptr, &__size_params, 4); 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)
{
ENCODER_DEBUG_LOG("glGetIntegerv(pname:0x%08x, params:0x%08x)", pname, params);
AEMU_SCOPED_TRACE("glGetIntegerv encode");
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;
memcpy(ptr, &__size_params, 4); 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)
{
ENCODER_DEBUG_LOG("glGetProgramiv(program:%u, pname:0x%08x, params:0x%08x)", program, pname, params);
AEMU_SCOPED_TRACE("glGetProgramiv encode");
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;
memcpy(ptr, &__size_params, 4); 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)
{
ENCODER_DEBUG_LOG("glGetProgramInfoLog(program:%u, bufsize:%d, length:0x%08x, infolog:0x%08x)", program, bufsize, length, infolog);
AEMU_SCOPED_TRACE("glGetProgramInfoLog encode");
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;
memcpy(ptr, &__size_length, 4); ptr += 4;
memcpy(ptr, &__size_infolog, 4); 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)
{
ENCODER_DEBUG_LOG("glGetRenderbufferParameteriv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params);
AEMU_SCOPED_TRACE("glGetRenderbufferParameteriv encode");
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_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &target, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;
memcpy(ptr, &__size_params, 4); 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("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
abort();
}
}
}
void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
{
ENCODER_DEBUG_LOG("glGetShaderiv(shader:%u, pname:0x%08x, params:0x%08x)", shader, pname, params);
AEMU_SCOPED_TRACE("glGetShaderiv encode");
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_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
memcpy(ptr, &totalSize, 4); ptr += 4;
memcpy(ptr, &shader, 4); ptr += 4;
memcpy(ptr, &pname, 4); ptr += 4;