| // 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" |
| |
| using gfxstream::guest::ChecksumCalculator; |
| |
| using gfxstream::guest::IOStream; |
| |
| 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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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[gfxstream::guest::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; |
| gfxstream::guest::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; |
| 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
| { |
| ENCODER_DEBUG_LOG("glGetShaderInfoLog(shader:%u, bufsize:%d, length:0x%08x, infolog:0x%08x)", shader, bufsize, length, infolog); |
| AEMU_SCOPED_TRACE("glGetShaderInfoLog encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &shader, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
| { |
| ENCODER_DEBUG_LOG("glGetShaderPrecisionFormat(shadertype:0x%08x, precisiontype:0x%08x, range:0x%08x, precision:0x%08x)", shadertype, precisiontype, range, precision); |
| AEMU_SCOPED_TRACE("glGetShaderPrecisionFormat encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_range = (2 * sizeof(GLint)); |
| const unsigned int __size_precision = (sizeof(GLint)); |
| 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_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &shadertype, 4); ptr += 4; |
| memcpy(ptr, &precisiontype, 4); ptr += 4; |
| memcpy(ptr, &__size_range, 4); ptr += 4; |
| memcpy(ptr, &__size_precision, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(range, __size_range); |
| if (useChecksum) checksumCalculator->addBuffer(range, __size_range); |
| stream->readback(precision, __size_precision); |
| if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
| { |
| ENCODER_DEBUG_LOG("glGetShaderSource(shader:%u, bufsize:%d, length:0x%08x, source:0x%08x)", shader, bufsize, length, source); |
| AEMU_SCOPED_TRACE("glGetShaderSource encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_source = 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_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &shader, 4); ptr += 4; |
| memcpy(ptr, &bufsize, 4); ptr += 4; |
| memcpy(ptr, &__size_length, 4); ptr += 4; |
| memcpy(ptr, &__size_source, 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(source, __size_source); |
| if (useChecksum) checksumCalculator->addBuffer(source, __size_source); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexParameterfv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexParameterfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetTexParameterfv;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexParameteriv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetTexParameteriv;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformfv(program:%u, location:%d, params:0x%08x)", program, location, params); |
| AEMU_SCOPED_TRACE("glGetUniformfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
| 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_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformiv(program:%u, location:%d, params:0x%08x)", program, location, params); |
| AEMU_SCOPED_TRACE("glGetUniformiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
| 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_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformLocation(program:%u, name:0x%08x)", program, name); |
| AEMU_SCOPED_TRACE("glGetUniformLocation encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetUniformLocation;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetVertexAttribfv(index:%u, pname:0x%08x, params:0x%08x)", index, pname, params); |
| AEMU_SCOPED_TRACE("glGetVertexAttribfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetVertexAttribiv(index:%u, pname:0x%08x, params:0x%08x)", index, pname, params); |
| AEMU_SCOPED_TRACE("glGetVertexAttribiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glHint_enc(void *self , GLenum target, GLenum mode) |
| { |
| ENCODER_DEBUG_LOG("glHint(target:0x%08x, mode:0x%08x)", target, mode); |
| AEMU_SCOPED_TRACE("glHint encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glHint;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &mode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLboolean glIsBuffer_enc(void *self , GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("glIsBuffer(buffer:%u)", buffer); |
| AEMU_SCOPED_TRACE("glIsBuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsEnabled_enc(void *self , GLenum cap) |
| { |
| ENCODER_DEBUG_LOG("glIsEnabled(cap:0x%08x)", cap); |
| AEMU_SCOPED_TRACE("glIsEnabled encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsEnabled;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; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer) |
| { |
| ENCODER_DEBUG_LOG("glIsFramebuffer(framebuffer:%u)", framebuffer); |
| AEMU_SCOPED_TRACE("glIsFramebuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &framebuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsProgram_enc(void *self , GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glIsProgram(program:%u)", program); |
| AEMU_SCOPED_TRACE("glIsProgram encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsProgram;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; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer) |
| { |
| ENCODER_DEBUG_LOG("glIsRenderbuffer(renderbuffer:%u)", renderbuffer); |
| AEMU_SCOPED_TRACE("glIsRenderbuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &renderbuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsShader_enc(void *self , GLuint shader) |
| { |
| ENCODER_DEBUG_LOG("glIsShader(shader:%u)", shader); |
| AEMU_SCOPED_TRACE("glIsShader encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsShader;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; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLboolean glIsTexture_enc(void *self , GLuint texture) |
| { |
| ENCODER_DEBUG_LOG("glIsTexture(texture:%u)", texture); |
| AEMU_SCOPED_TRACE("glIsTexture encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsTexture;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; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glLineWidth_enc(void *self , GLfloat width) |
| { |
| ENCODER_DEBUG_LOG("glLineWidth(width:%f)", width); |
| AEMU_SCOPED_TRACE("glLineWidth encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &width, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glLinkProgram_enc(void *self , GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glLinkProgram(program:%u)", program); |
| AEMU_SCOPED_TRACE("glLinkProgram encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glLinkProgram;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 glPixelStorei_enc(void *self , GLenum pname, GLint param) |
| { |
| ENCODER_DEBUG_LOG("glPixelStorei(pname:0x%08x, param:%d)", pname, param); |
| AEMU_SCOPED_TRACE("glPixelStorei encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units) |
| { |
| ENCODER_DEBUG_LOG("glPolygonOffset(factor:%f, units:%f)", factor, units); |
| AEMU_SCOPED_TRACE("glPolygonOffset encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &factor, 4); ptr += 4; |
| memcpy(ptr, &units, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) |
| { |
| ENCODER_DEBUG_LOG("glReadPixels(x:%d, y:%d, width:%d, height:%d, format:0x%08x, type:0x%08x, pixels:0x%08x)", x, y, width, height, format, type, pixels); |
| AEMU_SCOPED_TRACE("glReadPixels encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 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_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_pixels, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readbackPixels(self, width, height, format, type, pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glReleaseShaderCompiler_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glReleaseShaderCompiler()"); |
| AEMU_SCOPED_TRACE("glReleaseShaderCompiler encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glReleaseShaderCompiler;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 glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glRenderbufferStorage(target:0x%08x, internalformat:0x%08x, width:%d, height:%d)", target, internalformat, width, height); |
| AEMU_SCOPED_TRACE("glRenderbufferStorage encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 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; |
| |
| } |
| |
| void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert) |
| { |
| ENCODER_DEBUG_LOG("glSampleCoverage(value:%f, invert:%d)", value, invert); |
| AEMU_SCOPED_TRACE("glSampleCoverage encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 1; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &value, 4); ptr += 4; |
| memcpy(ptr, &invert, 1); ptr += 1; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glScissor(x:%d, y:%d, width:%d, height:%d)", x, y, width, height); |
| AEMU_SCOPED_TRACE("glScissor encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glScissor;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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; |
| |
| } |
| |
| void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask) |
| { |
| ENCODER_DEBUG_LOG("glStencilFunc(func:0x%08x, ref:%d, mask:%u)", func, ref, mask); |
| AEMU_SCOPED_TRACE("glStencilFunc encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &func, 4); ptr += 4; |
| memcpy(ptr, &ref, 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 glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask) |
| { |
| ENCODER_DEBUG_LOG("glStencilFuncSeparate(face:0x%08x, func:0x%08x, ref:%d, mask:%u)", face, func, ref, mask); |
| AEMU_SCOPED_TRACE("glStencilFuncSeparate encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 4); ptr += 4; |
| memcpy(ptr, &func, 4); ptr += 4; |
| memcpy(ptr, &ref, 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 glStencilMask_enc(void *self , GLuint mask) |
| { |
| ENCODER_DEBUG_LOG("glStencilMask(mask:%u)", mask); |
| AEMU_SCOPED_TRACE("glStencilMask encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilMask;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 glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask) |
| { |
| ENCODER_DEBUG_LOG("glStencilMaskSeparate(face:0x%08x, mask:%u)", face, mask); |
| AEMU_SCOPED_TRACE("glStencilMaskSeparate encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 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 glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass) |
| { |
| ENCODER_DEBUG_LOG("glStencilOp(fail:0x%08x, zfail:0x%08x, zpass:0x%08x)", fail, zfail, zpass); |
| AEMU_SCOPED_TRACE("glStencilOp encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &fail, 4); ptr += 4; |
| memcpy(ptr, &zfail, 4); ptr += 4; |
| memcpy(ptr, &zpass, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| { |
| ENCODER_DEBUG_LOG("glStencilOpSeparate(face:0x%08x, fail:0x%08x, zfail:0x%08x, zpass:0x%08x)", face, fail, zfail, zpass); |
| AEMU_SCOPED_TRACE("glStencilOpSeparate encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &face, 4); ptr += 4; |
| memcpy(ptr, &fail, 4); ptr += 4; |
| memcpy(ptr, &zfail, 4); ptr += 4; |
| memcpy(ptr, &zpass, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
| { |
| ENCODER_DEBUG_LOG("glTexImage2D(target:0x%08x, level:%d, internalformat:%d, width:%d, height:%d, border:%d, format:0x%08x, type:0x%08x, pixels:0x%08x)", target, level, internalformat, width, height, border, format, type, pixels); |
| AEMU_SCOPED_TRACE("glTexImage2D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 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_glTexImage2D;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, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_pixels,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
| if (pixels != NULL) { |
| stream->uploadPixels(self, width, height, 1, format, type, pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glTexParameterf(target:0x%08x, pname:0x%08x, param:%f)", target, pname, param); |
| AEMU_SCOPED_TRACE("glTexParameterf encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexParameterf;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, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glTexParameterfv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glTexParameterfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexParameterfv;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; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param) |
| { |
| ENCODER_DEBUG_LOG("glTexParameteri(target:0x%08x, pname:0x%08x, param:%d)", target, pname, param); |
| AEMU_SCOPED_TRACE("glTexParameteri encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexParameteri;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, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glTexParameteriv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glTexParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexParameteriv;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; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) |
| { |
| ENCODER_DEBUG_LOG("glTexSubImage2D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, width:%d, height:%d, format:0x%08x, type:0x%08x, pixels:0x%08x)", target, level, xoffset, yoffset, width, height, format, type, pixels); |
| AEMU_SCOPED_TRACE("glTexSubImage2D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 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_glTexSubImage2D;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, &type, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_pixels,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
| if (pixels != NULL) { |
| stream->uploadPixels(self, width, height, 1, format, type, pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glUniform1f_enc(void *self , GLint location, GLfloat x) |
| { |
| ENCODER_DEBUG_LOG("glUniform1f(location:%d, x:%f)", location, x); |
| AEMU_SCOPED_TRACE("glUniform1f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform1fv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform1fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (count * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform1i_enc(void *self , GLint location, GLint x) |
| { |
| ENCODER_DEBUG_LOG("glUniform1i(location:%d, x:%d)", location, x); |
| AEMU_SCOPED_TRACE("glUniform1i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform1iv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform1iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (count * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y) |
| { |
| ENCODER_DEBUG_LOG("glUniform2f(location:%d, x:%f, y:%f)", location, x, y); |
| AEMU_SCOPED_TRACE("glUniform2f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform2fv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (count * 2 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2i_enc(void *self , GLint location, GLint x, GLint y) |
| { |
| ENCODER_DEBUG_LOG("glUniform2i(location:%d, x:%d, y:%d)", location, x, y); |
| AEMU_SCOPED_TRACE("glUniform2i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform2iv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform2iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (count * 2 * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z) |
| { |
| ENCODER_DEBUG_LOG("glUniform3f(location:%d, x:%f, y:%f, z:%f)", location, x, y, z); |
| AEMU_SCOPED_TRACE("glUniform3f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform3fv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (count * 3 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z) |
| { |
| ENCODER_DEBUG_LOG("glUniform3i(location:%d, x:%d, y:%d, z:%d)", location, x, y, z); |
| AEMU_SCOPED_TRACE("glUniform3i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform3iv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform3iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (3 * count * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| { |
| ENCODER_DEBUG_LOG("glUniform4f(location:%d, x:%f, y:%f, z:%f, w:%f)", location, x, y, z, w); |
| AEMU_SCOPED_TRACE("glUniform4f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| memcpy(ptr, &w, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform4fv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (4 * count * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w) |
| { |
| ENCODER_DEBUG_LOG("glUniform4i(location:%d, x:%d, y:%d, z:%d, w:%d)", location, x, y, z, w); |
| AEMU_SCOPED_TRACE("glUniform4i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| memcpy(ptr, &w, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| { |
| ENCODER_DEBUG_LOG("glUniform4iv(location:%d, count:%d, v:0x%08x)", location, count, v); |
| AEMU_SCOPED_TRACE("glUniform4iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (4 * count * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix2fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix3fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 9 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix4fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 16 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUseProgram_enc(void *self , GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glUseProgram(program:%u)", program); |
| AEMU_SCOPED_TRACE("glUseProgram encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUseProgram;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 glValidateProgram_enc(void *self , GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glValidateProgram(program:%u)", program); |
| AEMU_SCOPED_TRACE("glValidateProgram encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glValidateProgram;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 glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib1f(indx:%u, x:%f)", indx, x); |
| AEMU_SCOPED_TRACE("glVertexAttrib1f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib1fv(indx:%u, values:0x%08x)", indx, values); |
| AEMU_SCOPED_TRACE("glVertexAttrib1fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_values = (sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &__size_values, 4); ptr += 4; |
| memcpy(ptr, values, __size_values);ptr += __size_values; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib2f(indx:%u, x:%f, y:%f)", indx, x, y); |
| AEMU_SCOPED_TRACE("glVertexAttrib2f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib2fv(indx:%u, values:0x%08x)", indx, values); |
| AEMU_SCOPED_TRACE("glVertexAttrib2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_values = (2 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &__size_values, 4); ptr += 4; |
| memcpy(ptr, values, __size_values);ptr += __size_values; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib3f(indx:%u, x:%f, y:%f, z:%f)", indx, x, y, z); |
| AEMU_SCOPED_TRACE("glVertexAttrib3f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib3fv(indx:%u, values:0x%08x)", indx, values); |
| AEMU_SCOPED_TRACE("glVertexAttrib3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_values = (3 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &__size_values, 4); ptr += 4; |
| memcpy(ptr, values, __size_values);ptr += __size_values; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib4f(indx:%u, x:%f, y:%f, z:%f, w:%f)", indx, x, y, z, w); |
| AEMU_SCOPED_TRACE("glVertexAttrib4f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &z, 4); ptr += 4; |
| memcpy(ptr, &w, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttrib4fv(indx:%u, values:0x%08x)", indx, values); |
| AEMU_SCOPED_TRACE("glVertexAttrib4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_values = (4 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &__size_values, 4); ptr += 4; |
| memcpy(ptr, values, __size_values);ptr += __size_values; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glViewport(x:%d, y:%d, width:%d, height:%d)", x, y, width, height); |
| AEMU_SCOPED_TRACE("glViewport encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glViewport;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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; |
| |
| } |
| |
| void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image) |
| { |
| ENCODER_DEBUG_LOG("glEGLImageTargetTexture2DOES(target:0x%08x, image:%p)", target, image); |
| AEMU_SCOPED_TRACE("glEGLImageTargetTexture2DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &image, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image) |
| { |
| ENCODER_DEBUG_LOG("glEGLImageTargetRenderbufferStorageOES(target:0x%08x, image:%p)", target, image); |
| AEMU_SCOPED_TRACE("glEGLImageTargetRenderbufferStorageOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &image, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLboolean glUnmapBufferOES_enc(void *self , GLenum target) |
| { |
| ENCODER_DEBUG_LOG("glUnmapBufferOES(target:0x%08x)", target); |
| AEMU_SCOPED_TRACE("glUnmapBufferOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUnmapBufferOES;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; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
| { |
| ENCODER_DEBUG_LOG("glTexImage3DOES(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, depth:%d, border:%d, format:0x%08x, type:0x%08x, pixels:0x%08x)", target, level, internalformat, width, height, depth, border, format, type, pixels); |
| AEMU_SCOPED_TRACE("glTexImage3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 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 + 4); |
| ptr = buf; |
| int tmp = OP_glTexImage3DOES;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, &depth, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_pixels,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
| if (pixels != NULL) { |
| stream->writeFully(pixels, __size_pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) |
| { |
| ENCODER_DEBUG_LOG("glTexSubImage3DOES(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, type:0x%08x, pixels:0x%08x)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| AEMU_SCOPED_TRACE("glTexSubImage3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 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 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glTexSubImage3DOES;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_pixels,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
| if (pixels != NULL) { |
| stream->writeFully(pixels, __size_pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glCopyTexSubImage3DOES(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, x:%d, y:%d, width:%d, height:%d)", target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| AEMU_SCOPED_TRACE("glCopyTexSubImage3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCopyTexSubImage3DOES;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, &zoffset, 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; |
| |
| } |
| |
| void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexImage3DOES(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, depth:%d, border:%d, imageSize:%d, data:0x%08x)", target, level, internalformat, width, height, depth, border, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexImage3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glCompressedTexImage3DOES;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, &depth, 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 glCompressedTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexSubImage3DOES(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, imageSize:%d, data:0x%08x)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexSubImage3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glCompressedTexSubImage3DOES;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 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 glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) |
| { |
| ENCODER_DEBUG_LOG("glFramebufferTexture3DOES(target:0x%08x, attachment:0x%08x, textarget:0x%08x, texture:%u, level:%d, zoffset:%d)", target, attachment, textarget, texture, level, zoffset); |
| AEMU_SCOPED_TRACE("glFramebufferTexture3DOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFramebufferTexture3DOES;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; |
| memcpy(ptr, &zoffset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindVertexArrayOES_enc(void *self , GLuint array) |
| { |
| ENCODER_DEBUG_LOG("glBindVertexArrayOES(array:%u)", array); |
| AEMU_SCOPED_TRACE("glBindVertexArrayOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays) |
| { |
| ENCODER_DEBUG_LOG("glDeleteVertexArraysOES(n:%d, arrays:0x%08x)", n, arrays); |
| AEMU_SCOPED_TRACE("glDeleteVertexArraysOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_arrays, 4); ptr += 4; |
| memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays) |
| { |
| ENCODER_DEBUG_LOG("glGenVertexArraysOES(n:%d, arrays:0x%08x)", n, arrays); |
| AEMU_SCOPED_TRACE("glGenVertexArraysOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_arrays = (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_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_arrays, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(arrays, __size_arrays); |
| if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| GLboolean glIsVertexArrayOES_enc(void *self , GLuint array) |
| { |
| ENCODER_DEBUG_LOG("glIsVertexArrayOES(array:%u)", array); |
| AEMU_SCOPED_TRACE("glIsVertexArrayOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| { |
| ENCODER_DEBUG_LOG("glDiscardFramebufferEXT(target:0x%08x, numAttachments:%d, attachments:0x%08x)", target, numAttachments, attachments); |
| AEMU_SCOPED_TRACE("glDiscardFramebufferEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &numAttachments, 4); ptr += 4; |
| memcpy(ptr, &__size_attachments, 4); ptr += 4; |
| memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribPointerData(indx:%u, size:%d, type:0x%08x, normalized:%d, stride:%d, data:0x%08x, datalen:%u)", indx, size, type, normalized, stride, data, datalen); |
| AEMU_SCOPED_TRACE("glVertexAttribPointerData encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &normalized, 1); ptr += 1; |
| memcpy(ptr, &stride, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribPointerOffset(indx:%u, size:%d, type:0x%08x, normalized:%d, stride:%d, offset:%u)", indx, size, type, normalized, stride, offset); |
| AEMU_SCOPED_TRACE("glVertexAttribPointerOffset encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indx, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &normalized, 1); ptr += 1; |
| memcpy(ptr, &stride, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsOffset(mode:0x%08x, count:%d, type:0x%08x, offset:%u)", mode, count, type, offset); |
| AEMU_SCOPED_TRACE("glDrawElementsOffset encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsData(mode:0x%08x, count:%d, type:0x%08x, data:0x%08x, datalen:%u)", mode, count, type, data, datalen); |
| AEMU_SCOPED_TRACE("glDrawElementsData encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| memcpy(ptr, data, __size_data);ptr += __size_data; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats) |
| { |
| ENCODER_DEBUG_LOG("glGetCompressedTextureFormats(count:%d, formats:0x%08x)", count, formats); |
| AEMU_SCOPED_TRACE("glGetCompressedTextureFormats encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_formats = (count * 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_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_formats, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(formats, __size_formats); |
| if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len) |
| { |
| ENCODER_DEBUG_LOG("glShaderString(shader:%u, string:0x%08x, len:%d)", shader, string, len); |
| AEMU_SCOPED_TRACE("glShaderString encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_string = len; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &shader, 4); ptr += 4; |
| memcpy(ptr, &__size_string, 4); ptr += 4; |
| memcpy(ptr, string, __size_string);ptr += __size_string; |
| memcpy(ptr, &len, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| int glFinishRoundTrip_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glFinishRoundTrip()"); |
| AEMU_SCOPED_TRACE("glFinishRoundTrip encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glFinishRoundTrip;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; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays) |
| { |
| ENCODER_DEBUG_LOG("glGenVertexArrays(n:%d, arrays:0x%08x)", n, arrays); |
| AEMU_SCOPED_TRACE("glGenVertexArrays encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_arrays = (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_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_arrays, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(arrays, __size_arrays); |
| if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glBindVertexArray_enc(void *self , GLuint array) |
| { |
| ENCODER_DEBUG_LOG("glBindVertexArray(array:%u)", array); |
| AEMU_SCOPED_TRACE("glBindVertexArray encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays) |
| { |
| ENCODER_DEBUG_LOG("glDeleteVertexArrays(n:%d, arrays:0x%08x)", n, arrays); |
| AEMU_SCOPED_TRACE("glDeleteVertexArrays encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_arrays, 4); ptr += 4; |
| memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLboolean glIsVertexArray_enc(void *self , GLuint array) |
| { |
| ENCODER_DEBUG_LOG("glIsVertexArray(array:%u)", array); |
| AEMU_SCOPED_TRACE("glIsVertexArray encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &array, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped) |
| { |
| ENCODER_DEBUG_LOG("glMapBufferRangeAEMU(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, mapped:0x%08x)", target, offset, length, access, mapped); |
| AEMU_SCOPED_TRACE("glMapBufferRangeAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_mapped = ((mapped != NULL) ? length : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 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_glMapBufferRangeAEMU;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &__size_mapped, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| if (mapped != NULL) { |
| stream->readback(mapped, __size_mapped); |
| if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped); |
| } |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res) |
| { |
| ENCODER_DEBUG_LOG("glUnmapBufferAEMU(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, guest_buffer:0x%08x, out_res:0x%08x)", target, offset, length, access, guest_buffer, out_res); |
| AEMU_SCOPED_TRACE("glUnmapBufferAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| const unsigned int __size_out_res = (sizeof(GLboolean)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUnmapBufferAEMU;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &__size_guest_buffer, 4); ptr += 4; |
| if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer; |
| memcpy(ptr, &__size_out_res, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(out_res, __size_out_res); |
| if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer) |
| { |
| ENCODER_DEBUG_LOG("glFlushMappedBufferRangeAEMU(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, guest_buffer:0x%08x)", target, offset, length, access, guest_buffer); |
| AEMU_SCOPED_TRACE("glFlushMappedBufferRangeAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glFlushMappedBufferRangeAEMU;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &__size_guest_buffer, 4); ptr += 4; |
| if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glReadPixelsOffsetAEMU(x:%d, y:%d, width:%d, height:%d, format:0x%08x, type:0x%08x, offset:%u)", x, y, width, height, format, type, offset); |
| AEMU_SCOPED_TRACE("glReadPixelsOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexImage2DOffsetAEMU(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, border:%d, imageSize:%d, offset:%u)", target, level, internalformat, width, height, border, imageSize, offset); |
| AEMU_SCOPED_TRACE("glCompressedTexImage2DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glCompressedTexImage2DOffsetAEMU;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; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexSubImage2DOffsetAEMU(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, width:%d, height:%d, format:0x%08x, imageSize:%d, offset:%u)", target, level, xoffset, yoffset, width, height, format, imageSize, offset); |
| AEMU_SCOPED_TRACE("glCompressedTexSubImage2DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;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; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glTexImage2DOffsetAEMU(target:0x%08x, level:%d, internalformat:%d, width:%d, height:%d, border:%d, format:0x%08x, type:0x%08x, offset:%u)", target, level, internalformat, width, height, border, format, type, offset); |
| AEMU_SCOPED_TRACE("glTexImage2DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexImage2DOffsetAEMU;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, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glTexSubImage2DOffsetAEMU(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, width:%d, height:%d, format:0x%08x, type:0x%08x, offset:%u)", target, level, xoffset, yoffset, width, height, format, type, offset); |
| AEMU_SCOPED_TRACE("glTexSubImage2DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexSubImage2DOffsetAEMU;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, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| { |
| ENCODER_DEBUG_LOG("glBindBufferRange(target:0x%08x, index:%u, buffer:%u, offset:0x%08lx, size:0x%08lx)", target, index, buffer, offset, size); |
| AEMU_SCOPED_TRACE("glBindBufferRange encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("glBindBufferBase(target:0x%08x, index:%u, buffer:%u)", target, index, buffer); |
| AEMU_SCOPED_TRACE("glBindBufferBase encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &index, 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 glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size) |
| { |
| ENCODER_DEBUG_LOG("glCopyBufferSubData(readtarget:0x%08x, writetarget:0x%08x, readoffset:0x%08lx, writeoffset:0x%08lx, size:0x%08lx)", readtarget, writetarget, readoffset, writeoffset, size); |
| AEMU_SCOPED_TRACE("glCopyBufferSubData encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &readtarget, 4); ptr += 4; |
| memcpy(ptr, &writetarget, 4); ptr += 4; |
| memcpy(ptr, &readoffset, 4); ptr += 4; |
| memcpy(ptr, &writeoffset, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->flush(); |
| } |
| |
| void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value) |
| { |
| ENCODER_DEBUG_LOG("glClearBufferiv(buffer:0x%08x, drawBuffer:%d, value:0x%08x)", buffer, drawBuffer, value); |
| AEMU_SCOPED_TRACE("glClearBufferiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glClearBufferuiv(buffer:0x%08x, drawBuffer:%d, value:0x%08x)", buffer, drawBuffer, value); |
| AEMU_SCOPED_TRACE("glClearBufferuiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glClearBufferfv(buffer:0x%08x, drawBuffer:%d, value:0x%08x)", buffer, drawBuffer, value); |
| AEMU_SCOPED_TRACE("glClearBufferfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil) |
| { |
| ENCODER_DEBUG_LOG("glClearBufferfi(buffer:0x%08x, drawBuffer:%d, depth:%f, stencil:%d)", buffer, drawBuffer, depth, stencil); |
| AEMU_SCOPED_TRACE("glClearBufferfi encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| memcpy(ptr, &depth, 4); ptr += 4; |
| memcpy(ptr, &stencil, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
| { |
| ENCODER_DEBUG_LOG("glUniformBlockBinding(program:%u, uniformBlockIndex:%u, uniformBlockBinding:%u)", program, uniformBlockIndex, uniformBlockBinding); |
| AEMU_SCOPED_TRACE("glUniformBlockBinding encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &uniformBlockIndex, 4); ptr += 4; |
| memcpy(ptr, &uniformBlockBinding, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformBlockIndex(program:%u, uniformBlockName:0x%08x)", program, uniformBlockName); |
| AEMU_SCOPED_TRACE("glGetUniformBlockIndex encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_uniformBlockName = (strlen(uniformBlockName) + 1); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &__size_uniformBlockName, 4); ptr += 4; |
| memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName; |
| |
| 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformIndicesAEMU(program:%u, uniformCount:%d, packedUniformNames:0x%08x, packedLen:%d, uniformIndices:0x%08x)", program, uniformCount, packedUniformNames, packedLen, uniformIndices); |
| AEMU_SCOPED_TRACE("glGetUniformIndicesAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_packedUniformNames = packedLen; |
| const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &uniformCount, 4); ptr += 4; |
| memcpy(ptr, &__size_packedUniformNames, 4); ptr += 4; |
| memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames; |
| memcpy(ptr, &packedLen, 4); ptr += 4; |
| memcpy(ptr, &__size_uniformIndices, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(uniformIndices, __size_uniformIndices); |
| if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetActiveUniformBlockiv(program:%u, uniformBlockIndex:%u, pname:0x%08x, params:0x%08x)", program, uniformBlockIndex, pname, params); |
| AEMU_SCOPED_TRACE("glGetActiveUniformBlockiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * 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_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &uniformBlockIndex, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) |
| { |
| ENCODER_DEBUG_LOG("glGetActiveUniformBlockName(program:%u, uniformBlockIndex:%u, bufSize:%d, length:0x%08x, uniformBlockName:0x%08x)", program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| AEMU_SCOPED_TRACE("glGetActiveUniformBlockName encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ? bufSize : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 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_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &uniformBlockIndex, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 4); ptr += 4; |
| memcpy(ptr, &__size_length, 4); ptr += 4; |
| memcpy(ptr, &__size_uniformBlockName, 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 (uniformBlockName != NULL) { |
| stream->readback(uniformBlockName, __size_uniformBlockName); |
| if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName); |
| } |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glUniform1ui_enc(void *self , GLint location, GLuint v0) |
| { |
| ENCODER_DEBUG_LOG("glUniform1ui(location:%d, v0:%u)", location, v0); |
| AEMU_SCOPED_TRACE("glUniform1ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1) |
| { |
| ENCODER_DEBUG_LOG("glUniform2ui(location:%d, v0:%u, v1:%u)", location, v0, v1); |
| AEMU_SCOPED_TRACE("glUniform2ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2) |
| { |
| ENCODER_DEBUG_LOG("glUniform3ui(location:%d, v0:%u, v1:%u, v2:%u)", location, v0, v1, v2); |
| AEMU_SCOPED_TRACE("glUniform3ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3) |
| { |
| ENCODER_DEBUG_LOG("glUniform4ui(location:%d, v0:%d, v1:%u, v2:%u, v3:%u)", location, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glUniform4ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glUniform1uiv(location:%d, count:%d, value:0x%08x)", location, count, value); |
| AEMU_SCOPED_TRACE("glUniform1uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glUniform2uiv(location:%d, count:%d, value:0x%08x)", location, count, value); |
| AEMU_SCOPED_TRACE("glUniform2uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 2 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glUniform3uiv(location:%d, count:%d, value:0x%08x)", location, count, value); |
| AEMU_SCOPED_TRACE("glUniform3uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 3 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glUniform4uiv(location:%d, count:%d, value:0x%08x)", location, count, value); |
| AEMU_SCOPED_TRACE("glUniform4uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix2x3fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix2x3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix3x2fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix3x2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix2x4fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix2x4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix4x2fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix4x2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix3x4fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix3x4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glUniformMatrix4x3fv(location:%d, count:%d, transpose:%d, value:0x%08x)", location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glUniformMatrix4x3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetUniformuiv(program:%u, location:%d, params:0x%08x)", program, location, params); |
| AEMU_SCOPED_TRACE("glGetUniformuiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
| 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_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetActiveUniformsiv(program:%u, uniformCount:%d, uniformIndices:0x%08x, pname:0x%08x, params:0x%08x)", program, uniformCount, uniformIndices, pname, params); |
| AEMU_SCOPED_TRACE("glGetActiveUniformsiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint)); |
| const unsigned int __size_params = (uniformCount * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &uniformCount, 4); ptr += 4; |
| memcpy(ptr, &__size_uniformIndices, 4); ptr += 4; |
| memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices; |
| 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribI4i(index:%u, v0:%d, v1:%d, v2:%d, v3:%d)", index, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glVertexAttribI4i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribI4ui(index:%u, v0:%u, v1:%u, v2:%u, v3:%u)", index, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glVertexAttribI4ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribI4iv(index:%u, v:0x%08x)", index, v); |
| AEMU_SCOPED_TRACE("glVertexAttribI4iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (4 * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribI4uiv(index:%u, v:0x%08x)", index, v); |
| AEMU_SCOPED_TRACE("glVertexAttribI4uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_v = (4 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_v, 4); ptr += 4; |
| memcpy(ptr, v, __size_v);ptr += __size_v; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribIPointerOffsetAEMU(index:%u, size:%d, type:0x%08x, stride:%d, offset:%u)", index, size, type, stride, offset); |
| AEMU_SCOPED_TRACE("glVertexAttribIPointerOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &stride, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribIPointerDataAEMU(index:%u, size:%d, type:0x%08x, stride:%d, data:0x%08x, datalen:%u)", index, size, type, stride, data, datalen); |
| AEMU_SCOPED_TRACE("glVertexAttribIPointerDataAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &stride, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetVertexAttribIiv(index:%u, pname:0x%08x, params:0x%08x)", index, pname, params); |
| AEMU_SCOPED_TRACE("glGetVertexAttribIiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetVertexAttribIuiv(index:%u, pname:0x%08x, params:0x%08x)", index, pname, params); |
| AEMU_SCOPED_TRACE("glGetVertexAttribIuiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint)); |
| 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_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribDivisor(index:%u, divisor:%u)", index, divisor); |
| AEMU_SCOPED_TRACE("glVertexAttribDivisor encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &divisor, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| { |
| ENCODER_DEBUG_LOG("glDrawArraysInstanced(mode:0x%08x, first:%d, count:%d, primcount:%d)", mode, first, count, primcount); |
| AEMU_SCOPED_TRACE("glDrawArraysInstanced encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawArraysInstanced;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; |
| memcpy(ptr, &primcount, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsInstancedDataAEMU(mode:0x%08x, count:%d, type:0x%08x, indices:0x%08x, primcount:%d, datalen:%d)", mode, count, type, indices, primcount, datalen); |
| AEMU_SCOPED_TRACE("glDrawElementsInstancedDataAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_indices = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_indices, 4); ptr += 4; |
| memcpy(ptr, indices, __size_indices);ptr += __size_indices; |
| memcpy(ptr, &primcount, 4); ptr += 4; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsInstancedOffsetAEMU(mode:0x%08x, count:%d, type:0x%08x, offset:%u, primcount:%d)", mode, count, type, offset, primcount); |
| AEMU_SCOPED_TRACE("glDrawElementsInstancedOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &primcount, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawRangeElementsDataAEMU(mode:0x%08x, start:%u, end:%u, count:%d, type:0x%08x, indices:0x%08x, datalen:%d)", mode, start, end, count, type, indices, datalen); |
| AEMU_SCOPED_TRACE("glDrawRangeElementsDataAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_indices = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &start, 4); ptr += 4; |
| memcpy(ptr, &end, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_indices, 4); ptr += 4; |
| memcpy(ptr, indices, __size_indices);ptr += __size_indices; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glDrawRangeElementsOffsetAEMU(mode:0x%08x, start:%u, end:%u, count:%d, type:0x%08x, offset:%u)", mode, start, end, count, type, offset); |
| AEMU_SCOPED_TRACE("glDrawRangeElementsOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &start, 4); ptr += 4; |
| memcpy(ptr, &end, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags) |
| { |
| ENCODER_DEBUG_LOG("glFenceSyncAEMU(condition:0x%08x, flags:0x%08x)", condition, flags); |
| AEMU_SCOPED_TRACE("glFenceSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &condition, 4); ptr += 4; |
| memcpy(ptr, &flags, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint64_t retval; |
| stream->readback(&retval, 8); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 8); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout) |
| { |
| ENCODER_DEBUG_LOG("glClientWaitSyncAEMU(wait_on:0x%016lx, flags:0x%08x, timeout:0x%016lx)", wait_on, flags, timeout); |
| AEMU_SCOPED_TRACE("glClientWaitSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &wait_on, 8); ptr += 8; |
| memcpy(ptr, &flags, 4); ptr += 4; |
| memcpy(ptr, &timeout, 8); ptr += 8; |
| |
| 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout) |
| { |
| ENCODER_DEBUG_LOG("glWaitSyncAEMU(wait_on:0x%016lx, flags:0x%08x, timeout:0x%016lx)", wait_on, flags, timeout); |
| AEMU_SCOPED_TRACE("glWaitSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &wait_on, 8); ptr += 8; |
| memcpy(ptr, &flags, 4); ptr += 4; |
| memcpy(ptr, &timeout, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete) |
| { |
| ENCODER_DEBUG_LOG("glDeleteSyncAEMU(to_delete:0x%016lx)", to_delete); |
| AEMU_SCOPED_TRACE("glDeleteSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &to_delete, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync) |
| { |
| ENCODER_DEBUG_LOG("glIsSyncAEMU(sync:0x%016lx)", sync); |
| AEMU_SCOPED_TRACE("glIsSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) |
| { |
| ENCODER_DEBUG_LOG("glGetSyncivAEMU(sync:0x%016lx, pname:0x%08x, bufSize:%d, length:0x%08x, values:0x%08x)", sync, pname, bufSize, length, values); |
| AEMU_SCOPED_TRACE("glGetSyncivAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_values = (bufSize * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 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_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 4); ptr += 4; |
| memcpy(ptr, &__size_length, 4); ptr += 4; |
| memcpy(ptr, &__size_values, 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(values, __size_values); |
| if (useChecksum) checksumCalculator->addBuffer(values, __size_values); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs) |
| { |
| ENCODER_DEBUG_LOG("glDrawBuffers(n:%d, bufs:0x%08x)", n, bufs); |
| AEMU_SCOPED_TRACE("glDrawBuffers encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_bufs = (n * sizeof(GLenum)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_bufs, 4); ptr += 4; |
| memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glReadBuffer_enc(void *self , GLenum src) |
| { |
| ENCODER_DEBUG_LOG("glReadBuffer(src:0x%08x)", src); |
| AEMU_SCOPED_TRACE("glReadBuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &src, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBlitFramebuffer_enc(void *self , GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) |
| { |
| ENCODER_DEBUG_LOG("glBlitFramebuffer(srcX0:%d, srcY0:%d, srcX1:%d, srcY1:%d, dstX0:%d, dstY0:%d, dstX1:%d, dstY1:%d, mask:0x%08x, filter:0x%08x)", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| AEMU_SCOPED_TRACE("glBlitFramebuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &srcX0, 4); ptr += 4; |
| memcpy(ptr, &srcY0, 4); ptr += 4; |
| memcpy(ptr, &srcX1, 4); ptr += 4; |
| memcpy(ptr, &srcY1, 4); ptr += 4; |
| memcpy(ptr, &dstX0, 4); ptr += 4; |
| memcpy(ptr, &dstY0, 4); ptr += 4; |
| memcpy(ptr, &dstX1, 4); ptr += 4; |
| memcpy(ptr, &dstY1, 4); ptr += 4; |
| memcpy(ptr, &mask, 4); ptr += 4; |
| memcpy(ptr, &filter, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| { |
| ENCODER_DEBUG_LOG("glInvalidateFramebuffer(target:0x%08x, numAttachments:%d, attachments:0x%08x)", target, numAttachments, attachments); |
| AEMU_SCOPED_TRACE("glInvalidateFramebuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &numAttachments, 4); ptr += 4; |
| memcpy(ptr, &__size_attachments, 4); ptr += 4; |
| memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glInvalidateSubFramebuffer(target:0x%08x, numAttachments:%d, attachments:0x%08x, x:%d, y:%d, width:%d, height:%d)", target, numAttachments, attachments, x, y, width, height); |
| AEMU_SCOPED_TRACE("glInvalidateSubFramebuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &numAttachments, 4); ptr += 4; |
| memcpy(ptr, &__size_attachments, 4); ptr += 4; |
| memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
| 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; |
| |
| } |
| |
| void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) |
| { |
| ENCODER_DEBUG_LOG("glFramebufferTextureLayer(target:0x%08x, attachment:0x%08x, texture:%u, level:%d, layer:%d)", target, attachment, texture, level, layer); |
| AEMU_SCOPED_TRACE("glFramebufferTextureLayer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glFramebufferTextureLayer;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, &texture, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &layer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glRenderbufferStorageMultisample(target:0x%08x, samples:%d, internalformat:0x%08x, width:%d, height:%d)", target, samples, internalformat, width, height); |
| AEMU_SCOPED_TRACE("glRenderbufferStorageMultisample encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &samples, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 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; |
| |
| } |
| |
| void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glTexStorage2D(target:0x%08x, levels:%d, internalformat:0x%08x, width:%d, height:%d)", target, levels, internalformat, width, height); |
| AEMU_SCOPED_TRACE("glTexStorage2D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &levels, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 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; |
| |
| } |
| |
| void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetInternalformativ(target:0x%08x, internalformat:0x%08x, pname:0x%08x, bufSize:%d, params:0x%08x)", target, internalformat, pname, bufSize, params); |
| AEMU_SCOPED_TRACE("glGetInternalformativ encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (sizeof(GLint) * bufSize); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 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_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode) |
| { |
| ENCODER_DEBUG_LOG("glBeginTransformFeedback(primitiveMode:0x%08x)", primitiveMode); |
| AEMU_SCOPED_TRACE("glBeginTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &primitiveMode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEndTransformFeedback_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glEndTransformFeedback()"); |
| AEMU_SCOPED_TRACE("glEndTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glEndTransformFeedback;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 glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids) |
| { |
| ENCODER_DEBUG_LOG("glGenTransformFeedbacks(n:%d, ids:0x%08x)", n, ids); |
| AEMU_SCOPED_TRACE("glGenTransformFeedbacks encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_ids = (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_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_ids, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(ids, __size_ids); |
| if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids) |
| { |
| ENCODER_DEBUG_LOG("glDeleteTransformFeedbacks(n:%d, ids:0x%08x)", n, ids); |
| AEMU_SCOPED_TRACE("glDeleteTransformFeedbacks encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_ids = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_ids, 4); ptr += 4; |
| memcpy(ptr, ids, __size_ids);ptr += __size_ids; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id) |
| { |
| ENCODER_DEBUG_LOG("glBindTransformFeedback(target:0x%08x, id:%u)", target, id); |
| AEMU_SCOPED_TRACE("glBindTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &id, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glPauseTransformFeedback_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glPauseTransformFeedback()"); |
| AEMU_SCOPED_TRACE("glPauseTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glPauseTransformFeedback;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 glResumeTransformFeedback_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glResumeTransformFeedback()"); |
| AEMU_SCOPED_TRACE("glResumeTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glResumeTransformFeedback;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; |
| |
| } |
| |
| GLboolean glIsTransformFeedback_enc(void *self , GLuint id) |
| { |
| ENCODER_DEBUG_LOG("glIsTransformFeedback(id:%u)", id); |
| AEMU_SCOPED_TRACE("glIsTransformFeedback encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &id, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode) |
| { |
| ENCODER_DEBUG_LOG("glTransformFeedbackVaryingsAEMU(program:%u, count:%d, packedVaryings:0x%08x, packedVaryingsLen:%u, bufferMode:0x%08x)", program, count, packedVaryings, packedVaryingsLen, bufferMode); |
| AEMU_SCOPED_TRACE("glTransformFeedbackVaryingsAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_packedVaryings = packedVaryingsLen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_packedVaryings, 4); ptr += 4; |
| memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings; |
| memcpy(ptr, &packedVaryingsLen, 4); ptr += 4; |
| memcpy(ptr, &bufferMode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name) |
| { |
| ENCODER_DEBUG_LOG("glGetTransformFeedbackVarying(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("glGetTransformFeedbackVarying encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 = (sizeof(GLsizei)); |
| 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_glGetTransformFeedbackVarying;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); |
| } |
| 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers) |
| { |
| ENCODER_DEBUG_LOG("glGenSamplers(n:%d, samplers:0x%08x)", n, samplers); |
| AEMU_SCOPED_TRACE("glGenSamplers encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_samplers = (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_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_samplers, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(samplers, __size_samplers); |
| if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers) |
| { |
| ENCODER_DEBUG_LOG("glDeleteSamplers(n:%d, samplers:0x%08x)", n, samplers); |
| AEMU_SCOPED_TRACE("glDeleteSamplers encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_samplers = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_samplers, 4); ptr += 4; |
| memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindSampler_enc(void *self , GLuint unit, GLuint sampler) |
| { |
| ENCODER_DEBUG_LOG("glBindSampler(unit:%u, sampler:%u)", unit, sampler); |
| AEMU_SCOPED_TRACE("glBindSampler encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &unit, 4); ptr += 4; |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param) |
| { |
| ENCODER_DEBUG_LOG("glSamplerParameterf(sampler:%u, pname:0x%08x, param:%f)", sampler, pname, param); |
| AEMU_SCOPED_TRACE("glSamplerParameterf encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param) |
| { |
| ENCODER_DEBUG_LOG("glSamplerParameteri(sampler:%u, pname:0x%08x, param:%d)", sampler, pname, param); |
| AEMU_SCOPED_TRACE("glSamplerParameteri encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glSamplerParameterfv(sampler:%u, pname:0x%08x, params:0x%08x)", sampler, pname, params); |
| AEMU_SCOPED_TRACE("glSamplerParameterfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glSamplerParameteriv(sampler:%u, pname:0x%08x, params:0x%08x)", sampler, pname, params); |
| AEMU_SCOPED_TRACE("glSamplerParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + __size_params + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_params, 4); ptr += 4; |
| memcpy(ptr, params, __size_params);ptr += __size_params; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetSamplerParameterfv(sampler:%u, pname:0x%08x, params:0x%08x)", sampler, pname, params); |
| AEMU_SCOPED_TRACE("glGetSamplerParameterfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetSamplerParameteriv(sampler:%u, pname:0x%08x, params:0x%08x)", sampler, pname, params); |
| AEMU_SCOPED_TRACE("glGetSamplerParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| GLboolean glIsSampler_enc(void *self , GLuint sampler) |
| { |
| ENCODER_DEBUG_LOG("glIsSampler(sampler:%u)", sampler); |
| AEMU_SCOPED_TRACE("glIsSampler encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sampler, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGenQueries_enc(void *self , GLsizei n, GLuint* queries) |
| { |
| ENCODER_DEBUG_LOG("glGenQueries(n:%d, queries:0x%08x)", n, queries); |
| AEMU_SCOPED_TRACE("glGenQueries encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_queries = (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_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_queries, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(queries, __size_queries); |
| if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries) |
| { |
| ENCODER_DEBUG_LOG("glDeleteQueries(n:%d, queries:0x%08x)", n, queries); |
| AEMU_SCOPED_TRACE("glDeleteQueries encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_queries = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_queries, 4); ptr += 4; |
| memcpy(ptr, queries, __size_queries);ptr += __size_queries; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBeginQuery_enc(void *self , GLenum target, GLuint query) |
| { |
| ENCODER_DEBUG_LOG("glBeginQuery(target:0x%08x, query:%u)", target, query); |
| AEMU_SCOPED_TRACE("glBeginQuery encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &query, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEndQuery_enc(void *self , GLenum target) |
| { |
| ENCODER_DEBUG_LOG("glEndQuery(target:0x%08x)", target); |
| AEMU_SCOPED_TRACE("glEndQuery encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glEndQuery;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 glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetQueryiv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glGetQueryiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetQueryiv;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetQueryObjectuiv(query:%u, pname:0x%08x, params:0x%08x)", query, pname, params); |
| AEMU_SCOPED_TRACE("glGetQueryObjectuiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint)); |
| 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_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &query, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| GLboolean glIsQuery_enc(void *self , GLuint query) |
| { |
| ENCODER_DEBUG_LOG("glIsQuery(query:%u)", query); |
| AEMU_SCOPED_TRACE("glIsQuery encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &query, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value) |
| { |
| ENCODER_DEBUG_LOG("glProgramParameteri(program:%u, pname:0x%08x, value:%d)", program, pname, value); |
| AEMU_SCOPED_TRACE("glProgramParameteri encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramParameteri;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, &value, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length) |
| { |
| ENCODER_DEBUG_LOG("glProgramBinary(program:%u, binaryFormat:0x%08x, binary:0x%08x, length:%d)", program, binaryFormat, binary, length); |
| AEMU_SCOPED_TRACE("glProgramBinary encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_binary = length; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &binaryFormat, 4); ptr += 4; |
| memcpy(ptr, &__size_binary, 4); ptr += 4; |
| memcpy(ptr, binary, __size_binary);ptr += __size_binary; |
| memcpy(ptr, &length, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramBinary(program:%u, bufSize:%d, length:0x%08x, binaryFormat:0x%08x, binary:0x%08x)", program, bufSize, length, binaryFormat, binary); |
| AEMU_SCOPED_TRACE("glGetProgramBinary encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_binaryFormat = (sizeof(GLenum)); |
| const unsigned int __size_binary = bufSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetProgramBinary;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_binaryFormat, 4); ptr += 4; |
| memcpy(ptr, &__size_binary, 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(binaryFormat, __size_binaryFormat); |
| if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat); |
| stream->readback(binary, __size_binary); |
| if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name) |
| { |
| ENCODER_DEBUG_LOG("glGetFragDataLocation(program:%u, name:0x%08x)", program, name); |
| AEMU_SCOPED_TRACE("glGetFragDataLocation encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetFragDataLocation;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; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data) |
| { |
| ENCODER_DEBUG_LOG("glGetInteger64v(pname:0x%08x, data:%p)", pname, data); |
| AEMU_SCOPED_TRACE("glGetInteger64v encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = (glUtilsParamSize(pname) * sizeof(GLint64)); |
| 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_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(data, __size_data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data) |
| { |
| ENCODER_DEBUG_LOG("glGetIntegeri_v(target:0x%08x, index:%u, data:0x%08x)", target, index, data); |
| AEMU_SCOPED_TRACE("glGetIntegeri_v encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = (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_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(data, __size_data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data) |
| { |
| ENCODER_DEBUG_LOG("glGetInteger64i_v(target:0x%08x, index:%u, data:%p)", target, index, data); |
| AEMU_SCOPED_TRACE("glGetInteger64i_v encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = (sizeof(GLint64)); |
| 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_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(data, __size_data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glTexImage3D_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glTexImage3D(target:0x%08x, level:%d, internalFormat:%d, width:%d, height:%d, depth:%d, border:%d, format:0x%08x, type:0x%08x, data:0x%08x)", target, level, internalFormat, width, height, depth, border, format, type, data); |
| AEMU_SCOPED_TRACE("glTexImage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 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 + 4); |
| ptr = buf; |
| int tmp = OP_glTexImage3D;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, &depth, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 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->uploadPixels(self, width, height, depth, format, type, data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glTexImage3DOffsetAEMU(target:0x%08x, level:%d, internalFormat:%d, width:%d, height:%d, depth:%d, border:%d, format:0x%08x, type:0x%08x, offset:%u)", target, level, internalFormat, width, height, depth, border, format, type, offset); |
| AEMU_SCOPED_TRACE("glTexImage3DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexImage3DOffsetAEMU;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, &depth, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) |
| { |
| ENCODER_DEBUG_LOG("glTexStorage3D(target:0x%08x, levels:%d, internalformat:0x%08x, width:%d, height:%d, depth:%d)", target, levels, internalformat, width, height, depth); |
| AEMU_SCOPED_TRACE("glTexStorage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &levels, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 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 glTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glTexSubImage3D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, type:0x%08x, data:0x%08x)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data); |
| AEMU_SCOPED_TRACE("glTexSubImage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 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 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glTexSubImage3D;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 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->uploadPixels(self, width, height, depth, format, type, data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glTexSubImage3DOffsetAEMU(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, type:0x%08x, offset:%u)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, offset); |
| AEMU_SCOPED_TRACE("glTexSubImage3DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexSubImage3DOffsetAEMU;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexImage3D(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, depth:%d, border:%d, imageSize:%d, data:0x%08x)", target, level, internalformat, width, height, depth, border, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexImage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glCompressedTexImage3D;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, &depth, 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 glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexImage3DOffsetAEMU(target:0x%08x, level:%d, internalformat:0x%08x, width:%d, height:%d, depth:%d, border:%d, imageSize:%d, offset:%u)", target, level, internalformat, width, height, depth, border, imageSize, offset); |
| AEMU_SCOPED_TRACE("glCompressedTexImage3DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCompressedTexImage3DOffsetAEMU;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, &depth, 4); ptr += 4; |
| memcpy(ptr, &border, 4); ptr += 4; |
| memcpy(ptr, &imageSize, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCompressedTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexSubImage3D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, imageSize:%d, data:0x%08x)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexSubImage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glCompressedTexSubImage3D;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 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 glCompressedTexSubImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLuint data) |
| { |
| ENCODER_DEBUG_LOG("glCompressedTexSubImage3DOffsetAEMU(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, width:%d, height:%d, depth:%d, format:0x%08x, imageSize:%d, data:%u)", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| AEMU_SCOPED_TRACE("glCompressedTexSubImage3DOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;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, &zoffset, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &depth, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| memcpy(ptr, &imageSize, 4); ptr += 4; |
| memcpy(ptr, &data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| ENCODER_DEBUG_LOG("glCopyTexSubImage3D(target:0x%08x, level:%d, xoffset:%d, yoffset:%d, zoffset:%d, x:%d, y:%d, width:%d, height:%d)", target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| AEMU_SCOPED_TRACE("glCopyTexSubImage3D encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCopyTexSubImage3D;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, &zoffset, 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; |
| |
| } |
| |
| void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data) |
| { |
| ENCODER_DEBUG_LOG("glGetBooleani_v(target:0x%08x, index:%u, data:0x%08x)", target, index, data); |
| AEMU_SCOPED_TRACE("glGetBooleani_v encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = (sizeof(GLboolean)); |
| 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_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(data, __size_data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glMemoryBarrier_enc(void *self , GLbitfield barriers) |
| { |
| ENCODER_DEBUG_LOG("glMemoryBarrier(barriers:0x%08x)", barriers); |
| AEMU_SCOPED_TRACE("glMemoryBarrier encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &barriers, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers) |
| { |
| ENCODER_DEBUG_LOG("glMemoryBarrierByRegion(barriers:0x%08x)", barriers); |
| AEMU_SCOPED_TRACE("glMemoryBarrierByRegion encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &barriers, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines) |
| { |
| ENCODER_DEBUG_LOG("glGenProgramPipelines(n:%d, pipelines:0x%08x)", n, pipelines); |
| AEMU_SCOPED_TRACE("glGenProgramPipelines encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pipelines = (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_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_pipelines, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(pipelines, __size_pipelines); |
| if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines) |
| { |
| ENCODER_DEBUG_LOG("glDeleteProgramPipelines(n:%d, pipelines:0x%08x)", n, pipelines); |
| AEMU_SCOPED_TRACE("glDeleteProgramPipelines encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pipelines = (n * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &n, 4); ptr += 4; |
| memcpy(ptr, &__size_pipelines, 4); ptr += 4; |
| memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindProgramPipeline_enc(void *self , GLuint pipeline) |
| { |
| ENCODER_DEBUG_LOG("glBindProgramPipeline(pipeline:%u)", pipeline); |
| AEMU_SCOPED_TRACE("glBindProgramPipeline encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramPipelineiv(pipeline:%u, pname:0x%08x, params:0x%08x)", pipeline, pname, params); |
| AEMU_SCOPED_TRACE("glGetProgramPipelineiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramPipelineInfoLog(pipeline:%u, bufSize:%d, length:0x%08x, infoLog:0x%08x)", pipeline, bufSize, length, infoLog); |
| AEMU_SCOPED_TRACE("glGetProgramPipelineInfoLog encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glValidateProgramPipeline_enc(void *self , GLuint pipeline) |
| { |
| ENCODER_DEBUG_LOG("glValidateProgramPipeline(pipeline:%u)", pipeline); |
| AEMU_SCOPED_TRACE("glValidateProgramPipeline encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline) |
| { |
| ENCODER_DEBUG_LOG("glIsProgramPipeline(pipeline:%u)", pipeline); |
| AEMU_SCOPED_TRACE("glIsProgramPipeline encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glUseProgramStages(pipeline:%u, stages:0x%08x, program:%u)", pipeline, stages, program); |
| AEMU_SCOPED_TRACE("glUseProgramStages encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 4); ptr += 4; |
| memcpy(ptr, &stages, 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 glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program) |
| { |
| ENCODER_DEBUG_LOG("glActiveShaderProgram(pipeline:%u, program:%u)", pipeline, program); |
| AEMU_SCOPED_TRACE("glActiveShaderProgram encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pipeline, 4); ptr += 4; |
| memcpy(ptr, &program, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen) |
| { |
| ENCODER_DEBUG_LOG("glCreateShaderProgramvAEMU(type:0x%08x, count:%d, packedStrings:0x%08x, packedLen:%u)", type, count, packedStrings, packedLen); |
| AEMU_SCOPED_TRACE("glCreateShaderProgramvAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_packedStrings = packedLen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_packedStrings, 4); ptr += 4; |
| memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings; |
| memcpy(ptr, &packedLen, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1f(program:%u, location:%d, v0:%f)", program, location, v0); |
| AEMU_SCOPED_TRACE("glProgramUniform1f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2f(program:%u, location:%d, v0:%f, v1:%f)", program, location, v0, v1); |
| AEMU_SCOPED_TRACE("glProgramUniform2f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3f(program:%u, location:%d, v0:%f, v1:%f, v2:%f)", program, location, v0, v1, v2); |
| AEMU_SCOPED_TRACE("glProgramUniform3f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4f(program:%u, location:%d, v0:%f, v1:%f, v2:%f, v3:%f)", program, location, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glProgramUniform4f encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1i(program:%u, location:%d, v0:%d)", program, location, v0); |
| AEMU_SCOPED_TRACE("glProgramUniform1i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2i(program:%u, location:%d, v0:%d, v1:%d)", program, location, v0, v1); |
| AEMU_SCOPED_TRACE("glProgramUniform2i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3i(program:%u, location:%d, v0:%d, v1:%d, v2:%d)", program, location, v0, v1, v2); |
| AEMU_SCOPED_TRACE("glProgramUniform3i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4i(program:%u, location:%d, v0:%d, v1:%d, v2:%d, v3:%d)", program, location, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glProgramUniform4i encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1ui(program:%u, location:%d, v0:%u)", program, location, v0); |
| AEMU_SCOPED_TRACE("glProgramUniform1ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2ui(program:%u, location:%d, v0:%d, v1:%u)", program, location, v0, v1); |
| AEMU_SCOPED_TRACE("glProgramUniform2ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3ui(program:%u, location:%d, v0:%d, v1:%d, v2:%u)", program, location, v0, v1, v2); |
| AEMU_SCOPED_TRACE("glProgramUniform3ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4ui(program:%u, location:%d, v0:%d, v1:%d, v2:%d, v3:%u)", program, location, v0, v1, v2, v3); |
| AEMU_SCOPED_TRACE("glProgramUniform4ui encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &v0, 4); ptr += 4; |
| memcpy(ptr, &v1, 4); ptr += 4; |
| memcpy(ptr, &v2, 4); ptr += 4; |
| memcpy(ptr, &v3, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1fv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform1fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2fv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 2 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3fv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 3 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4fv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1iv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform1iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2iv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform2iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 2 * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3iv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform3iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 3 * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4iv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform4iv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform1uiv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform1uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform2uiv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform2uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 2 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform3uiv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform3uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 3 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniform4uiv(program:%u, location:%d, count:%d, value:0x%08x)", program, location, count, value); |
| AEMU_SCOPED_TRACE("glProgramUniform4uiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLuint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix2fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix3fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 9 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix4fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 16 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix2x3fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix2x3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix3x2fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix3x2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix2x4fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix2x4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix4x2fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix4x2fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix3x4fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix3x4fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| { |
| ENCODER_DEBUG_LOG("glProgramUniformMatrix4x3fv(program:%u, location:%d, count:%d, transpose:%d, value:0x%08x)", program, location, count, transpose, value); |
| AEMU_SCOPED_TRACE("glProgramUniformMatrix4x3fv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &transpose, 1); ptr += 1; |
| memcpy(ptr, &__size_value, 4); ptr += 4; |
| memcpy(ptr, value, __size_value);ptr += __size_value; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramInterfaceiv(program:%u, programInterface:0x%08x, pname:0x%08x, params:0x%08x)", program, programInterface, pname, params); |
| AEMU_SCOPED_TRACE("glGetProgramInterfaceiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &programInterface, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramResourceiv(program:%u, programInterface:0x%08x, index:%u, propCount:%d, props:0x%08x, bufSize:%d, length:0x%08x, params:0x%08x)", program, programInterface, index, propCount, props, bufSize, length, params); |
| AEMU_SCOPED_TRACE("glGetProgramResourceiv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_props = (propCount * sizeof(GLenum)); |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_params = (bufSize * sizeof(GLint)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &programInterface, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &propCount, 4); ptr += 4; |
| memcpy(ptr, &__size_props, 4); ptr += 4; |
| memcpy(ptr, props, __size_props);ptr += __size_props; |
| memcpy(ptr, &bufSize, 4); ptr += 4; |
| memcpy(ptr, &__size_length, 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; |
| |
| if (length != NULL) { |
| stream->readback(length, __size_length); |
| if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| } |
| stream->readback(params, __size_params); |
| if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramResourceIndex(program:%u, programInterface:0x%08x, name:0x%08x)", program, programInterface, name); |
| AEMU_SCOPED_TRACE("glGetProgramResourceIndex encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &programInterface, 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; |
| |
| |
| GLuint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramResourceLocation(program:%u, programInterface:0x%08x, name:0x%08x)", program, programInterface, name); |
| AEMU_SCOPED_TRACE("glGetProgramResourceLocation encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &programInterface, 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; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name) |
| { |
| ENCODER_DEBUG_LOG("glGetProgramResourceName(program:%u, programInterface:0x%08x, index:%u, bufSize:%d, length:0x%08x, name:0x%08x)", program, programInterface, index, bufSize, length, name); |
| AEMU_SCOPED_TRACE("glGetProgramResourceName encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| const unsigned int __size_name = bufSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 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_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &programInterface, 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_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); |
| } |
| stream->readback(name, __size_name); |
| if (useChecksum) checksumCalculator->addBuffer(name, __size_name); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) |
| { |
| ENCODER_DEBUG_LOG("glBindImageTexture(unit:%u, texture:%u, level:%d, layered:%d, layer:%d, access:0x%08x, format:0x%08x)", unit, texture, level, layered, layer, access, format); |
| AEMU_SCOPED_TRACE("glBindImageTexture encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &unit, 4); ptr += 4; |
| memcpy(ptr, &texture, 4); ptr += 4; |
| memcpy(ptr, &level, 4); ptr += 4; |
| memcpy(ptr, &layered, 1); ptr += 1; |
| memcpy(ptr, &layer, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &format, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) |
| { |
| ENCODER_DEBUG_LOG("glDispatchCompute(num_groups_x:%u, num_groups_y:%u, num_groups_z:%u)", num_groups_x, num_groups_y, num_groups_z); |
| AEMU_SCOPED_TRACE("glDispatchCompute encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &num_groups_x, 4); ptr += 4; |
| memcpy(ptr, &num_groups_y, 4); ptr += 4; |
| memcpy(ptr, &num_groups_z, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDispatchComputeIndirect_enc(void *self , GLintptr indirect) |
| { |
| ENCODER_DEBUG_LOG("glDispatchComputeIndirect(indirect:0x%08lx)", indirect); |
| AEMU_SCOPED_TRACE("glDispatchComputeIndirect encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &indirect, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride) |
| { |
| ENCODER_DEBUG_LOG("glBindVertexBuffer(bindingindex:%u, buffer:%u, offset:0x%08lx, stride:0x%08lx)", bindingindex, buffer, offset, stride); |
| AEMU_SCOPED_TRACE("glBindVertexBuffer encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bindingindex, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &stride, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribBinding(attribindex:%u, bindingindex:%u)", attribindex, bindingindex); |
| AEMU_SCOPED_TRACE("glVertexAttribBinding encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &attribindex, 4); ptr += 4; |
| memcpy(ptr, &bindingindex, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribFormat(attribindex:%u, size:%d, type:0x%08x, normalized:%d, relativeoffset:%u)", attribindex, size, type, normalized, relativeoffset); |
| AEMU_SCOPED_TRACE("glVertexAttribFormat encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &attribindex, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &normalized, 1); ptr += 1; |
| memcpy(ptr, &relativeoffset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) |
| { |
| ENCODER_DEBUG_LOG("glVertexAttribIFormat(attribindex:%u, size:%d, type:0x%08x, relativeoffset:%u)", attribindex, size, type, relativeoffset); |
| AEMU_SCOPED_TRACE("glVertexAttribIFormat encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &attribindex, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &relativeoffset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor) |
| { |
| ENCODER_DEBUG_LOG("glVertexBindingDivisor(bindingindex:%u, divisor:%u)", bindingindex, divisor); |
| AEMU_SCOPED_TRACE("glVertexBindingDivisor encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bindingindex, 4); ptr += 4; |
| memcpy(ptr, &divisor, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawArraysIndirectDataAEMU(mode:0x%08x, indirect:0x%08x, datalen:%u)", mode, indirect, datalen); |
| AEMU_SCOPED_TRACE("glDrawArraysIndirectDataAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_indirect = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &__size_indirect, 4); ptr += 4; |
| memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glDrawArraysIndirectOffsetAEMU(mode:0x%08x, offset:%u)", mode, offset); |
| AEMU_SCOPED_TRACE("glDrawArraysIndirectOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsIndirectDataAEMU(mode:0x%08x, type:0x%08x, indirect:0x%08x, datalen:%u)", mode, type, indirect, datalen); |
| AEMU_SCOPED_TRACE("glDrawElementsIndirectDataAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_indirect = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_indirect, 4); ptr += 4; |
| memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsIndirectOffsetAEMU(mode:0x%08x, type:0x%08x, offset:%u)", mode, type, offset); |
| AEMU_SCOPED_TRACE("glDrawElementsIndirectOffsetAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) |
| { |
| ENCODER_DEBUG_LOG("glTexStorage2DMultisample(target:0x%08x, samples:%d, internalformat:0x%08x, width:%d, height:%d, fixedsamplelocations:%d)", target, samples, internalformat, width, height, fixedsamplelocations); |
| AEMU_SCOPED_TRACE("glTexStorage2DMultisample encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 1; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &samples, 4); ptr += 4; |
| memcpy(ptr, &internalformat, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &fixedsamplelocations, 1); ptr += 1; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask) |
| { |
| ENCODER_DEBUG_LOG("glSampleMaski(maskNumber:%u, mask:0x%08x)", maskNumber, mask); |
| AEMU_SCOPED_TRACE("glSampleMaski encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &maskNumber, 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 glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val) |
| { |
| ENCODER_DEBUG_LOG("glGetMultisamplefv(pname:0x%08x, index:%u, val:0x%08x)", pname, index, val); |
| AEMU_SCOPED_TRACE("glGetMultisamplefv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_val = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 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_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &pname, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| memcpy(ptr, &__size_val, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(val, __size_val); |
| if (useChecksum) checksumCalculator->addBuffer(val, __size_val); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param) |
| { |
| ENCODER_DEBUG_LOG("glFramebufferParameteri(target:0x%08x, pname:0x%08x, param:%d)", target, pname, param); |
| AEMU_SCOPED_TRACE("glFramebufferParameteri encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glFramebufferParameteri;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, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetFramebufferParameteriv(target:0x%08x, pname:0x%08x, params:0x%08x)", target, pname, params); |
| AEMU_SCOPED_TRACE("glGetFramebufferParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetFramebufferParameteriv;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexLevelParameterfv(target:0x%08x, level:%d, pname:0x%08x, params:0x%08x)", target, level, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexLevelParameterfv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetTexLevelParameterfv;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, &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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetTexLevelParameteriv(target:0x%08x, level:%d, pname:0x%08x, params:0x%08x)", target, level, pname, params); |
| AEMU_SCOPED_TRACE("glGetTexLevelParameteriv encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 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_glGetTexLevelParameteriv;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, &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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glMapBufferRangeDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr) |
| { |
| ENCODER_DEBUG_LOG("glMapBufferRangeDMA(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, paddr:0x%016lx)", target, offset, length, access, paddr); |
| AEMU_SCOPED_TRACE("glMapBufferRangeDMA encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMapBufferRangeDMA;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &paddr, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUnmapBufferDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, GLboolean* out_res) |
| { |
| ENCODER_DEBUG_LOG("glUnmapBufferDMA(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, paddr:0x%016lx, out_res:0x%08x)", target, offset, length, access, paddr, out_res); |
| AEMU_SCOPED_TRACE("glUnmapBufferDMA encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_out_res = (sizeof(GLboolean)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUnmapBufferDMA;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &paddr, 8); ptr += 8; |
| memcpy(ptr, &__size_out_res, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(out_res, __size_out_res); |
| if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glUnmapBufferDMA: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| uint64_t glMapBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr) |
| { |
| ENCODER_DEBUG_LOG("glMapBufferRangeDirect(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, paddr:0x%016lx)", target, offset, length, access, paddr); |
| AEMU_SCOPED_TRACE("glMapBufferRangeDirect encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glMapBufferRangeDirect;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &paddr, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint64_t retval; |
| stream->readback(&retval, 8); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 8); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glMapBufferRangeDirect: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glUnmapBufferDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, uint64_t guest_ptr, GLboolean* out_res) |
| { |
| ENCODER_DEBUG_LOG("glUnmapBufferDirect(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, paddr:0x%016lx, guest_ptr:0x%016lx, out_res:0x%08x)", target, offset, length, access, paddr, guest_ptr, out_res); |
| AEMU_SCOPED_TRACE("glUnmapBufferDirect encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_out_res = (sizeof(GLboolean)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 8 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glUnmapBufferDirect;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| memcpy(ptr, &paddr, 8); ptr += 8; |
| memcpy(ptr, &guest_ptr, 8); ptr += 8; |
| memcpy(ptr, &__size_out_res, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(out_res, __size_out_res); |
| if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glUnmapBufferDirect: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glFlushMappedBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
| { |
| ENCODER_DEBUG_LOG("glFlushMappedBufferRangeDirect(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x)", target, offset, length, access); |
| AEMU_SCOPED_TRACE("glFlushMappedBufferRangeDirect encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glFlushMappedBufferRangeDirect;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLenum glGetGraphicsResetStatusEXT_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("glGetGraphicsResetStatusEXT()"); |
| AEMU_SCOPED_TRACE("glGetGraphicsResetStatusEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glGetGraphicsResetStatusEXT;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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetGraphicsResetStatusEXT: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glReadnPixelsEXT_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid* data) |
| { |
| ENCODER_DEBUG_LOG("glReadnPixelsEXT(x:%d, y:%d, width:%d, height:%d, format:0x%08x, type:0x%08x, bufSize:%d, data:0x%08x)", x, y, width, height, format, type, bufSize, data); |
| AEMU_SCOPED_TRACE("glReadnPixelsEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = bufSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 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_glReadnPixelsEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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, &format, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(data, __size_data); |
| if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glReadnPixelsEXT: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetnUniformfvEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLfloat* params) |
| { |
| ENCODER_DEBUG_LOG("glGetnUniformfvEXT(program:%u, location:%d, bufSize:%d, params:0x%08x)", program, location, bufSize, params); |
| AEMU_SCOPED_TRACE("glGetnUniformfvEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = bufSize; |
| 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_glGetnUniformfvEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetnUniformfvEXT: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glGetnUniformivEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLint* params) |
| { |
| ENCODER_DEBUG_LOG("glGetnUniformivEXT(program:%u, location:%d, bufSize:%d, params:0x%08x)", program, location, bufSize, params); |
| AEMU_SCOPED_TRACE("glGetnUniformivEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_params = bufSize; |
| 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_glGetnUniformivEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &program, 4); ptr += 4; |
| memcpy(ptr, &location, 4); ptr += 4; |
| memcpy(ptr, &bufSize, 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[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glGetnUniformivEXT: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| void glDrawArraysNullAEMU_enc(void *self , GLenum mode, GLint first, GLsizei count) |
| { |
| ENCODER_DEBUG_LOG("glDrawArraysNullAEMU(mode:0x%08x, first:%d, count:%d)", mode, first, count); |
| AEMU_SCOPED_TRACE("glDrawArraysNullAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawArraysNullAEMU;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 glDrawElementsOffsetNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsOffsetNullAEMU(mode:0x%08x, count:%d, type:0x%08x, offset:%u)", mode, count, type, offset); |
| AEMU_SCOPED_TRACE("glDrawElementsOffsetNullAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDrawElementsOffsetNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glDrawElementsDataNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen) |
| { |
| ENCODER_DEBUG_LOG("glDrawElementsDataNullAEMU(mode:0x%08x, count:%d, type:0x%08x, data:0x%08x, datalen:%u)", mode, count, type, data, datalen); |
| AEMU_SCOPED_TRACE("glDrawElementsDataNullAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_data = datalen; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_glDrawElementsDataNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &count, 4); ptr += 4; |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| memcpy(ptr, data, __size_data);ptr += __size_data; |
| memcpy(ptr, &datalen, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glUnmapBufferAsyncAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res) |
| { |
| ENCODER_DEBUG_LOG("glUnmapBufferAsyncAEMU(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, guest_buffer:0x%08x, out_res:0x%08x)", target, offset, length, access, guest_buffer, out_res); |
| AEMU_SCOPED_TRACE("glUnmapBufferAsyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| const unsigned int __size_out_res = (sizeof(GLboolean)); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + __size_out_res + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(8 + 4 + 4 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glUnmapBufferAsyncAEMU;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_guest_buffer,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4); |
| if (guest_buffer != NULL) { |
| stream->writeFully(guest_buffer, __size_guest_buffer); |
| if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer); |
| } |
| buf = stream->alloc(__size_out_res + 1*4); |
| ptr = buf; |
| memcpy(ptr, &__size_out_res, 4); ptr += 4; |
| memcpy(ptr, out_res, __size_out_res);ptr += __size_out_res; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| void glFlushMappedBufferRangeAEMU2_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer) |
| { |
| ENCODER_DEBUG_LOG("glFlushMappedBufferRangeAEMU2(target:0x%08x, offset:0x%08lx, length:0x%08lx, access:0x%08x, guest_buffer:0x%08x)", target, offset, length, access, guest_buffer); |
| AEMU_SCOPED_TRACE("glFlushMappedBufferRangeAEMU2 encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(8 + 4 + 4 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_glFlushMappedBufferRangeAEMU2;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, &length, 4); ptr += 4; |
| memcpy(ptr, &access, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_guest_buffer,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4); |
| if (guest_buffer != NULL) { |
| stream->writeFully(guest_buffer, __size_guest_buffer); |
| if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer); |
| } |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| } |
| |
| GLboolean glBufferDataSyncAEMU_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) |
| { |
| ENCODER_DEBUG_LOG("glBufferDataSyncAEMU(target:0x%08x, size:0x%08lx, data:0x%08x, usage:0x%08x)", target, size, data, usage); |
| AEMU_SCOPED_TRACE("glBufferDataSyncAEMU encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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(totalSize); |
| ptr = buf; |
| int tmp = OP_glBufferDataSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| memcpy(ptr, &__size_data, 4); ptr += 4; |
| if (data != NULL) memcpy(ptr, data, __size_data);ptr += __size_data; |
| memcpy(ptr, &usage, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glBufferDataSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void glTexBufferOES_enc(void *self , GLenum target, GLenum internalFormat, GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("glTexBufferOES(target:0x%08x, internalFormat:0x%08x, buffer:%u)", target, internalFormat, buffer); |
| AEMU_SCOPED_TRACE("glTexBufferOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexBufferOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 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 glTexBufferRangeOES_enc(void *self , GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| { |
| ENCODER_DEBUG_LOG("glTexBufferRangeOES(target:0x%08x, internalFormat:0x%08x, buffer:%u, offset:0x%08lx, size:0x%08lx)", target, internalFormat, buffer, offset, size); |
| AEMU_SCOPED_TRACE("glTexBufferRangeOES encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexBufferRangeOES;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glTexBufferEXT_enc(void *self , GLenum target, GLenum internalFormat, GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("glTexBufferEXT(target:0x%08x, internalFormat:0x%08x, buffer:%u)", target, internalFormat, buffer); |
| AEMU_SCOPED_TRACE("glTexBufferEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexBufferEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 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 glTexBufferRangeEXT_enc(void *self , GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| { |
| ENCODER_DEBUG_LOG("glTexBufferRangeEXT(target:0x%08x, internalFormat:0x%08x, buffer:%u, offset:0x%08lx, size:0x%08lx)", target, internalFormat, buffer, offset, size); |
| AEMU_SCOPED_TRACE("glTexBufferRangeEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glTexBufferRangeEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| memcpy(ptr, &offset, 4); ptr += 4; |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void glEnableiEXT_enc(void *self , GLenum cap, GLuint index) |
| { |
| ENCODER_DEBUG_LOG("glEnableiEXT(cap:0x%08x, index:%u)", cap, index); |
| AEMU_SCOPED_TRACE("glEnableiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glEnableiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &cap, 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 glDisableiEXT_enc(void *self , GLenum cap, GLuint index) |
| { |
| ENCODER_DEBUG_LOG("glDisableiEXT(cap:0x%08x, index:%u)", cap, index); |
| AEMU_SCOPED_TRACE("glDisableiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glDisableiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &cap, 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 glBlendEquationiEXT_enc(void *self , GLuint index, GLenum mode) |
| { |
| ENCODER_DEBUG_LOG("glBlendEquationiEXT(index:%u, mode:0x%08x)", index, mode); |
| AEMU_SCOPED_TRACE("glBlendEquationiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBlendEquationiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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 glBlendEquationSeparateiEXT_enc(void *self , GLuint index, GLenum modeRGB, GLenum modeAlpha) |
| { |
| ENCODER_DEBUG_LOG("glBlendEquationSeparateiEXT(index:%u, modeRGB:0x%08x, modeAlpha:0x%08x)", index, modeRGB, modeAlpha); |
| AEMU_SCOPED_TRACE("glBlendEquationSeparateiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBlendEquationSeparateiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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 glBlendFunciEXT_enc(void *self , GLuint index, GLenum sfactor, GLenum dfactor) |
| { |
| ENCODER_DEBUG_LOG("glBlendFunciEXT(index:%u, sfactor:0x%08x, dfactor:0x%08x)", index, sfactor, dfactor); |
| AEMU_SCOPED_TRACE("glBlendFunciEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBlendFunciEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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 glBlendFuncSeparateiEXT_enc(void *self , GLuint index, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| { |
| ENCODER_DEBUG_LOG("glBlendFuncSeparateiEXT(index:%u, srcRGB:0x%08x, dstRGB:0x%08x, srcAlpha:0x%08x, dstAlpha:0x%08x)", index, srcRGB, dstRGB, srcAlpha, dstAlpha); |
| AEMU_SCOPED_TRACE("glBlendFuncSeparateiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glBlendFuncSeparateiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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 glColorMaskiEXT_enc(void *self , GLuint index, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| { |
| ENCODER_DEBUG_LOG("glColorMaskiEXT(index:%u, red:%d, green:%d, blue:%d, alpha:%d)", index, red, green, blue, alpha); |
| AEMU_SCOPED_TRACE("glColorMaskiEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 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_glColorMaskiEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &index, 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; |
| |
| } |
| |
| GLboolean glIsEnablediEXT_enc(void *self , GLenum cap, GLuint index) |
| { |
| ENCODER_DEBUG_LOG("glIsEnablediEXT(cap:0x%08x, index:%u)", cap, index); |
| AEMU_SCOPED_TRACE("glIsEnablediEXT encode"); |
| |
| gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| gfxstream::guest::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_glIsEnablediEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &cap, 4); ptr += 4; |
| memcpy(ptr, &index, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLboolean retval; |
| stream->readback(&retval, 1); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[gfxstream::guest::ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("glIsEnablediEXT: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| } // namespace |
| |
| gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator) |
| { |
| m_stream = stream; |
| m_checksumCalculator = checksumCalculator; |
| |
| this->glActiveTexture = &glActiveTexture_enc; |
| this->glAttachShader = &glAttachShader_enc; |
| this->glBindAttribLocation = &glBindAttribLocation_enc; |
| this->glBindBuffer = &glBindBuffer_enc; |
| this->glBindFramebuffer = &glBindFramebuffer_enc; |
| this->glBindRenderbuffer = &glBindRenderbuffer_enc; |
| this->glBindTexture = &glBindTexture_enc; |
| this->glBlendColor = &glBlendColor_enc; |
| this->glBlendEquation = &glBlendEquation_enc; |
| this->glBlendEquationSeparate = &glBlendEquationSeparate_enc; |
| this->glBlendFunc = &glBlendFunc_enc; |
| this->glBlendFuncSeparate = &glBlendFuncSeparate_enc; |
| this->glBufferData = &glBufferData_enc; |
| this->glBufferSubData = &glBufferSubData_enc; |
| this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc; |
| this->glClear = &glClear_enc; |
| this->glClearColor = &glClearColor_enc; |
| this->glClearDepthf = &glClearDepthf_enc; |
| this->glClearStencil = &glClearStencil_enc; |
| this->glColorMask = &glColorMask_enc; |
| this->glCompileShader = &glCompileShader_enc; |
| this->glCompressedTexImage2D = &glCompressedTexImage2D_enc; |
| this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc; |
| this->glCopyTexImage2D = &glCopyTexImage2D_enc; |
| this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc; |
| this->glCreateProgram = &glCreateProgram_enc; |
| this->glCreateShader = &glCreateShader_enc; |
| this->glCullFace = &glCullFace_enc; |
| this->glDeleteBuffers = &glDeleteBuffers_enc; |
| this->glDeleteFramebuffers = &glDeleteFramebuffers_enc; |
| this->glDeleteProgram = &glDeleteProgram_enc; |
| this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc; |
| this->glDeleteShader = &glDeleteShader_enc; |
| this->glDeleteTextures = &glDeleteTextures_enc; |
| this->glDepthFunc = &glDepthFunc_enc; |
| this->glDepthMask = &glDepthMask_enc; |
| this->glDepthRangef = &glDepthRangef_enc; |
| this->glDetachShader = &glDetachShader_enc; |
| this->glDisable = &glDisable_enc; |
| this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc; |
| this->glDrawArrays = &glDrawArrays_enc; |
| this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported; |
| this->glEnable = &glEnable_enc; |
| this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc; |
| this->glFinish = &glFinish_enc; |
| this->glFlush = &glFlush_enc; |
| this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc; |
| this->glFramebufferTexture2D = &glFramebufferTexture2D_enc; |
| this->glFrontFace = &glFrontFace_enc; |
| this->glGenBuffers = &glGenBuffers_enc; |
| this->glGenerateMipmap = &glGenerateMipmap_enc; |
| this->glGenFramebuffers = &glGenFramebuffers_enc; |
| this->glGenRenderbuffers = &glGenRenderbuffers_enc; |
| this->glGenTextures = &glGenTextures_enc; |
| this->glGetActiveAttrib = &glGetActiveAttrib_enc; |
| this->glGetActiveUniform = &glGetActiveUniform_enc; |
| this->glGetAttachedShaders = &glGetAttachedShaders_enc; |
| this->glGetAttribLocation = &glGetAttribLocation_enc; |
| this->glGetBooleanv = &glGetBooleanv_enc; |
| this->glGetBufferParameteriv = &glGetBufferParameteriv_enc; |
| this->glGetError = &glGetError_enc; |
| this->glGetFloatv = &glGetFloatv_enc; |
| this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc; |
| this->glGetIntegerv = &glGetIntegerv_enc; |
| this->glGetProgramiv = &glGetProgramiv_enc; |
| this->glGetProgramInfoLog = &glGetProgramInfoLog_enc; |
| this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc; |
| this->glGetShaderiv = &glGetShaderiv_enc; |
| this->glGetShaderInfoLog = &glGetShaderInfoLog_enc; |
| this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc; |
| this->glGetShaderSource = &glGetShaderSource_enc; |
| this->glGetString = (glGetString_client_proc_t) &enc_unsupported; |
| this->glGetTexParameterfv = &glGetTexParameterfv_enc; |
| this->glGetTexParameteriv = &glGetTexParameteriv_enc; |
| this->glGetUniformfv = &glGetUniformfv_enc; |
| this->glGetUniformiv = &glGetUniformiv_enc; |
| this->glGetUniformLocation = &glGetUniformLocation_enc; |
| this->glGetVertexAttribfv = &glGetVertexAttribfv_enc; |
| this->glGetVertexAttribiv = &glGetVertexAttribiv_enc; |
| this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported; |
| this->glHint = &glHint_enc; |
| this->glIsBuffer = &glIsBuffer_enc; |
| this->glIsEnabled = &glIsEnabled_enc; |
| this->glIsFramebuffer = &glIsFramebuffer_enc; |
| this->glIsProgram = &glIsProgram_enc; |
| this->glIsRenderbuffer = &glIsRenderbuffer_enc; |
| this->glIsShader = &glIsShader_enc; |
| this->glIsTexture = &glIsTexture_enc; |
| this->glLineWidth = &glLineWidth_enc; |
| this->glLinkProgram = &glLinkProgram_enc; |
| this->glPixelStorei = &glPixelStorei_enc; |
| this->glPolygonOffset = &glPolygonOffset_enc; |
| this->glReadPixels = &glReadPixels_enc; |
| this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc; |
| this->glRenderbufferStorage = &glRenderbufferStorage_enc; |
| this->glSampleCoverage = &glSampleCoverage_enc; |
| this->glScissor = &glScissor_enc; |
| this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported; |
| this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported; |
| this->glStencilFunc = &glStencilFunc_enc; |
| this->glStencilFuncSeparate = &glStencilFuncSeparate_enc; |
| this->glStencilMask = &glStencilMask_enc; |
| this->glStencilMaskSeparate = &glStencilMaskSeparate_enc; |
| this->glStencilOp = &glStencilOp_enc; |
| this->glStencilOpSeparate = &glStencilOpSeparate_enc; |
| this->glTexImage2D = &glTexImage2D_enc; |
| this->glTexParameterf = &glTexParameterf_enc; |
| this->glTexParameterfv = &glTexParameterfv_enc; |
| this->glTexParameteri = &glTexParameteri_enc; |
| this->glTexParameteriv = &glTexParameteriv_enc; |
| this->glTexSubImage2D = &glTexSubImage2D_enc; |
| this->glUniform1f = &glUniform1f_enc; |
| this->glUniform1fv = &glUniform1fv_enc; |
| this->glUniform1i = &glUniform1i_enc; |
| this->glUniform1iv = &glUniform1iv_enc; |
| this->glUniform2f = &glUniform2f_enc; |
| this->glUniform2fv = &glUniform2fv_enc; |
| this->glUniform2i = &glUniform2i_enc; |
| this->glUniform2iv = &glUniform2iv_enc; |
| this->glUniform3f = &glUniform3f_enc; |
| this->glUniform3fv = &glUniform3fv_enc; |
| this->glUniform3i = &glUniform3i_enc; |
| this->glUniform3iv = &glUniform3iv_enc; |
| this->glUniform4f = &glUniform4f_enc; |
| this->glUniform4fv = &glUniform4fv_enc; |
| this->glUniform4i = &glUniform4i_enc; |
| this->glUniform4iv = &glUniform4iv_enc; |
| this->glUniformMatrix2fv = &glUniformMatrix2fv_enc; |
| this->glUniformMatrix3fv = &glUniformMatrix3fv_enc; |
| this->glUniformMatrix4fv = &glUniformMatrix4fv_enc; |
| this->glUseProgram = &glUseProgram_enc; |
| this->glValidateProgram = &glValidateProgram_enc; |
| this->glVertexAttrib1f = &glVertexAttrib1f_enc; |
| this->glVertexAttrib1fv = &glVertexAttrib1fv_enc; |
| this->glVertexAttrib2f = &glVertexAttrib2f_enc; |
| this->glVertexAttrib2fv = &glVertexAttrib2fv_enc; |
| this->glVertexAttrib3f = &glVertexAttrib3f_enc; |
| this->glVertexAttrib3fv = &glVertexAttrib3fv_enc; |
| this->glVertexAttrib4f = &glVertexAttrib4f_enc; |
| this->glVertexAttrib4fv = &glVertexAttrib4fv_enc; |
| this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported; |
| this->glViewport = &glViewport_enc; |
| this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc; |
| this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc; |
| this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported; |
| this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported; |
| this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported; |
| this->glUnmapBufferOES = &glUnmapBufferOES_enc; |
| this->glTexImage3DOES = &glTexImage3DOES_enc; |
| this->glTexSubImage3DOES = &glTexSubImage3DOES_enc; |
| this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc; |
| this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc; |
| this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc; |
| this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc; |
| this->glBindVertexArrayOES = &glBindVertexArrayOES_enc; |
| this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc; |
| this->glGenVertexArraysOES = &glGenVertexArraysOES_enc; |
| this->glIsVertexArrayOES = &glIsVertexArrayOES_enc; |
| this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc; |
| this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported; |
| this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported; |
| this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported; |
| this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported; |
| this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported; |
| this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported; |
| this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported; |
| this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported; |
| this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported; |
| this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported; |
| this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported; |
| this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported; |
| this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported; |
| this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported; |
| this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported; |
| this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported; |
| this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported; |
| this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported; |
| this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported; |
| this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported; |
| this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported; |
| this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported; |
| this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported; |
| this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported; |
| this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported; |
| this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported; |
| this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported; |
| this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported; |
| this->glVertexAttribPointerData = &glVertexAttribPointerData_enc; |
| this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc; |
| this->glDrawElementsOffset = &glDrawElementsOffset_enc; |
| this->glDrawElementsData = &glDrawElementsData_enc; |
| this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc; |
| this->glShaderString = &glShaderString_enc; |
| this->glFinishRoundTrip = &glFinishRoundTrip_enc; |
| this->glGenVertexArrays = &glGenVertexArrays_enc; |
| this->glBindVertexArray = &glBindVertexArray_enc; |
| this->glDeleteVertexArrays = &glDeleteVertexArrays_enc; |
| this->glIsVertexArray = &glIsVertexArray_enc; |
| this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported; |
| this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported; |
| this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported; |
| this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc; |
| this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc; |
| this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc; |
| this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc; |
| this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc; |
| this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc; |
| this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc; |
| this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc; |
| this->glBindBufferRange = &glBindBufferRange_enc; |
| this->glBindBufferBase = &glBindBufferBase_enc; |
| this->glCopyBufferSubData = &glCopyBufferSubData_enc; |
| this->glClearBufferiv = &glClearBufferiv_enc; |
| this->glClearBufferuiv = &glClearBufferuiv_enc; |
| this->glClearBufferfv = &glClearBufferfv_enc; |
| this->glClearBufferfi = &glClearBufferfi_enc; |
| this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported; |
| this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported; |
| this->glUniformBlockBinding = &glUniformBlockBinding_enc; |
| this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc; |
| this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported; |
| this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc; |
| this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc; |
| this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc; |
| this->glUniform1ui = &glUniform1ui_enc; |
| this->glUniform2ui = &glUniform2ui_enc; |
| this->glUniform3ui = &glUniform3ui_enc; |
| this->glUniform4ui = &glUniform4ui_enc; |
| this->glUniform1uiv = &glUniform1uiv_enc; |
| this->glUniform2uiv = &glUniform2uiv_enc; |
| this->glUniform3uiv = &glUniform3uiv_enc; |
| this->glUniform4uiv = &glUniform4uiv_enc; |
| this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc; |
| this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc; |
| this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc; |
| this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc; |
| this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc; |
| this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc; |
| this->glGetUniformuiv = &glGetUniformuiv_enc; |
| this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc; |
| this->glVertexAttribI4i = &glVertexAttribI4i_enc; |
| this->glVertexAttribI4ui = &glVertexAttribI4ui_enc; |
| this->glVertexAttribI4iv = &glVertexAttribI4iv_enc; |
| this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc; |
| this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported; |
| this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc; |
| this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc; |
| this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc; |
| this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc; |
| this->glVertexAttribDivisor = &glVertexAttribDivisor_enc; |
| this->glDrawArraysInstanced = &glDrawArraysInstanced_enc; |
| this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported; |
| this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc; |
| this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc; |
| this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported; |
| this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc; |
| this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc; |
| this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported; |
| this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported; |
| this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported; |
| this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported; |
| this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported; |
| this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported; |
| this->glFenceSyncAEMU = &glFenceSyncAEMU_enc; |
| this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc; |
| this->glWaitSyncAEMU = &glWaitSyncAEMU_enc; |
| this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc; |
| this->glIsSyncAEMU = &glIsSyncAEMU_enc; |
| this->glGetSyncivAEMU = &glGetSyncivAEMU_enc; |
| this->glDrawBuffers = &glDrawBuffers_enc; |
| this->glReadBuffer = &glReadBuffer_enc; |
| this->glBlitFramebuffer = &glBlitFramebuffer_enc; |
| this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc; |
| this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc; |
| this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc; |
| this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc; |
| this->glTexStorage2D = &glTexStorage2D_enc; |
| this->glGetInternalformativ = &glGetInternalformativ_enc; |
| this->glBeginTransformFeedback = &glBeginTransformFeedback_enc; |
| this->glEndTransformFeedback = &glEndTransformFeedback_enc; |
| this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc; |
| this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc; |
| this->glBindTransformFeedback = &glBindTransformFeedback_enc; |
| this->glPauseTransformFeedback = &glPauseTransformFeedback_enc; |
| this->glResumeTransformFeedback = &glResumeTransformFeedback_enc; |
| this->glIsTransformFeedback = &glIsTransformFeedback_enc; |
| this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported; |
| this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc; |
| this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc; |
| this->glGenSamplers = &glGenSamplers_enc; |
| this->glDeleteSamplers = &glDeleteSamplers_enc; |
| this->glBindSampler = &glBindSampler_enc; |
| this->glSamplerParameterf = &glSamplerParameterf_enc; |
| this->glSamplerParameteri = &glSamplerParameteri_enc; |
| this->glSamplerParameterfv = &glSamplerParameterfv_enc; |
| this->glSamplerParameteriv = &glSamplerParameteriv_enc; |
| this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc; |
| this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc; |
| this->glIsSampler = &glIsSampler_enc; |
| this->glGenQueries = &glGenQueries_enc; |
| this->glDeleteQueries = &glDeleteQueries_enc; |
| this->glBeginQuery = &glBeginQuery_enc; |
| this->glEndQuery = &glEndQuery_enc; |
| this->glGetQueryiv = &glGetQueryiv_enc; |
| this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc; |
| this->glIsQuery = &glIsQuery_enc; |
| this->glProgramParameteri = &glProgramParameteri_enc; |
| this->glProgramBinary = &glProgramBinary_enc; |
| this->glGetProgramBinary = &glGetProgramBinary_enc; |
| this->glGetFragDataLocation = &glGetFragDataLocation_enc; |
| this->glGetInteger64v = &glGetInteger64v_enc; |
| this->glGetIntegeri_v = &glGetIntegeri_v_enc; |
| this->glGetInteger64i_v = &glGetInteger64i_v_enc; |
| this->glTexImage3D = &glTexImage3D_enc; |
| this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc; |
| this->glTexStorage3D = &glTexStorage3D_enc; |
| this->glTexSubImage3D = &glTexSubImage3D_enc; |
| this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc; |
| this->glCompressedTexImage3D = &glCompressedTexImage3D_enc; |
| this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc; |
| this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc; |
| this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc; |
| this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc; |
| this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported; |
| this->glGetBooleani_v = &glGetBooleani_v_enc; |
| this->glMemoryBarrier = &glMemoryBarrier_enc; |
| this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc; |
| this->glGenProgramPipelines = &glGenProgramPipelines_enc; |
| this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc; |
| this->glBindProgramPipeline = &glBindProgramPipeline_enc; |
| this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc; |
| this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc; |
| this->glValidateProgramPipeline = &glValidateProgramPipeline_enc; |
| this->glIsProgramPipeline = &glIsProgramPipeline_enc; |
| this->glUseProgramStages = &glUseProgramStages_enc; |
| this->glActiveShaderProgram = &glActiveShaderProgram_enc; |
| this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported; |
| this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc; |
| this->glProgramUniform1f = &glProgramUniform1f_enc; |
| this->glProgramUniform2f = &glProgramUniform2f_enc; |
| this->glProgramUniform3f = &glProgramUniform3f_enc; |
| this->glProgramUniform4f = &glProgramUniform4f_enc; |
| this->glProgramUniform1i = &glProgramUniform1i_enc; |
| this->glProgramUniform2i = &glProgramUniform2i_enc; |
| this->glProgramUniform3i = &glProgramUniform3i_enc; |
| this->glProgramUniform4i = &glProgramUniform4i_enc; |
| this->glProgramUniform1ui = &glProgramUniform1ui_enc; |
| this->glProgramUniform2ui = &glProgramUniform2ui_enc; |
| this->glProgramUniform3ui = &glProgramUniform3ui_enc; |
| this->glProgramUniform4ui = &glProgramUniform4ui_enc; |
| this->glProgramUniform1fv = &glProgramUniform1fv_enc; |
| this->glProgramUniform2fv = &glProgramUniform2fv_enc; |
| this->glProgramUniform3fv = &glProgramUniform3fv_enc; |
| this->glProgramUniform4fv = &glProgramUniform4fv_enc; |
| this->glProgramUniform1iv = &glProgramUniform1iv_enc; |
| this->glProgramUniform2iv = &glProgramUniform2iv_enc; |
| this->glProgramUniform3iv = &glProgramUniform3iv_enc; |
| this->glProgramUniform4iv = &glProgramUniform4iv_enc; |
| this->glProgramUniform1uiv = &glProgramUniform1uiv_enc; |
| this->glProgramUniform2uiv = &glProgramUniform2uiv_enc; |
| this->glProgramUniform3uiv = &glProgramUniform3uiv_enc; |
| this->glProgramUniform4uiv = &glProgramUniform4uiv_enc; |
| this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc; |
| this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc; |
| this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc; |
| this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc; |
| this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc; |
| this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc; |
| this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc; |
| this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc; |
| this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc; |
| this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc; |
| this->glGetProgramResourceiv = &glGetProgramResourceiv_enc; |
| this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc; |
| this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc; |
| this->glGetProgramResourceName = &glGetProgramResourceName_enc; |
| this->glBindImageTexture = &glBindImageTexture_enc; |
| this->glDispatchCompute = &glDispatchCompute_enc; |
| this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc; |
| this->glBindVertexBuffer = &glBindVertexBuffer_enc; |
| this->glVertexAttribBinding = &glVertexAttribBinding_enc; |
| this->glVertexAttribFormat = &glVertexAttribFormat_enc; |
| this->glVertexAttribIFormat = &glVertexAttribIFormat_enc; |
| this->glVertexBindingDivisor = &glVertexBindingDivisor_enc; |
| this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported; |
| this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc; |
| this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc; |
| this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported; |
| this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc; |
| this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc; |
| this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc; |
| this->glSampleMaski = &glSampleMaski_enc; |
| this->glGetMultisamplefv = &glGetMultisamplefv_enc; |
| this->glFramebufferParameteri = &glFramebufferParameteri_enc; |
| this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc; |
| this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc; |
| this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc; |
| this->glMapBufferRangeDMA = &glMapBufferRangeDMA_enc; |
| this->glUnmapBufferDMA = &glUnmapBufferDMA_enc; |
| this->glMapBufferRangeDirect = &glMapBufferRangeDirect_enc; |
| this->glUnmapBufferDirect = &glUnmapBufferDirect_enc; |
| this->glFlushMappedBufferRangeDirect = &glFlushMappedBufferRangeDirect_enc; |
| this->glGetGraphicsResetStatusEXT = &glGetGraphicsResetStatusEXT_enc; |
| this->glReadnPixelsEXT = &glReadnPixelsEXT_enc; |
| this->glGetnUniformfvEXT = &glGetnUniformfvEXT_enc; |
| this->glGetnUniformivEXT = &glGetnUniformivEXT_enc; |
| this->glDrawArraysNullAEMU = &glDrawArraysNullAEMU_enc; |
| this->glDrawElementsNullAEMU = (glDrawElementsNullAEMU_client_proc_t) &enc_unsupported; |
| this->glDrawElementsOffsetNullAEMU = &glDrawElementsOffsetNullAEMU_enc; |
| this->glDrawElementsDataNullAEMU = &glDrawElementsDataNullAEMU_enc; |
| this->glUnmapBufferAsyncAEMU = &glUnmapBufferAsyncAEMU_enc; |
| this->glFlushMappedBufferRangeAEMU2 = &glFlushMappedBufferRangeAEMU2_enc; |
| this->glBufferDataSyncAEMU = &glBufferDataSyncAEMU_enc; |
| this->glTexBufferOES = &glTexBufferOES_enc; |
| this->glTexBufferRangeOES = &glTexBufferRangeOES_enc; |
| this->glTexBufferEXT = &glTexBufferEXT_enc; |
| this->glTexBufferRangeEXT = &glTexBufferRangeEXT_enc; |
| this->glEnableiEXT = &glEnableiEXT_enc; |
| this->glDisableiEXT = &glDisableiEXT_enc; |
| this->glBlendEquationiEXT = &glBlendEquationiEXT_enc; |
| this->glBlendEquationSeparateiEXT = &glBlendEquationSeparateiEXT_enc; |
| this->glBlendFunciEXT = &glBlendFunciEXT_enc; |
| this->glBlendFuncSeparateiEXT = &glBlendFuncSeparateiEXT_enc; |
| this->glColorMaskiEXT = &glColorMaskiEXT_enc; |
| this->glIsEnablediEXT = &glIsEnablediEXT_enc; |
| } |
| |