blob: ffffa499cdae54fd77e25dcc5def7cbbcbfa4cf3 [file] [log] [blame]
keunyoungb85b2752013-03-08 12:28:03 -08001// 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 Kiryanov80f83652018-10-03 14:05:29 -070011#include <vector>
12
keunyoungb85b2752013-03-08 12:28:03 -080013#include <stdio.h>
David 'Digit' Turner3372af92014-10-29 09:55:08 +010014
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010015namespace {
David 'Digit' Turner3372af92014-10-29 09:55:08 +010016
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010017void enc_unsupported()
keunyoungb85b2752013-03-08 12:28:03 -080018{
19 ALOGE("Function is unsupported\n");
20}
21
22void 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 Zhoub7f09082016-03-10 11:45:02 -080027 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070028 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080029
30 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080031 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;
keunyoungb85b2752013-03-08 12:28:03 -080037 int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080038 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080039
40 memcpy(ptr, &texture, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080041
Yahan Zhoue222fd52016-03-16 12:41:08 -070042 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
43 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
44
keunyoungb85b2752013-03-08 12:28:03 -080045}
46
47void 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 Zhoub7f09082016-03-10 11:45:02 -080052 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070053 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080054
55 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080056 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;
keunyoungb85b2752013-03-08 12:28:03 -080062 int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080063 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080064
65 memcpy(ptr, &program, 4); ptr += 4;
66 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080067
Yahan Zhoue222fd52016-03-16 12:41:08 -070068 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
69 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
70
keunyoungb85b2752013-03-08 12:28:03 -080071}
72
73void 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 Zhoub7f09082016-03-10 11:45:02 -080078 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070079 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080080
81 const unsigned int __size_name = (strlen(name) + 1);
82 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080083 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;
keunyoungb85b2752013-03-08 12:28:03 -080089 int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080090 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080091
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 Zhoub7f09082016-03-10 11:45:02 -080096
Yahan Zhoue222fd52016-03-16 12:41:08 -070097 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
98 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
99
keunyoungb85b2752013-03-08 12:28:03 -0800100}
101
102void 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 Zhoub7f09082016-03-10 11:45:02 -0800107 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700108 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800109
110 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800111 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;
keunyoungb85b2752013-03-08 12:28:03 -0800117 int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800118 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800119
120 memcpy(ptr, &target, 4); ptr += 4;
121 memcpy(ptr, &buffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800122
Yahan Zhoue222fd52016-03-16 12:41:08 -0700123 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
124 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
125
keunyoungb85b2752013-03-08 12:28:03 -0800126}
127
128void 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 Zhoub7f09082016-03-10 11:45:02 -0800133 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700134 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800135
136 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800137 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;
keunyoungb85b2752013-03-08 12:28:03 -0800143 int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800144 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800145
146 memcpy(ptr, &target, 4); ptr += 4;
147 memcpy(ptr, &framebuffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800148
Yahan Zhoue222fd52016-03-16 12:41:08 -0700149 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
150 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
151
keunyoungb85b2752013-03-08 12:28:03 -0800152}
153
154void 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 Zhoub7f09082016-03-10 11:45:02 -0800159 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700160 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800161
162 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800163 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;
keunyoungb85b2752013-03-08 12:28:03 -0800169 int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800170 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800171
172 memcpy(ptr, &target, 4); ptr += 4;
173 memcpy(ptr, &renderbuffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800174
Yahan Zhoue222fd52016-03-16 12:41:08 -0700175 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
176 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
177
keunyoungb85b2752013-03-08 12:28:03 -0800178}
179
180void 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 Zhoub7f09082016-03-10 11:45:02 -0800185 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700186 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800187
188 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800189 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;
keunyoungb85b2752013-03-08 12:28:03 -0800195 int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800196 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800197
198 memcpy(ptr, &target, 4); ptr += 4;
199 memcpy(ptr, &texture, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800200
Yahan Zhoue222fd52016-03-16 12:41:08 -0700201 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
202 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
203
keunyoungb85b2752013-03-08 12:28:03 -0800204}
205
206void 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 Zhoub7f09082016-03-10 11:45:02 -0800211 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700212 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800213
214 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800215 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;
keunyoungb85b2752013-03-08 12:28:03 -0800221 int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800222 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800223
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 Zhoub7f09082016-03-10 11:45:02 -0800228
Yahan Zhoue222fd52016-03-16 12:41:08 -0700229 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
230 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
231
keunyoungb85b2752013-03-08 12:28:03 -0800232}
233
234void 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 Zhoub7f09082016-03-10 11:45:02 -0800239 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700240 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800241
242 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800243 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;
keunyoungb85b2752013-03-08 12:28:03 -0800249 int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800250 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800251
252 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800253
Yahan Zhoue222fd52016-03-16 12:41:08 -0700254 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
255 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
256
keunyoungb85b2752013-03-08 12:28:03 -0800257}
258
259void 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 Zhoub7f09082016-03-10 11:45:02 -0800264 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700265 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800266
267 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800268 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;
keunyoungb85b2752013-03-08 12:28:03 -0800274 int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800275 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800276
277 memcpy(ptr, &modeRGB, 4); ptr += 4;
278 memcpy(ptr, &modeAlpha, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800279
Yahan Zhoue222fd52016-03-16 12:41:08 -0700280 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
281 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
282
keunyoungb85b2752013-03-08 12:28:03 -0800283}
284
285void 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 Zhoub7f09082016-03-10 11:45:02 -0800290 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700291 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800292
293 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800294 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;
keunyoungb85b2752013-03-08 12:28:03 -0800300 int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800301 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800302
303 memcpy(ptr, &sfactor, 4); ptr += 4;
304 memcpy(ptr, &dfactor, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800305
Yahan Zhoue222fd52016-03-16 12:41:08 -0700306 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
307 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
308
keunyoungb85b2752013-03-08 12:28:03 -0800309}
310
311void 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 Zhoub7f09082016-03-10 11:45:02 -0800316 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700317 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800318
319 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800320 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;
keunyoungb85b2752013-03-08 12:28:03 -0800326 int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800327 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800328
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 Zhoub7f09082016-03-10 11:45:02 -0800333
Yahan Zhoue222fd52016-03-16 12:41:08 -0700334 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
335 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
336
keunyoungb85b2752013-03-08 12:28:03 -0800337}
338
339void 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 Zhoub7f09082016-03-10 11:45:02 -0800344 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700345 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800346
347 const unsigned int __size_data = ((data != NULL) ? size : 0);
348 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800349 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;
keunyoungb85b2752013-03-08 12:28:03 -0800355 int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800356 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800357
358 memcpy(ptr, &target, 4); ptr += 4;
359 memcpy(ptr, &size, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800360
Yahan Zhoue222fd52016-03-16 12:41:08 -0700361 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800362 stream->flush();
363 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700364 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800365 if (data != NULL) {
366 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700367 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800368 }
369 buf = stream->alloc(4);
370 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800371 memcpy(ptr, &usage, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800372
Yahan Zhoue222fd52016-03-16 12:41:08 -0700373 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800374 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700375 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
376
keunyoungb85b2752013-03-08 12:28:03 -0800377}
378
379void 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 Zhoub7f09082016-03-10 11:45:02 -0800384 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700385 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800386
Yahan Zhou268e85c2016-02-19 13:59:34 -0800387 const unsigned int __size_data = ((data != NULL) ? size : 0);
keunyoungb85b2752013-03-08 12:28:03 -0800388 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800389 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;
keunyoungb85b2752013-03-08 12:28:03 -0800395 int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800396 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800397
398 memcpy(ptr, &target, 4); ptr += 4;
399 memcpy(ptr, &offset, 4); ptr += 4;
400 memcpy(ptr, &size, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800401
Yahan Zhoue222fd52016-03-16 12:41:08 -0700402 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800403 stream->flush();
404 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700405 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800406 if (data != NULL) {
407 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700408 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800409 }
410 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700411 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
412
keunyoungb85b2752013-03-08 12:28:03 -0800413}
414
415GLenum 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 Zhoub7f09082016-03-10 11:45:02 -0800420 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700421 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800422
423 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800424 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;
keunyoungb85b2752013-03-08 12:28:03 -0800430 int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800431 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800432
433 memcpy(ptr, &target, 4); ptr += 4;
434
Yahan Zhoue222fd52016-03-16 12:41:08 -0700435 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
436 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
437
Yahan Zhoub7f09082016-03-10 11:45:02 -0800438
keunyoungb85b2752013-03-08 12:28:03 -0800439 GLenum retval;
440 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700441 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
442 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700443 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700444 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700445 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
446 stream->readback(checksumBufPtr, checksumSize);
447 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700448 ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
449 abort();
450 }
451 }
keunyoungb85b2752013-03-08 12:28:03 -0800452 return retval;
453}
454
455void 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 Zhoub7f09082016-03-10 11:45:02 -0800460 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700461 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800462
463 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800464 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;
keunyoungb85b2752013-03-08 12:28:03 -0800470 int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800471 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800472
473 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800474
Yahan Zhoue222fd52016-03-16 12:41:08 -0700475 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
476 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
477
keunyoungb85b2752013-03-08 12:28:03 -0800478}
479
480void 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 Zhoub7f09082016-03-10 11:45:02 -0800485 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700486 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800487
488 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800489 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;
keunyoungb85b2752013-03-08 12:28:03 -0800495 int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800496 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800497
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 Zhoub7f09082016-03-10 11:45:02 -0800502
Yahan Zhoue222fd52016-03-16 12:41:08 -0700503 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
504 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
505
keunyoungb85b2752013-03-08 12:28:03 -0800506}
507
508void 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 Zhoub7f09082016-03-10 11:45:02 -0800513 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700514 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800515
516 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800517 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;
keunyoungb85b2752013-03-08 12:28:03 -0800523 int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800524 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800525
526 memcpy(ptr, &depth, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800527
Yahan Zhoue222fd52016-03-16 12:41:08 -0700528 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
529 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
530
keunyoungb85b2752013-03-08 12:28:03 -0800531}
532
533void 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 Zhoub7f09082016-03-10 11:45:02 -0800538 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700539 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800540
541 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800542 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;
keunyoungb85b2752013-03-08 12:28:03 -0800548 int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800549 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800550
551 memcpy(ptr, &s, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800552
Yahan Zhoue222fd52016-03-16 12:41:08 -0700553 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
554 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
555
keunyoungb85b2752013-03-08 12:28:03 -0800556}
557
558void 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 Zhoub7f09082016-03-10 11:45:02 -0800563 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700564 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800565
566 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800567 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;
keunyoungb85b2752013-03-08 12:28:03 -0800573 int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800574 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800575
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 Zhoub7f09082016-03-10 11:45:02 -0800580
Yahan Zhoue222fd52016-03-16 12:41:08 -0700581 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
582 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
583
keunyoungb85b2752013-03-08 12:28:03 -0800584}
585
586void 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 Zhoub7f09082016-03-10 11:45:02 -0800591 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700592 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800593
594 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800595 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;
keunyoungb85b2752013-03-08 12:28:03 -0800601 int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800602 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800603
604 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800605
Yahan Zhoue222fd52016-03-16 12:41:08 -0700606 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
607 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
608
keunyoungb85b2752013-03-08 12:28:03 -0800609}
610
611void 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 Zhoub7f09082016-03-10 11:45:02 -0800616 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700617 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800618
619 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
620 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800621 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;
keunyoungb85b2752013-03-08 12:28:03 -0800627 int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800628 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800629
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 Zhoub7f09082016-03-10 11:45:02 -0800637
Yahan Zhoue222fd52016-03-16 12:41:08 -0700638 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800639 stream->flush();
640 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700641 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800642 if (data != NULL) {
643 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700644 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800645 }
646 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700647 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
648
keunyoungb85b2752013-03-08 12:28:03 -0800649}
650
651void 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 Zhoub7f09082016-03-10 11:45:02 -0800656 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700657 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800658
Yahan Zhou268e85c2016-02-19 13:59:34 -0800659 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -0800660 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800661 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;
keunyoungb85b2752013-03-08 12:28:03 -0800667 int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800668 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800669
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 Zhoub7f09082016-03-10 11:45:02 -0800678
Yahan Zhoue222fd52016-03-16 12:41:08 -0700679 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800680 stream->flush();
681 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700682 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800683 if (data != NULL) {
684 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700685 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800686 }
687 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700688 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
689
keunyoungb85b2752013-03-08 12:28:03 -0800690}
691
692void 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 Zhoub7f09082016-03-10 11:45:02 -0800697 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700698 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800699
700 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800701 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;
keunyoungb85b2752013-03-08 12:28:03 -0800707 int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800708 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800709
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 Zhoub7f09082016-03-10 11:45:02 -0800718
Yahan Zhoue222fd52016-03-16 12:41:08 -0700719 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
720 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
721
keunyoungb85b2752013-03-08 12:28:03 -0800722}
723
724void 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 Zhoub7f09082016-03-10 11:45:02 -0800729 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700730 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800731
732 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800733 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;
keunyoungb85b2752013-03-08 12:28:03 -0800739 int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800740 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800741
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 Zhoub7f09082016-03-10 11:45:02 -0800750
Yahan Zhoue222fd52016-03-16 12:41:08 -0700751 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
752 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
753
keunyoungb85b2752013-03-08 12:28:03 -0800754}
755
756GLuint glCreateProgram_enc(void *self )
757{
758
759 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
760 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800761 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700762 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800763
764 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800765 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;
keunyoungb85b2752013-03-08 12:28:03 -0800771 int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800772 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800773
774
Yahan Zhoue222fd52016-03-16 12:41:08 -0700775 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
776 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
777
Yahan Zhoub7f09082016-03-10 11:45:02 -0800778
keunyoungb85b2752013-03-08 12:28:03 -0800779 GLuint retval;
780 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700781 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
782 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700783 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700784 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700785 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
786 stream->readback(checksumBufPtr, checksumSize);
787 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700788 ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
789 abort();
790 }
791 }
keunyoungb85b2752013-03-08 12:28:03 -0800792 return retval;
793}
794
795GLuint 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 Zhoub7f09082016-03-10 11:45:02 -0800800 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700801 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800802
803 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800804 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;
keunyoungb85b2752013-03-08 12:28:03 -0800810 int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800811 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800812
813 memcpy(ptr, &type, 4); ptr += 4;
814
Yahan Zhoue222fd52016-03-16 12:41:08 -0700815 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
816 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
817
Yahan Zhoub7f09082016-03-10 11:45:02 -0800818
keunyoungb85b2752013-03-08 12:28:03 -0800819 GLuint retval;
820 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700821 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
822 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700823 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700824 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700825 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
826 stream->readback(checksumBufPtr, checksumSize);
827 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700828 ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
829 abort();
830 }
831 }
keunyoungb85b2752013-03-08 12:28:03 -0800832 return retval;
833}
834
835void 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 Zhoub7f09082016-03-10 11:45:02 -0800840 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700841 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800842
843 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800844 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;
keunyoungb85b2752013-03-08 12:28:03 -0800850 int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800851 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800852
853 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800854
Yahan Zhoue222fd52016-03-16 12:41:08 -0700855 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
856 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
857
keunyoungb85b2752013-03-08 12:28:03 -0800858}
859
860void 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 Zhoub7f09082016-03-10 11:45:02 -0800865 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700866 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800867
868 const unsigned int __size_buffers = (n * sizeof(GLuint));
869 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800870 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;
keunyoungb85b2752013-03-08 12:28:03 -0800876 int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800877 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800878
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 Zhoub7f09082016-03-10 11:45:02 -0800882
Yahan Zhoue222fd52016-03-16 12:41:08 -0700883 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
884 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
885
keunyoungb85b2752013-03-08 12:28:03 -0800886}
887
888void 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 Zhoub7f09082016-03-10 11:45:02 -0800893 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700894 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800895
896 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
897 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800898 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;
keunyoungb85b2752013-03-08 12:28:03 -0800904 int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800905 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800906
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 Zhoub7f09082016-03-10 11:45:02 -0800910
Yahan Zhoue222fd52016-03-16 12:41:08 -0700911 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
912 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
913
keunyoungb85b2752013-03-08 12:28:03 -0800914}
915
916void 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 Zhoub7f09082016-03-10 11:45:02 -0800921 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700922 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800923
924 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800925 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;
keunyoungb85b2752013-03-08 12:28:03 -0800931 int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800932 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800933
934 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800935
Yahan Zhoue222fd52016-03-16 12:41:08 -0700936 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
937 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
938
keunyoungb85b2752013-03-08 12:28:03 -0800939}
940
941void 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 Zhoub7f09082016-03-10 11:45:02 -0800946 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700947 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800948
949 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
950 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800951 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;
keunyoungb85b2752013-03-08 12:28:03 -0800957 int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800958 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800959
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 Zhoub7f09082016-03-10 11:45:02 -0800963
Yahan Zhoue222fd52016-03-16 12:41:08 -0700964 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
965 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
966
keunyoungb85b2752013-03-08 12:28:03 -0800967}
968
969void 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 Zhoub7f09082016-03-10 11:45:02 -0800974 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700975 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800976
977 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800978 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;
keunyoungb85b2752013-03-08 12:28:03 -0800984 int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800985 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800986
987 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800988
Yahan Zhoue222fd52016-03-16 12:41:08 -0700989 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
990 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
991
keunyoungb85b2752013-03-08 12:28:03 -0800992}
993
994void 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 Zhoub7f09082016-03-10 11:45:02 -0800999 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001000 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001001
1002 const unsigned int __size_textures = (n * sizeof(GLuint));
1003 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001004 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;
keunyoungb85b2752013-03-08 12:28:03 -08001010 int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001011 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001012
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 Zhoub7f09082016-03-10 11:45:02 -08001016
Yahan Zhoue222fd52016-03-16 12:41:08 -07001017 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1018 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1019
keunyoungb85b2752013-03-08 12:28:03 -08001020}
1021
1022void 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 Zhoub7f09082016-03-10 11:45:02 -08001027 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001028 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001029
1030 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001031 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;
keunyoungb85b2752013-03-08 12:28:03 -08001037 int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001038 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001039
1040 memcpy(ptr, &func, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001041
Yahan Zhoue222fd52016-03-16 12:41:08 -07001042 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1043 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1044
keunyoungb85b2752013-03-08 12:28:03 -08001045}
1046
1047void 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 Zhoub7f09082016-03-10 11:45:02 -08001052 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001053 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001054
1055 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001056 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;
keunyoungb85b2752013-03-08 12:28:03 -08001062 int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001063 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001064
1065 memcpy(ptr, &flag, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001066
Yahan Zhoue222fd52016-03-16 12:41:08 -07001067 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1068 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1069
keunyoungb85b2752013-03-08 12:28:03 -08001070}
1071
1072void 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 Zhoub7f09082016-03-10 11:45:02 -08001077 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001078 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001079
1080 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001081 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;
keunyoungb85b2752013-03-08 12:28:03 -08001087 int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001088 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001089
1090 memcpy(ptr, &zNear, 4); ptr += 4;
1091 memcpy(ptr, &zFar, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001092
Yahan Zhoue222fd52016-03-16 12:41:08 -07001093 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1094 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1095
keunyoungb85b2752013-03-08 12:28:03 -08001096}
1097
1098void 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 Zhoub7f09082016-03-10 11:45:02 -08001103 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001104 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001105
1106 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001107 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;
keunyoungb85b2752013-03-08 12:28:03 -08001113 int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001114 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001115
1116 memcpy(ptr, &program, 4); ptr += 4;
1117 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001118
Yahan Zhoue222fd52016-03-16 12:41:08 -07001119 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1120 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1121
keunyoungb85b2752013-03-08 12:28:03 -08001122}
1123
1124void 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 Zhoub7f09082016-03-10 11:45:02 -08001129 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001130 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001131
1132 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001133 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;
keunyoungb85b2752013-03-08 12:28:03 -08001139 int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001140 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001141
1142 memcpy(ptr, &cap, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001143
Yahan Zhoue222fd52016-03-16 12:41:08 -07001144 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1145 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1146
keunyoungb85b2752013-03-08 12:28:03 -08001147}
1148
1149void 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 Zhoub7f09082016-03-10 11:45:02 -08001154 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001155 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001156
1157 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001158 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;
keunyoungb85b2752013-03-08 12:28:03 -08001164 int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001165 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001166
1167 memcpy(ptr, &index, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001168
Yahan Zhoue222fd52016-03-16 12:41:08 -07001169 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1170 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1171
keunyoungb85b2752013-03-08 12:28:03 -08001172}
1173
1174void 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 Zhoub7f09082016-03-10 11:45:02 -08001179 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001180 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001181
1182 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001183 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;
keunyoungb85b2752013-03-08 12:28:03 -08001189 int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001190 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001191
1192 memcpy(ptr, &mode, 4); ptr += 4;
1193 memcpy(ptr, &first, 4); ptr += 4;
1194 memcpy(ptr, &count, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001195
Yahan Zhoue222fd52016-03-16 12:41:08 -07001196 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1197 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1198
keunyoungb85b2752013-03-08 12:28:03 -08001199}
1200
1201void 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 Zhoub7f09082016-03-10 11:45:02 -08001206 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001207 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001208
1209 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001210 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;
keunyoungb85b2752013-03-08 12:28:03 -08001216 int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001217 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001218
1219 memcpy(ptr, &cap, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001220
Yahan Zhoue222fd52016-03-16 12:41:08 -07001221 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1222 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1223
keunyoungb85b2752013-03-08 12:28:03 -08001224}
1225
1226void 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 Zhoub7f09082016-03-10 11:45:02 -08001231 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001232 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001233
1234 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001235 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;
keunyoungb85b2752013-03-08 12:28:03 -08001241 int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001242 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001243
1244 memcpy(ptr, &index, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001245
Yahan Zhoue222fd52016-03-16 12:41:08 -07001246 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1247 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1248
keunyoungb85b2752013-03-08 12:28:03 -08001249}
1250
1251void glFinish_enc(void *self )
1252{
1253
1254 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1255 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001256 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001257 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001258
1259 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001260 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;
keunyoungb85b2752013-03-08 12:28:03 -08001266 int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001267 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001268
Yahan Zhoub7f09082016-03-10 11:45:02 -08001269
Yahan Zhoue222fd52016-03-16 12:41:08 -07001270 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1271 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1272
keunyoungb85b2752013-03-08 12:28:03 -08001273}
1274
1275void glFlush_enc(void *self )
1276{
1277
1278 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1279 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001280 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001281 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001282
1283 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001284 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;
keunyoungb85b2752013-03-08 12:28:03 -08001290 int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001291 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001292
Yahan Zhoub7f09082016-03-10 11:45:02 -08001293
Yahan Zhoue222fd52016-03-16 12:41:08 -07001294 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1295 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1296
keunyoungb85b2752013-03-08 12:28:03 -08001297}
1298
1299void 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 Zhoub7f09082016-03-10 11:45:02 -08001304 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001305 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001306
1307 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001308 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;
keunyoungb85b2752013-03-08 12:28:03 -08001314 int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001315 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001316
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 Zhoub7f09082016-03-10 11:45:02 -08001321
Yahan Zhoue222fd52016-03-16 12:41:08 -07001322 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1323 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1324
keunyoungb85b2752013-03-08 12:28:03 -08001325}
1326
1327void 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 Zhoub7f09082016-03-10 11:45:02 -08001332 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001333 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001334
1335 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001336 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;
keunyoungb85b2752013-03-08 12:28:03 -08001342 int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001343 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001344
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 Zhoub7f09082016-03-10 11:45:02 -08001350
Yahan Zhoue222fd52016-03-16 12:41:08 -07001351 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1352 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1353
keunyoungb85b2752013-03-08 12:28:03 -08001354}
1355
1356void 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 Zhoub7f09082016-03-10 11:45:02 -08001361 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001362 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001363
1364 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001365 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;
keunyoungb85b2752013-03-08 12:28:03 -08001371 int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001372 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001373
1374 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001375
Yahan Zhoue222fd52016-03-16 12:41:08 -07001376 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1377 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1378
keunyoungb85b2752013-03-08 12:28:03 -08001379}
1380
1381void 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 Zhoub7f09082016-03-10 11:45:02 -08001386 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001387 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001388
1389 const unsigned int __size_buffers = (n * sizeof(GLuint));
1390 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001391 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001392 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001393 const size_t checksumSize = checksumCalculator->checksumByteSize();
1394 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1395 buf = stream->alloc(totalSize);
1396 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001397 int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001398 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001399
1400 memcpy(ptr, &n, 4); ptr += 4;
1401 *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001402
Yahan Zhoue222fd52016-03-16 12:41:08 -07001403 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1404 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1405
keunyoungb85b2752013-03-08 12:28:03 -08001406 stream->readback(buffers, __size_buffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001407 if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
1408 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001409 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001410 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001411 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1412 stream->readback(checksumBufPtr, checksumSize);
1413 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001414 ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
1415 abort();
1416 }
1417 }
keunyoungb85b2752013-03-08 12:28:03 -08001418}
1419
1420void 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 Zhoub7f09082016-03-10 11:45:02 -08001425 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001426 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001427
1428 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001429 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;
keunyoungb85b2752013-03-08 12:28:03 -08001435 int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001436 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001437
1438 memcpy(ptr, &target, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001439
Yahan Zhoue222fd52016-03-16 12:41:08 -07001440 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1441 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1442
keunyoungb85b2752013-03-08 12:28:03 -08001443}
1444
1445void 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 Zhoub7f09082016-03-10 11:45:02 -08001450 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001451 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001452
1453 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
1454 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001455 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001456 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001457 const size_t checksumSize = checksumCalculator->checksumByteSize();
1458 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1459 buf = stream->alloc(totalSize);
1460 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001461 int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001462 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001463
1464 memcpy(ptr, &n, 4); ptr += 4;
1465 *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001466
Yahan Zhoue222fd52016-03-16 12:41:08 -07001467 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1468 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1469
keunyoungb85b2752013-03-08 12:28:03 -08001470 stream->readback(framebuffers, __size_framebuffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001471 if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
1472 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001473 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001474 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001475 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1476 stream->readback(checksumBufPtr, checksumSize);
1477 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001478 ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
1479 abort();
1480 }
1481 }
keunyoungb85b2752013-03-08 12:28:03 -08001482}
1483
1484void 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 Zhoub7f09082016-03-10 11:45:02 -08001489 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001490 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001491
1492 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
1493 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001494 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001495 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001496 const size_t checksumSize = checksumCalculator->checksumByteSize();
1497 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1498 buf = stream->alloc(totalSize);
1499 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001500 int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001501 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001502
1503 memcpy(ptr, &n, 4); ptr += 4;
1504 *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001505
Yahan Zhoue222fd52016-03-16 12:41:08 -07001506 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1507 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1508
keunyoungb85b2752013-03-08 12:28:03 -08001509 stream->readback(renderbuffers, __size_renderbuffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001510 if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
1511 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001512 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001513 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001514 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1515 stream->readback(checksumBufPtr, checksumSize);
1516 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001517 ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
1518 abort();
1519 }
1520 }
keunyoungb85b2752013-03-08 12:28:03 -08001521}
1522
1523void 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 Zhoub7f09082016-03-10 11:45:02 -08001528 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001529 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001530
1531 const unsigned int __size_textures = (n * sizeof(GLuint));
1532 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001533 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001534 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001535 const size_t checksumSize = checksumCalculator->checksumByteSize();
1536 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1537 buf = stream->alloc(totalSize);
1538 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001539 int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001540 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001541
1542 memcpy(ptr, &n, 4); ptr += 4;
1543 *(unsigned int *)(ptr) = __size_textures; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001544
Yahan Zhoue222fd52016-03-16 12:41:08 -07001545 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1546 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1547
keunyoungb85b2752013-03-08 12:28:03 -08001548 stream->readback(textures, __size_textures);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001549 if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
1550 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001551 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001552 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001553 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1554 stream->readback(checksumBufPtr, checksumSize);
1555 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001556 ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
1557 abort();
1558 }
1559 }
keunyoungb85b2752013-03-08 12:28:03 -08001560}
1561
1562void 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 Zhoub7f09082016-03-10 11:45:02 -08001567 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001568 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001569
1570 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
bohua9ce3ca2015-01-14 09:46:36 -08001571 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1572 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08001573 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1574 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001575 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001576 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001577 const size_t checksumSize = checksumCalculator->checksumByteSize();
1578 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1579 buf = stream->alloc(totalSize);
1580 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001581 int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001582 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001583
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 Zhoub7f09082016-03-10 11:45:02 -08001591
Yahan Zhoue222fd52016-03-16 12:41:08 -07001592 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 Zhoua9aee9f2016-06-17 15:06:37 -07001612 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001613 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001614 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1615 stream->readback(checksumBufPtr, checksumSize);
1616 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001617 ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
1618 abort();
1619 }
1620 }
keunyoungb85b2752013-03-08 12:28:03 -08001621}
1622
1623void 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 Zhoub7f09082016-03-10 11:45:02 -08001628 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001629 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001630
1631 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
bohua9ce3ca2015-01-14 09:46:36 -08001632 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1633 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08001634 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1635 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001636 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001637 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001638 const size_t checksumSize = checksumCalculator->checksumByteSize();
1639 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1640 buf = stream->alloc(totalSize);
1641 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001642 int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001643 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001644
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 Zhoub7f09082016-03-10 11:45:02 -08001652
Yahan Zhoue222fd52016-03-16 12:41:08 -07001653 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 Zhoua9aee9f2016-06-17 15:06:37 -07001673 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001674 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001675 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1676 stream->readback(checksumBufPtr, checksumSize);
1677 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001678 ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
1679 abort();
1680 }
1681 }
keunyoungb85b2752013-03-08 12:28:03 -08001682}
1683
1684void 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 Zhoub7f09082016-03-10 11:45:02 -08001689 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001690 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001691
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 Zhoub7f09082016-03-10 11:45:02 -08001695 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001696 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001697 const size_t checksumSize = checksumCalculator->checksumByteSize();
1698 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1699 buf = stream->alloc(totalSize);
1700 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001701 int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001702 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001703
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 Zhoub7f09082016-03-10 11:45:02 -08001708
Yahan Zhoue222fd52016-03-16 12:41:08 -07001709 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 }
keunyoungb85b2752013-03-08 12:28:03 -08001716 stream->readback(shaders, __size_shaders);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001717 if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
1718 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001719 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001720 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001721 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1722 stream->readback(checksumBufPtr, checksumSize);
1723 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001724 ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
1725 abort();
1726 }
1727 }
keunyoungb85b2752013-03-08 12:28:03 -08001728}
1729
1730int 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 Zhoub7f09082016-03-10 11:45:02 -08001735 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001736 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001737
1738 const unsigned int __size_name = (strlen(name) + 1);
1739 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001740 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;
keunyoungb85b2752013-03-08 12:28:03 -08001746 int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001747 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001748
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 Zhoue222fd52016-03-16 12:41:08 -07001753 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1754 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1755
Yahan Zhoub7f09082016-03-10 11:45:02 -08001756
keunyoungb85b2752013-03-08 12:28:03 -08001757 int retval;
1758 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001759 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1760 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001761 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001762 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001763 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1764 stream->readback(checksumBufPtr, checksumSize);
1765 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001766 ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
1767 abort();
1768 }
1769 }
keunyoungb85b2752013-03-08 12:28:03 -08001770 return retval;
1771}
1772
1773void 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 Zhoub7f09082016-03-10 11:45:02 -08001778 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001779 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001780
1781 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
1782 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001783 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001784 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001785 const size_t checksumSize = checksumCalculator->checksumByteSize();
1786 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1787 buf = stream->alloc(totalSize);
1788 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001789 int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001790 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001791
1792 memcpy(ptr, &pname, 4); ptr += 4;
1793 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001794
Yahan Zhoue222fd52016-03-16 12:41:08 -07001795 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1796 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1797
keunyoungb85b2752013-03-08 12:28:03 -08001798 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001799 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1800 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001801 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001802 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001803 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1804 stream->readback(checksumBufPtr, checksumSize);
1805 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001806 ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
1807 abort();
1808 }
1809 }
keunyoungb85b2752013-03-08 12:28:03 -08001810}
1811
1812void 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 Zhoub7f09082016-03-10 11:45:02 -08001817 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001818 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001819
1820 const unsigned int __size_params = (sizeof(GLint));
1821 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001822 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001823 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001824 const size_t checksumSize = checksumCalculator->checksumByteSize();
1825 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1826 buf = stream->alloc(totalSize);
1827 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001828 int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001829 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001830
1831 memcpy(ptr, &target, 4); ptr += 4;
1832 memcpy(ptr, &pname, 4); ptr += 4;
1833 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001834
Yahan Zhoue222fd52016-03-16 12:41:08 -07001835 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1836 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1837
keunyoungb85b2752013-03-08 12:28:03 -08001838 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001839 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1840 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001841 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001842 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001843 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1844 stream->readback(checksumBufPtr, checksumSize);
1845 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001846 ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
1847 abort();
1848 }
1849 }
keunyoungb85b2752013-03-08 12:28:03 -08001850}
1851
1852GLenum glGetError_enc(void *self )
1853{
1854
1855 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1856 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001857 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001858 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001859
1860 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001861 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;
keunyoungb85b2752013-03-08 12:28:03 -08001867 int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001868 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001869
1870
Yahan Zhoue222fd52016-03-16 12:41:08 -07001871 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1872 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1873
Yahan Zhoub7f09082016-03-10 11:45:02 -08001874
keunyoungb85b2752013-03-08 12:28:03 -08001875 GLenum retval;
1876 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001877 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1878 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001879 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001880 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001881 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1882 stream->readback(checksumBufPtr, checksumSize);
1883 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001884 ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
1885 abort();
1886 }
1887 }
keunyoungb85b2752013-03-08 12:28:03 -08001888 return retval;
1889}
1890
1891void 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 Zhoub7f09082016-03-10 11:45:02 -08001896 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001897 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001898
1899 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
1900 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001901 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001902 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001903 const size_t checksumSize = checksumCalculator->checksumByteSize();
1904 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1905 buf = stream->alloc(totalSize);
1906 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001907 int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001908 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001909
1910 memcpy(ptr, &pname, 4); ptr += 4;
1911 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001912
Yahan Zhoue222fd52016-03-16 12:41:08 -07001913 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1914 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1915
keunyoungb85b2752013-03-08 12:28:03 -08001916 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001917 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1918 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001919 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001920 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001921 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1922 stream->readback(checksumBufPtr, checksumSize);
1923 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001924 ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
1925 abort();
1926 }
1927 }
keunyoungb85b2752013-03-08 12:28:03 -08001928}
1929
1930void 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 Zhoub7f09082016-03-10 11:45:02 -08001935 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001936 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001937
1938 const unsigned int __size_params = (sizeof(GLint));
1939 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001940 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001941 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001942 const size_t checksumSize = checksumCalculator->checksumByteSize();
1943 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1944 buf = stream->alloc(totalSize);
1945 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001946 int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001947 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001948
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 Zhoub7f09082016-03-10 11:45:02 -08001953
Yahan Zhoue222fd52016-03-16 12:41:08 -07001954 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1955 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1956
keunyoungb85b2752013-03-08 12:28:03 -08001957 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001958 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1959 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001960 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001961 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001962 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1963 stream->readback(checksumBufPtr, checksumSize);
1964 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001965 ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
1966 abort();
1967 }
1968 }
keunyoungb85b2752013-03-08 12:28:03 -08001969}
1970
1971void 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 Zhoub7f09082016-03-10 11:45:02 -08001976 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001977 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001978
1979 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
1980 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001981 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001982 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001983 const size_t checksumSize = checksumCalculator->checksumByteSize();
1984 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1985 buf = stream->alloc(totalSize);
1986 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001987 int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001988 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001989
1990 memcpy(ptr, &pname, 4); ptr += 4;
1991 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001992
Yahan Zhoue222fd52016-03-16 12:41:08 -07001993 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1994 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1995
keunyoungb85b2752013-03-08 12:28:03 -08001996 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001997 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1998 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001999 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002000 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002001 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2002 stream->readback(checksumBufPtr, checksumSize);
2003 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002004 ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
2005 abort();
2006 }
2007 }
keunyoungb85b2752013-03-08 12:28:03 -08002008}
2009
2010void 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 Zhoub7f09082016-03-10 11:45:02 -08002015 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002016 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002017
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08002018 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
keunyoungb85b2752013-03-08 12:28:03 -08002019 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002020 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002021 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002022 const size_t checksumSize = checksumCalculator->checksumByteSize();
2023 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2024 buf = stream->alloc(totalSize);
2025 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002026 int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002027 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002028
2029 memcpy(ptr, &program, 4); ptr += 4;
2030 memcpy(ptr, &pname, 4); ptr += 4;
2031 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002032
Yahan Zhoue222fd52016-03-16 12:41:08 -07002033 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2034 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2035
keunyoungb85b2752013-03-08 12:28:03 -08002036 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002037 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2038 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002039 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002040 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002041 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2042 stream->readback(checksumBufPtr, checksumSize);
2043 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002044 ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
2045 abort();
2046 }
2047 }
keunyoungb85b2752013-03-08 12:28:03 -08002048}
2049
2050void 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 Zhoub7f09082016-03-10 11:45:02 -08002055 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002056 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002057
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +01002058 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08002059 const unsigned int __size_infolog = bufsize;
2060 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002061 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002062 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002063 const size_t checksumSize = checksumCalculator->checksumByteSize();
2064 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2065 buf = stream->alloc(totalSize);
2066 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002067 int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002068 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002069
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 Zhoub7f09082016-03-10 11:45:02 -08002074
Yahan Zhoue222fd52016-03-16 12:41:08 -07002075 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 }
keunyoungb85b2752013-03-08 12:28:03 -08002082 stream->readback(infolog, __size_infolog);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002083 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2084 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002085 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002086 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002087 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2088 stream->readback(checksumBufPtr, checksumSize);
2089 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002090 ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
2091 abort();
2092 }
2093 }
keunyoungb85b2752013-03-08 12:28:03 -08002094}
2095
2096void 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 Zhoub7f09082016-03-10 11:45:02 -08002101 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002102 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002103
2104 const unsigned int __size_params = sizeof(GLint);
2105 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002106 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002107 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002108 const size_t checksumSize = checksumCalculator->checksumByteSize();
2109 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2110 buf = stream->alloc(totalSize);
2111 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002112 int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002113 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002114
2115 memcpy(ptr, &target, 4); ptr += 4;
2116 memcpy(ptr, &pname, 4); ptr += 4;
2117 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002118
Yahan Zhoue222fd52016-03-16 12:41:08 -07002119 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2120 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2121
keunyoungb85b2752013-03-08 12:28:03 -08002122 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002123 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2124 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002125 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002126 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002127 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2128 stream->readback(checksumBufPtr, checksumSize);
2129 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002130 ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
2131 abort();
2132 }
2133 }
keunyoungb85b2752013-03-08 12:28:03 -08002134}
2135
2136void 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 Zhoub7f09082016-03-10 11:45:02 -08002141 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002142 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002143
2144 const unsigned int __size_params = sizeof(GLint);
2145 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002146 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002147 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002148 const size_t checksumSize = checksumCalculator->checksumByteSize();
2149 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2150 buf = stream->alloc(totalSize);
2151 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002152 int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002153 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002154
2155 memcpy(ptr, &shader, 4); ptr += 4;
2156 memcpy(ptr, &pname, 4); ptr += 4;
2157 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002158
Yahan Zhoue222fd52016-03-16 12:41:08 -07002159 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2160 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2161
keunyoungb85b2752013-03-08 12:28:03 -08002162 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002163 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2164 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002165 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002166 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002167 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2168 stream->readback(checksumBufPtr, checksumSize);
2169 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002170 ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n");
2171 abort();
2172 }
2173 }
keunyoungb85b2752013-03-08 12:28:03 -08002174}
2175
2176void 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 Zhoub7f09082016-03-10 11:45:02 -08002181 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002182 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002183
2184 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2185 const unsigned int __size_infolog = bufsize;
2186 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002187 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002188 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002189 const size_t checksumSize = checksumCalculator->checksumByteSize();
2190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2191 buf = stream->alloc(totalSize);
2192 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002193 int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002194 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002195
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 Zhoub7f09082016-03-10 11:45:02 -08002200
Yahan Zhoue222fd52016-03-16 12:41:08 -07002201 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 }
keunyoungb85b2752013-03-08 12:28:03 -08002208 stream->readback(infolog, __size_infolog);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002209 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2210 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002211 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002212 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002213 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2214 stream->readback(checksumBufPtr, checksumSize);
2215 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002216 ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n");
2217 abort();
2218 }
2219 }
keunyoungb85b2752013-03-08 12:28:03 -08002220}
2221
2222void 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 Zhoub7f09082016-03-10 11:45:02 -08002227 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002228 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002229
2230 const unsigned int __size_range = (2 * sizeof(GLint));
2231 const unsigned int __size_precision = (sizeof(GLint));
2232 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002233 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002234 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002235 const size_t checksumSize = checksumCalculator->checksumByteSize();
2236 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2237 buf = stream->alloc(totalSize);
2238 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002239 int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002240 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002241
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 Zhoub7f09082016-03-10 11:45:02 -08002246
Yahan Zhoue222fd52016-03-16 12:41:08 -07002247 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2248 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2249
keunyoungb85b2752013-03-08 12:28:03 -08002250 stream->readback(range, __size_range);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002251 if (useChecksum) checksumCalculator->addBuffer(range, __size_range);
keunyoungb85b2752013-03-08 12:28:03 -08002252 stream->readback(precision, __size_precision);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002253 if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision);
2254 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002255 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002256 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002257 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2258 stream->readback(checksumBufPtr, checksumSize);
2259 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002260 ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n");
2261 abort();
2262 }
2263 }
keunyoungb85b2752013-03-08 12:28:03 -08002264}
2265
2266void 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 Zhoub7f09082016-03-10 11:45:02 -08002271 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002272 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002273
2274 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2275 const unsigned int __size_source = bufsize;
2276 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002277 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002278 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002279 const size_t checksumSize = checksumCalculator->checksumByteSize();
2280 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2281 buf = stream->alloc(totalSize);
2282 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002283 int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002284 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002285
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 Zhoub7f09082016-03-10 11:45:02 -08002290
Yahan Zhoue222fd52016-03-16 12:41:08 -07002291 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 }
keunyoungb85b2752013-03-08 12:28:03 -08002298 stream->readback(source, __size_source);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002299 if (useChecksum) checksumCalculator->addBuffer(source, __size_source);
2300 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002301 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002302 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002303 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2304 stream->readback(checksumBufPtr, checksumSize);
2305 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002306 ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n");
2307 abort();
2308 }
2309 }
keunyoungb85b2752013-03-08 12:28:03 -08002310}
2311
2312void 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 Zhoub7f09082016-03-10 11:45:02 -08002317 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002318 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002319
2320 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2321 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002322 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002323 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002324 const size_t checksumSize = checksumCalculator->checksumByteSize();
2325 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2326 buf = stream->alloc(totalSize);
2327 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002328 int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002329 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002330
2331 memcpy(ptr, &target, 4); ptr += 4;
2332 memcpy(ptr, &pname, 4); ptr += 4;
2333 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002334
Yahan Zhoue222fd52016-03-16 12:41:08 -07002335 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2336 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2337
keunyoungb85b2752013-03-08 12:28:03 -08002338 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002339 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2340 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002341 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002342 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002343 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2344 stream->readback(checksumBufPtr, checksumSize);
2345 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002346 ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
2347 abort();
2348 }
2349 }
keunyoungb85b2752013-03-08 12:28:03 -08002350}
2351
2352void 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 Zhoub7f09082016-03-10 11:45:02 -08002357 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002358 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002359
2360 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2361 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002362 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002363 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002364 const size_t checksumSize = checksumCalculator->checksumByteSize();
2365 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2366 buf = stream->alloc(totalSize);
2367 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002368 int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002369 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002370
2371 memcpy(ptr, &target, 4); ptr += 4;
2372 memcpy(ptr, &pname, 4); ptr += 4;
2373 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002374
Yahan Zhoue222fd52016-03-16 12:41:08 -07002375 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2376 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2377
keunyoungb85b2752013-03-08 12:28:03 -08002378 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002379 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2380 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002381 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002382 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002383 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2384 stream->readback(checksumBufPtr, checksumSize);
2385 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002386 ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
2387 abort();
2388 }
2389 }
keunyoungb85b2752013-03-08 12:28:03 -08002390}
2391
2392void 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 Zhoub7f09082016-03-10 11:45:02 -08002397 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002398 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002399
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01002400 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
keunyoungb85b2752013-03-08 12:28:03 -08002401 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002402 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002403 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002404 const size_t checksumSize = checksumCalculator->checksumByteSize();
2405 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2406 buf = stream->alloc(totalSize);
2407 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002408 int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002409 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002410
2411 memcpy(ptr, &program, 4); ptr += 4;
2412 memcpy(ptr, &location, 4); ptr += 4;
2413 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002414
Yahan Zhoue222fd52016-03-16 12:41:08 -07002415 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2416 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2417
keunyoungb85b2752013-03-08 12:28:03 -08002418 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002419 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2420 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002421 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002422 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002423 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2424 stream->readback(checksumBufPtr, checksumSize);
2425 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002426 ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n");
2427 abort();
2428 }
2429 }
keunyoungb85b2752013-03-08 12:28:03 -08002430}
2431
2432void 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 Zhoub7f09082016-03-10 11:45:02 -08002437 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002438 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002439
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01002440 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
keunyoungb85b2752013-03-08 12:28:03 -08002441 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002442 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002443 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002444 const size_t checksumSize = checksumCalculator->checksumByteSize();
2445 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2446 buf = stream->alloc(totalSize);
2447 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002448 int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002449 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002450
2451 memcpy(ptr, &program, 4); ptr += 4;
2452 memcpy(ptr, &location, 4); ptr += 4;
2453 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002454
Yahan Zhoue222fd52016-03-16 12:41:08 -07002455 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2456 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2457
keunyoungb85b2752013-03-08 12:28:03 -08002458 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002459 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2460 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002461 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002462 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002463 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2464 stream->readback(checksumBufPtr, checksumSize);
2465 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002466 ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n");
2467 abort();
2468 }
2469 }
keunyoungb85b2752013-03-08 12:28:03 -08002470}
2471
2472int 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 Zhoub7f09082016-03-10 11:45:02 -08002477 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002478 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002479
2480 const unsigned int __size_name = (strlen(name) + 1);
2481 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002482 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;
keunyoungb85b2752013-03-08 12:28:03 -08002488 int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002489 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002490
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 Zhoue222fd52016-03-16 12:41:08 -07002495 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2496 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2497
Yahan Zhoub7f09082016-03-10 11:45:02 -08002498
keunyoungb85b2752013-03-08 12:28:03 -08002499 int retval;
2500 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002501 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
2502 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002503 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002504 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002505 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2506 stream->readback(checksumBufPtr, checksumSize);
2507 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002508 ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n");
2509 abort();
2510 }
2511 }
keunyoungb85b2752013-03-08 12:28:03 -08002512 return retval;
2513}
2514
2515void 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 Zhoub7f09082016-03-10 11:45:02 -08002520 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002521 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002522
2523 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2524 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002525 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002526 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002527 const size_t checksumSize = checksumCalculator->checksumByteSize();
2528 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2529 buf = stream->alloc(totalSize);
2530 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002531 int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002532 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002533
2534 memcpy(ptr, &index, 4); ptr += 4;
2535 memcpy(ptr, &pname, 4); ptr += 4;
2536 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002537
Yahan Zhoue222fd52016-03-16 12:41:08 -07002538 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2539 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2540
keunyoungb85b2752013-03-08 12:28:03 -08002541 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002542 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2543 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002544 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002545 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002546 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2547 stream->readback(checksumBufPtr, checksumSize);
2548 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002549 ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n");
2550 abort();
2551 }
2552 }
keunyoungb85b2752013-03-08 12:28:03 -08002553}
2554
2555void 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 Zhoub7f09082016-03-10 11:45:02 -08002560 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002561 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002562
2563 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2564 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002565 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002566 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002567 const size_t checksumSize = checksumCalculator->checksumByteSize();
2568 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2569 buf = stream->alloc(totalSize);
2570 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002571 int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002572 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002573
2574 memcpy(ptr, &index, 4); ptr += 4;
2575 memcpy(ptr, &pname, 4); ptr += 4;
2576 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002577
Yahan Zhoue222fd52016-03-16 12:41:08 -07002578 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2579 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2580
keunyoungb85b2752013-03-08 12:28:03 -08002581 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002582 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2583 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002584 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002585 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002586 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2587 stream->readback(checksumBufPtr, checksumSize);
2588 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002589 ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n");
2590 abort();
2591 }
2592 }
keunyoungb85b2752013-03-08 12:28:03 -08002593}
2594
2595void 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 Zhoub7f09082016-03-10 11:45:02 -08002600 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002601 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002602
2603 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002604 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;
keunyoungb85b2752013-03-08 12:28:03 -08002610 int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002611 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002612
2613 memcpy(ptr, &target, 4); ptr += 4;
2614 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002615
Yahan Zhoue222fd52016-03-16 12:41:08 -07002616 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2617 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2618
keunyoungb85b2752013-03-08 12:28:03 -08002619}
2620
2621GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002626 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002627 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002628
2629 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002630 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;
keunyoungb85b2752013-03-08 12:28:03 -08002636 int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002637 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002638
2639 memcpy(ptr, &buffer, 4); ptr += 4;
2640
Yahan Zhoue222fd52016-03-16 12:41:08 -07002641 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2642 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2643
Yahan Zhoub7f09082016-03-10 11:45:02 -08002644
keunyoungb85b2752013-03-08 12:28:03 -08002645 GLboolean retval;
2646 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002647 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2648 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002649 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002650 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002651 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2652 stream->readback(checksumBufPtr, checksumSize);
2653 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002654 ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
2655 abort();
2656 }
2657 }
keunyoungb85b2752013-03-08 12:28:03 -08002658 return retval;
2659}
2660
2661GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002666 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002667 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002668
2669 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002670 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;
keunyoungb85b2752013-03-08 12:28:03 -08002676 int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002677 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002678
2679 memcpy(ptr, &cap, 4); ptr += 4;
2680
Yahan Zhoue222fd52016-03-16 12:41:08 -07002681 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2682 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2683
Yahan Zhoub7f09082016-03-10 11:45:02 -08002684
keunyoungb85b2752013-03-08 12:28:03 -08002685 GLboolean retval;
2686 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002687 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2688 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002689 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002690 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002691 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2692 stream->readback(checksumBufPtr, checksumSize);
2693 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002694 ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
2695 abort();
2696 }
2697 }
keunyoungb85b2752013-03-08 12:28:03 -08002698 return retval;
2699}
2700
2701GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002706 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002707 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002708
2709 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002710 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;
keunyoungb85b2752013-03-08 12:28:03 -08002716 int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002717 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002718
2719 memcpy(ptr, &framebuffer, 4); ptr += 4;
2720
Yahan Zhoue222fd52016-03-16 12:41:08 -07002721 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2722 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2723
Yahan Zhoub7f09082016-03-10 11:45:02 -08002724
keunyoungb85b2752013-03-08 12:28:03 -08002725 GLboolean retval;
2726 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002727 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2728 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002729 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002730 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002731 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2732 stream->readback(checksumBufPtr, checksumSize);
2733 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002734 ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n");
2735 abort();
2736 }
2737 }
keunyoungb85b2752013-03-08 12:28:03 -08002738 return retval;
2739}
2740
2741GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002746 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002747 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002748
2749 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002750 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;
keunyoungb85b2752013-03-08 12:28:03 -08002756 int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002757 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002758
2759 memcpy(ptr, &program, 4); ptr += 4;
2760
Yahan Zhoue222fd52016-03-16 12:41:08 -07002761 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2762 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2763
Yahan Zhoub7f09082016-03-10 11:45:02 -08002764
keunyoungb85b2752013-03-08 12:28:03 -08002765 GLboolean retval;
2766 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002767 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2768 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002769 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002770 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002771 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2772 stream->readback(checksumBufPtr, checksumSize);
2773 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002774 ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n");
2775 abort();
2776 }
2777 }
keunyoungb85b2752013-03-08 12:28:03 -08002778 return retval;
2779}
2780
2781GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002786 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002787 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002788
2789 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002790 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;
keunyoungb85b2752013-03-08 12:28:03 -08002796 int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002797 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002798
2799 memcpy(ptr, &renderbuffer, 4); ptr += 4;
2800
Yahan Zhoue222fd52016-03-16 12:41:08 -07002801 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2802 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2803
Yahan Zhoub7f09082016-03-10 11:45:02 -08002804
keunyoungb85b2752013-03-08 12:28:03 -08002805 GLboolean retval;
2806 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002807 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2808 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002809 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002810 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002811 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2812 stream->readback(checksumBufPtr, checksumSize);
2813 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002814 ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n");
2815 abort();
2816 }
2817 }
keunyoungb85b2752013-03-08 12:28:03 -08002818 return retval;
2819}
2820
2821GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002826 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002827 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002828
2829 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002830 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;
keunyoungb85b2752013-03-08 12:28:03 -08002836 int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002837 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002838
2839 memcpy(ptr, &shader, 4); ptr += 4;
2840
Yahan Zhoue222fd52016-03-16 12:41:08 -07002841 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2842 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2843
Yahan Zhoub7f09082016-03-10 11:45:02 -08002844
keunyoungb85b2752013-03-08 12:28:03 -08002845 GLboolean retval;
2846 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002847 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2848 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002849 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002850 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002851 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2852 stream->readback(checksumBufPtr, checksumSize);
2853 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002854 ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n");
2855 abort();
2856 }
2857 }
keunyoungb85b2752013-03-08 12:28:03 -08002858 return retval;
2859}
2860
2861GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08002866 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002867 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002868
2869 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002870 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;
keunyoungb85b2752013-03-08 12:28:03 -08002876 int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002877 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002878
2879 memcpy(ptr, &texture, 4); ptr += 4;
2880
Yahan Zhoue222fd52016-03-16 12:41:08 -07002881 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2882 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2883
Yahan Zhoub7f09082016-03-10 11:45:02 -08002884
keunyoungb85b2752013-03-08 12:28:03 -08002885 GLboolean retval;
2886 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002887 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2888 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002889 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002890 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002891 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2892 stream->readback(checksumBufPtr, checksumSize);
2893 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002894 ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
2895 abort();
2896 }
2897 }
keunyoungb85b2752013-03-08 12:28:03 -08002898 return retval;
2899}
2900
2901void 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 Zhoub7f09082016-03-10 11:45:02 -08002906 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002907 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002908
2909 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002910 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;
keunyoungb85b2752013-03-08 12:28:03 -08002916 int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002917 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002918
2919 memcpy(ptr, &width, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002920
Yahan Zhoue222fd52016-03-16 12:41:08 -07002921 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2922 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2923
keunyoungb85b2752013-03-08 12:28:03 -08002924}
2925
2926void 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 Zhoub7f09082016-03-10 11:45:02 -08002931 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002932 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002933
2934 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002935 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;
keunyoungb85b2752013-03-08 12:28:03 -08002941 int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002942 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002943
2944 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002945
Yahan Zhoue222fd52016-03-16 12:41:08 -07002946 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2947 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2948
keunyoungb85b2752013-03-08 12:28:03 -08002949}
2950
2951void 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 Zhoub7f09082016-03-10 11:45:02 -08002956 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002957 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002958
2959 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002960 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;
keunyoungb85b2752013-03-08 12:28:03 -08002966 int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002967 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002968
2969 memcpy(ptr, &pname, 4); ptr += 4;
2970 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002971
Yahan Zhoue222fd52016-03-16 12:41:08 -07002972 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2973 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2974
keunyoungb85b2752013-03-08 12:28:03 -08002975}
2976
2977void 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 Zhoub7f09082016-03-10 11:45:02 -08002982 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002983 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002984
2985 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002986 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;
keunyoungb85b2752013-03-08 12:28:03 -08002992 int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002993 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002994
2995 memcpy(ptr, &factor, 4); ptr += 4;
2996 memcpy(ptr, &units, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002997
Yahan Zhoue222fd52016-03-16 12:41:08 -07002998 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2999 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3000
keunyoungb85b2752013-03-08 12:28:03 -08003001}
3002
3003void 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 Zhoub7f09082016-03-10 11:45:02 -08003008 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003009 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003010
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003011 const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1);
keunyoungb85b2752013-03-08 12:28:03 -08003012 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003013 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07003014 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003015 const size_t checksumSize = checksumCalculator->checksumByteSize();
3016 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3017 buf = stream->alloc(totalSize);
3018 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003019 int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003020 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003021
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 Zhoub7f09082016-03-10 11:45:02 -08003029
Yahan Zhoue222fd52016-03-16 12:41:08 -07003030 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3031 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3032
Roman Kiryanov80f83652018-10-03 14:05:29 -07003033 // TODO: emugen produces bad code here, see b/79208762
Lingfeng Yang22dc42d2018-05-29 10:11:38 -07003034 stream->readbackPixels(self, width, height, format, type, pixels);
3035
Yahan Zhoue222fd52016-03-16 12:41:08 -07003036 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3037 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003038 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07003039 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003040 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
3041 stream->readback(checksumBufPtr, checksumSize);
3042 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07003043 ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3044 abort();
3045 }
3046 }
keunyoungb85b2752013-03-08 12:28:03 -08003047}
3048
3049void glReleaseShaderCompiler_enc(void *self )
3050{
3051
3052 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3053 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003054 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003055 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003056
3057 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003058 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;
keunyoungb85b2752013-03-08 12:28:03 -08003064 int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003065 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003066
Yahan Zhoub7f09082016-03-10 11:45:02 -08003067
Yahan Zhoue222fd52016-03-16 12:41:08 -07003068 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3069 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3070
keunyoungb85b2752013-03-08 12:28:03 -08003071}
3072
3073void 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 Zhoub7f09082016-03-10 11:45:02 -08003078 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003079 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003080
3081 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003082 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;
keunyoungb85b2752013-03-08 12:28:03 -08003088 int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003089 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003090
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 Zhoub7f09082016-03-10 11:45:02 -08003095
Yahan Zhoue222fd52016-03-16 12:41:08 -07003096 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3097 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3098
keunyoungb85b2752013-03-08 12:28:03 -08003099}
3100
3101void 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 Zhoub7f09082016-03-10 11:45:02 -08003106 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003107 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003108
3109 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003110 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;
keunyoungb85b2752013-03-08 12:28:03 -08003116 int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003117 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003118
3119 memcpy(ptr, &value, 4); ptr += 4;
3120 memcpy(ptr, &invert, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003121
Yahan Zhoue222fd52016-03-16 12:41:08 -07003122 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3123 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3124
keunyoungb85b2752013-03-08 12:28:03 -08003125}
3126
3127void 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 Zhoub7f09082016-03-10 11:45:02 -08003132 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003133 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003134
3135 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003136 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;
keunyoungb85b2752013-03-08 12:28:03 -08003142 int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003143 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003144
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 Zhoub7f09082016-03-10 11:45:02 -08003149
Yahan Zhoue222fd52016-03-16 12:41:08 -07003150 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3151 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3152
keunyoungb85b2752013-03-08 12:28:03 -08003153}
3154
3155void 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 Zhoub7f09082016-03-10 11:45:02 -08003160 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003161 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003162
3163 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003164 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;
keunyoungb85b2752013-03-08 12:28:03 -08003170 int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003171 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003172
3173 memcpy(ptr, &func, 4); ptr += 4;
3174 memcpy(ptr, &ref, 4); ptr += 4;
3175 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003176
Yahan Zhoue222fd52016-03-16 12:41:08 -07003177 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3178 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3179
keunyoungb85b2752013-03-08 12:28:03 -08003180}
3181
3182void 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 Zhoub7f09082016-03-10 11:45:02 -08003187 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003188 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003189
3190 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003191 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;
keunyoungb85b2752013-03-08 12:28:03 -08003197 int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003198 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003199
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 Zhoub7f09082016-03-10 11:45:02 -08003204
Yahan Zhoue222fd52016-03-16 12:41:08 -07003205 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3206 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3207
keunyoungb85b2752013-03-08 12:28:03 -08003208}
3209
3210void 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 Zhoub7f09082016-03-10 11:45:02 -08003215 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003216 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003217
3218 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003219 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;
keunyoungb85b2752013-03-08 12:28:03 -08003225 int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003226 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003227
3228 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003229
Yahan Zhoue222fd52016-03-16 12:41:08 -07003230 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3231 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3232
keunyoungb85b2752013-03-08 12:28:03 -08003233}
3234
3235void 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 Zhoub7f09082016-03-10 11:45:02 -08003240 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003241 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003242
3243 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003244 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;
keunyoungb85b2752013-03-08 12:28:03 -08003250 int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003251 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003252
3253 memcpy(ptr, &face, 4); ptr += 4;
3254 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003255
Yahan Zhoue222fd52016-03-16 12:41:08 -07003256 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3257 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3258
keunyoungb85b2752013-03-08 12:28:03 -08003259}
3260
3261void 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 Zhoub7f09082016-03-10 11:45:02 -08003266 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003267 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003268
3269 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003270 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;
keunyoungb85b2752013-03-08 12:28:03 -08003276 int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003277 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003278
3279 memcpy(ptr, &fail, 4); ptr += 4;
3280 memcpy(ptr, &zfail, 4); ptr += 4;
3281 memcpy(ptr, &zpass, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003282
Yahan Zhoue222fd52016-03-16 12:41:08 -07003283 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3284 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3285
keunyoungb85b2752013-03-08 12:28:03 -08003286}
3287
3288void 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 Zhoub7f09082016-03-10 11:45:02 -08003293 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003294 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003295
3296 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003297 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;
keunyoungb85b2752013-03-08 12:28:03 -08003303 int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003304 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003305
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 Zhoub7f09082016-03-10 11:45:02 -08003310
Yahan Zhoue222fd52016-03-16 12:41:08 -07003311 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3312 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3313
keunyoungb85b2752013-03-08 12:28:03 -08003314}
3315
3316void 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 Zhoub7f09082016-03-10 11:45:02 -08003321 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003322 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003323
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003324 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003325 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003326 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;
keunyoungb85b2752013-03-08 12:28:03 -08003332 int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003333 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003334
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 Zhoub7f09082016-03-10 11:45:02 -08003343
Yahan Zhoue222fd52016-03-16 12:41:08 -07003344 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003345 stream->flush();
3346 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003347 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003348 if (pixels != NULL) {
3349 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003350 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003351 }
3352 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003353 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3354
keunyoungb85b2752013-03-08 12:28:03 -08003355}
3356
3357void 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 Zhoub7f09082016-03-10 11:45:02 -08003362 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003363 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003364
3365 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003366 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;
keunyoungb85b2752013-03-08 12:28:03 -08003372 int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003373 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003374
3375 memcpy(ptr, &target, 4); ptr += 4;
3376 memcpy(ptr, &pname, 4); ptr += 4;
3377 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003378
Yahan Zhoue222fd52016-03-16 12:41:08 -07003379 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3380 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3381
keunyoungb85b2752013-03-08 12:28:03 -08003382}
3383
3384void 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 Zhoub7f09082016-03-10 11:45:02 -08003389 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003390 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003391
3392 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
3393 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003394 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;
keunyoungb85b2752013-03-08 12:28:03 -08003400 int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003401 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003402
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 Zhoub7f09082016-03-10 11:45:02 -08003407
Yahan Zhoue222fd52016-03-16 12:41:08 -07003408 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3409 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3410
keunyoungb85b2752013-03-08 12:28:03 -08003411}
3412
3413void 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 Zhoub7f09082016-03-10 11:45:02 -08003418 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003419 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003420
3421 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003422 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;
keunyoungb85b2752013-03-08 12:28:03 -08003428 int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003429 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003430
3431 memcpy(ptr, &target, 4); ptr += 4;
3432 memcpy(ptr, &pname, 4); ptr += 4;
3433 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003434
Yahan Zhoue222fd52016-03-16 12:41:08 -07003435 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3436 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3437
keunyoungb85b2752013-03-08 12:28:03 -08003438}
3439
3440void 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 Zhoub7f09082016-03-10 11:45:02 -08003445 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003446 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003447
3448 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
3449 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003450 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;
keunyoungb85b2752013-03-08 12:28:03 -08003456 int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003457 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003458
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 Zhoub7f09082016-03-10 11:45:02 -08003463
Yahan Zhoue222fd52016-03-16 12:41:08 -07003464 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3465 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3466
keunyoungb85b2752013-03-08 12:28:03 -08003467}
3468
3469void 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 Zhoub7f09082016-03-10 11:45:02 -08003474 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003475 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003476
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003477 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003478 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003479 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;
keunyoungb85b2752013-03-08 12:28:03 -08003485 int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003486 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003487
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 Zhoub7f09082016-03-10 11:45:02 -08003496
Yahan Zhoue222fd52016-03-16 12:41:08 -07003497 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003498 stream->flush();
3499 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003500 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003501 if (pixels != NULL) {
3502 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003503 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003504 }
3505 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003506 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3507
keunyoungb85b2752013-03-08 12:28:03 -08003508}
3509
3510void 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 Zhoub7f09082016-03-10 11:45:02 -08003515 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003516 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003517
3518 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003519 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;
keunyoungb85b2752013-03-08 12:28:03 -08003525 int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003526 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003527
3528 memcpy(ptr, &location, 4); ptr += 4;
3529 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003530
Yahan Zhoue222fd52016-03-16 12:41:08 -07003531 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3532 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3533
keunyoungb85b2752013-03-08 12:28:03 -08003534}
3535
3536void 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 Zhoub7f09082016-03-10 11:45:02 -08003541 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003542 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003543
3544 const unsigned int __size_v = (count * sizeof(GLfloat));
3545 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003546 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;
keunyoungb85b2752013-03-08 12:28:03 -08003552 int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003553 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003554
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 Zhoub7f09082016-03-10 11:45:02 -08003559
Yahan Zhoue222fd52016-03-16 12:41:08 -07003560 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3561 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3562
keunyoungb85b2752013-03-08 12:28:03 -08003563}
3564
3565void 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 Zhoub7f09082016-03-10 11:45:02 -08003570 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003571 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003572
3573 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003574 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;
keunyoungb85b2752013-03-08 12:28:03 -08003580 int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003581 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003582
3583 memcpy(ptr, &location, 4); ptr += 4;
3584 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003585
Yahan Zhoue222fd52016-03-16 12:41:08 -07003586 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3587 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3588
keunyoungb85b2752013-03-08 12:28:03 -08003589}
3590
3591void 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 Zhoub7f09082016-03-10 11:45:02 -08003596 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003597 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003598
3599 const unsigned int __size_v = (count * sizeof(GLint));
3600 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003601 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;
keunyoungb85b2752013-03-08 12:28:03 -08003607 int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003608 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003609
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 Zhoub7f09082016-03-10 11:45:02 -08003614
Yahan Zhoue222fd52016-03-16 12:41:08 -07003615 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3616 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3617
keunyoungb85b2752013-03-08 12:28:03 -08003618}
3619
3620void 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 Zhoub7f09082016-03-10 11:45:02 -08003625 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003626 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003627
3628 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003629 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;
keunyoungb85b2752013-03-08 12:28:03 -08003635 int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003636 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003637
3638 memcpy(ptr, &location, 4); ptr += 4;
3639 memcpy(ptr, &x, 4); ptr += 4;
3640 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003641
Yahan Zhoue222fd52016-03-16 12:41:08 -07003642 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3643 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3644
keunyoungb85b2752013-03-08 12:28:03 -08003645}
3646
3647void 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 Zhoub7f09082016-03-10 11:45:02 -08003652 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003653 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003654
3655 const unsigned int __size_v = (count * 2 * sizeof(GLfloat));
3656 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003657 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;
keunyoungb85b2752013-03-08 12:28:03 -08003663 int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003664 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003665
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 Zhoub7f09082016-03-10 11:45:02 -08003670
Yahan Zhoue222fd52016-03-16 12:41:08 -07003671 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3672 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3673
keunyoungb85b2752013-03-08 12:28:03 -08003674}
3675
3676void 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 Zhoub7f09082016-03-10 11:45:02 -08003681 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003682 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003683
3684 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003685 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;
keunyoungb85b2752013-03-08 12:28:03 -08003691 int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003692 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003693
3694 memcpy(ptr, &location, 4); ptr += 4;
3695 memcpy(ptr, &x, 4); ptr += 4;
3696 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003697
Yahan Zhoue222fd52016-03-16 12:41:08 -07003698 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3699 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3700
keunyoungb85b2752013-03-08 12:28:03 -08003701}
3702
3703void 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 Zhoub7f09082016-03-10 11:45:02 -08003708 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003709 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003710
3711 const unsigned int __size_v = (count * 2 * sizeof(GLint));
3712 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003713 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;
keunyoungb85b2752013-03-08 12:28:03 -08003719 int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003720 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003721
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 Zhoub7f09082016-03-10 11:45:02 -08003726
Yahan Zhoue222fd52016-03-16 12:41:08 -07003727 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3728 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3729
keunyoungb85b2752013-03-08 12:28:03 -08003730}
3731
3732void 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 Zhoub7f09082016-03-10 11:45:02 -08003737 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003738 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003739
3740 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003741 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;
keunyoungb85b2752013-03-08 12:28:03 -08003747 int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003748 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003749
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 Zhoub7f09082016-03-10 11:45:02 -08003754
Yahan Zhoue222fd52016-03-16 12:41:08 -07003755 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3756 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3757
keunyoungb85b2752013-03-08 12:28:03 -08003758}
3759
3760void 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 Zhoub7f09082016-03-10 11:45:02 -08003765 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003766 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003767
3768 const unsigned int __size_v = (count * 3 * sizeof(GLfloat));
3769 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003770 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;
keunyoungb85b2752013-03-08 12:28:03 -08003776 int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003777 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003778
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 Zhoub7f09082016-03-10 11:45:02 -08003783
Yahan Zhoue222fd52016-03-16 12:41:08 -07003784 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3785 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3786
keunyoungb85b2752013-03-08 12:28:03 -08003787}
3788
3789void 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 Zhoub7f09082016-03-10 11:45:02 -08003794 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003795 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003796
3797 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003798 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;
keunyoungb85b2752013-03-08 12:28:03 -08003804 int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003805 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003806
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 Zhoub7f09082016-03-10 11:45:02 -08003811
Yahan Zhoue222fd52016-03-16 12:41:08 -07003812 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3813 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3814
keunyoungb85b2752013-03-08 12:28:03 -08003815}
3816
3817void 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 Zhoub7f09082016-03-10 11:45:02 -08003822 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003823 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003824
3825 const unsigned int __size_v = (3 * count * sizeof(GLint));
3826 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003827 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;
keunyoungb85b2752013-03-08 12:28:03 -08003833 int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003834 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003835
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 Zhoub7f09082016-03-10 11:45:02 -08003840
Yahan Zhoue222fd52016-03-16 12:41:08 -07003841 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3842 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3843
keunyoungb85b2752013-03-08 12:28:03 -08003844}
3845
3846void 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 Zhoub7f09082016-03-10 11:45:02 -08003851 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003852 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003853
3854 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003855 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;
keunyoungb85b2752013-03-08 12:28:03 -08003861 int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003862 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003863
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 Zhoub7f09082016-03-10 11:45:02 -08003869
Yahan Zhoue222fd52016-03-16 12:41:08 -07003870 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3871 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3872
keunyoungb85b2752013-03-08 12:28:03 -08003873}
3874
3875void 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 Zhoub7f09082016-03-10 11:45:02 -08003880 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003881 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003882
3883 const unsigned int __size_v = (4 * count * sizeof(GLfloat));
3884 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003885 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;
keunyoungb85b2752013-03-08 12:28:03 -08003891 int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003892 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003893
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 Zhoub7f09082016-03-10 11:45:02 -08003898
Yahan Zhoue222fd52016-03-16 12:41:08 -07003899 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3900 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3901
keunyoungb85b2752013-03-08 12:28:03 -08003902}
3903
3904void 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 Zhoub7f09082016-03-10 11:45:02 -08003909 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003910 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003911
3912 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003913 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;
keunyoungb85b2752013-03-08 12:28:03 -08003919 int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003920 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003921
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 Zhoub7f09082016-03-10 11:45:02 -08003927
Yahan Zhoue222fd52016-03-16 12:41:08 -07003928 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3929 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3930
keunyoungb85b2752013-03-08 12:28:03 -08003931}
3932
3933void 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 Zhoub7f09082016-03-10 11:45:02 -08003938 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003939 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003940
3941 const unsigned int __size_v = (4 * count * sizeof(GLint));
3942 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003943 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;
keunyoungb85b2752013-03-08 12:28:03 -08003949 int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003950 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003951
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 Zhoub7f09082016-03-10 11:45:02 -08003956
Yahan Zhoue222fd52016-03-16 12:41:08 -07003957 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3958 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3959
keunyoungb85b2752013-03-08 12:28:03 -08003960}
3961
3962void 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 Zhoub7f09082016-03-10 11:45:02 -08003967 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003968 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003969
3970 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
3971 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003972 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;
keunyoungb85b2752013-03-08 12:28:03 -08003978 int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003979 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003980
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 Zhoub7f09082016-03-10 11:45:02 -08003986
Yahan Zhoue222fd52016-03-16 12:41:08 -07003987 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3988 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3989
keunyoungb85b2752013-03-08 12:28:03 -08003990}
3991
3992void 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 Zhoub7f09082016-03-10 11:45:02 -08003997 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003998 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003999
4000 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
4001 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004002 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;
keunyoungb85b2752013-03-08 12:28:03 -08004008 int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004009 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004010
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 Zhoub7f09082016-03-10 11:45:02 -08004016
Yahan Zhoue222fd52016-03-16 12:41:08 -07004017 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4018 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4019
keunyoungb85b2752013-03-08 12:28:03 -08004020}
4021
4022void 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 Zhoub7f09082016-03-10 11:45:02 -08004027 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004028 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004029
4030 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
4031 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004032 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;
keunyoungb85b2752013-03-08 12:28:03 -08004038 int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004039 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004040
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 Zhoub7f09082016-03-10 11:45:02 -08004046
Yahan Zhoue222fd52016-03-16 12:41:08 -07004047 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4048 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4049
keunyoungb85b2752013-03-08 12:28:03 -08004050}
4051
4052void 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 Zhoub7f09082016-03-10 11:45:02 -08004057 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004058 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004059
4060 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004061 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;
keunyoungb85b2752013-03-08 12:28:03 -08004067 int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004068 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004069
4070 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004071
Yahan Zhoue222fd52016-03-16 12:41:08 -07004072 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4073 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4074
keunyoungb85b2752013-03-08 12:28:03 -08004075}
4076
4077void 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 Zhoub7f09082016-03-10 11:45:02 -08004082 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004083 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004084
4085 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004086 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;
keunyoungb85b2752013-03-08 12:28:03 -08004092 int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004093 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004094
4095 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004096
Yahan Zhoue222fd52016-03-16 12:41:08 -07004097 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4098 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4099
keunyoungb85b2752013-03-08 12:28:03 -08004100}
4101
4102void 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 Zhoub7f09082016-03-10 11:45:02 -08004107 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004108 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004109
4110 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004111 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;
keunyoungb85b2752013-03-08 12:28:03 -08004117 int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004118 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004119
4120 memcpy(ptr, &indx, 4); ptr += 4;
4121 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004122
Yahan Zhoue222fd52016-03-16 12:41:08 -07004123 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4124 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4125
keunyoungb85b2752013-03-08 12:28:03 -08004126}
4127
4128void 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 Zhoub7f09082016-03-10 11:45:02 -08004133 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004134 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004135
4136 const unsigned int __size_values = (sizeof(GLfloat));
4137 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004138 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;
keunyoungb85b2752013-03-08 12:28:03 -08004144 int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004145 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004146
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 Zhoub7f09082016-03-10 11:45:02 -08004150
Yahan Zhoue222fd52016-03-16 12:41:08 -07004151 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4152 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4153
keunyoungb85b2752013-03-08 12:28:03 -08004154}
4155
4156void 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 Zhoub7f09082016-03-10 11:45:02 -08004161 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004162 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004163
4164 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004165 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;
keunyoungb85b2752013-03-08 12:28:03 -08004171 int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004172 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004173
4174 memcpy(ptr, &indx, 4); ptr += 4;
4175 memcpy(ptr, &x, 4); ptr += 4;
4176 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004177
Yahan Zhoue222fd52016-03-16 12:41:08 -07004178 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4179 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4180
keunyoungb85b2752013-03-08 12:28:03 -08004181}
4182
4183void 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 Zhoub7f09082016-03-10 11:45:02 -08004188 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004189 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004190
4191 const unsigned int __size_values = (2 * sizeof(GLfloat));
4192 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004193 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;
keunyoungb85b2752013-03-08 12:28:03 -08004199 int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004200 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004201
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 Zhoub7f09082016-03-10 11:45:02 -08004205
Yahan Zhoue222fd52016-03-16 12:41:08 -07004206 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4207 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4208
keunyoungb85b2752013-03-08 12:28:03 -08004209}
4210
4211void 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 Zhoub7f09082016-03-10 11:45:02 -08004216 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004217 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004218
4219 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004220 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;
keunyoungb85b2752013-03-08 12:28:03 -08004226 int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004227 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004228
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 Zhoub7f09082016-03-10 11:45:02 -08004233
Yahan Zhoue222fd52016-03-16 12:41:08 -07004234 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4235 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4236
keunyoungb85b2752013-03-08 12:28:03 -08004237}
4238
4239void 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 Zhoub7f09082016-03-10 11:45:02 -08004244 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004245 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004246
4247 const unsigned int __size_values = (3 * sizeof(GLfloat));
4248 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004249 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;
keunyoungb85b2752013-03-08 12:28:03 -08004255 int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004256 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004257
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 Zhoub7f09082016-03-10 11:45:02 -08004261
Yahan Zhoue222fd52016-03-16 12:41:08 -07004262 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4263 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4264
keunyoungb85b2752013-03-08 12:28:03 -08004265}
4266
4267void 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 Zhoub7f09082016-03-10 11:45:02 -08004272 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004273 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004274
4275 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004276 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;
keunyoungb85b2752013-03-08 12:28:03 -08004282 int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004283 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004284
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 Zhoub7f09082016-03-10 11:45:02 -08004290
Yahan Zhoue222fd52016-03-16 12:41:08 -07004291 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4292 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4293
keunyoungb85b2752013-03-08 12:28:03 -08004294}
4295
4296void 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 Zhoub7f09082016-03-10 11:45:02 -08004301 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004302 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004303
4304 const unsigned int __size_values = (4 * sizeof(GLfloat));
4305 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004306 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;
keunyoungb85b2752013-03-08 12:28:03 -08004312 int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004313 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004314
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 Zhoub7f09082016-03-10 11:45:02 -08004318
Yahan Zhoue222fd52016-03-16 12:41:08 -07004319 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4320 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4321
keunyoungb85b2752013-03-08 12:28:03 -08004322}
4323
4324void 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 Zhoub7f09082016-03-10 11:45:02 -08004329 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004330 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004331
4332 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004333 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;
keunyoungb85b2752013-03-08 12:28:03 -08004339 int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004340 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004341
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 Zhoub7f09082016-03-10 11:45:02 -08004346
Yahan Zhoue222fd52016-03-16 12:41:08 -07004347 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4348 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4349
keunyoungb85b2752013-03-08 12:28:03 -08004350}
4351
4352void 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 Zhoub7f09082016-03-10 11:45:02 -08004357 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004358 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004359
4360 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004361 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;
keunyoungb85b2752013-03-08 12:28:03 -08004367 int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004368 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004369
4370 memcpy(ptr, &target, 4); ptr += 4;
4371 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004372
Yahan Zhoue222fd52016-03-16 12:41:08 -07004373 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4374 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4375
keunyoungb85b2752013-03-08 12:28:03 -08004376}
4377
4378void 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 Zhoub7f09082016-03-10 11:45:02 -08004383 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004384 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004385
4386 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004387 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;
keunyoungb85b2752013-03-08 12:28:03 -08004393 int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004394 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004395
4396 memcpy(ptr, &target, 4); ptr += 4;
4397 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004398
Yahan Zhoue222fd52016-03-16 12:41:08 -07004399 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4400 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4401
keunyoungb85b2752013-03-08 12:28:03 -08004402}
4403
4404GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08004409 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004410 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004411
4412 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004413 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;
keunyoungb85b2752013-03-08 12:28:03 -08004419 int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004420 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004421
4422 memcpy(ptr, &target, 4); ptr += 4;
4423
Yahan Zhoue222fd52016-03-16 12:41:08 -07004424 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4425 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4426
Yahan Zhoub7f09082016-03-10 11:45:02 -08004427
keunyoungb85b2752013-03-08 12:28:03 -08004428 GLboolean retval;
4429 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004430 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4431 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004432 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004433 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004434 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4435 stream->readback(checksumBufPtr, checksumSize);
4436 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004437 ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
4438 abort();
4439 }
4440 }
keunyoungb85b2752013-03-08 12:28:03 -08004441 return retval;
4442}
4443
4444void 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 Zhoub7f09082016-03-10 11:45:02 -08004449 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004450 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004451
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01004452 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004453 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004454 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;
keunyoungb85b2752013-03-08 12:28:03 -08004460 int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004461 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004462
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 Zhoub7f09082016-03-10 11:45:02 -08004472
Yahan Zhoue222fd52016-03-16 12:41:08 -07004473 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004474 stream->flush();
4475 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004476 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004477 if (pixels != NULL) {
4478 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004479 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004480 }
4481 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004482 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4483
keunyoungb85b2752013-03-08 12:28:03 -08004484}
4485
4486void 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 Zhoub7f09082016-03-10 11:45:02 -08004491 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004492 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004493
Yahan Zhou268e85c2016-02-19 13:59:34 -08004494 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004495 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004496 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;
keunyoungb85b2752013-03-08 12:28:03 -08004502 int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004503 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004504
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 Zhoub7f09082016-03-10 11:45:02 -08004515
Yahan Zhoue222fd52016-03-16 12:41:08 -07004516 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004517 stream->flush();
4518 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004519 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004520 if (pixels != NULL) {
4521 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004522 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004523 }
4524 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004525 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4526
keunyoungb85b2752013-03-08 12:28:03 -08004527}
4528
4529void 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 Zhoub7f09082016-03-10 11:45:02 -08004534 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004535 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004536
4537 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004538 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;
keunyoungb85b2752013-03-08 12:28:03 -08004544 int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004545 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004546
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 Zhoub7f09082016-03-10 11:45:02 -08004556
Yahan Zhoue222fd52016-03-16 12:41:08 -07004557 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4558 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4559
keunyoungb85b2752013-03-08 12:28:03 -08004560}
4561
4562void 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 Zhoub7f09082016-03-10 11:45:02 -08004567 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004568 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004569
Yahan Zhou268e85c2016-02-19 13:59:34 -08004570 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004571 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004572 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;
keunyoungb85b2752013-03-08 12:28:03 -08004578 int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004579 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004580
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 Zhoub7f09082016-03-10 11:45:02 -08004589
Yahan Zhoue222fd52016-03-16 12:41:08 -07004590 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004591 stream->flush();
4592 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004593 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004594 if (data != NULL) {
4595 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004596 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004597 }
4598 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004599 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4600
keunyoungb85b2752013-03-08 12:28:03 -08004601}
4602
4603void 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 Zhoub7f09082016-03-10 11:45:02 -08004608 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004609 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004610
Yahan Zhou268e85c2016-02-19 13:59:34 -08004611 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004612 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004613 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;
keunyoungb85b2752013-03-08 12:28:03 -08004619 int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004620 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004621
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 Zhoub7f09082016-03-10 11:45:02 -08004632
Yahan Zhoue222fd52016-03-16 12:41:08 -07004633 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004634 stream->flush();
4635 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004636 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004637 if (data != NULL) {
4638 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004639 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004640 }
4641 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004642 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4643
keunyoungb85b2752013-03-08 12:28:03 -08004644}
4645
4646void 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 Zhoub7f09082016-03-10 11:45:02 -08004651 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004652 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004653
4654 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004655 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;
keunyoungb85b2752013-03-08 12:28:03 -08004661 int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004662 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004663
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 Zhoub7f09082016-03-10 11:45:02 -08004670
Yahan Zhoue222fd52016-03-16 12:41:08 -07004671 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4672 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4673
keunyoungb85b2752013-03-08 12:28:03 -08004674}
4675
4676void 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 Zhoub7f09082016-03-10 11:45:02 -08004681 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004682 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004683
4684 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004685 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;
keunyoungb85b2752013-03-08 12:28:03 -08004691 int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004692 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004693
4694 memcpy(ptr, &array, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004695
Yahan Zhoue222fd52016-03-16 12:41:08 -07004696 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4697 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4698
keunyoungb85b2752013-03-08 12:28:03 -08004699}
4700
4701void 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 Zhoub7f09082016-03-10 11:45:02 -08004706 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004707 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004708
4709 const unsigned int __size_arrays = (n * sizeof(GLuint));
4710 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004711 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;
keunyoungb85b2752013-03-08 12:28:03 -08004717 int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004718 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004719
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 Zhoub7f09082016-03-10 11:45:02 -08004723
Yahan Zhoue222fd52016-03-16 12:41:08 -07004724 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4725 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4726
keunyoungb85b2752013-03-08 12:28:03 -08004727}
4728
4729void 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 Zhoub7f09082016-03-10 11:45:02 -08004734 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004735 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004736
4737 const unsigned int __size_arrays = (n * sizeof(GLuint));
4738 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004739 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004740 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004741 const size_t checksumSize = checksumCalculator->checksumByteSize();
4742 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4743 buf = stream->alloc(totalSize);
4744 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004745 int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004746 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004747
4748 memcpy(ptr, &n, 4); ptr += 4;
4749 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004750
Yahan Zhoue222fd52016-03-16 12:41:08 -07004751 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4752 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4753
keunyoungb85b2752013-03-08 12:28:03 -08004754 stream->readback(arrays, __size_arrays);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004755 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
4756 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004757 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004758 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004759 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4760 stream->readback(checksumBufPtr, checksumSize);
4761 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004762 ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
4763 abort();
4764 }
4765 }
keunyoungb85b2752013-03-08 12:28:03 -08004766}
4767
4768GLboolean 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 Zhoub7f09082016-03-10 11:45:02 -08004773 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004774 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004775
4776 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004777 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;
keunyoungb85b2752013-03-08 12:28:03 -08004783 int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004784 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004785
4786 memcpy(ptr, &array, 4); ptr += 4;
4787
Yahan Zhoue222fd52016-03-16 12:41:08 -07004788 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4789 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4790
Yahan Zhoub7f09082016-03-10 11:45:02 -08004791
keunyoungb85b2752013-03-08 12:28:03 -08004792 GLboolean retval;
4793 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004794 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4795 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004796 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004797 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004798 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4799 stream->readback(checksumBufPtr, checksumSize);
4800 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004801 ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
4802 abort();
4803 }
4804 }
keunyoungb85b2752013-03-08 12:28:03 -08004805 return retval;
4806}
4807
4808void 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 Zhoub7f09082016-03-10 11:45:02 -08004813 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004814 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004815
4816 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
4817 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004818 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;
keunyoungb85b2752013-03-08 12:28:03 -08004824 int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004825 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004826
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 Zhoub7f09082016-03-10 11:45:02 -08004831
Yahan Zhoue222fd52016-03-16 12:41:08 -07004832 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4833 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4834
keunyoungb85b2752013-03-08 12:28:03 -08004835}
4836
4837void 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 Zhoub7f09082016-03-10 11:45:02 -08004842 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004843 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004844
4845 const unsigned int __size_data = datalen;
4846 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004847 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;
keunyoungb85b2752013-03-08 12:28:03 -08004853 int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004854 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004855
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 Zhoub7f09082016-03-10 11:45:02 -08004864
Yahan Zhoue222fd52016-03-16 12:41:08 -07004865 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4866 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4867
keunyoungb85b2752013-03-08 12:28:03 -08004868}
4869
4870void 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 Zhoub7f09082016-03-10 11:45:02 -08004875 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004876 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004877
4878 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004879 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;
keunyoungb85b2752013-03-08 12:28:03 -08004885 int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004886 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004887
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 Zhoub7f09082016-03-10 11:45:02 -08004894
Yahan Zhoue222fd52016-03-16 12:41:08 -07004895 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4896 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4897
keunyoungb85b2752013-03-08 12:28:03 -08004898}
4899
4900void 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 Zhoub7f09082016-03-10 11:45:02 -08004905 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004906 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004907
4908 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004909 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;
keunyoungb85b2752013-03-08 12:28:03 -08004915 int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004916 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004917
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 Zhoub7f09082016-03-10 11:45:02 -08004922
Yahan Zhoue222fd52016-03-16 12:41:08 -07004923 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4924 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004925
keunyoungb85b2752013-03-08 12:28:03 -08004926}
4927
4928void 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 Zhoub7f09082016-03-10 11:45:02 -08004933 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004934 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004935
4936 const unsigned int __size_data = datalen;
4937 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004938 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;
keunyoungb85b2752013-03-08 12:28:03 -08004944 int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004945 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004946
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 Zhoub7f09082016-03-10 11:45:02 -08004953
Yahan Zhoue222fd52016-03-16 12:41:08 -07004954 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4955 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004956
keunyoungb85b2752013-03-08 12:28:03 -08004957}
4958
4959void 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 Zhoub7f09082016-03-10 11:45:02 -08004964 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004965 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004966
4967 const unsigned int __size_formats = (count * sizeof(GLint));
4968 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004969 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004970 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004971 const size_t checksumSize = checksumCalculator->checksumByteSize();
4972 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4973 buf = stream->alloc(totalSize);
4974 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004975 int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004976 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004977
4978 memcpy(ptr, &count, 4); ptr += 4;
4979 *(unsigned int *)(ptr) = __size_formats; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004980
Yahan Zhoue222fd52016-03-16 12:41:08 -07004981 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4982 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4983
keunyoungb85b2752013-03-08 12:28:03 -08004984 stream->readback(formats, __size_formats);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004985 if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4986 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004987 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004988 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004989 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4990 stream->readback(checksumBufPtr, checksumSize);
4991 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004992 ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4993 abort();
4994 }
4995 }
keunyoungb85b2752013-03-08 12:28:03 -08004996}
4997
4998void 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 Zhoub7f09082016-03-10 11:45:02 -08005003 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005004 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005005
5006 const unsigned int __size_string = len;
5007 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005008 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;
keunyoungb85b2752013-03-08 12:28:03 -08005014 int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005015 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005016
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 Zhoub7f09082016-03-10 11:45:02 -08005021
Yahan Zhoue222fd52016-03-16 12:41:08 -07005022 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5023 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5024
keunyoungb85b2752013-03-08 12:28:03 -08005025}
5026
5027int glFinishRoundTrip_enc(void *self )
5028{
5029
5030 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5031 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005032 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005033 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005034
5035 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005036 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;
keunyoungb85b2752013-03-08 12:28:03 -08005042 int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005043 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005044
5045
Yahan Zhoue222fd52016-03-16 12:41:08 -07005046 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5047 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5048
Yahan Zhoub7f09082016-03-10 11:45:02 -08005049
keunyoungb85b2752013-03-08 12:28:03 -08005050 int retval;
5051 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07005052 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5053 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005054 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07005055 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005056 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5057 stream->readback(checksumBufPtr, checksumSize);
5058 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07005059 ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
5060 abort();
5061 }
5062 }
keunyoungb85b2752013-03-08 12:28:03 -08005063 return retval;
5064}
5065
Lingfeng Yange6556dc2017-01-09 12:04:12 -08005066void 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
5105void 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
5130void 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
5158GLboolean 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
5198void 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
5242void 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
5287void 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
5318void 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
5349void 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
5381void 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
5414void 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
5447void 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
5480void 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
5509void 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
5536void 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
5566void 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
5595void 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
5624void 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
5653void 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
5681void 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
5708GLuint 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
5751void 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
5795void 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
5836void 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
5885void 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
5911void 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
5938void 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
5966void 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
5995void 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
6024void 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
6053void 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
6082void 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
6111void 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
6141void 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
6171void 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
6201void 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
6231void 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
6261void 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
6291void 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
6331void 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
6375void 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
6404void 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
6433void 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
6461void 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
6489void 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
6518void 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
6550void 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
6590void 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
6630void 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
6656void 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
6684void 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
6716void 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
6745void 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
6778void 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 Yangf000ab42017-01-11 18:31:38 -08006808uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006809{
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 Yangf000ab42017-01-11 18:31:38 -08006823 int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006824 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 Yangf000ab42017-01-11 18:31:38 -08006833 uint64_t retval;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006834 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 Yangf000ab42017-01-11 18:31:38 -08006842 ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006843 abort();
6844 }
6845 }
6846 return retval;
6847}
6848
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006849GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006850{
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 Yangf000ab42017-01-11 18:31:38 -08006864 int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006865 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 Yangf000ab42017-01-11 18:31:38 -08006884 ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006885 abort();
6886 }
6887 }
6888 return retval;
6889}
6890
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006891void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006892{
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 Yangf000ab42017-01-11 18:31:38 -08006906 int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006907 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 Yangf000ab42017-01-11 18:31:38 -08006918void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006919{
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 Yangf000ab42017-01-11 18:31:38 -08006933 int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006934 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 Yangf000ab42017-01-11 18:31:38 -08006943GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006944{
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 Yangf000ab42017-01-11 18:31:38 -08006958 int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006959 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 Yangf000ab42017-01-11 18:31:38 -08006976 ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006977 abort();
6978 }
6979 }
6980 return retval;
6981}
6982
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006983void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006984{
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 Yangd3ae1062017-01-18 11:42:04 -08006991 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
6992 const unsigned int __size_values = (bufSize * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006993 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 Yangf000ab42017-01-11 18:31:38 -08007000 int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007001 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 Yangd3ae1062017-01-18 11:42:04 -08007012 if (length != NULL) {
7013 stream->readback(length, __size_length);
7014 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7015 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007016 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 Yangf000ab42017-01-11 18:31:38 -08007024 ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007025 abort();
7026 }
7027 }
7028}
7029
7030void 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
7058void 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
7083void 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
7117void 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
7146void 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
7179void 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
7208void 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
7237void 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
7266void 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
7308void 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
7333void 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
7357void 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
7396void 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
7424void 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
7450void 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
7474void 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
7498GLboolean 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
7538void 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
7569void 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
7628void 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
7667void 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
7695void 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
7721void 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, &param, 4); ptr += 4;
7742
7743 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7744 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7745
7746}
7747
7748void 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, &param, 4); ptr += 4;
7769
7770 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7771 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7772
7773}
7774
7775void 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
7804void 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
7833void 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
7873void 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
7913GLboolean 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
7953void 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
7992void 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
8020void 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
8046void 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
8071void 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
8111void 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
8151GLboolean 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
8191void 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
8218void 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
8248void 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 Yangd3ae1062017-01-18 11:42:04 -08008256 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008257 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 Yangd3ae1062017-01-18 11:42:04 -08008278 if (length != NULL) {
8279 stream->readback(length, __size_length);
8280 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
8281 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008282 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
8298GLint 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
8341void 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
8380void 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
8420void 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
8460void 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
8502void 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
8536void 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
8566void 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
8609void 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
8644void 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
8685void 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
8718void 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
8761void 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
8796void 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
8829void 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
8869void 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
8894void 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
8919void 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
8958void 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
8986void 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
9011void 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
9051void 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
9097void 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
9122GLboolean 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
9162void 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 Yangd3ae1062017-01-18 11:42:04 -08009189void 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 Yange6556dc2017-01-09 12:04:12 -08009215GLuint 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
9260void 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
9287void 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
9315void 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
9344void 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
9374void 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
9401void 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
9429void 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
9458void 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
9488void 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
9515void 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
9543void 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
9572void 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
9602void 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
9632void 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 Yangd3ae1062017-01-18 11:42:04 -08009640 const unsigned int __size_value = (count * 2 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009641 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
9662void 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 Yangd3ae1062017-01-18 11:42:04 -08009670 const unsigned int __size_value = (count * 3 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009671 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
9692void 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 Yangd3ae1062017-01-18 11:42:04 -08009700 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009701 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
9722void 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
9752void 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 Yangd3ae1062017-01-18 11:42:04 -08009760 const unsigned int __size_value = (count * 2 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009761 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
9782void 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 Yangd3ae1062017-01-18 11:42:04 -08009790 const unsigned int __size_value = (count * 3 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009791 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
9812void 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 Yangd3ae1062017-01-18 11:42:04 -08009820 const unsigned int __size_value = (count * 4 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009821 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
9842void 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
9872void 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 Yangd3ae1062017-01-18 11:42:04 -08009880 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009881 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
9902void 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 Yangd3ae1062017-01-18 11:42:04 -08009910 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009911 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
9932void 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 Yangd3ae1062017-01-18 11:42:04 -08009940 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009941 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
9962void 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
9993void 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
10024void 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
10055void 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
10086void 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
10117void 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
10148void 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
10179void 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
10210void 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
10241void 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
10282void 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
10334GLuint 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
10378GLint 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
10422void 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
10470void 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
10501void 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
10528void 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
10553void 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
10581void 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
10607void 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
10636void 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
10664void 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
10690void 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
10719void 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
10745void 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
10775void 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
10802void 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
10832void 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
10858void 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
10898void 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, &param, 4); ptr += 4;
10919
10920 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10921 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10922
10923}
10924
10925void 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
10965void 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
11006void 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
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010011047} // namespace
David 'Digit' Turner3372af92014-10-29 09:55:08 +010011048
Yahan Zhoub7f09082016-03-10 11:45:02 -080011049gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
keunyoungb85b2752013-03-08 12:28:03 -080011050{
11051 m_stream = stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080011052 m_checksumCalculator = checksumCalculator;
keunyoungb85b2752013-03-08 12:28:03 -080011053
David 'Digit' Turner3afd44b2014-10-30 18:15:04 +010011054 this->glActiveTexture = &glActiveTexture_enc;
11055 this->glAttachShader = &glAttachShader_enc;
11056 this->glBindAttribLocation = &glBindAttribLocation_enc;
11057 this->glBindBuffer = &glBindBuffer_enc;
11058 this->glBindFramebuffer = &glBindFramebuffer_enc;
11059 this->glBindRenderbuffer = &glBindRenderbuffer_enc;
11060 this->glBindTexture = &glBindTexture_enc;
11061 this->glBlendColor = &glBlendColor_enc;
11062 this->glBlendEquation = &glBlendEquation_enc;
11063 this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
11064 this->glBlendFunc = &glBlendFunc_enc;
11065 this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
11066 this->glBufferData = &glBufferData_enc;
11067 this->glBufferSubData = &glBufferSubData_enc;
11068 this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
11069 this->glClear = &glClear_enc;
11070 this->glClearColor = &glClearColor_enc;
11071 this->glClearDepthf = &glClearDepthf_enc;
11072 this->glClearStencil = &glClearStencil_enc;
11073 this->glColorMask = &glColorMask_enc;
11074 this->glCompileShader = &glCompileShader_enc;
11075 this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
11076 this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
11077 this->glCopyTexImage2D = &glCopyTexImage2D_enc;
11078 this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
11079 this->glCreateProgram = &glCreateProgram_enc;
11080 this->glCreateShader = &glCreateShader_enc;
11081 this->glCullFace = &glCullFace_enc;
11082 this->glDeleteBuffers = &glDeleteBuffers_enc;
11083 this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
11084 this->glDeleteProgram = &glDeleteProgram_enc;
11085 this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
11086 this->glDeleteShader = &glDeleteShader_enc;
11087 this->glDeleteTextures = &glDeleteTextures_enc;
11088 this->glDepthFunc = &glDepthFunc_enc;
11089 this->glDepthMask = &glDepthMask_enc;
11090 this->glDepthRangef = &glDepthRangef_enc;
11091 this->glDetachShader = &glDetachShader_enc;
11092 this->glDisable = &glDisable_enc;
11093 this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
11094 this->glDrawArrays = &glDrawArrays_enc;
11095 this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
11096 this->glEnable = &glEnable_enc;
11097 this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
11098 this->glFinish = &glFinish_enc;
11099 this->glFlush = &glFlush_enc;
11100 this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
11101 this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
11102 this->glFrontFace = &glFrontFace_enc;
11103 this->glGenBuffers = &glGenBuffers_enc;
11104 this->glGenerateMipmap = &glGenerateMipmap_enc;
11105 this->glGenFramebuffers = &glGenFramebuffers_enc;
11106 this->glGenRenderbuffers = &glGenRenderbuffers_enc;
11107 this->glGenTextures = &glGenTextures_enc;
11108 this->glGetActiveAttrib = &glGetActiveAttrib_enc;
11109 this->glGetActiveUniform = &glGetActiveUniform_enc;
11110 this->glGetAttachedShaders = &glGetAttachedShaders_enc;
11111 this->glGetAttribLocation = &glGetAttribLocation_enc;
11112 this->glGetBooleanv = &glGetBooleanv_enc;
11113 this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
11114 this->glGetError = &glGetError_enc;
11115 this->glGetFloatv = &glGetFloatv_enc;
11116 this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
11117 this->glGetIntegerv = &glGetIntegerv_enc;
11118 this->glGetProgramiv = &glGetProgramiv_enc;
11119 this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
11120 this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
11121 this->glGetShaderiv = &glGetShaderiv_enc;
11122 this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
11123 this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
11124 this->glGetShaderSource = &glGetShaderSource_enc;
11125 this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
11126 this->glGetTexParameterfv = &glGetTexParameterfv_enc;
11127 this->glGetTexParameteriv = &glGetTexParameteriv_enc;
11128 this->glGetUniformfv = &glGetUniformfv_enc;
11129 this->glGetUniformiv = &glGetUniformiv_enc;
11130 this->glGetUniformLocation = &glGetUniformLocation_enc;
11131 this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
11132 this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
11133 this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
11134 this->glHint = &glHint_enc;
11135 this->glIsBuffer = &glIsBuffer_enc;
11136 this->glIsEnabled = &glIsEnabled_enc;
11137 this->glIsFramebuffer = &glIsFramebuffer_enc;
11138 this->glIsProgram = &glIsProgram_enc;
11139 this->glIsRenderbuffer = &glIsRenderbuffer_enc;
11140 this->glIsShader = &glIsShader_enc;
11141 this->glIsTexture = &glIsTexture_enc;
11142 this->glLineWidth = &glLineWidth_enc;
11143 this->glLinkProgram = &glLinkProgram_enc;
11144 this->glPixelStorei = &glPixelStorei_enc;
11145 this->glPolygonOffset = &glPolygonOffset_enc;
11146 this->glReadPixels = &glReadPixels_enc;
11147 this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
11148 this->glRenderbufferStorage = &glRenderbufferStorage_enc;
11149 this->glSampleCoverage = &glSampleCoverage_enc;
11150 this->glScissor = &glScissor_enc;
11151 this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
11152 this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
11153 this->glStencilFunc = &glStencilFunc_enc;
11154 this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
11155 this->glStencilMask = &glStencilMask_enc;
11156 this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
11157 this->glStencilOp = &glStencilOp_enc;
11158 this->glStencilOpSeparate = &glStencilOpSeparate_enc;
11159 this->glTexImage2D = &glTexImage2D_enc;
11160 this->glTexParameterf = &glTexParameterf_enc;
11161 this->glTexParameterfv = &glTexParameterfv_enc;
11162 this->glTexParameteri = &glTexParameteri_enc;
11163 this->glTexParameteriv = &glTexParameteriv_enc;
11164 this->glTexSubImage2D = &glTexSubImage2D_enc;
11165 this->glUniform1f = &glUniform1f_enc;
11166 this->glUniform1fv = &glUniform1fv_enc;
11167 this->glUniform1i = &glUniform1i_enc;
11168 this->glUniform1iv = &glUniform1iv_enc;
11169 this->glUniform2f = &glUniform2f_enc;
11170 this->glUniform2fv = &glUniform2fv_enc;
11171 this->glUniform2i = &glUniform2i_enc;
11172 this->glUniform2iv = &glUniform2iv_enc;
11173 this->glUniform3f = &glUniform3f_enc;
11174 this->glUniform3fv = &glUniform3fv_enc;
11175 this->glUniform3i = &glUniform3i_enc;
11176 this->glUniform3iv = &glUniform3iv_enc;
11177 this->glUniform4f = &glUniform4f_enc;
11178 this->glUniform4fv = &glUniform4fv_enc;
11179 this->glUniform4i = &glUniform4i_enc;
11180 this->glUniform4iv = &glUniform4iv_enc;
11181 this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
11182 this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
11183 this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
11184 this->glUseProgram = &glUseProgram_enc;
11185 this->glValidateProgram = &glValidateProgram_enc;
11186 this->glVertexAttrib1f = &glVertexAttrib1f_enc;
11187 this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
11188 this->glVertexAttrib2f = &glVertexAttrib2f_enc;
11189 this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
11190 this->glVertexAttrib3f = &glVertexAttrib3f_enc;
11191 this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
11192 this->glVertexAttrib4f = &glVertexAttrib4f_enc;
11193 this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
11194 this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
11195 this->glViewport = &glViewport_enc;
11196 this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
11197 this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
11198 this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
11199 this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
11200 this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
11201 this->glUnmapBufferOES = &glUnmapBufferOES_enc;
11202 this->glTexImage3DOES = &glTexImage3DOES_enc;
11203 this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
11204 this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
11205 this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
11206 this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
11207 this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
11208 this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
11209 this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
11210 this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
11211 this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
11212 this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
11213 this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
11214 this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
11215 this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
11216 this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11217 this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
11218 this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
11219 this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
11220 this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
11221 this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
11222 this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11223 this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
11224 this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
11225 this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
11226 this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
11227 this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
11228 this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
11229 this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
11230 this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
11231 this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
11232 this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
11233 this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
11234 this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
11235 this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
11236 this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
11237 this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
11238 this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
11239 this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
11240 this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
11241 this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
11242 this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
11243 this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
11244 this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
11245 this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
11246 this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
11247 this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
11248 this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
11249 this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
11250 this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
11251 this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
11252 this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
11253 this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
11254 this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
11255 this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
11256 this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
11257 this->glDrawElementsOffset = &glDrawElementsOffset_enc;
11258 this->glDrawElementsData = &glDrawElementsData_enc;
11259 this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
11260 this->glShaderString = &glShaderString_enc;
11261 this->glFinishRoundTrip = &glFinishRoundTrip_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011262 this->glGenVertexArrays = &glGenVertexArrays_enc;
11263 this->glBindVertexArray = &glBindVertexArray_enc;
11264 this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
11265 this->glIsVertexArray = &glIsVertexArray_enc;
11266 this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
11267 this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
11268 this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
11269 this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
11270 this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
11271 this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
11272 this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
11273 this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
11274 this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
11275 this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
11276 this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
11277 this->glBindBufferRange = &glBindBufferRange_enc;
11278 this->glBindBufferBase = &glBindBufferBase_enc;
11279 this->glCopyBufferSubData = &glCopyBufferSubData_enc;
11280 this->glClearBufferiv = &glClearBufferiv_enc;
11281 this->glClearBufferuiv = &glClearBufferuiv_enc;
11282 this->glClearBufferfv = &glClearBufferfv_enc;
11283 this->glClearBufferfi = &glClearBufferfi_enc;
11284 this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
11285 this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
11286 this->glUniformBlockBinding = &glUniformBlockBinding_enc;
11287 this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
11288 this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
11289 this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
11290 this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
11291 this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
11292 this->glUniform1ui = &glUniform1ui_enc;
11293 this->glUniform2ui = &glUniform2ui_enc;
11294 this->glUniform3ui = &glUniform3ui_enc;
11295 this->glUniform4ui = &glUniform4ui_enc;
11296 this->glUniform1uiv = &glUniform1uiv_enc;
11297 this->glUniform2uiv = &glUniform2uiv_enc;
11298 this->glUniform3uiv = &glUniform3uiv_enc;
11299 this->glUniform4uiv = &glUniform4uiv_enc;
11300 this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
11301 this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
11302 this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
11303 this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
11304 this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
11305 this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
11306 this->glGetUniformuiv = &glGetUniformuiv_enc;
11307 this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
11308 this->glVertexAttribI4i = &glVertexAttribI4i_enc;
11309 this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
11310 this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
11311 this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
11312 this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
11313 this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
11314 this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
11315 this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
11316 this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
11317 this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
11318 this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
11319 this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
11320 this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
11321 this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
11322 this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
11323 this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
11324 this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
Lingfeng Yangf000ab42017-01-11 18:31:38 -080011325 this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
11326 this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
11327 this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
11328 this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
11329 this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
11330 this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
11331 this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
11332 this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
11333 this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
11334 this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
11335 this->glIsSyncAEMU = &glIsSyncAEMU_enc;
11336 this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011337 this->glDrawBuffers = &glDrawBuffers_enc;
11338 this->glReadBuffer = &glReadBuffer_enc;
11339 this->glBlitFramebuffer = &glBlitFramebuffer_enc;
11340 this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
11341 this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
11342 this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
11343 this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
11344 this->glTexStorage2D = &glTexStorage2D_enc;
11345 this->glGetInternalformativ = &glGetInternalformativ_enc;
11346 this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
11347 this->glEndTransformFeedback = &glEndTransformFeedback_enc;
11348 this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
11349 this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
11350 this->glBindTransformFeedback = &glBindTransformFeedback_enc;
11351 this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
11352 this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
11353 this->glIsTransformFeedback = &glIsTransformFeedback_enc;
11354 this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
11355 this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
11356 this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
11357 this->glGenSamplers = &glGenSamplers_enc;
11358 this->glDeleteSamplers = &glDeleteSamplers_enc;
11359 this->glBindSampler = &glBindSampler_enc;
11360 this->glSamplerParameterf = &glSamplerParameterf_enc;
11361 this->glSamplerParameteri = &glSamplerParameteri_enc;
11362 this->glSamplerParameterfv = &glSamplerParameterfv_enc;
11363 this->glSamplerParameteriv = &glSamplerParameteriv_enc;
11364 this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
11365 this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
11366 this->glIsSampler = &glIsSampler_enc;
11367 this->glGenQueries = &glGenQueries_enc;
11368 this->glDeleteQueries = &glDeleteQueries_enc;
11369 this->glBeginQuery = &glBeginQuery_enc;
11370 this->glEndQuery = &glEndQuery_enc;
11371 this->glGetQueryiv = &glGetQueryiv_enc;
11372 this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
11373 this->glIsQuery = &glIsQuery_enc;
11374 this->glProgramParameteri = &glProgramParameteri_enc;
11375 this->glProgramBinary = &glProgramBinary_enc;
11376 this->glGetProgramBinary = &glGetProgramBinary_enc;
11377 this->glGetFragDataLocation = &glGetFragDataLocation_enc;
11378 this->glGetInteger64v = &glGetInteger64v_enc;
11379 this->glGetIntegeri_v = &glGetIntegeri_v_enc;
11380 this->glGetInteger64i_v = &glGetInteger64i_v_enc;
11381 this->glTexImage3D = &glTexImage3D_enc;
11382 this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
11383 this->glTexStorage3D = &glTexStorage3D_enc;
11384 this->glTexSubImage3D = &glTexSubImage3D_enc;
11385 this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
11386 this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
11387 this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
11388 this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
11389 this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
11390 this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
11391 this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
11392 this->glGetBooleani_v = &glGetBooleani_v_enc;
11393 this->glMemoryBarrier = &glMemoryBarrier_enc;
11394 this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
11395 this->glGenProgramPipelines = &glGenProgramPipelines_enc;
11396 this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
11397 this->glBindProgramPipeline = &glBindProgramPipeline_enc;
11398 this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
11399 this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
11400 this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
11401 this->glIsProgramPipeline = &glIsProgramPipeline_enc;
11402 this->glUseProgramStages = &glUseProgramStages_enc;
Lingfeng Yangd3ae1062017-01-18 11:42:04 -080011403 this->glActiveShaderProgram = &glActiveShaderProgram_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011404 this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
11405 this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
11406 this->glProgramUniform1f = &glProgramUniform1f_enc;
11407 this->glProgramUniform2f = &glProgramUniform2f_enc;
11408 this->glProgramUniform3f = &glProgramUniform3f_enc;
11409 this->glProgramUniform4f = &glProgramUniform4f_enc;
11410 this->glProgramUniform1i = &glProgramUniform1i_enc;
11411 this->glProgramUniform2i = &glProgramUniform2i_enc;
11412 this->glProgramUniform3i = &glProgramUniform3i_enc;
11413 this->glProgramUniform4i = &glProgramUniform4i_enc;
11414 this->glProgramUniform1ui = &glProgramUniform1ui_enc;
11415 this->glProgramUniform2ui = &glProgramUniform2ui_enc;
11416 this->glProgramUniform3ui = &glProgramUniform3ui_enc;
11417 this->glProgramUniform4ui = &glProgramUniform4ui_enc;
11418 this->glProgramUniform1fv = &glProgramUniform1fv_enc;
11419 this->glProgramUniform2fv = &glProgramUniform2fv_enc;
11420 this->glProgramUniform3fv = &glProgramUniform3fv_enc;
11421 this->glProgramUniform4fv = &glProgramUniform4fv_enc;
11422 this->glProgramUniform1iv = &glProgramUniform1iv_enc;
11423 this->glProgramUniform2iv = &glProgramUniform2iv_enc;
11424 this->glProgramUniform3iv = &glProgramUniform3iv_enc;
11425 this->glProgramUniform4iv = &glProgramUniform4iv_enc;
11426 this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
11427 this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
11428 this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
11429 this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
11430 this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
11431 this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
11432 this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
11433 this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
11434 this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
11435 this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
11436 this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
11437 this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
11438 this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
11439 this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
11440 this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
11441 this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
11442 this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
11443 this->glGetProgramResourceName = &glGetProgramResourceName_enc;
11444 this->glBindImageTexture = &glBindImageTexture_enc;
11445 this->glDispatchCompute = &glDispatchCompute_enc;
11446 this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
11447 this->glBindVertexBuffer = &glBindVertexBuffer_enc;
11448 this->glVertexAttribBinding = &glVertexAttribBinding_enc;
11449 this->glVertexAttribFormat = &glVertexAttribFormat_enc;
11450 this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
11451 this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
11452 this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
11453 this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
11454 this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
11455 this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
11456 this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
11457 this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
11458 this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
11459 this->glSampleMaski = &glSampleMaski_enc;
11460 this->glGetMultisamplefv = &glGetMultisamplefv_enc;
11461 this->glFramebufferParameteri = &glFramebufferParameteri_enc;
11462 this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
11463 this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
11464 this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
keunyoungb85b2752013-03-08 12:28:03 -080011465}
11466