keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1 | // Generated Code - DO NOT EDIT !! |
| 2 | // generated by 'emugen' |
| 3 | |
| 4 | |
| 5 | #include <string.h> |
| 6 | #include "gl2_opcodes.h" |
| 7 | |
| 8 | #include "gl2_enc.h" |
| 9 | |
| 10 | |
Roman Kiryanov | 80f8365 | 2018-10-03 14:05:29 -0700 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 13 | #include <stdio.h> |
David 'Digit' Turner | 3372af9 | 2014-10-29 09:55:08 +0100 | [diff] [blame] | 14 | |
David 'Digit' Turner | 4f91c8e | 2014-10-31 11:39:38 +0100 | [diff] [blame] | 15 | namespace { |
David 'Digit' Turner | 3372af9 | 2014-10-29 09:55:08 +0100 | [diff] [blame] | 16 | |
David 'Digit' Turner | 4f91c8e | 2014-10-31 11:39:38 +0100 | [diff] [blame] | 17 | void enc_unsupported() |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 18 | { |
| 19 | ALOGE("Function is unsupported\n"); |
| 20 | } |
| 21 | |
| 22 | void glActiveTexture_enc(void *self , GLenum texture) |
| 23 | { |
| 24 | |
| 25 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 26 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 27 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 28 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 29 | |
| 30 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 31 | unsigned char *buf; |
| 32 | const size_t sizeWithoutChecksum = 8 + 4; |
| 33 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 34 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 35 | buf = stream->alloc(totalSize); |
| 36 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 37 | int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 38 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 39 | |
| 40 | memcpy(ptr, &texture, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 41 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 42 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 43 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 44 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void glAttachShader_enc(void *self , GLuint program, GLuint shader) |
| 48 | { |
| 49 | |
| 50 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 51 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 52 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 53 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 54 | |
| 55 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 56 | unsigned char *buf; |
| 57 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 58 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 59 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 60 | buf = stream->alloc(totalSize); |
| 61 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 62 | int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 63 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 64 | |
| 65 | memcpy(ptr, &program, 4); ptr += 4; |
| 66 | memcpy(ptr, &shader, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 67 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 68 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 69 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 70 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name) |
| 74 | { |
| 75 | |
| 76 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 77 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 78 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 79 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 80 | |
| 81 | const unsigned int __size_name = (strlen(name) + 1); |
| 82 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 83 | unsigned char *buf; |
| 84 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4; |
| 85 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 86 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 87 | buf = stream->alloc(totalSize); |
| 88 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 89 | int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 90 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 91 | |
| 92 | memcpy(ptr, &program, 4); ptr += 4; |
| 93 | memcpy(ptr, &index, 4); ptr += 4; |
| 94 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 95 | memcpy(ptr, name, __size_name);ptr += __size_name; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 96 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 97 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 98 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 99 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | void glBindBuffer_enc(void *self , GLenum target, GLuint buffer) |
| 103 | { |
| 104 | |
| 105 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 106 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 107 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 108 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 109 | |
| 110 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 111 | unsigned char *buf; |
| 112 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 113 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 114 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 115 | buf = stream->alloc(totalSize); |
| 116 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 117 | int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 118 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 119 | |
| 120 | memcpy(ptr, &target, 4); ptr += 4; |
| 121 | memcpy(ptr, &buffer, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 122 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 123 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 124 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 125 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer) |
| 129 | { |
| 130 | |
| 131 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 132 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 133 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 134 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 135 | |
| 136 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 137 | unsigned char *buf; |
| 138 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 139 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 140 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 141 | buf = stream->alloc(totalSize); |
| 142 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 143 | int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 144 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 145 | |
| 146 | memcpy(ptr, &target, 4); ptr += 4; |
| 147 | memcpy(ptr, &framebuffer, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 148 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 149 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 150 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 151 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer) |
| 155 | { |
| 156 | |
| 157 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 158 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 159 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 160 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 161 | |
| 162 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 163 | unsigned char *buf; |
| 164 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 165 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 166 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 167 | buf = stream->alloc(totalSize); |
| 168 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 169 | int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 170 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 171 | |
| 172 | memcpy(ptr, &target, 4); ptr += 4; |
| 173 | memcpy(ptr, &renderbuffer, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 174 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 175 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 176 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 177 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | void glBindTexture_enc(void *self , GLenum target, GLuint texture) |
| 181 | { |
| 182 | |
| 183 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 184 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 185 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 186 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 187 | |
| 188 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 189 | unsigned char *buf; |
| 190 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 191 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 192 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 193 | buf = stream->alloc(totalSize); |
| 194 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 195 | int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 196 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 197 | |
| 198 | memcpy(ptr, &target, 4); ptr += 4; |
| 199 | memcpy(ptr, &texture, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 200 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 201 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 202 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 203 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 207 | { |
| 208 | |
| 209 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 210 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 211 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 212 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 213 | |
| 214 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 215 | unsigned char *buf; |
| 216 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 217 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 218 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 219 | buf = stream->alloc(totalSize); |
| 220 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 221 | int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 222 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 223 | |
| 224 | memcpy(ptr, &red, 4); ptr += 4; |
| 225 | memcpy(ptr, &green, 4); ptr += 4; |
| 226 | memcpy(ptr, &blue, 4); ptr += 4; |
| 227 | memcpy(ptr, &alpha, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 228 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 229 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 230 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 231 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | void glBlendEquation_enc(void *self , GLenum mode) |
| 235 | { |
| 236 | |
| 237 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 238 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 239 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 240 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 241 | |
| 242 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 243 | unsigned char *buf; |
| 244 | const size_t sizeWithoutChecksum = 8 + 4; |
| 245 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 246 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 247 | buf = stream->alloc(totalSize); |
| 248 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 249 | int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 250 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 251 | |
| 252 | memcpy(ptr, &mode, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 253 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 254 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 255 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 256 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha) |
| 260 | { |
| 261 | |
| 262 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 263 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 264 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 265 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 266 | |
| 267 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 268 | unsigned char *buf; |
| 269 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 270 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 271 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 272 | buf = stream->alloc(totalSize); |
| 273 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 274 | int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 275 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 276 | |
| 277 | memcpy(ptr, &modeRGB, 4); ptr += 4; |
| 278 | memcpy(ptr, &modeAlpha, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 279 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 280 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 281 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 282 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor) |
| 286 | { |
| 287 | |
| 288 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 289 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 290 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 291 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 292 | |
| 293 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 294 | unsigned char *buf; |
| 295 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 296 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 297 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 298 | buf = stream->alloc(totalSize); |
| 299 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 300 | int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 301 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 302 | |
| 303 | memcpy(ptr, &sfactor, 4); ptr += 4; |
| 304 | memcpy(ptr, &dfactor, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 305 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 306 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 307 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 308 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| 312 | { |
| 313 | |
| 314 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 315 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 316 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 317 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 318 | |
| 319 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 320 | unsigned char *buf; |
| 321 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 322 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 323 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 324 | buf = stream->alloc(totalSize); |
| 325 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 326 | int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 327 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 328 | |
| 329 | memcpy(ptr, &srcRGB, 4); ptr += 4; |
| 330 | memcpy(ptr, &dstRGB, 4); ptr += 4; |
| 331 | memcpy(ptr, &srcAlpha, 4); ptr += 4; |
| 332 | memcpy(ptr, &dstAlpha, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 333 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 334 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 335 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 336 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) |
| 340 | { |
| 341 | |
| 342 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 343 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 344 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 345 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 346 | |
| 347 | const unsigned int __size_data = ((data != NULL) ? size : 0); |
| 348 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 349 | unsigned char *buf; |
| 350 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4; |
| 351 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 352 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 353 | buf = stream->alloc(8 + 4 + 4); |
| 354 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 355 | int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 356 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 357 | |
| 358 | memcpy(ptr, &target, 4); ptr += 4; |
| 359 | memcpy(ptr, &size, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 360 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 361 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 362 | stream->flush(); |
| 363 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 364 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 365 | if (data != NULL) { |
| 366 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 367 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 368 | } |
| 369 | buf = stream->alloc(4); |
| 370 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 371 | memcpy(ptr, &usage, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 372 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 373 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 374 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 375 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 376 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) |
| 380 | { |
| 381 | |
| 382 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 383 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 384 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 385 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 386 | |
Yahan Zhou | 268e85c | 2016-02-19 13:59:34 -0800 | [diff] [blame] | 387 | const unsigned int __size_data = ((data != NULL) ? size : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 388 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 389 | unsigned char *buf; |
| 390 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4; |
| 391 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 392 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 393 | buf = stream->alloc(8 + 4 + 4 + 4); |
| 394 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 395 | int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 396 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 397 | |
| 398 | memcpy(ptr, &target, 4); ptr += 4; |
| 399 | memcpy(ptr, &offset, 4); ptr += 4; |
| 400 | memcpy(ptr, &size, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 401 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 402 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 403 | stream->flush(); |
| 404 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 405 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 406 | if (data != NULL) { |
| 407 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 408 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 409 | } |
| 410 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 411 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 412 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 413 | } |
| 414 | |
| 415 | GLenum glCheckFramebufferStatus_enc(void *self , GLenum target) |
| 416 | { |
| 417 | |
| 418 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 419 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 420 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 421 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 422 | |
| 423 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 424 | unsigned char *buf; |
| 425 | const size_t sizeWithoutChecksum = 8 + 4; |
| 426 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 427 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 428 | buf = stream->alloc(totalSize); |
| 429 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 430 | int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 431 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 432 | |
| 433 | memcpy(ptr, &target, 4); ptr += 4; |
| 434 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 435 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 436 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 437 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 438 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 439 | GLenum retval; |
| 440 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 441 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 442 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 443 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 444 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 445 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 446 | stream->readback(checksumBufPtr, checksumSize); |
| 447 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 448 | ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n"); |
| 449 | abort(); |
| 450 | } |
| 451 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 452 | return retval; |
| 453 | } |
| 454 | |
| 455 | void glClear_enc(void *self , GLbitfield mask) |
| 456 | { |
| 457 | |
| 458 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 459 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 460 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 461 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 462 | |
| 463 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 464 | unsigned char *buf; |
| 465 | const size_t sizeWithoutChecksum = 8 + 4; |
| 466 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 467 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 468 | buf = stream->alloc(totalSize); |
| 469 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 470 | int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 471 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 472 | |
| 473 | memcpy(ptr, &mask, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 474 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 475 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 476 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 477 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 481 | { |
| 482 | |
| 483 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 484 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 485 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 486 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 487 | |
| 488 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 489 | unsigned char *buf; |
| 490 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 491 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 492 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 493 | buf = stream->alloc(totalSize); |
| 494 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 495 | int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 496 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 497 | |
| 498 | memcpy(ptr, &red, 4); ptr += 4; |
| 499 | memcpy(ptr, &green, 4); ptr += 4; |
| 500 | memcpy(ptr, &blue, 4); ptr += 4; |
| 501 | memcpy(ptr, &alpha, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 502 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 503 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 504 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 505 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | void glClearDepthf_enc(void *self , GLclampf depth) |
| 509 | { |
| 510 | |
| 511 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 512 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 513 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 514 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 515 | |
| 516 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 517 | unsigned char *buf; |
| 518 | const size_t sizeWithoutChecksum = 8 + 4; |
| 519 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 520 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 521 | buf = stream->alloc(totalSize); |
| 522 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 523 | int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 524 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 525 | |
| 526 | memcpy(ptr, &depth, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 527 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 528 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 529 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 530 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 531 | } |
| 532 | |
| 533 | void glClearStencil_enc(void *self , GLint s) |
| 534 | { |
| 535 | |
| 536 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 537 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 538 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 539 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 540 | |
| 541 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 542 | unsigned char *buf; |
| 543 | const size_t sizeWithoutChecksum = 8 + 4; |
| 544 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 545 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 546 | buf = stream->alloc(totalSize); |
| 547 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 548 | int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 549 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 550 | |
| 551 | memcpy(ptr, &s, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 552 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 553 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 554 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 555 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| 559 | { |
| 560 | |
| 561 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 562 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 563 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 564 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 565 | |
| 566 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 567 | unsigned char *buf; |
| 568 | const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1; |
| 569 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 570 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 571 | buf = stream->alloc(totalSize); |
| 572 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 573 | int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 574 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 575 | |
| 576 | memcpy(ptr, &red, 1); ptr += 1; |
| 577 | memcpy(ptr, &green, 1); ptr += 1; |
| 578 | memcpy(ptr, &blue, 1); ptr += 1; |
| 579 | memcpy(ptr, &alpha, 1); ptr += 1; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 580 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 581 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 582 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 583 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | void glCompileShader_enc(void *self , GLuint shader) |
| 587 | { |
| 588 | |
| 589 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 590 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 591 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 592 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 593 | |
| 594 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 595 | unsigned char *buf; |
| 596 | const size_t sizeWithoutChecksum = 8 + 4; |
| 597 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 598 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 599 | buf = stream->alloc(totalSize); |
| 600 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 601 | int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 602 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 603 | |
| 604 | memcpy(ptr, &shader, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 605 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 606 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 607 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 608 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) |
| 612 | { |
| 613 | |
| 614 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 615 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 616 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 617 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 618 | |
| 619 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
| 620 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 621 | unsigned char *buf; |
| 622 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 623 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 624 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 625 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 626 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 627 | int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 628 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 629 | |
| 630 | memcpy(ptr, &target, 4); ptr += 4; |
| 631 | memcpy(ptr, &level, 4); ptr += 4; |
| 632 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 633 | memcpy(ptr, &width, 4); ptr += 4; |
| 634 | memcpy(ptr, &height, 4); ptr += 4; |
| 635 | memcpy(ptr, &border, 4); ptr += 4; |
| 636 | memcpy(ptr, &imageSize, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 637 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 638 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 639 | stream->flush(); |
| 640 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 641 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 642 | if (data != NULL) { |
| 643 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 644 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 645 | } |
| 646 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 647 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 648 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 649 | } |
| 650 | |
| 651 | void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) |
| 652 | { |
| 653 | |
| 654 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 655 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 656 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 657 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 658 | |
Yahan Zhou | 268e85c | 2016-02-19 13:59:34 -0800 | [diff] [blame] | 659 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 660 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 661 | unsigned char *buf; |
| 662 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 663 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 664 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 665 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 666 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 667 | int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 668 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 669 | |
| 670 | memcpy(ptr, &target, 4); ptr += 4; |
| 671 | memcpy(ptr, &level, 4); ptr += 4; |
| 672 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 673 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 674 | memcpy(ptr, &width, 4); ptr += 4; |
| 675 | memcpy(ptr, &height, 4); ptr += 4; |
| 676 | memcpy(ptr, &format, 4); ptr += 4; |
| 677 | memcpy(ptr, &imageSize, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 678 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 679 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 680 | stream->flush(); |
| 681 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 682 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 683 | if (data != NULL) { |
| 684 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 685 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 686 | } |
| 687 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 688 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 689 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 690 | } |
| 691 | |
| 692 | void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| 693 | { |
| 694 | |
| 695 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 696 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 697 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 698 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 699 | |
| 700 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 701 | unsigned char *buf; |
| 702 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 703 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 704 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 705 | buf = stream->alloc(totalSize); |
| 706 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 707 | int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 708 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 709 | |
| 710 | memcpy(ptr, &target, 4); ptr += 4; |
| 711 | memcpy(ptr, &level, 4); ptr += 4; |
| 712 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 713 | memcpy(ptr, &x, 4); ptr += 4; |
| 714 | memcpy(ptr, &y, 4); ptr += 4; |
| 715 | memcpy(ptr, &width, 4); ptr += 4; |
| 716 | memcpy(ptr, &height, 4); ptr += 4; |
| 717 | memcpy(ptr, &border, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 718 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 719 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 720 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 721 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 725 | { |
| 726 | |
| 727 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 728 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 729 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 730 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 731 | |
| 732 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 733 | unsigned char *buf; |
| 734 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 735 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 736 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 737 | buf = stream->alloc(totalSize); |
| 738 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 739 | int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 740 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 741 | |
| 742 | memcpy(ptr, &target, 4); ptr += 4; |
| 743 | memcpy(ptr, &level, 4); ptr += 4; |
| 744 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 745 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 746 | memcpy(ptr, &x, 4); ptr += 4; |
| 747 | memcpy(ptr, &y, 4); ptr += 4; |
| 748 | memcpy(ptr, &width, 4); ptr += 4; |
| 749 | memcpy(ptr, &height, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 750 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 751 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 752 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 753 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | GLuint glCreateProgram_enc(void *self ) |
| 757 | { |
| 758 | |
| 759 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 760 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 761 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 762 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 763 | |
| 764 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 765 | unsigned char *buf; |
| 766 | const size_t sizeWithoutChecksum = 8; |
| 767 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 768 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 769 | buf = stream->alloc(totalSize); |
| 770 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 771 | int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 772 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 773 | |
| 774 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 775 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 776 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 777 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 778 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 779 | GLuint retval; |
| 780 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 781 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 782 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 783 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 784 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 785 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 786 | stream->readback(checksumBufPtr, checksumSize); |
| 787 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 788 | ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n"); |
| 789 | abort(); |
| 790 | } |
| 791 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 792 | return retval; |
| 793 | } |
| 794 | |
| 795 | GLuint glCreateShader_enc(void *self , GLenum type) |
| 796 | { |
| 797 | |
| 798 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 799 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 800 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 801 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 802 | |
| 803 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 804 | unsigned char *buf; |
| 805 | const size_t sizeWithoutChecksum = 8 + 4; |
| 806 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 807 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 808 | buf = stream->alloc(totalSize); |
| 809 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 810 | int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 811 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 812 | |
| 813 | memcpy(ptr, &type, 4); ptr += 4; |
| 814 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 815 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 816 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 817 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 818 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 819 | GLuint retval; |
| 820 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 821 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 822 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 823 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 824 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 825 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 826 | stream->readback(checksumBufPtr, checksumSize); |
| 827 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 828 | ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n"); |
| 829 | abort(); |
| 830 | } |
| 831 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 832 | return retval; |
| 833 | } |
| 834 | |
| 835 | void glCullFace_enc(void *self , GLenum mode) |
| 836 | { |
| 837 | |
| 838 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 839 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 840 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 841 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 842 | |
| 843 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 844 | unsigned char *buf; |
| 845 | const size_t sizeWithoutChecksum = 8 + 4; |
| 846 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 847 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 848 | buf = stream->alloc(totalSize); |
| 849 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 850 | int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 851 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 852 | |
| 853 | memcpy(ptr, &mode, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 854 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 855 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 856 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 857 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers) |
| 861 | { |
| 862 | |
| 863 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 864 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 865 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 866 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 867 | |
| 868 | const unsigned int __size_buffers = (n * sizeof(GLuint)); |
| 869 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 870 | unsigned char *buf; |
| 871 | const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4; |
| 872 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 873 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 874 | buf = stream->alloc(totalSize); |
| 875 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 876 | int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 877 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 878 | |
| 879 | memcpy(ptr, &n, 4); ptr += 4; |
| 880 | *(unsigned int *)(ptr) = __size_buffers; ptr += 4; |
| 881 | memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 882 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 883 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 884 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 885 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 886 | } |
| 887 | |
| 888 | void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers) |
| 889 | { |
| 890 | |
| 891 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 892 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 893 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 894 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 895 | |
| 896 | const unsigned int __size_framebuffers = (n * sizeof(GLuint)); |
| 897 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 898 | unsigned char *buf; |
| 899 | const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4; |
| 900 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 901 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 902 | buf = stream->alloc(totalSize); |
| 903 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 904 | int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 905 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 906 | |
| 907 | memcpy(ptr, &n, 4); ptr += 4; |
| 908 | *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4; |
| 909 | memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 910 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 911 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 912 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 913 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 914 | } |
| 915 | |
| 916 | void glDeleteProgram_enc(void *self , GLuint program) |
| 917 | { |
| 918 | |
| 919 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 920 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 921 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 922 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 923 | |
| 924 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 925 | unsigned char *buf; |
| 926 | const size_t sizeWithoutChecksum = 8 + 4; |
| 927 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 928 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 929 | buf = stream->alloc(totalSize); |
| 930 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 931 | int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 932 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 933 | |
| 934 | memcpy(ptr, &program, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 935 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 936 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 937 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 938 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers) |
| 942 | { |
| 943 | |
| 944 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 945 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 946 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 947 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 948 | |
| 949 | const unsigned int __size_renderbuffers = (n * sizeof(GLuint)); |
| 950 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 951 | unsigned char *buf; |
| 952 | const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4; |
| 953 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 954 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 955 | buf = stream->alloc(totalSize); |
| 956 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 957 | int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 958 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 959 | |
| 960 | memcpy(ptr, &n, 4); ptr += 4; |
| 961 | *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4; |
| 962 | memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 963 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 964 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 965 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 966 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 967 | } |
| 968 | |
| 969 | void glDeleteShader_enc(void *self , GLuint shader) |
| 970 | { |
| 971 | |
| 972 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 973 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 974 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 975 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 976 | |
| 977 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 978 | unsigned char *buf; |
| 979 | const size_t sizeWithoutChecksum = 8 + 4; |
| 980 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 981 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 982 | buf = stream->alloc(totalSize); |
| 983 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 984 | int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 985 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 986 | |
| 987 | memcpy(ptr, &shader, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 988 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 989 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 990 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 991 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures) |
| 995 | { |
| 996 | |
| 997 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 998 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 999 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1000 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1001 | |
| 1002 | const unsigned int __size_textures = (n * sizeof(GLuint)); |
| 1003 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1004 | unsigned char *buf; |
| 1005 | const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4; |
| 1006 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1007 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1008 | buf = stream->alloc(totalSize); |
| 1009 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1010 | int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1011 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1012 | |
| 1013 | memcpy(ptr, &n, 4); ptr += 4; |
| 1014 | *(unsigned int *)(ptr) = __size_textures; ptr += 4; |
| 1015 | memcpy(ptr, textures, __size_textures);ptr += __size_textures; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1016 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1017 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1018 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1019 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1020 | } |
| 1021 | |
| 1022 | void glDepthFunc_enc(void *self , GLenum func) |
| 1023 | { |
| 1024 | |
| 1025 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1026 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1027 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1028 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1029 | |
| 1030 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1031 | unsigned char *buf; |
| 1032 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1033 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1034 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1035 | buf = stream->alloc(totalSize); |
| 1036 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1037 | int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1038 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1039 | |
| 1040 | memcpy(ptr, &func, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1041 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1042 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1043 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1044 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1045 | } |
| 1046 | |
| 1047 | void glDepthMask_enc(void *self , GLboolean flag) |
| 1048 | { |
| 1049 | |
| 1050 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1051 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1052 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1053 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1054 | |
| 1055 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1056 | unsigned char *buf; |
| 1057 | const size_t sizeWithoutChecksum = 8 + 1; |
| 1058 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1059 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1060 | buf = stream->alloc(totalSize); |
| 1061 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1062 | int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1063 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1064 | |
| 1065 | memcpy(ptr, &flag, 1); ptr += 1; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1066 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1067 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1068 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1069 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1070 | } |
| 1071 | |
| 1072 | void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar) |
| 1073 | { |
| 1074 | |
| 1075 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1076 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1077 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1078 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1079 | |
| 1080 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1081 | unsigned char *buf; |
| 1082 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 1083 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1084 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1085 | buf = stream->alloc(totalSize); |
| 1086 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1087 | int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1088 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1089 | |
| 1090 | memcpy(ptr, &zNear, 4); ptr += 4; |
| 1091 | memcpy(ptr, &zFar, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1092 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1093 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1094 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1095 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1096 | } |
| 1097 | |
| 1098 | void glDetachShader_enc(void *self , GLuint program, GLuint shader) |
| 1099 | { |
| 1100 | |
| 1101 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1102 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1103 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1104 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1105 | |
| 1106 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1107 | unsigned char *buf; |
| 1108 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 1109 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1110 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1111 | buf = stream->alloc(totalSize); |
| 1112 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1113 | int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1114 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1115 | |
| 1116 | memcpy(ptr, &program, 4); ptr += 4; |
| 1117 | memcpy(ptr, &shader, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1118 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1119 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1120 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1121 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1122 | } |
| 1123 | |
| 1124 | void glDisable_enc(void *self , GLenum cap) |
| 1125 | { |
| 1126 | |
| 1127 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1128 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1129 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1130 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1131 | |
| 1132 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1133 | unsigned char *buf; |
| 1134 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1135 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1136 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1137 | buf = stream->alloc(totalSize); |
| 1138 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1139 | int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1140 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1141 | |
| 1142 | memcpy(ptr, &cap, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1143 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1144 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1145 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1146 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1147 | } |
| 1148 | |
| 1149 | void glDisableVertexAttribArray_enc(void *self , GLuint index) |
| 1150 | { |
| 1151 | |
| 1152 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1153 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1154 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1155 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1156 | |
| 1157 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1158 | unsigned char *buf; |
| 1159 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1160 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1161 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1162 | buf = stream->alloc(totalSize); |
| 1163 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1164 | int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1165 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1166 | |
| 1167 | memcpy(ptr, &index, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1168 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1169 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1170 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1171 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count) |
| 1175 | { |
| 1176 | |
| 1177 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1178 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1179 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1180 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1181 | |
| 1182 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1183 | unsigned char *buf; |
| 1184 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 1185 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1186 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1187 | buf = stream->alloc(totalSize); |
| 1188 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1189 | int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1190 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1191 | |
| 1192 | memcpy(ptr, &mode, 4); ptr += 4; |
| 1193 | memcpy(ptr, &first, 4); ptr += 4; |
| 1194 | memcpy(ptr, &count, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1195 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1196 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1197 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1198 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1199 | } |
| 1200 | |
| 1201 | void glEnable_enc(void *self , GLenum cap) |
| 1202 | { |
| 1203 | |
| 1204 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1205 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1206 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1207 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1208 | |
| 1209 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1210 | unsigned char *buf; |
| 1211 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1212 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1213 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1214 | buf = stream->alloc(totalSize); |
| 1215 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1216 | int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1217 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1218 | |
| 1219 | memcpy(ptr, &cap, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1220 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1221 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1222 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1223 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1224 | } |
| 1225 | |
| 1226 | void glEnableVertexAttribArray_enc(void *self , GLuint index) |
| 1227 | { |
| 1228 | |
| 1229 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1230 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1231 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1232 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1233 | |
| 1234 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1235 | unsigned char *buf; |
| 1236 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1237 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1238 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1239 | buf = stream->alloc(totalSize); |
| 1240 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1241 | int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1242 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1243 | |
| 1244 | memcpy(ptr, &index, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1245 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1246 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1247 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1248 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1249 | } |
| 1250 | |
| 1251 | void glFinish_enc(void *self ) |
| 1252 | { |
| 1253 | |
| 1254 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1255 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1256 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1257 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1258 | |
| 1259 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1260 | unsigned char *buf; |
| 1261 | const size_t sizeWithoutChecksum = 8; |
| 1262 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1263 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1264 | buf = stream->alloc(totalSize); |
| 1265 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1266 | int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1267 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1268 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1269 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1270 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1271 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1272 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1273 | } |
| 1274 | |
| 1275 | void glFlush_enc(void *self ) |
| 1276 | { |
| 1277 | |
| 1278 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1279 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1280 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1281 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1282 | |
| 1283 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1284 | unsigned char *buf; |
| 1285 | const size_t sizeWithoutChecksum = 8; |
| 1286 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1287 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1288 | buf = stream->alloc(totalSize); |
| 1289 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1290 | int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1291 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1292 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1293 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1294 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1295 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1296 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1297 | } |
| 1298 | |
| 1299 | void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) |
| 1300 | { |
| 1301 | |
| 1302 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1303 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1304 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1305 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1306 | |
| 1307 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1308 | unsigned char *buf; |
| 1309 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 1310 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1311 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1312 | buf = stream->alloc(totalSize); |
| 1313 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1314 | int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1315 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1316 | |
| 1317 | memcpy(ptr, &target, 4); ptr += 4; |
| 1318 | memcpy(ptr, &attachment, 4); ptr += 4; |
| 1319 | memcpy(ptr, &renderbuffertarget, 4); ptr += 4; |
| 1320 | memcpy(ptr, &renderbuffer, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1321 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1322 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1323 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1324 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1325 | } |
| 1326 | |
| 1327 | void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
| 1328 | { |
| 1329 | |
| 1330 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1331 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1332 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1333 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1334 | |
| 1335 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1336 | unsigned char *buf; |
| 1337 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 1338 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1339 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1340 | buf = stream->alloc(totalSize); |
| 1341 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1342 | int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1343 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1344 | |
| 1345 | memcpy(ptr, &target, 4); ptr += 4; |
| 1346 | memcpy(ptr, &attachment, 4); ptr += 4; |
| 1347 | memcpy(ptr, &textarget, 4); ptr += 4; |
| 1348 | memcpy(ptr, &texture, 4); ptr += 4; |
| 1349 | memcpy(ptr, &level, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1350 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1351 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1352 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1353 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1354 | } |
| 1355 | |
| 1356 | void glFrontFace_enc(void *self , GLenum mode) |
| 1357 | { |
| 1358 | |
| 1359 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1360 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1361 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1362 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1363 | |
| 1364 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1365 | unsigned char *buf; |
| 1366 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1367 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1368 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1369 | buf = stream->alloc(totalSize); |
| 1370 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1371 | int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1372 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1373 | |
| 1374 | memcpy(ptr, &mode, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1375 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1376 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1377 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1378 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1379 | } |
| 1380 | |
| 1381 | void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers) |
| 1382 | { |
| 1383 | |
| 1384 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1385 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1386 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1387 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1388 | |
| 1389 | const unsigned int __size_buffers = (n * sizeof(GLuint)); |
| 1390 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1391 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1392 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1393 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1394 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1395 | buf = stream->alloc(totalSize); |
| 1396 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1397 | int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1398 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1399 | |
| 1400 | memcpy(ptr, &n, 4); ptr += 4; |
| 1401 | *(unsigned int *)(ptr) = __size_buffers; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1402 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1403 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1404 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1405 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1406 | stream->readback(buffers, __size_buffers); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1407 | if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers); |
| 1408 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1409 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1410 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1411 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1412 | stream->readback(checksumBufPtr, checksumSize); |
| 1413 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1414 | ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n"); |
| 1415 | abort(); |
| 1416 | } |
| 1417 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1418 | } |
| 1419 | |
| 1420 | void glGenerateMipmap_enc(void *self , GLenum target) |
| 1421 | { |
| 1422 | |
| 1423 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1424 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1425 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1426 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1427 | |
| 1428 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1429 | unsigned char *buf; |
| 1430 | const size_t sizeWithoutChecksum = 8 + 4; |
| 1431 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1432 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1433 | buf = stream->alloc(totalSize); |
| 1434 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1435 | int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1436 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1437 | |
| 1438 | memcpy(ptr, &target, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1439 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1440 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1441 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1442 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1443 | } |
| 1444 | |
| 1445 | void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers) |
| 1446 | { |
| 1447 | |
| 1448 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1449 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1450 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1451 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1452 | |
| 1453 | const unsigned int __size_framebuffers = (n * sizeof(GLuint)); |
| 1454 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1455 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1456 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1457 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1458 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1459 | buf = stream->alloc(totalSize); |
| 1460 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1461 | int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1462 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1463 | |
| 1464 | memcpy(ptr, &n, 4); ptr += 4; |
| 1465 | *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1466 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1467 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1468 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1469 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1470 | stream->readback(framebuffers, __size_framebuffers); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1471 | if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers); |
| 1472 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1473 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1474 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1475 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1476 | stream->readback(checksumBufPtr, checksumSize); |
| 1477 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1478 | ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n"); |
| 1479 | abort(); |
| 1480 | } |
| 1481 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1482 | } |
| 1483 | |
| 1484 | void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers) |
| 1485 | { |
| 1486 | |
| 1487 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1488 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1489 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1490 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1491 | |
| 1492 | const unsigned int __size_renderbuffers = (n * sizeof(GLuint)); |
| 1493 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1494 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1495 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1496 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1497 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1498 | buf = stream->alloc(totalSize); |
| 1499 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1500 | int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1501 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1502 | |
| 1503 | memcpy(ptr, &n, 4); ptr += 4; |
| 1504 | *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1505 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1506 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1507 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1508 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1509 | stream->readback(renderbuffers, __size_renderbuffers); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1510 | if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers); |
| 1511 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1512 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1513 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1514 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1515 | stream->readback(checksumBufPtr, checksumSize); |
| 1516 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1517 | ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n"); |
| 1518 | abort(); |
| 1519 | } |
| 1520 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1521 | } |
| 1522 | |
| 1523 | void glGenTextures_enc(void *self , GLsizei n, GLuint* textures) |
| 1524 | { |
| 1525 | |
| 1526 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1527 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1528 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1529 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1530 | |
| 1531 | const unsigned int __size_textures = (n * sizeof(GLuint)); |
| 1532 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1533 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1534 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1535 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1536 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1537 | buf = stream->alloc(totalSize); |
| 1538 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1539 | int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1540 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1541 | |
| 1542 | memcpy(ptr, &n, 4); ptr += 4; |
| 1543 | *(unsigned int *)(ptr) = __size_textures; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1544 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1545 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1546 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1547 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1548 | stream->readback(textures, __size_textures); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1549 | if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures); |
| 1550 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1551 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1552 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1553 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1554 | stream->readback(checksumBufPtr, checksumSize); |
| 1555 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1556 | ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n"); |
| 1557 | abort(); |
| 1558 | } |
| 1559 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1560 | } |
| 1561 | |
| 1562 | void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) |
| 1563 | { |
| 1564 | |
| 1565 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1566 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1567 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1568 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1569 | |
| 1570 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
bohu | a9ce3ca | 2015-01-14 09:46:36 -0800 | [diff] [blame] | 1571 | const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0); |
| 1572 | const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1573 | const unsigned int __size_name = ((name != NULL) ? bufsize : 0); |
| 1574 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1575 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1576 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1577 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1578 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1579 | buf = stream->alloc(totalSize); |
| 1580 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1581 | int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1582 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1583 | |
| 1584 | memcpy(ptr, &program, 4); ptr += 4; |
| 1585 | memcpy(ptr, &index, 4); ptr += 4; |
| 1586 | memcpy(ptr, &bufsize, 4); ptr += 4; |
| 1587 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 1588 | *(unsigned int *)(ptr) = __size_size; ptr += 4; |
| 1589 | *(unsigned int *)(ptr) = __size_type; ptr += 4; |
| 1590 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1591 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1592 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1593 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1594 | |
| 1595 | if (length != NULL) { |
| 1596 | stream->readback(length, __size_length); |
| 1597 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 1598 | } |
| 1599 | if (size != NULL) { |
| 1600 | stream->readback(size, __size_size); |
| 1601 | if (useChecksum) checksumCalculator->addBuffer(size, __size_size); |
| 1602 | } |
| 1603 | if (type != NULL) { |
| 1604 | stream->readback(type, __size_type); |
| 1605 | if (useChecksum) checksumCalculator->addBuffer(type, __size_type); |
| 1606 | } |
| 1607 | if (name != NULL) { |
| 1608 | stream->readback(name, __size_name); |
| 1609 | if (useChecksum) checksumCalculator->addBuffer(name, __size_name); |
| 1610 | } |
| 1611 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1612 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1613 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1614 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1615 | stream->readback(checksumBufPtr, checksumSize); |
| 1616 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1617 | ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n"); |
| 1618 | abort(); |
| 1619 | } |
| 1620 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1621 | } |
| 1622 | |
| 1623 | void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) |
| 1624 | { |
| 1625 | |
| 1626 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1627 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1628 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1629 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1630 | |
| 1631 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
bohu | a9ce3ca | 2015-01-14 09:46:36 -0800 | [diff] [blame] | 1632 | const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0); |
| 1633 | const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1634 | const unsigned int __size_name = ((name != NULL) ? bufsize : 0); |
| 1635 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1636 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1637 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1638 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1639 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1640 | buf = stream->alloc(totalSize); |
| 1641 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1642 | int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1643 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1644 | |
| 1645 | memcpy(ptr, &program, 4); ptr += 4; |
| 1646 | memcpy(ptr, &index, 4); ptr += 4; |
| 1647 | memcpy(ptr, &bufsize, 4); ptr += 4; |
| 1648 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 1649 | *(unsigned int *)(ptr) = __size_size; ptr += 4; |
| 1650 | *(unsigned int *)(ptr) = __size_type; ptr += 4; |
| 1651 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1652 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1653 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1654 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1655 | |
| 1656 | if (length != NULL) { |
| 1657 | stream->readback(length, __size_length); |
| 1658 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 1659 | } |
| 1660 | if (size != NULL) { |
| 1661 | stream->readback(size, __size_size); |
| 1662 | if (useChecksum) checksumCalculator->addBuffer(size, __size_size); |
| 1663 | } |
| 1664 | if (type != NULL) { |
| 1665 | stream->readback(type, __size_type); |
| 1666 | if (useChecksum) checksumCalculator->addBuffer(type, __size_type); |
| 1667 | } |
| 1668 | if (name != NULL) { |
| 1669 | stream->readback(name, __size_name); |
| 1670 | if (useChecksum) checksumCalculator->addBuffer(name, __size_name); |
| 1671 | } |
| 1672 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1673 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1674 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1675 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1676 | stream->readback(checksumBufPtr, checksumSize); |
| 1677 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1678 | ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n"); |
| 1679 | abort(); |
| 1680 | } |
| 1681 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1682 | } |
| 1683 | |
| 1684 | void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) |
| 1685 | { |
| 1686 | |
| 1687 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1688 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1689 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1690 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1691 | |
| 1692 | const unsigned int __size_count = ((count != NULL) ? (sizeof(GLsizei)) : 0); |
| 1693 | const unsigned int __size_shaders = (maxcount*sizeof(GLuint)); |
| 1694 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1695 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1696 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1697 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1698 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1699 | buf = stream->alloc(totalSize); |
| 1700 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1701 | int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1702 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1703 | |
| 1704 | memcpy(ptr, &program, 4); ptr += 4; |
| 1705 | memcpy(ptr, &maxcount, 4); ptr += 4; |
| 1706 | *(unsigned int *)(ptr) = __size_count; ptr += 4; |
| 1707 | *(unsigned int *)(ptr) = __size_shaders; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1708 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1709 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1710 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1711 | |
| 1712 | if (count != NULL) { |
| 1713 | stream->readback(count, __size_count); |
| 1714 | if (useChecksum) checksumCalculator->addBuffer(count, __size_count); |
| 1715 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1716 | stream->readback(shaders, __size_shaders); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1717 | if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders); |
| 1718 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1719 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1720 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1721 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1722 | stream->readback(checksumBufPtr, checksumSize); |
| 1723 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1724 | ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n"); |
| 1725 | abort(); |
| 1726 | } |
| 1727 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1728 | } |
| 1729 | |
| 1730 | int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name) |
| 1731 | { |
| 1732 | |
| 1733 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1734 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1735 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1736 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1737 | |
| 1738 | const unsigned int __size_name = (strlen(name) + 1); |
| 1739 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1740 | unsigned char *buf; |
| 1741 | const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4; |
| 1742 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1743 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1744 | buf = stream->alloc(totalSize); |
| 1745 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1746 | int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1747 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1748 | |
| 1749 | memcpy(ptr, &program, 4); ptr += 4; |
| 1750 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 1751 | memcpy(ptr, name, __size_name);ptr += __size_name; |
| 1752 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1753 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1754 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1755 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1756 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1757 | int retval; |
| 1758 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1759 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 1760 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1761 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1762 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1763 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1764 | stream->readback(checksumBufPtr, checksumSize); |
| 1765 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1766 | ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n"); |
| 1767 | abort(); |
| 1768 | } |
| 1769 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1770 | return retval; |
| 1771 | } |
| 1772 | |
| 1773 | void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params) |
| 1774 | { |
| 1775 | |
| 1776 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1777 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1778 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1779 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1780 | |
| 1781 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean)); |
| 1782 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1783 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1784 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1785 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1786 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1787 | buf = stream->alloc(totalSize); |
| 1788 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1789 | int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1790 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1791 | |
| 1792 | memcpy(ptr, &pname, 4); ptr += 4; |
| 1793 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1794 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1795 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1796 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1797 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1798 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1799 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 1800 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1801 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1802 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1803 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1804 | stream->readback(checksumBufPtr, checksumSize); |
| 1805 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1806 | ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n"); |
| 1807 | abort(); |
| 1808 | } |
| 1809 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1810 | } |
| 1811 | |
| 1812 | void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| 1813 | { |
| 1814 | |
| 1815 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1816 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1817 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1818 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1819 | |
| 1820 | const unsigned int __size_params = (sizeof(GLint)); |
| 1821 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1822 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1823 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1824 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1825 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1826 | buf = stream->alloc(totalSize); |
| 1827 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1828 | int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1829 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1830 | |
| 1831 | memcpy(ptr, &target, 4); ptr += 4; |
| 1832 | memcpy(ptr, &pname, 4); ptr += 4; |
| 1833 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1834 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1835 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1836 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1837 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1838 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1839 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 1840 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1841 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1842 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1843 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1844 | stream->readback(checksumBufPtr, checksumSize); |
| 1845 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1846 | ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 1847 | abort(); |
| 1848 | } |
| 1849 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1850 | } |
| 1851 | |
| 1852 | GLenum glGetError_enc(void *self ) |
| 1853 | { |
| 1854 | |
| 1855 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1856 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1857 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1858 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1859 | |
| 1860 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1861 | unsigned char *buf; |
| 1862 | const size_t sizeWithoutChecksum = 8; |
| 1863 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1864 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1865 | buf = stream->alloc(totalSize); |
| 1866 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1867 | int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1868 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1869 | |
| 1870 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1871 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1872 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1873 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1874 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1875 | GLenum retval; |
| 1876 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1877 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 1878 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1879 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1880 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1881 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1882 | stream->readback(checksumBufPtr, checksumSize); |
| 1883 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1884 | ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n"); |
| 1885 | abort(); |
| 1886 | } |
| 1887 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1888 | return retval; |
| 1889 | } |
| 1890 | |
| 1891 | void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params) |
| 1892 | { |
| 1893 | |
| 1894 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1895 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1896 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1897 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1898 | |
| 1899 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 1900 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1901 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1902 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1903 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1904 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1905 | buf = stream->alloc(totalSize); |
| 1906 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1907 | int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1908 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1909 | |
| 1910 | memcpy(ptr, &pname, 4); ptr += 4; |
| 1911 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1912 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1913 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1914 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1915 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1916 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1917 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 1918 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1919 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1920 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1921 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1922 | stream->readback(checksumBufPtr, checksumSize); |
| 1923 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1924 | ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n"); |
| 1925 | abort(); |
| 1926 | } |
| 1927 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1928 | } |
| 1929 | |
| 1930 | void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params) |
| 1931 | { |
| 1932 | |
| 1933 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1934 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1935 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1936 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1937 | |
| 1938 | const unsigned int __size_params = (sizeof(GLint)); |
| 1939 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1940 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1941 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1942 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1943 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1944 | buf = stream->alloc(totalSize); |
| 1945 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1946 | int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1947 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1948 | |
| 1949 | memcpy(ptr, &target, 4); ptr += 4; |
| 1950 | memcpy(ptr, &attachment, 4); ptr += 4; |
| 1951 | memcpy(ptr, &pname, 4); ptr += 4; |
| 1952 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1953 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1954 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1955 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1956 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1957 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1958 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 1959 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1960 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1961 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1962 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 1963 | stream->readback(checksumBufPtr, checksumSize); |
| 1964 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1965 | ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 1966 | abort(); |
| 1967 | } |
| 1968 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1969 | } |
| 1970 | |
| 1971 | void glGetIntegerv_enc(void *self , GLenum pname, GLint* params) |
| 1972 | { |
| 1973 | |
| 1974 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 1975 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1976 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1977 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1978 | |
| 1979 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 1980 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1981 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 1982 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1983 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 1984 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 1985 | buf = stream->alloc(totalSize); |
| 1986 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1987 | int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1988 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1989 | |
| 1990 | memcpy(ptr, &pname, 4); ptr += 4; |
| 1991 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 1992 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1993 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 1994 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 1995 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 1996 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 1997 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 1998 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 1999 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2000 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2001 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2002 | stream->readback(checksumBufPtr, checksumSize); |
| 2003 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2004 | ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n"); |
| 2005 | abort(); |
| 2006 | } |
| 2007 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2008 | } |
| 2009 | |
| 2010 | void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params) |
| 2011 | { |
| 2012 | |
| 2013 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2014 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2015 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2016 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2017 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 2018 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2019 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2020 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2021 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2022 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2023 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2024 | buf = stream->alloc(totalSize); |
| 2025 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2026 | int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2027 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2028 | |
| 2029 | memcpy(ptr, &program, 4); ptr += 4; |
| 2030 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2031 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2032 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2033 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2034 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2035 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2036 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2037 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2038 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2039 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2040 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2041 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2042 | stream->readback(checksumBufPtr, checksumSize); |
| 2043 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2044 | ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n"); |
| 2045 | abort(); |
| 2046 | } |
| 2047 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2048 | } |
| 2049 | |
| 2050 | void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
| 2051 | { |
| 2052 | |
| 2053 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2054 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2055 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2056 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2057 | |
David 'Digit' Turner | 4f91c8e | 2014-10-31 11:39:38 +0100 | [diff] [blame] | 2058 | const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2059 | const unsigned int __size_infolog = bufsize; |
| 2060 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2061 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2062 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2063 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2064 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2065 | buf = stream->alloc(totalSize); |
| 2066 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2067 | int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2068 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2069 | |
| 2070 | memcpy(ptr, &program, 4); ptr += 4; |
| 2071 | memcpy(ptr, &bufsize, 4); ptr += 4; |
| 2072 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 2073 | *(unsigned int *)(ptr) = __size_infolog; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2074 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2075 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2076 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2077 | |
| 2078 | if (length != NULL) { |
| 2079 | stream->readback(length, __size_length); |
| 2080 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 2081 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2082 | stream->readback(infolog, __size_infolog); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2083 | if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog); |
| 2084 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2085 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2086 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2087 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2088 | stream->readback(checksumBufPtr, checksumSize); |
| 2089 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2090 | ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n"); |
| 2091 | abort(); |
| 2092 | } |
| 2093 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2094 | } |
| 2095 | |
| 2096 | void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| 2097 | { |
| 2098 | |
| 2099 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2100 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2101 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2102 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2103 | |
| 2104 | const unsigned int __size_params = sizeof(GLint); |
| 2105 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2106 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2107 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2108 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2109 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2110 | buf = stream->alloc(totalSize); |
| 2111 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2112 | int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2113 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2114 | |
| 2115 | memcpy(ptr, &target, 4); ptr += 4; |
| 2116 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2117 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2118 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2119 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2120 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2121 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2122 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2123 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2124 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2125 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2126 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2127 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2128 | stream->readback(checksumBufPtr, checksumSize); |
| 2129 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2130 | ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 2131 | abort(); |
| 2132 | } |
| 2133 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2134 | } |
| 2135 | |
| 2136 | void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params) |
| 2137 | { |
| 2138 | |
| 2139 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2140 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2141 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2142 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2143 | |
| 2144 | const unsigned int __size_params = sizeof(GLint); |
| 2145 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2146 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2147 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2148 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2149 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2150 | buf = stream->alloc(totalSize); |
| 2151 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2152 | int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2153 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2154 | |
| 2155 | memcpy(ptr, &shader, 4); ptr += 4; |
| 2156 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2157 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2158 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2159 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2160 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2161 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2162 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2163 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2164 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2165 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2166 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2167 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2168 | stream->readback(checksumBufPtr, checksumSize); |
| 2169 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2170 | ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n"); |
| 2171 | abort(); |
| 2172 | } |
| 2173 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2174 | } |
| 2175 | |
| 2176 | void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
| 2177 | { |
| 2178 | |
| 2179 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2180 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2181 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2182 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2183 | |
| 2184 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 2185 | const unsigned int __size_infolog = bufsize; |
| 2186 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2187 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2188 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2189 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2190 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2191 | buf = stream->alloc(totalSize); |
| 2192 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2193 | int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2194 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2195 | |
| 2196 | memcpy(ptr, &shader, 4); ptr += 4; |
| 2197 | memcpy(ptr, &bufsize, 4); ptr += 4; |
| 2198 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 2199 | *(unsigned int *)(ptr) = __size_infolog; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2200 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2201 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2202 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2203 | |
| 2204 | if (length != NULL) { |
| 2205 | stream->readback(length, __size_length); |
| 2206 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 2207 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2208 | stream->readback(infolog, __size_infolog); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2209 | if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog); |
| 2210 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2211 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2212 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2213 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2214 | stream->readback(checksumBufPtr, checksumSize); |
| 2215 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2216 | ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n"); |
| 2217 | abort(); |
| 2218 | } |
| 2219 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2220 | } |
| 2221 | |
| 2222 | void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
| 2223 | { |
| 2224 | |
| 2225 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2226 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2227 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2228 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2229 | |
| 2230 | const unsigned int __size_range = (2 * sizeof(GLint)); |
| 2231 | const unsigned int __size_precision = (sizeof(GLint)); |
| 2232 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2233 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2234 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2235 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2236 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2237 | buf = stream->alloc(totalSize); |
| 2238 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2239 | int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2240 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2241 | |
| 2242 | memcpy(ptr, &shadertype, 4); ptr += 4; |
| 2243 | memcpy(ptr, &precisiontype, 4); ptr += 4; |
| 2244 | *(unsigned int *)(ptr) = __size_range; ptr += 4; |
| 2245 | *(unsigned int *)(ptr) = __size_precision; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2246 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2247 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2248 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2249 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2250 | stream->readback(range, __size_range); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2251 | if (useChecksum) checksumCalculator->addBuffer(range, __size_range); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2252 | stream->readback(precision, __size_precision); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2253 | if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision); |
| 2254 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2255 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2256 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2257 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2258 | stream->readback(checksumBufPtr, checksumSize); |
| 2259 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2260 | ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n"); |
| 2261 | abort(); |
| 2262 | } |
| 2263 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2264 | } |
| 2265 | |
| 2266 | void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
| 2267 | { |
| 2268 | |
| 2269 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2270 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2271 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2272 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2273 | |
| 2274 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 2275 | const unsigned int __size_source = bufsize; |
| 2276 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2277 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2278 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2279 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2280 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2281 | buf = stream->alloc(totalSize); |
| 2282 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2283 | int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2284 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2285 | |
| 2286 | memcpy(ptr, &shader, 4); ptr += 4; |
| 2287 | memcpy(ptr, &bufsize, 4); ptr += 4; |
| 2288 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 2289 | *(unsigned int *)(ptr) = __size_source; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2290 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2291 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2292 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2293 | |
| 2294 | if (length != NULL) { |
| 2295 | stream->readback(length, __size_length); |
| 2296 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 2297 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2298 | stream->readback(source, __size_source); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2299 | if (useChecksum) checksumCalculator->addBuffer(source, __size_source); |
| 2300 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2301 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2302 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2303 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2304 | stream->readback(checksumBufPtr, checksumSize); |
| 2305 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2306 | ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n"); |
| 2307 | abort(); |
| 2308 | } |
| 2309 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2310 | } |
| 2311 | |
| 2312 | void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params) |
| 2313 | { |
| 2314 | |
| 2315 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2316 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2317 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2318 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2319 | |
| 2320 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 2321 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2322 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2323 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2324 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2325 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2326 | buf = stream->alloc(totalSize); |
| 2327 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2328 | int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2329 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2330 | |
| 2331 | memcpy(ptr, &target, 4); ptr += 4; |
| 2332 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2333 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2334 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2335 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2336 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2337 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2338 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2339 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2340 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2341 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2342 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2343 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2344 | stream->readback(checksumBufPtr, checksumSize); |
| 2345 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2346 | ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| 2347 | abort(); |
| 2348 | } |
| 2349 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2350 | } |
| 2351 | |
| 2352 | void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| 2353 | { |
| 2354 | |
| 2355 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2356 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2357 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2358 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2359 | |
| 2360 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 2361 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2362 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2363 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2364 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2365 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2366 | buf = stream->alloc(totalSize); |
| 2367 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2368 | int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2369 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2370 | |
| 2371 | memcpy(ptr, &target, 4); ptr += 4; |
| 2372 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2373 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2374 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2375 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2376 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2377 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2378 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2379 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2380 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2381 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2382 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2383 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2384 | stream->readback(checksumBufPtr, checksumSize); |
| 2385 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2386 | ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 2387 | abort(); |
| 2388 | } |
| 2389 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2390 | } |
| 2391 | |
| 2392 | void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params) |
| 2393 | { |
| 2394 | |
| 2395 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2396 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2397 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2398 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2399 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 2400 | const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2401 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2402 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2403 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2404 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2405 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2406 | buf = stream->alloc(totalSize); |
| 2407 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2408 | int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2409 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2410 | |
| 2411 | memcpy(ptr, &program, 4); ptr += 4; |
| 2412 | memcpy(ptr, &location, 4); ptr += 4; |
| 2413 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2414 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2415 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2416 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2417 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2418 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2419 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2420 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2421 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2422 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2423 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2424 | stream->readback(checksumBufPtr, checksumSize); |
| 2425 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2426 | ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n"); |
| 2427 | abort(); |
| 2428 | } |
| 2429 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2430 | } |
| 2431 | |
| 2432 | void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params) |
| 2433 | { |
| 2434 | |
| 2435 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2436 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2437 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2438 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2439 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 2440 | const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2441 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2442 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2443 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2444 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2445 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2446 | buf = stream->alloc(totalSize); |
| 2447 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2448 | int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2449 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2450 | |
| 2451 | memcpy(ptr, &program, 4); ptr += 4; |
| 2452 | memcpy(ptr, &location, 4); ptr += 4; |
| 2453 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2454 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2455 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2456 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2457 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2458 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2459 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2460 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2461 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2462 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2463 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2464 | stream->readback(checksumBufPtr, checksumSize); |
| 2465 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2466 | ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n"); |
| 2467 | abort(); |
| 2468 | } |
| 2469 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2470 | } |
| 2471 | |
| 2472 | int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name) |
| 2473 | { |
| 2474 | |
| 2475 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2476 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2477 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2478 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2479 | |
| 2480 | const unsigned int __size_name = (strlen(name) + 1); |
| 2481 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2482 | unsigned char *buf; |
| 2483 | const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4; |
| 2484 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2485 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2486 | buf = stream->alloc(totalSize); |
| 2487 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2488 | int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2489 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2490 | |
| 2491 | memcpy(ptr, &program, 4); ptr += 4; |
| 2492 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 2493 | memcpy(ptr, name, __size_name);ptr += __size_name; |
| 2494 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2495 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2496 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2497 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2498 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2499 | int retval; |
| 2500 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2501 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 2502 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2503 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2504 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2505 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2506 | stream->readback(checksumBufPtr, checksumSize); |
| 2507 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2508 | ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n"); |
| 2509 | abort(); |
| 2510 | } |
| 2511 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2512 | return retval; |
| 2513 | } |
| 2514 | |
| 2515 | void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params) |
| 2516 | { |
| 2517 | |
| 2518 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2519 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2520 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2521 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2522 | |
| 2523 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 2524 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2525 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2526 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2527 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2528 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2529 | buf = stream->alloc(totalSize); |
| 2530 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2531 | int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2532 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2533 | |
| 2534 | memcpy(ptr, &index, 4); ptr += 4; |
| 2535 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2536 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2537 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2538 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2539 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2540 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2541 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2542 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2543 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2544 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2545 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2546 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2547 | stream->readback(checksumBufPtr, checksumSize); |
| 2548 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2549 | ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n"); |
| 2550 | abort(); |
| 2551 | } |
| 2552 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2553 | } |
| 2554 | |
| 2555 | void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params) |
| 2556 | { |
| 2557 | |
| 2558 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2559 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2560 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2561 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2562 | |
| 2563 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 2564 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2565 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2566 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2567 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2568 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2569 | buf = stream->alloc(totalSize); |
| 2570 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2571 | int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2572 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2573 | |
| 2574 | memcpy(ptr, &index, 4); ptr += 4; |
| 2575 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2576 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2577 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2578 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2579 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2580 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2581 | stream->readback(params, __size_params); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2582 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 2583 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2584 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2585 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2586 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2587 | stream->readback(checksumBufPtr, checksumSize); |
| 2588 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2589 | ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n"); |
| 2590 | abort(); |
| 2591 | } |
| 2592 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2593 | } |
| 2594 | |
| 2595 | void glHint_enc(void *self , GLenum target, GLenum mode) |
| 2596 | { |
| 2597 | |
| 2598 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2599 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2600 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2601 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2602 | |
| 2603 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2604 | unsigned char *buf; |
| 2605 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 2606 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2607 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2608 | buf = stream->alloc(totalSize); |
| 2609 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2610 | int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2611 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2612 | |
| 2613 | memcpy(ptr, &target, 4); ptr += 4; |
| 2614 | memcpy(ptr, &mode, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2615 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2616 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2617 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2618 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2619 | } |
| 2620 | |
| 2621 | GLboolean glIsBuffer_enc(void *self , GLuint buffer) |
| 2622 | { |
| 2623 | |
| 2624 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2625 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2626 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2627 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2628 | |
| 2629 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2630 | unsigned char *buf; |
| 2631 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2632 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2633 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2634 | buf = stream->alloc(totalSize); |
| 2635 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2636 | int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2637 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2638 | |
| 2639 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 2640 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2641 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2642 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2643 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2644 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2645 | GLboolean retval; |
| 2646 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2647 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2648 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2649 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2650 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2651 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2652 | stream->readback(checksumBufPtr, checksumSize); |
| 2653 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2654 | ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| 2655 | abort(); |
| 2656 | } |
| 2657 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2658 | return retval; |
| 2659 | } |
| 2660 | |
| 2661 | GLboolean glIsEnabled_enc(void *self , GLenum cap) |
| 2662 | { |
| 2663 | |
| 2664 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2665 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2666 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2667 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2668 | |
| 2669 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2670 | unsigned char *buf; |
| 2671 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2672 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2673 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2674 | buf = stream->alloc(totalSize); |
| 2675 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2676 | int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2677 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2678 | |
| 2679 | memcpy(ptr, &cap, 4); ptr += 4; |
| 2680 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2681 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2682 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2683 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2684 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2685 | GLboolean retval; |
| 2686 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2687 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2688 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2689 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2690 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2691 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2692 | stream->readback(checksumBufPtr, checksumSize); |
| 2693 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2694 | ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n"); |
| 2695 | abort(); |
| 2696 | } |
| 2697 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2698 | return retval; |
| 2699 | } |
| 2700 | |
| 2701 | GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer) |
| 2702 | { |
| 2703 | |
| 2704 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2705 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2706 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2707 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2708 | |
| 2709 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2710 | unsigned char *buf; |
| 2711 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2712 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2713 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2714 | buf = stream->alloc(totalSize); |
| 2715 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2716 | int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2717 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2718 | |
| 2719 | memcpy(ptr, &framebuffer, 4); ptr += 4; |
| 2720 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2721 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2722 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2723 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2724 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2725 | GLboolean retval; |
| 2726 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2727 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2728 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2729 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2730 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2731 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2732 | stream->readback(checksumBufPtr, checksumSize); |
| 2733 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2734 | ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n"); |
| 2735 | abort(); |
| 2736 | } |
| 2737 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2738 | return retval; |
| 2739 | } |
| 2740 | |
| 2741 | GLboolean glIsProgram_enc(void *self , GLuint program) |
| 2742 | { |
| 2743 | |
| 2744 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2745 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2746 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2747 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2748 | |
| 2749 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2750 | unsigned char *buf; |
| 2751 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2752 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2753 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2754 | buf = stream->alloc(totalSize); |
| 2755 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2756 | int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2757 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2758 | |
| 2759 | memcpy(ptr, &program, 4); ptr += 4; |
| 2760 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2761 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2762 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2763 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2764 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2765 | GLboolean retval; |
| 2766 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2767 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2768 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2769 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2770 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2771 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2772 | stream->readback(checksumBufPtr, checksumSize); |
| 2773 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2774 | ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n"); |
| 2775 | abort(); |
| 2776 | } |
| 2777 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2778 | return retval; |
| 2779 | } |
| 2780 | |
| 2781 | GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer) |
| 2782 | { |
| 2783 | |
| 2784 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2785 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2786 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2787 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2788 | |
| 2789 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2790 | unsigned char *buf; |
| 2791 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2792 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2793 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2794 | buf = stream->alloc(totalSize); |
| 2795 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2796 | int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2797 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2798 | |
| 2799 | memcpy(ptr, &renderbuffer, 4); ptr += 4; |
| 2800 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2801 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2802 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2803 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2804 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2805 | GLboolean retval; |
| 2806 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2807 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2808 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2809 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2810 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2811 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2812 | stream->readback(checksumBufPtr, checksumSize); |
| 2813 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2814 | ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n"); |
| 2815 | abort(); |
| 2816 | } |
| 2817 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2818 | return retval; |
| 2819 | } |
| 2820 | |
| 2821 | GLboolean glIsShader_enc(void *self , GLuint shader) |
| 2822 | { |
| 2823 | |
| 2824 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2825 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2826 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2827 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2828 | |
| 2829 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2830 | unsigned char *buf; |
| 2831 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2832 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2833 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2834 | buf = stream->alloc(totalSize); |
| 2835 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2836 | int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2837 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2838 | |
| 2839 | memcpy(ptr, &shader, 4); ptr += 4; |
| 2840 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2841 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2842 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2843 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2844 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2845 | GLboolean retval; |
| 2846 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2847 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2848 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2849 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2850 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2851 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2852 | stream->readback(checksumBufPtr, checksumSize); |
| 2853 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2854 | ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n"); |
| 2855 | abort(); |
| 2856 | } |
| 2857 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2858 | return retval; |
| 2859 | } |
| 2860 | |
| 2861 | GLboolean glIsTexture_enc(void *self , GLuint texture) |
| 2862 | { |
| 2863 | |
| 2864 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2865 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2866 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2867 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2868 | |
| 2869 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2870 | unsigned char *buf; |
| 2871 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2872 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2873 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2874 | buf = stream->alloc(totalSize); |
| 2875 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2876 | int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2877 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2878 | |
| 2879 | memcpy(ptr, &texture, 4); ptr += 4; |
| 2880 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2881 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2882 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2883 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2884 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2885 | GLboolean retval; |
| 2886 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2887 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 2888 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2889 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 2890 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 2891 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 2892 | stream->readback(checksumBufPtr, checksumSize); |
| 2893 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2894 | ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n"); |
| 2895 | abort(); |
| 2896 | } |
| 2897 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2898 | return retval; |
| 2899 | } |
| 2900 | |
| 2901 | void glLineWidth_enc(void *self , GLfloat width) |
| 2902 | { |
| 2903 | |
| 2904 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2905 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2906 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2907 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2908 | |
| 2909 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2910 | unsigned char *buf; |
| 2911 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2912 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2913 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2914 | buf = stream->alloc(totalSize); |
| 2915 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2916 | int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2917 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2918 | |
| 2919 | memcpy(ptr, &width, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2920 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2921 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2922 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2923 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2924 | } |
| 2925 | |
| 2926 | void glLinkProgram_enc(void *self , GLuint program) |
| 2927 | { |
| 2928 | |
| 2929 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2930 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2931 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2932 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2933 | |
| 2934 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2935 | unsigned char *buf; |
| 2936 | const size_t sizeWithoutChecksum = 8 + 4; |
| 2937 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2938 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2939 | buf = stream->alloc(totalSize); |
| 2940 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2941 | int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2942 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2943 | |
| 2944 | memcpy(ptr, &program, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2945 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2946 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2947 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2948 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2949 | } |
| 2950 | |
| 2951 | void glPixelStorei_enc(void *self , GLenum pname, GLint param) |
| 2952 | { |
| 2953 | |
| 2954 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2955 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2956 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2957 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2958 | |
| 2959 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2960 | unsigned char *buf; |
| 2961 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 2962 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2963 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2964 | buf = stream->alloc(totalSize); |
| 2965 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2966 | int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2967 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2968 | |
| 2969 | memcpy(ptr, &pname, 4); ptr += 4; |
| 2970 | memcpy(ptr, ¶m, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2971 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2972 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2973 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 2974 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2975 | } |
| 2976 | |
| 2977 | void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units) |
| 2978 | { |
| 2979 | |
| 2980 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 2981 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2982 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2983 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2984 | |
| 2985 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2986 | unsigned char *buf; |
| 2987 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 2988 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 2989 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 2990 | buf = stream->alloc(totalSize); |
| 2991 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2992 | int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2993 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 2994 | |
| 2995 | memcpy(ptr, &factor, 4); ptr += 4; |
| 2996 | memcpy(ptr, &units, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 2997 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 2998 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 2999 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3000 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3001 | } |
| 3002 | |
| 3003 | void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) |
| 3004 | { |
| 3005 | |
| 3006 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3007 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3008 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3009 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3010 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 3011 | const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3012 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3013 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 3014 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3015 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3016 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3017 | buf = stream->alloc(totalSize); |
| 3018 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3019 | int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3020 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3021 | |
| 3022 | memcpy(ptr, &x, 4); ptr += 4; |
| 3023 | memcpy(ptr, &y, 4); ptr += 4; |
| 3024 | memcpy(ptr, &width, 4); ptr += 4; |
| 3025 | memcpy(ptr, &height, 4); ptr += 4; |
| 3026 | memcpy(ptr, &format, 4); ptr += 4; |
| 3027 | memcpy(ptr, &type, 4); ptr += 4; |
| 3028 | *(unsigned int *)(ptr) = __size_pixels; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3029 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3030 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3031 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3032 | |
Roman Kiryanov | 80f8365 | 2018-10-03 14:05:29 -0700 | [diff] [blame] | 3033 | // TODO: emugen produces bad code here, see b/79208762 |
Lingfeng Yang | 22dc42d | 2018-05-29 10:11:38 -0700 | [diff] [blame] | 3034 | stream->readbackPixels(self, width, height, format, type, pixels); |
| 3035 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3036 | if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| 3037 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 3038 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 3039 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 3040 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 3041 | stream->readback(checksumBufPtr, checksumSize); |
| 3042 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3043 | ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n"); |
| 3044 | abort(); |
| 3045 | } |
| 3046 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3047 | } |
| 3048 | |
| 3049 | void glReleaseShaderCompiler_enc(void *self ) |
| 3050 | { |
| 3051 | |
| 3052 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3053 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3054 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3055 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3056 | |
| 3057 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3058 | unsigned char *buf; |
| 3059 | const size_t sizeWithoutChecksum = 8; |
| 3060 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3061 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3062 | buf = stream->alloc(totalSize); |
| 3063 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3064 | int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3065 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3066 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3067 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3068 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3069 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3070 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3071 | } |
| 3072 | |
| 3073 | void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| 3074 | { |
| 3075 | |
| 3076 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3077 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3078 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3079 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3080 | |
| 3081 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3082 | unsigned char *buf; |
| 3083 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3084 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3085 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3086 | buf = stream->alloc(totalSize); |
| 3087 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3088 | int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3089 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3090 | |
| 3091 | memcpy(ptr, &target, 4); ptr += 4; |
| 3092 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 3093 | memcpy(ptr, &width, 4); ptr += 4; |
| 3094 | memcpy(ptr, &height, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3095 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3096 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3097 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3098 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3099 | } |
| 3100 | |
| 3101 | void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert) |
| 3102 | { |
| 3103 | |
| 3104 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3105 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3106 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3107 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3108 | |
| 3109 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3110 | unsigned char *buf; |
| 3111 | const size_t sizeWithoutChecksum = 8 + 4 + 1; |
| 3112 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3113 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3114 | buf = stream->alloc(totalSize); |
| 3115 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3116 | int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3117 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3118 | |
| 3119 | memcpy(ptr, &value, 4); ptr += 4; |
| 3120 | memcpy(ptr, &invert, 1); ptr += 1; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3121 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3122 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3123 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3124 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3125 | } |
| 3126 | |
| 3127 | void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height) |
| 3128 | { |
| 3129 | |
| 3130 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3131 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3132 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3133 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3134 | |
| 3135 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3136 | unsigned char *buf; |
| 3137 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3138 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3139 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3140 | buf = stream->alloc(totalSize); |
| 3141 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3142 | int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3143 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3144 | |
| 3145 | memcpy(ptr, &x, 4); ptr += 4; |
| 3146 | memcpy(ptr, &y, 4); ptr += 4; |
| 3147 | memcpy(ptr, &width, 4); ptr += 4; |
| 3148 | memcpy(ptr, &height, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3149 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3150 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3151 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3152 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3153 | } |
| 3154 | |
| 3155 | void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask) |
| 3156 | { |
| 3157 | |
| 3158 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3159 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3160 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3161 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3162 | |
| 3163 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3164 | unsigned char *buf; |
| 3165 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3166 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3167 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3168 | buf = stream->alloc(totalSize); |
| 3169 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3170 | int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3171 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3172 | |
| 3173 | memcpy(ptr, &func, 4); ptr += 4; |
| 3174 | memcpy(ptr, &ref, 4); ptr += 4; |
| 3175 | memcpy(ptr, &mask, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3176 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3177 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3178 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3179 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3180 | } |
| 3181 | |
| 3182 | void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask) |
| 3183 | { |
| 3184 | |
| 3185 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3186 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3187 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3188 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3189 | |
| 3190 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3191 | unsigned char *buf; |
| 3192 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3193 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3194 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3195 | buf = stream->alloc(totalSize); |
| 3196 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3197 | int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3198 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3199 | |
| 3200 | memcpy(ptr, &face, 4); ptr += 4; |
| 3201 | memcpy(ptr, &func, 4); ptr += 4; |
| 3202 | memcpy(ptr, &ref, 4); ptr += 4; |
| 3203 | memcpy(ptr, &mask, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3204 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3205 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3206 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3207 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3208 | } |
| 3209 | |
| 3210 | void glStencilMask_enc(void *self , GLuint mask) |
| 3211 | { |
| 3212 | |
| 3213 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3214 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3215 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3216 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3217 | |
| 3218 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3219 | unsigned char *buf; |
| 3220 | const size_t sizeWithoutChecksum = 8 + 4; |
| 3221 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3222 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3223 | buf = stream->alloc(totalSize); |
| 3224 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3225 | int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3226 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3227 | |
| 3228 | memcpy(ptr, &mask, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3229 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3230 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3231 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3232 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3233 | } |
| 3234 | |
| 3235 | void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask) |
| 3236 | { |
| 3237 | |
| 3238 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3239 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3240 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3241 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3242 | |
| 3243 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3244 | unsigned char *buf; |
| 3245 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 3246 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3247 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3248 | buf = stream->alloc(totalSize); |
| 3249 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3250 | int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3251 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3252 | |
| 3253 | memcpy(ptr, &face, 4); ptr += 4; |
| 3254 | memcpy(ptr, &mask, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3255 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3256 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3257 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3258 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3259 | } |
| 3260 | |
| 3261 | void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass) |
| 3262 | { |
| 3263 | |
| 3264 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3265 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3266 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3267 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3268 | |
| 3269 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3270 | unsigned char *buf; |
| 3271 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3272 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3273 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3274 | buf = stream->alloc(totalSize); |
| 3275 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3276 | int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3277 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3278 | |
| 3279 | memcpy(ptr, &fail, 4); ptr += 4; |
| 3280 | memcpy(ptr, &zfail, 4); ptr += 4; |
| 3281 | memcpy(ptr, &zpass, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3282 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3283 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3284 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3285 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3286 | } |
| 3287 | |
| 3288 | void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| 3289 | { |
| 3290 | |
| 3291 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3292 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3293 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3294 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3295 | |
| 3296 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3297 | unsigned char *buf; |
| 3298 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3299 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3300 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3301 | buf = stream->alloc(totalSize); |
| 3302 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3303 | int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3304 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3305 | |
| 3306 | memcpy(ptr, &face, 4); ptr += 4; |
| 3307 | memcpy(ptr, &fail, 4); ptr += 4; |
| 3308 | memcpy(ptr, &zfail, 4); ptr += 4; |
| 3309 | memcpy(ptr, &zpass, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3310 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3311 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3312 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3313 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3314 | } |
| 3315 | |
| 3316 | void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
| 3317 | { |
| 3318 | |
| 3319 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3320 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3321 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3322 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3323 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 3324 | const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3325 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3326 | unsigned char *buf; |
| 3327 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; |
| 3328 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3329 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3330 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 3331 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3332 | int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3333 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3334 | |
| 3335 | memcpy(ptr, &target, 4); ptr += 4; |
| 3336 | memcpy(ptr, &level, 4); ptr += 4; |
| 3337 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 3338 | memcpy(ptr, &width, 4); ptr += 4; |
| 3339 | memcpy(ptr, &height, 4); ptr += 4; |
| 3340 | memcpy(ptr, &border, 4); ptr += 4; |
| 3341 | memcpy(ptr, &format, 4); ptr += 4; |
| 3342 | memcpy(ptr, &type, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3343 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3344 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3345 | stream->flush(); |
| 3346 | stream->writeFully(&__size_pixels,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3347 | if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3348 | if (pixels != NULL) { |
| 3349 | stream->writeFully(pixels, __size_pixels); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3350 | if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3351 | } |
| 3352 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3353 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 3354 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3355 | } |
| 3356 | |
| 3357 | void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param) |
| 3358 | { |
| 3359 | |
| 3360 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3361 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3362 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3363 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3364 | |
| 3365 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3366 | unsigned char *buf; |
| 3367 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3368 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3369 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3370 | buf = stream->alloc(totalSize); |
| 3371 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3372 | int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3373 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3374 | |
| 3375 | memcpy(ptr, &target, 4); ptr += 4; |
| 3376 | memcpy(ptr, &pname, 4); ptr += 4; |
| 3377 | memcpy(ptr, ¶m, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3378 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3379 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3380 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3381 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3382 | } |
| 3383 | |
| 3384 | void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params) |
| 3385 | { |
| 3386 | |
| 3387 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3388 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3389 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3390 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3391 | |
| 3392 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 3393 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3394 | unsigned char *buf; |
| 3395 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| 3396 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3397 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3398 | buf = stream->alloc(totalSize); |
| 3399 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3400 | int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3401 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3402 | |
| 3403 | memcpy(ptr, &target, 4); ptr += 4; |
| 3404 | memcpy(ptr, &pname, 4); ptr += 4; |
| 3405 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 3406 | memcpy(ptr, params, __size_params);ptr += __size_params; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3407 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3408 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3409 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3410 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3411 | } |
| 3412 | |
| 3413 | void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param) |
| 3414 | { |
| 3415 | |
| 3416 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3417 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3418 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3419 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3420 | |
| 3421 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3422 | unsigned char *buf; |
| 3423 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3424 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3425 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3426 | buf = stream->alloc(totalSize); |
| 3427 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3428 | int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3429 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3430 | |
| 3431 | memcpy(ptr, &target, 4); ptr += 4; |
| 3432 | memcpy(ptr, &pname, 4); ptr += 4; |
| 3433 | memcpy(ptr, ¶m, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3434 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3435 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3436 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3437 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3438 | } |
| 3439 | |
| 3440 | void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params) |
| 3441 | { |
| 3442 | |
| 3443 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3444 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3445 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3446 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3447 | |
| 3448 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 3449 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3450 | unsigned char *buf; |
| 3451 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| 3452 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3453 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3454 | buf = stream->alloc(totalSize); |
| 3455 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3456 | int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3457 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3458 | |
| 3459 | memcpy(ptr, &target, 4); ptr += 4; |
| 3460 | memcpy(ptr, &pname, 4); ptr += 4; |
| 3461 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 3462 | memcpy(ptr, params, __size_params);ptr += __size_params; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3463 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3464 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3465 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3466 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3467 | } |
| 3468 | |
| 3469 | void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) |
| 3470 | { |
| 3471 | |
| 3472 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3473 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3474 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3475 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3476 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 3477 | const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3478 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3479 | unsigned char *buf; |
| 3480 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; |
| 3481 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3482 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3483 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 3484 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3485 | int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3486 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3487 | |
| 3488 | memcpy(ptr, &target, 4); ptr += 4; |
| 3489 | memcpy(ptr, &level, 4); ptr += 4; |
| 3490 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 3491 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 3492 | memcpy(ptr, &width, 4); ptr += 4; |
| 3493 | memcpy(ptr, &height, 4); ptr += 4; |
| 3494 | memcpy(ptr, &format, 4); ptr += 4; |
| 3495 | memcpy(ptr, &type, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3496 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3497 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3498 | stream->flush(); |
| 3499 | stream->writeFully(&__size_pixels,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3500 | if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3501 | if (pixels != NULL) { |
| 3502 | stream->writeFully(pixels, __size_pixels); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3503 | if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3504 | } |
| 3505 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3506 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 3507 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3508 | } |
| 3509 | |
| 3510 | void glUniform1f_enc(void *self , GLint location, GLfloat x) |
| 3511 | { |
| 3512 | |
| 3513 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3514 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3515 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3516 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3517 | |
| 3518 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3519 | unsigned char *buf; |
| 3520 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 3521 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3522 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3523 | buf = stream->alloc(totalSize); |
| 3524 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3525 | int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3526 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3527 | |
| 3528 | memcpy(ptr, &location, 4); ptr += 4; |
| 3529 | memcpy(ptr, &x, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3530 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3531 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3532 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3533 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3534 | } |
| 3535 | |
| 3536 | void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| 3537 | { |
| 3538 | |
| 3539 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3540 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3541 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3542 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3543 | |
| 3544 | const unsigned int __size_v = (count * sizeof(GLfloat)); |
| 3545 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3546 | unsigned char *buf; |
| 3547 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3548 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3549 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3550 | buf = stream->alloc(totalSize); |
| 3551 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3552 | int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3553 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3554 | |
| 3555 | memcpy(ptr, &location, 4); ptr += 4; |
| 3556 | memcpy(ptr, &count, 4); ptr += 4; |
| 3557 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3558 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3559 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3560 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3561 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3562 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | void glUniform1i_enc(void *self , GLint location, GLint x) |
| 3566 | { |
| 3567 | |
| 3568 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3569 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3570 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3571 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3572 | |
| 3573 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3574 | unsigned char *buf; |
| 3575 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 3576 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3577 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3578 | buf = stream->alloc(totalSize); |
| 3579 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3580 | int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3581 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3582 | |
| 3583 | memcpy(ptr, &location, 4); ptr += 4; |
| 3584 | memcpy(ptr, &x, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3585 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3586 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3587 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3588 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3589 | } |
| 3590 | |
| 3591 | void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| 3592 | { |
| 3593 | |
| 3594 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3595 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3596 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3597 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3598 | |
| 3599 | const unsigned int __size_v = (count * sizeof(GLint)); |
| 3600 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3601 | unsigned char *buf; |
| 3602 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3603 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3604 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3605 | buf = stream->alloc(totalSize); |
| 3606 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3607 | int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3608 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3609 | |
| 3610 | memcpy(ptr, &location, 4); ptr += 4; |
| 3611 | memcpy(ptr, &count, 4); ptr += 4; |
| 3612 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3613 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3614 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3615 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3616 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3617 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3618 | } |
| 3619 | |
| 3620 | void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y) |
| 3621 | { |
| 3622 | |
| 3623 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3624 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3625 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3626 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3627 | |
| 3628 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3629 | unsigned char *buf; |
| 3630 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3631 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3632 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3633 | buf = stream->alloc(totalSize); |
| 3634 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3635 | int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3636 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3637 | |
| 3638 | memcpy(ptr, &location, 4); ptr += 4; |
| 3639 | memcpy(ptr, &x, 4); ptr += 4; |
| 3640 | memcpy(ptr, &y, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3641 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3642 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3643 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3644 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3645 | } |
| 3646 | |
| 3647 | void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| 3648 | { |
| 3649 | |
| 3650 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3651 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3652 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3653 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3654 | |
| 3655 | const unsigned int __size_v = (count * 2 * sizeof(GLfloat)); |
| 3656 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3657 | unsigned char *buf; |
| 3658 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3659 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3660 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3661 | buf = stream->alloc(totalSize); |
| 3662 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3663 | int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3664 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3665 | |
| 3666 | memcpy(ptr, &location, 4); ptr += 4; |
| 3667 | memcpy(ptr, &count, 4); ptr += 4; |
| 3668 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3669 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3670 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3671 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3672 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3673 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3674 | } |
| 3675 | |
| 3676 | void glUniform2i_enc(void *self , GLint location, GLint x, GLint y) |
| 3677 | { |
| 3678 | |
| 3679 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3680 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3681 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3682 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3683 | |
| 3684 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3685 | unsigned char *buf; |
| 3686 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 3687 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3688 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3689 | buf = stream->alloc(totalSize); |
| 3690 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3691 | int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3692 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3693 | |
| 3694 | memcpy(ptr, &location, 4); ptr += 4; |
| 3695 | memcpy(ptr, &x, 4); ptr += 4; |
| 3696 | memcpy(ptr, &y, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3697 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3698 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3699 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3700 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3701 | } |
| 3702 | |
| 3703 | void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| 3704 | { |
| 3705 | |
| 3706 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3707 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3708 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3709 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3710 | |
| 3711 | const unsigned int __size_v = (count * 2 * sizeof(GLint)); |
| 3712 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3713 | unsigned char *buf; |
| 3714 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3715 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3716 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3717 | buf = stream->alloc(totalSize); |
| 3718 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3719 | int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3720 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3721 | |
| 3722 | memcpy(ptr, &location, 4); ptr += 4; |
| 3723 | memcpy(ptr, &count, 4); ptr += 4; |
| 3724 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3725 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3726 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3727 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3728 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3729 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3730 | } |
| 3731 | |
| 3732 | void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z) |
| 3733 | { |
| 3734 | |
| 3735 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3736 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3737 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3738 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3739 | |
| 3740 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3741 | unsigned char *buf; |
| 3742 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3743 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3744 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3745 | buf = stream->alloc(totalSize); |
| 3746 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3747 | int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3748 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3749 | |
| 3750 | memcpy(ptr, &location, 4); ptr += 4; |
| 3751 | memcpy(ptr, &x, 4); ptr += 4; |
| 3752 | memcpy(ptr, &y, 4); ptr += 4; |
| 3753 | memcpy(ptr, &z, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3754 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3755 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3756 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3757 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3758 | } |
| 3759 | |
| 3760 | void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| 3761 | { |
| 3762 | |
| 3763 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3764 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3765 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3766 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3767 | |
| 3768 | const unsigned int __size_v = (count * 3 * sizeof(GLfloat)); |
| 3769 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3770 | unsigned char *buf; |
| 3771 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3772 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3773 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3774 | buf = stream->alloc(totalSize); |
| 3775 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3776 | int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3777 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3778 | |
| 3779 | memcpy(ptr, &location, 4); ptr += 4; |
| 3780 | memcpy(ptr, &count, 4); ptr += 4; |
| 3781 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3782 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3783 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3784 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3785 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3786 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3787 | } |
| 3788 | |
| 3789 | void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z) |
| 3790 | { |
| 3791 | |
| 3792 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3793 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3794 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3795 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3796 | |
| 3797 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3798 | unsigned char *buf; |
| 3799 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 3800 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3801 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3802 | buf = stream->alloc(totalSize); |
| 3803 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3804 | int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3805 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3806 | |
| 3807 | memcpy(ptr, &location, 4); ptr += 4; |
| 3808 | memcpy(ptr, &x, 4); ptr += 4; |
| 3809 | memcpy(ptr, &y, 4); ptr += 4; |
| 3810 | memcpy(ptr, &z, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3811 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3812 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3813 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3814 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3815 | } |
| 3816 | |
| 3817 | void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| 3818 | { |
| 3819 | |
| 3820 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3821 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3822 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3823 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3824 | |
| 3825 | const unsigned int __size_v = (3 * count * sizeof(GLint)); |
| 3826 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3827 | unsigned char *buf; |
| 3828 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3829 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3830 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3831 | buf = stream->alloc(totalSize); |
| 3832 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3833 | int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3834 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3835 | |
| 3836 | memcpy(ptr, &location, 4); ptr += 4; |
| 3837 | memcpy(ptr, &count, 4); ptr += 4; |
| 3838 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3839 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3840 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3841 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3842 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3843 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3844 | } |
| 3845 | |
| 3846 | void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 3847 | { |
| 3848 | |
| 3849 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3850 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3851 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3852 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3853 | |
| 3854 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3855 | unsigned char *buf; |
| 3856 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 3857 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3858 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3859 | buf = stream->alloc(totalSize); |
| 3860 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3861 | int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3862 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3863 | |
| 3864 | memcpy(ptr, &location, 4); ptr += 4; |
| 3865 | memcpy(ptr, &x, 4); ptr += 4; |
| 3866 | memcpy(ptr, &y, 4); ptr += 4; |
| 3867 | memcpy(ptr, &z, 4); ptr += 4; |
| 3868 | memcpy(ptr, &w, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3869 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3870 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3871 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3872 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3873 | } |
| 3874 | |
| 3875 | void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v) |
| 3876 | { |
| 3877 | |
| 3878 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3879 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3880 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3881 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3882 | |
| 3883 | const unsigned int __size_v = (4 * count * sizeof(GLfloat)); |
| 3884 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3885 | unsigned char *buf; |
| 3886 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3887 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3888 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3889 | buf = stream->alloc(totalSize); |
| 3890 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3891 | int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3892 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3893 | |
| 3894 | memcpy(ptr, &location, 4); ptr += 4; |
| 3895 | memcpy(ptr, &count, 4); ptr += 4; |
| 3896 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3897 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3898 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3899 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3900 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3901 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3902 | } |
| 3903 | |
| 3904 | void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w) |
| 3905 | { |
| 3906 | |
| 3907 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3908 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3909 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3910 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3911 | |
| 3912 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3913 | unsigned char *buf; |
| 3914 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 3915 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3916 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3917 | buf = stream->alloc(totalSize); |
| 3918 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3919 | int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3920 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3921 | |
| 3922 | memcpy(ptr, &location, 4); ptr += 4; |
| 3923 | memcpy(ptr, &x, 4); ptr += 4; |
| 3924 | memcpy(ptr, &y, 4); ptr += 4; |
| 3925 | memcpy(ptr, &z, 4); ptr += 4; |
| 3926 | memcpy(ptr, &w, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3927 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3928 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3929 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3930 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3931 | } |
| 3932 | |
| 3933 | void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v) |
| 3934 | { |
| 3935 | |
| 3936 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3937 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3938 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3939 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3940 | |
| 3941 | const unsigned int __size_v = (4 * count * sizeof(GLint)); |
| 3942 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3943 | unsigned char *buf; |
| 3944 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4; |
| 3945 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3946 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3947 | buf = stream->alloc(totalSize); |
| 3948 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3949 | int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3950 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3951 | |
| 3952 | memcpy(ptr, &location, 4); ptr += 4; |
| 3953 | memcpy(ptr, &count, 4); ptr += 4; |
| 3954 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 3955 | memcpy(ptr, v, __size_v);ptr += __size_v; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3956 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3957 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3958 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3959 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3960 | } |
| 3961 | |
| 3962 | void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 3963 | { |
| 3964 | |
| 3965 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3966 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3967 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3968 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3969 | |
| 3970 | const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
| 3971 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3972 | unsigned char *buf; |
| 3973 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 3974 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 3975 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 3976 | buf = stream->alloc(totalSize); |
| 3977 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3978 | int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3979 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3980 | |
| 3981 | memcpy(ptr, &location, 4); ptr += 4; |
| 3982 | memcpy(ptr, &count, 4); ptr += 4; |
| 3983 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 3984 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 3985 | memcpy(ptr, value, __size_value);ptr += __size_value; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3986 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3987 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 3988 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 3989 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3990 | } |
| 3991 | |
| 3992 | void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 3993 | { |
| 3994 | |
| 3995 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 3996 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 3997 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 3998 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 3999 | |
| 4000 | const unsigned int __size_value = (count * 9 * sizeof(GLfloat)); |
| 4001 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4002 | unsigned char *buf; |
| 4003 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 4004 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4005 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4006 | buf = stream->alloc(totalSize); |
| 4007 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4008 | int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4009 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4010 | |
| 4011 | memcpy(ptr, &location, 4); ptr += 4; |
| 4012 | memcpy(ptr, &count, 4); ptr += 4; |
| 4013 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 4014 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 4015 | memcpy(ptr, value, __size_value);ptr += __size_value; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4016 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4017 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4018 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4019 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4020 | } |
| 4021 | |
| 4022 | void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4023 | { |
| 4024 | |
| 4025 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4026 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4027 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4028 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4029 | |
| 4030 | const unsigned int __size_value = (count * 16 * sizeof(GLfloat)); |
| 4031 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4032 | unsigned char *buf; |
| 4033 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 4034 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4035 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4036 | buf = stream->alloc(totalSize); |
| 4037 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4038 | int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4039 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4040 | |
| 4041 | memcpy(ptr, &location, 4); ptr += 4; |
| 4042 | memcpy(ptr, &count, 4); ptr += 4; |
| 4043 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 4044 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 4045 | memcpy(ptr, value, __size_value);ptr += __size_value; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4046 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4047 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4048 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4049 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4050 | } |
| 4051 | |
| 4052 | void glUseProgram_enc(void *self , GLuint program) |
| 4053 | { |
| 4054 | |
| 4055 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4056 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4057 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4058 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4059 | |
| 4060 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4061 | unsigned char *buf; |
| 4062 | const size_t sizeWithoutChecksum = 8 + 4; |
| 4063 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4064 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4065 | buf = stream->alloc(totalSize); |
| 4066 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4067 | int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4068 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4069 | |
| 4070 | memcpy(ptr, &program, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4071 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4072 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4073 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4074 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4075 | } |
| 4076 | |
| 4077 | void glValidateProgram_enc(void *self , GLuint program) |
| 4078 | { |
| 4079 | |
| 4080 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4081 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4082 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4083 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4084 | |
| 4085 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4086 | unsigned char *buf; |
| 4087 | const size_t sizeWithoutChecksum = 8 + 4; |
| 4088 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4089 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4090 | buf = stream->alloc(totalSize); |
| 4091 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4092 | int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4093 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4094 | |
| 4095 | memcpy(ptr, &program, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4096 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4097 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4098 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4099 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4100 | } |
| 4101 | |
| 4102 | void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x) |
| 4103 | { |
| 4104 | |
| 4105 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4106 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4107 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4108 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4109 | |
| 4110 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4111 | unsigned char *buf; |
| 4112 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 4113 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4114 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4115 | buf = stream->alloc(totalSize); |
| 4116 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4117 | int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4118 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4119 | |
| 4120 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4121 | memcpy(ptr, &x, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4122 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4123 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4124 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4125 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4126 | } |
| 4127 | |
| 4128 | void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values) |
| 4129 | { |
| 4130 | |
| 4131 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4132 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4133 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4134 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4135 | |
| 4136 | const unsigned int __size_values = (sizeof(GLfloat)); |
| 4137 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4138 | unsigned char *buf; |
| 4139 | const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| 4140 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4141 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4142 | buf = stream->alloc(totalSize); |
| 4143 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4144 | int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4145 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4146 | |
| 4147 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4148 | *(unsigned int *)(ptr) = __size_values; ptr += 4; |
| 4149 | memcpy(ptr, values, __size_values);ptr += __size_values; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4150 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4151 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4152 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4153 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4154 | } |
| 4155 | |
| 4156 | void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y) |
| 4157 | { |
| 4158 | |
| 4159 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4160 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4161 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4162 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4163 | |
| 4164 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4165 | unsigned char *buf; |
| 4166 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 4167 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4168 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4169 | buf = stream->alloc(totalSize); |
| 4170 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4171 | int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4172 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4173 | |
| 4174 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4175 | memcpy(ptr, &x, 4); ptr += 4; |
| 4176 | memcpy(ptr, &y, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4177 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4178 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4179 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4180 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4181 | } |
| 4182 | |
| 4183 | void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values) |
| 4184 | { |
| 4185 | |
| 4186 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4187 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4188 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4189 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4190 | |
| 4191 | const unsigned int __size_values = (2 * sizeof(GLfloat)); |
| 4192 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4193 | unsigned char *buf; |
| 4194 | const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| 4195 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4196 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4197 | buf = stream->alloc(totalSize); |
| 4198 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4199 | int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4200 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4201 | |
| 4202 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4203 | *(unsigned int *)(ptr) = __size_values; ptr += 4; |
| 4204 | memcpy(ptr, values, __size_values);ptr += __size_values; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4205 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4206 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4207 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4208 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4209 | } |
| 4210 | |
| 4211 | void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z) |
| 4212 | { |
| 4213 | |
| 4214 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4215 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4216 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4217 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4218 | |
| 4219 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4220 | unsigned char *buf; |
| 4221 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 4222 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4223 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4224 | buf = stream->alloc(totalSize); |
| 4225 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4226 | int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4227 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4228 | |
| 4229 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4230 | memcpy(ptr, &x, 4); ptr += 4; |
| 4231 | memcpy(ptr, &y, 4); ptr += 4; |
| 4232 | memcpy(ptr, &z, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4233 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4234 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4235 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4236 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4237 | } |
| 4238 | |
| 4239 | void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values) |
| 4240 | { |
| 4241 | |
| 4242 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4243 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4244 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4245 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4246 | |
| 4247 | const unsigned int __size_values = (3 * sizeof(GLfloat)); |
| 4248 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4249 | unsigned char *buf; |
| 4250 | const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| 4251 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4252 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4253 | buf = stream->alloc(totalSize); |
| 4254 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4255 | int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4256 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4257 | |
| 4258 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4259 | *(unsigned int *)(ptr) = __size_values; ptr += 4; |
| 4260 | memcpy(ptr, values, __size_values);ptr += __size_values; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4261 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4262 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4263 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4264 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4265 | } |
| 4266 | |
| 4267 | void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4268 | { |
| 4269 | |
| 4270 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4271 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4272 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4273 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4274 | |
| 4275 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4276 | unsigned char *buf; |
| 4277 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 4278 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4279 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4280 | buf = stream->alloc(totalSize); |
| 4281 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4282 | int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4283 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4284 | |
| 4285 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4286 | memcpy(ptr, &x, 4); ptr += 4; |
| 4287 | memcpy(ptr, &y, 4); ptr += 4; |
| 4288 | memcpy(ptr, &z, 4); ptr += 4; |
| 4289 | memcpy(ptr, &w, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4290 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4291 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4292 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4293 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4294 | } |
| 4295 | |
| 4296 | void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values) |
| 4297 | { |
| 4298 | |
| 4299 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4300 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4301 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4302 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4303 | |
| 4304 | const unsigned int __size_values = (4 * sizeof(GLfloat)); |
| 4305 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4306 | unsigned char *buf; |
| 4307 | const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4; |
| 4308 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4309 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4310 | buf = stream->alloc(totalSize); |
| 4311 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4312 | int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4313 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4314 | |
| 4315 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4316 | *(unsigned int *)(ptr) = __size_values; ptr += 4; |
| 4317 | memcpy(ptr, values, __size_values);ptr += __size_values; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4318 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4319 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4320 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4321 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4322 | } |
| 4323 | |
| 4324 | void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height) |
| 4325 | { |
| 4326 | |
| 4327 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4328 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4329 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4330 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4331 | |
| 4332 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4333 | unsigned char *buf; |
| 4334 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 4335 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4336 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4337 | buf = stream->alloc(totalSize); |
| 4338 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4339 | int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4340 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4341 | |
| 4342 | memcpy(ptr, &x, 4); ptr += 4; |
| 4343 | memcpy(ptr, &y, 4); ptr += 4; |
| 4344 | memcpy(ptr, &width, 4); ptr += 4; |
| 4345 | memcpy(ptr, &height, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4346 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4347 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4348 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4349 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4350 | } |
| 4351 | |
| 4352 | void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image) |
| 4353 | { |
| 4354 | |
| 4355 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4356 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4357 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4358 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4359 | |
| 4360 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4361 | unsigned char *buf; |
| 4362 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 4363 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4364 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4365 | buf = stream->alloc(totalSize); |
| 4366 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4367 | int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4368 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4369 | |
| 4370 | memcpy(ptr, &target, 4); ptr += 4; |
| 4371 | memcpy(ptr, &image, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4372 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4373 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4374 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4375 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4376 | } |
| 4377 | |
| 4378 | void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image) |
| 4379 | { |
| 4380 | |
| 4381 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4382 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4383 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4384 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4385 | |
| 4386 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4387 | unsigned char *buf; |
| 4388 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 4389 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4390 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4391 | buf = stream->alloc(totalSize); |
| 4392 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4393 | int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4394 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4395 | |
| 4396 | memcpy(ptr, &target, 4); ptr += 4; |
| 4397 | memcpy(ptr, &image, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4398 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4399 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4400 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4401 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4402 | } |
| 4403 | |
| 4404 | GLboolean glUnmapBufferOES_enc(void *self , GLenum target) |
| 4405 | { |
| 4406 | |
| 4407 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4408 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4409 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4410 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4411 | |
| 4412 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4413 | unsigned char *buf; |
| 4414 | const size_t sizeWithoutChecksum = 8 + 4; |
| 4415 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4416 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4417 | buf = stream->alloc(totalSize); |
| 4418 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4419 | int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4420 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4421 | |
| 4422 | memcpy(ptr, &target, 4); ptr += 4; |
| 4423 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4424 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4425 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4426 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4427 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4428 | GLboolean retval; |
| 4429 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4430 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 4431 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4432 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4433 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4434 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 4435 | stream->readback(checksumBufPtr, checksumSize); |
| 4436 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4437 | ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n"); |
| 4438 | abort(); |
| 4439 | } |
| 4440 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4441 | return retval; |
| 4442 | } |
| 4443 | |
| 4444 | 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) |
| 4445 | { |
| 4446 | |
| 4447 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4448 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4449 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4450 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4451 | |
David 'Digit' Turner | 0f788d8 | 2014-11-27 18:05:34 +0100 | [diff] [blame] | 4452 | const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4453 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4454 | unsigned char *buf; |
| 4455 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; |
| 4456 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4457 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4458 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 4459 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4460 | int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4461 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4462 | |
| 4463 | memcpy(ptr, &target, 4); ptr += 4; |
| 4464 | memcpy(ptr, &level, 4); ptr += 4; |
| 4465 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 4466 | memcpy(ptr, &width, 4); ptr += 4; |
| 4467 | memcpy(ptr, &height, 4); ptr += 4; |
| 4468 | memcpy(ptr, &depth, 4); ptr += 4; |
| 4469 | memcpy(ptr, &border, 4); ptr += 4; |
| 4470 | memcpy(ptr, &format, 4); ptr += 4; |
| 4471 | memcpy(ptr, &type, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4472 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4473 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4474 | stream->flush(); |
| 4475 | stream->writeFully(&__size_pixels,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4476 | if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4477 | if (pixels != NULL) { |
| 4478 | stream->writeFully(pixels, __size_pixels); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4479 | if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4480 | } |
| 4481 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4482 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 4483 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4484 | } |
| 4485 | |
| 4486 | 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) |
| 4487 | { |
| 4488 | |
| 4489 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4490 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4491 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4492 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4493 | |
Yahan Zhou | 268e85c | 2016-02-19 13:59:34 -0800 | [diff] [blame] | 4494 | const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4495 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4496 | unsigned char *buf; |
| 4497 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; |
| 4498 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4499 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4500 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 4501 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4502 | int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4503 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4504 | |
| 4505 | memcpy(ptr, &target, 4); ptr += 4; |
| 4506 | memcpy(ptr, &level, 4); ptr += 4; |
| 4507 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 4508 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 4509 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 4510 | memcpy(ptr, &width, 4); ptr += 4; |
| 4511 | memcpy(ptr, &height, 4); ptr += 4; |
| 4512 | memcpy(ptr, &depth, 4); ptr += 4; |
| 4513 | memcpy(ptr, &format, 4); ptr += 4; |
| 4514 | memcpy(ptr, &type, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4515 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4516 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4517 | stream->flush(); |
| 4518 | stream->writeFully(&__size_pixels,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4519 | if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4520 | if (pixels != NULL) { |
| 4521 | stream->writeFully(pixels, __size_pixels); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4522 | if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4523 | } |
| 4524 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4525 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 4526 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4527 | } |
| 4528 | |
| 4529 | void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 4530 | { |
| 4531 | |
| 4532 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4533 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4534 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4535 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4536 | |
| 4537 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4538 | unsigned char *buf; |
| 4539 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 4540 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4541 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4542 | buf = stream->alloc(totalSize); |
| 4543 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4544 | int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4545 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4546 | |
| 4547 | memcpy(ptr, &target, 4); ptr += 4; |
| 4548 | memcpy(ptr, &level, 4); ptr += 4; |
| 4549 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 4550 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 4551 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 4552 | memcpy(ptr, &x, 4); ptr += 4; |
| 4553 | memcpy(ptr, &y, 4); ptr += 4; |
| 4554 | memcpy(ptr, &width, 4); ptr += 4; |
| 4555 | memcpy(ptr, &height, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4556 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4557 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4558 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4559 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4560 | } |
| 4561 | |
| 4562 | void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| 4563 | { |
| 4564 | |
| 4565 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4566 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4567 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4568 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4569 | |
Yahan Zhou | 268e85c | 2016-02-19 13:59:34 -0800 | [diff] [blame] | 4570 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4571 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4572 | unsigned char *buf; |
| 4573 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 4574 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4575 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4576 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 4577 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4578 | int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4579 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4580 | |
| 4581 | memcpy(ptr, &target, 4); ptr += 4; |
| 4582 | memcpy(ptr, &level, 4); ptr += 4; |
| 4583 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 4584 | memcpy(ptr, &width, 4); ptr += 4; |
| 4585 | memcpy(ptr, &height, 4); ptr += 4; |
| 4586 | memcpy(ptr, &depth, 4); ptr += 4; |
| 4587 | memcpy(ptr, &border, 4); ptr += 4; |
| 4588 | memcpy(ptr, &imageSize, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4589 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4590 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4591 | stream->flush(); |
| 4592 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4593 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4594 | if (data != NULL) { |
| 4595 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4596 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4597 | } |
| 4598 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4599 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 4600 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4601 | } |
| 4602 | |
| 4603 | 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) |
| 4604 | { |
| 4605 | |
| 4606 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4607 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4608 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4609 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4610 | |
Yahan Zhou | 268e85c | 2016-02-19 13:59:34 -0800 | [diff] [blame] | 4611 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4612 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4613 | unsigned char *buf; |
| 4614 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 4615 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4616 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4617 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 4618 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4619 | int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4620 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4621 | |
| 4622 | memcpy(ptr, &target, 4); ptr += 4; |
| 4623 | memcpy(ptr, &level, 4); ptr += 4; |
| 4624 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 4625 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 4626 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 4627 | memcpy(ptr, &width, 4); ptr += 4; |
| 4628 | memcpy(ptr, &height, 4); ptr += 4; |
| 4629 | memcpy(ptr, &depth, 4); ptr += 4; |
| 4630 | memcpy(ptr, &format, 4); ptr += 4; |
| 4631 | memcpy(ptr, &imageSize, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4632 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4633 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4634 | stream->flush(); |
| 4635 | stream->writeFully(&__size_data,4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4636 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4637 | if (data != NULL) { |
| 4638 | stream->writeFully(data, __size_data); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4639 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4640 | } |
| 4641 | buf = stream->alloc(checksumSize); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4642 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 4643 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4644 | } |
| 4645 | |
| 4646 | void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) |
| 4647 | { |
| 4648 | |
| 4649 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4650 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4651 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4652 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4653 | |
| 4654 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4655 | unsigned char *buf; |
| 4656 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 4657 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4658 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4659 | buf = stream->alloc(totalSize); |
| 4660 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4661 | int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4662 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4663 | |
| 4664 | memcpy(ptr, &target, 4); ptr += 4; |
| 4665 | memcpy(ptr, &attachment, 4); ptr += 4; |
| 4666 | memcpy(ptr, &textarget, 4); ptr += 4; |
| 4667 | memcpy(ptr, &texture, 4); ptr += 4; |
| 4668 | memcpy(ptr, &level, 4); ptr += 4; |
| 4669 | memcpy(ptr, &zoffset, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4670 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4671 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4672 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4673 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4674 | } |
| 4675 | |
| 4676 | void glBindVertexArrayOES_enc(void *self , GLuint array) |
| 4677 | { |
| 4678 | |
| 4679 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4680 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4681 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4682 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4683 | |
| 4684 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4685 | unsigned char *buf; |
| 4686 | const size_t sizeWithoutChecksum = 8 + 4; |
| 4687 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4688 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4689 | buf = stream->alloc(totalSize); |
| 4690 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4691 | int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4692 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4693 | |
| 4694 | memcpy(ptr, &array, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4695 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4696 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4697 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4698 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4699 | } |
| 4700 | |
| 4701 | void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays) |
| 4702 | { |
| 4703 | |
| 4704 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4705 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4706 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4707 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4708 | |
| 4709 | const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| 4710 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4711 | unsigned char *buf; |
| 4712 | const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4; |
| 4713 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4714 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4715 | buf = stream->alloc(totalSize); |
| 4716 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4717 | int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4718 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4719 | |
| 4720 | memcpy(ptr, &n, 4); ptr += 4; |
| 4721 | *(unsigned int *)(ptr) = __size_arrays; ptr += 4; |
| 4722 | memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4723 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4724 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4725 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4726 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4727 | } |
| 4728 | |
| 4729 | void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays) |
| 4730 | { |
| 4731 | |
| 4732 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4733 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4734 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4735 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4736 | |
| 4737 | const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| 4738 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4739 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4740 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4741 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4742 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4743 | buf = stream->alloc(totalSize); |
| 4744 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4745 | int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4746 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4747 | |
| 4748 | memcpy(ptr, &n, 4); ptr += 4; |
| 4749 | *(unsigned int *)(ptr) = __size_arrays; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4750 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4751 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4752 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4753 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4754 | stream->readback(arrays, __size_arrays); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4755 | if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays); |
| 4756 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4757 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4758 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4759 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 4760 | stream->readback(checksumBufPtr, checksumSize); |
| 4761 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4762 | ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n"); |
| 4763 | abort(); |
| 4764 | } |
| 4765 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4766 | } |
| 4767 | |
| 4768 | GLboolean glIsVertexArrayOES_enc(void *self , GLuint array) |
| 4769 | { |
| 4770 | |
| 4771 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4772 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4773 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4774 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4775 | |
| 4776 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4777 | unsigned char *buf; |
| 4778 | const size_t sizeWithoutChecksum = 8 + 4; |
| 4779 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4780 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4781 | buf = stream->alloc(totalSize); |
| 4782 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4783 | int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4784 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4785 | |
| 4786 | memcpy(ptr, &array, 4); ptr += 4; |
| 4787 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4788 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4789 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4790 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4791 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4792 | GLboolean retval; |
| 4793 | stream->readback(&retval, 1); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4794 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 4795 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4796 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4797 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4798 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 4799 | stream->readback(checksumBufPtr, checksumSize); |
| 4800 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4801 | ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n"); |
| 4802 | abort(); |
| 4803 | } |
| 4804 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4805 | return retval; |
| 4806 | } |
| 4807 | |
| 4808 | void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| 4809 | { |
| 4810 | |
| 4811 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4812 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4813 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4814 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4815 | |
| 4816 | const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| 4817 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4818 | unsigned char *buf; |
| 4819 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4; |
| 4820 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4821 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4822 | buf = stream->alloc(totalSize); |
| 4823 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4824 | int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4825 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4826 | |
| 4827 | memcpy(ptr, &target, 4); ptr += 4; |
| 4828 | memcpy(ptr, &numAttachments, 4); ptr += 4; |
| 4829 | *(unsigned int *)(ptr) = __size_attachments; ptr += 4; |
| 4830 | memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4831 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4832 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4833 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4834 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4835 | } |
| 4836 | |
| 4837 | void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen) |
| 4838 | { |
| 4839 | |
| 4840 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4841 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4842 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4843 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4844 | |
| 4845 | const unsigned int __size_data = datalen; |
| 4846 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4847 | unsigned char *buf; |
| 4848 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4; |
| 4849 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4850 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4851 | buf = stream->alloc(totalSize); |
| 4852 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4853 | int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4854 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4855 | |
| 4856 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4857 | memcpy(ptr, &size, 4); ptr += 4; |
| 4858 | memcpy(ptr, &type, 4); ptr += 4; |
| 4859 | memcpy(ptr, &normalized, 1); ptr += 1; |
| 4860 | memcpy(ptr, &stride, 4); ptr += 4; |
| 4861 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 4862 | glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data; |
| 4863 | memcpy(ptr, &datalen, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4864 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4865 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4866 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4867 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4868 | } |
| 4869 | |
| 4870 | void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset) |
| 4871 | { |
| 4872 | |
| 4873 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4874 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4875 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4876 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4877 | |
| 4878 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4879 | unsigned char *buf; |
| 4880 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4; |
| 4881 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4882 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4883 | buf = stream->alloc(totalSize); |
| 4884 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4885 | int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4886 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4887 | |
| 4888 | memcpy(ptr, &indx, 4); ptr += 4; |
| 4889 | memcpy(ptr, &size, 4); ptr += 4; |
| 4890 | memcpy(ptr, &type, 4); ptr += 4; |
| 4891 | memcpy(ptr, &normalized, 1); ptr += 1; |
| 4892 | memcpy(ptr, &stride, 4); ptr += 4; |
| 4893 | memcpy(ptr, &offset, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4894 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4895 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4896 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4897 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4898 | } |
| 4899 | |
| 4900 | void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset) |
| 4901 | { |
| 4902 | |
| 4903 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4904 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4905 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4906 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4907 | |
| 4908 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4909 | unsigned char *buf; |
| 4910 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 4911 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4912 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4913 | buf = stream->alloc(totalSize); |
| 4914 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4915 | int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4916 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4917 | |
| 4918 | memcpy(ptr, &mode, 4); ptr += 4; |
| 4919 | memcpy(ptr, &count, 4); ptr += 4; |
| 4920 | memcpy(ptr, &type, 4); ptr += 4; |
| 4921 | memcpy(ptr, &offset, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4922 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4923 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4924 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
Yahan Zhou | e57bd75 | 2016-06-06 12:30:39 -0700 | [diff] [blame] | 4925 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4926 | } |
| 4927 | |
| 4928 | void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen) |
| 4929 | { |
| 4930 | |
| 4931 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4932 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4933 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4934 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4935 | |
| 4936 | const unsigned int __size_data = datalen; |
| 4937 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4938 | unsigned char *buf; |
| 4939 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4; |
| 4940 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4941 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4942 | buf = stream->alloc(totalSize); |
| 4943 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4944 | int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4945 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4946 | |
| 4947 | memcpy(ptr, &mode, 4); ptr += 4; |
| 4948 | memcpy(ptr, &count, 4); ptr += 4; |
| 4949 | memcpy(ptr, &type, 4); ptr += 4; |
| 4950 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 4951 | memcpy(ptr, data, __size_data);ptr += __size_data; |
| 4952 | memcpy(ptr, &datalen, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4953 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4954 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4955 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
Yahan Zhou | e57bd75 | 2016-06-06 12:30:39 -0700 | [diff] [blame] | 4956 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4957 | } |
| 4958 | |
| 4959 | void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats) |
| 4960 | { |
| 4961 | |
| 4962 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 4963 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4964 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4965 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4966 | |
| 4967 | const unsigned int __size_formats = (count * sizeof(GLint)); |
| 4968 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4969 | unsigned char *buf; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4970 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4971 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 4972 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 4973 | buf = stream->alloc(totalSize); |
| 4974 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4975 | int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4976 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4977 | |
| 4978 | memcpy(ptr, &count, 4); ptr += 4; |
| 4979 | *(unsigned int *)(ptr) = __size_formats; ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 4980 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4981 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 4982 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 4983 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4984 | stream->readback(formats, __size_formats); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4985 | if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats); |
| 4986 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4987 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 4988 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 4989 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 4990 | stream->readback(checksumBufPtr, checksumSize); |
| 4991 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 4992 | ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n"); |
| 4993 | abort(); |
| 4994 | } |
| 4995 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 4996 | } |
| 4997 | |
| 4998 | void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len) |
| 4999 | { |
| 5000 | |
| 5001 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5002 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5003 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5004 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5005 | |
| 5006 | const unsigned int __size_string = len; |
| 5007 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5008 | unsigned char *buf; |
| 5009 | const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4; |
| 5010 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5011 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5012 | buf = stream->alloc(totalSize); |
| 5013 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5014 | int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5015 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5016 | |
| 5017 | memcpy(ptr, &shader, 4); ptr += 4; |
| 5018 | *(unsigned int *)(ptr) = __size_string; ptr += 4; |
| 5019 | memcpy(ptr, string, __size_string);ptr += __size_string; |
| 5020 | memcpy(ptr, &len, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5021 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5022 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5023 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5024 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5025 | } |
| 5026 | |
| 5027 | int glFinishRoundTrip_enc(void *self ) |
| 5028 | { |
| 5029 | |
| 5030 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5031 | IOStream *stream = ctx->m_stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5032 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5033 | bool useChecksum = checksumCalculator->getVersion() > 0; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5034 | |
| 5035 | unsigned char *ptr; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5036 | unsigned char *buf; |
| 5037 | const size_t sizeWithoutChecksum = 8; |
| 5038 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5039 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5040 | buf = stream->alloc(totalSize); |
| 5041 | ptr = buf; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5042 | int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5043 | memcpy(ptr, &totalSize, 4); ptr += 4; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5044 | |
| 5045 | |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5046 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5047 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5048 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 5049 | |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5050 | int retval; |
| 5051 | stream->readback(&retval, 4); |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5052 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 5053 | if (useChecksum) { |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 5054 | unsigned char *checksumBufPtr = NULL; |
Yurii Zubrytskyi | 1d1fc8d | 2016-11-04 11:59:27 -0700 | [diff] [blame] | 5055 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
Yahan Zhou | a9aee9f | 2016-06-17 15:06:37 -0700 | [diff] [blame] | 5056 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5057 | stream->readback(checksumBufPtr, checksumSize); |
| 5058 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Yahan Zhou | e222fd5 | 2016-03-16 12:41:08 -0700 | [diff] [blame] | 5059 | ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n"); |
| 5060 | abort(); |
| 5061 | } |
| 5062 | } |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 5063 | return retval; |
| 5064 | } |
| 5065 | |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 5066 | void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays) |
| 5067 | { |
| 5068 | |
| 5069 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5070 | IOStream *stream = ctx->m_stream; |
| 5071 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5072 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5073 | |
| 5074 | const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| 5075 | unsigned char *ptr; |
| 5076 | unsigned char *buf; |
| 5077 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 5078 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5079 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5080 | buf = stream->alloc(totalSize); |
| 5081 | ptr = buf; |
| 5082 | int tmp = OP_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5083 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5084 | |
| 5085 | memcpy(ptr, &n, 4); ptr += 4; |
| 5086 | *(unsigned int *)(ptr) = __size_arrays; ptr += 4; |
| 5087 | |
| 5088 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5089 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5090 | |
| 5091 | stream->readback(arrays, __size_arrays); |
| 5092 | if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays); |
| 5093 | if (useChecksum) { |
| 5094 | unsigned char *checksumBufPtr = NULL; |
| 5095 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5096 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5097 | stream->readback(checksumBufPtr, checksumSize); |
| 5098 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5099 | ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n"); |
| 5100 | abort(); |
| 5101 | } |
| 5102 | } |
| 5103 | } |
| 5104 | |
| 5105 | void glBindVertexArray_enc(void *self , GLuint array) |
| 5106 | { |
| 5107 | |
| 5108 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5109 | IOStream *stream = ctx->m_stream; |
| 5110 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5111 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5112 | |
| 5113 | unsigned char *ptr; |
| 5114 | unsigned char *buf; |
| 5115 | const size_t sizeWithoutChecksum = 8 + 4; |
| 5116 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5117 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5118 | buf = stream->alloc(totalSize); |
| 5119 | ptr = buf; |
| 5120 | int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5121 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5122 | |
| 5123 | memcpy(ptr, &array, 4); ptr += 4; |
| 5124 | |
| 5125 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5126 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5127 | |
| 5128 | } |
| 5129 | |
| 5130 | void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays) |
| 5131 | { |
| 5132 | |
| 5133 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5134 | IOStream *stream = ctx->m_stream; |
| 5135 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5136 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5137 | |
| 5138 | const unsigned int __size_arrays = (n * sizeof(GLuint)); |
| 5139 | unsigned char *ptr; |
| 5140 | unsigned char *buf; |
| 5141 | const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4; |
| 5142 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5143 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5144 | buf = stream->alloc(totalSize); |
| 5145 | ptr = buf; |
| 5146 | int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5147 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5148 | |
| 5149 | memcpy(ptr, &n, 4); ptr += 4; |
| 5150 | *(unsigned int *)(ptr) = __size_arrays; ptr += 4; |
| 5151 | memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays; |
| 5152 | |
| 5153 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5154 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5155 | |
| 5156 | } |
| 5157 | |
| 5158 | GLboolean glIsVertexArray_enc(void *self , GLuint array) |
| 5159 | { |
| 5160 | |
| 5161 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5162 | IOStream *stream = ctx->m_stream; |
| 5163 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5164 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5165 | |
| 5166 | unsigned char *ptr; |
| 5167 | unsigned char *buf; |
| 5168 | const size_t sizeWithoutChecksum = 8 + 4; |
| 5169 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5170 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5171 | buf = stream->alloc(totalSize); |
| 5172 | ptr = buf; |
| 5173 | int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5174 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5175 | |
| 5176 | memcpy(ptr, &array, 4); ptr += 4; |
| 5177 | |
| 5178 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5179 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5180 | |
| 5181 | |
| 5182 | GLboolean retval; |
| 5183 | stream->readback(&retval, 1); |
| 5184 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 5185 | if (useChecksum) { |
| 5186 | unsigned char *checksumBufPtr = NULL; |
| 5187 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5188 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5189 | stream->readback(checksumBufPtr, checksumSize); |
| 5190 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5191 | ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n"); |
| 5192 | abort(); |
| 5193 | } |
| 5194 | } |
| 5195 | return retval; |
| 5196 | } |
| 5197 | |
| 5198 | void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped) |
| 5199 | { |
| 5200 | |
| 5201 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5202 | IOStream *stream = ctx->m_stream; |
| 5203 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5204 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5205 | |
| 5206 | const unsigned int __size_mapped = ((mapped != NULL) ? length : 0); |
| 5207 | unsigned char *ptr; |
| 5208 | unsigned char *buf; |
| 5209 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4; |
| 5210 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5211 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5212 | buf = stream->alloc(totalSize); |
| 5213 | ptr = buf; |
| 5214 | int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5215 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5216 | |
| 5217 | memcpy(ptr, &target, 4); ptr += 4; |
| 5218 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5219 | memcpy(ptr, &length, 4); ptr += 4; |
| 5220 | memcpy(ptr, &access, 4); ptr += 4; |
| 5221 | *(unsigned int *)(ptr) = __size_mapped; ptr += 4; |
| 5222 | |
| 5223 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5224 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5225 | |
| 5226 | if (mapped != NULL) { |
| 5227 | stream->readback(mapped, __size_mapped); |
| 5228 | if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped); |
| 5229 | } |
| 5230 | if (useChecksum) { |
| 5231 | unsigned char *checksumBufPtr = NULL; |
| 5232 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5233 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5234 | stream->readback(checksumBufPtr, checksumSize); |
| 5235 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5236 | ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| 5237 | abort(); |
| 5238 | } |
| 5239 | } |
| 5240 | } |
| 5241 | |
| 5242 | void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res) |
| 5243 | { |
| 5244 | |
| 5245 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5246 | IOStream *stream = ctx->m_stream; |
| 5247 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5248 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5249 | |
| 5250 | const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| 5251 | const unsigned int __size_out_res = (sizeof(GLboolean)); |
| 5252 | unsigned char *ptr; |
| 5253 | unsigned char *buf; |
| 5254 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4; |
| 5255 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5256 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5257 | buf = stream->alloc(totalSize); |
| 5258 | ptr = buf; |
| 5259 | int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5260 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5261 | |
| 5262 | memcpy(ptr, &target, 4); ptr += 4; |
| 5263 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5264 | memcpy(ptr, &length, 4); ptr += 4; |
| 5265 | memcpy(ptr, &access, 4); ptr += 4; |
| 5266 | *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4; |
| 5267 | if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer; |
| 5268 | *(unsigned int *)(ptr) = __size_out_res; ptr += 4; |
| 5269 | |
| 5270 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5271 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5272 | |
| 5273 | stream->readback(out_res, __size_out_res); |
| 5274 | if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res); |
| 5275 | if (useChecksum) { |
| 5276 | unsigned char *checksumBufPtr = NULL; |
| 5277 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5278 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5279 | stream->readback(checksumBufPtr, checksumSize); |
| 5280 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5281 | ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| 5282 | abort(); |
| 5283 | } |
| 5284 | } |
| 5285 | } |
| 5286 | |
| 5287 | void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer) |
| 5288 | { |
| 5289 | |
| 5290 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5291 | IOStream *stream = ctx->m_stream; |
| 5292 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5293 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5294 | |
| 5295 | const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0); |
| 5296 | unsigned char *ptr; |
| 5297 | unsigned char *buf; |
| 5298 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4; |
| 5299 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5300 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5301 | buf = stream->alloc(totalSize); |
| 5302 | ptr = buf; |
| 5303 | int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5304 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5305 | |
| 5306 | memcpy(ptr, &target, 4); ptr += 4; |
| 5307 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5308 | memcpy(ptr, &length, 4); ptr += 4; |
| 5309 | memcpy(ptr, &access, 4); ptr += 4; |
| 5310 | *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4; |
| 5311 | if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer; |
| 5312 | |
| 5313 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5314 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5315 | |
| 5316 | } |
| 5317 | |
| 5318 | void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset) |
| 5319 | { |
| 5320 | |
| 5321 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5322 | IOStream *stream = ctx->m_stream; |
| 5323 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5324 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5325 | |
| 5326 | unsigned char *ptr; |
| 5327 | unsigned char *buf; |
| 5328 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 5329 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5330 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5331 | buf = stream->alloc(totalSize); |
| 5332 | ptr = buf; |
| 5333 | int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5334 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5335 | |
| 5336 | memcpy(ptr, &x, 4); ptr += 4; |
| 5337 | memcpy(ptr, &y, 4); ptr += 4; |
| 5338 | memcpy(ptr, &width, 4); ptr += 4; |
| 5339 | memcpy(ptr, &height, 4); ptr += 4; |
| 5340 | memcpy(ptr, &format, 4); ptr += 4; |
| 5341 | memcpy(ptr, &type, 4); ptr += 4; |
| 5342 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5343 | |
| 5344 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5345 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5346 | |
| 5347 | } |
| 5348 | |
| 5349 | void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset) |
| 5350 | { |
| 5351 | |
| 5352 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5353 | IOStream *stream = ctx->m_stream; |
| 5354 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5355 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5356 | |
| 5357 | unsigned char *ptr; |
| 5358 | unsigned char *buf; |
| 5359 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 5360 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5361 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5362 | buf = stream->alloc(totalSize); |
| 5363 | ptr = buf; |
| 5364 | int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5365 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5366 | |
| 5367 | memcpy(ptr, &target, 4); ptr += 4; |
| 5368 | memcpy(ptr, &level, 4); ptr += 4; |
| 5369 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 5370 | memcpy(ptr, &width, 4); ptr += 4; |
| 5371 | memcpy(ptr, &height, 4); ptr += 4; |
| 5372 | memcpy(ptr, &border, 4); ptr += 4; |
| 5373 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 5374 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5375 | |
| 5376 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5377 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5378 | |
| 5379 | } |
| 5380 | |
| 5381 | void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset) |
| 5382 | { |
| 5383 | |
| 5384 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5385 | IOStream *stream = ctx->m_stream; |
| 5386 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5387 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5388 | |
| 5389 | unsigned char *ptr; |
| 5390 | unsigned char *buf; |
| 5391 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 5392 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5393 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5394 | buf = stream->alloc(totalSize); |
| 5395 | ptr = buf; |
| 5396 | int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5397 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5398 | |
| 5399 | memcpy(ptr, &target, 4); ptr += 4; |
| 5400 | memcpy(ptr, &level, 4); ptr += 4; |
| 5401 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 5402 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 5403 | memcpy(ptr, &width, 4); ptr += 4; |
| 5404 | memcpy(ptr, &height, 4); ptr += 4; |
| 5405 | memcpy(ptr, &format, 4); ptr += 4; |
| 5406 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 5407 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5408 | |
| 5409 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5410 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5411 | |
| 5412 | } |
| 5413 | |
| 5414 | void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset) |
| 5415 | { |
| 5416 | |
| 5417 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5418 | IOStream *stream = ctx->m_stream; |
| 5419 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5420 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5421 | |
| 5422 | unsigned char *ptr; |
| 5423 | unsigned char *buf; |
| 5424 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 5425 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5426 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5427 | buf = stream->alloc(totalSize); |
| 5428 | ptr = buf; |
| 5429 | int tmp = OP_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5430 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5431 | |
| 5432 | memcpy(ptr, &target, 4); ptr += 4; |
| 5433 | memcpy(ptr, &level, 4); ptr += 4; |
| 5434 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 5435 | memcpy(ptr, &width, 4); ptr += 4; |
| 5436 | memcpy(ptr, &height, 4); ptr += 4; |
| 5437 | memcpy(ptr, &border, 4); ptr += 4; |
| 5438 | memcpy(ptr, &format, 4); ptr += 4; |
| 5439 | memcpy(ptr, &type, 4); ptr += 4; |
| 5440 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5441 | |
| 5442 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5443 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5444 | |
| 5445 | } |
| 5446 | |
| 5447 | void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset) |
| 5448 | { |
| 5449 | |
| 5450 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5451 | IOStream *stream = ctx->m_stream; |
| 5452 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5453 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5454 | |
| 5455 | unsigned char *ptr; |
| 5456 | unsigned char *buf; |
| 5457 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 5458 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5459 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5460 | buf = stream->alloc(totalSize); |
| 5461 | ptr = buf; |
| 5462 | int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5463 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5464 | |
| 5465 | memcpy(ptr, &target, 4); ptr += 4; |
| 5466 | memcpy(ptr, &level, 4); ptr += 4; |
| 5467 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 5468 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 5469 | memcpy(ptr, &width, 4); ptr += 4; |
| 5470 | memcpy(ptr, &height, 4); ptr += 4; |
| 5471 | memcpy(ptr, &format, 4); ptr += 4; |
| 5472 | memcpy(ptr, &type, 4); ptr += 4; |
| 5473 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5474 | |
| 5475 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5476 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5477 | |
| 5478 | } |
| 5479 | |
| 5480 | void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| 5481 | { |
| 5482 | |
| 5483 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5484 | IOStream *stream = ctx->m_stream; |
| 5485 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5486 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5487 | |
| 5488 | unsigned char *ptr; |
| 5489 | unsigned char *buf; |
| 5490 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 5491 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5492 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5493 | buf = stream->alloc(totalSize); |
| 5494 | ptr = buf; |
| 5495 | int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5496 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5497 | |
| 5498 | memcpy(ptr, &target, 4); ptr += 4; |
| 5499 | memcpy(ptr, &index, 4); ptr += 4; |
| 5500 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5501 | memcpy(ptr, &offset, 4); ptr += 4; |
| 5502 | memcpy(ptr, &size, 4); ptr += 4; |
| 5503 | |
| 5504 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5505 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5506 | |
| 5507 | } |
| 5508 | |
| 5509 | void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer) |
| 5510 | { |
| 5511 | |
| 5512 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5513 | IOStream *stream = ctx->m_stream; |
| 5514 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5515 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5516 | |
| 5517 | unsigned char *ptr; |
| 5518 | unsigned char *buf; |
| 5519 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 5520 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5521 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5522 | buf = stream->alloc(totalSize); |
| 5523 | ptr = buf; |
| 5524 | int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5525 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5526 | |
| 5527 | memcpy(ptr, &target, 4); ptr += 4; |
| 5528 | memcpy(ptr, &index, 4); ptr += 4; |
| 5529 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5530 | |
| 5531 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5532 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5533 | |
| 5534 | } |
| 5535 | |
| 5536 | void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size) |
| 5537 | { |
| 5538 | |
| 5539 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5540 | IOStream *stream = ctx->m_stream; |
| 5541 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5542 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5543 | |
| 5544 | unsigned char *ptr; |
| 5545 | unsigned char *buf; |
| 5546 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 5547 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5548 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5549 | buf = stream->alloc(totalSize); |
| 5550 | ptr = buf; |
| 5551 | int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5552 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5553 | |
| 5554 | memcpy(ptr, &readtarget, 4); ptr += 4; |
| 5555 | memcpy(ptr, &writetarget, 4); ptr += 4; |
| 5556 | memcpy(ptr, &readoffset, 4); ptr += 4; |
| 5557 | memcpy(ptr, &writeoffset, 4); ptr += 4; |
| 5558 | memcpy(ptr, &size, 4); ptr += 4; |
| 5559 | |
| 5560 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5561 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5562 | |
| 5563 | stream->flush(); |
| 5564 | } |
| 5565 | |
| 5566 | void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value) |
| 5567 | { |
| 5568 | |
| 5569 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5570 | IOStream *stream = ctx->m_stream; |
| 5571 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5572 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5573 | |
| 5574 | const unsigned int __size_value = (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| 5575 | unsigned char *ptr; |
| 5576 | unsigned char *buf; |
| 5577 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 5578 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5579 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5580 | buf = stream->alloc(totalSize); |
| 5581 | ptr = buf; |
| 5582 | int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5583 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5584 | |
| 5585 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5586 | memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| 5587 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 5588 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 5589 | |
| 5590 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5591 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5592 | |
| 5593 | } |
| 5594 | |
| 5595 | void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value) |
| 5596 | { |
| 5597 | |
| 5598 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5599 | IOStream *stream = ctx->m_stream; |
| 5600 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5601 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5602 | |
| 5603 | const unsigned int __size_value = (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| 5604 | unsigned char *ptr; |
| 5605 | unsigned char *buf; |
| 5606 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 5607 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5608 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5609 | buf = stream->alloc(totalSize); |
| 5610 | ptr = buf; |
| 5611 | int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5612 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5613 | |
| 5614 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5615 | memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| 5616 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 5617 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 5618 | |
| 5619 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5620 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5621 | |
| 5622 | } |
| 5623 | |
| 5624 | void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value) |
| 5625 | { |
| 5626 | |
| 5627 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5628 | IOStream *stream = ctx->m_stream; |
| 5629 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5630 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5631 | |
| 5632 | const unsigned int __size_value = (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer)); |
| 5633 | unsigned char *ptr; |
| 5634 | unsigned char *buf; |
| 5635 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 5636 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5637 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5638 | buf = stream->alloc(totalSize); |
| 5639 | ptr = buf; |
| 5640 | int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5641 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5642 | |
| 5643 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5644 | memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| 5645 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 5646 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 5647 | |
| 5648 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5649 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5650 | |
| 5651 | } |
| 5652 | |
| 5653 | void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil) |
| 5654 | { |
| 5655 | |
| 5656 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5657 | IOStream *stream = ctx->m_stream; |
| 5658 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5659 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5660 | |
| 5661 | unsigned char *ptr; |
| 5662 | unsigned char *buf; |
| 5663 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 5664 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5665 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5666 | buf = stream->alloc(totalSize); |
| 5667 | ptr = buf; |
| 5668 | int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5669 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5670 | |
| 5671 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 5672 | memcpy(ptr, &drawBuffer, 4); ptr += 4; |
| 5673 | memcpy(ptr, &depth, 4); ptr += 4; |
| 5674 | memcpy(ptr, &stencil, 4); ptr += 4; |
| 5675 | |
| 5676 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5677 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5678 | |
| 5679 | } |
| 5680 | |
| 5681 | void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
| 5682 | { |
| 5683 | |
| 5684 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5685 | IOStream *stream = ctx->m_stream; |
| 5686 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5687 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5688 | |
| 5689 | unsigned char *ptr; |
| 5690 | unsigned char *buf; |
| 5691 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 5692 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5693 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5694 | buf = stream->alloc(totalSize); |
| 5695 | ptr = buf; |
| 5696 | int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5697 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5698 | |
| 5699 | memcpy(ptr, &program, 4); ptr += 4; |
| 5700 | memcpy(ptr, &uniformBlockIndex, 4); ptr += 4; |
| 5701 | memcpy(ptr, &uniformBlockBinding, 4); ptr += 4; |
| 5702 | |
| 5703 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5704 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5705 | |
| 5706 | } |
| 5707 | |
| 5708 | GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName) |
| 5709 | { |
| 5710 | |
| 5711 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5712 | IOStream *stream = ctx->m_stream; |
| 5713 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5714 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5715 | |
| 5716 | const unsigned int __size_uniformBlockName = (strlen(uniformBlockName) + 1); |
| 5717 | unsigned char *ptr; |
| 5718 | unsigned char *buf; |
| 5719 | const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4; |
| 5720 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5721 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5722 | buf = stream->alloc(totalSize); |
| 5723 | ptr = buf; |
| 5724 | int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5725 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5726 | |
| 5727 | memcpy(ptr, &program, 4); ptr += 4; |
| 5728 | *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4; |
| 5729 | memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName; |
| 5730 | |
| 5731 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5732 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5733 | |
| 5734 | |
| 5735 | GLuint retval; |
| 5736 | stream->readback(&retval, 4); |
| 5737 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 5738 | if (useChecksum) { |
| 5739 | unsigned char *checksumBufPtr = NULL; |
| 5740 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5741 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5742 | stream->readback(checksumBufPtr, checksumSize); |
| 5743 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5744 | ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n"); |
| 5745 | abort(); |
| 5746 | } |
| 5747 | } |
| 5748 | return retval; |
| 5749 | } |
| 5750 | |
| 5751 | void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices) |
| 5752 | { |
| 5753 | |
| 5754 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5755 | IOStream *stream = ctx->m_stream; |
| 5756 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5757 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5758 | |
| 5759 | const unsigned int __size_packedUniformNames = packedLen; |
| 5760 | const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint)); |
| 5761 | unsigned char *ptr; |
| 5762 | unsigned char *buf; |
| 5763 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4; |
| 5764 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5765 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5766 | buf = stream->alloc(totalSize); |
| 5767 | ptr = buf; |
| 5768 | int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5769 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5770 | |
| 5771 | memcpy(ptr, &program, 4); ptr += 4; |
| 5772 | memcpy(ptr, &uniformCount, 4); ptr += 4; |
| 5773 | *(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4; |
| 5774 | memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames; |
| 5775 | memcpy(ptr, &packedLen, 4); ptr += 4; |
| 5776 | *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4; |
| 5777 | |
| 5778 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5779 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5780 | |
| 5781 | stream->readback(uniformIndices, __size_uniformIndices); |
| 5782 | if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices); |
| 5783 | if (useChecksum) { |
| 5784 | unsigned char *checksumBufPtr = NULL; |
| 5785 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5786 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5787 | stream->readback(checksumBufPtr, checksumSize); |
| 5788 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5789 | ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| 5790 | abort(); |
| 5791 | } |
| 5792 | } |
| 5793 | } |
| 5794 | |
| 5795 | void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) |
| 5796 | { |
| 5797 | |
| 5798 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5799 | IOStream *stream = ctx->m_stream; |
| 5800 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5801 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5802 | |
| 5803 | const unsigned int __size_params = (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint)); |
| 5804 | unsigned char *ptr; |
| 5805 | unsigned char *buf; |
| 5806 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4; |
| 5807 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5808 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5809 | buf = stream->alloc(totalSize); |
| 5810 | ptr = buf; |
| 5811 | int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5812 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5813 | |
| 5814 | memcpy(ptr, &program, 4); ptr += 4; |
| 5815 | memcpy(ptr, &uniformBlockIndex, 4); ptr += 4; |
| 5816 | memcpy(ptr, &pname, 4); ptr += 4; |
| 5817 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 5818 | |
| 5819 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5820 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5821 | |
| 5822 | stream->readback(params, __size_params); |
| 5823 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 5824 | if (useChecksum) { |
| 5825 | unsigned char *checksumBufPtr = NULL; |
| 5826 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5827 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5828 | stream->readback(checksumBufPtr, checksumSize); |
| 5829 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5830 | ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n"); |
| 5831 | abort(); |
| 5832 | } |
| 5833 | } |
| 5834 | } |
| 5835 | |
| 5836 | void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) |
| 5837 | { |
| 5838 | |
| 5839 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5840 | IOStream *stream = ctx->m_stream; |
| 5841 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5842 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5843 | |
| 5844 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 5845 | const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ? bufSize : 0); |
| 5846 | unsigned char *ptr; |
| 5847 | unsigned char *buf; |
| 5848 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4; |
| 5849 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5850 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5851 | buf = stream->alloc(totalSize); |
| 5852 | ptr = buf; |
| 5853 | int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5854 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5855 | |
| 5856 | memcpy(ptr, &program, 4); ptr += 4; |
| 5857 | memcpy(ptr, &uniformBlockIndex, 4); ptr += 4; |
| 5858 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 5859 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 5860 | *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4; |
| 5861 | |
| 5862 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5863 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5864 | |
| 5865 | if (length != NULL) { |
| 5866 | stream->readback(length, __size_length); |
| 5867 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 5868 | } |
| 5869 | if (uniformBlockName != NULL) { |
| 5870 | stream->readback(uniformBlockName, __size_uniformBlockName); |
| 5871 | if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName); |
| 5872 | } |
| 5873 | if (useChecksum) { |
| 5874 | unsigned char *checksumBufPtr = NULL; |
| 5875 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 5876 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 5877 | stream->readback(checksumBufPtr, checksumSize); |
| 5878 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 5879 | ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n"); |
| 5880 | abort(); |
| 5881 | } |
| 5882 | } |
| 5883 | } |
| 5884 | |
| 5885 | void glUniform1ui_enc(void *self , GLint location, GLuint v0) |
| 5886 | { |
| 5887 | |
| 5888 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5889 | IOStream *stream = ctx->m_stream; |
| 5890 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5891 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5892 | |
| 5893 | unsigned char *ptr; |
| 5894 | unsigned char *buf; |
| 5895 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 5896 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5897 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5898 | buf = stream->alloc(totalSize); |
| 5899 | ptr = buf; |
| 5900 | int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5901 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5902 | |
| 5903 | memcpy(ptr, &location, 4); ptr += 4; |
| 5904 | memcpy(ptr, &v0, 4); ptr += 4; |
| 5905 | |
| 5906 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5907 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5908 | |
| 5909 | } |
| 5910 | |
| 5911 | void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1) |
| 5912 | { |
| 5913 | |
| 5914 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5915 | IOStream *stream = ctx->m_stream; |
| 5916 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5917 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5918 | |
| 5919 | unsigned char *ptr; |
| 5920 | unsigned char *buf; |
| 5921 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 5922 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5923 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5924 | buf = stream->alloc(totalSize); |
| 5925 | ptr = buf; |
| 5926 | int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5927 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5928 | |
| 5929 | memcpy(ptr, &location, 4); ptr += 4; |
| 5930 | memcpy(ptr, &v0, 4); ptr += 4; |
| 5931 | memcpy(ptr, &v1, 4); ptr += 4; |
| 5932 | |
| 5933 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5934 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5935 | |
| 5936 | } |
| 5937 | |
| 5938 | void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2) |
| 5939 | { |
| 5940 | |
| 5941 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5942 | IOStream *stream = ctx->m_stream; |
| 5943 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5944 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5945 | |
| 5946 | unsigned char *ptr; |
| 5947 | unsigned char *buf; |
| 5948 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 5949 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5950 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5951 | buf = stream->alloc(totalSize); |
| 5952 | ptr = buf; |
| 5953 | int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5954 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5955 | |
| 5956 | memcpy(ptr, &location, 4); ptr += 4; |
| 5957 | memcpy(ptr, &v0, 4); ptr += 4; |
| 5958 | memcpy(ptr, &v1, 4); ptr += 4; |
| 5959 | memcpy(ptr, &v2, 4); ptr += 4; |
| 5960 | |
| 5961 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5962 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5963 | |
| 5964 | } |
| 5965 | |
| 5966 | void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3) |
| 5967 | { |
| 5968 | |
| 5969 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5970 | IOStream *stream = ctx->m_stream; |
| 5971 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 5972 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 5973 | |
| 5974 | unsigned char *ptr; |
| 5975 | unsigned char *buf; |
| 5976 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 5977 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 5978 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 5979 | buf = stream->alloc(totalSize); |
| 5980 | ptr = buf; |
| 5981 | int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 5982 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 5983 | |
| 5984 | memcpy(ptr, &location, 4); ptr += 4; |
| 5985 | memcpy(ptr, &v0, 4); ptr += 4; |
| 5986 | memcpy(ptr, &v1, 4); ptr += 4; |
| 5987 | memcpy(ptr, &v2, 4); ptr += 4; |
| 5988 | memcpy(ptr, &v3, 4); ptr += 4; |
| 5989 | |
| 5990 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 5991 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 5992 | |
| 5993 | } |
| 5994 | |
| 5995 | void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| 5996 | { |
| 5997 | |
| 5998 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 5999 | IOStream *stream = ctx->m_stream; |
| 6000 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6001 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6002 | |
| 6003 | const unsigned int __size_value = (count * sizeof(GLuint)); |
| 6004 | unsigned char *ptr; |
| 6005 | unsigned char *buf; |
| 6006 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 6007 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6008 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6009 | buf = stream->alloc(totalSize); |
| 6010 | ptr = buf; |
| 6011 | int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6012 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6013 | |
| 6014 | memcpy(ptr, &location, 4); ptr += 4; |
| 6015 | memcpy(ptr, &count, 4); ptr += 4; |
| 6016 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6017 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6018 | |
| 6019 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6020 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6021 | |
| 6022 | } |
| 6023 | |
| 6024 | void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| 6025 | { |
| 6026 | |
| 6027 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6028 | IOStream *stream = ctx->m_stream; |
| 6029 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6030 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6031 | |
| 6032 | const unsigned int __size_value = (count * 2 * sizeof(GLuint)); |
| 6033 | unsigned char *ptr; |
| 6034 | unsigned char *buf; |
| 6035 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 6036 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6037 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6038 | buf = stream->alloc(totalSize); |
| 6039 | ptr = buf; |
| 6040 | int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6041 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6042 | |
| 6043 | memcpy(ptr, &location, 4); ptr += 4; |
| 6044 | memcpy(ptr, &count, 4); ptr += 4; |
| 6045 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6046 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6047 | |
| 6048 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6049 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6050 | |
| 6051 | } |
| 6052 | |
| 6053 | void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| 6054 | { |
| 6055 | |
| 6056 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6057 | IOStream *stream = ctx->m_stream; |
| 6058 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6059 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6060 | |
| 6061 | const unsigned int __size_value = (count * 3 * sizeof(GLuint)); |
| 6062 | unsigned char *ptr; |
| 6063 | unsigned char *buf; |
| 6064 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 6065 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6066 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6067 | buf = stream->alloc(totalSize); |
| 6068 | ptr = buf; |
| 6069 | int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6070 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6071 | |
| 6072 | memcpy(ptr, &location, 4); ptr += 4; |
| 6073 | memcpy(ptr, &count, 4); ptr += 4; |
| 6074 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6075 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6076 | |
| 6077 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6078 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6079 | |
| 6080 | } |
| 6081 | |
| 6082 | void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value) |
| 6083 | { |
| 6084 | |
| 6085 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6086 | IOStream *stream = ctx->m_stream; |
| 6087 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6088 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6089 | |
| 6090 | const unsigned int __size_value = (count * 4 * sizeof(GLuint)); |
| 6091 | unsigned char *ptr; |
| 6092 | unsigned char *buf; |
| 6093 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4; |
| 6094 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6095 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6096 | buf = stream->alloc(totalSize); |
| 6097 | ptr = buf; |
| 6098 | int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6099 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6100 | |
| 6101 | memcpy(ptr, &location, 4); ptr += 4; |
| 6102 | memcpy(ptr, &count, 4); ptr += 4; |
| 6103 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6104 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6105 | |
| 6106 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6107 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6108 | |
| 6109 | } |
| 6110 | |
| 6111 | void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6112 | { |
| 6113 | |
| 6114 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6115 | IOStream *stream = ctx->m_stream; |
| 6116 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6117 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6118 | |
| 6119 | const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| 6120 | unsigned char *ptr; |
| 6121 | unsigned char *buf; |
| 6122 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6123 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6124 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6125 | buf = stream->alloc(totalSize); |
| 6126 | ptr = buf; |
| 6127 | int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6128 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6129 | |
| 6130 | memcpy(ptr, &location, 4); ptr += 4; |
| 6131 | memcpy(ptr, &count, 4); ptr += 4; |
| 6132 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6133 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6134 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6135 | |
| 6136 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6137 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6138 | |
| 6139 | } |
| 6140 | |
| 6141 | void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6142 | { |
| 6143 | |
| 6144 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6145 | IOStream *stream = ctx->m_stream; |
| 6146 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6147 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6148 | |
| 6149 | const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| 6150 | unsigned char *ptr; |
| 6151 | unsigned char *buf; |
| 6152 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6153 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6154 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6155 | buf = stream->alloc(totalSize); |
| 6156 | ptr = buf; |
| 6157 | int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6158 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6159 | |
| 6160 | memcpy(ptr, &location, 4); ptr += 4; |
| 6161 | memcpy(ptr, &count, 4); ptr += 4; |
| 6162 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6163 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6164 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6165 | |
| 6166 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6167 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6168 | |
| 6169 | } |
| 6170 | |
| 6171 | void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6172 | { |
| 6173 | |
| 6174 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6175 | IOStream *stream = ctx->m_stream; |
| 6176 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6177 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6178 | |
| 6179 | const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| 6180 | unsigned char *ptr; |
| 6181 | unsigned char *buf; |
| 6182 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6183 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6184 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6185 | buf = stream->alloc(totalSize); |
| 6186 | ptr = buf; |
| 6187 | int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6188 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6189 | |
| 6190 | memcpy(ptr, &location, 4); ptr += 4; |
| 6191 | memcpy(ptr, &count, 4); ptr += 4; |
| 6192 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6193 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6194 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6195 | |
| 6196 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6197 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6198 | |
| 6199 | } |
| 6200 | |
| 6201 | void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6202 | { |
| 6203 | |
| 6204 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6205 | IOStream *stream = ctx->m_stream; |
| 6206 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6207 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6208 | |
| 6209 | const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| 6210 | unsigned char *ptr; |
| 6211 | unsigned char *buf; |
| 6212 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6213 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6214 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6215 | buf = stream->alloc(totalSize); |
| 6216 | ptr = buf; |
| 6217 | int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6218 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6219 | |
| 6220 | memcpy(ptr, &location, 4); ptr += 4; |
| 6221 | memcpy(ptr, &count, 4); ptr += 4; |
| 6222 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6223 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6224 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6225 | |
| 6226 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6227 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6228 | |
| 6229 | } |
| 6230 | |
| 6231 | void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6232 | { |
| 6233 | |
| 6234 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6235 | IOStream *stream = ctx->m_stream; |
| 6236 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6237 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6238 | |
| 6239 | const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| 6240 | unsigned char *ptr; |
| 6241 | unsigned char *buf; |
| 6242 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6243 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6244 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6245 | buf = stream->alloc(totalSize); |
| 6246 | ptr = buf; |
| 6247 | int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6248 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6249 | |
| 6250 | memcpy(ptr, &location, 4); ptr += 4; |
| 6251 | memcpy(ptr, &count, 4); ptr += 4; |
| 6252 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6253 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6254 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6255 | |
| 6256 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6257 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6258 | |
| 6259 | } |
| 6260 | |
| 6261 | void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 6262 | { |
| 6263 | |
| 6264 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6265 | IOStream *stream = ctx->m_stream; |
| 6266 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6267 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6268 | |
| 6269 | const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| 6270 | unsigned char *ptr; |
| 6271 | unsigned char *buf; |
| 6272 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4; |
| 6273 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6274 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6275 | buf = stream->alloc(totalSize); |
| 6276 | ptr = buf; |
| 6277 | int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6278 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6279 | |
| 6280 | memcpy(ptr, &location, 4); ptr += 4; |
| 6281 | memcpy(ptr, &count, 4); ptr += 4; |
| 6282 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 6283 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 6284 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 6285 | |
| 6286 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6287 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6288 | |
| 6289 | } |
| 6290 | |
| 6291 | void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params) |
| 6292 | { |
| 6293 | |
| 6294 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6295 | IOStream *stream = ctx->m_stream; |
| 6296 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6297 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6298 | |
| 6299 | const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location)); |
| 6300 | unsigned char *ptr; |
| 6301 | unsigned char *buf; |
| 6302 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 6303 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6304 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6305 | buf = stream->alloc(totalSize); |
| 6306 | ptr = buf; |
| 6307 | int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6308 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6309 | |
| 6310 | memcpy(ptr, &program, 4); ptr += 4; |
| 6311 | memcpy(ptr, &location, 4); ptr += 4; |
| 6312 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 6313 | |
| 6314 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6315 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6316 | |
| 6317 | stream->readback(params, __size_params); |
| 6318 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 6319 | if (useChecksum) { |
| 6320 | unsigned char *checksumBufPtr = NULL; |
| 6321 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6322 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6323 | stream->readback(checksumBufPtr, checksumSize); |
| 6324 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 6325 | ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n"); |
| 6326 | abort(); |
| 6327 | } |
| 6328 | } |
| 6329 | } |
| 6330 | |
| 6331 | void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) |
| 6332 | { |
| 6333 | |
| 6334 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6335 | IOStream *stream = ctx->m_stream; |
| 6336 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6337 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6338 | |
| 6339 | const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint)); |
| 6340 | const unsigned int __size_params = (uniformCount * sizeof(GLint)); |
| 6341 | unsigned char *ptr; |
| 6342 | unsigned char *buf; |
| 6343 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4; |
| 6344 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6345 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6346 | buf = stream->alloc(totalSize); |
| 6347 | ptr = buf; |
| 6348 | int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6349 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6350 | |
| 6351 | memcpy(ptr, &program, 4); ptr += 4; |
| 6352 | memcpy(ptr, &uniformCount, 4); ptr += 4; |
| 6353 | *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4; |
| 6354 | memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices; |
| 6355 | memcpy(ptr, &pname, 4); ptr += 4; |
| 6356 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 6357 | |
| 6358 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6359 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6360 | |
| 6361 | stream->readback(params, __size_params); |
| 6362 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 6363 | if (useChecksum) { |
| 6364 | unsigned char *checksumBufPtr = NULL; |
| 6365 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6366 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6367 | stream->readback(checksumBufPtr, checksumSize); |
| 6368 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 6369 | ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n"); |
| 6370 | abort(); |
| 6371 | } |
| 6372 | } |
| 6373 | } |
| 6374 | |
| 6375 | void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) |
| 6376 | { |
| 6377 | |
| 6378 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6379 | IOStream *stream = ctx->m_stream; |
| 6380 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6381 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6382 | |
| 6383 | unsigned char *ptr; |
| 6384 | unsigned char *buf; |
| 6385 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 6386 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6387 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6388 | buf = stream->alloc(totalSize); |
| 6389 | ptr = buf; |
| 6390 | int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6391 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6392 | |
| 6393 | memcpy(ptr, &index, 4); ptr += 4; |
| 6394 | memcpy(ptr, &v0, 4); ptr += 4; |
| 6395 | memcpy(ptr, &v1, 4); ptr += 4; |
| 6396 | memcpy(ptr, &v2, 4); ptr += 4; |
| 6397 | memcpy(ptr, &v3, 4); ptr += 4; |
| 6398 | |
| 6399 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6400 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6401 | |
| 6402 | } |
| 6403 | |
| 6404 | void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) |
| 6405 | { |
| 6406 | |
| 6407 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6408 | IOStream *stream = ctx->m_stream; |
| 6409 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6410 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6411 | |
| 6412 | unsigned char *ptr; |
| 6413 | unsigned char *buf; |
| 6414 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 6415 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6416 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6417 | buf = stream->alloc(totalSize); |
| 6418 | ptr = buf; |
| 6419 | int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6420 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6421 | |
| 6422 | memcpy(ptr, &index, 4); ptr += 4; |
| 6423 | memcpy(ptr, &v0, 4); ptr += 4; |
| 6424 | memcpy(ptr, &v1, 4); ptr += 4; |
| 6425 | memcpy(ptr, &v2, 4); ptr += 4; |
| 6426 | memcpy(ptr, &v3, 4); ptr += 4; |
| 6427 | |
| 6428 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6429 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6430 | |
| 6431 | } |
| 6432 | |
| 6433 | void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v) |
| 6434 | { |
| 6435 | |
| 6436 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6437 | IOStream *stream = ctx->m_stream; |
| 6438 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6439 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6440 | |
| 6441 | const unsigned int __size_v = (4 * sizeof(GLint)); |
| 6442 | unsigned char *ptr; |
| 6443 | unsigned char *buf; |
| 6444 | const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4; |
| 6445 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6446 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6447 | buf = stream->alloc(totalSize); |
| 6448 | ptr = buf; |
| 6449 | int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6450 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6451 | |
| 6452 | memcpy(ptr, &index, 4); ptr += 4; |
| 6453 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 6454 | memcpy(ptr, v, __size_v);ptr += __size_v; |
| 6455 | |
| 6456 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6457 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6458 | |
| 6459 | } |
| 6460 | |
| 6461 | void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v) |
| 6462 | { |
| 6463 | |
| 6464 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6465 | IOStream *stream = ctx->m_stream; |
| 6466 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6467 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6468 | |
| 6469 | const unsigned int __size_v = (4 * sizeof(GLuint)); |
| 6470 | unsigned char *ptr; |
| 6471 | unsigned char *buf; |
| 6472 | const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4; |
| 6473 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6474 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6475 | buf = stream->alloc(totalSize); |
| 6476 | ptr = buf; |
| 6477 | int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6478 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6479 | |
| 6480 | memcpy(ptr, &index, 4); ptr += 4; |
| 6481 | *(unsigned int *)(ptr) = __size_v; ptr += 4; |
| 6482 | memcpy(ptr, v, __size_v);ptr += __size_v; |
| 6483 | |
| 6484 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6485 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6486 | |
| 6487 | } |
| 6488 | |
| 6489 | void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset) |
| 6490 | { |
| 6491 | |
| 6492 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6493 | IOStream *stream = ctx->m_stream; |
| 6494 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6495 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6496 | |
| 6497 | unsigned char *ptr; |
| 6498 | unsigned char *buf; |
| 6499 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 6500 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6501 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6502 | buf = stream->alloc(totalSize); |
| 6503 | ptr = buf; |
| 6504 | int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6505 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6506 | |
| 6507 | memcpy(ptr, &index, 4); ptr += 4; |
| 6508 | memcpy(ptr, &size, 4); ptr += 4; |
| 6509 | memcpy(ptr, &type, 4); ptr += 4; |
| 6510 | memcpy(ptr, &stride, 4); ptr += 4; |
| 6511 | memcpy(ptr, &offset, 4); ptr += 4; |
| 6512 | |
| 6513 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6514 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6515 | |
| 6516 | } |
| 6517 | |
| 6518 | void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen) |
| 6519 | { |
| 6520 | |
| 6521 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6522 | IOStream *stream = ctx->m_stream; |
| 6523 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6524 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6525 | |
| 6526 | const unsigned int __size_data = datalen; |
| 6527 | unsigned char *ptr; |
| 6528 | unsigned char *buf; |
| 6529 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4; |
| 6530 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6531 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6532 | buf = stream->alloc(totalSize); |
| 6533 | ptr = buf; |
| 6534 | int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6535 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6536 | |
| 6537 | memcpy(ptr, &index, 4); ptr += 4; |
| 6538 | memcpy(ptr, &size, 4); ptr += 4; |
| 6539 | memcpy(ptr, &type, 4); ptr += 4; |
| 6540 | memcpy(ptr, &stride, 4); ptr += 4; |
| 6541 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 6542 | glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data; |
| 6543 | memcpy(ptr, &datalen, 4); ptr += 4; |
| 6544 | |
| 6545 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6546 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6547 | |
| 6548 | } |
| 6549 | |
| 6550 | void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params) |
| 6551 | { |
| 6552 | |
| 6553 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6554 | IOStream *stream = ctx->m_stream; |
| 6555 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6556 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6557 | |
| 6558 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 6559 | unsigned char *ptr; |
| 6560 | unsigned char *buf; |
| 6561 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 6562 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6563 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6564 | buf = stream->alloc(totalSize); |
| 6565 | ptr = buf; |
| 6566 | int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6567 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6568 | |
| 6569 | memcpy(ptr, &index, 4); ptr += 4; |
| 6570 | memcpy(ptr, &pname, 4); ptr += 4; |
| 6571 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 6572 | |
| 6573 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6574 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6575 | |
| 6576 | stream->readback(params, __size_params); |
| 6577 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 6578 | if (useChecksum) { |
| 6579 | unsigned char *checksumBufPtr = NULL; |
| 6580 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6581 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6582 | stream->readback(checksumBufPtr, checksumSize); |
| 6583 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 6584 | ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n"); |
| 6585 | abort(); |
| 6586 | } |
| 6587 | } |
| 6588 | } |
| 6589 | |
| 6590 | void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params) |
| 6591 | { |
| 6592 | |
| 6593 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6594 | IOStream *stream = ctx->m_stream; |
| 6595 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6596 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6597 | |
| 6598 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint)); |
| 6599 | unsigned char *ptr; |
| 6600 | unsigned char *buf; |
| 6601 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 6602 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6603 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6604 | buf = stream->alloc(totalSize); |
| 6605 | ptr = buf; |
| 6606 | int tmp = OP_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6607 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6608 | |
| 6609 | memcpy(ptr, &index, 4); ptr += 4; |
| 6610 | memcpy(ptr, &pname, 4); ptr += 4; |
| 6611 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 6612 | |
| 6613 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6614 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6615 | |
| 6616 | stream->readback(params, __size_params); |
| 6617 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 6618 | if (useChecksum) { |
| 6619 | unsigned char *checksumBufPtr = NULL; |
| 6620 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6621 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6622 | stream->readback(checksumBufPtr, checksumSize); |
| 6623 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 6624 | ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n"); |
| 6625 | abort(); |
| 6626 | } |
| 6627 | } |
| 6628 | } |
| 6629 | |
| 6630 | void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor) |
| 6631 | { |
| 6632 | |
| 6633 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6634 | IOStream *stream = ctx->m_stream; |
| 6635 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6636 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6637 | |
| 6638 | unsigned char *ptr; |
| 6639 | unsigned char *buf; |
| 6640 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 6641 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6642 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6643 | buf = stream->alloc(totalSize); |
| 6644 | ptr = buf; |
| 6645 | int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6646 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6647 | |
| 6648 | memcpy(ptr, &index, 4); ptr += 4; |
| 6649 | memcpy(ptr, &divisor, 4); ptr += 4; |
| 6650 | |
| 6651 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6652 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6653 | |
| 6654 | } |
| 6655 | |
| 6656 | void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| 6657 | { |
| 6658 | |
| 6659 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6660 | IOStream *stream = ctx->m_stream; |
| 6661 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6662 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6663 | |
| 6664 | unsigned char *ptr; |
| 6665 | unsigned char *buf; |
| 6666 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 6667 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6668 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6669 | buf = stream->alloc(totalSize); |
| 6670 | ptr = buf; |
| 6671 | int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6672 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6673 | |
| 6674 | memcpy(ptr, &mode, 4); ptr += 4; |
| 6675 | memcpy(ptr, &first, 4); ptr += 4; |
| 6676 | memcpy(ptr, &count, 4); ptr += 4; |
| 6677 | memcpy(ptr, &primcount, 4); ptr += 4; |
| 6678 | |
| 6679 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6680 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6681 | |
| 6682 | } |
| 6683 | |
| 6684 | void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen) |
| 6685 | { |
| 6686 | |
| 6687 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6688 | IOStream *stream = ctx->m_stream; |
| 6689 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6690 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6691 | |
| 6692 | const unsigned int __size_indices = datalen; |
| 6693 | unsigned char *ptr; |
| 6694 | unsigned char *buf; |
| 6695 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4; |
| 6696 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6697 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6698 | buf = stream->alloc(totalSize); |
| 6699 | ptr = buf; |
| 6700 | int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6701 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6702 | |
| 6703 | memcpy(ptr, &mode, 4); ptr += 4; |
| 6704 | memcpy(ptr, &count, 4); ptr += 4; |
| 6705 | memcpy(ptr, &type, 4); ptr += 4; |
| 6706 | *(unsigned int *)(ptr) = __size_indices; ptr += 4; |
| 6707 | memcpy(ptr, indices, __size_indices);ptr += __size_indices; |
| 6708 | memcpy(ptr, &primcount, 4); ptr += 4; |
| 6709 | memcpy(ptr, &datalen, 4); ptr += 4; |
| 6710 | |
| 6711 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6712 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6713 | |
| 6714 | } |
| 6715 | |
| 6716 | void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount) |
| 6717 | { |
| 6718 | |
| 6719 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6720 | IOStream *stream = ctx->m_stream; |
| 6721 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6722 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6723 | |
| 6724 | unsigned char *ptr; |
| 6725 | unsigned char *buf; |
| 6726 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 6727 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6728 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6729 | buf = stream->alloc(totalSize); |
| 6730 | ptr = buf; |
| 6731 | int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6732 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6733 | |
| 6734 | memcpy(ptr, &mode, 4); ptr += 4; |
| 6735 | memcpy(ptr, &count, 4); ptr += 4; |
| 6736 | memcpy(ptr, &type, 4); ptr += 4; |
| 6737 | memcpy(ptr, &offset, 4); ptr += 4; |
| 6738 | memcpy(ptr, &primcount, 4); ptr += 4; |
| 6739 | |
| 6740 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6741 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6742 | |
| 6743 | } |
| 6744 | |
| 6745 | void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen) |
| 6746 | { |
| 6747 | |
| 6748 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6749 | IOStream *stream = ctx->m_stream; |
| 6750 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6751 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6752 | |
| 6753 | const unsigned int __size_indices = datalen; |
| 6754 | unsigned char *ptr; |
| 6755 | unsigned char *buf; |
| 6756 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4; |
| 6757 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6758 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6759 | buf = stream->alloc(totalSize); |
| 6760 | ptr = buf; |
| 6761 | int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6762 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6763 | |
| 6764 | memcpy(ptr, &mode, 4); ptr += 4; |
| 6765 | memcpy(ptr, &start, 4); ptr += 4; |
| 6766 | memcpy(ptr, &end, 4); ptr += 4; |
| 6767 | memcpy(ptr, &count, 4); ptr += 4; |
| 6768 | memcpy(ptr, &type, 4); ptr += 4; |
| 6769 | *(unsigned int *)(ptr) = __size_indices; ptr += 4; |
| 6770 | memcpy(ptr, indices, __size_indices);ptr += __size_indices; |
| 6771 | memcpy(ptr, &datalen, 4); ptr += 4; |
| 6772 | |
| 6773 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6774 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6775 | |
| 6776 | } |
| 6777 | |
| 6778 | void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset) |
| 6779 | { |
| 6780 | |
| 6781 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6782 | IOStream *stream = ctx->m_stream; |
| 6783 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6784 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6785 | |
| 6786 | unsigned char *ptr; |
| 6787 | unsigned char *buf; |
| 6788 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 6789 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6790 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6791 | buf = stream->alloc(totalSize); |
| 6792 | ptr = buf; |
| 6793 | int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 6794 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6795 | |
| 6796 | memcpy(ptr, &mode, 4); ptr += 4; |
| 6797 | memcpy(ptr, &start, 4); ptr += 4; |
| 6798 | memcpy(ptr, &end, 4); ptr += 4; |
| 6799 | memcpy(ptr, &count, 4); ptr += 4; |
| 6800 | memcpy(ptr, &type, 4); ptr += 4; |
| 6801 | memcpy(ptr, &offset, 4); ptr += 4; |
| 6802 | |
| 6803 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6804 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6805 | |
| 6806 | } |
| 6807 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6808 | uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6809 | { |
| 6810 | |
| 6811 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6812 | IOStream *stream = ctx->m_stream; |
| 6813 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6814 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6815 | |
| 6816 | unsigned char *ptr; |
| 6817 | unsigned char *buf; |
| 6818 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 6819 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6820 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6821 | buf = stream->alloc(totalSize); |
| 6822 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6823 | int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6824 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6825 | |
| 6826 | memcpy(ptr, &condition, 4); ptr += 4; |
| 6827 | memcpy(ptr, &flags, 4); ptr += 4; |
| 6828 | |
| 6829 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6830 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6831 | |
| 6832 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6833 | uint64_t retval; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6834 | stream->readback(&retval, 8); |
| 6835 | if (useChecksum) checksumCalculator->addBuffer(&retval, 8); |
| 6836 | if (useChecksum) { |
| 6837 | unsigned char *checksumBufPtr = NULL; |
| 6838 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6839 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6840 | stream->readback(checksumBufPtr, checksumSize); |
| 6841 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6842 | ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6843 | abort(); |
| 6844 | } |
| 6845 | } |
| 6846 | return retval; |
| 6847 | } |
| 6848 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6849 | GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6850 | { |
| 6851 | |
| 6852 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6853 | IOStream *stream = ctx->m_stream; |
| 6854 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6855 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6856 | |
| 6857 | unsigned char *ptr; |
| 6858 | unsigned char *buf; |
| 6859 | const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| 6860 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6861 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6862 | buf = stream->alloc(totalSize); |
| 6863 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6864 | int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6865 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6866 | |
| 6867 | memcpy(ptr, &wait_on, 8); ptr += 8; |
| 6868 | memcpy(ptr, &flags, 4); ptr += 4; |
| 6869 | memcpy(ptr, &timeout, 8); ptr += 8; |
| 6870 | |
| 6871 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6872 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6873 | |
| 6874 | |
| 6875 | GLenum retval; |
| 6876 | stream->readback(&retval, 4); |
| 6877 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 6878 | if (useChecksum) { |
| 6879 | unsigned char *checksumBufPtr = NULL; |
| 6880 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6881 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6882 | stream->readback(checksumBufPtr, checksumSize); |
| 6883 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6884 | ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6885 | abort(); |
| 6886 | } |
| 6887 | } |
| 6888 | return retval; |
| 6889 | } |
| 6890 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6891 | void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6892 | { |
| 6893 | |
| 6894 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6895 | IOStream *stream = ctx->m_stream; |
| 6896 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6897 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6898 | |
| 6899 | unsigned char *ptr; |
| 6900 | unsigned char *buf; |
| 6901 | const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| 6902 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6903 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6904 | buf = stream->alloc(totalSize); |
| 6905 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6906 | int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6907 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6908 | |
| 6909 | memcpy(ptr, &wait_on, 8); ptr += 8; |
| 6910 | memcpy(ptr, &flags, 4); ptr += 4; |
| 6911 | memcpy(ptr, &timeout, 8); ptr += 8; |
| 6912 | |
| 6913 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6914 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6915 | |
| 6916 | } |
| 6917 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6918 | void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6919 | { |
| 6920 | |
| 6921 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6922 | IOStream *stream = ctx->m_stream; |
| 6923 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6924 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6925 | |
| 6926 | unsigned char *ptr; |
| 6927 | unsigned char *buf; |
| 6928 | const size_t sizeWithoutChecksum = 8 + 8; |
| 6929 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6930 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6931 | buf = stream->alloc(totalSize); |
| 6932 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6933 | int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6934 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6935 | |
| 6936 | memcpy(ptr, &to_delete, 8); ptr += 8; |
| 6937 | |
| 6938 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6939 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6940 | |
| 6941 | } |
| 6942 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6943 | GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6944 | { |
| 6945 | |
| 6946 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6947 | IOStream *stream = ctx->m_stream; |
| 6948 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6949 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6950 | |
| 6951 | unsigned char *ptr; |
| 6952 | unsigned char *buf; |
| 6953 | const size_t sizeWithoutChecksum = 8 + 8; |
| 6954 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6955 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6956 | buf = stream->alloc(totalSize); |
| 6957 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6958 | int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6959 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 6960 | |
| 6961 | memcpy(ptr, &sync, 8); ptr += 8; |
| 6962 | |
| 6963 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 6964 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 6965 | |
| 6966 | |
| 6967 | GLboolean retval; |
| 6968 | stream->readback(&retval, 1); |
| 6969 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 6970 | if (useChecksum) { |
| 6971 | unsigned char *checksumBufPtr = NULL; |
| 6972 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 6973 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 6974 | stream->readback(checksumBufPtr, checksumSize); |
| 6975 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6976 | ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n"); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6977 | abort(); |
| 6978 | } |
| 6979 | } |
| 6980 | return retval; |
| 6981 | } |
| 6982 | |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 6983 | void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6984 | { |
| 6985 | |
| 6986 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 6987 | IOStream *stream = ctx->m_stream; |
| 6988 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 6989 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 6990 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 6991 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 6992 | const unsigned int __size_values = (bufSize * sizeof(GLint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 6993 | unsigned char *ptr; |
| 6994 | unsigned char *buf; |
| 6995 | const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4; |
| 6996 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 6997 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 6998 | buf = stream->alloc(totalSize); |
| 6999 | ptr = buf; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 7000 | int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 7001 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7002 | |
| 7003 | memcpy(ptr, &sync, 8); ptr += 8; |
| 7004 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7005 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 7006 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 7007 | *(unsigned int *)(ptr) = __size_values; ptr += 4; |
| 7008 | |
| 7009 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7010 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7011 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 7012 | if (length != NULL) { |
| 7013 | stream->readback(length, __size_length); |
| 7014 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 7015 | } |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 7016 | stream->readback(values, __size_values); |
| 7017 | if (useChecksum) checksumCalculator->addBuffer(values, __size_values); |
| 7018 | if (useChecksum) { |
| 7019 | unsigned char *checksumBufPtr = NULL; |
| 7020 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7021 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7022 | stream->readback(checksumBufPtr, checksumSize); |
| 7023 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 7024 | ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n"); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 7025 | abort(); |
| 7026 | } |
| 7027 | } |
| 7028 | } |
| 7029 | |
| 7030 | void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs) |
| 7031 | { |
| 7032 | |
| 7033 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7034 | IOStream *stream = ctx->m_stream; |
| 7035 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7036 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7037 | |
| 7038 | const unsigned int __size_bufs = (n * sizeof(GLenum)); |
| 7039 | unsigned char *ptr; |
| 7040 | unsigned char *buf; |
| 7041 | const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4; |
| 7042 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7043 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7044 | buf = stream->alloc(totalSize); |
| 7045 | ptr = buf; |
| 7046 | int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7047 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7048 | |
| 7049 | memcpy(ptr, &n, 4); ptr += 4; |
| 7050 | *(unsigned int *)(ptr) = __size_bufs; ptr += 4; |
| 7051 | memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs; |
| 7052 | |
| 7053 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7054 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7055 | |
| 7056 | } |
| 7057 | |
| 7058 | void glReadBuffer_enc(void *self , GLenum src) |
| 7059 | { |
| 7060 | |
| 7061 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7062 | IOStream *stream = ctx->m_stream; |
| 7063 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7064 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7065 | |
| 7066 | unsigned char *ptr; |
| 7067 | unsigned char *buf; |
| 7068 | const size_t sizeWithoutChecksum = 8 + 4; |
| 7069 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7070 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7071 | buf = stream->alloc(totalSize); |
| 7072 | ptr = buf; |
| 7073 | int tmp = OP_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7074 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7075 | |
| 7076 | memcpy(ptr, &src, 4); ptr += 4; |
| 7077 | |
| 7078 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7079 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7080 | |
| 7081 | } |
| 7082 | |
| 7083 | 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) |
| 7084 | { |
| 7085 | |
| 7086 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7087 | IOStream *stream = ctx->m_stream; |
| 7088 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7089 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7090 | |
| 7091 | unsigned char *ptr; |
| 7092 | unsigned char *buf; |
| 7093 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 7094 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7095 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7096 | buf = stream->alloc(totalSize); |
| 7097 | ptr = buf; |
| 7098 | int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7099 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7100 | |
| 7101 | memcpy(ptr, &srcX0, 4); ptr += 4; |
| 7102 | memcpy(ptr, &srcY0, 4); ptr += 4; |
| 7103 | memcpy(ptr, &srcX1, 4); ptr += 4; |
| 7104 | memcpy(ptr, &srcY1, 4); ptr += 4; |
| 7105 | memcpy(ptr, &dstX0, 4); ptr += 4; |
| 7106 | memcpy(ptr, &dstY0, 4); ptr += 4; |
| 7107 | memcpy(ptr, &dstX1, 4); ptr += 4; |
| 7108 | memcpy(ptr, &dstY1, 4); ptr += 4; |
| 7109 | memcpy(ptr, &mask, 4); ptr += 4; |
| 7110 | memcpy(ptr, &filter, 4); ptr += 4; |
| 7111 | |
| 7112 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7113 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7114 | |
| 7115 | } |
| 7116 | |
| 7117 | void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| 7118 | { |
| 7119 | |
| 7120 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7121 | IOStream *stream = ctx->m_stream; |
| 7122 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7123 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7124 | |
| 7125 | const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| 7126 | unsigned char *ptr; |
| 7127 | unsigned char *buf; |
| 7128 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4; |
| 7129 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7130 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7131 | buf = stream->alloc(totalSize); |
| 7132 | ptr = buf; |
| 7133 | int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7134 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7135 | |
| 7136 | memcpy(ptr, &target, 4); ptr += 4; |
| 7137 | memcpy(ptr, &numAttachments, 4); ptr += 4; |
| 7138 | *(unsigned int *)(ptr) = __size_attachments; ptr += 4; |
| 7139 | memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
| 7140 | |
| 7141 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7142 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7143 | |
| 7144 | } |
| 7145 | |
| 7146 | void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) |
| 7147 | { |
| 7148 | |
| 7149 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7150 | IOStream *stream = ctx->m_stream; |
| 7151 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7152 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7153 | |
| 7154 | const unsigned int __size_attachments = (numAttachments * sizeof(GLenum)); |
| 7155 | unsigned char *ptr; |
| 7156 | unsigned char *buf; |
| 7157 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4; |
| 7158 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7159 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7160 | buf = stream->alloc(totalSize); |
| 7161 | ptr = buf; |
| 7162 | int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7163 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7164 | |
| 7165 | memcpy(ptr, &target, 4); ptr += 4; |
| 7166 | memcpy(ptr, &numAttachments, 4); ptr += 4; |
| 7167 | *(unsigned int *)(ptr) = __size_attachments; ptr += 4; |
| 7168 | memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments; |
| 7169 | memcpy(ptr, &x, 4); ptr += 4; |
| 7170 | memcpy(ptr, &y, 4); ptr += 4; |
| 7171 | memcpy(ptr, &width, 4); ptr += 4; |
| 7172 | memcpy(ptr, &height, 4); ptr += 4; |
| 7173 | |
| 7174 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7175 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7176 | |
| 7177 | } |
| 7178 | |
| 7179 | void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) |
| 7180 | { |
| 7181 | |
| 7182 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7183 | IOStream *stream = ctx->m_stream; |
| 7184 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7185 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7186 | |
| 7187 | unsigned char *ptr; |
| 7188 | unsigned char *buf; |
| 7189 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 7190 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7191 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7192 | buf = stream->alloc(totalSize); |
| 7193 | ptr = buf; |
| 7194 | int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7195 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7196 | |
| 7197 | memcpy(ptr, &target, 4); ptr += 4; |
| 7198 | memcpy(ptr, &attachment, 4); ptr += 4; |
| 7199 | memcpy(ptr, &texture, 4); ptr += 4; |
| 7200 | memcpy(ptr, &level, 4); ptr += 4; |
| 7201 | memcpy(ptr, &layer, 4); ptr += 4; |
| 7202 | |
| 7203 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7204 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7205 | |
| 7206 | } |
| 7207 | |
| 7208 | void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
| 7209 | { |
| 7210 | |
| 7211 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7212 | IOStream *stream = ctx->m_stream; |
| 7213 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7214 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7215 | |
| 7216 | unsigned char *ptr; |
| 7217 | unsigned char *buf; |
| 7218 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 7219 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7220 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7221 | buf = stream->alloc(totalSize); |
| 7222 | ptr = buf; |
| 7223 | int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7224 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7225 | |
| 7226 | memcpy(ptr, &target, 4); ptr += 4; |
| 7227 | memcpy(ptr, &samples, 4); ptr += 4; |
| 7228 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 7229 | memcpy(ptr, &width, 4); ptr += 4; |
| 7230 | memcpy(ptr, &height, 4); ptr += 4; |
| 7231 | |
| 7232 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7233 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7234 | |
| 7235 | } |
| 7236 | |
| 7237 | void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| 7238 | { |
| 7239 | |
| 7240 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7241 | IOStream *stream = ctx->m_stream; |
| 7242 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7243 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7244 | |
| 7245 | unsigned char *ptr; |
| 7246 | unsigned char *buf; |
| 7247 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 7248 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7249 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7250 | buf = stream->alloc(totalSize); |
| 7251 | ptr = buf; |
| 7252 | int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7253 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7254 | |
| 7255 | memcpy(ptr, &target, 4); ptr += 4; |
| 7256 | memcpy(ptr, &levels, 4); ptr += 4; |
| 7257 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 7258 | memcpy(ptr, &width, 4); ptr += 4; |
| 7259 | memcpy(ptr, &height, 4); ptr += 4; |
| 7260 | |
| 7261 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7262 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7263 | |
| 7264 | } |
| 7265 | |
| 7266 | void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) |
| 7267 | { |
| 7268 | |
| 7269 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7270 | IOStream *stream = ctx->m_stream; |
| 7271 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7272 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7273 | |
| 7274 | const unsigned int __size_params = (sizeof(GLint) * bufSize); |
| 7275 | unsigned char *ptr; |
| 7276 | unsigned char *buf; |
| 7277 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4; |
| 7278 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7279 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7280 | buf = stream->alloc(totalSize); |
| 7281 | ptr = buf; |
| 7282 | int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7283 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7284 | |
| 7285 | memcpy(ptr, &target, 4); ptr += 4; |
| 7286 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 7287 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7288 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 7289 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 7290 | |
| 7291 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7292 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7293 | |
| 7294 | stream->readback(params, __size_params); |
| 7295 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 7296 | if (useChecksum) { |
| 7297 | unsigned char *checksumBufPtr = NULL; |
| 7298 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7299 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7300 | stream->readback(checksumBufPtr, checksumSize); |
| 7301 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7302 | ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n"); |
| 7303 | abort(); |
| 7304 | } |
| 7305 | } |
| 7306 | } |
| 7307 | |
| 7308 | void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode) |
| 7309 | { |
| 7310 | |
| 7311 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7312 | IOStream *stream = ctx->m_stream; |
| 7313 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7314 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7315 | |
| 7316 | unsigned char *ptr; |
| 7317 | unsigned char *buf; |
| 7318 | const size_t sizeWithoutChecksum = 8 + 4; |
| 7319 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7320 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7321 | buf = stream->alloc(totalSize); |
| 7322 | ptr = buf; |
| 7323 | int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7324 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7325 | |
| 7326 | memcpy(ptr, &primitiveMode, 4); ptr += 4; |
| 7327 | |
| 7328 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7329 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7330 | |
| 7331 | } |
| 7332 | |
| 7333 | void glEndTransformFeedback_enc(void *self ) |
| 7334 | { |
| 7335 | |
| 7336 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7337 | IOStream *stream = ctx->m_stream; |
| 7338 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7339 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7340 | |
| 7341 | unsigned char *ptr; |
| 7342 | unsigned char *buf; |
| 7343 | const size_t sizeWithoutChecksum = 8; |
| 7344 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7345 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7346 | buf = stream->alloc(totalSize); |
| 7347 | ptr = buf; |
| 7348 | int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7349 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7350 | |
| 7351 | |
| 7352 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7353 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7354 | |
| 7355 | } |
| 7356 | |
| 7357 | void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids) |
| 7358 | { |
| 7359 | |
| 7360 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7361 | IOStream *stream = ctx->m_stream; |
| 7362 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7363 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7364 | |
| 7365 | const unsigned int __size_ids = (n * sizeof(GLuint)); |
| 7366 | unsigned char *ptr; |
| 7367 | unsigned char *buf; |
| 7368 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 7369 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7370 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7371 | buf = stream->alloc(totalSize); |
| 7372 | ptr = buf; |
| 7373 | int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7374 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7375 | |
| 7376 | memcpy(ptr, &n, 4); ptr += 4; |
| 7377 | *(unsigned int *)(ptr) = __size_ids; ptr += 4; |
| 7378 | |
| 7379 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7380 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7381 | |
| 7382 | stream->readback(ids, __size_ids); |
| 7383 | if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids); |
| 7384 | if (useChecksum) { |
| 7385 | unsigned char *checksumBufPtr = NULL; |
| 7386 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7387 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7388 | stream->readback(checksumBufPtr, checksumSize); |
| 7389 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7390 | ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n"); |
| 7391 | abort(); |
| 7392 | } |
| 7393 | } |
| 7394 | } |
| 7395 | |
| 7396 | void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids) |
| 7397 | { |
| 7398 | |
| 7399 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7400 | IOStream *stream = ctx->m_stream; |
| 7401 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7402 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7403 | |
| 7404 | const unsigned int __size_ids = (n * sizeof(GLuint)); |
| 7405 | unsigned char *ptr; |
| 7406 | unsigned char *buf; |
| 7407 | const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4; |
| 7408 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7409 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7410 | buf = stream->alloc(totalSize); |
| 7411 | ptr = buf; |
| 7412 | int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7413 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7414 | |
| 7415 | memcpy(ptr, &n, 4); ptr += 4; |
| 7416 | *(unsigned int *)(ptr) = __size_ids; ptr += 4; |
| 7417 | memcpy(ptr, ids, __size_ids);ptr += __size_ids; |
| 7418 | |
| 7419 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7420 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7421 | |
| 7422 | } |
| 7423 | |
| 7424 | void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id) |
| 7425 | { |
| 7426 | |
| 7427 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7428 | IOStream *stream = ctx->m_stream; |
| 7429 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7430 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7431 | |
| 7432 | unsigned char *ptr; |
| 7433 | unsigned char *buf; |
| 7434 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 7435 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7436 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7437 | buf = stream->alloc(totalSize); |
| 7438 | ptr = buf; |
| 7439 | int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7440 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7441 | |
| 7442 | memcpy(ptr, &target, 4); ptr += 4; |
| 7443 | memcpy(ptr, &id, 4); ptr += 4; |
| 7444 | |
| 7445 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7446 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7447 | |
| 7448 | } |
| 7449 | |
| 7450 | void glPauseTransformFeedback_enc(void *self ) |
| 7451 | { |
| 7452 | |
| 7453 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7454 | IOStream *stream = ctx->m_stream; |
| 7455 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7456 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7457 | |
| 7458 | unsigned char *ptr; |
| 7459 | unsigned char *buf; |
| 7460 | const size_t sizeWithoutChecksum = 8; |
| 7461 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7462 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7463 | buf = stream->alloc(totalSize); |
| 7464 | ptr = buf; |
| 7465 | int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7466 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7467 | |
| 7468 | |
| 7469 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7470 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7471 | |
| 7472 | } |
| 7473 | |
| 7474 | void glResumeTransformFeedback_enc(void *self ) |
| 7475 | { |
| 7476 | |
| 7477 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7478 | IOStream *stream = ctx->m_stream; |
| 7479 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7480 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7481 | |
| 7482 | unsigned char *ptr; |
| 7483 | unsigned char *buf; |
| 7484 | const size_t sizeWithoutChecksum = 8; |
| 7485 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7486 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7487 | buf = stream->alloc(totalSize); |
| 7488 | ptr = buf; |
| 7489 | int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7490 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7491 | |
| 7492 | |
| 7493 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7494 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7495 | |
| 7496 | } |
| 7497 | |
| 7498 | GLboolean glIsTransformFeedback_enc(void *self , GLuint id) |
| 7499 | { |
| 7500 | |
| 7501 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7502 | IOStream *stream = ctx->m_stream; |
| 7503 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7504 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7505 | |
| 7506 | unsigned char *ptr; |
| 7507 | unsigned char *buf; |
| 7508 | const size_t sizeWithoutChecksum = 8 + 4; |
| 7509 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7510 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7511 | buf = stream->alloc(totalSize); |
| 7512 | ptr = buf; |
| 7513 | int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7514 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7515 | |
| 7516 | memcpy(ptr, &id, 4); ptr += 4; |
| 7517 | |
| 7518 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7519 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7520 | |
| 7521 | |
| 7522 | GLboolean retval; |
| 7523 | stream->readback(&retval, 1); |
| 7524 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 7525 | if (useChecksum) { |
| 7526 | unsigned char *checksumBufPtr = NULL; |
| 7527 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7528 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7529 | stream->readback(checksumBufPtr, checksumSize); |
| 7530 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7531 | ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n"); |
| 7532 | abort(); |
| 7533 | } |
| 7534 | } |
| 7535 | return retval; |
| 7536 | } |
| 7537 | |
| 7538 | void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode) |
| 7539 | { |
| 7540 | |
| 7541 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7542 | IOStream *stream = ctx->m_stream; |
| 7543 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7544 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7545 | |
| 7546 | const unsigned int __size_packedVaryings = packedVaryingsLen; |
| 7547 | unsigned char *ptr; |
| 7548 | unsigned char *buf; |
| 7549 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4; |
| 7550 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7551 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7552 | buf = stream->alloc(totalSize); |
| 7553 | ptr = buf; |
| 7554 | int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7555 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7556 | |
| 7557 | memcpy(ptr, &program, 4); ptr += 4; |
| 7558 | memcpy(ptr, &count, 4); ptr += 4; |
| 7559 | *(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4; |
| 7560 | memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings; |
| 7561 | memcpy(ptr, &packedVaryingsLen, 4); ptr += 4; |
| 7562 | memcpy(ptr, &bufferMode, 4); ptr += 4; |
| 7563 | |
| 7564 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7565 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7566 | |
| 7567 | } |
| 7568 | |
| 7569 | void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name) |
| 7570 | { |
| 7571 | |
| 7572 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7573 | IOStream *stream = ctx->m_stream; |
| 7574 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7575 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7576 | |
| 7577 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 7578 | const unsigned int __size_size = (sizeof(GLsizei)); |
| 7579 | const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0); |
| 7580 | const unsigned int __size_name = ((name != NULL) ? bufSize : 0); |
| 7581 | unsigned char *ptr; |
| 7582 | unsigned char *buf; |
| 7583 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4; |
| 7584 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7585 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7586 | buf = stream->alloc(totalSize); |
| 7587 | ptr = buf; |
| 7588 | int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7589 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7590 | |
| 7591 | memcpy(ptr, &program, 4); ptr += 4; |
| 7592 | memcpy(ptr, &index, 4); ptr += 4; |
| 7593 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 7594 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 7595 | *(unsigned int *)(ptr) = __size_size; ptr += 4; |
| 7596 | *(unsigned int *)(ptr) = __size_type; ptr += 4; |
| 7597 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 7598 | |
| 7599 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7600 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7601 | |
| 7602 | if (length != NULL) { |
| 7603 | stream->readback(length, __size_length); |
| 7604 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 7605 | } |
| 7606 | stream->readback(size, __size_size); |
| 7607 | if (useChecksum) checksumCalculator->addBuffer(size, __size_size); |
| 7608 | if (type != NULL) { |
| 7609 | stream->readback(type, __size_type); |
| 7610 | if (useChecksum) checksumCalculator->addBuffer(type, __size_type); |
| 7611 | } |
| 7612 | if (name != NULL) { |
| 7613 | stream->readback(name, __size_name); |
| 7614 | if (useChecksum) checksumCalculator->addBuffer(name, __size_name); |
| 7615 | } |
| 7616 | if (useChecksum) { |
| 7617 | unsigned char *checksumBufPtr = NULL; |
| 7618 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7619 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7620 | stream->readback(checksumBufPtr, checksumSize); |
| 7621 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7622 | ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n"); |
| 7623 | abort(); |
| 7624 | } |
| 7625 | } |
| 7626 | } |
| 7627 | |
| 7628 | void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers) |
| 7629 | { |
| 7630 | |
| 7631 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7632 | IOStream *stream = ctx->m_stream; |
| 7633 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7634 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7635 | |
| 7636 | const unsigned int __size_samplers = (n * sizeof(GLuint)); |
| 7637 | unsigned char *ptr; |
| 7638 | unsigned char *buf; |
| 7639 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 7640 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7641 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7642 | buf = stream->alloc(totalSize); |
| 7643 | ptr = buf; |
| 7644 | int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7645 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7646 | |
| 7647 | memcpy(ptr, &n, 4); ptr += 4; |
| 7648 | *(unsigned int *)(ptr) = __size_samplers; ptr += 4; |
| 7649 | |
| 7650 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7651 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7652 | |
| 7653 | stream->readback(samplers, __size_samplers); |
| 7654 | if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers); |
| 7655 | if (useChecksum) { |
| 7656 | unsigned char *checksumBufPtr = NULL; |
| 7657 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7658 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7659 | stream->readback(checksumBufPtr, checksumSize); |
| 7660 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7661 | ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n"); |
| 7662 | abort(); |
| 7663 | } |
| 7664 | } |
| 7665 | } |
| 7666 | |
| 7667 | void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers) |
| 7668 | { |
| 7669 | |
| 7670 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7671 | IOStream *stream = ctx->m_stream; |
| 7672 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7673 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7674 | |
| 7675 | const unsigned int __size_samplers = (n * sizeof(GLuint)); |
| 7676 | unsigned char *ptr; |
| 7677 | unsigned char *buf; |
| 7678 | const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4; |
| 7679 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7680 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7681 | buf = stream->alloc(totalSize); |
| 7682 | ptr = buf; |
| 7683 | int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7684 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7685 | |
| 7686 | memcpy(ptr, &n, 4); ptr += 4; |
| 7687 | *(unsigned int *)(ptr) = __size_samplers; ptr += 4; |
| 7688 | memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers; |
| 7689 | |
| 7690 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7691 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7692 | |
| 7693 | } |
| 7694 | |
| 7695 | void glBindSampler_enc(void *self , GLuint unit, GLuint sampler) |
| 7696 | { |
| 7697 | |
| 7698 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7699 | IOStream *stream = ctx->m_stream; |
| 7700 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7701 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7702 | |
| 7703 | unsigned char *ptr; |
| 7704 | unsigned char *buf; |
| 7705 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 7706 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7707 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7708 | buf = stream->alloc(totalSize); |
| 7709 | ptr = buf; |
| 7710 | int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7711 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7712 | |
| 7713 | memcpy(ptr, &unit, 4); ptr += 4; |
| 7714 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7715 | |
| 7716 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7717 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7718 | |
| 7719 | } |
| 7720 | |
| 7721 | void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param) |
| 7722 | { |
| 7723 | |
| 7724 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7725 | IOStream *stream = ctx->m_stream; |
| 7726 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7727 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7728 | |
| 7729 | unsigned char *ptr; |
| 7730 | unsigned char *buf; |
| 7731 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 7732 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7733 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7734 | buf = stream->alloc(totalSize); |
| 7735 | ptr = buf; |
| 7736 | int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7737 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7738 | |
| 7739 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7740 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7741 | memcpy(ptr, ¶m, 4); ptr += 4; |
| 7742 | |
| 7743 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7744 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7745 | |
| 7746 | } |
| 7747 | |
| 7748 | void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param) |
| 7749 | { |
| 7750 | |
| 7751 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7752 | IOStream *stream = ctx->m_stream; |
| 7753 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7754 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7755 | |
| 7756 | unsigned char *ptr; |
| 7757 | unsigned char *buf; |
| 7758 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 7759 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7760 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7761 | buf = stream->alloc(totalSize); |
| 7762 | ptr = buf; |
| 7763 | int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7764 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7765 | |
| 7766 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7767 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7768 | memcpy(ptr, ¶m, 4); ptr += 4; |
| 7769 | |
| 7770 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7771 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7772 | |
| 7773 | } |
| 7774 | |
| 7775 | void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params) |
| 7776 | { |
| 7777 | |
| 7778 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7779 | IOStream *stream = ctx->m_stream; |
| 7780 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7781 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7782 | |
| 7783 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 7784 | unsigned char *ptr; |
| 7785 | unsigned char *buf; |
| 7786 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| 7787 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7788 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7789 | buf = stream->alloc(totalSize); |
| 7790 | ptr = buf; |
| 7791 | int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7792 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7793 | |
| 7794 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7795 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7796 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 7797 | memcpy(ptr, params, __size_params);ptr += __size_params; |
| 7798 | |
| 7799 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7800 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7801 | |
| 7802 | } |
| 7803 | |
| 7804 | void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params) |
| 7805 | { |
| 7806 | |
| 7807 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7808 | IOStream *stream = ctx->m_stream; |
| 7809 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7810 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7811 | |
| 7812 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 7813 | unsigned char *ptr; |
| 7814 | unsigned char *buf; |
| 7815 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4; |
| 7816 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7817 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7818 | buf = stream->alloc(totalSize); |
| 7819 | ptr = buf; |
| 7820 | int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7821 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7822 | |
| 7823 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7824 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7825 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 7826 | memcpy(ptr, params, __size_params);ptr += __size_params; |
| 7827 | |
| 7828 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7829 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7830 | |
| 7831 | } |
| 7832 | |
| 7833 | void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params) |
| 7834 | { |
| 7835 | |
| 7836 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7837 | IOStream *stream = ctx->m_stream; |
| 7838 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7839 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7840 | |
| 7841 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 7842 | unsigned char *ptr; |
| 7843 | unsigned char *buf; |
| 7844 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 7845 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7846 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7847 | buf = stream->alloc(totalSize); |
| 7848 | ptr = buf; |
| 7849 | int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7850 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7851 | |
| 7852 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7853 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7854 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 7855 | |
| 7856 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7857 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7858 | |
| 7859 | stream->readback(params, __size_params); |
| 7860 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 7861 | if (useChecksum) { |
| 7862 | unsigned char *checksumBufPtr = NULL; |
| 7863 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7864 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7865 | stream->readback(checksumBufPtr, checksumSize); |
| 7866 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7867 | ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| 7868 | abort(); |
| 7869 | } |
| 7870 | } |
| 7871 | } |
| 7872 | |
| 7873 | void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params) |
| 7874 | { |
| 7875 | |
| 7876 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7877 | IOStream *stream = ctx->m_stream; |
| 7878 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7879 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7880 | |
| 7881 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 7882 | unsigned char *ptr; |
| 7883 | unsigned char *buf; |
| 7884 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 7885 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7886 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7887 | buf = stream->alloc(totalSize); |
| 7888 | ptr = buf; |
| 7889 | int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7890 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7891 | |
| 7892 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7893 | memcpy(ptr, &pname, 4); ptr += 4; |
| 7894 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 7895 | |
| 7896 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7897 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7898 | |
| 7899 | stream->readback(params, __size_params); |
| 7900 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 7901 | if (useChecksum) { |
| 7902 | unsigned char *checksumBufPtr = NULL; |
| 7903 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7904 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7905 | stream->readback(checksumBufPtr, checksumSize); |
| 7906 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7907 | ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 7908 | abort(); |
| 7909 | } |
| 7910 | } |
| 7911 | } |
| 7912 | |
| 7913 | GLboolean glIsSampler_enc(void *self , GLuint sampler) |
| 7914 | { |
| 7915 | |
| 7916 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7917 | IOStream *stream = ctx->m_stream; |
| 7918 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7919 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7920 | |
| 7921 | unsigned char *ptr; |
| 7922 | unsigned char *buf; |
| 7923 | const size_t sizeWithoutChecksum = 8 + 4; |
| 7924 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7925 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7926 | buf = stream->alloc(totalSize); |
| 7927 | ptr = buf; |
| 7928 | int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7929 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7930 | |
| 7931 | memcpy(ptr, &sampler, 4); ptr += 4; |
| 7932 | |
| 7933 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7934 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7935 | |
| 7936 | |
| 7937 | GLboolean retval; |
| 7938 | stream->readback(&retval, 1); |
| 7939 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 7940 | if (useChecksum) { |
| 7941 | unsigned char *checksumBufPtr = NULL; |
| 7942 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7943 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7944 | stream->readback(checksumBufPtr, checksumSize); |
| 7945 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7946 | ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n"); |
| 7947 | abort(); |
| 7948 | } |
| 7949 | } |
| 7950 | return retval; |
| 7951 | } |
| 7952 | |
| 7953 | void glGenQueries_enc(void *self , GLsizei n, GLuint* queries) |
| 7954 | { |
| 7955 | |
| 7956 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7957 | IOStream *stream = ctx->m_stream; |
| 7958 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7959 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7960 | |
| 7961 | const unsigned int __size_queries = (n * sizeof(GLuint)); |
| 7962 | unsigned char *ptr; |
| 7963 | unsigned char *buf; |
| 7964 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 7965 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 7966 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 7967 | buf = stream->alloc(totalSize); |
| 7968 | ptr = buf; |
| 7969 | int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4; |
| 7970 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 7971 | |
| 7972 | memcpy(ptr, &n, 4); ptr += 4; |
| 7973 | *(unsigned int *)(ptr) = __size_queries; ptr += 4; |
| 7974 | |
| 7975 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 7976 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 7977 | |
| 7978 | stream->readback(queries, __size_queries); |
| 7979 | if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries); |
| 7980 | if (useChecksum) { |
| 7981 | unsigned char *checksumBufPtr = NULL; |
| 7982 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 7983 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 7984 | stream->readback(checksumBufPtr, checksumSize); |
| 7985 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 7986 | ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n"); |
| 7987 | abort(); |
| 7988 | } |
| 7989 | } |
| 7990 | } |
| 7991 | |
| 7992 | void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries) |
| 7993 | { |
| 7994 | |
| 7995 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 7996 | IOStream *stream = ctx->m_stream; |
| 7997 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 7998 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 7999 | |
| 8000 | const unsigned int __size_queries = (n * sizeof(GLuint)); |
| 8001 | unsigned char *ptr; |
| 8002 | unsigned char *buf; |
| 8003 | const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4; |
| 8004 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8005 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8006 | buf = stream->alloc(totalSize); |
| 8007 | ptr = buf; |
| 8008 | int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8009 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8010 | |
| 8011 | memcpy(ptr, &n, 4); ptr += 4; |
| 8012 | *(unsigned int *)(ptr) = __size_queries; ptr += 4; |
| 8013 | memcpy(ptr, queries, __size_queries);ptr += __size_queries; |
| 8014 | |
| 8015 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8016 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8017 | |
| 8018 | } |
| 8019 | |
| 8020 | void glBeginQuery_enc(void *self , GLenum target, GLuint query) |
| 8021 | { |
| 8022 | |
| 8023 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8024 | IOStream *stream = ctx->m_stream; |
| 8025 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8026 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8027 | |
| 8028 | unsigned char *ptr; |
| 8029 | unsigned char *buf; |
| 8030 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 8031 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8032 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8033 | buf = stream->alloc(totalSize); |
| 8034 | ptr = buf; |
| 8035 | int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8036 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8037 | |
| 8038 | memcpy(ptr, &target, 4); ptr += 4; |
| 8039 | memcpy(ptr, &query, 4); ptr += 4; |
| 8040 | |
| 8041 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8042 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8043 | |
| 8044 | } |
| 8045 | |
| 8046 | void glEndQuery_enc(void *self , GLenum target) |
| 8047 | { |
| 8048 | |
| 8049 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8050 | IOStream *stream = ctx->m_stream; |
| 8051 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8052 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8053 | |
| 8054 | unsigned char *ptr; |
| 8055 | unsigned char *buf; |
| 8056 | const size_t sizeWithoutChecksum = 8 + 4; |
| 8057 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8058 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8059 | buf = stream->alloc(totalSize); |
| 8060 | ptr = buf; |
| 8061 | int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8062 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8063 | |
| 8064 | memcpy(ptr, &target, 4); ptr += 4; |
| 8065 | |
| 8066 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8067 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8068 | |
| 8069 | } |
| 8070 | |
| 8071 | void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| 8072 | { |
| 8073 | |
| 8074 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8075 | IOStream *stream = ctx->m_stream; |
| 8076 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8077 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8078 | |
| 8079 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 8080 | unsigned char *ptr; |
| 8081 | unsigned char *buf; |
| 8082 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 8083 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8084 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8085 | buf = stream->alloc(totalSize); |
| 8086 | ptr = buf; |
| 8087 | int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8088 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8089 | |
| 8090 | memcpy(ptr, &target, 4); ptr += 4; |
| 8091 | memcpy(ptr, &pname, 4); ptr += 4; |
| 8092 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 8093 | |
| 8094 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8095 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8096 | |
| 8097 | stream->readback(params, __size_params); |
| 8098 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 8099 | if (useChecksum) { |
| 8100 | unsigned char *checksumBufPtr = NULL; |
| 8101 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8102 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8103 | stream->readback(checksumBufPtr, checksumSize); |
| 8104 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8105 | ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n"); |
| 8106 | abort(); |
| 8107 | } |
| 8108 | } |
| 8109 | } |
| 8110 | |
| 8111 | void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params) |
| 8112 | { |
| 8113 | |
| 8114 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8115 | IOStream *stream = ctx->m_stream; |
| 8116 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8117 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8118 | |
| 8119 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint)); |
| 8120 | unsigned char *ptr; |
| 8121 | unsigned char *buf; |
| 8122 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 8123 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8124 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8125 | buf = stream->alloc(totalSize); |
| 8126 | ptr = buf; |
| 8127 | int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8128 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8129 | |
| 8130 | memcpy(ptr, &query, 4); ptr += 4; |
| 8131 | memcpy(ptr, &pname, 4); ptr += 4; |
| 8132 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 8133 | |
| 8134 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8135 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8136 | |
| 8137 | stream->readback(params, __size_params); |
| 8138 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 8139 | if (useChecksum) { |
| 8140 | unsigned char *checksumBufPtr = NULL; |
| 8141 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8142 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8143 | stream->readback(checksumBufPtr, checksumSize); |
| 8144 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8145 | ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n"); |
| 8146 | abort(); |
| 8147 | } |
| 8148 | } |
| 8149 | } |
| 8150 | |
| 8151 | GLboolean glIsQuery_enc(void *self , GLuint query) |
| 8152 | { |
| 8153 | |
| 8154 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8155 | IOStream *stream = ctx->m_stream; |
| 8156 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8157 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8158 | |
| 8159 | unsigned char *ptr; |
| 8160 | unsigned char *buf; |
| 8161 | const size_t sizeWithoutChecksum = 8 + 4; |
| 8162 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8163 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8164 | buf = stream->alloc(totalSize); |
| 8165 | ptr = buf; |
| 8166 | int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8167 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8168 | |
| 8169 | memcpy(ptr, &query, 4); ptr += 4; |
| 8170 | |
| 8171 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8172 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8173 | |
| 8174 | |
| 8175 | GLboolean retval; |
| 8176 | stream->readback(&retval, 1); |
| 8177 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 8178 | if (useChecksum) { |
| 8179 | unsigned char *checksumBufPtr = NULL; |
| 8180 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8181 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8182 | stream->readback(checksumBufPtr, checksumSize); |
| 8183 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8184 | ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n"); |
| 8185 | abort(); |
| 8186 | } |
| 8187 | } |
| 8188 | return retval; |
| 8189 | } |
| 8190 | |
| 8191 | void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value) |
| 8192 | { |
| 8193 | |
| 8194 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8195 | IOStream *stream = ctx->m_stream; |
| 8196 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8197 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8198 | |
| 8199 | unsigned char *ptr; |
| 8200 | unsigned char *buf; |
| 8201 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 8202 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8203 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8204 | buf = stream->alloc(totalSize); |
| 8205 | ptr = buf; |
| 8206 | int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8207 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8208 | |
| 8209 | memcpy(ptr, &program, 4); ptr += 4; |
| 8210 | memcpy(ptr, &pname, 4); ptr += 4; |
| 8211 | memcpy(ptr, &value, 4); ptr += 4; |
| 8212 | |
| 8213 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8214 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8215 | |
| 8216 | } |
| 8217 | |
| 8218 | void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length) |
| 8219 | { |
| 8220 | |
| 8221 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8222 | IOStream *stream = ctx->m_stream; |
| 8223 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8224 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8225 | |
| 8226 | const unsigned int __size_binary = length; |
| 8227 | unsigned char *ptr; |
| 8228 | unsigned char *buf; |
| 8229 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4; |
| 8230 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8231 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8232 | buf = stream->alloc(totalSize); |
| 8233 | ptr = buf; |
| 8234 | int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8235 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8236 | |
| 8237 | memcpy(ptr, &program, 4); ptr += 4; |
| 8238 | memcpy(ptr, &binaryFormat, 4); ptr += 4; |
| 8239 | *(unsigned int *)(ptr) = __size_binary; ptr += 4; |
| 8240 | memcpy(ptr, binary, __size_binary);ptr += __size_binary; |
| 8241 | memcpy(ptr, &length, 4); ptr += 4; |
| 8242 | |
| 8243 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8244 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8245 | |
| 8246 | } |
| 8247 | |
| 8248 | void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary) |
| 8249 | { |
| 8250 | |
| 8251 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8252 | IOStream *stream = ctx->m_stream; |
| 8253 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8254 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8255 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 8256 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 8257 | const unsigned int __size_binaryFormat = (sizeof(GLenum)); |
| 8258 | const unsigned int __size_binary = bufSize; |
| 8259 | unsigned char *ptr; |
| 8260 | unsigned char *buf; |
| 8261 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4; |
| 8262 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8263 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8264 | buf = stream->alloc(totalSize); |
| 8265 | ptr = buf; |
| 8266 | int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8267 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8268 | |
| 8269 | memcpy(ptr, &program, 4); ptr += 4; |
| 8270 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 8271 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 8272 | *(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4; |
| 8273 | *(unsigned int *)(ptr) = __size_binary; ptr += 4; |
| 8274 | |
| 8275 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8276 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8277 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 8278 | if (length != NULL) { |
| 8279 | stream->readback(length, __size_length); |
| 8280 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 8281 | } |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 8282 | stream->readback(binaryFormat, __size_binaryFormat); |
| 8283 | if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat); |
| 8284 | stream->readback(binary, __size_binary); |
| 8285 | if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary); |
| 8286 | if (useChecksum) { |
| 8287 | unsigned char *checksumBufPtr = NULL; |
| 8288 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8289 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8290 | stream->readback(checksumBufPtr, checksumSize); |
| 8291 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8292 | ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n"); |
| 8293 | abort(); |
| 8294 | } |
| 8295 | } |
| 8296 | } |
| 8297 | |
| 8298 | GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name) |
| 8299 | { |
| 8300 | |
| 8301 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8302 | IOStream *stream = ctx->m_stream; |
| 8303 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8304 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8305 | |
| 8306 | const unsigned int __size_name = (strlen(name) + 1); |
| 8307 | unsigned char *ptr; |
| 8308 | unsigned char *buf; |
| 8309 | const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4; |
| 8310 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8311 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8312 | buf = stream->alloc(totalSize); |
| 8313 | ptr = buf; |
| 8314 | int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8315 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8316 | |
| 8317 | memcpy(ptr, &program, 4); ptr += 4; |
| 8318 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 8319 | memcpy(ptr, name, __size_name);ptr += __size_name; |
| 8320 | |
| 8321 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8322 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8323 | |
| 8324 | |
| 8325 | GLint retval; |
| 8326 | stream->readback(&retval, 4); |
| 8327 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 8328 | if (useChecksum) { |
| 8329 | unsigned char *checksumBufPtr = NULL; |
| 8330 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8331 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8332 | stream->readback(checksumBufPtr, checksumSize); |
| 8333 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8334 | ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n"); |
| 8335 | abort(); |
| 8336 | } |
| 8337 | } |
| 8338 | return retval; |
| 8339 | } |
| 8340 | |
| 8341 | void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data) |
| 8342 | { |
| 8343 | |
| 8344 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8345 | IOStream *stream = ctx->m_stream; |
| 8346 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8347 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8348 | |
| 8349 | const unsigned int __size_data = (glUtilsParamSize(pname) * sizeof(GLint64)); |
| 8350 | unsigned char *ptr; |
| 8351 | unsigned char *buf; |
| 8352 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 8353 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8354 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8355 | buf = stream->alloc(totalSize); |
| 8356 | ptr = buf; |
| 8357 | int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8358 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8359 | |
| 8360 | memcpy(ptr, &pname, 4); ptr += 4; |
| 8361 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 8362 | |
| 8363 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8364 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8365 | |
| 8366 | stream->readback(data, __size_data); |
| 8367 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8368 | if (useChecksum) { |
| 8369 | unsigned char *checksumBufPtr = NULL; |
| 8370 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8371 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8372 | stream->readback(checksumBufPtr, checksumSize); |
| 8373 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8374 | ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n"); |
| 8375 | abort(); |
| 8376 | } |
| 8377 | } |
| 8378 | } |
| 8379 | |
| 8380 | void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data) |
| 8381 | { |
| 8382 | |
| 8383 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8384 | IOStream *stream = ctx->m_stream; |
| 8385 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8386 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8387 | |
| 8388 | const unsigned int __size_data = (sizeof(GLint)); |
| 8389 | unsigned char *ptr; |
| 8390 | unsigned char *buf; |
| 8391 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 8392 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8393 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8394 | buf = stream->alloc(totalSize); |
| 8395 | ptr = buf; |
| 8396 | int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8397 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8398 | |
| 8399 | memcpy(ptr, &target, 4); ptr += 4; |
| 8400 | memcpy(ptr, &index, 4); ptr += 4; |
| 8401 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 8402 | |
| 8403 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8404 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8405 | |
| 8406 | stream->readback(data, __size_data); |
| 8407 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8408 | if (useChecksum) { |
| 8409 | unsigned char *checksumBufPtr = NULL; |
| 8410 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8411 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8412 | stream->readback(checksumBufPtr, checksumSize); |
| 8413 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8414 | ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n"); |
| 8415 | abort(); |
| 8416 | } |
| 8417 | } |
| 8418 | } |
| 8419 | |
| 8420 | void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data) |
| 8421 | { |
| 8422 | |
| 8423 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8424 | IOStream *stream = ctx->m_stream; |
| 8425 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8426 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8427 | |
| 8428 | const unsigned int __size_data = (sizeof(GLint64)); |
| 8429 | unsigned char *ptr; |
| 8430 | unsigned char *buf; |
| 8431 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 8432 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8433 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8434 | buf = stream->alloc(totalSize); |
| 8435 | ptr = buf; |
| 8436 | int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8437 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8438 | |
| 8439 | memcpy(ptr, &target, 4); ptr += 4; |
| 8440 | memcpy(ptr, &index, 4); ptr += 4; |
| 8441 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 8442 | |
| 8443 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8444 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8445 | |
| 8446 | stream->readback(data, __size_data); |
| 8447 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8448 | if (useChecksum) { |
| 8449 | unsigned char *checksumBufPtr = NULL; |
| 8450 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8451 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8452 | stream->readback(checksumBufPtr, checksumSize); |
| 8453 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8454 | ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n"); |
| 8455 | abort(); |
| 8456 | } |
| 8457 | } |
| 8458 | } |
| 8459 | |
| 8460 | 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) |
| 8461 | { |
| 8462 | |
| 8463 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8464 | IOStream *stream = ctx->m_stream; |
| 8465 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8466 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8467 | |
| 8468 | const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| 8469 | unsigned char *ptr; |
| 8470 | unsigned char *buf; |
| 8471 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 8472 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8473 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8474 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 8475 | ptr = buf; |
| 8476 | int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8477 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8478 | |
| 8479 | memcpy(ptr, &target, 4); ptr += 4; |
| 8480 | memcpy(ptr, &level, 4); ptr += 4; |
| 8481 | memcpy(ptr, &internalFormat, 4); ptr += 4; |
| 8482 | memcpy(ptr, &width, 4); ptr += 4; |
| 8483 | memcpy(ptr, &height, 4); ptr += 4; |
| 8484 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8485 | memcpy(ptr, &border, 4); ptr += 4; |
| 8486 | memcpy(ptr, &format, 4); ptr += 4; |
| 8487 | memcpy(ptr, &type, 4); ptr += 4; |
| 8488 | |
| 8489 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8490 | stream->flush(); |
| 8491 | stream->writeFully(&__size_data,4); |
| 8492 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
| 8493 | if (data != NULL) { |
| 8494 | stream->writeFully(data, __size_data); |
| 8495 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8496 | } |
| 8497 | buf = stream->alloc(checksumSize); |
| 8498 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 8499 | |
| 8500 | } |
| 8501 | |
| 8502 | 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) |
| 8503 | { |
| 8504 | |
| 8505 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8506 | IOStream *stream = ctx->m_stream; |
| 8507 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8508 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8509 | |
| 8510 | unsigned char *ptr; |
| 8511 | unsigned char *buf; |
| 8512 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8513 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8514 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8515 | buf = stream->alloc(totalSize); |
| 8516 | ptr = buf; |
| 8517 | int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8518 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8519 | |
| 8520 | memcpy(ptr, &target, 4); ptr += 4; |
| 8521 | memcpy(ptr, &level, 4); ptr += 4; |
| 8522 | memcpy(ptr, &internalFormat, 4); ptr += 4; |
| 8523 | memcpy(ptr, &width, 4); ptr += 4; |
| 8524 | memcpy(ptr, &height, 4); ptr += 4; |
| 8525 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8526 | memcpy(ptr, &border, 4); ptr += 4; |
| 8527 | memcpy(ptr, &format, 4); ptr += 4; |
| 8528 | memcpy(ptr, &type, 4); ptr += 4; |
| 8529 | memcpy(ptr, &offset, 4); ptr += 4; |
| 8530 | |
| 8531 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8532 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8533 | |
| 8534 | } |
| 8535 | |
| 8536 | void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) |
| 8537 | { |
| 8538 | |
| 8539 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8540 | IOStream *stream = ctx->m_stream; |
| 8541 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8542 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8543 | |
| 8544 | unsigned char *ptr; |
| 8545 | unsigned char *buf; |
| 8546 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8547 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8548 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8549 | buf = stream->alloc(totalSize); |
| 8550 | ptr = buf; |
| 8551 | int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8552 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8553 | |
| 8554 | memcpy(ptr, &target, 4); ptr += 4; |
| 8555 | memcpy(ptr, &levels, 4); ptr += 4; |
| 8556 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 8557 | memcpy(ptr, &width, 4); ptr += 4; |
| 8558 | memcpy(ptr, &height, 4); ptr += 4; |
| 8559 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8560 | |
| 8561 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8562 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8563 | |
| 8564 | } |
| 8565 | |
| 8566 | 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) |
| 8567 | { |
| 8568 | |
| 8569 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8570 | IOStream *stream = ctx->m_stream; |
| 8571 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8572 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8573 | |
| 8574 | const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0); |
| 8575 | unsigned char *ptr; |
| 8576 | unsigned char *buf; |
| 8577 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 8578 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8579 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8580 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 8581 | ptr = buf; |
| 8582 | int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8583 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8584 | |
| 8585 | memcpy(ptr, &target, 4); ptr += 4; |
| 8586 | memcpy(ptr, &level, 4); ptr += 4; |
| 8587 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 8588 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 8589 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 8590 | memcpy(ptr, &width, 4); ptr += 4; |
| 8591 | memcpy(ptr, &height, 4); ptr += 4; |
| 8592 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8593 | memcpy(ptr, &format, 4); ptr += 4; |
| 8594 | memcpy(ptr, &type, 4); ptr += 4; |
| 8595 | |
| 8596 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8597 | stream->flush(); |
| 8598 | stream->writeFully(&__size_data,4); |
| 8599 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
| 8600 | if (data != NULL) { |
| 8601 | stream->writeFully(data, __size_data); |
| 8602 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8603 | } |
| 8604 | buf = stream->alloc(checksumSize); |
| 8605 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 8606 | |
| 8607 | } |
| 8608 | |
| 8609 | 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) |
| 8610 | { |
| 8611 | |
| 8612 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8613 | IOStream *stream = ctx->m_stream; |
| 8614 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8615 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8616 | |
| 8617 | unsigned char *ptr; |
| 8618 | unsigned char *buf; |
| 8619 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8620 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8621 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8622 | buf = stream->alloc(totalSize); |
| 8623 | ptr = buf; |
| 8624 | int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8625 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8626 | |
| 8627 | memcpy(ptr, &target, 4); ptr += 4; |
| 8628 | memcpy(ptr, &level, 4); ptr += 4; |
| 8629 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 8630 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 8631 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 8632 | memcpy(ptr, &width, 4); ptr += 4; |
| 8633 | memcpy(ptr, &height, 4); ptr += 4; |
| 8634 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8635 | memcpy(ptr, &format, 4); ptr += 4; |
| 8636 | memcpy(ptr, &type, 4); ptr += 4; |
| 8637 | memcpy(ptr, &offset, 4); ptr += 4; |
| 8638 | |
| 8639 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8640 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8641 | |
| 8642 | } |
| 8643 | |
| 8644 | void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| 8645 | { |
| 8646 | |
| 8647 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8648 | IOStream *stream = ctx->m_stream; |
| 8649 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8650 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8651 | |
| 8652 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
| 8653 | unsigned char *ptr; |
| 8654 | unsigned char *buf; |
| 8655 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 8656 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8657 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8658 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 8659 | ptr = buf; |
| 8660 | int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8661 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8662 | |
| 8663 | memcpy(ptr, &target, 4); ptr += 4; |
| 8664 | memcpy(ptr, &level, 4); ptr += 4; |
| 8665 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 8666 | memcpy(ptr, &width, 4); ptr += 4; |
| 8667 | memcpy(ptr, &height, 4); ptr += 4; |
| 8668 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8669 | memcpy(ptr, &border, 4); ptr += 4; |
| 8670 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 8671 | |
| 8672 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8673 | stream->flush(); |
| 8674 | stream->writeFully(&__size_data,4); |
| 8675 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
| 8676 | if (data != NULL) { |
| 8677 | stream->writeFully(data, __size_data); |
| 8678 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8679 | } |
| 8680 | buf = stream->alloc(checksumSize); |
| 8681 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 8682 | |
| 8683 | } |
| 8684 | |
| 8685 | void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset) |
| 8686 | { |
| 8687 | |
| 8688 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8689 | IOStream *stream = ctx->m_stream; |
| 8690 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8691 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8692 | |
| 8693 | unsigned char *ptr; |
| 8694 | unsigned char *buf; |
| 8695 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8696 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8697 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8698 | buf = stream->alloc(totalSize); |
| 8699 | ptr = buf; |
| 8700 | int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8701 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8702 | |
| 8703 | memcpy(ptr, &target, 4); ptr += 4; |
| 8704 | memcpy(ptr, &level, 4); ptr += 4; |
| 8705 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 8706 | memcpy(ptr, &width, 4); ptr += 4; |
| 8707 | memcpy(ptr, &height, 4); ptr += 4; |
| 8708 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8709 | memcpy(ptr, &border, 4); ptr += 4; |
| 8710 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 8711 | memcpy(ptr, &offset, 4); ptr += 4; |
| 8712 | |
| 8713 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8714 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8715 | |
| 8716 | } |
| 8717 | |
| 8718 | 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) |
| 8719 | { |
| 8720 | |
| 8721 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8722 | IOStream *stream = ctx->m_stream; |
| 8723 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8724 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8725 | |
| 8726 | const unsigned int __size_data = ((data != NULL) ? imageSize : 0); |
| 8727 | unsigned char *ptr; |
| 8728 | unsigned char *buf; |
| 8729 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4; |
| 8730 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8731 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8732 | buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| 8733 | ptr = buf; |
| 8734 | int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8735 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8736 | |
| 8737 | memcpy(ptr, &target, 4); ptr += 4; |
| 8738 | memcpy(ptr, &level, 4); ptr += 4; |
| 8739 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 8740 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 8741 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 8742 | memcpy(ptr, &width, 4); ptr += 4; |
| 8743 | memcpy(ptr, &height, 4); ptr += 4; |
| 8744 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8745 | memcpy(ptr, &format, 4); ptr += 4; |
| 8746 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 8747 | |
| 8748 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8749 | stream->flush(); |
| 8750 | stream->writeFully(&__size_data,4); |
| 8751 | if (useChecksum) checksumCalculator->addBuffer(&__size_data,4); |
| 8752 | if (data != NULL) { |
| 8753 | stream->writeFully(data, __size_data); |
| 8754 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8755 | } |
| 8756 | buf = stream->alloc(checksumSize); |
| 8757 | if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| 8758 | |
| 8759 | } |
| 8760 | |
| 8761 | 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) |
| 8762 | { |
| 8763 | |
| 8764 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8765 | IOStream *stream = ctx->m_stream; |
| 8766 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8767 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8768 | |
| 8769 | unsigned char *ptr; |
| 8770 | unsigned char *buf; |
| 8771 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8772 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8773 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8774 | buf = stream->alloc(totalSize); |
| 8775 | ptr = buf; |
| 8776 | int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8777 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8778 | |
| 8779 | memcpy(ptr, &target, 4); ptr += 4; |
| 8780 | memcpy(ptr, &level, 4); ptr += 4; |
| 8781 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 8782 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 8783 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 8784 | memcpy(ptr, &width, 4); ptr += 4; |
| 8785 | memcpy(ptr, &height, 4); ptr += 4; |
| 8786 | memcpy(ptr, &depth, 4); ptr += 4; |
| 8787 | memcpy(ptr, &format, 4); ptr += 4; |
| 8788 | memcpy(ptr, &imageSize, 4); ptr += 4; |
| 8789 | memcpy(ptr, &data, 4); ptr += 4; |
| 8790 | |
| 8791 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8792 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8793 | |
| 8794 | } |
| 8795 | |
| 8796 | void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 8797 | { |
| 8798 | |
| 8799 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8800 | IOStream *stream = ctx->m_stream; |
| 8801 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8802 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8803 | |
| 8804 | unsigned char *ptr; |
| 8805 | unsigned char *buf; |
| 8806 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4; |
| 8807 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8808 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8809 | buf = stream->alloc(totalSize); |
| 8810 | ptr = buf; |
| 8811 | int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8812 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8813 | |
| 8814 | memcpy(ptr, &target, 4); ptr += 4; |
| 8815 | memcpy(ptr, &level, 4); ptr += 4; |
| 8816 | memcpy(ptr, &xoffset, 4); ptr += 4; |
| 8817 | memcpy(ptr, &yoffset, 4); ptr += 4; |
| 8818 | memcpy(ptr, &zoffset, 4); ptr += 4; |
| 8819 | memcpy(ptr, &x, 4); ptr += 4; |
| 8820 | memcpy(ptr, &y, 4); ptr += 4; |
| 8821 | memcpy(ptr, &width, 4); ptr += 4; |
| 8822 | memcpy(ptr, &height, 4); ptr += 4; |
| 8823 | |
| 8824 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8825 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8826 | |
| 8827 | } |
| 8828 | |
| 8829 | void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data) |
| 8830 | { |
| 8831 | |
| 8832 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8833 | IOStream *stream = ctx->m_stream; |
| 8834 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8835 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8836 | |
| 8837 | const unsigned int __size_data = (sizeof(GLboolean)); |
| 8838 | unsigned char *ptr; |
| 8839 | unsigned char *buf; |
| 8840 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 8841 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8842 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8843 | buf = stream->alloc(totalSize); |
| 8844 | ptr = buf; |
| 8845 | int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8846 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8847 | |
| 8848 | memcpy(ptr, &target, 4); ptr += 4; |
| 8849 | memcpy(ptr, &index, 4); ptr += 4; |
| 8850 | *(unsigned int *)(ptr) = __size_data; ptr += 4; |
| 8851 | |
| 8852 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8853 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8854 | |
| 8855 | stream->readback(data, __size_data); |
| 8856 | if (useChecksum) checksumCalculator->addBuffer(data, __size_data); |
| 8857 | if (useChecksum) { |
| 8858 | unsigned char *checksumBufPtr = NULL; |
| 8859 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8860 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8861 | stream->readback(checksumBufPtr, checksumSize); |
| 8862 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8863 | ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n"); |
| 8864 | abort(); |
| 8865 | } |
| 8866 | } |
| 8867 | } |
| 8868 | |
| 8869 | void glMemoryBarrier_enc(void *self , GLbitfield barriers) |
| 8870 | { |
| 8871 | |
| 8872 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8873 | IOStream *stream = ctx->m_stream; |
| 8874 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8875 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8876 | |
| 8877 | unsigned char *ptr; |
| 8878 | unsigned char *buf; |
| 8879 | const size_t sizeWithoutChecksum = 8 + 4; |
| 8880 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8881 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8882 | buf = stream->alloc(totalSize); |
| 8883 | ptr = buf; |
| 8884 | int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8885 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8886 | |
| 8887 | memcpy(ptr, &barriers, 4); ptr += 4; |
| 8888 | |
| 8889 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8890 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8891 | |
| 8892 | } |
| 8893 | |
| 8894 | void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers) |
| 8895 | { |
| 8896 | |
| 8897 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8898 | IOStream *stream = ctx->m_stream; |
| 8899 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8900 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8901 | |
| 8902 | unsigned char *ptr; |
| 8903 | unsigned char *buf; |
| 8904 | const size_t sizeWithoutChecksum = 8 + 4; |
| 8905 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8906 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8907 | buf = stream->alloc(totalSize); |
| 8908 | ptr = buf; |
| 8909 | int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8910 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8911 | |
| 8912 | memcpy(ptr, &barriers, 4); ptr += 4; |
| 8913 | |
| 8914 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8915 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8916 | |
| 8917 | } |
| 8918 | |
| 8919 | void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines) |
| 8920 | { |
| 8921 | |
| 8922 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8923 | IOStream *stream = ctx->m_stream; |
| 8924 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8925 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8926 | |
| 8927 | const unsigned int __size_pipelines = (n * sizeof(GLuint)); |
| 8928 | unsigned char *ptr; |
| 8929 | unsigned char *buf; |
| 8930 | const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| 8931 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8932 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8933 | buf = stream->alloc(totalSize); |
| 8934 | ptr = buf; |
| 8935 | int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8936 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8937 | |
| 8938 | memcpy(ptr, &n, 4); ptr += 4; |
| 8939 | *(unsigned int *)(ptr) = __size_pipelines; ptr += 4; |
| 8940 | |
| 8941 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8942 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8943 | |
| 8944 | stream->readback(pipelines, __size_pipelines); |
| 8945 | if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines); |
| 8946 | if (useChecksum) { |
| 8947 | unsigned char *checksumBufPtr = NULL; |
| 8948 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 8949 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 8950 | stream->readback(checksumBufPtr, checksumSize); |
| 8951 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 8952 | ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n"); |
| 8953 | abort(); |
| 8954 | } |
| 8955 | } |
| 8956 | } |
| 8957 | |
| 8958 | void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines) |
| 8959 | { |
| 8960 | |
| 8961 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8962 | IOStream *stream = ctx->m_stream; |
| 8963 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8964 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8965 | |
| 8966 | const unsigned int __size_pipelines = (n * sizeof(GLuint)); |
| 8967 | unsigned char *ptr; |
| 8968 | unsigned char *buf; |
| 8969 | const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4; |
| 8970 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8971 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8972 | buf = stream->alloc(totalSize); |
| 8973 | ptr = buf; |
| 8974 | int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4; |
| 8975 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 8976 | |
| 8977 | memcpy(ptr, &n, 4); ptr += 4; |
| 8978 | *(unsigned int *)(ptr) = __size_pipelines; ptr += 4; |
| 8979 | memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines; |
| 8980 | |
| 8981 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 8982 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 8983 | |
| 8984 | } |
| 8985 | |
| 8986 | void glBindProgramPipeline_enc(void *self , GLuint pipeline) |
| 8987 | { |
| 8988 | |
| 8989 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 8990 | IOStream *stream = ctx->m_stream; |
| 8991 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 8992 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 8993 | |
| 8994 | unsigned char *ptr; |
| 8995 | unsigned char *buf; |
| 8996 | const size_t sizeWithoutChecksum = 8 + 4; |
| 8997 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 8998 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 8999 | buf = stream->alloc(totalSize); |
| 9000 | ptr = buf; |
| 9001 | int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9002 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9003 | |
| 9004 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9005 | |
| 9006 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9007 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9008 | |
| 9009 | } |
| 9010 | |
| 9011 | void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params) |
| 9012 | { |
| 9013 | |
| 9014 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9015 | IOStream *stream = ctx->m_stream; |
| 9016 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9017 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9018 | |
| 9019 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 9020 | unsigned char *ptr; |
| 9021 | unsigned char *buf; |
| 9022 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 9023 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9024 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9025 | buf = stream->alloc(totalSize); |
| 9026 | ptr = buf; |
| 9027 | int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9028 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9029 | |
| 9030 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9031 | memcpy(ptr, &pname, 4); ptr += 4; |
| 9032 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 9033 | |
| 9034 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9035 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9036 | |
| 9037 | stream->readback(params, __size_params); |
| 9038 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 9039 | if (useChecksum) { |
| 9040 | unsigned char *checksumBufPtr = NULL; |
| 9041 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 9042 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 9043 | stream->readback(checksumBufPtr, checksumSize); |
| 9044 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 9045 | ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n"); |
| 9046 | abort(); |
| 9047 | } |
| 9048 | } |
| 9049 | } |
| 9050 | |
| 9051 | void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog) |
| 9052 | { |
| 9053 | |
| 9054 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9055 | IOStream *stream = ctx->m_stream; |
| 9056 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9057 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9058 | |
| 9059 | const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0); |
| 9060 | const unsigned int __size_infoLog = bufSize; |
| 9061 | unsigned char *ptr; |
| 9062 | unsigned char *buf; |
| 9063 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4; |
| 9064 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9065 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9066 | buf = stream->alloc(totalSize); |
| 9067 | ptr = buf; |
| 9068 | int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9069 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9070 | |
| 9071 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9072 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 9073 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 9074 | *(unsigned int *)(ptr) = __size_infoLog; ptr += 4; |
| 9075 | |
| 9076 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9077 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9078 | |
| 9079 | if (length != NULL) { |
| 9080 | stream->readback(length, __size_length); |
| 9081 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 9082 | } |
| 9083 | stream->readback(infoLog, __size_infoLog); |
| 9084 | if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog); |
| 9085 | if (useChecksum) { |
| 9086 | unsigned char *checksumBufPtr = NULL; |
| 9087 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 9088 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 9089 | stream->readback(checksumBufPtr, checksumSize); |
| 9090 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 9091 | ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n"); |
| 9092 | abort(); |
| 9093 | } |
| 9094 | } |
| 9095 | } |
| 9096 | |
| 9097 | void glValidateProgramPipeline_enc(void *self , GLuint pipeline) |
| 9098 | { |
| 9099 | |
| 9100 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9101 | IOStream *stream = ctx->m_stream; |
| 9102 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9103 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9104 | |
| 9105 | unsigned char *ptr; |
| 9106 | unsigned char *buf; |
| 9107 | const size_t sizeWithoutChecksum = 8 + 4; |
| 9108 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9109 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9110 | buf = stream->alloc(totalSize); |
| 9111 | ptr = buf; |
| 9112 | int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9113 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9114 | |
| 9115 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9116 | |
| 9117 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9118 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9119 | |
| 9120 | } |
| 9121 | |
| 9122 | GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline) |
| 9123 | { |
| 9124 | |
| 9125 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9126 | IOStream *stream = ctx->m_stream; |
| 9127 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9128 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9129 | |
| 9130 | unsigned char *ptr; |
| 9131 | unsigned char *buf; |
| 9132 | const size_t sizeWithoutChecksum = 8 + 4; |
| 9133 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9134 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9135 | buf = stream->alloc(totalSize); |
| 9136 | ptr = buf; |
| 9137 | int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9138 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9139 | |
| 9140 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9141 | |
| 9142 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9143 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9144 | |
| 9145 | |
| 9146 | GLboolean retval; |
| 9147 | stream->readback(&retval, 1); |
| 9148 | if (useChecksum) checksumCalculator->addBuffer(&retval, 1); |
| 9149 | if (useChecksum) { |
| 9150 | unsigned char *checksumBufPtr = NULL; |
| 9151 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 9152 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 9153 | stream->readback(checksumBufPtr, checksumSize); |
| 9154 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 9155 | ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n"); |
| 9156 | abort(); |
| 9157 | } |
| 9158 | } |
| 9159 | return retval; |
| 9160 | } |
| 9161 | |
| 9162 | void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program) |
| 9163 | { |
| 9164 | |
| 9165 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9166 | IOStream *stream = ctx->m_stream; |
| 9167 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9168 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9169 | |
| 9170 | unsigned char *ptr; |
| 9171 | unsigned char *buf; |
| 9172 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 9173 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9174 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9175 | buf = stream->alloc(totalSize); |
| 9176 | ptr = buf; |
| 9177 | int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9178 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9179 | |
| 9180 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9181 | memcpy(ptr, &stages, 4); ptr += 4; |
| 9182 | memcpy(ptr, &program, 4); ptr += 4; |
| 9183 | |
| 9184 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9185 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9186 | |
| 9187 | } |
| 9188 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9189 | void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program) |
| 9190 | { |
| 9191 | |
| 9192 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9193 | IOStream *stream = ctx->m_stream; |
| 9194 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9195 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9196 | |
| 9197 | unsigned char *ptr; |
| 9198 | unsigned char *buf; |
| 9199 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 9200 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9201 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9202 | buf = stream->alloc(totalSize); |
| 9203 | ptr = buf; |
| 9204 | int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9205 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9206 | |
| 9207 | memcpy(ptr, &pipeline, 4); ptr += 4; |
| 9208 | memcpy(ptr, &program, 4); ptr += 4; |
| 9209 | |
| 9210 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9211 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9212 | |
| 9213 | } |
| 9214 | |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9215 | GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen) |
| 9216 | { |
| 9217 | |
| 9218 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9219 | IOStream *stream = ctx->m_stream; |
| 9220 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9221 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9222 | |
| 9223 | const unsigned int __size_packedStrings = packedLen; |
| 9224 | unsigned char *ptr; |
| 9225 | unsigned char *buf; |
| 9226 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4; |
| 9227 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9228 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9229 | buf = stream->alloc(totalSize); |
| 9230 | ptr = buf; |
| 9231 | int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9232 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9233 | |
| 9234 | memcpy(ptr, &type, 4); ptr += 4; |
| 9235 | memcpy(ptr, &count, 4); ptr += 4; |
| 9236 | *(unsigned int *)(ptr) = __size_packedStrings; ptr += 4; |
| 9237 | memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings; |
| 9238 | memcpy(ptr, &packedLen, 4); ptr += 4; |
| 9239 | |
| 9240 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9241 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9242 | |
| 9243 | |
| 9244 | GLuint retval; |
| 9245 | stream->readback(&retval, 4); |
| 9246 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 9247 | if (useChecksum) { |
| 9248 | unsigned char *checksumBufPtr = NULL; |
| 9249 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 9250 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 9251 | stream->readback(checksumBufPtr, checksumSize); |
| 9252 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 9253 | ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n"); |
| 9254 | abort(); |
| 9255 | } |
| 9256 | } |
| 9257 | return retval; |
| 9258 | } |
| 9259 | |
| 9260 | void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0) |
| 9261 | { |
| 9262 | |
| 9263 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9264 | IOStream *stream = ctx->m_stream; |
| 9265 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9266 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9267 | |
| 9268 | unsigned char *ptr; |
| 9269 | unsigned char *buf; |
| 9270 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 9271 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9272 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9273 | buf = stream->alloc(totalSize); |
| 9274 | ptr = buf; |
| 9275 | int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9276 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9277 | |
| 9278 | memcpy(ptr, &program, 4); ptr += 4; |
| 9279 | memcpy(ptr, &location, 4); ptr += 4; |
| 9280 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9281 | |
| 9282 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9283 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9284 | |
| 9285 | } |
| 9286 | |
| 9287 | void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1) |
| 9288 | { |
| 9289 | |
| 9290 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9291 | IOStream *stream = ctx->m_stream; |
| 9292 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9293 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9294 | |
| 9295 | unsigned char *ptr; |
| 9296 | unsigned char *buf; |
| 9297 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 9298 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9299 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9300 | buf = stream->alloc(totalSize); |
| 9301 | ptr = buf; |
| 9302 | int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9303 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9304 | |
| 9305 | memcpy(ptr, &program, 4); ptr += 4; |
| 9306 | memcpy(ptr, &location, 4); ptr += 4; |
| 9307 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9308 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9309 | |
| 9310 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9311 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9312 | |
| 9313 | } |
| 9314 | |
| 9315 | void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) |
| 9316 | { |
| 9317 | |
| 9318 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9319 | IOStream *stream = ctx->m_stream; |
| 9320 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9321 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9322 | |
| 9323 | unsigned char *ptr; |
| 9324 | unsigned char *buf; |
| 9325 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 9326 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9327 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9328 | buf = stream->alloc(totalSize); |
| 9329 | ptr = buf; |
| 9330 | int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9331 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9332 | |
| 9333 | memcpy(ptr, &program, 4); ptr += 4; |
| 9334 | memcpy(ptr, &location, 4); ptr += 4; |
| 9335 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9336 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9337 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9338 | |
| 9339 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9340 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9341 | |
| 9342 | } |
| 9343 | |
| 9344 | void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| 9345 | { |
| 9346 | |
| 9347 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9348 | IOStream *stream = ctx->m_stream; |
| 9349 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9350 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9351 | |
| 9352 | unsigned char *ptr; |
| 9353 | unsigned char *buf; |
| 9354 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 9355 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9356 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9357 | buf = stream->alloc(totalSize); |
| 9358 | ptr = buf; |
| 9359 | int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9360 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9361 | |
| 9362 | memcpy(ptr, &program, 4); ptr += 4; |
| 9363 | memcpy(ptr, &location, 4); ptr += 4; |
| 9364 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9365 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9366 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9367 | memcpy(ptr, &v3, 4); ptr += 4; |
| 9368 | |
| 9369 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9370 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9371 | |
| 9372 | } |
| 9373 | |
| 9374 | void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0) |
| 9375 | { |
| 9376 | |
| 9377 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9378 | IOStream *stream = ctx->m_stream; |
| 9379 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9380 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9381 | |
| 9382 | unsigned char *ptr; |
| 9383 | unsigned char *buf; |
| 9384 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 9385 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9386 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9387 | buf = stream->alloc(totalSize); |
| 9388 | ptr = buf; |
| 9389 | int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9390 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9391 | |
| 9392 | memcpy(ptr, &program, 4); ptr += 4; |
| 9393 | memcpy(ptr, &location, 4); ptr += 4; |
| 9394 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9395 | |
| 9396 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9397 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9398 | |
| 9399 | } |
| 9400 | |
| 9401 | void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1) |
| 9402 | { |
| 9403 | |
| 9404 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9405 | IOStream *stream = ctx->m_stream; |
| 9406 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9407 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9408 | |
| 9409 | unsigned char *ptr; |
| 9410 | unsigned char *buf; |
| 9411 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 9412 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9413 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9414 | buf = stream->alloc(totalSize); |
| 9415 | ptr = buf; |
| 9416 | int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9417 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9418 | |
| 9419 | memcpy(ptr, &program, 4); ptr += 4; |
| 9420 | memcpy(ptr, &location, 4); ptr += 4; |
| 9421 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9422 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9423 | |
| 9424 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9425 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9426 | |
| 9427 | } |
| 9428 | |
| 9429 | void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2) |
| 9430 | { |
| 9431 | |
| 9432 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9433 | IOStream *stream = ctx->m_stream; |
| 9434 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9435 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9436 | |
| 9437 | unsigned char *ptr; |
| 9438 | unsigned char *buf; |
| 9439 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 9440 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9441 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9442 | buf = stream->alloc(totalSize); |
| 9443 | ptr = buf; |
| 9444 | int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9445 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9446 | |
| 9447 | memcpy(ptr, &program, 4); ptr += 4; |
| 9448 | memcpy(ptr, &location, 4); ptr += 4; |
| 9449 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9450 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9451 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9452 | |
| 9453 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9454 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9455 | |
| 9456 | } |
| 9457 | |
| 9458 | void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) |
| 9459 | { |
| 9460 | |
| 9461 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9462 | IOStream *stream = ctx->m_stream; |
| 9463 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9464 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9465 | |
| 9466 | unsigned char *ptr; |
| 9467 | unsigned char *buf; |
| 9468 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 9469 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9470 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9471 | buf = stream->alloc(totalSize); |
| 9472 | ptr = buf; |
| 9473 | int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9474 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9475 | |
| 9476 | memcpy(ptr, &program, 4); ptr += 4; |
| 9477 | memcpy(ptr, &location, 4); ptr += 4; |
| 9478 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9479 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9480 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9481 | memcpy(ptr, &v3, 4); ptr += 4; |
| 9482 | |
| 9483 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9484 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9485 | |
| 9486 | } |
| 9487 | |
| 9488 | void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0) |
| 9489 | { |
| 9490 | |
| 9491 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9492 | IOStream *stream = ctx->m_stream; |
| 9493 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9494 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9495 | |
| 9496 | unsigned char *ptr; |
| 9497 | unsigned char *buf; |
| 9498 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 9499 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9500 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9501 | buf = stream->alloc(totalSize); |
| 9502 | ptr = buf; |
| 9503 | int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9504 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9505 | |
| 9506 | memcpy(ptr, &program, 4); ptr += 4; |
| 9507 | memcpy(ptr, &location, 4); ptr += 4; |
| 9508 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9509 | |
| 9510 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9511 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9512 | |
| 9513 | } |
| 9514 | |
| 9515 | void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1) |
| 9516 | { |
| 9517 | |
| 9518 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9519 | IOStream *stream = ctx->m_stream; |
| 9520 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9521 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9522 | |
| 9523 | unsigned char *ptr; |
| 9524 | unsigned char *buf; |
| 9525 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 9526 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9527 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9528 | buf = stream->alloc(totalSize); |
| 9529 | ptr = buf; |
| 9530 | int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9531 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9532 | |
| 9533 | memcpy(ptr, &program, 4); ptr += 4; |
| 9534 | memcpy(ptr, &location, 4); ptr += 4; |
| 9535 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9536 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9537 | |
| 9538 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9539 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9540 | |
| 9541 | } |
| 9542 | |
| 9543 | void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2) |
| 9544 | { |
| 9545 | |
| 9546 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9547 | IOStream *stream = ctx->m_stream; |
| 9548 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9549 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9550 | |
| 9551 | unsigned char *ptr; |
| 9552 | unsigned char *buf; |
| 9553 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| 9554 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9555 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9556 | buf = stream->alloc(totalSize); |
| 9557 | ptr = buf; |
| 9558 | int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9559 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9560 | |
| 9561 | memcpy(ptr, &program, 4); ptr += 4; |
| 9562 | memcpy(ptr, &location, 4); ptr += 4; |
| 9563 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9564 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9565 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9566 | |
| 9567 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9568 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9569 | |
| 9570 | } |
| 9571 | |
| 9572 | void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3) |
| 9573 | { |
| 9574 | |
| 9575 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9576 | IOStream *stream = ctx->m_stream; |
| 9577 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9578 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9579 | |
| 9580 | unsigned char *ptr; |
| 9581 | unsigned char *buf; |
| 9582 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4; |
| 9583 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9584 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9585 | buf = stream->alloc(totalSize); |
| 9586 | ptr = buf; |
| 9587 | int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9588 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9589 | |
| 9590 | memcpy(ptr, &program, 4); ptr += 4; |
| 9591 | memcpy(ptr, &location, 4); ptr += 4; |
| 9592 | memcpy(ptr, &v0, 4); ptr += 4; |
| 9593 | memcpy(ptr, &v1, 4); ptr += 4; |
| 9594 | memcpy(ptr, &v2, 4); ptr += 4; |
| 9595 | memcpy(ptr, &v3, 4); ptr += 4; |
| 9596 | |
| 9597 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9598 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9599 | |
| 9600 | } |
| 9601 | |
| 9602 | void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| 9603 | { |
| 9604 | |
| 9605 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9606 | IOStream *stream = ctx->m_stream; |
| 9607 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9608 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9609 | |
| 9610 | const unsigned int __size_value = (count * sizeof(GLfloat)); |
| 9611 | unsigned char *ptr; |
| 9612 | unsigned char *buf; |
| 9613 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9614 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9615 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9616 | buf = stream->alloc(totalSize); |
| 9617 | ptr = buf; |
| 9618 | int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9619 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9620 | |
| 9621 | memcpy(ptr, &program, 4); ptr += 4; |
| 9622 | memcpy(ptr, &location, 4); ptr += 4; |
| 9623 | memcpy(ptr, &count, 4); ptr += 4; |
| 9624 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9625 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9626 | |
| 9627 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9628 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9629 | |
| 9630 | } |
| 9631 | |
| 9632 | void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| 9633 | { |
| 9634 | |
| 9635 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9636 | IOStream *stream = ctx->m_stream; |
| 9637 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9638 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9639 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9640 | const unsigned int __size_value = (count * 2 * sizeof(GLfloat)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9641 | unsigned char *ptr; |
| 9642 | unsigned char *buf; |
| 9643 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9644 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9645 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9646 | buf = stream->alloc(totalSize); |
| 9647 | ptr = buf; |
| 9648 | int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9649 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9650 | |
| 9651 | memcpy(ptr, &program, 4); ptr += 4; |
| 9652 | memcpy(ptr, &location, 4); ptr += 4; |
| 9653 | memcpy(ptr, &count, 4); ptr += 4; |
| 9654 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9655 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9656 | |
| 9657 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9658 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9659 | |
| 9660 | } |
| 9661 | |
| 9662 | void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| 9663 | { |
| 9664 | |
| 9665 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9666 | IOStream *stream = ctx->m_stream; |
| 9667 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9668 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9669 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9670 | const unsigned int __size_value = (count * 3 * sizeof(GLfloat)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9671 | unsigned char *ptr; |
| 9672 | unsigned char *buf; |
| 9673 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9674 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9675 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9676 | buf = stream->alloc(totalSize); |
| 9677 | ptr = buf; |
| 9678 | int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9679 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9680 | |
| 9681 | memcpy(ptr, &program, 4); ptr += 4; |
| 9682 | memcpy(ptr, &location, 4); ptr += 4; |
| 9683 | memcpy(ptr, &count, 4); ptr += 4; |
| 9684 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9685 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9686 | |
| 9687 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9688 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9689 | |
| 9690 | } |
| 9691 | |
| 9692 | void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value) |
| 9693 | { |
| 9694 | |
| 9695 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9696 | IOStream *stream = ctx->m_stream; |
| 9697 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9698 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9699 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9700 | const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9701 | unsigned char *ptr; |
| 9702 | unsigned char *buf; |
| 9703 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9704 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9705 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9706 | buf = stream->alloc(totalSize); |
| 9707 | ptr = buf; |
| 9708 | int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9709 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9710 | |
| 9711 | memcpy(ptr, &program, 4); ptr += 4; |
| 9712 | memcpy(ptr, &location, 4); ptr += 4; |
| 9713 | memcpy(ptr, &count, 4); ptr += 4; |
| 9714 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9715 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9716 | |
| 9717 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9718 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9719 | |
| 9720 | } |
| 9721 | |
| 9722 | void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| 9723 | { |
| 9724 | |
| 9725 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9726 | IOStream *stream = ctx->m_stream; |
| 9727 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9728 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9729 | |
| 9730 | const unsigned int __size_value = (count * sizeof(GLint)); |
| 9731 | unsigned char *ptr; |
| 9732 | unsigned char *buf; |
| 9733 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9734 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9735 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9736 | buf = stream->alloc(totalSize); |
| 9737 | ptr = buf; |
| 9738 | int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9739 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9740 | |
| 9741 | memcpy(ptr, &program, 4); ptr += 4; |
| 9742 | memcpy(ptr, &location, 4); ptr += 4; |
| 9743 | memcpy(ptr, &count, 4); ptr += 4; |
| 9744 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9745 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9746 | |
| 9747 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9748 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9749 | |
| 9750 | } |
| 9751 | |
| 9752 | void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| 9753 | { |
| 9754 | |
| 9755 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9756 | IOStream *stream = ctx->m_stream; |
| 9757 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9758 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9759 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9760 | const unsigned int __size_value = (count * 2 * sizeof(GLint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9761 | unsigned char *ptr; |
| 9762 | unsigned char *buf; |
| 9763 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9764 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9765 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9766 | buf = stream->alloc(totalSize); |
| 9767 | ptr = buf; |
| 9768 | int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9769 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9770 | |
| 9771 | memcpy(ptr, &program, 4); ptr += 4; |
| 9772 | memcpy(ptr, &location, 4); ptr += 4; |
| 9773 | memcpy(ptr, &count, 4); ptr += 4; |
| 9774 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9775 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9776 | |
| 9777 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9778 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9779 | |
| 9780 | } |
| 9781 | |
| 9782 | void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| 9783 | { |
| 9784 | |
| 9785 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9786 | IOStream *stream = ctx->m_stream; |
| 9787 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9788 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9789 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9790 | const unsigned int __size_value = (count * 3 * sizeof(GLint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9791 | unsigned char *ptr; |
| 9792 | unsigned char *buf; |
| 9793 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9794 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9795 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9796 | buf = stream->alloc(totalSize); |
| 9797 | ptr = buf; |
| 9798 | int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9799 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9800 | |
| 9801 | memcpy(ptr, &program, 4); ptr += 4; |
| 9802 | memcpy(ptr, &location, 4); ptr += 4; |
| 9803 | memcpy(ptr, &count, 4); ptr += 4; |
| 9804 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9805 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9806 | |
| 9807 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9808 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9809 | |
| 9810 | } |
| 9811 | |
| 9812 | void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value) |
| 9813 | { |
| 9814 | |
| 9815 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9816 | IOStream *stream = ctx->m_stream; |
| 9817 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9818 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9819 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9820 | const unsigned int __size_value = (count * 4 * sizeof(GLint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9821 | unsigned char *ptr; |
| 9822 | unsigned char *buf; |
| 9823 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9824 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9825 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9826 | buf = stream->alloc(totalSize); |
| 9827 | ptr = buf; |
| 9828 | int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9829 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9830 | |
| 9831 | memcpy(ptr, &program, 4); ptr += 4; |
| 9832 | memcpy(ptr, &location, 4); ptr += 4; |
| 9833 | memcpy(ptr, &count, 4); ptr += 4; |
| 9834 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9835 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9836 | |
| 9837 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9838 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9839 | |
| 9840 | } |
| 9841 | |
| 9842 | void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| 9843 | { |
| 9844 | |
| 9845 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9846 | IOStream *stream = ctx->m_stream; |
| 9847 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9848 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9849 | |
| 9850 | const unsigned int __size_value = (count * sizeof(GLuint)); |
| 9851 | unsigned char *ptr; |
| 9852 | unsigned char *buf; |
| 9853 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9854 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9855 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9856 | buf = stream->alloc(totalSize); |
| 9857 | ptr = buf; |
| 9858 | int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9859 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9860 | |
| 9861 | memcpy(ptr, &program, 4); ptr += 4; |
| 9862 | memcpy(ptr, &location, 4); ptr += 4; |
| 9863 | memcpy(ptr, &count, 4); ptr += 4; |
| 9864 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9865 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9866 | |
| 9867 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9868 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9869 | |
| 9870 | } |
| 9871 | |
| 9872 | void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| 9873 | { |
| 9874 | |
| 9875 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9876 | IOStream *stream = ctx->m_stream; |
| 9877 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9878 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9879 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9880 | const unsigned int __size_value = (count * 2 * sizeof(GLuint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9881 | unsigned char *ptr; |
| 9882 | unsigned char *buf; |
| 9883 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9884 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9885 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9886 | buf = stream->alloc(totalSize); |
| 9887 | ptr = buf; |
| 9888 | int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9889 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9890 | |
| 9891 | memcpy(ptr, &program, 4); ptr += 4; |
| 9892 | memcpy(ptr, &location, 4); ptr += 4; |
| 9893 | memcpy(ptr, &count, 4); ptr += 4; |
| 9894 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9895 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9896 | |
| 9897 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9898 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9899 | |
| 9900 | } |
| 9901 | |
| 9902 | void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| 9903 | { |
| 9904 | |
| 9905 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9906 | IOStream *stream = ctx->m_stream; |
| 9907 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9908 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9909 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9910 | const unsigned int __size_value = (count * 3 * sizeof(GLuint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9911 | unsigned char *ptr; |
| 9912 | unsigned char *buf; |
| 9913 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9914 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9915 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9916 | buf = stream->alloc(totalSize); |
| 9917 | ptr = buf; |
| 9918 | int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9919 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9920 | |
| 9921 | memcpy(ptr, &program, 4); ptr += 4; |
| 9922 | memcpy(ptr, &location, 4); ptr += 4; |
| 9923 | memcpy(ptr, &count, 4); ptr += 4; |
| 9924 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9925 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9926 | |
| 9927 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9928 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9929 | |
| 9930 | } |
| 9931 | |
| 9932 | void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value) |
| 9933 | { |
| 9934 | |
| 9935 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9936 | IOStream *stream = ctx->m_stream; |
| 9937 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9938 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9939 | |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 9940 | const unsigned int __size_value = (count * 4 * sizeof(GLuint)); |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 9941 | unsigned char *ptr; |
| 9942 | unsigned char *buf; |
| 9943 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4; |
| 9944 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9945 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9946 | buf = stream->alloc(totalSize); |
| 9947 | ptr = buf; |
| 9948 | int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9949 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9950 | |
| 9951 | memcpy(ptr, &program, 4); ptr += 4; |
| 9952 | memcpy(ptr, &location, 4); ptr += 4; |
| 9953 | memcpy(ptr, &count, 4); ptr += 4; |
| 9954 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9955 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9956 | |
| 9957 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9958 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9959 | |
| 9960 | } |
| 9961 | |
| 9962 | void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 9963 | { |
| 9964 | |
| 9965 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9966 | IOStream *stream = ctx->m_stream; |
| 9967 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9968 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 9969 | |
| 9970 | const unsigned int __size_value = (count * 4 * sizeof(GLfloat)); |
| 9971 | unsigned char *ptr; |
| 9972 | unsigned char *buf; |
| 9973 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 9974 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 9975 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 9976 | buf = stream->alloc(totalSize); |
| 9977 | ptr = buf; |
| 9978 | int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 9979 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 9980 | |
| 9981 | memcpy(ptr, &program, 4); ptr += 4; |
| 9982 | memcpy(ptr, &location, 4); ptr += 4; |
| 9983 | memcpy(ptr, &count, 4); ptr += 4; |
| 9984 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 9985 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 9986 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 9987 | |
| 9988 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 9989 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 9990 | |
| 9991 | } |
| 9992 | |
| 9993 | void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 9994 | { |
| 9995 | |
| 9996 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 9997 | IOStream *stream = ctx->m_stream; |
| 9998 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 9999 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10000 | |
| 10001 | const unsigned int __size_value = (count * 9 * sizeof(GLfloat)); |
| 10002 | unsigned char *ptr; |
| 10003 | unsigned char *buf; |
| 10004 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10005 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10006 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10007 | buf = stream->alloc(totalSize); |
| 10008 | ptr = buf; |
| 10009 | int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10010 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10011 | |
| 10012 | memcpy(ptr, &program, 4); ptr += 4; |
| 10013 | memcpy(ptr, &location, 4); ptr += 4; |
| 10014 | memcpy(ptr, &count, 4); ptr += 4; |
| 10015 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10016 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10017 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10018 | |
| 10019 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10020 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10021 | |
| 10022 | } |
| 10023 | |
| 10024 | void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10025 | { |
| 10026 | |
| 10027 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10028 | IOStream *stream = ctx->m_stream; |
| 10029 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10030 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10031 | |
| 10032 | const unsigned int __size_value = (count * 16 * sizeof(GLfloat)); |
| 10033 | unsigned char *ptr; |
| 10034 | unsigned char *buf; |
| 10035 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10036 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10037 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10038 | buf = stream->alloc(totalSize); |
| 10039 | ptr = buf; |
| 10040 | int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10041 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10042 | |
| 10043 | memcpy(ptr, &program, 4); ptr += 4; |
| 10044 | memcpy(ptr, &location, 4); ptr += 4; |
| 10045 | memcpy(ptr, &count, 4); ptr += 4; |
| 10046 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10047 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10048 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10049 | |
| 10050 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10051 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10052 | |
| 10053 | } |
| 10054 | |
| 10055 | void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10056 | { |
| 10057 | |
| 10058 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10059 | IOStream *stream = ctx->m_stream; |
| 10060 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10061 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10062 | |
| 10063 | const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| 10064 | unsigned char *ptr; |
| 10065 | unsigned char *buf; |
| 10066 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10067 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10068 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10069 | buf = stream->alloc(totalSize); |
| 10070 | ptr = buf; |
| 10071 | int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10072 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10073 | |
| 10074 | memcpy(ptr, &program, 4); ptr += 4; |
| 10075 | memcpy(ptr, &location, 4); ptr += 4; |
| 10076 | memcpy(ptr, &count, 4); ptr += 4; |
| 10077 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10078 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10079 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10080 | |
| 10081 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10082 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10083 | |
| 10084 | } |
| 10085 | |
| 10086 | void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10087 | { |
| 10088 | |
| 10089 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10090 | IOStream *stream = ctx->m_stream; |
| 10091 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10092 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10093 | |
| 10094 | const unsigned int __size_value = (count * 6 * sizeof(GLfloat)); |
| 10095 | unsigned char *ptr; |
| 10096 | unsigned char *buf; |
| 10097 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10098 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10099 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10100 | buf = stream->alloc(totalSize); |
| 10101 | ptr = buf; |
| 10102 | int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10103 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10104 | |
| 10105 | memcpy(ptr, &program, 4); ptr += 4; |
| 10106 | memcpy(ptr, &location, 4); ptr += 4; |
| 10107 | memcpy(ptr, &count, 4); ptr += 4; |
| 10108 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10109 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10110 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10111 | |
| 10112 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10113 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10114 | |
| 10115 | } |
| 10116 | |
| 10117 | void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10118 | { |
| 10119 | |
| 10120 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10121 | IOStream *stream = ctx->m_stream; |
| 10122 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10123 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10124 | |
| 10125 | const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| 10126 | unsigned char *ptr; |
| 10127 | unsigned char *buf; |
| 10128 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10129 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10130 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10131 | buf = stream->alloc(totalSize); |
| 10132 | ptr = buf; |
| 10133 | int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10134 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10135 | |
| 10136 | memcpy(ptr, &program, 4); ptr += 4; |
| 10137 | memcpy(ptr, &location, 4); ptr += 4; |
| 10138 | memcpy(ptr, &count, 4); ptr += 4; |
| 10139 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10140 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10141 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10142 | |
| 10143 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10144 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10145 | |
| 10146 | } |
| 10147 | |
| 10148 | void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10149 | { |
| 10150 | |
| 10151 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10152 | IOStream *stream = ctx->m_stream; |
| 10153 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10154 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10155 | |
| 10156 | const unsigned int __size_value = (count * 8 * sizeof(GLfloat)); |
| 10157 | unsigned char *ptr; |
| 10158 | unsigned char *buf; |
| 10159 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10160 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10161 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10162 | buf = stream->alloc(totalSize); |
| 10163 | ptr = buf; |
| 10164 | int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10165 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10166 | |
| 10167 | memcpy(ptr, &program, 4); ptr += 4; |
| 10168 | memcpy(ptr, &location, 4); ptr += 4; |
| 10169 | memcpy(ptr, &count, 4); ptr += 4; |
| 10170 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10171 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10172 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10173 | |
| 10174 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10175 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10176 | |
| 10177 | } |
| 10178 | |
| 10179 | void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10180 | { |
| 10181 | |
| 10182 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10183 | IOStream *stream = ctx->m_stream; |
| 10184 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10185 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10186 | |
| 10187 | const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| 10188 | unsigned char *ptr; |
| 10189 | unsigned char *buf; |
| 10190 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10191 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10192 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10193 | buf = stream->alloc(totalSize); |
| 10194 | ptr = buf; |
| 10195 | int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10196 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10197 | |
| 10198 | memcpy(ptr, &program, 4); ptr += 4; |
| 10199 | memcpy(ptr, &location, 4); ptr += 4; |
| 10200 | memcpy(ptr, &count, 4); ptr += 4; |
| 10201 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10202 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10203 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10204 | |
| 10205 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10206 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10207 | |
| 10208 | } |
| 10209 | |
| 10210 | void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 10211 | { |
| 10212 | |
| 10213 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10214 | IOStream *stream = ctx->m_stream; |
| 10215 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10216 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10217 | |
| 10218 | const unsigned int __size_value = (count * 12 * sizeof(GLfloat)); |
| 10219 | unsigned char *ptr; |
| 10220 | unsigned char *buf; |
| 10221 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4; |
| 10222 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10223 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10224 | buf = stream->alloc(totalSize); |
| 10225 | ptr = buf; |
| 10226 | int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10227 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10228 | |
| 10229 | memcpy(ptr, &program, 4); ptr += 4; |
| 10230 | memcpy(ptr, &location, 4); ptr += 4; |
| 10231 | memcpy(ptr, &count, 4); ptr += 4; |
| 10232 | memcpy(ptr, &transpose, 1); ptr += 1; |
| 10233 | *(unsigned int *)(ptr) = __size_value; ptr += 4; |
| 10234 | memcpy(ptr, value, __size_value);ptr += __size_value; |
| 10235 | |
| 10236 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10237 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10238 | |
| 10239 | } |
| 10240 | |
| 10241 | void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params) |
| 10242 | { |
| 10243 | |
| 10244 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10245 | IOStream *stream = ctx->m_stream; |
| 10246 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10247 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10248 | |
| 10249 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 10250 | unsigned char *ptr; |
| 10251 | unsigned char *buf; |
| 10252 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4; |
| 10253 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10254 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10255 | buf = stream->alloc(totalSize); |
| 10256 | ptr = buf; |
| 10257 | int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10258 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10259 | |
| 10260 | memcpy(ptr, &program, 4); ptr += 4; |
| 10261 | memcpy(ptr, &programInterface, 4); ptr += 4; |
| 10262 | memcpy(ptr, &pname, 4); ptr += 4; |
| 10263 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 10264 | |
| 10265 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10266 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10267 | |
| 10268 | stream->readback(params, __size_params); |
| 10269 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 10270 | if (useChecksum) { |
| 10271 | unsigned char *checksumBufPtr = NULL; |
| 10272 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10273 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10274 | stream->readback(checksumBufPtr, checksumSize); |
| 10275 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10276 | ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n"); |
| 10277 | abort(); |
| 10278 | } |
| 10279 | } |
| 10280 | } |
| 10281 | |
| 10282 | void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params) |
| 10283 | { |
| 10284 | |
| 10285 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10286 | IOStream *stream = ctx->m_stream; |
| 10287 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10288 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10289 | |
| 10290 | const unsigned int __size_props = (propCount * sizeof(GLenum)); |
| 10291 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 10292 | const unsigned int __size_params = (bufSize * sizeof(GLint)); |
| 10293 | unsigned char *ptr; |
| 10294 | unsigned char *buf; |
| 10295 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4; |
| 10296 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10297 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10298 | buf = stream->alloc(totalSize); |
| 10299 | ptr = buf; |
| 10300 | int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10301 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10302 | |
| 10303 | memcpy(ptr, &program, 4); ptr += 4; |
| 10304 | memcpy(ptr, &programInterface, 4); ptr += 4; |
| 10305 | memcpy(ptr, &index, 4); ptr += 4; |
| 10306 | memcpy(ptr, &propCount, 4); ptr += 4; |
| 10307 | *(unsigned int *)(ptr) = __size_props; ptr += 4; |
| 10308 | memcpy(ptr, props, __size_props);ptr += __size_props; |
| 10309 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 10310 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 10311 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 10312 | |
| 10313 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10314 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10315 | |
| 10316 | if (length != NULL) { |
| 10317 | stream->readback(length, __size_length); |
| 10318 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 10319 | } |
| 10320 | stream->readback(params, __size_params); |
| 10321 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 10322 | if (useChecksum) { |
| 10323 | unsigned char *checksumBufPtr = NULL; |
| 10324 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10325 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10326 | stream->readback(checksumBufPtr, checksumSize); |
| 10327 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10328 | ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n"); |
| 10329 | abort(); |
| 10330 | } |
| 10331 | } |
| 10332 | } |
| 10333 | |
| 10334 | GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name) |
| 10335 | { |
| 10336 | |
| 10337 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10338 | IOStream *stream = ctx->m_stream; |
| 10339 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10340 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10341 | |
| 10342 | const unsigned int __size_name = (strlen(name) + 1); |
| 10343 | unsigned char *ptr; |
| 10344 | unsigned char *buf; |
| 10345 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4; |
| 10346 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10347 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10348 | buf = stream->alloc(totalSize); |
| 10349 | ptr = buf; |
| 10350 | int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10351 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10352 | |
| 10353 | memcpy(ptr, &program, 4); ptr += 4; |
| 10354 | memcpy(ptr, &programInterface, 4); ptr += 4; |
| 10355 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 10356 | memcpy(ptr, name, __size_name);ptr += __size_name; |
| 10357 | |
| 10358 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10359 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10360 | |
| 10361 | |
| 10362 | GLuint retval; |
| 10363 | stream->readback(&retval, 4); |
| 10364 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 10365 | if (useChecksum) { |
| 10366 | unsigned char *checksumBufPtr = NULL; |
| 10367 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10368 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10369 | stream->readback(checksumBufPtr, checksumSize); |
| 10370 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10371 | ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n"); |
| 10372 | abort(); |
| 10373 | } |
| 10374 | } |
| 10375 | return retval; |
| 10376 | } |
| 10377 | |
| 10378 | GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name) |
| 10379 | { |
| 10380 | |
| 10381 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10382 | IOStream *stream = ctx->m_stream; |
| 10383 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10384 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10385 | |
| 10386 | const unsigned int __size_name = (strlen(name) + 1); |
| 10387 | unsigned char *ptr; |
| 10388 | unsigned char *buf; |
| 10389 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4; |
| 10390 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10391 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10392 | buf = stream->alloc(totalSize); |
| 10393 | ptr = buf; |
| 10394 | int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10395 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10396 | |
| 10397 | memcpy(ptr, &program, 4); ptr += 4; |
| 10398 | memcpy(ptr, &programInterface, 4); ptr += 4; |
| 10399 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 10400 | memcpy(ptr, name, __size_name);ptr += __size_name; |
| 10401 | |
| 10402 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10403 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10404 | |
| 10405 | |
| 10406 | GLint retval; |
| 10407 | stream->readback(&retval, 4); |
| 10408 | if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| 10409 | if (useChecksum) { |
| 10410 | unsigned char *checksumBufPtr = NULL; |
| 10411 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10412 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10413 | stream->readback(checksumBufPtr, checksumSize); |
| 10414 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10415 | ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n"); |
| 10416 | abort(); |
| 10417 | } |
| 10418 | } |
| 10419 | return retval; |
| 10420 | } |
| 10421 | |
| 10422 | void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name) |
| 10423 | { |
| 10424 | |
| 10425 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10426 | IOStream *stream = ctx->m_stream; |
| 10427 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10428 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10429 | |
| 10430 | const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0); |
| 10431 | const unsigned int __size_name = bufSize; |
| 10432 | unsigned char *ptr; |
| 10433 | unsigned char *buf; |
| 10434 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4; |
| 10435 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10436 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10437 | buf = stream->alloc(totalSize); |
| 10438 | ptr = buf; |
| 10439 | int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10440 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10441 | |
| 10442 | memcpy(ptr, &program, 4); ptr += 4; |
| 10443 | memcpy(ptr, &programInterface, 4); ptr += 4; |
| 10444 | memcpy(ptr, &index, 4); ptr += 4; |
| 10445 | memcpy(ptr, &bufSize, 4); ptr += 4; |
| 10446 | *(unsigned int *)(ptr) = __size_length; ptr += 4; |
| 10447 | *(unsigned int *)(ptr) = __size_name; ptr += 4; |
| 10448 | |
| 10449 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10450 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10451 | |
| 10452 | if (length != NULL) { |
| 10453 | stream->readback(length, __size_length); |
| 10454 | if (useChecksum) checksumCalculator->addBuffer(length, __size_length); |
| 10455 | } |
| 10456 | stream->readback(name, __size_name); |
| 10457 | if (useChecksum) checksumCalculator->addBuffer(name, __size_name); |
| 10458 | if (useChecksum) { |
| 10459 | unsigned char *checksumBufPtr = NULL; |
| 10460 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10461 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10462 | stream->readback(checksumBufPtr, checksumSize); |
| 10463 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10464 | ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n"); |
| 10465 | abort(); |
| 10466 | } |
| 10467 | } |
| 10468 | } |
| 10469 | |
| 10470 | void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) |
| 10471 | { |
| 10472 | |
| 10473 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10474 | IOStream *stream = ctx->m_stream; |
| 10475 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10476 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10477 | |
| 10478 | unsigned char *ptr; |
| 10479 | unsigned char *buf; |
| 10480 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4; |
| 10481 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10482 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10483 | buf = stream->alloc(totalSize); |
| 10484 | ptr = buf; |
| 10485 | int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10486 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10487 | |
| 10488 | memcpy(ptr, &unit, 4); ptr += 4; |
| 10489 | memcpy(ptr, &texture, 4); ptr += 4; |
| 10490 | memcpy(ptr, &level, 4); ptr += 4; |
| 10491 | memcpy(ptr, &layered, 1); ptr += 1; |
| 10492 | memcpy(ptr, &layer, 4); ptr += 4; |
| 10493 | memcpy(ptr, &access, 4); ptr += 4; |
| 10494 | memcpy(ptr, &format, 4); ptr += 4; |
| 10495 | |
| 10496 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10497 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10498 | |
| 10499 | } |
| 10500 | |
| 10501 | void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) |
| 10502 | { |
| 10503 | |
| 10504 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10505 | IOStream *stream = ctx->m_stream; |
| 10506 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10507 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10508 | |
| 10509 | unsigned char *ptr; |
| 10510 | unsigned char *buf; |
| 10511 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 10512 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10513 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10514 | buf = stream->alloc(totalSize); |
| 10515 | ptr = buf; |
| 10516 | int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10517 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10518 | |
| 10519 | memcpy(ptr, &num_groups_x, 4); ptr += 4; |
| 10520 | memcpy(ptr, &num_groups_y, 4); ptr += 4; |
| 10521 | memcpy(ptr, &num_groups_z, 4); ptr += 4; |
| 10522 | |
| 10523 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10524 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10525 | |
| 10526 | } |
| 10527 | |
| 10528 | void glDispatchComputeIndirect_enc(void *self , GLintptr indirect) |
| 10529 | { |
| 10530 | |
| 10531 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10532 | IOStream *stream = ctx->m_stream; |
| 10533 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10534 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10535 | |
| 10536 | unsigned char *ptr; |
| 10537 | unsigned char *buf; |
| 10538 | const size_t sizeWithoutChecksum = 8 + 4; |
| 10539 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10540 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10541 | buf = stream->alloc(totalSize); |
| 10542 | ptr = buf; |
| 10543 | int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10544 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10545 | |
| 10546 | memcpy(ptr, &indirect, 4); ptr += 4; |
| 10547 | |
| 10548 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10549 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10550 | |
| 10551 | } |
| 10552 | |
| 10553 | void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride) |
| 10554 | { |
| 10555 | |
| 10556 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10557 | IOStream *stream = ctx->m_stream; |
| 10558 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10559 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10560 | |
| 10561 | unsigned char *ptr; |
| 10562 | unsigned char *buf; |
| 10563 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 10564 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10565 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10566 | buf = stream->alloc(totalSize); |
| 10567 | ptr = buf; |
| 10568 | int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10569 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10570 | |
| 10571 | memcpy(ptr, &bindingindex, 4); ptr += 4; |
| 10572 | memcpy(ptr, &buffer, 4); ptr += 4; |
| 10573 | memcpy(ptr, &offset, 4); ptr += 4; |
| 10574 | memcpy(ptr, &stride, 4); ptr += 4; |
| 10575 | |
| 10576 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10577 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10578 | |
| 10579 | } |
| 10580 | |
| 10581 | void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex) |
| 10582 | { |
| 10583 | |
| 10584 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10585 | IOStream *stream = ctx->m_stream; |
| 10586 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10587 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10588 | |
| 10589 | unsigned char *ptr; |
| 10590 | unsigned char *buf; |
| 10591 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 10592 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10593 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10594 | buf = stream->alloc(totalSize); |
| 10595 | ptr = buf; |
| 10596 | int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10597 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10598 | |
| 10599 | memcpy(ptr, &attribindex, 4); ptr += 4; |
| 10600 | memcpy(ptr, &bindingindex, 4); ptr += 4; |
| 10601 | |
| 10602 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10603 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10604 | |
| 10605 | } |
| 10606 | |
| 10607 | void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) |
| 10608 | { |
| 10609 | |
| 10610 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10611 | IOStream *stream = ctx->m_stream; |
| 10612 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10613 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10614 | |
| 10615 | unsigned char *ptr; |
| 10616 | unsigned char *buf; |
| 10617 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4; |
| 10618 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10619 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10620 | buf = stream->alloc(totalSize); |
| 10621 | ptr = buf; |
| 10622 | int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10623 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10624 | |
| 10625 | memcpy(ptr, &attribindex, 4); ptr += 4; |
| 10626 | memcpy(ptr, &size, 4); ptr += 4; |
| 10627 | memcpy(ptr, &type, 4); ptr += 4; |
| 10628 | memcpy(ptr, &normalized, 1); ptr += 1; |
| 10629 | memcpy(ptr, &relativeoffset, 4); ptr += 4; |
| 10630 | |
| 10631 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10632 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10633 | |
| 10634 | } |
| 10635 | |
| 10636 | void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) |
| 10637 | { |
| 10638 | |
| 10639 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10640 | IOStream *stream = ctx->m_stream; |
| 10641 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10642 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10643 | |
| 10644 | unsigned char *ptr; |
| 10645 | unsigned char *buf; |
| 10646 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| 10647 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10648 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10649 | buf = stream->alloc(totalSize); |
| 10650 | ptr = buf; |
| 10651 | int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10652 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10653 | |
| 10654 | memcpy(ptr, &attribindex, 4); ptr += 4; |
| 10655 | memcpy(ptr, &size, 4); ptr += 4; |
| 10656 | memcpy(ptr, &type, 4); ptr += 4; |
| 10657 | memcpy(ptr, &relativeoffset, 4); ptr += 4; |
| 10658 | |
| 10659 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10660 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10661 | |
| 10662 | } |
| 10663 | |
| 10664 | void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor) |
| 10665 | { |
| 10666 | |
| 10667 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10668 | IOStream *stream = ctx->m_stream; |
| 10669 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10670 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10671 | |
| 10672 | unsigned char *ptr; |
| 10673 | unsigned char *buf; |
| 10674 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 10675 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10676 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10677 | buf = stream->alloc(totalSize); |
| 10678 | ptr = buf; |
| 10679 | int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10680 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10681 | |
| 10682 | memcpy(ptr, &bindingindex, 4); ptr += 4; |
| 10683 | memcpy(ptr, &divisor, 4); ptr += 4; |
| 10684 | |
| 10685 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10686 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10687 | |
| 10688 | } |
| 10689 | |
| 10690 | void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen) |
| 10691 | { |
| 10692 | |
| 10693 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10694 | IOStream *stream = ctx->m_stream; |
| 10695 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10696 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10697 | |
| 10698 | const unsigned int __size_indirect = datalen; |
| 10699 | unsigned char *ptr; |
| 10700 | unsigned char *buf; |
| 10701 | const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4; |
| 10702 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10703 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10704 | buf = stream->alloc(totalSize); |
| 10705 | ptr = buf; |
| 10706 | int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10707 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10708 | |
| 10709 | memcpy(ptr, &mode, 4); ptr += 4; |
| 10710 | *(unsigned int *)(ptr) = __size_indirect; ptr += 4; |
| 10711 | memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect; |
| 10712 | memcpy(ptr, &datalen, 4); ptr += 4; |
| 10713 | |
| 10714 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10715 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10716 | |
| 10717 | } |
| 10718 | |
| 10719 | void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset) |
| 10720 | { |
| 10721 | |
| 10722 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10723 | IOStream *stream = ctx->m_stream; |
| 10724 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10725 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10726 | |
| 10727 | unsigned char *ptr; |
| 10728 | unsigned char *buf; |
| 10729 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 10730 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10731 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10732 | buf = stream->alloc(totalSize); |
| 10733 | ptr = buf; |
| 10734 | int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10735 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10736 | |
| 10737 | memcpy(ptr, &mode, 4); ptr += 4; |
| 10738 | memcpy(ptr, &offset, 4); ptr += 4; |
| 10739 | |
| 10740 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10741 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10742 | |
| 10743 | } |
| 10744 | |
| 10745 | void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen) |
| 10746 | { |
| 10747 | |
| 10748 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10749 | IOStream *stream = ctx->m_stream; |
| 10750 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10751 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10752 | |
| 10753 | const unsigned int __size_indirect = datalen; |
| 10754 | unsigned char *ptr; |
| 10755 | unsigned char *buf; |
| 10756 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4; |
| 10757 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10758 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10759 | buf = stream->alloc(totalSize); |
| 10760 | ptr = buf; |
| 10761 | int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10762 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10763 | |
| 10764 | memcpy(ptr, &mode, 4); ptr += 4; |
| 10765 | memcpy(ptr, &type, 4); ptr += 4; |
| 10766 | *(unsigned int *)(ptr) = __size_indirect; ptr += 4; |
| 10767 | memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect; |
| 10768 | memcpy(ptr, &datalen, 4); ptr += 4; |
| 10769 | |
| 10770 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10771 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10772 | |
| 10773 | } |
| 10774 | |
| 10775 | void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset) |
| 10776 | { |
| 10777 | |
| 10778 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10779 | IOStream *stream = ctx->m_stream; |
| 10780 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10781 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10782 | |
| 10783 | unsigned char *ptr; |
| 10784 | unsigned char *buf; |
| 10785 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 10786 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10787 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10788 | buf = stream->alloc(totalSize); |
| 10789 | ptr = buf; |
| 10790 | int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10791 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10792 | |
| 10793 | memcpy(ptr, &mode, 4); ptr += 4; |
| 10794 | memcpy(ptr, &type, 4); ptr += 4; |
| 10795 | memcpy(ptr, &offset, 4); ptr += 4; |
| 10796 | |
| 10797 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10798 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10799 | |
| 10800 | } |
| 10801 | |
| 10802 | void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) |
| 10803 | { |
| 10804 | |
| 10805 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10806 | IOStream *stream = ctx->m_stream; |
| 10807 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10808 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10809 | |
| 10810 | unsigned char *ptr; |
| 10811 | unsigned char *buf; |
| 10812 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1; |
| 10813 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10814 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10815 | buf = stream->alloc(totalSize); |
| 10816 | ptr = buf; |
| 10817 | int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10818 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10819 | |
| 10820 | memcpy(ptr, &target, 4); ptr += 4; |
| 10821 | memcpy(ptr, &samples, 4); ptr += 4; |
| 10822 | memcpy(ptr, &internalformat, 4); ptr += 4; |
| 10823 | memcpy(ptr, &width, 4); ptr += 4; |
| 10824 | memcpy(ptr, &height, 4); ptr += 4; |
| 10825 | memcpy(ptr, &fixedsamplelocations, 1); ptr += 1; |
| 10826 | |
| 10827 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10828 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10829 | |
| 10830 | } |
| 10831 | |
| 10832 | void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask) |
| 10833 | { |
| 10834 | |
| 10835 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10836 | IOStream *stream = ctx->m_stream; |
| 10837 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10838 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10839 | |
| 10840 | unsigned char *ptr; |
| 10841 | unsigned char *buf; |
| 10842 | const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| 10843 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10844 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10845 | buf = stream->alloc(totalSize); |
| 10846 | ptr = buf; |
| 10847 | int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10848 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10849 | |
| 10850 | memcpy(ptr, &maskNumber, 4); ptr += 4; |
| 10851 | memcpy(ptr, &mask, 4); ptr += 4; |
| 10852 | |
| 10853 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10854 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10855 | |
| 10856 | } |
| 10857 | |
| 10858 | void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val) |
| 10859 | { |
| 10860 | |
| 10861 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10862 | IOStream *stream = ctx->m_stream; |
| 10863 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10864 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10865 | |
| 10866 | const unsigned int __size_val = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 10867 | unsigned char *ptr; |
| 10868 | unsigned char *buf; |
| 10869 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 10870 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10871 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10872 | buf = stream->alloc(totalSize); |
| 10873 | ptr = buf; |
| 10874 | int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10875 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10876 | |
| 10877 | memcpy(ptr, &pname, 4); ptr += 4; |
| 10878 | memcpy(ptr, &index, 4); ptr += 4; |
| 10879 | *(unsigned int *)(ptr) = __size_val; ptr += 4; |
| 10880 | |
| 10881 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10882 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10883 | |
| 10884 | stream->readback(val, __size_val); |
| 10885 | if (useChecksum) checksumCalculator->addBuffer(val, __size_val); |
| 10886 | if (useChecksum) { |
| 10887 | unsigned char *checksumBufPtr = NULL; |
| 10888 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10889 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10890 | stream->readback(checksumBufPtr, checksumSize); |
| 10891 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10892 | ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n"); |
| 10893 | abort(); |
| 10894 | } |
| 10895 | } |
| 10896 | } |
| 10897 | |
| 10898 | void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param) |
| 10899 | { |
| 10900 | |
| 10901 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10902 | IOStream *stream = ctx->m_stream; |
| 10903 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10904 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10905 | |
| 10906 | unsigned char *ptr; |
| 10907 | unsigned char *buf; |
| 10908 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| 10909 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10910 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10911 | buf = stream->alloc(totalSize); |
| 10912 | ptr = buf; |
| 10913 | int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10914 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10915 | |
| 10916 | memcpy(ptr, &target, 4); ptr += 4; |
| 10917 | memcpy(ptr, &pname, 4); ptr += 4; |
| 10918 | memcpy(ptr, ¶m, 4); ptr += 4; |
| 10919 | |
| 10920 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10921 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10922 | |
| 10923 | } |
| 10924 | |
| 10925 | void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params) |
| 10926 | { |
| 10927 | |
| 10928 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10929 | IOStream *stream = ctx->m_stream; |
| 10930 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10931 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10932 | |
| 10933 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 10934 | unsigned char *ptr; |
| 10935 | unsigned char *buf; |
| 10936 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4; |
| 10937 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10938 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10939 | buf = stream->alloc(totalSize); |
| 10940 | ptr = buf; |
| 10941 | int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10942 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10943 | |
| 10944 | memcpy(ptr, &target, 4); ptr += 4; |
| 10945 | memcpy(ptr, &pname, 4); ptr += 4; |
| 10946 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 10947 | |
| 10948 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10949 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10950 | |
| 10951 | stream->readback(params, __size_params); |
| 10952 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 10953 | if (useChecksum) { |
| 10954 | unsigned char *checksumBufPtr = NULL; |
| 10955 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10956 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10957 | stream->readback(checksumBufPtr, checksumSize); |
| 10958 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 10959 | ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 10960 | abort(); |
| 10961 | } |
| 10962 | } |
| 10963 | } |
| 10964 | |
| 10965 | void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params) |
| 10966 | { |
| 10967 | |
| 10968 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 10969 | IOStream *stream = ctx->m_stream; |
| 10970 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 10971 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 10972 | |
| 10973 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat)); |
| 10974 | unsigned char *ptr; |
| 10975 | unsigned char *buf; |
| 10976 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4; |
| 10977 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 10978 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 10979 | buf = stream->alloc(totalSize); |
| 10980 | ptr = buf; |
| 10981 | int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 10982 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 10983 | |
| 10984 | memcpy(ptr, &target, 4); ptr += 4; |
| 10985 | memcpy(ptr, &level, 4); ptr += 4; |
| 10986 | memcpy(ptr, &pname, 4); ptr += 4; |
| 10987 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 10988 | |
| 10989 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 10990 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 10991 | |
| 10992 | stream->readback(params, __size_params); |
| 10993 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 10994 | if (useChecksum) { |
| 10995 | unsigned char *checksumBufPtr = NULL; |
| 10996 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 10997 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 10998 | stream->readback(checksumBufPtr, checksumSize); |
| 10999 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 11000 | ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n"); |
| 11001 | abort(); |
| 11002 | } |
| 11003 | } |
| 11004 | } |
| 11005 | |
| 11006 | void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params) |
| 11007 | { |
| 11008 | |
| 11009 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 11010 | IOStream *stream = ctx->m_stream; |
| 11011 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 11012 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 11013 | |
| 11014 | const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint)); |
| 11015 | unsigned char *ptr; |
| 11016 | unsigned char *buf; |
| 11017 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4; |
| 11018 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 11019 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 11020 | buf = stream->alloc(totalSize); |
| 11021 | ptr = buf; |
| 11022 | int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4; |
| 11023 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 11024 | |
| 11025 | memcpy(ptr, &target, 4); ptr += 4; |
| 11026 | memcpy(ptr, &level, 4); ptr += 4; |
| 11027 | memcpy(ptr, &pname, 4); ptr += 4; |
| 11028 | *(unsigned int *)(ptr) = __size_params; ptr += 4; |
| 11029 | |
| 11030 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 11031 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 11032 | |
| 11033 | stream->readback(params, __size_params); |
| 11034 | if (useChecksum) checksumCalculator->addBuffer(params, __size_params); |
| 11035 | if (useChecksum) { |
| 11036 | unsigned char *checksumBufPtr = NULL; |
| 11037 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 11038 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 11039 | stream->readback(checksumBufPtr, checksumSize); |
| 11040 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 11041 | ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n"); |
| 11042 | abort(); |
| 11043 | } |
| 11044 | } |
| 11045 | } |
| 11046 | |
Roman Kiryanov | be1c0c2 | 2018-10-02 18:07:14 -0700 | [diff] [blame^] | 11047 | void glMapBufferRangeDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr) |
| 11048 | { |
| 11049 | |
| 11050 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 11051 | IOStream *stream = ctx->m_stream; |
| 11052 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 11053 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 11054 | |
| 11055 | unsigned char *ptr; |
| 11056 | unsigned char *buf; |
| 11057 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8; |
| 11058 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 11059 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 11060 | buf = stream->alloc(totalSize); |
| 11061 | ptr = buf; |
| 11062 | int tmp = OP_glMapBufferRangeDMA;memcpy(ptr, &tmp, 4); ptr += 4; |
| 11063 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 11064 | |
| 11065 | memcpy(ptr, &target, 4); ptr += 4; |
| 11066 | memcpy(ptr, &offset, 4); ptr += 4; |
| 11067 | memcpy(ptr, &length, 4); ptr += 4; |
| 11068 | memcpy(ptr, &access, 4); ptr += 4; |
| 11069 | memcpy(ptr, &paddr, 8); ptr += 8; |
| 11070 | |
| 11071 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 11072 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 11073 | |
| 11074 | } |
| 11075 | |
| 11076 | void glUnmapBufferDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, GLboolean* out_res) |
| 11077 | { |
| 11078 | |
| 11079 | gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self; |
| 11080 | IOStream *stream = ctx->m_stream; |
| 11081 | ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| 11082 | bool useChecksum = checksumCalculator->getVersion() > 0; |
| 11083 | |
| 11084 | const unsigned int __size_out_res = (sizeof(GLboolean)); |
| 11085 | unsigned char *ptr; |
| 11086 | unsigned char *buf; |
| 11087 | const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 0 + 1*4; |
| 11088 | const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| 11089 | const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| 11090 | buf = stream->alloc(totalSize); |
| 11091 | ptr = buf; |
| 11092 | int tmp = OP_glUnmapBufferDMA;memcpy(ptr, &tmp, 4); ptr += 4; |
| 11093 | memcpy(ptr, &totalSize, 4); ptr += 4; |
| 11094 | |
| 11095 | memcpy(ptr, &target, 4); ptr += 4; |
| 11096 | memcpy(ptr, &offset, 4); ptr += 4; |
| 11097 | memcpy(ptr, &length, 4); ptr += 4; |
| 11098 | memcpy(ptr, &access, 4); ptr += 4; |
| 11099 | memcpy(ptr, &paddr, 8); ptr += 8; |
| 11100 | *(unsigned int *)(ptr) = __size_out_res; ptr += 4; |
| 11101 | |
| 11102 | if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| 11103 | if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| 11104 | |
| 11105 | stream->readback(out_res, __size_out_res); |
| 11106 | if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res); |
| 11107 | if (useChecksum) { |
| 11108 | unsigned char *checksumBufPtr = NULL; |
| 11109 | unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| 11110 | if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| 11111 | stream->readback(checksumBufPtr, checksumSize); |
| 11112 | if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| 11113 | ALOGE("glUnmapBufferDMA: GL communication error, please report this issue to b.android.com.\n"); |
| 11114 | abort(); |
| 11115 | } |
| 11116 | } |
| 11117 | } |
| 11118 | |
David 'Digit' Turner | 4f91c8e | 2014-10-31 11:39:38 +0100 | [diff] [blame] | 11119 | } // namespace |
David 'Digit' Turner | 3372af9 | 2014-10-29 09:55:08 +0100 | [diff] [blame] | 11120 | |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 11121 | gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator) |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 11122 | { |
| 11123 | m_stream = stream; |
Yahan Zhou | b7f0908 | 2016-03-10 11:45:02 -0800 | [diff] [blame] | 11124 | m_checksumCalculator = checksumCalculator; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 11125 | |
David 'Digit' Turner | 3afd44b | 2014-10-30 18:15:04 +0100 | [diff] [blame] | 11126 | this->glActiveTexture = &glActiveTexture_enc; |
| 11127 | this->glAttachShader = &glAttachShader_enc; |
| 11128 | this->glBindAttribLocation = &glBindAttribLocation_enc; |
| 11129 | this->glBindBuffer = &glBindBuffer_enc; |
| 11130 | this->glBindFramebuffer = &glBindFramebuffer_enc; |
| 11131 | this->glBindRenderbuffer = &glBindRenderbuffer_enc; |
| 11132 | this->glBindTexture = &glBindTexture_enc; |
| 11133 | this->glBlendColor = &glBlendColor_enc; |
| 11134 | this->glBlendEquation = &glBlendEquation_enc; |
| 11135 | this->glBlendEquationSeparate = &glBlendEquationSeparate_enc; |
| 11136 | this->glBlendFunc = &glBlendFunc_enc; |
| 11137 | this->glBlendFuncSeparate = &glBlendFuncSeparate_enc; |
| 11138 | this->glBufferData = &glBufferData_enc; |
| 11139 | this->glBufferSubData = &glBufferSubData_enc; |
| 11140 | this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc; |
| 11141 | this->glClear = &glClear_enc; |
| 11142 | this->glClearColor = &glClearColor_enc; |
| 11143 | this->glClearDepthf = &glClearDepthf_enc; |
| 11144 | this->glClearStencil = &glClearStencil_enc; |
| 11145 | this->glColorMask = &glColorMask_enc; |
| 11146 | this->glCompileShader = &glCompileShader_enc; |
| 11147 | this->glCompressedTexImage2D = &glCompressedTexImage2D_enc; |
| 11148 | this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc; |
| 11149 | this->glCopyTexImage2D = &glCopyTexImage2D_enc; |
| 11150 | this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc; |
| 11151 | this->glCreateProgram = &glCreateProgram_enc; |
| 11152 | this->glCreateShader = &glCreateShader_enc; |
| 11153 | this->glCullFace = &glCullFace_enc; |
| 11154 | this->glDeleteBuffers = &glDeleteBuffers_enc; |
| 11155 | this->glDeleteFramebuffers = &glDeleteFramebuffers_enc; |
| 11156 | this->glDeleteProgram = &glDeleteProgram_enc; |
| 11157 | this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc; |
| 11158 | this->glDeleteShader = &glDeleteShader_enc; |
| 11159 | this->glDeleteTextures = &glDeleteTextures_enc; |
| 11160 | this->glDepthFunc = &glDepthFunc_enc; |
| 11161 | this->glDepthMask = &glDepthMask_enc; |
| 11162 | this->glDepthRangef = &glDepthRangef_enc; |
| 11163 | this->glDetachShader = &glDetachShader_enc; |
| 11164 | this->glDisable = &glDisable_enc; |
| 11165 | this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc; |
| 11166 | this->glDrawArrays = &glDrawArrays_enc; |
| 11167 | this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported; |
| 11168 | this->glEnable = &glEnable_enc; |
| 11169 | this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc; |
| 11170 | this->glFinish = &glFinish_enc; |
| 11171 | this->glFlush = &glFlush_enc; |
| 11172 | this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc; |
| 11173 | this->glFramebufferTexture2D = &glFramebufferTexture2D_enc; |
| 11174 | this->glFrontFace = &glFrontFace_enc; |
| 11175 | this->glGenBuffers = &glGenBuffers_enc; |
| 11176 | this->glGenerateMipmap = &glGenerateMipmap_enc; |
| 11177 | this->glGenFramebuffers = &glGenFramebuffers_enc; |
| 11178 | this->glGenRenderbuffers = &glGenRenderbuffers_enc; |
| 11179 | this->glGenTextures = &glGenTextures_enc; |
| 11180 | this->glGetActiveAttrib = &glGetActiveAttrib_enc; |
| 11181 | this->glGetActiveUniform = &glGetActiveUniform_enc; |
| 11182 | this->glGetAttachedShaders = &glGetAttachedShaders_enc; |
| 11183 | this->glGetAttribLocation = &glGetAttribLocation_enc; |
| 11184 | this->glGetBooleanv = &glGetBooleanv_enc; |
| 11185 | this->glGetBufferParameteriv = &glGetBufferParameteriv_enc; |
| 11186 | this->glGetError = &glGetError_enc; |
| 11187 | this->glGetFloatv = &glGetFloatv_enc; |
| 11188 | this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc; |
| 11189 | this->glGetIntegerv = &glGetIntegerv_enc; |
| 11190 | this->glGetProgramiv = &glGetProgramiv_enc; |
| 11191 | this->glGetProgramInfoLog = &glGetProgramInfoLog_enc; |
| 11192 | this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc; |
| 11193 | this->glGetShaderiv = &glGetShaderiv_enc; |
| 11194 | this->glGetShaderInfoLog = &glGetShaderInfoLog_enc; |
| 11195 | this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc; |
| 11196 | this->glGetShaderSource = &glGetShaderSource_enc; |
| 11197 | this->glGetString = (glGetString_client_proc_t) &enc_unsupported; |
| 11198 | this->glGetTexParameterfv = &glGetTexParameterfv_enc; |
| 11199 | this->glGetTexParameteriv = &glGetTexParameteriv_enc; |
| 11200 | this->glGetUniformfv = &glGetUniformfv_enc; |
| 11201 | this->glGetUniformiv = &glGetUniformiv_enc; |
| 11202 | this->glGetUniformLocation = &glGetUniformLocation_enc; |
| 11203 | this->glGetVertexAttribfv = &glGetVertexAttribfv_enc; |
| 11204 | this->glGetVertexAttribiv = &glGetVertexAttribiv_enc; |
| 11205 | this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported; |
| 11206 | this->glHint = &glHint_enc; |
| 11207 | this->glIsBuffer = &glIsBuffer_enc; |
| 11208 | this->glIsEnabled = &glIsEnabled_enc; |
| 11209 | this->glIsFramebuffer = &glIsFramebuffer_enc; |
| 11210 | this->glIsProgram = &glIsProgram_enc; |
| 11211 | this->glIsRenderbuffer = &glIsRenderbuffer_enc; |
| 11212 | this->glIsShader = &glIsShader_enc; |
| 11213 | this->glIsTexture = &glIsTexture_enc; |
| 11214 | this->glLineWidth = &glLineWidth_enc; |
| 11215 | this->glLinkProgram = &glLinkProgram_enc; |
| 11216 | this->glPixelStorei = &glPixelStorei_enc; |
| 11217 | this->glPolygonOffset = &glPolygonOffset_enc; |
| 11218 | this->glReadPixels = &glReadPixels_enc; |
| 11219 | this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc; |
| 11220 | this->glRenderbufferStorage = &glRenderbufferStorage_enc; |
| 11221 | this->glSampleCoverage = &glSampleCoverage_enc; |
| 11222 | this->glScissor = &glScissor_enc; |
| 11223 | this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported; |
| 11224 | this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported; |
| 11225 | this->glStencilFunc = &glStencilFunc_enc; |
| 11226 | this->glStencilFuncSeparate = &glStencilFuncSeparate_enc; |
| 11227 | this->glStencilMask = &glStencilMask_enc; |
| 11228 | this->glStencilMaskSeparate = &glStencilMaskSeparate_enc; |
| 11229 | this->glStencilOp = &glStencilOp_enc; |
| 11230 | this->glStencilOpSeparate = &glStencilOpSeparate_enc; |
| 11231 | this->glTexImage2D = &glTexImage2D_enc; |
| 11232 | this->glTexParameterf = &glTexParameterf_enc; |
| 11233 | this->glTexParameterfv = &glTexParameterfv_enc; |
| 11234 | this->glTexParameteri = &glTexParameteri_enc; |
| 11235 | this->glTexParameteriv = &glTexParameteriv_enc; |
| 11236 | this->glTexSubImage2D = &glTexSubImage2D_enc; |
| 11237 | this->glUniform1f = &glUniform1f_enc; |
| 11238 | this->glUniform1fv = &glUniform1fv_enc; |
| 11239 | this->glUniform1i = &glUniform1i_enc; |
| 11240 | this->glUniform1iv = &glUniform1iv_enc; |
| 11241 | this->glUniform2f = &glUniform2f_enc; |
| 11242 | this->glUniform2fv = &glUniform2fv_enc; |
| 11243 | this->glUniform2i = &glUniform2i_enc; |
| 11244 | this->glUniform2iv = &glUniform2iv_enc; |
| 11245 | this->glUniform3f = &glUniform3f_enc; |
| 11246 | this->glUniform3fv = &glUniform3fv_enc; |
| 11247 | this->glUniform3i = &glUniform3i_enc; |
| 11248 | this->glUniform3iv = &glUniform3iv_enc; |
| 11249 | this->glUniform4f = &glUniform4f_enc; |
| 11250 | this->glUniform4fv = &glUniform4fv_enc; |
| 11251 | this->glUniform4i = &glUniform4i_enc; |
| 11252 | this->glUniform4iv = &glUniform4iv_enc; |
| 11253 | this->glUniformMatrix2fv = &glUniformMatrix2fv_enc; |
| 11254 | this->glUniformMatrix3fv = &glUniformMatrix3fv_enc; |
| 11255 | this->glUniformMatrix4fv = &glUniformMatrix4fv_enc; |
| 11256 | this->glUseProgram = &glUseProgram_enc; |
| 11257 | this->glValidateProgram = &glValidateProgram_enc; |
| 11258 | this->glVertexAttrib1f = &glVertexAttrib1f_enc; |
| 11259 | this->glVertexAttrib1fv = &glVertexAttrib1fv_enc; |
| 11260 | this->glVertexAttrib2f = &glVertexAttrib2f_enc; |
| 11261 | this->glVertexAttrib2fv = &glVertexAttrib2fv_enc; |
| 11262 | this->glVertexAttrib3f = &glVertexAttrib3f_enc; |
| 11263 | this->glVertexAttrib3fv = &glVertexAttrib3fv_enc; |
| 11264 | this->glVertexAttrib4f = &glVertexAttrib4f_enc; |
| 11265 | this->glVertexAttrib4fv = &glVertexAttrib4fv_enc; |
| 11266 | this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported; |
| 11267 | this->glViewport = &glViewport_enc; |
| 11268 | this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc; |
| 11269 | this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc; |
| 11270 | this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported; |
| 11271 | this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported; |
| 11272 | this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported; |
| 11273 | this->glUnmapBufferOES = &glUnmapBufferOES_enc; |
| 11274 | this->glTexImage3DOES = &glTexImage3DOES_enc; |
| 11275 | this->glTexSubImage3DOES = &glTexSubImage3DOES_enc; |
| 11276 | this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc; |
| 11277 | this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc; |
| 11278 | this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc; |
| 11279 | this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc; |
| 11280 | this->glBindVertexArrayOES = &glBindVertexArrayOES_enc; |
| 11281 | this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc; |
| 11282 | this->glGenVertexArraysOES = &glGenVertexArraysOES_enc; |
| 11283 | this->glIsVertexArrayOES = &glIsVertexArrayOES_enc; |
| 11284 | this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc; |
| 11285 | this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported; |
| 11286 | this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported; |
| 11287 | this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported; |
| 11288 | this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported; |
| 11289 | this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported; |
| 11290 | this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported; |
| 11291 | this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported; |
| 11292 | this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported; |
| 11293 | this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported; |
| 11294 | this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported; |
| 11295 | this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported; |
| 11296 | this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported; |
| 11297 | this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported; |
| 11298 | this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported; |
| 11299 | this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported; |
| 11300 | this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported; |
| 11301 | this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported; |
| 11302 | this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported; |
| 11303 | this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported; |
| 11304 | this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported; |
| 11305 | this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported; |
| 11306 | this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported; |
| 11307 | this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported; |
| 11308 | this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported; |
| 11309 | this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported; |
| 11310 | this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported; |
| 11311 | this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported; |
| 11312 | this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported; |
| 11313 | this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported; |
| 11314 | this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported; |
| 11315 | this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported; |
| 11316 | this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported; |
| 11317 | this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported; |
| 11318 | this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported; |
| 11319 | this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported; |
| 11320 | this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported; |
| 11321 | this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported; |
| 11322 | this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported; |
| 11323 | this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported; |
| 11324 | this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported; |
| 11325 | this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported; |
| 11326 | this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported; |
| 11327 | this->glVertexAttribPointerData = &glVertexAttribPointerData_enc; |
| 11328 | this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc; |
| 11329 | this->glDrawElementsOffset = &glDrawElementsOffset_enc; |
| 11330 | this->glDrawElementsData = &glDrawElementsData_enc; |
| 11331 | this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc; |
| 11332 | this->glShaderString = &glShaderString_enc; |
| 11333 | this->glFinishRoundTrip = &glFinishRoundTrip_enc; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 11334 | this->glGenVertexArrays = &glGenVertexArrays_enc; |
| 11335 | this->glBindVertexArray = &glBindVertexArray_enc; |
| 11336 | this->glDeleteVertexArrays = &glDeleteVertexArrays_enc; |
| 11337 | this->glIsVertexArray = &glIsVertexArray_enc; |
| 11338 | this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported; |
| 11339 | this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported; |
| 11340 | this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported; |
| 11341 | this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc; |
| 11342 | this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc; |
| 11343 | this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc; |
| 11344 | this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc; |
| 11345 | this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc; |
| 11346 | this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc; |
| 11347 | this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc; |
| 11348 | this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc; |
| 11349 | this->glBindBufferRange = &glBindBufferRange_enc; |
| 11350 | this->glBindBufferBase = &glBindBufferBase_enc; |
| 11351 | this->glCopyBufferSubData = &glCopyBufferSubData_enc; |
| 11352 | this->glClearBufferiv = &glClearBufferiv_enc; |
| 11353 | this->glClearBufferuiv = &glClearBufferuiv_enc; |
| 11354 | this->glClearBufferfv = &glClearBufferfv_enc; |
| 11355 | this->glClearBufferfi = &glClearBufferfi_enc; |
| 11356 | this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported; |
| 11357 | this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported; |
| 11358 | this->glUniformBlockBinding = &glUniformBlockBinding_enc; |
| 11359 | this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc; |
| 11360 | this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported; |
| 11361 | this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc; |
| 11362 | this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc; |
| 11363 | this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc; |
| 11364 | this->glUniform1ui = &glUniform1ui_enc; |
| 11365 | this->glUniform2ui = &glUniform2ui_enc; |
| 11366 | this->glUniform3ui = &glUniform3ui_enc; |
| 11367 | this->glUniform4ui = &glUniform4ui_enc; |
| 11368 | this->glUniform1uiv = &glUniform1uiv_enc; |
| 11369 | this->glUniform2uiv = &glUniform2uiv_enc; |
| 11370 | this->glUniform3uiv = &glUniform3uiv_enc; |
| 11371 | this->glUniform4uiv = &glUniform4uiv_enc; |
| 11372 | this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc; |
| 11373 | this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc; |
| 11374 | this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc; |
| 11375 | this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc; |
| 11376 | this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc; |
| 11377 | this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc; |
| 11378 | this->glGetUniformuiv = &glGetUniformuiv_enc; |
| 11379 | this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc; |
| 11380 | this->glVertexAttribI4i = &glVertexAttribI4i_enc; |
| 11381 | this->glVertexAttribI4ui = &glVertexAttribI4ui_enc; |
| 11382 | this->glVertexAttribI4iv = &glVertexAttribI4iv_enc; |
| 11383 | this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc; |
| 11384 | this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported; |
| 11385 | this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc; |
| 11386 | this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc; |
| 11387 | this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc; |
| 11388 | this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc; |
| 11389 | this->glVertexAttribDivisor = &glVertexAttribDivisor_enc; |
| 11390 | this->glDrawArraysInstanced = &glDrawArraysInstanced_enc; |
| 11391 | this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported; |
| 11392 | this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc; |
| 11393 | this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc; |
| 11394 | this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported; |
| 11395 | this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc; |
| 11396 | this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc; |
Lingfeng Yang | f000ab4 | 2017-01-11 18:31:38 -0800 | [diff] [blame] | 11397 | this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported; |
| 11398 | this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported; |
| 11399 | this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported; |
| 11400 | this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported; |
| 11401 | this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported; |
| 11402 | this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported; |
| 11403 | this->glFenceSyncAEMU = &glFenceSyncAEMU_enc; |
| 11404 | this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc; |
| 11405 | this->glWaitSyncAEMU = &glWaitSyncAEMU_enc; |
| 11406 | this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc; |
| 11407 | this->glIsSyncAEMU = &glIsSyncAEMU_enc; |
| 11408 | this->glGetSyncivAEMU = &glGetSyncivAEMU_enc; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 11409 | this->glDrawBuffers = &glDrawBuffers_enc; |
| 11410 | this->glReadBuffer = &glReadBuffer_enc; |
| 11411 | this->glBlitFramebuffer = &glBlitFramebuffer_enc; |
| 11412 | this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc; |
| 11413 | this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc; |
| 11414 | this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc; |
| 11415 | this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc; |
| 11416 | this->glTexStorage2D = &glTexStorage2D_enc; |
| 11417 | this->glGetInternalformativ = &glGetInternalformativ_enc; |
| 11418 | this->glBeginTransformFeedback = &glBeginTransformFeedback_enc; |
| 11419 | this->glEndTransformFeedback = &glEndTransformFeedback_enc; |
| 11420 | this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc; |
| 11421 | this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc; |
| 11422 | this->glBindTransformFeedback = &glBindTransformFeedback_enc; |
| 11423 | this->glPauseTransformFeedback = &glPauseTransformFeedback_enc; |
| 11424 | this->glResumeTransformFeedback = &glResumeTransformFeedback_enc; |
| 11425 | this->glIsTransformFeedback = &glIsTransformFeedback_enc; |
| 11426 | this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported; |
| 11427 | this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc; |
| 11428 | this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc; |
| 11429 | this->glGenSamplers = &glGenSamplers_enc; |
| 11430 | this->glDeleteSamplers = &glDeleteSamplers_enc; |
| 11431 | this->glBindSampler = &glBindSampler_enc; |
| 11432 | this->glSamplerParameterf = &glSamplerParameterf_enc; |
| 11433 | this->glSamplerParameteri = &glSamplerParameteri_enc; |
| 11434 | this->glSamplerParameterfv = &glSamplerParameterfv_enc; |
| 11435 | this->glSamplerParameteriv = &glSamplerParameteriv_enc; |
| 11436 | this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc; |
| 11437 | this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc; |
| 11438 | this->glIsSampler = &glIsSampler_enc; |
| 11439 | this->glGenQueries = &glGenQueries_enc; |
| 11440 | this->glDeleteQueries = &glDeleteQueries_enc; |
| 11441 | this->glBeginQuery = &glBeginQuery_enc; |
| 11442 | this->glEndQuery = &glEndQuery_enc; |
| 11443 | this->glGetQueryiv = &glGetQueryiv_enc; |
| 11444 | this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc; |
| 11445 | this->glIsQuery = &glIsQuery_enc; |
| 11446 | this->glProgramParameteri = &glProgramParameteri_enc; |
| 11447 | this->glProgramBinary = &glProgramBinary_enc; |
| 11448 | this->glGetProgramBinary = &glGetProgramBinary_enc; |
| 11449 | this->glGetFragDataLocation = &glGetFragDataLocation_enc; |
| 11450 | this->glGetInteger64v = &glGetInteger64v_enc; |
| 11451 | this->glGetIntegeri_v = &glGetIntegeri_v_enc; |
| 11452 | this->glGetInteger64i_v = &glGetInteger64i_v_enc; |
| 11453 | this->glTexImage3D = &glTexImage3D_enc; |
| 11454 | this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc; |
| 11455 | this->glTexStorage3D = &glTexStorage3D_enc; |
| 11456 | this->glTexSubImage3D = &glTexSubImage3D_enc; |
| 11457 | this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc; |
| 11458 | this->glCompressedTexImage3D = &glCompressedTexImage3D_enc; |
| 11459 | this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc; |
| 11460 | this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc; |
| 11461 | this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc; |
| 11462 | this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc; |
| 11463 | this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported; |
| 11464 | this->glGetBooleani_v = &glGetBooleani_v_enc; |
| 11465 | this->glMemoryBarrier = &glMemoryBarrier_enc; |
| 11466 | this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc; |
| 11467 | this->glGenProgramPipelines = &glGenProgramPipelines_enc; |
| 11468 | this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc; |
| 11469 | this->glBindProgramPipeline = &glBindProgramPipeline_enc; |
| 11470 | this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc; |
| 11471 | this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc; |
| 11472 | this->glValidateProgramPipeline = &glValidateProgramPipeline_enc; |
| 11473 | this->glIsProgramPipeline = &glIsProgramPipeline_enc; |
| 11474 | this->glUseProgramStages = &glUseProgramStages_enc; |
Lingfeng Yang | d3ae106 | 2017-01-18 11:42:04 -0800 | [diff] [blame] | 11475 | this->glActiveShaderProgram = &glActiveShaderProgram_enc; |
Lingfeng Yang | e6556dc | 2017-01-09 12:04:12 -0800 | [diff] [blame] | 11476 | this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported; |
| 11477 | this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc; |
| 11478 | this->glProgramUniform1f = &glProgramUniform1f_enc; |
| 11479 | this->glProgramUniform2f = &glProgramUniform2f_enc; |
| 11480 | this->glProgramUniform3f = &glProgramUniform3f_enc; |
| 11481 | this->glProgramUniform4f = &glProgramUniform4f_enc; |
| 11482 | this->glProgramUniform1i = &glProgramUniform1i_enc; |
| 11483 | this->glProgramUniform2i = &glProgramUniform2i_enc; |
| 11484 | this->glProgramUniform3i = &glProgramUniform3i_enc; |
| 11485 | this->glProgramUniform4i = &glProgramUniform4i_enc; |
| 11486 | this->glProgramUniform1ui = &glProgramUniform1ui_enc; |
| 11487 | this->glProgramUniform2ui = &glProgramUniform2ui_enc; |
| 11488 | this->glProgramUniform3ui = &glProgramUniform3ui_enc; |
| 11489 | this->glProgramUniform4ui = &glProgramUniform4ui_enc; |
| 11490 | this->glProgramUniform1fv = &glProgramUniform1fv_enc; |
| 11491 | this->glProgramUniform2fv = &glProgramUniform2fv_enc; |
| 11492 | this->glProgramUniform3fv = &glProgramUniform3fv_enc; |
| 11493 | this->glProgramUniform4fv = &glProgramUniform4fv_enc; |
| 11494 | this->glProgramUniform1iv = &glProgramUniform1iv_enc; |
| 11495 | this->glProgramUniform2iv = &glProgramUniform2iv_enc; |
| 11496 | this->glProgramUniform3iv = &glProgramUniform3iv_enc; |
| 11497 | this->glProgramUniform4iv = &glProgramUniform4iv_enc; |
| 11498 | this->glProgramUniform1uiv = &glProgramUniform1uiv_enc; |
| 11499 | this->glProgramUniform2uiv = &glProgramUniform2uiv_enc; |
| 11500 | this->glProgramUniform3uiv = &glProgramUniform3uiv_enc; |
| 11501 | this->glProgramUniform4uiv = &glProgramUniform4uiv_enc; |
| 11502 | this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc; |
| 11503 | this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc; |
| 11504 | this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc; |
| 11505 | this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc; |
| 11506 | this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc; |
| 11507 | this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc; |
| 11508 | this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc; |
| 11509 | this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc; |
| 11510 | this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc; |
| 11511 | this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc; |
| 11512 | this->glGetProgramResourceiv = &glGetProgramResourceiv_enc; |
| 11513 | this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc; |
| 11514 | this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc; |
| 11515 | this->glGetProgramResourceName = &glGetProgramResourceName_enc; |
| 11516 | this->glBindImageTexture = &glBindImageTexture_enc; |
| 11517 | this->glDispatchCompute = &glDispatchCompute_enc; |
| 11518 | this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc; |
| 11519 | this->glBindVertexBuffer = &glBindVertexBuffer_enc; |
| 11520 | this->glVertexAttribBinding = &glVertexAttribBinding_enc; |
| 11521 | this->glVertexAttribFormat = &glVertexAttribFormat_enc; |
| 11522 | this->glVertexAttribIFormat = &glVertexAttribIFormat_enc; |
| 11523 | this->glVertexBindingDivisor = &glVertexBindingDivisor_enc; |
| 11524 | this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported; |
| 11525 | this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc; |
| 11526 | this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc; |
| 11527 | this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported; |
| 11528 | this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc; |
| 11529 | this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc; |
| 11530 | this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc; |
| 11531 | this->glSampleMaski = &glSampleMaski_enc; |
| 11532 | this->glGetMultisamplefv = &glGetMultisamplefv_enc; |
| 11533 | this->glFramebufferParameteri = &glFramebufferParameteri_enc; |
| 11534 | this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc; |
| 11535 | this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc; |
| 11536 | this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc; |
Roman Kiryanov | be1c0c2 | 2018-10-02 18:07:14 -0700 | [diff] [blame^] | 11537 | this->glMapBufferRangeDMA = &glMapBufferRangeDMA_enc; |
| 11538 | this->glUnmapBufferDMA = &glUnmapBufferDMA_enc; |
keunyoung | b85b275 | 2013-03-08 12:28:03 -0800 | [diff] [blame] | 11539 | } |
| 11540 | |