blob: fb70443abb005ae3e1e88f3788652d9c486aeb04 [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
Lingfeng Yangabc80da2019-01-04 22:53:06 -08003033 stream->readbackPixels(self, width, height, format, type, pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003034 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3035 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003036 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07003037 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003038 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
3039 stream->readback(checksumBufPtr, checksumSize);
3040 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07003041 ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3042 abort();
3043 }
3044 }
keunyoungb85b2752013-03-08 12:28:03 -08003045}
3046
3047void glReleaseShaderCompiler_enc(void *self )
3048{
3049
3050 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3051 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003052 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003053 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003054
3055 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003056 unsigned char *buf;
3057 const size_t sizeWithoutChecksum = 8;
3058 const size_t checksumSize = checksumCalculator->checksumByteSize();
3059 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3060 buf = stream->alloc(totalSize);
3061 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003062 int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003063 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003064
Yahan Zhoub7f09082016-03-10 11:45:02 -08003065
Yahan Zhoue222fd52016-03-16 12:41:08 -07003066 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3067 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3068
keunyoungb85b2752013-03-08 12:28:03 -08003069}
3070
3071void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
3072{
3073
3074 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3075 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003076 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003077 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003078
3079 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003080 unsigned char *buf;
3081 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3082 const size_t checksumSize = checksumCalculator->checksumByteSize();
3083 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3084 buf = stream->alloc(totalSize);
3085 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003086 int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003087 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003088
3089 memcpy(ptr, &target, 4); ptr += 4;
3090 memcpy(ptr, &internalformat, 4); ptr += 4;
3091 memcpy(ptr, &width, 4); ptr += 4;
3092 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003093
Yahan Zhoue222fd52016-03-16 12:41:08 -07003094 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3095 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3096
keunyoungb85b2752013-03-08 12:28:03 -08003097}
3098
3099void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
3100{
3101
3102 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3103 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003104 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003105 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003106
3107 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003108 unsigned char *buf;
3109 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3110 const size_t checksumSize = checksumCalculator->checksumByteSize();
3111 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3112 buf = stream->alloc(totalSize);
3113 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003114 int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003115 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003116
3117 memcpy(ptr, &value, 4); ptr += 4;
3118 memcpy(ptr, &invert, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003119
Yahan Zhoue222fd52016-03-16 12:41:08 -07003120 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3121 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3122
keunyoungb85b2752013-03-08 12:28:03 -08003123}
3124
3125void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3126{
3127
3128 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3129 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003130 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003131 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003132
3133 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003134 unsigned char *buf;
3135 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3136 const size_t checksumSize = checksumCalculator->checksumByteSize();
3137 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3138 buf = stream->alloc(totalSize);
3139 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003140 int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003141 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003142
3143 memcpy(ptr, &x, 4); ptr += 4;
3144 memcpy(ptr, &y, 4); ptr += 4;
3145 memcpy(ptr, &width, 4); ptr += 4;
3146 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003147
Yahan Zhoue222fd52016-03-16 12:41:08 -07003148 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3149 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3150
keunyoungb85b2752013-03-08 12:28:03 -08003151}
3152
3153void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
3154{
3155
3156 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3157 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003158 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003159 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003160
3161 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003162 unsigned char *buf;
3163 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3164 const size_t checksumSize = checksumCalculator->checksumByteSize();
3165 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3166 buf = stream->alloc(totalSize);
3167 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003168 int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003169 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003170
3171 memcpy(ptr, &func, 4); ptr += 4;
3172 memcpy(ptr, &ref, 4); ptr += 4;
3173 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003174
Yahan Zhoue222fd52016-03-16 12:41:08 -07003175 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3176 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3177
keunyoungb85b2752013-03-08 12:28:03 -08003178}
3179
3180void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
3181{
3182
3183 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3184 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003185 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003186 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003187
3188 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003189 unsigned char *buf;
3190 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3191 const size_t checksumSize = checksumCalculator->checksumByteSize();
3192 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3193 buf = stream->alloc(totalSize);
3194 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003195 int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003196 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003197
3198 memcpy(ptr, &face, 4); ptr += 4;
3199 memcpy(ptr, &func, 4); ptr += 4;
3200 memcpy(ptr, &ref, 4); ptr += 4;
3201 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003202
Yahan Zhoue222fd52016-03-16 12:41:08 -07003203 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3204 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3205
keunyoungb85b2752013-03-08 12:28:03 -08003206}
3207
3208void glStencilMask_enc(void *self , GLuint mask)
3209{
3210
3211 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3212 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003213 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003214 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003215
3216 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003217 unsigned char *buf;
3218 const size_t sizeWithoutChecksum = 8 + 4;
3219 const size_t checksumSize = checksumCalculator->checksumByteSize();
3220 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3221 buf = stream->alloc(totalSize);
3222 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003223 int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003224 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003225
3226 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003227
Yahan Zhoue222fd52016-03-16 12:41:08 -07003228 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3229 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3230
keunyoungb85b2752013-03-08 12:28:03 -08003231}
3232
3233void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
3234{
3235
3236 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3237 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003238 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003239 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003240
3241 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003242 unsigned char *buf;
3243 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3244 const size_t checksumSize = checksumCalculator->checksumByteSize();
3245 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3246 buf = stream->alloc(totalSize);
3247 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003248 int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003249 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003250
3251 memcpy(ptr, &face, 4); ptr += 4;
3252 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003253
Yahan Zhoue222fd52016-03-16 12:41:08 -07003254 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3255 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3256
keunyoungb85b2752013-03-08 12:28:03 -08003257}
3258
3259void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
3260{
3261
3262 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3263 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003264 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003265 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003266
3267 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003268 unsigned char *buf;
3269 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3270 const size_t checksumSize = checksumCalculator->checksumByteSize();
3271 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3272 buf = stream->alloc(totalSize);
3273 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003274 int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003275 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003276
3277 memcpy(ptr, &fail, 4); ptr += 4;
3278 memcpy(ptr, &zfail, 4); ptr += 4;
3279 memcpy(ptr, &zpass, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003280
Yahan Zhoue222fd52016-03-16 12:41:08 -07003281 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3282 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3283
keunyoungb85b2752013-03-08 12:28:03 -08003284}
3285
3286void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3287{
3288
3289 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3290 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003291 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003292 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003293
3294 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003295 unsigned char *buf;
3296 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3297 const size_t checksumSize = checksumCalculator->checksumByteSize();
3298 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3299 buf = stream->alloc(totalSize);
3300 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003301 int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003302 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003303
3304 memcpy(ptr, &face, 4); ptr += 4;
3305 memcpy(ptr, &fail, 4); ptr += 4;
3306 memcpy(ptr, &zfail, 4); ptr += 4;
3307 memcpy(ptr, &zpass, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003308
Yahan Zhoue222fd52016-03-16 12:41:08 -07003309 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3310 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3311
keunyoungb85b2752013-03-08 12:28:03 -08003312}
3313
3314void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
3315{
3316
3317 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3318 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003319 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003320 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003321
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003322 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003323 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003324 unsigned char *buf;
3325 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3326 const size_t checksumSize = checksumCalculator->checksumByteSize();
3327 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3328 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3329 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003330 int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003331 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003332
3333 memcpy(ptr, &target, 4); ptr += 4;
3334 memcpy(ptr, &level, 4); ptr += 4;
3335 memcpy(ptr, &internalformat, 4); ptr += 4;
3336 memcpy(ptr, &width, 4); ptr += 4;
3337 memcpy(ptr, &height, 4); ptr += 4;
3338 memcpy(ptr, &border, 4); ptr += 4;
3339 memcpy(ptr, &format, 4); ptr += 4;
3340 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003341
Yahan Zhoue222fd52016-03-16 12:41:08 -07003342 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003343 stream->flush();
3344 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003345 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003346 if (pixels != NULL) {
Lingfeng Yang454ebdd2020-04-07 17:17:24 -07003347 stream->uploadPixels(self, width, height, format, type, pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003348 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003349 }
3350 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003351 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3352
keunyoungb85b2752013-03-08 12:28:03 -08003353}
3354
3355void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
3356{
3357
3358 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3359 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003360 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003361 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003362
3363 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003364 unsigned char *buf;
3365 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3366 const size_t checksumSize = checksumCalculator->checksumByteSize();
3367 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3368 buf = stream->alloc(totalSize);
3369 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003370 int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003371 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003372
3373 memcpy(ptr, &target, 4); ptr += 4;
3374 memcpy(ptr, &pname, 4); ptr += 4;
3375 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003376
Yahan Zhoue222fd52016-03-16 12:41:08 -07003377 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3378 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3379
keunyoungb85b2752013-03-08 12:28:03 -08003380}
3381
3382void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
3383{
3384
3385 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3386 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003387 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003388 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003389
3390 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
3391 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003392 unsigned char *buf;
3393 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3394 const size_t checksumSize = checksumCalculator->checksumByteSize();
3395 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3396 buf = stream->alloc(totalSize);
3397 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003398 int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003399 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003400
3401 memcpy(ptr, &target, 4); ptr += 4;
3402 memcpy(ptr, &pname, 4); ptr += 4;
3403 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3404 memcpy(ptr, params, __size_params);ptr += __size_params;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003405
Yahan Zhoue222fd52016-03-16 12:41:08 -07003406 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3407 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3408
keunyoungb85b2752013-03-08 12:28:03 -08003409}
3410
3411void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
3412{
3413
3414 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3415 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003416 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003417 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003418
3419 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003420 unsigned char *buf;
3421 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3422 const size_t checksumSize = checksumCalculator->checksumByteSize();
3423 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3424 buf = stream->alloc(totalSize);
3425 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003426 int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003427 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003428
3429 memcpy(ptr, &target, 4); ptr += 4;
3430 memcpy(ptr, &pname, 4); ptr += 4;
3431 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003432
Yahan Zhoue222fd52016-03-16 12:41:08 -07003433 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3434 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3435
keunyoungb85b2752013-03-08 12:28:03 -08003436}
3437
3438void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3439{
3440
3441 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3442 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003443 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003444 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003445
3446 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
3447 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003448 unsigned char *buf;
3449 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3450 const size_t checksumSize = checksumCalculator->checksumByteSize();
3451 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3452 buf = stream->alloc(totalSize);
3453 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003454 int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003455 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003456
3457 memcpy(ptr, &target, 4); ptr += 4;
3458 memcpy(ptr, &pname, 4); ptr += 4;
3459 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3460 memcpy(ptr, params, __size_params);ptr += __size_params;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003461
Yahan Zhoue222fd52016-03-16 12:41:08 -07003462 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3463 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3464
keunyoungb85b2752013-03-08 12:28:03 -08003465}
3466
3467void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
3468{
3469
3470 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3471 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003472 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003473 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003474
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003475 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003476 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003477 unsigned char *buf;
3478 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3479 const size_t checksumSize = checksumCalculator->checksumByteSize();
3480 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3481 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3482 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003483 int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003484 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003485
3486 memcpy(ptr, &target, 4); ptr += 4;
3487 memcpy(ptr, &level, 4); ptr += 4;
3488 memcpy(ptr, &xoffset, 4); ptr += 4;
3489 memcpy(ptr, &yoffset, 4); ptr += 4;
3490 memcpy(ptr, &width, 4); ptr += 4;
3491 memcpy(ptr, &height, 4); ptr += 4;
3492 memcpy(ptr, &format, 4); ptr += 4;
3493 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003494
Yahan Zhoue222fd52016-03-16 12:41:08 -07003495 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003496 stream->flush();
3497 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003498 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003499 if (pixels != NULL) {
Lingfeng Yang454ebdd2020-04-07 17:17:24 -07003500 stream->uploadPixels(self, width, height, format, type, pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003501 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003502 }
3503 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003504 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3505
keunyoungb85b2752013-03-08 12:28:03 -08003506}
3507
3508void glUniform1f_enc(void *self , GLint location, GLfloat x)
3509{
3510
3511 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3512 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003513 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003514 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003515
3516 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003517 unsigned char *buf;
3518 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3519 const size_t checksumSize = checksumCalculator->checksumByteSize();
3520 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3521 buf = stream->alloc(totalSize);
3522 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003523 int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003524 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003525
3526 memcpy(ptr, &location, 4); ptr += 4;
3527 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003528
Yahan Zhoue222fd52016-03-16 12:41:08 -07003529 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3530 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3531
keunyoungb85b2752013-03-08 12:28:03 -08003532}
3533
3534void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3535{
3536
3537 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3538 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003539 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003540 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003541
3542 const unsigned int __size_v = (count * sizeof(GLfloat));
3543 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003544 unsigned char *buf;
3545 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3546 const size_t checksumSize = checksumCalculator->checksumByteSize();
3547 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3548 buf = stream->alloc(totalSize);
3549 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003550 int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003551 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003552
3553 memcpy(ptr, &location, 4); ptr += 4;
3554 memcpy(ptr, &count, 4); ptr += 4;
3555 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3556 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003557
Yahan Zhoue222fd52016-03-16 12:41:08 -07003558 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3559 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3560
keunyoungb85b2752013-03-08 12:28:03 -08003561}
3562
3563void glUniform1i_enc(void *self , GLint location, GLint x)
3564{
3565
3566 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3567 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003568 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003569 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003570
3571 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003572 unsigned char *buf;
3573 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3574 const size_t checksumSize = checksumCalculator->checksumByteSize();
3575 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3576 buf = stream->alloc(totalSize);
3577 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003578 int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003579 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003580
3581 memcpy(ptr, &location, 4); ptr += 4;
3582 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003583
Yahan Zhoue222fd52016-03-16 12:41:08 -07003584 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3585 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3586
keunyoungb85b2752013-03-08 12:28:03 -08003587}
3588
3589void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3590{
3591
3592 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3593 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003594 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003595 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003596
3597 const unsigned int __size_v = (count * sizeof(GLint));
3598 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003599 unsigned char *buf;
3600 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3601 const size_t checksumSize = checksumCalculator->checksumByteSize();
3602 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3603 buf = stream->alloc(totalSize);
3604 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003605 int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003606 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003607
3608 memcpy(ptr, &location, 4); ptr += 4;
3609 memcpy(ptr, &count, 4); ptr += 4;
3610 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3611 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003612
Yahan Zhoue222fd52016-03-16 12:41:08 -07003613 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3614 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3615
keunyoungb85b2752013-03-08 12:28:03 -08003616}
3617
3618void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
3619{
3620
3621 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3622 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003623 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003624 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003625
3626 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003627 unsigned char *buf;
3628 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3629 const size_t checksumSize = checksumCalculator->checksumByteSize();
3630 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3631 buf = stream->alloc(totalSize);
3632 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003633 int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003634 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003635
3636 memcpy(ptr, &location, 4); ptr += 4;
3637 memcpy(ptr, &x, 4); ptr += 4;
3638 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003639
Yahan Zhoue222fd52016-03-16 12:41:08 -07003640 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3641 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3642
keunyoungb85b2752013-03-08 12:28:03 -08003643}
3644
3645void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3646{
3647
3648 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3649 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003650 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003651 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003652
3653 const unsigned int __size_v = (count * 2 * sizeof(GLfloat));
3654 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003655 unsigned char *buf;
3656 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3657 const size_t checksumSize = checksumCalculator->checksumByteSize();
3658 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3659 buf = stream->alloc(totalSize);
3660 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003661 int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003662 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003663
3664 memcpy(ptr, &location, 4); ptr += 4;
3665 memcpy(ptr, &count, 4); ptr += 4;
3666 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3667 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003668
Yahan Zhoue222fd52016-03-16 12:41:08 -07003669 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3670 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3671
keunyoungb85b2752013-03-08 12:28:03 -08003672}
3673
3674void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
3675{
3676
3677 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3678 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003679 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003680 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003681
3682 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003683 unsigned char *buf;
3684 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3685 const size_t checksumSize = checksumCalculator->checksumByteSize();
3686 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3687 buf = stream->alloc(totalSize);
3688 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003689 int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003690 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003691
3692 memcpy(ptr, &location, 4); ptr += 4;
3693 memcpy(ptr, &x, 4); ptr += 4;
3694 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003695
Yahan Zhoue222fd52016-03-16 12:41:08 -07003696 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3697 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3698
keunyoungb85b2752013-03-08 12:28:03 -08003699}
3700
3701void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3702{
3703
3704 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3705 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003706 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003707 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003708
3709 const unsigned int __size_v = (count * 2 * sizeof(GLint));
3710 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003711 unsigned char *buf;
3712 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3713 const size_t checksumSize = checksumCalculator->checksumByteSize();
3714 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3715 buf = stream->alloc(totalSize);
3716 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003717 int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003718 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003719
3720 memcpy(ptr, &location, 4); ptr += 4;
3721 memcpy(ptr, &count, 4); ptr += 4;
3722 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3723 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003724
Yahan Zhoue222fd52016-03-16 12:41:08 -07003725 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3726 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3727
keunyoungb85b2752013-03-08 12:28:03 -08003728}
3729
3730void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
3731{
3732
3733 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3734 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003735 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003736 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003737
3738 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003739 unsigned char *buf;
3740 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3741 const size_t checksumSize = checksumCalculator->checksumByteSize();
3742 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3743 buf = stream->alloc(totalSize);
3744 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003745 int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003746 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003747
3748 memcpy(ptr, &location, 4); ptr += 4;
3749 memcpy(ptr, &x, 4); ptr += 4;
3750 memcpy(ptr, &y, 4); ptr += 4;
3751 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003752
Yahan Zhoue222fd52016-03-16 12:41:08 -07003753 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3754 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3755
keunyoungb85b2752013-03-08 12:28:03 -08003756}
3757
3758void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3759{
3760
3761 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3762 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003763 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003764 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003765
3766 const unsigned int __size_v = (count * 3 * sizeof(GLfloat));
3767 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003768 unsigned char *buf;
3769 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3770 const size_t checksumSize = checksumCalculator->checksumByteSize();
3771 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3772 buf = stream->alloc(totalSize);
3773 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003774 int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003775 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003776
3777 memcpy(ptr, &location, 4); ptr += 4;
3778 memcpy(ptr, &count, 4); ptr += 4;
3779 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3780 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003781
Yahan Zhoue222fd52016-03-16 12:41:08 -07003782 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3783 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3784
keunyoungb85b2752013-03-08 12:28:03 -08003785}
3786
3787void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
3788{
3789
3790 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3791 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003792 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003793 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003794
3795 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003796 unsigned char *buf;
3797 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3798 const size_t checksumSize = checksumCalculator->checksumByteSize();
3799 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3800 buf = stream->alloc(totalSize);
3801 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003802 int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003803 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003804
3805 memcpy(ptr, &location, 4); ptr += 4;
3806 memcpy(ptr, &x, 4); ptr += 4;
3807 memcpy(ptr, &y, 4); ptr += 4;
3808 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003809
Yahan Zhoue222fd52016-03-16 12:41:08 -07003810 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3811 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3812
keunyoungb85b2752013-03-08 12:28:03 -08003813}
3814
3815void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3816{
3817
3818 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3819 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003820 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003821 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003822
3823 const unsigned int __size_v = (3 * count * sizeof(GLint));
3824 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003825 unsigned char *buf;
3826 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3827 const size_t checksumSize = checksumCalculator->checksumByteSize();
3828 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3829 buf = stream->alloc(totalSize);
3830 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003831 int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003832 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003833
3834 memcpy(ptr, &location, 4); ptr += 4;
3835 memcpy(ptr, &count, 4); ptr += 4;
3836 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3837 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003838
Yahan Zhoue222fd52016-03-16 12:41:08 -07003839 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3840 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3841
keunyoungb85b2752013-03-08 12:28:03 -08003842}
3843
3844void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3845{
3846
3847 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3848 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003849 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003850 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003851
3852 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003853 unsigned char *buf;
3854 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3855 const size_t checksumSize = checksumCalculator->checksumByteSize();
3856 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3857 buf = stream->alloc(totalSize);
3858 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003859 int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003860 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003861
3862 memcpy(ptr, &location, 4); ptr += 4;
3863 memcpy(ptr, &x, 4); ptr += 4;
3864 memcpy(ptr, &y, 4); ptr += 4;
3865 memcpy(ptr, &z, 4); ptr += 4;
3866 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003867
Yahan Zhoue222fd52016-03-16 12:41:08 -07003868 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3869 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3870
keunyoungb85b2752013-03-08 12:28:03 -08003871}
3872
3873void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3874{
3875
3876 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3877 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003878 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003879 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003880
3881 const unsigned int __size_v = (4 * count * sizeof(GLfloat));
3882 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003883 unsigned char *buf;
3884 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3885 const size_t checksumSize = checksumCalculator->checksumByteSize();
3886 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3887 buf = stream->alloc(totalSize);
3888 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003889 int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003890 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003891
3892 memcpy(ptr, &location, 4); ptr += 4;
3893 memcpy(ptr, &count, 4); ptr += 4;
3894 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3895 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003896
Yahan Zhoue222fd52016-03-16 12:41:08 -07003897 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3898 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3899
keunyoungb85b2752013-03-08 12:28:03 -08003900}
3901
3902void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
3903{
3904
3905 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3906 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003907 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003908 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003909
3910 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003911 unsigned char *buf;
3912 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3913 const size_t checksumSize = checksumCalculator->checksumByteSize();
3914 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3915 buf = stream->alloc(totalSize);
3916 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003917 int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003918 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003919
3920 memcpy(ptr, &location, 4); ptr += 4;
3921 memcpy(ptr, &x, 4); ptr += 4;
3922 memcpy(ptr, &y, 4); ptr += 4;
3923 memcpy(ptr, &z, 4); ptr += 4;
3924 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003925
Yahan Zhoue222fd52016-03-16 12:41:08 -07003926 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3927 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3928
keunyoungb85b2752013-03-08 12:28:03 -08003929}
3930
3931void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3932{
3933
3934 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3935 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003936 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003937 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003938
3939 const unsigned int __size_v = (4 * count * sizeof(GLint));
3940 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003941 unsigned char *buf;
3942 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3943 const size_t checksumSize = checksumCalculator->checksumByteSize();
3944 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3945 buf = stream->alloc(totalSize);
3946 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003947 int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003948 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003949
3950 memcpy(ptr, &location, 4); ptr += 4;
3951 memcpy(ptr, &count, 4); ptr += 4;
3952 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3953 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003954
Yahan Zhoue222fd52016-03-16 12:41:08 -07003955 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3956 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3957
keunyoungb85b2752013-03-08 12:28:03 -08003958}
3959
3960void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3961{
3962
3963 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3964 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003965 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003966 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003967
3968 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
3969 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003970 unsigned char *buf;
3971 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
3972 const size_t checksumSize = checksumCalculator->checksumByteSize();
3973 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3974 buf = stream->alloc(totalSize);
3975 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003976 int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003977 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003978
3979 memcpy(ptr, &location, 4); ptr += 4;
3980 memcpy(ptr, &count, 4); ptr += 4;
3981 memcpy(ptr, &transpose, 1); ptr += 1;
3982 *(unsigned int *)(ptr) = __size_value; ptr += 4;
3983 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003984
Yahan Zhoue222fd52016-03-16 12:41:08 -07003985 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3986 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3987
keunyoungb85b2752013-03-08 12:28:03 -08003988}
3989
3990void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3991{
3992
3993 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3994 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003995 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003996 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003997
3998 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
3999 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004000 unsigned char *buf;
4001 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4002 const size_t checksumSize = checksumCalculator->checksumByteSize();
4003 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4004 buf = stream->alloc(totalSize);
4005 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004006 int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004007 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004008
4009 memcpy(ptr, &location, 4); ptr += 4;
4010 memcpy(ptr, &count, 4); ptr += 4;
4011 memcpy(ptr, &transpose, 1); ptr += 1;
4012 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4013 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004014
Yahan Zhoue222fd52016-03-16 12:41:08 -07004015 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4016 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4017
keunyoungb85b2752013-03-08 12:28:03 -08004018}
4019
4020void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
4021{
4022
4023 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4024 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004026 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004027
4028 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
4029 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004030 unsigned char *buf;
4031 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4032 const size_t checksumSize = checksumCalculator->checksumByteSize();
4033 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4034 buf = stream->alloc(totalSize);
4035 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004036 int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004037 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004038
4039 memcpy(ptr, &location, 4); ptr += 4;
4040 memcpy(ptr, &count, 4); ptr += 4;
4041 memcpy(ptr, &transpose, 1); ptr += 1;
4042 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4043 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004044
Yahan Zhoue222fd52016-03-16 12:41:08 -07004045 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4046 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4047
keunyoungb85b2752013-03-08 12:28:03 -08004048}
4049
4050void glUseProgram_enc(void *self , GLuint program)
4051{
4052
4053 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4054 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004055 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004056 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004057
4058 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004059 unsigned char *buf;
4060 const size_t sizeWithoutChecksum = 8 + 4;
4061 const size_t checksumSize = checksumCalculator->checksumByteSize();
4062 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4063 buf = stream->alloc(totalSize);
4064 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004065 int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004066 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004067
4068 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004069
Yahan Zhoue222fd52016-03-16 12:41:08 -07004070 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4071 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4072
keunyoungb85b2752013-03-08 12:28:03 -08004073}
4074
4075void glValidateProgram_enc(void *self , GLuint program)
4076{
4077
4078 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4079 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004080 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004081 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004082
4083 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004084 unsigned char *buf;
4085 const size_t sizeWithoutChecksum = 8 + 4;
4086 const size_t checksumSize = checksumCalculator->checksumByteSize();
4087 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4088 buf = stream->alloc(totalSize);
4089 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004090 int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004091 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004092
4093 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004094
Yahan Zhoue222fd52016-03-16 12:41:08 -07004095 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4096 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4097
keunyoungb85b2752013-03-08 12:28:03 -08004098}
4099
4100void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
4101{
4102
4103 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4104 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004105 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004106 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004107
4108 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004109 unsigned char *buf;
4110 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4111 const size_t checksumSize = checksumCalculator->checksumByteSize();
4112 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4113 buf = stream->alloc(totalSize);
4114 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004115 int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004116 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004117
4118 memcpy(ptr, &indx, 4); ptr += 4;
4119 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004120
Yahan Zhoue222fd52016-03-16 12:41:08 -07004121 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4122 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4123
keunyoungb85b2752013-03-08 12:28:03 -08004124}
4125
4126void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
4127{
4128
4129 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4130 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004131 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004132 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004133
4134 const unsigned int __size_values = (sizeof(GLfloat));
4135 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004136 unsigned char *buf;
4137 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4138 const size_t checksumSize = checksumCalculator->checksumByteSize();
4139 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4140 buf = stream->alloc(totalSize);
4141 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004142 int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004143 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004144
4145 memcpy(ptr, &indx, 4); ptr += 4;
4146 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4147 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004148
Yahan Zhoue222fd52016-03-16 12:41:08 -07004149 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4150 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4151
keunyoungb85b2752013-03-08 12:28:03 -08004152}
4153
4154void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
4155{
4156
4157 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4158 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004159 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004160 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004161
4162 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004163 unsigned char *buf;
4164 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4165 const size_t checksumSize = checksumCalculator->checksumByteSize();
4166 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4167 buf = stream->alloc(totalSize);
4168 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004169 int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004170 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004171
4172 memcpy(ptr, &indx, 4); ptr += 4;
4173 memcpy(ptr, &x, 4); ptr += 4;
4174 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004175
Yahan Zhoue222fd52016-03-16 12:41:08 -07004176 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4177 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4178
keunyoungb85b2752013-03-08 12:28:03 -08004179}
4180
4181void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
4182{
4183
4184 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4185 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004186 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004187 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004188
4189 const unsigned int __size_values = (2 * sizeof(GLfloat));
4190 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004191 unsigned char *buf;
4192 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4193 const size_t checksumSize = checksumCalculator->checksumByteSize();
4194 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4195 buf = stream->alloc(totalSize);
4196 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004197 int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004198 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004199
4200 memcpy(ptr, &indx, 4); ptr += 4;
4201 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4202 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004203
Yahan Zhoue222fd52016-03-16 12:41:08 -07004204 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4205 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4206
keunyoungb85b2752013-03-08 12:28:03 -08004207}
4208
4209void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
4210{
4211
4212 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4213 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004214 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004215 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004216
4217 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004218 unsigned char *buf;
4219 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4220 const size_t checksumSize = checksumCalculator->checksumByteSize();
4221 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4222 buf = stream->alloc(totalSize);
4223 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004224 int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004225 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004226
4227 memcpy(ptr, &indx, 4); ptr += 4;
4228 memcpy(ptr, &x, 4); ptr += 4;
4229 memcpy(ptr, &y, 4); ptr += 4;
4230 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004231
Yahan Zhoue222fd52016-03-16 12:41:08 -07004232 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4233 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4234
keunyoungb85b2752013-03-08 12:28:03 -08004235}
4236
4237void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
4238{
4239
4240 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4241 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004242 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004243 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004244
4245 const unsigned int __size_values = (3 * sizeof(GLfloat));
4246 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004247 unsigned char *buf;
4248 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4249 const size_t checksumSize = checksumCalculator->checksumByteSize();
4250 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4251 buf = stream->alloc(totalSize);
4252 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004253 int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004254 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004255
4256 memcpy(ptr, &indx, 4); ptr += 4;
4257 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4258 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004259
Yahan Zhoue222fd52016-03-16 12:41:08 -07004260 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4261 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4262
keunyoungb85b2752013-03-08 12:28:03 -08004263}
4264
4265void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4266{
4267
4268 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4269 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004270 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004271 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004272
4273 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004274 unsigned char *buf;
4275 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4276 const size_t checksumSize = checksumCalculator->checksumByteSize();
4277 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4278 buf = stream->alloc(totalSize);
4279 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004280 int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004281 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004282
4283 memcpy(ptr, &indx, 4); ptr += 4;
4284 memcpy(ptr, &x, 4); ptr += 4;
4285 memcpy(ptr, &y, 4); ptr += 4;
4286 memcpy(ptr, &z, 4); ptr += 4;
4287 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004288
Yahan Zhoue222fd52016-03-16 12:41:08 -07004289 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4290 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4291
keunyoungb85b2752013-03-08 12:28:03 -08004292}
4293
4294void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
4295{
4296
4297 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4298 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004299 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004300 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004301
4302 const unsigned int __size_values = (4 * sizeof(GLfloat));
4303 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004304 unsigned char *buf;
4305 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4306 const size_t checksumSize = checksumCalculator->checksumByteSize();
4307 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4308 buf = stream->alloc(totalSize);
4309 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004310 int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004311 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004312
4313 memcpy(ptr, &indx, 4); ptr += 4;
4314 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4315 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004316
Yahan Zhoue222fd52016-03-16 12:41:08 -07004317 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4318 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4319
keunyoungb85b2752013-03-08 12:28:03 -08004320}
4321
4322void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
4323{
4324
4325 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4326 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004327 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004328 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004329
4330 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004331 unsigned char *buf;
4332 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4333 const size_t checksumSize = checksumCalculator->checksumByteSize();
4334 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4335 buf = stream->alloc(totalSize);
4336 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004337 int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004338 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004339
4340 memcpy(ptr, &x, 4); ptr += 4;
4341 memcpy(ptr, &y, 4); ptr += 4;
4342 memcpy(ptr, &width, 4); ptr += 4;
4343 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004344
Yahan Zhoue222fd52016-03-16 12:41:08 -07004345 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4346 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4347
keunyoungb85b2752013-03-08 12:28:03 -08004348}
4349
4350void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
4351{
4352
4353 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4354 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004355 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004356 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004357
4358 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004359 unsigned char *buf;
4360 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4361 const size_t checksumSize = checksumCalculator->checksumByteSize();
4362 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4363 buf = stream->alloc(totalSize);
4364 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004365 int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004366 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004367
4368 memcpy(ptr, &target, 4); ptr += 4;
4369 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004370
Yahan Zhoue222fd52016-03-16 12:41:08 -07004371 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4372 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4373
keunyoungb85b2752013-03-08 12:28:03 -08004374}
4375
4376void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
4377{
4378
4379 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4380 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004381 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004382 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004383
4384 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004385 unsigned char *buf;
4386 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4387 const size_t checksumSize = checksumCalculator->checksumByteSize();
4388 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4389 buf = stream->alloc(totalSize);
4390 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004391 int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004392 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004393
4394 memcpy(ptr, &target, 4); ptr += 4;
4395 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004396
Yahan Zhoue222fd52016-03-16 12:41:08 -07004397 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4398 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4399
keunyoungb85b2752013-03-08 12:28:03 -08004400}
4401
4402GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
4403{
4404
4405 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4406 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004407 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004408 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004409
4410 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004411 unsigned char *buf;
4412 const size_t sizeWithoutChecksum = 8 + 4;
4413 const size_t checksumSize = checksumCalculator->checksumByteSize();
4414 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4415 buf = stream->alloc(totalSize);
4416 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004417 int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004418 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004419
4420 memcpy(ptr, &target, 4); ptr += 4;
4421
Yahan Zhoue222fd52016-03-16 12:41:08 -07004422 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4423 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4424
Yahan Zhoub7f09082016-03-10 11:45:02 -08004425
keunyoungb85b2752013-03-08 12:28:03 -08004426 GLboolean retval;
4427 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004428 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4429 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004430 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004431 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004432 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4433 stream->readback(checksumBufPtr, checksumSize);
4434 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004435 ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
4436 abort();
4437 }
4438 }
keunyoungb85b2752013-03-08 12:28:03 -08004439 return retval;
4440}
4441
4442void 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)
4443{
4444
4445 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4446 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004447 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004448 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004449
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01004450 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004451 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004452 unsigned char *buf;
4453 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4454 const size_t checksumSize = checksumCalculator->checksumByteSize();
4455 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4456 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4457 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004458 int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004459 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004460
4461 memcpy(ptr, &target, 4); ptr += 4;
4462 memcpy(ptr, &level, 4); ptr += 4;
4463 memcpy(ptr, &internalformat, 4); ptr += 4;
4464 memcpy(ptr, &width, 4); ptr += 4;
4465 memcpy(ptr, &height, 4); ptr += 4;
4466 memcpy(ptr, &depth, 4); ptr += 4;
4467 memcpy(ptr, &border, 4); ptr += 4;
4468 memcpy(ptr, &format, 4); ptr += 4;
4469 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004470
Yahan Zhoue222fd52016-03-16 12:41:08 -07004471 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004472 stream->flush();
4473 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004474 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004475 if (pixels != NULL) {
4476 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004477 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004478 }
4479 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004480 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4481
keunyoungb85b2752013-03-08 12:28:03 -08004482}
4483
4484void 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)
4485{
4486
4487 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4488 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004489 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004490 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004491
Yahan Zhou268e85c2016-02-19 13:59:34 -08004492 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004493 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004494 unsigned char *buf;
4495 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4496 const size_t checksumSize = checksumCalculator->checksumByteSize();
4497 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4498 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4499 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004500 int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004501 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004502
4503 memcpy(ptr, &target, 4); ptr += 4;
4504 memcpy(ptr, &level, 4); ptr += 4;
4505 memcpy(ptr, &xoffset, 4); ptr += 4;
4506 memcpy(ptr, &yoffset, 4); ptr += 4;
4507 memcpy(ptr, &zoffset, 4); ptr += 4;
4508 memcpy(ptr, &width, 4); ptr += 4;
4509 memcpy(ptr, &height, 4); ptr += 4;
4510 memcpy(ptr, &depth, 4); ptr += 4;
4511 memcpy(ptr, &format, 4); ptr += 4;
4512 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004513
Yahan Zhoue222fd52016-03-16 12:41:08 -07004514 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004515 stream->flush();
4516 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004517 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004518 if (pixels != NULL) {
4519 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004520 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004521 }
4522 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004523 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4524
keunyoungb85b2752013-03-08 12:28:03 -08004525}
4526
4527void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
4528{
4529
4530 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4531 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004532 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004533 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004534
4535 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004536 unsigned char *buf;
4537 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
4538 const size_t checksumSize = checksumCalculator->checksumByteSize();
4539 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4540 buf = stream->alloc(totalSize);
4541 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004542 int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004543 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004544
4545 memcpy(ptr, &target, 4); ptr += 4;
4546 memcpy(ptr, &level, 4); ptr += 4;
4547 memcpy(ptr, &xoffset, 4); ptr += 4;
4548 memcpy(ptr, &yoffset, 4); ptr += 4;
4549 memcpy(ptr, &zoffset, 4); ptr += 4;
4550 memcpy(ptr, &x, 4); ptr += 4;
4551 memcpy(ptr, &y, 4); ptr += 4;
4552 memcpy(ptr, &width, 4); ptr += 4;
4553 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004554
Yahan Zhoue222fd52016-03-16 12:41:08 -07004555 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4556 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4557
keunyoungb85b2752013-03-08 12:28:03 -08004558}
4559
4560void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
4561{
4562
4563 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4564 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004565 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004566 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004567
Yahan Zhou268e85c2016-02-19 13:59:34 -08004568 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004569 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004570 unsigned char *buf;
4571 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4572 const size_t checksumSize = checksumCalculator->checksumByteSize();
4573 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4574 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4575 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004576 int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004577 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004578
4579 memcpy(ptr, &target, 4); ptr += 4;
4580 memcpy(ptr, &level, 4); ptr += 4;
4581 memcpy(ptr, &internalformat, 4); ptr += 4;
4582 memcpy(ptr, &width, 4); ptr += 4;
4583 memcpy(ptr, &height, 4); ptr += 4;
4584 memcpy(ptr, &depth, 4); ptr += 4;
4585 memcpy(ptr, &border, 4); ptr += 4;
4586 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004587
Yahan Zhoue222fd52016-03-16 12:41:08 -07004588 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004589 stream->flush();
4590 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004591 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004592 if (data != NULL) {
4593 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004594 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004595 }
4596 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004597 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4598
keunyoungb85b2752013-03-08 12:28:03 -08004599}
4600
4601void 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)
4602{
4603
4604 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4605 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004606 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004607 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004608
Yahan Zhou268e85c2016-02-19 13:59:34 -08004609 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004610 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004611 unsigned char *buf;
4612 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4613 const size_t checksumSize = checksumCalculator->checksumByteSize();
4614 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4615 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4616 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004617 int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004618 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004619
4620 memcpy(ptr, &target, 4); ptr += 4;
4621 memcpy(ptr, &level, 4); ptr += 4;
4622 memcpy(ptr, &xoffset, 4); ptr += 4;
4623 memcpy(ptr, &yoffset, 4); ptr += 4;
4624 memcpy(ptr, &zoffset, 4); ptr += 4;
4625 memcpy(ptr, &width, 4); ptr += 4;
4626 memcpy(ptr, &height, 4); ptr += 4;
4627 memcpy(ptr, &depth, 4); ptr += 4;
4628 memcpy(ptr, &format, 4); ptr += 4;
4629 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004630
Yahan Zhoue222fd52016-03-16 12:41:08 -07004631 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004632 stream->flush();
4633 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004634 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004635 if (data != NULL) {
4636 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004637 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004638 }
4639 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004640 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4641
keunyoungb85b2752013-03-08 12:28:03 -08004642}
4643
4644void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
4645{
4646
4647 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4648 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004649 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004650 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004651
4652 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004653 unsigned char *buf;
4654 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
4655 const size_t checksumSize = checksumCalculator->checksumByteSize();
4656 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4657 buf = stream->alloc(totalSize);
4658 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004659 int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004660 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004661
4662 memcpy(ptr, &target, 4); ptr += 4;
4663 memcpy(ptr, &attachment, 4); ptr += 4;
4664 memcpy(ptr, &textarget, 4); ptr += 4;
4665 memcpy(ptr, &texture, 4); ptr += 4;
4666 memcpy(ptr, &level, 4); ptr += 4;
4667 memcpy(ptr, &zoffset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004668
Yahan Zhoue222fd52016-03-16 12:41:08 -07004669 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4670 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4671
keunyoungb85b2752013-03-08 12:28:03 -08004672}
4673
4674void glBindVertexArrayOES_enc(void *self , GLuint array)
4675{
4676
4677 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4678 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004679 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004680 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004681
4682 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004683 unsigned char *buf;
4684 const size_t sizeWithoutChecksum = 8 + 4;
4685 const size_t checksumSize = checksumCalculator->checksumByteSize();
4686 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4687 buf = stream->alloc(totalSize);
4688 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004689 int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004690 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004691
4692 memcpy(ptr, &array, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004693
Yahan Zhoue222fd52016-03-16 12:41:08 -07004694 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4695 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4696
keunyoungb85b2752013-03-08 12:28:03 -08004697}
4698
4699void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
4700{
4701
4702 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4703 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004704 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004705 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004706
4707 const unsigned int __size_arrays = (n * sizeof(GLuint));
4708 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004709 unsigned char *buf;
4710 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
4711 const size_t checksumSize = checksumCalculator->checksumByteSize();
4712 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4713 buf = stream->alloc(totalSize);
4714 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004715 int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004716 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004717
4718 memcpy(ptr, &n, 4); ptr += 4;
4719 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4720 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004721
Yahan Zhoue222fd52016-03-16 12:41:08 -07004722 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4723 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4724
keunyoungb85b2752013-03-08 12:28:03 -08004725}
4726
4727void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
4728{
4729
4730 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4731 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004732 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004733 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004734
4735 const unsigned int __size_arrays = (n * sizeof(GLuint));
4736 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004737 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004738 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004739 const size_t checksumSize = checksumCalculator->checksumByteSize();
4740 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4741 buf = stream->alloc(totalSize);
4742 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004743 int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004744 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004745
4746 memcpy(ptr, &n, 4); ptr += 4;
4747 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004748
Yahan Zhoue222fd52016-03-16 12:41:08 -07004749 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4750 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4751
keunyoungb85b2752013-03-08 12:28:03 -08004752 stream->readback(arrays, __size_arrays);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004753 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
4754 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004755 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004756 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004757 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4758 stream->readback(checksumBufPtr, checksumSize);
4759 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004760 ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
4761 abort();
4762 }
4763 }
keunyoungb85b2752013-03-08 12:28:03 -08004764}
4765
4766GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
4767{
4768
4769 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4770 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004771 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004772 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004773
4774 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004775 unsigned char *buf;
4776 const size_t sizeWithoutChecksum = 8 + 4;
4777 const size_t checksumSize = checksumCalculator->checksumByteSize();
4778 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4779 buf = stream->alloc(totalSize);
4780 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004781 int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004782 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004783
4784 memcpy(ptr, &array, 4); ptr += 4;
4785
Yahan Zhoue222fd52016-03-16 12:41:08 -07004786 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4787 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4788
Yahan Zhoub7f09082016-03-10 11:45:02 -08004789
keunyoungb85b2752013-03-08 12:28:03 -08004790 GLboolean retval;
4791 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004792 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4793 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004794 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004795 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004796 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4797 stream->readback(checksumBufPtr, checksumSize);
4798 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004799 ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
4800 abort();
4801 }
4802 }
keunyoungb85b2752013-03-08 12:28:03 -08004803 return retval;
4804}
4805
4806void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
4807{
4808
4809 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4810 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004811 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004812 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004813
4814 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
4815 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004816 unsigned char *buf;
4817 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
4818 const size_t checksumSize = checksumCalculator->checksumByteSize();
4819 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4820 buf = stream->alloc(totalSize);
4821 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004822 int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004823 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004824
4825 memcpy(ptr, &target, 4); ptr += 4;
4826 memcpy(ptr, &numAttachments, 4); ptr += 4;
4827 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
4828 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004829
Yahan Zhoue222fd52016-03-16 12:41:08 -07004830 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4831 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4832
keunyoungb85b2752013-03-08 12:28:03 -08004833}
4834
4835void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
4836{
4837
4838 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4839 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004840 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004841 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004842
4843 const unsigned int __size_data = datalen;
4844 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004845 unsigned char *buf;
4846 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
4847 const size_t checksumSize = checksumCalculator->checksumByteSize();
4848 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4849 buf = stream->alloc(totalSize);
4850 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004851 int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004852 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004853
4854 memcpy(ptr, &indx, 4); ptr += 4;
4855 memcpy(ptr, &size, 4); ptr += 4;
4856 memcpy(ptr, &type, 4); ptr += 4;
4857 memcpy(ptr, &normalized, 1); ptr += 1;
4858 memcpy(ptr, &stride, 4); ptr += 4;
4859 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4860 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4861 memcpy(ptr, &datalen, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004862
Yahan Zhoue222fd52016-03-16 12:41:08 -07004863 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4864 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4865
keunyoungb85b2752013-03-08 12:28:03 -08004866}
4867
4868void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
4869{
4870
4871 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4872 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004873 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004874 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004875
4876 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004877 unsigned char *buf;
4878 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4;
4879 const size_t checksumSize = checksumCalculator->checksumByteSize();
4880 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4881 buf = stream->alloc(totalSize);
4882 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004883 int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004884 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004885
4886 memcpy(ptr, &indx, 4); ptr += 4;
4887 memcpy(ptr, &size, 4); ptr += 4;
4888 memcpy(ptr, &type, 4); ptr += 4;
4889 memcpy(ptr, &normalized, 1); ptr += 1;
4890 memcpy(ptr, &stride, 4); ptr += 4;
4891 memcpy(ptr, &offset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004892
Yahan Zhoue222fd52016-03-16 12:41:08 -07004893 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4894 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4895
keunyoungb85b2752013-03-08 12:28:03 -08004896}
4897
4898void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
4899{
4900
4901 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4902 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004903 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004904 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004905
4906 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004907 unsigned char *buf;
4908 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4909 const size_t checksumSize = checksumCalculator->checksumByteSize();
4910 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4911 buf = stream->alloc(totalSize);
4912 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004913 int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004914 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004915
4916 memcpy(ptr, &mode, 4); ptr += 4;
4917 memcpy(ptr, &count, 4); ptr += 4;
4918 memcpy(ptr, &type, 4); ptr += 4;
4919 memcpy(ptr, &offset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004920
Yahan Zhoue222fd52016-03-16 12:41:08 -07004921 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4922 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004923
keunyoungb85b2752013-03-08 12:28:03 -08004924}
4925
4926void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
4927{
4928
4929 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4930 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004931 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004932 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004933
4934 const unsigned int __size_data = datalen;
4935 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004936 unsigned char *buf;
4937 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4938 const size_t checksumSize = checksumCalculator->checksumByteSize();
4939 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4940 buf = stream->alloc(totalSize);
4941 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004942 int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004943 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004944
4945 memcpy(ptr, &mode, 4); ptr += 4;
4946 memcpy(ptr, &count, 4); ptr += 4;
4947 memcpy(ptr, &type, 4); ptr += 4;
4948 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4949 memcpy(ptr, data, __size_data);ptr += __size_data;
4950 memcpy(ptr, &datalen, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004951
Yahan Zhoue222fd52016-03-16 12:41:08 -07004952 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4953 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004954
keunyoungb85b2752013-03-08 12:28:03 -08004955}
4956
4957void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
4958{
4959
4960 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4961 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004962 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004963 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004964
4965 const unsigned int __size_formats = (count * sizeof(GLint));
4966 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004967 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004968 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004969 const size_t checksumSize = checksumCalculator->checksumByteSize();
4970 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4971 buf = stream->alloc(totalSize);
4972 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004973 int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004974 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004975
4976 memcpy(ptr, &count, 4); ptr += 4;
4977 *(unsigned int *)(ptr) = __size_formats; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004978
Yahan Zhoue222fd52016-03-16 12:41:08 -07004979 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4980 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4981
keunyoungb85b2752013-03-08 12:28:03 -08004982 stream->readback(formats, __size_formats);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004983 if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4984 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004985 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004986 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004987 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4988 stream->readback(checksumBufPtr, checksumSize);
4989 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004990 ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4991 abort();
4992 }
4993 }
keunyoungb85b2752013-03-08 12:28:03 -08004994}
4995
4996void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
4997{
4998
4999 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5000 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005001 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005002 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005003
5004 const unsigned int __size_string = len;
5005 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005006 unsigned char *buf;
5007 const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4;
5008 const size_t checksumSize = checksumCalculator->checksumByteSize();
5009 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5010 buf = stream->alloc(totalSize);
5011 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08005012 int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005013 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005014
5015 memcpy(ptr, &shader, 4); ptr += 4;
5016 *(unsigned int *)(ptr) = __size_string; ptr += 4;
5017 memcpy(ptr, string, __size_string);ptr += __size_string;
5018 memcpy(ptr, &len, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005019
Yahan Zhoue222fd52016-03-16 12:41:08 -07005020 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5021 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5022
keunyoungb85b2752013-03-08 12:28:03 -08005023}
5024
5025int glFinishRoundTrip_enc(void *self )
5026{
5027
5028 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5029 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005030 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005031 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005032
5033 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005034 unsigned char *buf;
5035 const size_t sizeWithoutChecksum = 8;
5036 const size_t checksumSize = checksumCalculator->checksumByteSize();
5037 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5038 buf = stream->alloc(totalSize);
5039 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08005040 int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005041 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005042
5043
Yahan Zhoue222fd52016-03-16 12:41:08 -07005044 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5045 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5046
Yahan Zhoub7f09082016-03-10 11:45:02 -08005047
keunyoungb85b2752013-03-08 12:28:03 -08005048 int retval;
5049 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07005050 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5051 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005052 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07005053 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005054 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5055 stream->readback(checksumBufPtr, checksumSize);
5056 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07005057 ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
5058 abort();
5059 }
5060 }
keunyoungb85b2752013-03-08 12:28:03 -08005061 return retval;
5062}
5063
Lingfeng Yange6556dc2017-01-09 12:04:12 -08005064void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays)
5065{
5066
5067 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5068 IOStream *stream = ctx->m_stream;
5069 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5070 bool useChecksum = checksumCalculator->getVersion() > 0;
5071
5072 const unsigned int __size_arrays = (n * sizeof(GLuint));
5073 unsigned char *ptr;
5074 unsigned char *buf;
5075 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
5076 const size_t checksumSize = checksumCalculator->checksumByteSize();
5077 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5078 buf = stream->alloc(totalSize);
5079 ptr = buf;
5080 int tmp = OP_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5081 memcpy(ptr, &totalSize, 4); ptr += 4;
5082
5083 memcpy(ptr, &n, 4); ptr += 4;
5084 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5085
5086 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5087 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5088
5089 stream->readback(arrays, __size_arrays);
5090 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
5091 if (useChecksum) {
5092 unsigned char *checksumBufPtr = NULL;
5093 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5094 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5095 stream->readback(checksumBufPtr, checksumSize);
5096 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5097 ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n");
5098 abort();
5099 }
5100 }
5101}
5102
5103void glBindVertexArray_enc(void *self , GLuint array)
5104{
5105
5106 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5107 IOStream *stream = ctx->m_stream;
5108 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5109 bool useChecksum = checksumCalculator->getVersion() > 0;
5110
5111 unsigned char *ptr;
5112 unsigned char *buf;
5113 const size_t sizeWithoutChecksum = 8 + 4;
5114 const size_t checksumSize = checksumCalculator->checksumByteSize();
5115 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5116 buf = stream->alloc(totalSize);
5117 ptr = buf;
5118 int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5119 memcpy(ptr, &totalSize, 4); ptr += 4;
5120
5121 memcpy(ptr, &array, 4); ptr += 4;
5122
5123 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5124 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5125
5126}
5127
5128void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays)
5129{
5130
5131 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5132 IOStream *stream = ctx->m_stream;
5133 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5134 bool useChecksum = checksumCalculator->getVersion() > 0;
5135
5136 const unsigned int __size_arrays = (n * sizeof(GLuint));
5137 unsigned char *ptr;
5138 unsigned char *buf;
5139 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
5140 const size_t checksumSize = checksumCalculator->checksumByteSize();
5141 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5142 buf = stream->alloc(totalSize);
5143 ptr = buf;
5144 int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5145 memcpy(ptr, &totalSize, 4); ptr += 4;
5146
5147 memcpy(ptr, &n, 4); ptr += 4;
5148 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5149 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
5150
5151 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5152 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5153
5154}
5155
5156GLboolean glIsVertexArray_enc(void *self , GLuint array)
5157{
5158
5159 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5160 IOStream *stream = ctx->m_stream;
5161 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5162 bool useChecksum = checksumCalculator->getVersion() > 0;
5163
5164 unsigned char *ptr;
5165 unsigned char *buf;
5166 const size_t sizeWithoutChecksum = 8 + 4;
5167 const size_t checksumSize = checksumCalculator->checksumByteSize();
5168 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5169 buf = stream->alloc(totalSize);
5170 ptr = buf;
5171 int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5172 memcpy(ptr, &totalSize, 4); ptr += 4;
5173
5174 memcpy(ptr, &array, 4); ptr += 4;
5175
5176 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5177 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5178
5179
5180 GLboolean retval;
5181 stream->readback(&retval, 1);
5182 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
5183 if (useChecksum) {
5184 unsigned char *checksumBufPtr = NULL;
5185 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5186 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5187 stream->readback(checksumBufPtr, checksumSize);
5188 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5189 ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n");
5190 abort();
5191 }
5192 }
5193 return retval;
5194}
5195
5196void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped)
5197{
5198
5199 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5200 IOStream *stream = ctx->m_stream;
5201 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5202 bool useChecksum = checksumCalculator->getVersion() > 0;
5203
5204 const unsigned int __size_mapped = ((mapped != NULL) ? length : 0);
5205 unsigned char *ptr;
5206 unsigned char *buf;
5207 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
5208 const size_t checksumSize = checksumCalculator->checksumByteSize();
5209 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5210 buf = stream->alloc(totalSize);
5211 ptr = buf;
5212 int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5213 memcpy(ptr, &totalSize, 4); ptr += 4;
5214
5215 memcpy(ptr, &target, 4); ptr += 4;
5216 memcpy(ptr, &offset, 4); ptr += 4;
5217 memcpy(ptr, &length, 4); ptr += 4;
5218 memcpy(ptr, &access, 4); ptr += 4;
5219 *(unsigned int *)(ptr) = __size_mapped; ptr += 4;
5220
5221 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5222 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5223
5224 if (mapped != NULL) {
5225 stream->readback(mapped, __size_mapped);
5226 if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped);
5227 }
5228 if (useChecksum) {
5229 unsigned char *checksumBufPtr = NULL;
5230 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5231 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5232 stream->readback(checksumBufPtr, checksumSize);
5233 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5234 ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n");
5235 abort();
5236 }
5237 }
5238}
5239
5240void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
5241{
5242
5243 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5244 IOStream *stream = ctx->m_stream;
5245 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5246 bool useChecksum = checksumCalculator->getVersion() > 0;
5247
5248 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5249 const unsigned int __size_out_res = (sizeof(GLboolean));
5250 unsigned char *ptr;
5251 unsigned char *buf;
5252 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4;
5253 const size_t checksumSize = checksumCalculator->checksumByteSize();
5254 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5255 buf = stream->alloc(totalSize);
5256 ptr = buf;
5257 int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5258 memcpy(ptr, &totalSize, 4); ptr += 4;
5259
5260 memcpy(ptr, &target, 4); ptr += 4;
5261 memcpy(ptr, &offset, 4); ptr += 4;
5262 memcpy(ptr, &length, 4); ptr += 4;
5263 memcpy(ptr, &access, 4); ptr += 4;
5264 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5265 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5266 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
5267
5268 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5269 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5270
5271 stream->readback(out_res, __size_out_res);
5272 if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
5273 if (useChecksum) {
5274 unsigned char *checksumBufPtr = NULL;
5275 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5276 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5277 stream->readback(checksumBufPtr, checksumSize);
5278 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5279 ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n");
5280 abort();
5281 }
5282 }
5283}
5284
5285void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
5286{
5287
5288 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5289 IOStream *stream = ctx->m_stream;
5290 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5291 bool useChecksum = checksumCalculator->getVersion() > 0;
5292
5293 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5294 unsigned char *ptr;
5295 unsigned char *buf;
5296 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
5297 const size_t checksumSize = checksumCalculator->checksumByteSize();
5298 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5299 buf = stream->alloc(totalSize);
5300 ptr = buf;
5301 int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5302 memcpy(ptr, &totalSize, 4); ptr += 4;
5303
5304 memcpy(ptr, &target, 4); ptr += 4;
5305 memcpy(ptr, &offset, 4); ptr += 4;
5306 memcpy(ptr, &length, 4); ptr += 4;
5307 memcpy(ptr, &access, 4); ptr += 4;
5308 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5309 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5310
5311 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5312 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5313
5314}
5315
5316void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5317{
5318
5319 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5320 IOStream *stream = ctx->m_stream;
5321 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5322 bool useChecksum = checksumCalculator->getVersion() > 0;
5323
5324 unsigned char *ptr;
5325 unsigned char *buf;
5326 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5327 const size_t checksumSize = checksumCalculator->checksumByteSize();
5328 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5329 buf = stream->alloc(totalSize);
5330 ptr = buf;
5331 int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5332 memcpy(ptr, &totalSize, 4); ptr += 4;
5333
5334 memcpy(ptr, &x, 4); ptr += 4;
5335 memcpy(ptr, &y, 4); ptr += 4;
5336 memcpy(ptr, &width, 4); ptr += 4;
5337 memcpy(ptr, &height, 4); ptr += 4;
5338 memcpy(ptr, &format, 4); ptr += 4;
5339 memcpy(ptr, &type, 4); ptr += 4;
5340 memcpy(ptr, &offset, 4); ptr += 4;
5341
5342 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5343 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5344
5345}
5346
5347void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset)
5348{
5349
5350 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5351 IOStream *stream = ctx->m_stream;
5352 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5353 bool useChecksum = checksumCalculator->getVersion() > 0;
5354
5355 unsigned char *ptr;
5356 unsigned char *buf;
5357 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5358 const size_t checksumSize = checksumCalculator->checksumByteSize();
5359 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5360 buf = stream->alloc(totalSize);
5361 ptr = buf;
5362 int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5363 memcpy(ptr, &totalSize, 4); ptr += 4;
5364
5365 memcpy(ptr, &target, 4); ptr += 4;
5366 memcpy(ptr, &level, 4); ptr += 4;
5367 memcpy(ptr, &internalformat, 4); ptr += 4;
5368 memcpy(ptr, &width, 4); ptr += 4;
5369 memcpy(ptr, &height, 4); ptr += 4;
5370 memcpy(ptr, &border, 4); ptr += 4;
5371 memcpy(ptr, &imageSize, 4); ptr += 4;
5372 memcpy(ptr, &offset, 4); ptr += 4;
5373
5374 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5375 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5376
5377}
5378
5379void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset)
5380{
5381
5382 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5383 IOStream *stream = ctx->m_stream;
5384 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5385 bool useChecksum = checksumCalculator->getVersion() > 0;
5386
5387 unsigned char *ptr;
5388 unsigned char *buf;
5389 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5390 const size_t checksumSize = checksumCalculator->checksumByteSize();
5391 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5392 buf = stream->alloc(totalSize);
5393 ptr = buf;
5394 int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5395 memcpy(ptr, &totalSize, 4); ptr += 4;
5396
5397 memcpy(ptr, &target, 4); ptr += 4;
5398 memcpy(ptr, &level, 4); ptr += 4;
5399 memcpy(ptr, &xoffset, 4); ptr += 4;
5400 memcpy(ptr, &yoffset, 4); ptr += 4;
5401 memcpy(ptr, &width, 4); ptr += 4;
5402 memcpy(ptr, &height, 4); ptr += 4;
5403 memcpy(ptr, &format, 4); ptr += 4;
5404 memcpy(ptr, &imageSize, 4); ptr += 4;
5405 memcpy(ptr, &offset, 4); ptr += 4;
5406
5407 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5408 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5409
5410}
5411
5412void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset)
5413{
5414
5415 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5416 IOStream *stream = ctx->m_stream;
5417 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5418 bool useChecksum = checksumCalculator->getVersion() > 0;
5419
5420 unsigned char *ptr;
5421 unsigned char *buf;
5422 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5423 const size_t checksumSize = checksumCalculator->checksumByteSize();
5424 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5425 buf = stream->alloc(totalSize);
5426 ptr = buf;
5427 int tmp = OP_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5428 memcpy(ptr, &totalSize, 4); ptr += 4;
5429
5430 memcpy(ptr, &target, 4); ptr += 4;
5431 memcpy(ptr, &level, 4); ptr += 4;
5432 memcpy(ptr, &internalformat, 4); ptr += 4;
5433 memcpy(ptr, &width, 4); ptr += 4;
5434 memcpy(ptr, &height, 4); ptr += 4;
5435 memcpy(ptr, &border, 4); ptr += 4;
5436 memcpy(ptr, &format, 4); ptr += 4;
5437 memcpy(ptr, &type, 4); ptr += 4;
5438 memcpy(ptr, &offset, 4); ptr += 4;
5439
5440 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5441 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5442
5443}
5444
5445void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5446{
5447
5448 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5449 IOStream *stream = ctx->m_stream;
5450 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5451 bool useChecksum = checksumCalculator->getVersion() > 0;
5452
5453 unsigned char *ptr;
5454 unsigned char *buf;
5455 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5456 const size_t checksumSize = checksumCalculator->checksumByteSize();
5457 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5458 buf = stream->alloc(totalSize);
5459 ptr = buf;
5460 int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5461 memcpy(ptr, &totalSize, 4); ptr += 4;
5462
5463 memcpy(ptr, &target, 4); ptr += 4;
5464 memcpy(ptr, &level, 4); ptr += 4;
5465 memcpy(ptr, &xoffset, 4); ptr += 4;
5466 memcpy(ptr, &yoffset, 4); ptr += 4;
5467 memcpy(ptr, &width, 4); ptr += 4;
5468 memcpy(ptr, &height, 4); ptr += 4;
5469 memcpy(ptr, &format, 4); ptr += 4;
5470 memcpy(ptr, &type, 4); ptr += 4;
5471 memcpy(ptr, &offset, 4); ptr += 4;
5472
5473 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5474 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5475
5476}
5477
5478void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5479{
5480
5481 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5482 IOStream *stream = ctx->m_stream;
5483 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5484 bool useChecksum = checksumCalculator->getVersion() > 0;
5485
5486 unsigned char *ptr;
5487 unsigned char *buf;
5488 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5489 const size_t checksumSize = checksumCalculator->checksumByteSize();
5490 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5491 buf = stream->alloc(totalSize);
5492 ptr = buf;
5493 int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4;
5494 memcpy(ptr, &totalSize, 4); ptr += 4;
5495
5496 memcpy(ptr, &target, 4); ptr += 4;
5497 memcpy(ptr, &index, 4); ptr += 4;
5498 memcpy(ptr, &buffer, 4); ptr += 4;
5499 memcpy(ptr, &offset, 4); ptr += 4;
5500 memcpy(ptr, &size, 4); ptr += 4;
5501
5502 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5503 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5504
5505}
5506
5507void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer)
5508{
5509
5510 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5511 IOStream *stream = ctx->m_stream;
5512 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5513 bool useChecksum = checksumCalculator->getVersion() > 0;
5514
5515 unsigned char *ptr;
5516 unsigned char *buf;
5517 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5518 const size_t checksumSize = checksumCalculator->checksumByteSize();
5519 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5520 buf = stream->alloc(totalSize);
5521 ptr = buf;
5522 int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4;
5523 memcpy(ptr, &totalSize, 4); ptr += 4;
5524
5525 memcpy(ptr, &target, 4); ptr += 4;
5526 memcpy(ptr, &index, 4); ptr += 4;
5527 memcpy(ptr, &buffer, 4); ptr += 4;
5528
5529 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5530 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5531
5532}
5533
5534void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
5535{
5536
5537 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5538 IOStream *stream = ctx->m_stream;
5539 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5540 bool useChecksum = checksumCalculator->getVersion() > 0;
5541
5542 unsigned char *ptr;
5543 unsigned char *buf;
5544 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5545 const size_t checksumSize = checksumCalculator->checksumByteSize();
5546 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5547 buf = stream->alloc(totalSize);
5548 ptr = buf;
5549 int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
5550 memcpy(ptr, &totalSize, 4); ptr += 4;
5551
5552 memcpy(ptr, &readtarget, 4); ptr += 4;
5553 memcpy(ptr, &writetarget, 4); ptr += 4;
5554 memcpy(ptr, &readoffset, 4); ptr += 4;
5555 memcpy(ptr, &writeoffset, 4); ptr += 4;
5556 memcpy(ptr, &size, 4); ptr += 4;
5557
5558 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5559 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5560
5561 stream->flush();
5562}
5563
5564void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value)
5565{
5566
5567 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5568 IOStream *stream = ctx->m_stream;
5569 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5570 bool useChecksum = checksumCalculator->getVersion() > 0;
5571
5572 const unsigned int __size_value = (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer));
5573 unsigned char *ptr;
5574 unsigned char *buf;
5575 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5576 const size_t checksumSize = checksumCalculator->checksumByteSize();
5577 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5578 buf = stream->alloc(totalSize);
5579 ptr = buf;
5580 int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4;
5581 memcpy(ptr, &totalSize, 4); ptr += 4;
5582
5583 memcpy(ptr, &buffer, 4); ptr += 4;
5584 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5585 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5586 memcpy(ptr, value, __size_value);ptr += __size_value;
5587
5588 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5589 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5590
5591}
5592
5593void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value)
5594{
5595
5596 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5597 IOStream *stream = ctx->m_stream;
5598 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5599 bool useChecksum = checksumCalculator->getVersion() > 0;
5600
5601 const unsigned int __size_value = (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer));
5602 unsigned char *ptr;
5603 unsigned char *buf;
5604 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5605 const size_t checksumSize = checksumCalculator->checksumByteSize();
5606 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5607 buf = stream->alloc(totalSize);
5608 ptr = buf;
5609 int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4;
5610 memcpy(ptr, &totalSize, 4); ptr += 4;
5611
5612 memcpy(ptr, &buffer, 4); ptr += 4;
5613 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5614 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5615 memcpy(ptr, value, __size_value);ptr += __size_value;
5616
5617 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5618 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5619
5620}
5621
5622void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value)
5623{
5624
5625 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5626 IOStream *stream = ctx->m_stream;
5627 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5628 bool useChecksum = checksumCalculator->getVersion() > 0;
5629
5630 const unsigned int __size_value = (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer));
5631 unsigned char *ptr;
5632 unsigned char *buf;
5633 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5634 const size_t checksumSize = checksumCalculator->checksumByteSize();
5635 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5636 buf = stream->alloc(totalSize);
5637 ptr = buf;
5638 int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4;
5639 memcpy(ptr, &totalSize, 4); ptr += 4;
5640
5641 memcpy(ptr, &buffer, 4); ptr += 4;
5642 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5643 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5644 memcpy(ptr, value, __size_value);ptr += __size_value;
5645
5646 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5647 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5648
5649}
5650
5651void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
5652{
5653
5654 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5655 IOStream *stream = ctx->m_stream;
5656 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5657 bool useChecksum = checksumCalculator->getVersion() > 0;
5658
5659 unsigned char *ptr;
5660 unsigned char *buf;
5661 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5662 const size_t checksumSize = checksumCalculator->checksumByteSize();
5663 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5664 buf = stream->alloc(totalSize);
5665 ptr = buf;
5666 int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4;
5667 memcpy(ptr, &totalSize, 4); ptr += 4;
5668
5669 memcpy(ptr, &buffer, 4); ptr += 4;
5670 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5671 memcpy(ptr, &depth, 4); ptr += 4;
5672 memcpy(ptr, &stencil, 4); ptr += 4;
5673
5674 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5675 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5676
5677}
5678
5679void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5680{
5681
5682 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5683 IOStream *stream = ctx->m_stream;
5684 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5685 bool useChecksum = checksumCalculator->getVersion() > 0;
5686
5687 unsigned char *ptr;
5688 unsigned char *buf;
5689 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5690 const size_t checksumSize = checksumCalculator->checksumByteSize();
5691 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5692 buf = stream->alloc(totalSize);
5693 ptr = buf;
5694 int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4;
5695 memcpy(ptr, &totalSize, 4); ptr += 4;
5696
5697 memcpy(ptr, &program, 4); ptr += 4;
5698 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5699 memcpy(ptr, &uniformBlockBinding, 4); ptr += 4;
5700
5701 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5702 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5703
5704}
5705
5706GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName)
5707{
5708
5709 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5710 IOStream *stream = ctx->m_stream;
5711 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5712 bool useChecksum = checksumCalculator->getVersion() > 0;
5713
5714 const unsigned int __size_uniformBlockName = (strlen(uniformBlockName) + 1);
5715 unsigned char *ptr;
5716 unsigned char *buf;
5717 const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4;
5718 const size_t checksumSize = checksumCalculator->checksumByteSize();
5719 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5720 buf = stream->alloc(totalSize);
5721 ptr = buf;
5722 int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4;
5723 memcpy(ptr, &totalSize, 4); ptr += 4;
5724
5725 memcpy(ptr, &program, 4); ptr += 4;
5726 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5727 memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName;
5728
5729 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5730 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5731
5732
5733 GLuint retval;
5734 stream->readback(&retval, 4);
5735 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5736 if (useChecksum) {
5737 unsigned char *checksumBufPtr = NULL;
5738 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5739 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5740 stream->readback(checksumBufPtr, checksumSize);
5741 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5742 ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n");
5743 abort();
5744 }
5745 }
5746 return retval;
5747}
5748
5749void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices)
5750{
5751
5752 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5753 IOStream *stream = ctx->m_stream;
5754 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5755 bool useChecksum = checksumCalculator->getVersion() > 0;
5756
5757 const unsigned int __size_packedUniformNames = packedLen;
5758 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
5759 unsigned char *ptr;
5760 unsigned char *buf;
5761 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4;
5762 const size_t checksumSize = checksumCalculator->checksumByteSize();
5763 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5764 buf = stream->alloc(totalSize);
5765 ptr = buf;
5766 int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5767 memcpy(ptr, &totalSize, 4); ptr += 4;
5768
5769 memcpy(ptr, &program, 4); ptr += 4;
5770 memcpy(ptr, &uniformCount, 4); ptr += 4;
5771 *(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4;
5772 memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames;
5773 memcpy(ptr, &packedLen, 4); ptr += 4;
5774 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
5775
5776 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5777 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5778
5779 stream->readback(uniformIndices, __size_uniformIndices);
5780 if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices);
5781 if (useChecksum) {
5782 unsigned char *checksumBufPtr = NULL;
5783 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5784 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5785 stream->readback(checksumBufPtr, checksumSize);
5786 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5787 ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n");
5788 abort();
5789 }
5790 }
5791}
5792
5793void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5794{
5795
5796 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5797 IOStream *stream = ctx->m_stream;
5798 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5799 bool useChecksum = checksumCalculator->getVersion() > 0;
5800
5801 const unsigned int __size_params = (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint));
5802 unsigned char *ptr;
5803 unsigned char *buf;
5804 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
5805 const size_t checksumSize = checksumCalculator->checksumByteSize();
5806 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5807 buf = stream->alloc(totalSize);
5808 ptr = buf;
5809 int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4;
5810 memcpy(ptr, &totalSize, 4); ptr += 4;
5811
5812 memcpy(ptr, &program, 4); ptr += 4;
5813 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5814 memcpy(ptr, &pname, 4); ptr += 4;
5815 *(unsigned int *)(ptr) = __size_params; ptr += 4;
5816
5817 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5818 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5819
5820 stream->readback(params, __size_params);
5821 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5822 if (useChecksum) {
5823 unsigned char *checksumBufPtr = NULL;
5824 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5825 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5826 stream->readback(checksumBufPtr, checksumSize);
5827 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5828 ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n");
5829 abort();
5830 }
5831 }
5832}
5833
5834void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5835{
5836
5837 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5838 IOStream *stream = ctx->m_stream;
5839 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5840 bool useChecksum = checksumCalculator->getVersion() > 0;
5841
5842 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
5843 const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ? bufSize : 0);
5844 unsigned char *ptr;
5845 unsigned char *buf;
5846 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4;
5847 const size_t checksumSize = checksumCalculator->checksumByteSize();
5848 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5849 buf = stream->alloc(totalSize);
5850 ptr = buf;
5851 int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4;
5852 memcpy(ptr, &totalSize, 4); ptr += 4;
5853
5854 memcpy(ptr, &program, 4); ptr += 4;
5855 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5856 memcpy(ptr, &bufSize, 4); ptr += 4;
5857 *(unsigned int *)(ptr) = __size_length; ptr += 4;
5858 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5859
5860 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5861 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5862
5863 if (length != NULL) {
5864 stream->readback(length, __size_length);
5865 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
5866 }
5867 if (uniformBlockName != NULL) {
5868 stream->readback(uniformBlockName, __size_uniformBlockName);
5869 if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName);
5870 }
5871 if (useChecksum) {
5872 unsigned char *checksumBufPtr = NULL;
5873 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5874 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5875 stream->readback(checksumBufPtr, checksumSize);
5876 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5877 ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n");
5878 abort();
5879 }
5880 }
5881}
5882
5883void glUniform1ui_enc(void *self , GLint location, GLuint v0)
5884{
5885
5886 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5887 IOStream *stream = ctx->m_stream;
5888 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5889 bool useChecksum = checksumCalculator->getVersion() > 0;
5890
5891 unsigned char *ptr;
5892 unsigned char *buf;
5893 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5894 const size_t checksumSize = checksumCalculator->checksumByteSize();
5895 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5896 buf = stream->alloc(totalSize);
5897 ptr = buf;
5898 int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
5899 memcpy(ptr, &totalSize, 4); ptr += 4;
5900
5901 memcpy(ptr, &location, 4); ptr += 4;
5902 memcpy(ptr, &v0, 4); ptr += 4;
5903
5904 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5905 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5906
5907}
5908
5909void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1)
5910{
5911
5912 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5913 IOStream *stream = ctx->m_stream;
5914 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5915 bool useChecksum = checksumCalculator->getVersion() > 0;
5916
5917 unsigned char *ptr;
5918 unsigned char *buf;
5919 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5920 const size_t checksumSize = checksumCalculator->checksumByteSize();
5921 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5922 buf = stream->alloc(totalSize);
5923 ptr = buf;
5924 int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
5925 memcpy(ptr, &totalSize, 4); ptr += 4;
5926
5927 memcpy(ptr, &location, 4); ptr += 4;
5928 memcpy(ptr, &v0, 4); ptr += 4;
5929 memcpy(ptr, &v1, 4); ptr += 4;
5930
5931 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5932 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5933
5934}
5935
5936void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2)
5937{
5938
5939 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5940 IOStream *stream = ctx->m_stream;
5941 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5942 bool useChecksum = checksumCalculator->getVersion() > 0;
5943
5944 unsigned char *ptr;
5945 unsigned char *buf;
5946 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5947 const size_t checksumSize = checksumCalculator->checksumByteSize();
5948 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5949 buf = stream->alloc(totalSize);
5950 ptr = buf;
5951 int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
5952 memcpy(ptr, &totalSize, 4); ptr += 4;
5953
5954 memcpy(ptr, &location, 4); ptr += 4;
5955 memcpy(ptr, &v0, 4); ptr += 4;
5956 memcpy(ptr, &v1, 4); ptr += 4;
5957 memcpy(ptr, &v2, 4); ptr += 4;
5958
5959 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5960 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5961
5962}
5963
5964void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3)
5965{
5966
5967 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5968 IOStream *stream = ctx->m_stream;
5969 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5970 bool useChecksum = checksumCalculator->getVersion() > 0;
5971
5972 unsigned char *ptr;
5973 unsigned char *buf;
5974 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5975 const size_t checksumSize = checksumCalculator->checksumByteSize();
5976 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5977 buf = stream->alloc(totalSize);
5978 ptr = buf;
5979 int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
5980 memcpy(ptr, &totalSize, 4); ptr += 4;
5981
5982 memcpy(ptr, &location, 4); ptr += 4;
5983 memcpy(ptr, &v0, 4); ptr += 4;
5984 memcpy(ptr, &v1, 4); ptr += 4;
5985 memcpy(ptr, &v2, 4); ptr += 4;
5986 memcpy(ptr, &v3, 4); ptr += 4;
5987
5988 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5989 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5990
5991}
5992
5993void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
5994{
5995
5996 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5997 IOStream *stream = ctx->m_stream;
5998 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5999 bool useChecksum = checksumCalculator->getVersion() > 0;
6000
6001 const unsigned int __size_value = (count * sizeof(GLuint));
6002 unsigned char *ptr;
6003 unsigned char *buf;
6004 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6005 const size_t checksumSize = checksumCalculator->checksumByteSize();
6006 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6007 buf = stream->alloc(totalSize);
6008 ptr = buf;
6009 int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6010 memcpy(ptr, &totalSize, 4); ptr += 4;
6011
6012 memcpy(ptr, &location, 4); ptr += 4;
6013 memcpy(ptr, &count, 4); ptr += 4;
6014 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6015 memcpy(ptr, value, __size_value);ptr += __size_value;
6016
6017 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6018 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6019
6020}
6021
6022void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6023{
6024
6025 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6026 IOStream *stream = ctx->m_stream;
6027 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6028 bool useChecksum = checksumCalculator->getVersion() > 0;
6029
6030 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
6031 unsigned char *ptr;
6032 unsigned char *buf;
6033 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6034 const size_t checksumSize = checksumCalculator->checksumByteSize();
6035 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6036 buf = stream->alloc(totalSize);
6037 ptr = buf;
6038 int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6039 memcpy(ptr, &totalSize, 4); ptr += 4;
6040
6041 memcpy(ptr, &location, 4); ptr += 4;
6042 memcpy(ptr, &count, 4); ptr += 4;
6043 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6044 memcpy(ptr, value, __size_value);ptr += __size_value;
6045
6046 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6047 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6048
6049}
6050
6051void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6052{
6053
6054 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6055 IOStream *stream = ctx->m_stream;
6056 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6057 bool useChecksum = checksumCalculator->getVersion() > 0;
6058
6059 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
6060 unsigned char *ptr;
6061 unsigned char *buf;
6062 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6063 const size_t checksumSize = checksumCalculator->checksumByteSize();
6064 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6065 buf = stream->alloc(totalSize);
6066 ptr = buf;
6067 int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6068 memcpy(ptr, &totalSize, 4); ptr += 4;
6069
6070 memcpy(ptr, &location, 4); ptr += 4;
6071 memcpy(ptr, &count, 4); ptr += 4;
6072 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6073 memcpy(ptr, value, __size_value);ptr += __size_value;
6074
6075 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6076 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6077
6078}
6079
6080void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6081{
6082
6083 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6084 IOStream *stream = ctx->m_stream;
6085 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6086 bool useChecksum = checksumCalculator->getVersion() > 0;
6087
6088 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
6089 unsigned char *ptr;
6090 unsigned char *buf;
6091 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6092 const size_t checksumSize = checksumCalculator->checksumByteSize();
6093 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6094 buf = stream->alloc(totalSize);
6095 ptr = buf;
6096 int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6097 memcpy(ptr, &totalSize, 4); ptr += 4;
6098
6099 memcpy(ptr, &location, 4); ptr += 4;
6100 memcpy(ptr, &count, 4); ptr += 4;
6101 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6102 memcpy(ptr, value, __size_value);ptr += __size_value;
6103
6104 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6105 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6106
6107}
6108
6109void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6110{
6111
6112 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6113 IOStream *stream = ctx->m_stream;
6114 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6115 bool useChecksum = checksumCalculator->getVersion() > 0;
6116
6117 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6118 unsigned char *ptr;
6119 unsigned char *buf;
6120 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6121 const size_t checksumSize = checksumCalculator->checksumByteSize();
6122 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6123 buf = stream->alloc(totalSize);
6124 ptr = buf;
6125 int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6126 memcpy(ptr, &totalSize, 4); ptr += 4;
6127
6128 memcpy(ptr, &location, 4); ptr += 4;
6129 memcpy(ptr, &count, 4); ptr += 4;
6130 memcpy(ptr, &transpose, 1); ptr += 1;
6131 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6132 memcpy(ptr, value, __size_value);ptr += __size_value;
6133
6134 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6135 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6136
6137}
6138
6139void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6140{
6141
6142 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6143 IOStream *stream = ctx->m_stream;
6144 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6145 bool useChecksum = checksumCalculator->getVersion() > 0;
6146
6147 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6148 unsigned char *ptr;
6149 unsigned char *buf;
6150 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6151 const size_t checksumSize = checksumCalculator->checksumByteSize();
6152 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6153 buf = stream->alloc(totalSize);
6154 ptr = buf;
6155 int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6156 memcpy(ptr, &totalSize, 4); ptr += 4;
6157
6158 memcpy(ptr, &location, 4); ptr += 4;
6159 memcpy(ptr, &count, 4); ptr += 4;
6160 memcpy(ptr, &transpose, 1); ptr += 1;
6161 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6162 memcpy(ptr, value, __size_value);ptr += __size_value;
6163
6164 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6165 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6166
6167}
6168
6169void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6170{
6171
6172 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6173 IOStream *stream = ctx->m_stream;
6174 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6175 bool useChecksum = checksumCalculator->getVersion() > 0;
6176
6177 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6178 unsigned char *ptr;
6179 unsigned char *buf;
6180 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6181 const size_t checksumSize = checksumCalculator->checksumByteSize();
6182 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6183 buf = stream->alloc(totalSize);
6184 ptr = buf;
6185 int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6186 memcpy(ptr, &totalSize, 4); ptr += 4;
6187
6188 memcpy(ptr, &location, 4); ptr += 4;
6189 memcpy(ptr, &count, 4); ptr += 4;
6190 memcpy(ptr, &transpose, 1); ptr += 1;
6191 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6192 memcpy(ptr, value, __size_value);ptr += __size_value;
6193
6194 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6195 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6196
6197}
6198
6199void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6200{
6201
6202 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6203 IOStream *stream = ctx->m_stream;
6204 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6205 bool useChecksum = checksumCalculator->getVersion() > 0;
6206
6207 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6208 unsigned char *ptr;
6209 unsigned char *buf;
6210 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6211 const size_t checksumSize = checksumCalculator->checksumByteSize();
6212 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6213 buf = stream->alloc(totalSize);
6214 ptr = buf;
6215 int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6216 memcpy(ptr, &totalSize, 4); ptr += 4;
6217
6218 memcpy(ptr, &location, 4); ptr += 4;
6219 memcpy(ptr, &count, 4); ptr += 4;
6220 memcpy(ptr, &transpose, 1); ptr += 1;
6221 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6222 memcpy(ptr, value, __size_value);ptr += __size_value;
6223
6224 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6225 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6226
6227}
6228
6229void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6230{
6231
6232 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6233 IOStream *stream = ctx->m_stream;
6234 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6235 bool useChecksum = checksumCalculator->getVersion() > 0;
6236
6237 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6238 unsigned char *ptr;
6239 unsigned char *buf;
6240 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6241 const size_t checksumSize = checksumCalculator->checksumByteSize();
6242 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6243 buf = stream->alloc(totalSize);
6244 ptr = buf;
6245 int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6246 memcpy(ptr, &totalSize, 4); ptr += 4;
6247
6248 memcpy(ptr, &location, 4); ptr += 4;
6249 memcpy(ptr, &count, 4); ptr += 4;
6250 memcpy(ptr, &transpose, 1); ptr += 1;
6251 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6252 memcpy(ptr, value, __size_value);ptr += __size_value;
6253
6254 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6255 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6256
6257}
6258
6259void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6260{
6261
6262 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6263 IOStream *stream = ctx->m_stream;
6264 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6265 bool useChecksum = checksumCalculator->getVersion() > 0;
6266
6267 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6268 unsigned char *ptr;
6269 unsigned char *buf;
6270 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6271 const size_t checksumSize = checksumCalculator->checksumByteSize();
6272 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6273 buf = stream->alloc(totalSize);
6274 ptr = buf;
6275 int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6276 memcpy(ptr, &totalSize, 4); ptr += 4;
6277
6278 memcpy(ptr, &location, 4); ptr += 4;
6279 memcpy(ptr, &count, 4); ptr += 4;
6280 memcpy(ptr, &transpose, 1); ptr += 1;
6281 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6282 memcpy(ptr, value, __size_value);ptr += __size_value;
6283
6284 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6285 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6286
6287}
6288
6289void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params)
6290{
6291
6292 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6293 IOStream *stream = ctx->m_stream;
6294 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6295 bool useChecksum = checksumCalculator->getVersion() > 0;
6296
6297 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
6298 unsigned char *ptr;
6299 unsigned char *buf;
6300 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6301 const size_t checksumSize = checksumCalculator->checksumByteSize();
6302 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6303 buf = stream->alloc(totalSize);
6304 ptr = buf;
6305 int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6306 memcpy(ptr, &totalSize, 4); ptr += 4;
6307
6308 memcpy(ptr, &program, 4); ptr += 4;
6309 memcpy(ptr, &location, 4); ptr += 4;
6310 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6311
6312 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6313 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6314
6315 stream->readback(params, __size_params);
6316 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6317 if (useChecksum) {
6318 unsigned char *checksumBufPtr = NULL;
6319 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6320 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6321 stream->readback(checksumBufPtr, checksumSize);
6322 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6323 ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n");
6324 abort();
6325 }
6326 }
6327}
6328
6329void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
6330{
6331
6332 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6333 IOStream *stream = ctx->m_stream;
6334 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6335 bool useChecksum = checksumCalculator->getVersion() > 0;
6336
6337 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
6338 const unsigned int __size_params = (uniformCount * sizeof(GLint));
6339 unsigned char *ptr;
6340 unsigned char *buf;
6341 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4;
6342 const size_t checksumSize = checksumCalculator->checksumByteSize();
6343 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6344 buf = stream->alloc(totalSize);
6345 ptr = buf;
6346 int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4;
6347 memcpy(ptr, &totalSize, 4); ptr += 4;
6348
6349 memcpy(ptr, &program, 4); ptr += 4;
6350 memcpy(ptr, &uniformCount, 4); ptr += 4;
6351 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
6352 memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices;
6353 memcpy(ptr, &pname, 4); ptr += 4;
6354 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6355
6356 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6357 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6358
6359 stream->readback(params, __size_params);
6360 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6361 if (useChecksum) {
6362 unsigned char *checksumBufPtr = NULL;
6363 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6364 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6365 stream->readback(checksumBufPtr, checksumSize);
6366 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6367 ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n");
6368 abort();
6369 }
6370 }
6371}
6372
6373void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3)
6374{
6375
6376 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6377 IOStream *stream = ctx->m_stream;
6378 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6379 bool useChecksum = checksumCalculator->getVersion() > 0;
6380
6381 unsigned char *ptr;
6382 unsigned char *buf;
6383 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6384 const size_t checksumSize = checksumCalculator->checksumByteSize();
6385 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6386 buf = stream->alloc(totalSize);
6387 ptr = buf;
6388 int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4;
6389 memcpy(ptr, &totalSize, 4); ptr += 4;
6390
6391 memcpy(ptr, &index, 4); ptr += 4;
6392 memcpy(ptr, &v0, 4); ptr += 4;
6393 memcpy(ptr, &v1, 4); ptr += 4;
6394 memcpy(ptr, &v2, 4); ptr += 4;
6395 memcpy(ptr, &v3, 4); ptr += 4;
6396
6397 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6398 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6399
6400}
6401
6402void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
6403{
6404
6405 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6406 IOStream *stream = ctx->m_stream;
6407 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6408 bool useChecksum = checksumCalculator->getVersion() > 0;
6409
6410 unsigned char *ptr;
6411 unsigned char *buf;
6412 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6413 const size_t checksumSize = checksumCalculator->checksumByteSize();
6414 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6415 buf = stream->alloc(totalSize);
6416 ptr = buf;
6417 int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4;
6418 memcpy(ptr, &totalSize, 4); ptr += 4;
6419
6420 memcpy(ptr, &index, 4); ptr += 4;
6421 memcpy(ptr, &v0, 4); ptr += 4;
6422 memcpy(ptr, &v1, 4); ptr += 4;
6423 memcpy(ptr, &v2, 4); ptr += 4;
6424 memcpy(ptr, &v3, 4); ptr += 4;
6425
6426 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6427 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6428
6429}
6430
6431void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v)
6432{
6433
6434 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6435 IOStream *stream = ctx->m_stream;
6436 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6437 bool useChecksum = checksumCalculator->getVersion() > 0;
6438
6439 const unsigned int __size_v = (4 * sizeof(GLint));
6440 unsigned char *ptr;
6441 unsigned char *buf;
6442 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6443 const size_t checksumSize = checksumCalculator->checksumByteSize();
6444 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6445 buf = stream->alloc(totalSize);
6446 ptr = buf;
6447 int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4;
6448 memcpy(ptr, &totalSize, 4); ptr += 4;
6449
6450 memcpy(ptr, &index, 4); ptr += 4;
6451 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6452 memcpy(ptr, v, __size_v);ptr += __size_v;
6453
6454 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6455 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6456
6457}
6458
6459void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v)
6460{
6461
6462 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6463 IOStream *stream = ctx->m_stream;
6464 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6465 bool useChecksum = checksumCalculator->getVersion() > 0;
6466
6467 const unsigned int __size_v = (4 * sizeof(GLuint));
6468 unsigned char *ptr;
6469 unsigned char *buf;
6470 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6471 const size_t checksumSize = checksumCalculator->checksumByteSize();
6472 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6473 buf = stream->alloc(totalSize);
6474 ptr = buf;
6475 int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6476 memcpy(ptr, &totalSize, 4); ptr += 4;
6477
6478 memcpy(ptr, &index, 4); ptr += 4;
6479 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6480 memcpy(ptr, v, __size_v);ptr += __size_v;
6481
6482 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6483 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6484
6485}
6486
6487void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset)
6488{
6489
6490 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6491 IOStream *stream = ctx->m_stream;
6492 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6493 bool useChecksum = checksumCalculator->getVersion() > 0;
6494
6495 unsigned char *ptr;
6496 unsigned char *buf;
6497 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6498 const size_t checksumSize = checksumCalculator->checksumByteSize();
6499 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6500 buf = stream->alloc(totalSize);
6501 ptr = buf;
6502 int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6503 memcpy(ptr, &totalSize, 4); ptr += 4;
6504
6505 memcpy(ptr, &index, 4); ptr += 4;
6506 memcpy(ptr, &size, 4); ptr += 4;
6507 memcpy(ptr, &type, 4); ptr += 4;
6508 memcpy(ptr, &stride, 4); ptr += 4;
6509 memcpy(ptr, &offset, 4); ptr += 4;
6510
6511 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6512 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6513
6514}
6515
6516void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
6517{
6518
6519 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6520 IOStream *stream = ctx->m_stream;
6521 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6522 bool useChecksum = checksumCalculator->getVersion() > 0;
6523
6524 const unsigned int __size_data = datalen;
6525 unsigned char *ptr;
6526 unsigned char *buf;
6527 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
6528 const size_t checksumSize = checksumCalculator->checksumByteSize();
6529 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6530 buf = stream->alloc(totalSize);
6531 ptr = buf;
6532 int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6533 memcpy(ptr, &totalSize, 4); ptr += 4;
6534
6535 memcpy(ptr, &index, 4); ptr += 4;
6536 memcpy(ptr, &size, 4); ptr += 4;
6537 memcpy(ptr, &type, 4); ptr += 4;
6538 memcpy(ptr, &stride, 4); ptr += 4;
6539 *(unsigned int *)(ptr) = __size_data; ptr += 4;
6540 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
6541 memcpy(ptr, &datalen, 4); ptr += 4;
6542
6543 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6544 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6545
6546}
6547
6548void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
6549{
6550
6551 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6552 IOStream *stream = ctx->m_stream;
6553 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6554 bool useChecksum = checksumCalculator->getVersion() > 0;
6555
6556 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
6557 unsigned char *ptr;
6558 unsigned char *buf;
6559 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6560 const size_t checksumSize = checksumCalculator->checksumByteSize();
6561 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6562 buf = stream->alloc(totalSize);
6563 ptr = buf;
6564 int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4;
6565 memcpy(ptr, &totalSize, 4); ptr += 4;
6566
6567 memcpy(ptr, &index, 4); ptr += 4;
6568 memcpy(ptr, &pname, 4); ptr += 4;
6569 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6570
6571 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6572 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6573
6574 stream->readback(params, __size_params);
6575 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6576 if (useChecksum) {
6577 unsigned char *checksumBufPtr = NULL;
6578 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6579 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6580 stream->readback(checksumBufPtr, checksumSize);
6581 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6582 ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n");
6583 abort();
6584 }
6585 }
6586}
6587
6588void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params)
6589{
6590
6591 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6592 IOStream *stream = ctx->m_stream;
6593 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6594 bool useChecksum = checksumCalculator->getVersion() > 0;
6595
6596 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
6597 unsigned char *ptr;
6598 unsigned char *buf;
6599 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6600 const size_t checksumSize = checksumCalculator->checksumByteSize();
6601 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6602 buf = stream->alloc(totalSize);
6603 ptr = buf;
6604 int tmp = OP_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6605 memcpy(ptr, &totalSize, 4); ptr += 4;
6606
6607 memcpy(ptr, &index, 4); ptr += 4;
6608 memcpy(ptr, &pname, 4); ptr += 4;
6609 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6610
6611 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6612 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6613
6614 stream->readback(params, __size_params);
6615 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6616 if (useChecksum) {
6617 unsigned char *checksumBufPtr = NULL;
6618 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6619 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6620 stream->readback(checksumBufPtr, checksumSize);
6621 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6622 ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n");
6623 abort();
6624 }
6625 }
6626}
6627
6628void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor)
6629{
6630
6631 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6632 IOStream *stream = ctx->m_stream;
6633 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6634 bool useChecksum = checksumCalculator->getVersion() > 0;
6635
6636 unsigned char *ptr;
6637 unsigned char *buf;
6638 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6639 const size_t checksumSize = checksumCalculator->checksumByteSize();
6640 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6641 buf = stream->alloc(totalSize);
6642 ptr = buf;
6643 int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
6644 memcpy(ptr, &totalSize, 4); ptr += 4;
6645
6646 memcpy(ptr, &index, 4); ptr += 4;
6647 memcpy(ptr, &divisor, 4); ptr += 4;
6648
6649 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6650 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6651
6652}
6653
6654void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount)
6655{
6656
6657 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6658 IOStream *stream = ctx->m_stream;
6659 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6660 bool useChecksum = checksumCalculator->getVersion() > 0;
6661
6662 unsigned char *ptr;
6663 unsigned char *buf;
6664 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6665 const size_t checksumSize = checksumCalculator->checksumByteSize();
6666 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6667 buf = stream->alloc(totalSize);
6668 ptr = buf;
6669 int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4;
6670 memcpy(ptr, &totalSize, 4); ptr += 4;
6671
6672 memcpy(ptr, &mode, 4); ptr += 4;
6673 memcpy(ptr, &first, 4); ptr += 4;
6674 memcpy(ptr, &count, 4); ptr += 4;
6675 memcpy(ptr, &primcount, 4); ptr += 4;
6676
6677 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6678 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6679
6680}
6681
6682void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen)
6683{
6684
6685 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6686 IOStream *stream = ctx->m_stream;
6687 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6688 bool useChecksum = checksumCalculator->getVersion() > 0;
6689
6690 const unsigned int __size_indices = datalen;
6691 unsigned char *ptr;
6692 unsigned char *buf;
6693 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4;
6694 const size_t checksumSize = checksumCalculator->checksumByteSize();
6695 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6696 buf = stream->alloc(totalSize);
6697 ptr = buf;
6698 int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6699 memcpy(ptr, &totalSize, 4); ptr += 4;
6700
6701 memcpy(ptr, &mode, 4); ptr += 4;
6702 memcpy(ptr, &count, 4); ptr += 4;
6703 memcpy(ptr, &type, 4); ptr += 4;
6704 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6705 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6706 memcpy(ptr, &primcount, 4); ptr += 4;
6707 memcpy(ptr, &datalen, 4); ptr += 4;
6708
6709 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6710 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6711
6712}
6713
6714void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount)
6715{
6716
6717 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6718 IOStream *stream = ctx->m_stream;
6719 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6720 bool useChecksum = checksumCalculator->getVersion() > 0;
6721
6722 unsigned char *ptr;
6723 unsigned char *buf;
6724 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6725 const size_t checksumSize = checksumCalculator->checksumByteSize();
6726 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6727 buf = stream->alloc(totalSize);
6728 ptr = buf;
6729 int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6730 memcpy(ptr, &totalSize, 4); ptr += 4;
6731
6732 memcpy(ptr, &mode, 4); ptr += 4;
6733 memcpy(ptr, &count, 4); ptr += 4;
6734 memcpy(ptr, &type, 4); ptr += 4;
6735 memcpy(ptr, &offset, 4); ptr += 4;
6736 memcpy(ptr, &primcount, 4); ptr += 4;
6737
6738 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6739 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6740
6741}
6742
6743void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen)
6744{
6745
6746 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6747 IOStream *stream = ctx->m_stream;
6748 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6749 bool useChecksum = checksumCalculator->getVersion() > 0;
6750
6751 const unsigned int __size_indices = datalen;
6752 unsigned char *ptr;
6753 unsigned char *buf;
6754 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4;
6755 const size_t checksumSize = checksumCalculator->checksumByteSize();
6756 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6757 buf = stream->alloc(totalSize);
6758 ptr = buf;
6759 int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6760 memcpy(ptr, &totalSize, 4); ptr += 4;
6761
6762 memcpy(ptr, &mode, 4); ptr += 4;
6763 memcpy(ptr, &start, 4); ptr += 4;
6764 memcpy(ptr, &end, 4); ptr += 4;
6765 memcpy(ptr, &count, 4); ptr += 4;
6766 memcpy(ptr, &type, 4); ptr += 4;
6767 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6768 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6769 memcpy(ptr, &datalen, 4); ptr += 4;
6770
6771 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6772 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6773
6774}
6775
6776void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset)
6777{
6778
6779 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6780 IOStream *stream = ctx->m_stream;
6781 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6782 bool useChecksum = checksumCalculator->getVersion() > 0;
6783
6784 unsigned char *ptr;
6785 unsigned char *buf;
6786 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6787 const size_t checksumSize = checksumCalculator->checksumByteSize();
6788 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6789 buf = stream->alloc(totalSize);
6790 ptr = buf;
6791 int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6792 memcpy(ptr, &totalSize, 4); ptr += 4;
6793
6794 memcpy(ptr, &mode, 4); ptr += 4;
6795 memcpy(ptr, &start, 4); ptr += 4;
6796 memcpy(ptr, &end, 4); ptr += 4;
6797 memcpy(ptr, &count, 4); ptr += 4;
6798 memcpy(ptr, &type, 4); ptr += 4;
6799 memcpy(ptr, &offset, 4); ptr += 4;
6800
6801 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6802 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6803
6804}
6805
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006806uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006807{
6808
6809 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6810 IOStream *stream = ctx->m_stream;
6811 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6812 bool useChecksum = checksumCalculator->getVersion() > 0;
6813
6814 unsigned char *ptr;
6815 unsigned char *buf;
6816 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6817 const size_t checksumSize = checksumCalculator->checksumByteSize();
6818 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6819 buf = stream->alloc(totalSize);
6820 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006821 int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006822 memcpy(ptr, &totalSize, 4); ptr += 4;
6823
6824 memcpy(ptr, &condition, 4); ptr += 4;
6825 memcpy(ptr, &flags, 4); ptr += 4;
6826
6827 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6828 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6829
6830
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006831 uint64_t retval;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006832 stream->readback(&retval, 8);
6833 if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
6834 if (useChecksum) {
6835 unsigned char *checksumBufPtr = NULL;
6836 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6837 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6838 stream->readback(checksumBufPtr, checksumSize);
6839 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006840 ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006841 abort();
6842 }
6843 }
6844 return retval;
6845}
6846
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006847GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006848{
6849
6850 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6851 IOStream *stream = ctx->m_stream;
6852 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6853 bool useChecksum = checksumCalculator->getVersion() > 0;
6854
6855 unsigned char *ptr;
6856 unsigned char *buf;
6857 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6858 const size_t checksumSize = checksumCalculator->checksumByteSize();
6859 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6860 buf = stream->alloc(totalSize);
6861 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006862 int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006863 memcpy(ptr, &totalSize, 4); ptr += 4;
6864
6865 memcpy(ptr, &wait_on, 8); ptr += 8;
6866 memcpy(ptr, &flags, 4); ptr += 4;
6867 memcpy(ptr, &timeout, 8); ptr += 8;
6868
6869 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6870 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6871
6872
6873 GLenum retval;
6874 stream->readback(&retval, 4);
6875 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6876 if (useChecksum) {
6877 unsigned char *checksumBufPtr = NULL;
6878 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6879 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6880 stream->readback(checksumBufPtr, checksumSize);
6881 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006882 ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006883 abort();
6884 }
6885 }
6886 return retval;
6887}
6888
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006889void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006890{
6891
6892 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6893 IOStream *stream = ctx->m_stream;
6894 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6895 bool useChecksum = checksumCalculator->getVersion() > 0;
6896
6897 unsigned char *ptr;
6898 unsigned char *buf;
6899 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6900 const size_t checksumSize = checksumCalculator->checksumByteSize();
6901 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6902 buf = stream->alloc(totalSize);
6903 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006904 int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006905 memcpy(ptr, &totalSize, 4); ptr += 4;
6906
6907 memcpy(ptr, &wait_on, 8); ptr += 8;
6908 memcpy(ptr, &flags, 4); ptr += 4;
6909 memcpy(ptr, &timeout, 8); ptr += 8;
6910
6911 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6912 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6913
6914}
6915
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006916void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006917{
6918
6919 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6920 IOStream *stream = ctx->m_stream;
6921 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6922 bool useChecksum = checksumCalculator->getVersion() > 0;
6923
6924 unsigned char *ptr;
6925 unsigned char *buf;
6926 const size_t sizeWithoutChecksum = 8 + 8;
6927 const size_t checksumSize = checksumCalculator->checksumByteSize();
6928 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6929 buf = stream->alloc(totalSize);
6930 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006931 int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006932 memcpy(ptr, &totalSize, 4); ptr += 4;
6933
6934 memcpy(ptr, &to_delete, 8); ptr += 8;
6935
6936 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6937 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6938
6939}
6940
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006941GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006942{
6943
6944 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6945 IOStream *stream = ctx->m_stream;
6946 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6947 bool useChecksum = checksumCalculator->getVersion() > 0;
6948
6949 unsigned char *ptr;
6950 unsigned char *buf;
6951 const size_t sizeWithoutChecksum = 8 + 8;
6952 const size_t checksumSize = checksumCalculator->checksumByteSize();
6953 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6954 buf = stream->alloc(totalSize);
6955 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006956 int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006957 memcpy(ptr, &totalSize, 4); ptr += 4;
6958
6959 memcpy(ptr, &sync, 8); ptr += 8;
6960
6961 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6962 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6963
6964
6965 GLboolean retval;
6966 stream->readback(&retval, 1);
6967 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6968 if (useChecksum) {
6969 unsigned char *checksumBufPtr = NULL;
6970 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6971 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6972 stream->readback(checksumBufPtr, checksumSize);
6973 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006974 ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006975 abort();
6976 }
6977 }
6978 return retval;
6979}
6980
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006981void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006982{
6983
6984 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6985 IOStream *stream = ctx->m_stream;
6986 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6987 bool useChecksum = checksumCalculator->getVersion() > 0;
6988
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08006989 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
6990 const unsigned int __size_values = (bufSize * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006991 unsigned char *ptr;
6992 unsigned char *buf;
6993 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4;
6994 const size_t checksumSize = checksumCalculator->checksumByteSize();
6995 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6996 buf = stream->alloc(totalSize);
6997 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006998 int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006999 memcpy(ptr, &totalSize, 4); ptr += 4;
7000
7001 memcpy(ptr, &sync, 8); ptr += 8;
7002 memcpy(ptr, &pname, 4); ptr += 4;
7003 memcpy(ptr, &bufSize, 4); ptr += 4;
7004 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7005 *(unsigned int *)(ptr) = __size_values; ptr += 4;
7006
7007 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7008 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7009
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08007010 if (length != NULL) {
7011 stream->readback(length, __size_length);
7012 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7013 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007014 stream->readback(values, __size_values);
7015 if (useChecksum) checksumCalculator->addBuffer(values, __size_values);
7016 if (useChecksum) {
7017 unsigned char *checksumBufPtr = NULL;
7018 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7019 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7020 stream->readback(checksumBufPtr, checksumSize);
7021 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08007022 ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007023 abort();
7024 }
7025 }
7026}
7027
7028void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs)
7029{
7030
7031 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7032 IOStream *stream = ctx->m_stream;
7033 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7034 bool useChecksum = checksumCalculator->getVersion() > 0;
7035
7036 const unsigned int __size_bufs = (n * sizeof(GLenum));
7037 unsigned char *ptr;
7038 unsigned char *buf;
7039 const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4;
7040 const size_t checksumSize = checksumCalculator->checksumByteSize();
7041 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7042 buf = stream->alloc(totalSize);
7043 ptr = buf;
7044 int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
7045 memcpy(ptr, &totalSize, 4); ptr += 4;
7046
7047 memcpy(ptr, &n, 4); ptr += 4;
7048 *(unsigned int *)(ptr) = __size_bufs; ptr += 4;
7049 memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs;
7050
7051 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7052 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7053
7054}
7055
7056void glReadBuffer_enc(void *self , GLenum src)
7057{
7058
7059 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7060 IOStream *stream = ctx->m_stream;
7061 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7062 bool useChecksum = checksumCalculator->getVersion() > 0;
7063
7064 unsigned char *ptr;
7065 unsigned char *buf;
7066 const size_t sizeWithoutChecksum = 8 + 4;
7067 const size_t checksumSize = checksumCalculator->checksumByteSize();
7068 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7069 buf = stream->alloc(totalSize);
7070 ptr = buf;
7071 int tmp = OP_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7072 memcpy(ptr, &totalSize, 4); ptr += 4;
7073
7074 memcpy(ptr, &src, 4); ptr += 4;
7075
7076 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7077 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7078
7079}
7080
7081void glBlitFramebuffer_enc(void *self , GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
7082{
7083
7084 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7085 IOStream *stream = ctx->m_stream;
7086 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7087 bool useChecksum = checksumCalculator->getVersion() > 0;
7088
7089 unsigned char *ptr;
7090 unsigned char *buf;
7091 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
7092 const size_t checksumSize = checksumCalculator->checksumByteSize();
7093 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7094 buf = stream->alloc(totalSize);
7095 ptr = buf;
7096 int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7097 memcpy(ptr, &totalSize, 4); ptr += 4;
7098
7099 memcpy(ptr, &srcX0, 4); ptr += 4;
7100 memcpy(ptr, &srcY0, 4); ptr += 4;
7101 memcpy(ptr, &srcX1, 4); ptr += 4;
7102 memcpy(ptr, &srcY1, 4); ptr += 4;
7103 memcpy(ptr, &dstX0, 4); ptr += 4;
7104 memcpy(ptr, &dstY0, 4); ptr += 4;
7105 memcpy(ptr, &dstX1, 4); ptr += 4;
7106 memcpy(ptr, &dstY1, 4); ptr += 4;
7107 memcpy(ptr, &mask, 4); ptr += 4;
7108 memcpy(ptr, &filter, 4); ptr += 4;
7109
7110 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7111 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7112
7113}
7114
7115void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
7116{
7117
7118 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7119 IOStream *stream = ctx->m_stream;
7120 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7121 bool useChecksum = checksumCalculator->getVersion() > 0;
7122
7123 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7124 unsigned char *ptr;
7125 unsigned char *buf;
7126 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
7127 const size_t checksumSize = checksumCalculator->checksumByteSize();
7128 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7129 buf = stream->alloc(totalSize);
7130 ptr = buf;
7131 int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7132 memcpy(ptr, &totalSize, 4); ptr += 4;
7133
7134 memcpy(ptr, &target, 4); ptr += 4;
7135 memcpy(ptr, &numAttachments, 4); ptr += 4;
7136 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7137 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7138
7139 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7140 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7141
7142}
7143
7144void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
7145{
7146
7147 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7148 IOStream *stream = ctx->m_stream;
7149 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7150 bool useChecksum = checksumCalculator->getVersion() > 0;
7151
7152 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7153 unsigned char *ptr;
7154 unsigned char *buf;
7155 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4;
7156 const size_t checksumSize = checksumCalculator->checksumByteSize();
7157 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7158 buf = stream->alloc(totalSize);
7159 ptr = buf;
7160 int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7161 memcpy(ptr, &totalSize, 4); ptr += 4;
7162
7163 memcpy(ptr, &target, 4); ptr += 4;
7164 memcpy(ptr, &numAttachments, 4); ptr += 4;
7165 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7166 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7167 memcpy(ptr, &x, 4); ptr += 4;
7168 memcpy(ptr, &y, 4); ptr += 4;
7169 memcpy(ptr, &width, 4); ptr += 4;
7170 memcpy(ptr, &height, 4); ptr += 4;
7171
7172 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7173 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7174
7175}
7176
7177void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
7178{
7179
7180 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7181 IOStream *stream = ctx->m_stream;
7182 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7183 bool useChecksum = checksumCalculator->getVersion() > 0;
7184
7185 unsigned char *ptr;
7186 unsigned char *buf;
7187 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7188 const size_t checksumSize = checksumCalculator->checksumByteSize();
7189 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7190 buf = stream->alloc(totalSize);
7191 ptr = buf;
7192 int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4;
7193 memcpy(ptr, &totalSize, 4); ptr += 4;
7194
7195 memcpy(ptr, &target, 4); ptr += 4;
7196 memcpy(ptr, &attachment, 4); ptr += 4;
7197 memcpy(ptr, &texture, 4); ptr += 4;
7198 memcpy(ptr, &level, 4); ptr += 4;
7199 memcpy(ptr, &layer, 4); ptr += 4;
7200
7201 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7202 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7203
7204}
7205
7206void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
7207{
7208
7209 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7210 IOStream *stream = ctx->m_stream;
7211 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7212 bool useChecksum = checksumCalculator->getVersion() > 0;
7213
7214 unsigned char *ptr;
7215 unsigned char *buf;
7216 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7217 const size_t checksumSize = checksumCalculator->checksumByteSize();
7218 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7219 buf = stream->alloc(totalSize);
7220 ptr = buf;
7221 int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
7222 memcpy(ptr, &totalSize, 4); ptr += 4;
7223
7224 memcpy(ptr, &target, 4); ptr += 4;
7225 memcpy(ptr, &samples, 4); ptr += 4;
7226 memcpy(ptr, &internalformat, 4); ptr += 4;
7227 memcpy(ptr, &width, 4); ptr += 4;
7228 memcpy(ptr, &height, 4); ptr += 4;
7229
7230 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7231 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7232
7233}
7234
7235void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
7236{
7237
7238 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7239 IOStream *stream = ctx->m_stream;
7240 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7241 bool useChecksum = checksumCalculator->getVersion() > 0;
7242
7243 unsigned char *ptr;
7244 unsigned char *buf;
7245 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7246 const size_t checksumSize = checksumCalculator->checksumByteSize();
7247 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7248 buf = stream->alloc(totalSize);
7249 ptr = buf;
7250 int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4;
7251 memcpy(ptr, &totalSize, 4); ptr += 4;
7252
7253 memcpy(ptr, &target, 4); ptr += 4;
7254 memcpy(ptr, &levels, 4); ptr += 4;
7255 memcpy(ptr, &internalformat, 4); ptr += 4;
7256 memcpy(ptr, &width, 4); ptr += 4;
7257 memcpy(ptr, &height, 4); ptr += 4;
7258
7259 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7260 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7261
7262}
7263
7264void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
7265{
7266
7267 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7268 IOStream *stream = ctx->m_stream;
7269 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7270 bool useChecksum = checksumCalculator->getVersion() > 0;
7271
7272 const unsigned int __size_params = (sizeof(GLint) * bufSize);
7273 unsigned char *ptr;
7274 unsigned char *buf;
7275 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
7276 const size_t checksumSize = checksumCalculator->checksumByteSize();
7277 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7278 buf = stream->alloc(totalSize);
7279 ptr = buf;
7280 int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4;
7281 memcpy(ptr, &totalSize, 4); ptr += 4;
7282
7283 memcpy(ptr, &target, 4); ptr += 4;
7284 memcpy(ptr, &internalformat, 4); ptr += 4;
7285 memcpy(ptr, &pname, 4); ptr += 4;
7286 memcpy(ptr, &bufSize, 4); ptr += 4;
7287 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7288
7289 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7290 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7291
7292 stream->readback(params, __size_params);
7293 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7294 if (useChecksum) {
7295 unsigned char *checksumBufPtr = NULL;
7296 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7297 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7298 stream->readback(checksumBufPtr, checksumSize);
7299 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7300 ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n");
7301 abort();
7302 }
7303 }
7304}
7305
7306void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode)
7307{
7308
7309 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7310 IOStream *stream = ctx->m_stream;
7311 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7312 bool useChecksum = checksumCalculator->getVersion() > 0;
7313
7314 unsigned char *ptr;
7315 unsigned char *buf;
7316 const size_t sizeWithoutChecksum = 8 + 4;
7317 const size_t checksumSize = checksumCalculator->checksumByteSize();
7318 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7319 buf = stream->alloc(totalSize);
7320 ptr = buf;
7321 int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7322 memcpy(ptr, &totalSize, 4); ptr += 4;
7323
7324 memcpy(ptr, &primitiveMode, 4); ptr += 4;
7325
7326 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7327 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7328
7329}
7330
7331void glEndTransformFeedback_enc(void *self )
7332{
7333
7334 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7335 IOStream *stream = ctx->m_stream;
7336 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7337 bool useChecksum = checksumCalculator->getVersion() > 0;
7338
7339 unsigned char *ptr;
7340 unsigned char *buf;
7341 const size_t sizeWithoutChecksum = 8;
7342 const size_t checksumSize = checksumCalculator->checksumByteSize();
7343 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7344 buf = stream->alloc(totalSize);
7345 ptr = buf;
7346 int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7347 memcpy(ptr, &totalSize, 4); ptr += 4;
7348
7349
7350 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7351 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7352
7353}
7354
7355void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids)
7356{
7357
7358 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7359 IOStream *stream = ctx->m_stream;
7360 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7361 bool useChecksum = checksumCalculator->getVersion() > 0;
7362
7363 const unsigned int __size_ids = (n * sizeof(GLuint));
7364 unsigned char *ptr;
7365 unsigned char *buf;
7366 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7367 const size_t checksumSize = checksumCalculator->checksumByteSize();
7368 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7369 buf = stream->alloc(totalSize);
7370 ptr = buf;
7371 int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7372 memcpy(ptr, &totalSize, 4); ptr += 4;
7373
7374 memcpy(ptr, &n, 4); ptr += 4;
7375 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7376
7377 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7378 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7379
7380 stream->readback(ids, __size_ids);
7381 if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids);
7382 if (useChecksum) {
7383 unsigned char *checksumBufPtr = NULL;
7384 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7385 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7386 stream->readback(checksumBufPtr, checksumSize);
7387 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7388 ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n");
7389 abort();
7390 }
7391 }
7392}
7393
7394void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids)
7395{
7396
7397 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7398 IOStream *stream = ctx->m_stream;
7399 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7400 bool useChecksum = checksumCalculator->getVersion() > 0;
7401
7402 const unsigned int __size_ids = (n * sizeof(GLuint));
7403 unsigned char *ptr;
7404 unsigned char *buf;
7405 const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4;
7406 const size_t checksumSize = checksumCalculator->checksumByteSize();
7407 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7408 buf = stream->alloc(totalSize);
7409 ptr = buf;
7410 int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7411 memcpy(ptr, &totalSize, 4); ptr += 4;
7412
7413 memcpy(ptr, &n, 4); ptr += 4;
7414 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7415 memcpy(ptr, ids, __size_ids);ptr += __size_ids;
7416
7417 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7418 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7419
7420}
7421
7422void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id)
7423{
7424
7425 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7426 IOStream *stream = ctx->m_stream;
7427 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7428 bool useChecksum = checksumCalculator->getVersion() > 0;
7429
7430 unsigned char *ptr;
7431 unsigned char *buf;
7432 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7433 const size_t checksumSize = checksumCalculator->checksumByteSize();
7434 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7435 buf = stream->alloc(totalSize);
7436 ptr = buf;
7437 int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7438 memcpy(ptr, &totalSize, 4); ptr += 4;
7439
7440 memcpy(ptr, &target, 4); ptr += 4;
7441 memcpy(ptr, &id, 4); ptr += 4;
7442
7443 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7444 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7445
7446}
7447
7448void glPauseTransformFeedback_enc(void *self )
7449{
7450
7451 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7452 IOStream *stream = ctx->m_stream;
7453 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7454 bool useChecksum = checksumCalculator->getVersion() > 0;
7455
7456 unsigned char *ptr;
7457 unsigned char *buf;
7458 const size_t sizeWithoutChecksum = 8;
7459 const size_t checksumSize = checksumCalculator->checksumByteSize();
7460 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7461 buf = stream->alloc(totalSize);
7462 ptr = buf;
7463 int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7464 memcpy(ptr, &totalSize, 4); ptr += 4;
7465
7466
7467 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7468 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7469
7470}
7471
7472void glResumeTransformFeedback_enc(void *self )
7473{
7474
7475 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7476 IOStream *stream = ctx->m_stream;
7477 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7478 bool useChecksum = checksumCalculator->getVersion() > 0;
7479
7480 unsigned char *ptr;
7481 unsigned char *buf;
7482 const size_t sizeWithoutChecksum = 8;
7483 const size_t checksumSize = checksumCalculator->checksumByteSize();
7484 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7485 buf = stream->alloc(totalSize);
7486 ptr = buf;
7487 int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7488 memcpy(ptr, &totalSize, 4); ptr += 4;
7489
7490
7491 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7492 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7493
7494}
7495
7496GLboolean glIsTransformFeedback_enc(void *self , GLuint id)
7497{
7498
7499 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7500 IOStream *stream = ctx->m_stream;
7501 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7502 bool useChecksum = checksumCalculator->getVersion() > 0;
7503
7504 unsigned char *ptr;
7505 unsigned char *buf;
7506 const size_t sizeWithoutChecksum = 8 + 4;
7507 const size_t checksumSize = checksumCalculator->checksumByteSize();
7508 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7509 buf = stream->alloc(totalSize);
7510 ptr = buf;
7511 int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7512 memcpy(ptr, &totalSize, 4); ptr += 4;
7513
7514 memcpy(ptr, &id, 4); ptr += 4;
7515
7516 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7517 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7518
7519
7520 GLboolean retval;
7521 stream->readback(&retval, 1);
7522 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7523 if (useChecksum) {
7524 unsigned char *checksumBufPtr = NULL;
7525 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7526 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7527 stream->readback(checksumBufPtr, checksumSize);
7528 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7529 ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n");
7530 abort();
7531 }
7532 }
7533 return retval;
7534}
7535
7536void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode)
7537{
7538
7539 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7540 IOStream *stream = ctx->m_stream;
7541 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7542 bool useChecksum = checksumCalculator->getVersion() > 0;
7543
7544 const unsigned int __size_packedVaryings = packedVaryingsLen;
7545 unsigned char *ptr;
7546 unsigned char *buf;
7547 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4;
7548 const size_t checksumSize = checksumCalculator->checksumByteSize();
7549 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7550 buf = stream->alloc(totalSize);
7551 ptr = buf;
7552 int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
7553 memcpy(ptr, &totalSize, 4); ptr += 4;
7554
7555 memcpy(ptr, &program, 4); ptr += 4;
7556 memcpy(ptr, &count, 4); ptr += 4;
7557 *(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4;
7558 memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings;
7559 memcpy(ptr, &packedVaryingsLen, 4); ptr += 4;
7560 memcpy(ptr, &bufferMode, 4); ptr += 4;
7561
7562 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7563 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7564
7565}
7566
7567void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name)
7568{
7569
7570 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7571 IOStream *stream = ctx->m_stream;
7572 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7573 bool useChecksum = checksumCalculator->getVersion() > 0;
7574
7575 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
7576 const unsigned int __size_size = (sizeof(GLsizei));
7577 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
7578 const unsigned int __size_name = ((name != NULL) ? bufSize : 0);
7579 unsigned char *ptr;
7580 unsigned char *buf;
7581 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
7582 const size_t checksumSize = checksumCalculator->checksumByteSize();
7583 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7584 buf = stream->alloc(totalSize);
7585 ptr = buf;
7586 int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4;
7587 memcpy(ptr, &totalSize, 4); ptr += 4;
7588
7589 memcpy(ptr, &program, 4); ptr += 4;
7590 memcpy(ptr, &index, 4); ptr += 4;
7591 memcpy(ptr, &bufSize, 4); ptr += 4;
7592 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7593 *(unsigned int *)(ptr) = __size_size; ptr += 4;
7594 *(unsigned int *)(ptr) = __size_type; ptr += 4;
7595 *(unsigned int *)(ptr) = __size_name; ptr += 4;
7596
7597 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7598 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7599
7600 if (length != NULL) {
7601 stream->readback(length, __size_length);
7602 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7603 }
7604 stream->readback(size, __size_size);
7605 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
7606 if (type != NULL) {
7607 stream->readback(type, __size_type);
7608 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
7609 }
7610 if (name != NULL) {
7611 stream->readback(name, __size_name);
7612 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
7613 }
7614 if (useChecksum) {
7615 unsigned char *checksumBufPtr = NULL;
7616 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7617 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7618 stream->readback(checksumBufPtr, checksumSize);
7619 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7620 ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n");
7621 abort();
7622 }
7623 }
7624}
7625
7626void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers)
7627{
7628
7629 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7630 IOStream *stream = ctx->m_stream;
7631 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7632 bool useChecksum = checksumCalculator->getVersion() > 0;
7633
7634 const unsigned int __size_samplers = (n * sizeof(GLuint));
7635 unsigned char *ptr;
7636 unsigned char *buf;
7637 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7638 const size_t checksumSize = checksumCalculator->checksumByteSize();
7639 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7640 buf = stream->alloc(totalSize);
7641 ptr = buf;
7642 int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7643 memcpy(ptr, &totalSize, 4); ptr += 4;
7644
7645 memcpy(ptr, &n, 4); ptr += 4;
7646 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7647
7648 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7649 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7650
7651 stream->readback(samplers, __size_samplers);
7652 if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers);
7653 if (useChecksum) {
7654 unsigned char *checksumBufPtr = NULL;
7655 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7656 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7657 stream->readback(checksumBufPtr, checksumSize);
7658 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7659 ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n");
7660 abort();
7661 }
7662 }
7663}
7664
7665void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers)
7666{
7667
7668 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7669 IOStream *stream = ctx->m_stream;
7670 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7671 bool useChecksum = checksumCalculator->getVersion() > 0;
7672
7673 const unsigned int __size_samplers = (n * sizeof(GLuint));
7674 unsigned char *ptr;
7675 unsigned char *buf;
7676 const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4;
7677 const size_t checksumSize = checksumCalculator->checksumByteSize();
7678 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7679 buf = stream->alloc(totalSize);
7680 ptr = buf;
7681 int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7682 memcpy(ptr, &totalSize, 4); ptr += 4;
7683
7684 memcpy(ptr, &n, 4); ptr += 4;
7685 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7686 memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers;
7687
7688 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7689 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7690
7691}
7692
7693void glBindSampler_enc(void *self , GLuint unit, GLuint sampler)
7694{
7695
7696 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7697 IOStream *stream = ctx->m_stream;
7698 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7699 bool useChecksum = checksumCalculator->getVersion() > 0;
7700
7701 unsigned char *ptr;
7702 unsigned char *buf;
7703 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7704 const size_t checksumSize = checksumCalculator->checksumByteSize();
7705 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7706 buf = stream->alloc(totalSize);
7707 ptr = buf;
7708 int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7709 memcpy(ptr, &totalSize, 4); ptr += 4;
7710
7711 memcpy(ptr, &unit, 4); ptr += 4;
7712 memcpy(ptr, &sampler, 4); ptr += 4;
7713
7714 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7715 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7716
7717}
7718
7719void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param)
7720{
7721
7722 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7723 IOStream *stream = ctx->m_stream;
7724 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7725 bool useChecksum = checksumCalculator->getVersion() > 0;
7726
7727 unsigned char *ptr;
7728 unsigned char *buf;
7729 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7730 const size_t checksumSize = checksumCalculator->checksumByteSize();
7731 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7732 buf = stream->alloc(totalSize);
7733 ptr = buf;
7734 int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
7735 memcpy(ptr, &totalSize, 4); ptr += 4;
7736
7737 memcpy(ptr, &sampler, 4); ptr += 4;
7738 memcpy(ptr, &pname, 4); ptr += 4;
7739 memcpy(ptr, &param, 4); ptr += 4;
7740
7741 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7742 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7743
7744}
7745
7746void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param)
7747{
7748
7749 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7750 IOStream *stream = ctx->m_stream;
7751 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7752 bool useChecksum = checksumCalculator->getVersion() > 0;
7753
7754 unsigned char *ptr;
7755 unsigned char *buf;
7756 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7757 const size_t checksumSize = checksumCalculator->checksumByteSize();
7758 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7759 buf = stream->alloc(totalSize);
7760 ptr = buf;
7761 int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
7762 memcpy(ptr, &totalSize, 4); ptr += 4;
7763
7764 memcpy(ptr, &sampler, 4); ptr += 4;
7765 memcpy(ptr, &pname, 4); ptr += 4;
7766 memcpy(ptr, &param, 4); ptr += 4;
7767
7768 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7769 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7770
7771}
7772
7773void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params)
7774{
7775
7776 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7777 IOStream *stream = ctx->m_stream;
7778 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7779 bool useChecksum = checksumCalculator->getVersion() > 0;
7780
7781 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7782 unsigned char *ptr;
7783 unsigned char *buf;
7784 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7785 const size_t checksumSize = checksumCalculator->checksumByteSize();
7786 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7787 buf = stream->alloc(totalSize);
7788 ptr = buf;
7789 int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7790 memcpy(ptr, &totalSize, 4); ptr += 4;
7791
7792 memcpy(ptr, &sampler, 4); ptr += 4;
7793 memcpy(ptr, &pname, 4); ptr += 4;
7794 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7795 memcpy(ptr, params, __size_params);ptr += __size_params;
7796
7797 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7798 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7799
7800}
7801
7802void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params)
7803{
7804
7805 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7806 IOStream *stream = ctx->m_stream;
7807 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7808 bool useChecksum = checksumCalculator->getVersion() > 0;
7809
7810 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7811 unsigned char *ptr;
7812 unsigned char *buf;
7813 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7814 const size_t checksumSize = checksumCalculator->checksumByteSize();
7815 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7816 buf = stream->alloc(totalSize);
7817 ptr = buf;
7818 int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7819 memcpy(ptr, &totalSize, 4); ptr += 4;
7820
7821 memcpy(ptr, &sampler, 4); ptr += 4;
7822 memcpy(ptr, &pname, 4); ptr += 4;
7823 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7824 memcpy(ptr, params, __size_params);ptr += __size_params;
7825
7826 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7827 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7828
7829}
7830
7831void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params)
7832{
7833
7834 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7835 IOStream *stream = ctx->m_stream;
7836 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7837 bool useChecksum = checksumCalculator->getVersion() > 0;
7838
7839 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7840 unsigned char *ptr;
7841 unsigned char *buf;
7842 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7843 const size_t checksumSize = checksumCalculator->checksumByteSize();
7844 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7845 buf = stream->alloc(totalSize);
7846 ptr = buf;
7847 int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7848 memcpy(ptr, &totalSize, 4); ptr += 4;
7849
7850 memcpy(ptr, &sampler, 4); ptr += 4;
7851 memcpy(ptr, &pname, 4); ptr += 4;
7852 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7853
7854 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7855 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7856
7857 stream->readback(params, __size_params);
7858 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7859 if (useChecksum) {
7860 unsigned char *checksumBufPtr = NULL;
7861 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7862 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7863 stream->readback(checksumBufPtr, checksumSize);
7864 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7865 ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n");
7866 abort();
7867 }
7868 }
7869}
7870
7871void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params)
7872{
7873
7874 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7875 IOStream *stream = ctx->m_stream;
7876 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7877 bool useChecksum = checksumCalculator->getVersion() > 0;
7878
7879 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7880 unsigned char *ptr;
7881 unsigned char *buf;
7882 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7883 const size_t checksumSize = checksumCalculator->checksumByteSize();
7884 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7885 buf = stream->alloc(totalSize);
7886 ptr = buf;
7887 int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7888 memcpy(ptr, &totalSize, 4); ptr += 4;
7889
7890 memcpy(ptr, &sampler, 4); ptr += 4;
7891 memcpy(ptr, &pname, 4); ptr += 4;
7892 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7893
7894 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7895 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7896
7897 stream->readback(params, __size_params);
7898 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7899 if (useChecksum) {
7900 unsigned char *checksumBufPtr = NULL;
7901 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7902 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7903 stream->readback(checksumBufPtr, checksumSize);
7904 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7905 ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n");
7906 abort();
7907 }
7908 }
7909}
7910
7911GLboolean glIsSampler_enc(void *self , GLuint sampler)
7912{
7913
7914 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7915 IOStream *stream = ctx->m_stream;
7916 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7917 bool useChecksum = checksumCalculator->getVersion() > 0;
7918
7919 unsigned char *ptr;
7920 unsigned char *buf;
7921 const size_t sizeWithoutChecksum = 8 + 4;
7922 const size_t checksumSize = checksumCalculator->checksumByteSize();
7923 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7924 buf = stream->alloc(totalSize);
7925 ptr = buf;
7926 int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7927 memcpy(ptr, &totalSize, 4); ptr += 4;
7928
7929 memcpy(ptr, &sampler, 4); ptr += 4;
7930
7931 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7932 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7933
7934
7935 GLboolean retval;
7936 stream->readback(&retval, 1);
7937 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7938 if (useChecksum) {
7939 unsigned char *checksumBufPtr = NULL;
7940 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7941 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7942 stream->readback(checksumBufPtr, checksumSize);
7943 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7944 ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n");
7945 abort();
7946 }
7947 }
7948 return retval;
7949}
7950
7951void glGenQueries_enc(void *self , GLsizei n, GLuint* queries)
7952{
7953
7954 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7955 IOStream *stream = ctx->m_stream;
7956 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7957 bool useChecksum = checksumCalculator->getVersion() > 0;
7958
7959 const unsigned int __size_queries = (n * sizeof(GLuint));
7960 unsigned char *ptr;
7961 unsigned char *buf;
7962 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7963 const size_t checksumSize = checksumCalculator->checksumByteSize();
7964 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7965 buf = stream->alloc(totalSize);
7966 ptr = buf;
7967 int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4;
7968 memcpy(ptr, &totalSize, 4); ptr += 4;
7969
7970 memcpy(ptr, &n, 4); ptr += 4;
7971 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
7972
7973 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7974 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7975
7976 stream->readback(queries, __size_queries);
7977 if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries);
7978 if (useChecksum) {
7979 unsigned char *checksumBufPtr = NULL;
7980 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7981 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7982 stream->readback(checksumBufPtr, checksumSize);
7983 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7984 ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n");
7985 abort();
7986 }
7987 }
7988}
7989
7990void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries)
7991{
7992
7993 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7994 IOStream *stream = ctx->m_stream;
7995 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7996 bool useChecksum = checksumCalculator->getVersion() > 0;
7997
7998 const unsigned int __size_queries = (n * sizeof(GLuint));
7999 unsigned char *ptr;
8000 unsigned char *buf;
8001 const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4;
8002 const size_t checksumSize = checksumCalculator->checksumByteSize();
8003 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8004 buf = stream->alloc(totalSize);
8005 ptr = buf;
8006 int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4;
8007 memcpy(ptr, &totalSize, 4); ptr += 4;
8008
8009 memcpy(ptr, &n, 4); ptr += 4;
8010 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
8011 memcpy(ptr, queries, __size_queries);ptr += __size_queries;
8012
8013 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8014 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8015
8016}
8017
8018void glBeginQuery_enc(void *self , GLenum target, GLuint query)
8019{
8020
8021 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8022 IOStream *stream = ctx->m_stream;
8023 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8024 bool useChecksum = checksumCalculator->getVersion() > 0;
8025
8026 unsigned char *ptr;
8027 unsigned char *buf;
8028 const size_t sizeWithoutChecksum = 8 + 4 + 4;
8029 const size_t checksumSize = checksumCalculator->checksumByteSize();
8030 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8031 buf = stream->alloc(totalSize);
8032 ptr = buf;
8033 int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8034 memcpy(ptr, &totalSize, 4); ptr += 4;
8035
8036 memcpy(ptr, &target, 4); ptr += 4;
8037 memcpy(ptr, &query, 4); ptr += 4;
8038
8039 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8040 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8041
8042}
8043
8044void glEndQuery_enc(void *self , GLenum target)
8045{
8046
8047 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8048 IOStream *stream = ctx->m_stream;
8049 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8050 bool useChecksum = checksumCalculator->getVersion() > 0;
8051
8052 unsigned char *ptr;
8053 unsigned char *buf;
8054 const size_t sizeWithoutChecksum = 8 + 4;
8055 const size_t checksumSize = checksumCalculator->checksumByteSize();
8056 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8057 buf = stream->alloc(totalSize);
8058 ptr = buf;
8059 int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8060 memcpy(ptr, &totalSize, 4); ptr += 4;
8061
8062 memcpy(ptr, &target, 4); ptr += 4;
8063
8064 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8065 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8066
8067}
8068
8069void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params)
8070{
8071
8072 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8073 IOStream *stream = ctx->m_stream;
8074 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8075 bool useChecksum = checksumCalculator->getVersion() > 0;
8076
8077 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
8078 unsigned char *ptr;
8079 unsigned char *buf;
8080 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8081 const size_t checksumSize = checksumCalculator->checksumByteSize();
8082 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8083 buf = stream->alloc(totalSize);
8084 ptr = buf;
8085 int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4;
8086 memcpy(ptr, &totalSize, 4); ptr += 4;
8087
8088 memcpy(ptr, &target, 4); ptr += 4;
8089 memcpy(ptr, &pname, 4); ptr += 4;
8090 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8091
8092 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8093 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8094
8095 stream->readback(params, __size_params);
8096 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8097 if (useChecksum) {
8098 unsigned char *checksumBufPtr = NULL;
8099 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8100 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8101 stream->readback(checksumBufPtr, checksumSize);
8102 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8103 ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n");
8104 abort();
8105 }
8106 }
8107}
8108
8109void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params)
8110{
8111
8112 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8113 IOStream *stream = ctx->m_stream;
8114 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8115 bool useChecksum = checksumCalculator->getVersion() > 0;
8116
8117 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
8118 unsigned char *ptr;
8119 unsigned char *buf;
8120 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8121 const size_t checksumSize = checksumCalculator->checksumByteSize();
8122 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8123 buf = stream->alloc(totalSize);
8124 ptr = buf;
8125 int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4;
8126 memcpy(ptr, &totalSize, 4); ptr += 4;
8127
8128 memcpy(ptr, &query, 4); ptr += 4;
8129 memcpy(ptr, &pname, 4); ptr += 4;
8130 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8131
8132 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8133 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8134
8135 stream->readback(params, __size_params);
8136 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8137 if (useChecksum) {
8138 unsigned char *checksumBufPtr = NULL;
8139 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8140 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8141 stream->readback(checksumBufPtr, checksumSize);
8142 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8143 ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n");
8144 abort();
8145 }
8146 }
8147}
8148
8149GLboolean glIsQuery_enc(void *self , GLuint query)
8150{
8151
8152 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8153 IOStream *stream = ctx->m_stream;
8154 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8155 bool useChecksum = checksumCalculator->getVersion() > 0;
8156
8157 unsigned char *ptr;
8158 unsigned char *buf;
8159 const size_t sizeWithoutChecksum = 8 + 4;
8160 const size_t checksumSize = checksumCalculator->checksumByteSize();
8161 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8162 buf = stream->alloc(totalSize);
8163 ptr = buf;
8164 int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8165 memcpy(ptr, &totalSize, 4); ptr += 4;
8166
8167 memcpy(ptr, &query, 4); ptr += 4;
8168
8169 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8170 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8171
8172
8173 GLboolean retval;
8174 stream->readback(&retval, 1);
8175 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
8176 if (useChecksum) {
8177 unsigned char *checksumBufPtr = NULL;
8178 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8179 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8180 stream->readback(checksumBufPtr, checksumSize);
8181 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8182 ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n");
8183 abort();
8184 }
8185 }
8186 return retval;
8187}
8188
8189void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value)
8190{
8191
8192 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8193 IOStream *stream = ctx->m_stream;
8194 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8195 bool useChecksum = checksumCalculator->getVersion() > 0;
8196
8197 unsigned char *ptr;
8198 unsigned char *buf;
8199 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
8200 const size_t checksumSize = checksumCalculator->checksumByteSize();
8201 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8202 buf = stream->alloc(totalSize);
8203 ptr = buf;
8204 int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
8205 memcpy(ptr, &totalSize, 4); ptr += 4;
8206
8207 memcpy(ptr, &program, 4); ptr += 4;
8208 memcpy(ptr, &pname, 4); ptr += 4;
8209 memcpy(ptr, &value, 4); ptr += 4;
8210
8211 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8212 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8213
8214}
8215
8216void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length)
8217{
8218
8219 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8220 IOStream *stream = ctx->m_stream;
8221 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8222 bool useChecksum = checksumCalculator->getVersion() > 0;
8223
8224 const unsigned int __size_binary = length;
8225 unsigned char *ptr;
8226 unsigned char *buf;
8227 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4;
8228 const size_t checksumSize = checksumCalculator->checksumByteSize();
8229 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8230 buf = stream->alloc(totalSize);
8231 ptr = buf;
8232 int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8233 memcpy(ptr, &totalSize, 4); ptr += 4;
8234
8235 memcpy(ptr, &program, 4); ptr += 4;
8236 memcpy(ptr, &binaryFormat, 4); ptr += 4;
8237 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8238 memcpy(ptr, binary, __size_binary);ptr += __size_binary;
8239 memcpy(ptr, &length, 4); ptr += 4;
8240
8241 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8242 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8243
8244}
8245
8246void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary)
8247{
8248
8249 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8250 IOStream *stream = ctx->m_stream;
8251 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8252 bool useChecksum = checksumCalculator->getVersion() > 0;
8253
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08008254 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008255 const unsigned int __size_binaryFormat = (sizeof(GLenum));
8256 const unsigned int __size_binary = bufSize;
8257 unsigned char *ptr;
8258 unsigned char *buf;
8259 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4;
8260 const size_t checksumSize = checksumCalculator->checksumByteSize();
8261 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8262 buf = stream->alloc(totalSize);
8263 ptr = buf;
8264 int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8265 memcpy(ptr, &totalSize, 4); ptr += 4;
8266
8267 memcpy(ptr, &program, 4); ptr += 4;
8268 memcpy(ptr, &bufSize, 4); ptr += 4;
8269 *(unsigned int *)(ptr) = __size_length; ptr += 4;
8270 *(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4;
8271 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8272
8273 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8274 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8275
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08008276 if (length != NULL) {
8277 stream->readback(length, __size_length);
8278 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
8279 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008280 stream->readback(binaryFormat, __size_binaryFormat);
8281 if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat);
8282 stream->readback(binary, __size_binary);
8283 if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary);
8284 if (useChecksum) {
8285 unsigned char *checksumBufPtr = NULL;
8286 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8287 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8288 stream->readback(checksumBufPtr, checksumSize);
8289 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8290 ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n");
8291 abort();
8292 }
8293 }
8294}
8295
8296GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name)
8297{
8298
8299 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8300 IOStream *stream = ctx->m_stream;
8301 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8302 bool useChecksum = checksumCalculator->getVersion() > 0;
8303
8304 const unsigned int __size_name = (strlen(name) + 1);
8305 unsigned char *ptr;
8306 unsigned char *buf;
8307 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
8308 const size_t checksumSize = checksumCalculator->checksumByteSize();
8309 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8310 buf = stream->alloc(totalSize);
8311 ptr = buf;
8312 int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4;
8313 memcpy(ptr, &totalSize, 4); ptr += 4;
8314
8315 memcpy(ptr, &program, 4); ptr += 4;
8316 *(unsigned int *)(ptr) = __size_name; ptr += 4;
8317 memcpy(ptr, name, __size_name);ptr += __size_name;
8318
8319 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8320 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8321
8322
8323 GLint retval;
8324 stream->readback(&retval, 4);
8325 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
8326 if (useChecksum) {
8327 unsigned char *checksumBufPtr = NULL;
8328 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8329 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8330 stream->readback(checksumBufPtr, checksumSize);
8331 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8332 ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n");
8333 abort();
8334 }
8335 }
8336 return retval;
8337}
8338
8339void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data)
8340{
8341
8342 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8343 IOStream *stream = ctx->m_stream;
8344 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8345 bool useChecksum = checksumCalculator->getVersion() > 0;
8346
8347 const unsigned int __size_data = (glUtilsParamSize(pname) * sizeof(GLint64));
8348 unsigned char *ptr;
8349 unsigned char *buf;
8350 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8351 const size_t checksumSize = checksumCalculator->checksumByteSize();
8352 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8353 buf = stream->alloc(totalSize);
8354 ptr = buf;
8355 int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4;
8356 memcpy(ptr, &totalSize, 4); ptr += 4;
8357
8358 memcpy(ptr, &pname, 4); ptr += 4;
8359 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8360
8361 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8362 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8363
8364 stream->readback(data, __size_data);
8365 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8366 if (useChecksum) {
8367 unsigned char *checksumBufPtr = NULL;
8368 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8369 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8370 stream->readback(checksumBufPtr, checksumSize);
8371 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8372 ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n");
8373 abort();
8374 }
8375 }
8376}
8377
8378void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data)
8379{
8380
8381 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8382 IOStream *stream = ctx->m_stream;
8383 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8384 bool useChecksum = checksumCalculator->getVersion() > 0;
8385
8386 const unsigned int __size_data = (sizeof(GLint));
8387 unsigned char *ptr;
8388 unsigned char *buf;
8389 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8390 const size_t checksumSize = checksumCalculator->checksumByteSize();
8391 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8392 buf = stream->alloc(totalSize);
8393 ptr = buf;
8394 int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4;
8395 memcpy(ptr, &totalSize, 4); ptr += 4;
8396
8397 memcpy(ptr, &target, 4); ptr += 4;
8398 memcpy(ptr, &index, 4); ptr += 4;
8399 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8400
8401 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8402 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8403
8404 stream->readback(data, __size_data);
8405 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8406 if (useChecksum) {
8407 unsigned char *checksumBufPtr = NULL;
8408 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8409 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8410 stream->readback(checksumBufPtr, checksumSize);
8411 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8412 ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n");
8413 abort();
8414 }
8415 }
8416}
8417
8418void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data)
8419{
8420
8421 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8422 IOStream *stream = ctx->m_stream;
8423 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8424 bool useChecksum = checksumCalculator->getVersion() > 0;
8425
8426 const unsigned int __size_data = (sizeof(GLint64));
8427 unsigned char *ptr;
8428 unsigned char *buf;
8429 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8430 const size_t checksumSize = checksumCalculator->checksumByteSize();
8431 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8432 buf = stream->alloc(totalSize);
8433 ptr = buf;
8434 int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4;
8435 memcpy(ptr, &totalSize, 4); ptr += 4;
8436
8437 memcpy(ptr, &target, 4); ptr += 4;
8438 memcpy(ptr, &index, 4); ptr += 4;
8439 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8440
8441 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8442 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8443
8444 stream->readback(data, __size_data);
8445 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8446 if (useChecksum) {
8447 unsigned char *checksumBufPtr = NULL;
8448 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8449 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8450 stream->readback(checksumBufPtr, checksumSize);
8451 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8452 ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n");
8453 abort();
8454 }
8455 }
8456}
8457
8458void 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)
8459{
8460
8461 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8462 IOStream *stream = ctx->m_stream;
8463 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8464 bool useChecksum = checksumCalculator->getVersion() > 0;
8465
8466 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8467 unsigned char *ptr;
8468 unsigned char *buf;
8469 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8470 const size_t checksumSize = checksumCalculator->checksumByteSize();
8471 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8472 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8473 ptr = buf;
8474 int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8475 memcpy(ptr, &totalSize, 4); ptr += 4;
8476
8477 memcpy(ptr, &target, 4); ptr += 4;
8478 memcpy(ptr, &level, 4); ptr += 4;
8479 memcpy(ptr, &internalFormat, 4); ptr += 4;
8480 memcpy(ptr, &width, 4); ptr += 4;
8481 memcpy(ptr, &height, 4); ptr += 4;
8482 memcpy(ptr, &depth, 4); ptr += 4;
8483 memcpy(ptr, &border, 4); ptr += 4;
8484 memcpy(ptr, &format, 4); ptr += 4;
8485 memcpy(ptr, &type, 4); ptr += 4;
8486
8487 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8488 stream->flush();
8489 stream->writeFully(&__size_data,4);
8490 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8491 if (data != NULL) {
8492 stream->writeFully(data, __size_data);
8493 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8494 }
8495 buf = stream->alloc(checksumSize);
8496 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8497
8498}
8499
8500void glTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLuint offset)
8501{
8502
8503 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8504 IOStream *stream = ctx->m_stream;
8505 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8506 bool useChecksum = checksumCalculator->getVersion() > 0;
8507
8508 unsigned char *ptr;
8509 unsigned char *buf;
8510 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8511 const size_t checksumSize = checksumCalculator->checksumByteSize();
8512 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8513 buf = stream->alloc(totalSize);
8514 ptr = buf;
8515 int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8516 memcpy(ptr, &totalSize, 4); ptr += 4;
8517
8518 memcpy(ptr, &target, 4); ptr += 4;
8519 memcpy(ptr, &level, 4); ptr += 4;
8520 memcpy(ptr, &internalFormat, 4); ptr += 4;
8521 memcpy(ptr, &width, 4); ptr += 4;
8522 memcpy(ptr, &height, 4); ptr += 4;
8523 memcpy(ptr, &depth, 4); ptr += 4;
8524 memcpy(ptr, &border, 4); ptr += 4;
8525 memcpy(ptr, &format, 4); ptr += 4;
8526 memcpy(ptr, &type, 4); ptr += 4;
8527 memcpy(ptr, &offset, 4); ptr += 4;
8528
8529 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8530 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8531
8532}
8533
8534void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
8535{
8536
8537 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8538 IOStream *stream = ctx->m_stream;
8539 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8540 bool useChecksum = checksumCalculator->getVersion() > 0;
8541
8542 unsigned char *ptr;
8543 unsigned char *buf;
8544 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
8545 const size_t checksumSize = checksumCalculator->checksumByteSize();
8546 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8547 buf = stream->alloc(totalSize);
8548 ptr = buf;
8549 int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8550 memcpy(ptr, &totalSize, 4); ptr += 4;
8551
8552 memcpy(ptr, &target, 4); ptr += 4;
8553 memcpy(ptr, &levels, 4); ptr += 4;
8554 memcpy(ptr, &internalformat, 4); ptr += 4;
8555 memcpy(ptr, &width, 4); ptr += 4;
8556 memcpy(ptr, &height, 4); ptr += 4;
8557 memcpy(ptr, &depth, 4); ptr += 4;
8558
8559 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8560 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8561
8562}
8563
8564void 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)
8565{
8566
8567 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8568 IOStream *stream = ctx->m_stream;
8569 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8570 bool useChecksum = checksumCalculator->getVersion() > 0;
8571
8572 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8573 unsigned char *ptr;
8574 unsigned char *buf;
8575 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8576 const size_t checksumSize = checksumCalculator->checksumByteSize();
8577 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8578 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8579 ptr = buf;
8580 int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8581 memcpy(ptr, &totalSize, 4); ptr += 4;
8582
8583 memcpy(ptr, &target, 4); ptr += 4;
8584 memcpy(ptr, &level, 4); ptr += 4;
8585 memcpy(ptr, &xoffset, 4); ptr += 4;
8586 memcpy(ptr, &yoffset, 4); ptr += 4;
8587 memcpy(ptr, &zoffset, 4); ptr += 4;
8588 memcpy(ptr, &width, 4); ptr += 4;
8589 memcpy(ptr, &height, 4); ptr += 4;
8590 memcpy(ptr, &depth, 4); ptr += 4;
8591 memcpy(ptr, &format, 4); ptr += 4;
8592 memcpy(ptr, &type, 4); ptr += 4;
8593
8594 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8595 stream->flush();
8596 stream->writeFully(&__size_data,4);
8597 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8598 if (data != NULL) {
8599 stream->writeFully(data, __size_data);
8600 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8601 }
8602 buf = stream->alloc(checksumSize);
8603 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8604
8605}
8606
8607void 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)
8608{
8609
8610 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8611 IOStream *stream = ctx->m_stream;
8612 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8613 bool useChecksum = checksumCalculator->getVersion() > 0;
8614
8615 unsigned char *ptr;
8616 unsigned char *buf;
8617 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8618 const size_t checksumSize = checksumCalculator->checksumByteSize();
8619 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8620 buf = stream->alloc(totalSize);
8621 ptr = buf;
8622 int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8623 memcpy(ptr, &totalSize, 4); ptr += 4;
8624
8625 memcpy(ptr, &target, 4); ptr += 4;
8626 memcpy(ptr, &level, 4); ptr += 4;
8627 memcpy(ptr, &xoffset, 4); ptr += 4;
8628 memcpy(ptr, &yoffset, 4); ptr += 4;
8629 memcpy(ptr, &zoffset, 4); ptr += 4;
8630 memcpy(ptr, &width, 4); ptr += 4;
8631 memcpy(ptr, &height, 4); ptr += 4;
8632 memcpy(ptr, &depth, 4); ptr += 4;
8633 memcpy(ptr, &format, 4); ptr += 4;
8634 memcpy(ptr, &type, 4); ptr += 4;
8635 memcpy(ptr, &offset, 4); ptr += 4;
8636
8637 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8638 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8639
8640}
8641
8642void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
8643{
8644
8645 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8646 IOStream *stream = ctx->m_stream;
8647 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8648 bool useChecksum = checksumCalculator->getVersion() > 0;
8649
8650 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8651 unsigned char *ptr;
8652 unsigned char *buf;
8653 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8654 const size_t checksumSize = checksumCalculator->checksumByteSize();
8655 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8656 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8657 ptr = buf;
8658 int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8659 memcpy(ptr, &totalSize, 4); ptr += 4;
8660
8661 memcpy(ptr, &target, 4); ptr += 4;
8662 memcpy(ptr, &level, 4); ptr += 4;
8663 memcpy(ptr, &internalformat, 4); ptr += 4;
8664 memcpy(ptr, &width, 4); ptr += 4;
8665 memcpy(ptr, &height, 4); ptr += 4;
8666 memcpy(ptr, &depth, 4); ptr += 4;
8667 memcpy(ptr, &border, 4); ptr += 4;
8668 memcpy(ptr, &imageSize, 4); ptr += 4;
8669
8670 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8671 stream->flush();
8672 stream->writeFully(&__size_data,4);
8673 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8674 if (data != NULL) {
8675 stream->writeFully(data, __size_data);
8676 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8677 }
8678 buf = stream->alloc(checksumSize);
8679 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8680
8681}
8682
8683void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset)
8684{
8685
8686 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8687 IOStream *stream = ctx->m_stream;
8688 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8689 bool useChecksum = checksumCalculator->getVersion() > 0;
8690
8691 unsigned char *ptr;
8692 unsigned char *buf;
8693 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8694 const size_t checksumSize = checksumCalculator->checksumByteSize();
8695 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8696 buf = stream->alloc(totalSize);
8697 ptr = buf;
8698 int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8699 memcpy(ptr, &totalSize, 4); ptr += 4;
8700
8701 memcpy(ptr, &target, 4); ptr += 4;
8702 memcpy(ptr, &level, 4); ptr += 4;
8703 memcpy(ptr, &internalformat, 4); ptr += 4;
8704 memcpy(ptr, &width, 4); ptr += 4;
8705 memcpy(ptr, &height, 4); ptr += 4;
8706 memcpy(ptr, &depth, 4); ptr += 4;
8707 memcpy(ptr, &border, 4); ptr += 4;
8708 memcpy(ptr, &imageSize, 4); ptr += 4;
8709 memcpy(ptr, &offset, 4); ptr += 4;
8710
8711 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8712 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8713
8714}
8715
8716void 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)
8717{
8718
8719 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8720 IOStream *stream = ctx->m_stream;
8721 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8722 bool useChecksum = checksumCalculator->getVersion() > 0;
8723
8724 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8725 unsigned char *ptr;
8726 unsigned char *buf;
8727 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8728 const size_t checksumSize = checksumCalculator->checksumByteSize();
8729 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8730 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8731 ptr = buf;
8732 int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8733 memcpy(ptr, &totalSize, 4); ptr += 4;
8734
8735 memcpy(ptr, &target, 4); ptr += 4;
8736 memcpy(ptr, &level, 4); ptr += 4;
8737 memcpy(ptr, &xoffset, 4); ptr += 4;
8738 memcpy(ptr, &yoffset, 4); ptr += 4;
8739 memcpy(ptr, &zoffset, 4); ptr += 4;
8740 memcpy(ptr, &width, 4); ptr += 4;
8741 memcpy(ptr, &height, 4); ptr += 4;
8742 memcpy(ptr, &depth, 4); ptr += 4;
8743 memcpy(ptr, &format, 4); ptr += 4;
8744 memcpy(ptr, &imageSize, 4); ptr += 4;
8745
8746 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8747 stream->flush();
8748 stream->writeFully(&__size_data,4);
8749 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8750 if (data != NULL) {
8751 stream->writeFully(data, __size_data);
8752 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8753 }
8754 buf = stream->alloc(checksumSize);
8755 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8756
8757}
8758
8759void 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)
8760{
8761
8762 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8763 IOStream *stream = ctx->m_stream;
8764 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8765 bool useChecksum = checksumCalculator->getVersion() > 0;
8766
8767 unsigned char *ptr;
8768 unsigned char *buf;
8769 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8770 const size_t checksumSize = checksumCalculator->checksumByteSize();
8771 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8772 buf = stream->alloc(totalSize);
8773 ptr = buf;
8774 int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8775 memcpy(ptr, &totalSize, 4); ptr += 4;
8776
8777 memcpy(ptr, &target, 4); ptr += 4;
8778 memcpy(ptr, &level, 4); ptr += 4;
8779 memcpy(ptr, &xoffset, 4); ptr += 4;
8780 memcpy(ptr, &yoffset, 4); ptr += 4;
8781 memcpy(ptr, &zoffset, 4); ptr += 4;
8782 memcpy(ptr, &width, 4); ptr += 4;
8783 memcpy(ptr, &height, 4); ptr += 4;
8784 memcpy(ptr, &depth, 4); ptr += 4;
8785 memcpy(ptr, &format, 4); ptr += 4;
8786 memcpy(ptr, &imageSize, 4); ptr += 4;
8787 memcpy(ptr, &data, 4); ptr += 4;
8788
8789 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8790 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8791
8792}
8793
8794void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
8795{
8796
8797 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8798 IOStream *stream = ctx->m_stream;
8799 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8800 bool useChecksum = checksumCalculator->getVersion() > 0;
8801
8802 unsigned char *ptr;
8803 unsigned char *buf;
8804 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8805 const size_t checksumSize = checksumCalculator->checksumByteSize();
8806 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8807 buf = stream->alloc(totalSize);
8808 ptr = buf;
8809 int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8810 memcpy(ptr, &totalSize, 4); ptr += 4;
8811
8812 memcpy(ptr, &target, 4); ptr += 4;
8813 memcpy(ptr, &level, 4); ptr += 4;
8814 memcpy(ptr, &xoffset, 4); ptr += 4;
8815 memcpy(ptr, &yoffset, 4); ptr += 4;
8816 memcpy(ptr, &zoffset, 4); ptr += 4;
8817 memcpy(ptr, &x, 4); ptr += 4;
8818 memcpy(ptr, &y, 4); ptr += 4;
8819 memcpy(ptr, &width, 4); ptr += 4;
8820 memcpy(ptr, &height, 4); ptr += 4;
8821
8822 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8823 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8824
8825}
8826
8827void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data)
8828{
8829
8830 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8831 IOStream *stream = ctx->m_stream;
8832 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8833 bool useChecksum = checksumCalculator->getVersion() > 0;
8834
8835 const unsigned int __size_data = (sizeof(GLboolean));
8836 unsigned char *ptr;
8837 unsigned char *buf;
8838 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8839 const size_t checksumSize = checksumCalculator->checksumByteSize();
8840 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8841 buf = stream->alloc(totalSize);
8842 ptr = buf;
8843 int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4;
8844 memcpy(ptr, &totalSize, 4); ptr += 4;
8845
8846 memcpy(ptr, &target, 4); ptr += 4;
8847 memcpy(ptr, &index, 4); ptr += 4;
8848 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8849
8850 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8851 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8852
8853 stream->readback(data, __size_data);
8854 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8855 if (useChecksum) {
8856 unsigned char *checksumBufPtr = NULL;
8857 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8858 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8859 stream->readback(checksumBufPtr, checksumSize);
8860 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8861 ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n");
8862 abort();
8863 }
8864 }
8865}
8866
8867void glMemoryBarrier_enc(void *self , GLbitfield barriers)
8868{
8869
8870 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8871 IOStream *stream = ctx->m_stream;
8872 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8873 bool useChecksum = checksumCalculator->getVersion() > 0;
8874
8875 unsigned char *ptr;
8876 unsigned char *buf;
8877 const size_t sizeWithoutChecksum = 8 + 4;
8878 const size_t checksumSize = checksumCalculator->checksumByteSize();
8879 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8880 buf = stream->alloc(totalSize);
8881 ptr = buf;
8882 int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4;
8883 memcpy(ptr, &totalSize, 4); ptr += 4;
8884
8885 memcpy(ptr, &barriers, 4); ptr += 4;
8886
8887 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8888 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8889
8890}
8891
8892void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers)
8893{
8894
8895 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8896 IOStream *stream = ctx->m_stream;
8897 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8898 bool useChecksum = checksumCalculator->getVersion() > 0;
8899
8900 unsigned char *ptr;
8901 unsigned char *buf;
8902 const size_t sizeWithoutChecksum = 8 + 4;
8903 const size_t checksumSize = checksumCalculator->checksumByteSize();
8904 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8905 buf = stream->alloc(totalSize);
8906 ptr = buf;
8907 int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4;
8908 memcpy(ptr, &totalSize, 4); ptr += 4;
8909
8910 memcpy(ptr, &barriers, 4); ptr += 4;
8911
8912 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8913 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8914
8915}
8916
8917void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines)
8918{
8919
8920 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8921 IOStream *stream = ctx->m_stream;
8922 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8923 bool useChecksum = checksumCalculator->getVersion() > 0;
8924
8925 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8926 unsigned char *ptr;
8927 unsigned char *buf;
8928 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8929 const size_t checksumSize = checksumCalculator->checksumByteSize();
8930 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8931 buf = stream->alloc(totalSize);
8932 ptr = buf;
8933 int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8934 memcpy(ptr, &totalSize, 4); ptr += 4;
8935
8936 memcpy(ptr, &n, 4); ptr += 4;
8937 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8938
8939 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8940 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8941
8942 stream->readback(pipelines, __size_pipelines);
8943 if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines);
8944 if (useChecksum) {
8945 unsigned char *checksumBufPtr = NULL;
8946 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8947 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8948 stream->readback(checksumBufPtr, checksumSize);
8949 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8950 ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n");
8951 abort();
8952 }
8953 }
8954}
8955
8956void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines)
8957{
8958
8959 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8960 IOStream *stream = ctx->m_stream;
8961 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8962 bool useChecksum = checksumCalculator->getVersion() > 0;
8963
8964 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8965 unsigned char *ptr;
8966 unsigned char *buf;
8967 const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4;
8968 const size_t checksumSize = checksumCalculator->checksumByteSize();
8969 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8970 buf = stream->alloc(totalSize);
8971 ptr = buf;
8972 int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8973 memcpy(ptr, &totalSize, 4); ptr += 4;
8974
8975 memcpy(ptr, &n, 4); ptr += 4;
8976 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8977 memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines;
8978
8979 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8980 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8981
8982}
8983
8984void glBindProgramPipeline_enc(void *self , GLuint pipeline)
8985{
8986
8987 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8988 IOStream *stream = ctx->m_stream;
8989 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8990 bool useChecksum = checksumCalculator->getVersion() > 0;
8991
8992 unsigned char *ptr;
8993 unsigned char *buf;
8994 const size_t sizeWithoutChecksum = 8 + 4;
8995 const size_t checksumSize = checksumCalculator->checksumByteSize();
8996 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8997 buf = stream->alloc(totalSize);
8998 ptr = buf;
8999 int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9000 memcpy(ptr, &totalSize, 4); ptr += 4;
9001
9002 memcpy(ptr, &pipeline, 4); ptr += 4;
9003
9004 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9005 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9006
9007}
9008
9009void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params)
9010{
9011
9012 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9013 IOStream *stream = ctx->m_stream;
9014 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9015 bool useChecksum = checksumCalculator->getVersion() > 0;
9016
9017 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
9018 unsigned char *ptr;
9019 unsigned char *buf;
9020 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
9021 const size_t checksumSize = checksumCalculator->checksumByteSize();
9022 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9023 buf = stream->alloc(totalSize);
9024 ptr = buf;
9025 int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4;
9026 memcpy(ptr, &totalSize, 4); ptr += 4;
9027
9028 memcpy(ptr, &pipeline, 4); ptr += 4;
9029 memcpy(ptr, &pname, 4); ptr += 4;
9030 *(unsigned int *)(ptr) = __size_params; ptr += 4;
9031
9032 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9033 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9034
9035 stream->readback(params, __size_params);
9036 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
9037 if (useChecksum) {
9038 unsigned char *checksumBufPtr = NULL;
9039 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9040 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9041 stream->readback(checksumBufPtr, checksumSize);
9042 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9043 ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n");
9044 abort();
9045 }
9046 }
9047}
9048
9049void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog)
9050{
9051
9052 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9053 IOStream *stream = ctx->m_stream;
9054 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9055 bool useChecksum = checksumCalculator->getVersion() > 0;
9056
9057 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
9058 const unsigned int __size_infoLog = bufSize;
9059 unsigned char *ptr;
9060 unsigned char *buf;
9061 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
9062 const size_t checksumSize = checksumCalculator->checksumByteSize();
9063 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9064 buf = stream->alloc(totalSize);
9065 ptr = buf;
9066 int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
9067 memcpy(ptr, &totalSize, 4); ptr += 4;
9068
9069 memcpy(ptr, &pipeline, 4); ptr += 4;
9070 memcpy(ptr, &bufSize, 4); ptr += 4;
9071 *(unsigned int *)(ptr) = __size_length; ptr += 4;
9072 *(unsigned int *)(ptr) = __size_infoLog; ptr += 4;
9073
9074 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9075 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9076
9077 if (length != NULL) {
9078 stream->readback(length, __size_length);
9079 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
9080 }
9081 stream->readback(infoLog, __size_infoLog);
9082 if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog);
9083 if (useChecksum) {
9084 unsigned char *checksumBufPtr = NULL;
9085 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9086 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9087 stream->readback(checksumBufPtr, checksumSize);
9088 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9089 ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n");
9090 abort();
9091 }
9092 }
9093}
9094
9095void glValidateProgramPipeline_enc(void *self , GLuint pipeline)
9096{
9097
9098 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9099 IOStream *stream = ctx->m_stream;
9100 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9101 bool useChecksum = checksumCalculator->getVersion() > 0;
9102
9103 unsigned char *ptr;
9104 unsigned char *buf;
9105 const size_t sizeWithoutChecksum = 8 + 4;
9106 const size_t checksumSize = checksumCalculator->checksumByteSize();
9107 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9108 buf = stream->alloc(totalSize);
9109 ptr = buf;
9110 int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9111 memcpy(ptr, &totalSize, 4); ptr += 4;
9112
9113 memcpy(ptr, &pipeline, 4); ptr += 4;
9114
9115 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9116 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9117
9118}
9119
9120GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline)
9121{
9122
9123 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9124 IOStream *stream = ctx->m_stream;
9125 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9126 bool useChecksum = checksumCalculator->getVersion() > 0;
9127
9128 unsigned char *ptr;
9129 unsigned char *buf;
9130 const size_t sizeWithoutChecksum = 8 + 4;
9131 const size_t checksumSize = checksumCalculator->checksumByteSize();
9132 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9133 buf = stream->alloc(totalSize);
9134 ptr = buf;
9135 int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9136 memcpy(ptr, &totalSize, 4); ptr += 4;
9137
9138 memcpy(ptr, &pipeline, 4); ptr += 4;
9139
9140 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9141 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9142
9143
9144 GLboolean retval;
9145 stream->readback(&retval, 1);
9146 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
9147 if (useChecksum) {
9148 unsigned char *checksumBufPtr = NULL;
9149 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9150 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9151 stream->readback(checksumBufPtr, checksumSize);
9152 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9153 ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n");
9154 abort();
9155 }
9156 }
9157 return retval;
9158}
9159
9160void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program)
9161{
9162
9163 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9164 IOStream *stream = ctx->m_stream;
9165 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9166 bool useChecksum = checksumCalculator->getVersion() > 0;
9167
9168 unsigned char *ptr;
9169 unsigned char *buf;
9170 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9171 const size_t checksumSize = checksumCalculator->checksumByteSize();
9172 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9173 buf = stream->alloc(totalSize);
9174 ptr = buf;
9175 int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4;
9176 memcpy(ptr, &totalSize, 4); ptr += 4;
9177
9178 memcpy(ptr, &pipeline, 4); ptr += 4;
9179 memcpy(ptr, &stages, 4); ptr += 4;
9180 memcpy(ptr, &program, 4); ptr += 4;
9181
9182 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9183 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9184
9185}
9186
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009187void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program)
9188{
9189
9190 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9191 IOStream *stream = ctx->m_stream;
9192 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9193 bool useChecksum = checksumCalculator->getVersion() > 0;
9194
9195 unsigned char *ptr;
9196 unsigned char *buf;
9197 const size_t sizeWithoutChecksum = 8 + 4 + 4;
9198 const size_t checksumSize = checksumCalculator->checksumByteSize();
9199 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9200 buf = stream->alloc(totalSize);
9201 ptr = buf;
9202 int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4;
9203 memcpy(ptr, &totalSize, 4); ptr += 4;
9204
9205 memcpy(ptr, &pipeline, 4); ptr += 4;
9206 memcpy(ptr, &program, 4); ptr += 4;
9207
9208 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9209 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9210
9211}
9212
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009213GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen)
9214{
9215
9216 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9217 IOStream *stream = ctx->m_stream;
9218 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9219 bool useChecksum = checksumCalculator->getVersion() > 0;
9220
9221 const unsigned int __size_packedStrings = packedLen;
9222 unsigned char *ptr;
9223 unsigned char *buf;
9224 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4;
9225 const size_t checksumSize = checksumCalculator->checksumByteSize();
9226 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9227 buf = stream->alloc(totalSize);
9228 ptr = buf;
9229 int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
9230 memcpy(ptr, &totalSize, 4); ptr += 4;
9231
9232 memcpy(ptr, &type, 4); ptr += 4;
9233 memcpy(ptr, &count, 4); ptr += 4;
9234 *(unsigned int *)(ptr) = __size_packedStrings; ptr += 4;
9235 memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings;
9236 memcpy(ptr, &packedLen, 4); ptr += 4;
9237
9238 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9239 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9240
9241
9242 GLuint retval;
9243 stream->readback(&retval, 4);
9244 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
9245 if (useChecksum) {
9246 unsigned char *checksumBufPtr = NULL;
9247 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9248 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9249 stream->readback(checksumBufPtr, checksumSize);
9250 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9251 ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n");
9252 abort();
9253 }
9254 }
9255 return retval;
9256}
9257
9258void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0)
9259{
9260
9261 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9262 IOStream *stream = ctx->m_stream;
9263 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9264 bool useChecksum = checksumCalculator->getVersion() > 0;
9265
9266 unsigned char *ptr;
9267 unsigned char *buf;
9268 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9269 const size_t checksumSize = checksumCalculator->checksumByteSize();
9270 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9271 buf = stream->alloc(totalSize);
9272 ptr = buf;
9273 int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
9274 memcpy(ptr, &totalSize, 4); ptr += 4;
9275
9276 memcpy(ptr, &program, 4); ptr += 4;
9277 memcpy(ptr, &location, 4); ptr += 4;
9278 memcpy(ptr, &v0, 4); ptr += 4;
9279
9280 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9281 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9282
9283}
9284
9285void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1)
9286{
9287
9288 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9289 IOStream *stream = ctx->m_stream;
9290 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9291 bool useChecksum = checksumCalculator->getVersion() > 0;
9292
9293 unsigned char *ptr;
9294 unsigned char *buf;
9295 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9296 const size_t checksumSize = checksumCalculator->checksumByteSize();
9297 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9298 buf = stream->alloc(totalSize);
9299 ptr = buf;
9300 int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
9301 memcpy(ptr, &totalSize, 4); ptr += 4;
9302
9303 memcpy(ptr, &program, 4); ptr += 4;
9304 memcpy(ptr, &location, 4); ptr += 4;
9305 memcpy(ptr, &v0, 4); ptr += 4;
9306 memcpy(ptr, &v1, 4); ptr += 4;
9307
9308 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9309 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9310
9311}
9312
9313void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
9314{
9315
9316 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9317 IOStream *stream = ctx->m_stream;
9318 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9319 bool useChecksum = checksumCalculator->getVersion() > 0;
9320
9321 unsigned char *ptr;
9322 unsigned char *buf;
9323 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9324 const size_t checksumSize = checksumCalculator->checksumByteSize();
9325 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9326 buf = stream->alloc(totalSize);
9327 ptr = buf;
9328 int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
9329 memcpy(ptr, &totalSize, 4); ptr += 4;
9330
9331 memcpy(ptr, &program, 4); ptr += 4;
9332 memcpy(ptr, &location, 4); ptr += 4;
9333 memcpy(ptr, &v0, 4); ptr += 4;
9334 memcpy(ptr, &v1, 4); ptr += 4;
9335 memcpy(ptr, &v2, 4); ptr += 4;
9336
9337 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9338 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9339
9340}
9341
9342void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
9343{
9344
9345 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9346 IOStream *stream = ctx->m_stream;
9347 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9348 bool useChecksum = checksumCalculator->getVersion() > 0;
9349
9350 unsigned char *ptr;
9351 unsigned char *buf;
9352 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9353 const size_t checksumSize = checksumCalculator->checksumByteSize();
9354 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9355 buf = stream->alloc(totalSize);
9356 ptr = buf;
9357 int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
9358 memcpy(ptr, &totalSize, 4); ptr += 4;
9359
9360 memcpy(ptr, &program, 4); ptr += 4;
9361 memcpy(ptr, &location, 4); ptr += 4;
9362 memcpy(ptr, &v0, 4); ptr += 4;
9363 memcpy(ptr, &v1, 4); ptr += 4;
9364 memcpy(ptr, &v2, 4); ptr += 4;
9365 memcpy(ptr, &v3, 4); ptr += 4;
9366
9367 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9368 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9369
9370}
9371
9372void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0)
9373{
9374
9375 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9376 IOStream *stream = ctx->m_stream;
9377 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9378 bool useChecksum = checksumCalculator->getVersion() > 0;
9379
9380 unsigned char *ptr;
9381 unsigned char *buf;
9382 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9383 const size_t checksumSize = checksumCalculator->checksumByteSize();
9384 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9385 buf = stream->alloc(totalSize);
9386 ptr = buf;
9387 int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
9388 memcpy(ptr, &totalSize, 4); ptr += 4;
9389
9390 memcpy(ptr, &program, 4); ptr += 4;
9391 memcpy(ptr, &location, 4); ptr += 4;
9392 memcpy(ptr, &v0, 4); ptr += 4;
9393
9394 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9395 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9396
9397}
9398
9399void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1)
9400{
9401
9402 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9403 IOStream *stream = ctx->m_stream;
9404 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9405 bool useChecksum = checksumCalculator->getVersion() > 0;
9406
9407 unsigned char *ptr;
9408 unsigned char *buf;
9409 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9410 const size_t checksumSize = checksumCalculator->checksumByteSize();
9411 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9412 buf = stream->alloc(totalSize);
9413 ptr = buf;
9414 int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
9415 memcpy(ptr, &totalSize, 4); ptr += 4;
9416
9417 memcpy(ptr, &program, 4); ptr += 4;
9418 memcpy(ptr, &location, 4); ptr += 4;
9419 memcpy(ptr, &v0, 4); ptr += 4;
9420 memcpy(ptr, &v1, 4); ptr += 4;
9421
9422 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9423 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9424
9425}
9426
9427void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
9428{
9429
9430 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9431 IOStream *stream = ctx->m_stream;
9432 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9433 bool useChecksum = checksumCalculator->getVersion() > 0;
9434
9435 unsigned char *ptr;
9436 unsigned char *buf;
9437 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9438 const size_t checksumSize = checksumCalculator->checksumByteSize();
9439 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9440 buf = stream->alloc(totalSize);
9441 ptr = buf;
9442 int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
9443 memcpy(ptr, &totalSize, 4); ptr += 4;
9444
9445 memcpy(ptr, &program, 4); ptr += 4;
9446 memcpy(ptr, &location, 4); ptr += 4;
9447 memcpy(ptr, &v0, 4); ptr += 4;
9448 memcpy(ptr, &v1, 4); ptr += 4;
9449 memcpy(ptr, &v2, 4); ptr += 4;
9450
9451 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9452 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9453
9454}
9455
9456void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
9457{
9458
9459 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9460 IOStream *stream = ctx->m_stream;
9461 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9462 bool useChecksum = checksumCalculator->getVersion() > 0;
9463
9464 unsigned char *ptr;
9465 unsigned char *buf;
9466 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9467 const size_t checksumSize = checksumCalculator->checksumByteSize();
9468 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9469 buf = stream->alloc(totalSize);
9470 ptr = buf;
9471 int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
9472 memcpy(ptr, &totalSize, 4); ptr += 4;
9473
9474 memcpy(ptr, &program, 4); ptr += 4;
9475 memcpy(ptr, &location, 4); ptr += 4;
9476 memcpy(ptr, &v0, 4); ptr += 4;
9477 memcpy(ptr, &v1, 4); ptr += 4;
9478 memcpy(ptr, &v2, 4); ptr += 4;
9479 memcpy(ptr, &v3, 4); ptr += 4;
9480
9481 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9482 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9483
9484}
9485
9486void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0)
9487{
9488
9489 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9490 IOStream *stream = ctx->m_stream;
9491 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9492 bool useChecksum = checksumCalculator->getVersion() > 0;
9493
9494 unsigned char *ptr;
9495 unsigned char *buf;
9496 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9497 const size_t checksumSize = checksumCalculator->checksumByteSize();
9498 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9499 buf = stream->alloc(totalSize);
9500 ptr = buf;
9501 int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
9502 memcpy(ptr, &totalSize, 4); ptr += 4;
9503
9504 memcpy(ptr, &program, 4); ptr += 4;
9505 memcpy(ptr, &location, 4); ptr += 4;
9506 memcpy(ptr, &v0, 4); ptr += 4;
9507
9508 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9509 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9510
9511}
9512
9513void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1)
9514{
9515
9516 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9517 IOStream *stream = ctx->m_stream;
9518 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9519 bool useChecksum = checksumCalculator->getVersion() > 0;
9520
9521 unsigned char *ptr;
9522 unsigned char *buf;
9523 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9524 const size_t checksumSize = checksumCalculator->checksumByteSize();
9525 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9526 buf = stream->alloc(totalSize);
9527 ptr = buf;
9528 int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
9529 memcpy(ptr, &totalSize, 4); ptr += 4;
9530
9531 memcpy(ptr, &program, 4); ptr += 4;
9532 memcpy(ptr, &location, 4); ptr += 4;
9533 memcpy(ptr, &v0, 4); ptr += 4;
9534 memcpy(ptr, &v1, 4); ptr += 4;
9535
9536 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9537 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9538
9539}
9540
9541void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
9542{
9543
9544 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9545 IOStream *stream = ctx->m_stream;
9546 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9547 bool useChecksum = checksumCalculator->getVersion() > 0;
9548
9549 unsigned char *ptr;
9550 unsigned char *buf;
9551 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9552 const size_t checksumSize = checksumCalculator->checksumByteSize();
9553 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9554 buf = stream->alloc(totalSize);
9555 ptr = buf;
9556 int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
9557 memcpy(ptr, &totalSize, 4); ptr += 4;
9558
9559 memcpy(ptr, &program, 4); ptr += 4;
9560 memcpy(ptr, &location, 4); ptr += 4;
9561 memcpy(ptr, &v0, 4); ptr += 4;
9562 memcpy(ptr, &v1, 4); ptr += 4;
9563 memcpy(ptr, &v2, 4); ptr += 4;
9564
9565 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9566 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9567
9568}
9569
9570void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
9571{
9572
9573 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9574 IOStream *stream = ctx->m_stream;
9575 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9576 bool useChecksum = checksumCalculator->getVersion() > 0;
9577
9578 unsigned char *ptr;
9579 unsigned char *buf;
9580 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9581 const size_t checksumSize = checksumCalculator->checksumByteSize();
9582 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9583 buf = stream->alloc(totalSize);
9584 ptr = buf;
9585 int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
9586 memcpy(ptr, &totalSize, 4); ptr += 4;
9587
9588 memcpy(ptr, &program, 4); ptr += 4;
9589 memcpy(ptr, &location, 4); ptr += 4;
9590 memcpy(ptr, &v0, 4); ptr += 4;
9591 memcpy(ptr, &v1, 4); ptr += 4;
9592 memcpy(ptr, &v2, 4); ptr += 4;
9593 memcpy(ptr, &v3, 4); ptr += 4;
9594
9595 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9596 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9597
9598}
9599
9600void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9601{
9602
9603 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9604 IOStream *stream = ctx->m_stream;
9605 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9606 bool useChecksum = checksumCalculator->getVersion() > 0;
9607
9608 const unsigned int __size_value = (count * sizeof(GLfloat));
9609 unsigned char *ptr;
9610 unsigned char *buf;
9611 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9612 const size_t checksumSize = checksumCalculator->checksumByteSize();
9613 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9614 buf = stream->alloc(totalSize);
9615 ptr = buf;
9616 int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
9617 memcpy(ptr, &totalSize, 4); ptr += 4;
9618
9619 memcpy(ptr, &program, 4); ptr += 4;
9620 memcpy(ptr, &location, 4); ptr += 4;
9621 memcpy(ptr, &count, 4); ptr += 4;
9622 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9623 memcpy(ptr, value, __size_value);ptr += __size_value;
9624
9625 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9626 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9627
9628}
9629
9630void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9631{
9632
9633 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9634 IOStream *stream = ctx->m_stream;
9635 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9636 bool useChecksum = checksumCalculator->getVersion() > 0;
9637
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009638 const unsigned int __size_value = (count * 2 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009639 unsigned char *ptr;
9640 unsigned char *buf;
9641 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9642 const size_t checksumSize = checksumCalculator->checksumByteSize();
9643 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9644 buf = stream->alloc(totalSize);
9645 ptr = buf;
9646 int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9647 memcpy(ptr, &totalSize, 4); ptr += 4;
9648
9649 memcpy(ptr, &program, 4); ptr += 4;
9650 memcpy(ptr, &location, 4); ptr += 4;
9651 memcpy(ptr, &count, 4); ptr += 4;
9652 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9653 memcpy(ptr, value, __size_value);ptr += __size_value;
9654
9655 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9656 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9657
9658}
9659
9660void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9661{
9662
9663 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9664 IOStream *stream = ctx->m_stream;
9665 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9666 bool useChecksum = checksumCalculator->getVersion() > 0;
9667
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009668 const unsigned int __size_value = (count * 3 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009669 unsigned char *ptr;
9670 unsigned char *buf;
9671 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9672 const size_t checksumSize = checksumCalculator->checksumByteSize();
9673 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9674 buf = stream->alloc(totalSize);
9675 ptr = buf;
9676 int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
9677 memcpy(ptr, &totalSize, 4); ptr += 4;
9678
9679 memcpy(ptr, &program, 4); ptr += 4;
9680 memcpy(ptr, &location, 4); ptr += 4;
9681 memcpy(ptr, &count, 4); ptr += 4;
9682 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9683 memcpy(ptr, value, __size_value);ptr += __size_value;
9684
9685 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9686 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9687
9688}
9689
9690void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9691{
9692
9693 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9694 IOStream *stream = ctx->m_stream;
9695 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9696 bool useChecksum = checksumCalculator->getVersion() > 0;
9697
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009698 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009699 unsigned char *ptr;
9700 unsigned char *buf;
9701 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9702 const size_t checksumSize = checksumCalculator->checksumByteSize();
9703 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9704 buf = stream->alloc(totalSize);
9705 ptr = buf;
9706 int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
9707 memcpy(ptr, &totalSize, 4); ptr += 4;
9708
9709 memcpy(ptr, &program, 4); ptr += 4;
9710 memcpy(ptr, &location, 4); ptr += 4;
9711 memcpy(ptr, &count, 4); ptr += 4;
9712 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9713 memcpy(ptr, value, __size_value);ptr += __size_value;
9714
9715 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9716 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9717
9718}
9719
9720void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9721{
9722
9723 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9724 IOStream *stream = ctx->m_stream;
9725 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9726 bool useChecksum = checksumCalculator->getVersion() > 0;
9727
9728 const unsigned int __size_value = (count * sizeof(GLint));
9729 unsigned char *ptr;
9730 unsigned char *buf;
9731 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9732 const size_t checksumSize = checksumCalculator->checksumByteSize();
9733 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9734 buf = stream->alloc(totalSize);
9735 ptr = buf;
9736 int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
9737 memcpy(ptr, &totalSize, 4); ptr += 4;
9738
9739 memcpy(ptr, &program, 4); ptr += 4;
9740 memcpy(ptr, &location, 4); ptr += 4;
9741 memcpy(ptr, &count, 4); ptr += 4;
9742 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9743 memcpy(ptr, value, __size_value);ptr += __size_value;
9744
9745 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9746 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9747
9748}
9749
9750void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9751{
9752
9753 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9754 IOStream *stream = ctx->m_stream;
9755 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9756 bool useChecksum = checksumCalculator->getVersion() > 0;
9757
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009758 const unsigned int __size_value = (count * 2 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009759 unsigned char *ptr;
9760 unsigned char *buf;
9761 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9762 const size_t checksumSize = checksumCalculator->checksumByteSize();
9763 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9764 buf = stream->alloc(totalSize);
9765 ptr = buf;
9766 int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
9767 memcpy(ptr, &totalSize, 4); ptr += 4;
9768
9769 memcpy(ptr, &program, 4); ptr += 4;
9770 memcpy(ptr, &location, 4); ptr += 4;
9771 memcpy(ptr, &count, 4); ptr += 4;
9772 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9773 memcpy(ptr, value, __size_value);ptr += __size_value;
9774
9775 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9776 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9777
9778}
9779
9780void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9781{
9782
9783 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9784 IOStream *stream = ctx->m_stream;
9785 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9786 bool useChecksum = checksumCalculator->getVersion() > 0;
9787
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009788 const unsigned int __size_value = (count * 3 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009789 unsigned char *ptr;
9790 unsigned char *buf;
9791 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9792 const size_t checksumSize = checksumCalculator->checksumByteSize();
9793 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9794 buf = stream->alloc(totalSize);
9795 ptr = buf;
9796 int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
9797 memcpy(ptr, &totalSize, 4); ptr += 4;
9798
9799 memcpy(ptr, &program, 4); ptr += 4;
9800 memcpy(ptr, &location, 4); ptr += 4;
9801 memcpy(ptr, &count, 4); ptr += 4;
9802 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9803 memcpy(ptr, value, __size_value);ptr += __size_value;
9804
9805 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9806 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9807
9808}
9809
9810void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9811{
9812
9813 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9814 IOStream *stream = ctx->m_stream;
9815 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9816 bool useChecksum = checksumCalculator->getVersion() > 0;
9817
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009818 const unsigned int __size_value = (count * 4 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009819 unsigned char *ptr;
9820 unsigned char *buf;
9821 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9822 const size_t checksumSize = checksumCalculator->checksumByteSize();
9823 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9824 buf = stream->alloc(totalSize);
9825 ptr = buf;
9826 int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
9827 memcpy(ptr, &totalSize, 4); ptr += 4;
9828
9829 memcpy(ptr, &program, 4); ptr += 4;
9830 memcpy(ptr, &location, 4); ptr += 4;
9831 memcpy(ptr, &count, 4); ptr += 4;
9832 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9833 memcpy(ptr, value, __size_value);ptr += __size_value;
9834
9835 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9836 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9837
9838}
9839
9840void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9841{
9842
9843 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9844 IOStream *stream = ctx->m_stream;
9845 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9846 bool useChecksum = checksumCalculator->getVersion() > 0;
9847
9848 const unsigned int __size_value = (count * sizeof(GLuint));
9849 unsigned char *ptr;
9850 unsigned char *buf;
9851 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9852 const size_t checksumSize = checksumCalculator->checksumByteSize();
9853 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9854 buf = stream->alloc(totalSize);
9855 ptr = buf;
9856 int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9857 memcpy(ptr, &totalSize, 4); ptr += 4;
9858
9859 memcpy(ptr, &program, 4); ptr += 4;
9860 memcpy(ptr, &location, 4); ptr += 4;
9861 memcpy(ptr, &count, 4); ptr += 4;
9862 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9863 memcpy(ptr, value, __size_value);ptr += __size_value;
9864
9865 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9866 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9867
9868}
9869
9870void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9871{
9872
9873 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9874 IOStream *stream = ctx->m_stream;
9875 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9876 bool useChecksum = checksumCalculator->getVersion() > 0;
9877
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009878 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009879 unsigned char *ptr;
9880 unsigned char *buf;
9881 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9882 const size_t checksumSize = checksumCalculator->checksumByteSize();
9883 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9884 buf = stream->alloc(totalSize);
9885 ptr = buf;
9886 int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9887 memcpy(ptr, &totalSize, 4); ptr += 4;
9888
9889 memcpy(ptr, &program, 4); ptr += 4;
9890 memcpy(ptr, &location, 4); ptr += 4;
9891 memcpy(ptr, &count, 4); ptr += 4;
9892 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9893 memcpy(ptr, value, __size_value);ptr += __size_value;
9894
9895 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9896 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9897
9898}
9899
9900void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9901{
9902
9903 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9904 IOStream *stream = ctx->m_stream;
9905 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9906 bool useChecksum = checksumCalculator->getVersion() > 0;
9907
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009908 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009909 unsigned char *ptr;
9910 unsigned char *buf;
9911 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9912 const size_t checksumSize = checksumCalculator->checksumByteSize();
9913 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9914 buf = stream->alloc(totalSize);
9915 ptr = buf;
9916 int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9917 memcpy(ptr, &totalSize, 4); ptr += 4;
9918
9919 memcpy(ptr, &program, 4); ptr += 4;
9920 memcpy(ptr, &location, 4); ptr += 4;
9921 memcpy(ptr, &count, 4); ptr += 4;
9922 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9923 memcpy(ptr, value, __size_value);ptr += __size_value;
9924
9925 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9926 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9927
9928}
9929
9930void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9931{
9932
9933 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9934 IOStream *stream = ctx->m_stream;
9935 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9936 bool useChecksum = checksumCalculator->getVersion() > 0;
9937
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009938 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009939 unsigned char *ptr;
9940 unsigned char *buf;
9941 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9942 const size_t checksumSize = checksumCalculator->checksumByteSize();
9943 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9944 buf = stream->alloc(totalSize);
9945 ptr = buf;
9946 int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9947 memcpy(ptr, &totalSize, 4); ptr += 4;
9948
9949 memcpy(ptr, &program, 4); ptr += 4;
9950 memcpy(ptr, &location, 4); ptr += 4;
9951 memcpy(ptr, &count, 4); ptr += 4;
9952 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9953 memcpy(ptr, value, __size_value);ptr += __size_value;
9954
9955 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9956 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9957
9958}
9959
9960void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9961{
9962
9963 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9964 IOStream *stream = ctx->m_stream;
9965 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9966 bool useChecksum = checksumCalculator->getVersion() > 0;
9967
9968 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
9969 unsigned char *ptr;
9970 unsigned char *buf;
9971 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
9972 const size_t checksumSize = checksumCalculator->checksumByteSize();
9973 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9974 buf = stream->alloc(totalSize);
9975 ptr = buf;
9976 int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9977 memcpy(ptr, &totalSize, 4); ptr += 4;
9978
9979 memcpy(ptr, &program, 4); ptr += 4;
9980 memcpy(ptr, &location, 4); ptr += 4;
9981 memcpy(ptr, &count, 4); ptr += 4;
9982 memcpy(ptr, &transpose, 1); ptr += 1;
9983 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9984 memcpy(ptr, value, __size_value);ptr += __size_value;
9985
9986 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9987 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9988
9989}
9990
9991void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9992{
9993
9994 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9995 IOStream *stream = ctx->m_stream;
9996 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9997 bool useChecksum = checksumCalculator->getVersion() > 0;
9998
9999 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
10000 unsigned char *ptr;
10001 unsigned char *buf;
10002 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10003 const size_t checksumSize = checksumCalculator->checksumByteSize();
10004 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10005 buf = stream->alloc(totalSize);
10006 ptr = buf;
10007 int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10008 memcpy(ptr, &totalSize, 4); ptr += 4;
10009
10010 memcpy(ptr, &program, 4); ptr += 4;
10011 memcpy(ptr, &location, 4); ptr += 4;
10012 memcpy(ptr, &count, 4); ptr += 4;
10013 memcpy(ptr, &transpose, 1); ptr += 1;
10014 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10015 memcpy(ptr, value, __size_value);ptr += __size_value;
10016
10017 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10018 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10019
10020}
10021
10022void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10023{
10024
10025 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10026 IOStream *stream = ctx->m_stream;
10027 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10028 bool useChecksum = checksumCalculator->getVersion() > 0;
10029
10030 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
10031 unsigned char *ptr;
10032 unsigned char *buf;
10033 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10034 const size_t checksumSize = checksumCalculator->checksumByteSize();
10035 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10036 buf = stream->alloc(totalSize);
10037 ptr = buf;
10038 int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10039 memcpy(ptr, &totalSize, 4); ptr += 4;
10040
10041 memcpy(ptr, &program, 4); ptr += 4;
10042 memcpy(ptr, &location, 4); ptr += 4;
10043 memcpy(ptr, &count, 4); ptr += 4;
10044 memcpy(ptr, &transpose, 1); ptr += 1;
10045 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10046 memcpy(ptr, value, __size_value);ptr += __size_value;
10047
10048 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10049 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10050
10051}
10052
10053void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10054{
10055
10056 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10057 IOStream *stream = ctx->m_stream;
10058 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10059 bool useChecksum = checksumCalculator->getVersion() > 0;
10060
10061 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10062 unsigned char *ptr;
10063 unsigned char *buf;
10064 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10065 const size_t checksumSize = checksumCalculator->checksumByteSize();
10066 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10067 buf = stream->alloc(totalSize);
10068 ptr = buf;
10069 int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10070 memcpy(ptr, &totalSize, 4); ptr += 4;
10071
10072 memcpy(ptr, &program, 4); ptr += 4;
10073 memcpy(ptr, &location, 4); ptr += 4;
10074 memcpy(ptr, &count, 4); ptr += 4;
10075 memcpy(ptr, &transpose, 1); ptr += 1;
10076 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10077 memcpy(ptr, value, __size_value);ptr += __size_value;
10078
10079 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10080 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10081
10082}
10083
10084void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10085{
10086
10087 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10088 IOStream *stream = ctx->m_stream;
10089 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10090 bool useChecksum = checksumCalculator->getVersion() > 0;
10091
10092 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10093 unsigned char *ptr;
10094 unsigned char *buf;
10095 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10096 const size_t checksumSize = checksumCalculator->checksumByteSize();
10097 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10098 buf = stream->alloc(totalSize);
10099 ptr = buf;
10100 int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10101 memcpy(ptr, &totalSize, 4); ptr += 4;
10102
10103 memcpy(ptr, &program, 4); ptr += 4;
10104 memcpy(ptr, &location, 4); ptr += 4;
10105 memcpy(ptr, &count, 4); ptr += 4;
10106 memcpy(ptr, &transpose, 1); ptr += 1;
10107 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10108 memcpy(ptr, value, __size_value);ptr += __size_value;
10109
10110 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10111 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10112
10113}
10114
10115void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10116{
10117
10118 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10119 IOStream *stream = ctx->m_stream;
10120 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10121 bool useChecksum = checksumCalculator->getVersion() > 0;
10122
10123 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10124 unsigned char *ptr;
10125 unsigned char *buf;
10126 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10127 const size_t checksumSize = checksumCalculator->checksumByteSize();
10128 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10129 buf = stream->alloc(totalSize);
10130 ptr = buf;
10131 int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10132 memcpy(ptr, &totalSize, 4); ptr += 4;
10133
10134 memcpy(ptr, &program, 4); ptr += 4;
10135 memcpy(ptr, &location, 4); ptr += 4;
10136 memcpy(ptr, &count, 4); ptr += 4;
10137 memcpy(ptr, &transpose, 1); ptr += 1;
10138 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10139 memcpy(ptr, value, __size_value);ptr += __size_value;
10140
10141 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10142 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10143
10144}
10145
10146void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10147{
10148
10149 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10150 IOStream *stream = ctx->m_stream;
10151 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10152 bool useChecksum = checksumCalculator->getVersion() > 0;
10153
10154 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10155 unsigned char *ptr;
10156 unsigned char *buf;
10157 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10158 const size_t checksumSize = checksumCalculator->checksumByteSize();
10159 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10160 buf = stream->alloc(totalSize);
10161 ptr = buf;
10162 int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10163 memcpy(ptr, &totalSize, 4); ptr += 4;
10164
10165 memcpy(ptr, &program, 4); ptr += 4;
10166 memcpy(ptr, &location, 4); ptr += 4;
10167 memcpy(ptr, &count, 4); ptr += 4;
10168 memcpy(ptr, &transpose, 1); ptr += 1;
10169 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10170 memcpy(ptr, value, __size_value);ptr += __size_value;
10171
10172 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10173 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10174
10175}
10176
10177void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10178{
10179
10180 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10181 IOStream *stream = ctx->m_stream;
10182 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10183 bool useChecksum = checksumCalculator->getVersion() > 0;
10184
10185 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10186 unsigned char *ptr;
10187 unsigned char *buf;
10188 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10189 const size_t checksumSize = checksumCalculator->checksumByteSize();
10190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10191 buf = stream->alloc(totalSize);
10192 ptr = buf;
10193 int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10194 memcpy(ptr, &totalSize, 4); ptr += 4;
10195
10196 memcpy(ptr, &program, 4); ptr += 4;
10197 memcpy(ptr, &location, 4); ptr += 4;
10198 memcpy(ptr, &count, 4); ptr += 4;
10199 memcpy(ptr, &transpose, 1); ptr += 1;
10200 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10201 memcpy(ptr, value, __size_value);ptr += __size_value;
10202
10203 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10204 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10205
10206}
10207
10208void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10209{
10210
10211 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10212 IOStream *stream = ctx->m_stream;
10213 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10214 bool useChecksum = checksumCalculator->getVersion() > 0;
10215
10216 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10217 unsigned char *ptr;
10218 unsigned char *buf;
10219 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10220 const size_t checksumSize = checksumCalculator->checksumByteSize();
10221 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10222 buf = stream->alloc(totalSize);
10223 ptr = buf;
10224 int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10225 memcpy(ptr, &totalSize, 4); ptr += 4;
10226
10227 memcpy(ptr, &program, 4); ptr += 4;
10228 memcpy(ptr, &location, 4); ptr += 4;
10229 memcpy(ptr, &count, 4); ptr += 4;
10230 memcpy(ptr, &transpose, 1); ptr += 1;
10231 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10232 memcpy(ptr, value, __size_value);ptr += __size_value;
10233
10234 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10235 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10236
10237}
10238
10239void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params)
10240{
10241
10242 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10243 IOStream *stream = ctx->m_stream;
10244 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10245 bool useChecksum = checksumCalculator->getVersion() > 0;
10246
10247 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10248 unsigned char *ptr;
10249 unsigned char *buf;
10250 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10251 const size_t checksumSize = checksumCalculator->checksumByteSize();
10252 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10253 buf = stream->alloc(totalSize);
10254 ptr = buf;
10255 int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10256 memcpy(ptr, &totalSize, 4); ptr += 4;
10257
10258 memcpy(ptr, &program, 4); ptr += 4;
10259 memcpy(ptr, &programInterface, 4); ptr += 4;
10260 memcpy(ptr, &pname, 4); ptr += 4;
10261 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10262
10263 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10264 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10265
10266 stream->readback(params, __size_params);
10267 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10268 if (useChecksum) {
10269 unsigned char *checksumBufPtr = NULL;
10270 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10271 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10272 stream->readback(checksumBufPtr, checksumSize);
10273 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10274 ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n");
10275 abort();
10276 }
10277 }
10278}
10279
10280void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params)
10281{
10282
10283 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10284 IOStream *stream = ctx->m_stream;
10285 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10286 bool useChecksum = checksumCalculator->getVersion() > 0;
10287
10288 const unsigned int __size_props = (propCount * sizeof(GLenum));
10289 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10290 const unsigned int __size_params = (bufSize * sizeof(GLint));
10291 unsigned char *ptr;
10292 unsigned char *buf;
10293 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4;
10294 const size_t checksumSize = checksumCalculator->checksumByteSize();
10295 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10296 buf = stream->alloc(totalSize);
10297 ptr = buf;
10298 int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10299 memcpy(ptr, &totalSize, 4); ptr += 4;
10300
10301 memcpy(ptr, &program, 4); ptr += 4;
10302 memcpy(ptr, &programInterface, 4); ptr += 4;
10303 memcpy(ptr, &index, 4); ptr += 4;
10304 memcpy(ptr, &propCount, 4); ptr += 4;
10305 *(unsigned int *)(ptr) = __size_props; ptr += 4;
10306 memcpy(ptr, props, __size_props);ptr += __size_props;
10307 memcpy(ptr, &bufSize, 4); ptr += 4;
10308 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10309 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10310
10311 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10312 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10313
10314 if (length != NULL) {
10315 stream->readback(length, __size_length);
10316 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10317 }
10318 stream->readback(params, __size_params);
10319 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10320 if (useChecksum) {
10321 unsigned char *checksumBufPtr = NULL;
10322 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10323 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10324 stream->readback(checksumBufPtr, checksumSize);
10325 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10326 ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n");
10327 abort();
10328 }
10329 }
10330}
10331
10332GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10333{
10334
10335 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10336 IOStream *stream = ctx->m_stream;
10337 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10338 bool useChecksum = checksumCalculator->getVersion() > 0;
10339
10340 const unsigned int __size_name = (strlen(name) + 1);
10341 unsigned char *ptr;
10342 unsigned char *buf;
10343 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10344 const size_t checksumSize = checksumCalculator->checksumByteSize();
10345 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10346 buf = stream->alloc(totalSize);
10347 ptr = buf;
10348 int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4;
10349 memcpy(ptr, &totalSize, 4); ptr += 4;
10350
10351 memcpy(ptr, &program, 4); ptr += 4;
10352 memcpy(ptr, &programInterface, 4); ptr += 4;
10353 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10354 memcpy(ptr, name, __size_name);ptr += __size_name;
10355
10356 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10357 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10358
10359
10360 GLuint retval;
10361 stream->readback(&retval, 4);
10362 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10363 if (useChecksum) {
10364 unsigned char *checksumBufPtr = NULL;
10365 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10366 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10367 stream->readback(checksumBufPtr, checksumSize);
10368 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10369 ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n");
10370 abort();
10371 }
10372 }
10373 return retval;
10374}
10375
10376GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10377{
10378
10379 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10380 IOStream *stream = ctx->m_stream;
10381 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10382 bool useChecksum = checksumCalculator->getVersion() > 0;
10383
10384 const unsigned int __size_name = (strlen(name) + 1);
10385 unsigned char *ptr;
10386 unsigned char *buf;
10387 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10388 const size_t checksumSize = checksumCalculator->checksumByteSize();
10389 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10390 buf = stream->alloc(totalSize);
10391 ptr = buf;
10392 int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4;
10393 memcpy(ptr, &totalSize, 4); ptr += 4;
10394
10395 memcpy(ptr, &program, 4); ptr += 4;
10396 memcpy(ptr, &programInterface, 4); ptr += 4;
10397 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10398 memcpy(ptr, name, __size_name);ptr += __size_name;
10399
10400 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10401 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10402
10403
10404 GLint retval;
10405 stream->readback(&retval, 4);
10406 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10407 if (useChecksum) {
10408 unsigned char *checksumBufPtr = NULL;
10409 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10410 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10411 stream->readback(checksumBufPtr, checksumSize);
10412 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10413 ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n");
10414 abort();
10415 }
10416 }
10417 return retval;
10418}
10419
10420void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name)
10421{
10422
10423 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10424 IOStream *stream = ctx->m_stream;
10425 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10426 bool useChecksum = checksumCalculator->getVersion() > 0;
10427
10428 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10429 const unsigned int __size_name = bufSize;
10430 unsigned char *ptr;
10431 unsigned char *buf;
10432 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4;
10433 const size_t checksumSize = checksumCalculator->checksumByteSize();
10434 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10435 buf = stream->alloc(totalSize);
10436 ptr = buf;
10437 int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4;
10438 memcpy(ptr, &totalSize, 4); ptr += 4;
10439
10440 memcpy(ptr, &program, 4); ptr += 4;
10441 memcpy(ptr, &programInterface, 4); ptr += 4;
10442 memcpy(ptr, &index, 4); ptr += 4;
10443 memcpy(ptr, &bufSize, 4); ptr += 4;
10444 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10445 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10446
10447 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10448 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10449
10450 if (length != NULL) {
10451 stream->readback(length, __size_length);
10452 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10453 }
10454 stream->readback(name, __size_name);
10455 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
10456 if (useChecksum) {
10457 unsigned char *checksumBufPtr = NULL;
10458 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10459 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10460 stream->readback(checksumBufPtr, checksumSize);
10461 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10462 ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n");
10463 abort();
10464 }
10465 }
10466}
10467
10468void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
10469{
10470
10471 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10472 IOStream *stream = ctx->m_stream;
10473 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10474 bool useChecksum = checksumCalculator->getVersion() > 0;
10475
10476 unsigned char *ptr;
10477 unsigned char *buf;
10478 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4;
10479 const size_t checksumSize = checksumCalculator->checksumByteSize();
10480 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10481 buf = stream->alloc(totalSize);
10482 ptr = buf;
10483 int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4;
10484 memcpy(ptr, &totalSize, 4); ptr += 4;
10485
10486 memcpy(ptr, &unit, 4); ptr += 4;
10487 memcpy(ptr, &texture, 4); ptr += 4;
10488 memcpy(ptr, &level, 4); ptr += 4;
10489 memcpy(ptr, &layered, 1); ptr += 1;
10490 memcpy(ptr, &layer, 4); ptr += 4;
10491 memcpy(ptr, &access, 4); ptr += 4;
10492 memcpy(ptr, &format, 4); ptr += 4;
10493
10494 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10495 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10496
10497}
10498
10499void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
10500{
10501
10502 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10503 IOStream *stream = ctx->m_stream;
10504 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10505 bool useChecksum = checksumCalculator->getVersion() > 0;
10506
10507 unsigned char *ptr;
10508 unsigned char *buf;
10509 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10510 const size_t checksumSize = checksumCalculator->checksumByteSize();
10511 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10512 buf = stream->alloc(totalSize);
10513 ptr = buf;
10514 int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4;
10515 memcpy(ptr, &totalSize, 4); ptr += 4;
10516
10517 memcpy(ptr, &num_groups_x, 4); ptr += 4;
10518 memcpy(ptr, &num_groups_y, 4); ptr += 4;
10519 memcpy(ptr, &num_groups_z, 4); ptr += 4;
10520
10521 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10522 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10523
10524}
10525
10526void glDispatchComputeIndirect_enc(void *self , GLintptr indirect)
10527{
10528
10529 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10530 IOStream *stream = ctx->m_stream;
10531 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10532 bool useChecksum = checksumCalculator->getVersion() > 0;
10533
10534 unsigned char *ptr;
10535 unsigned char *buf;
10536 const size_t sizeWithoutChecksum = 8 + 4;
10537 const size_t checksumSize = checksumCalculator->checksumByteSize();
10538 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10539 buf = stream->alloc(totalSize);
10540 ptr = buf;
10541 int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4;
10542 memcpy(ptr, &totalSize, 4); ptr += 4;
10543
10544 memcpy(ptr, &indirect, 4); ptr += 4;
10545
10546 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10547 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10548
10549}
10550
10551void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride)
10552{
10553
10554 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10555 IOStream *stream = ctx->m_stream;
10556 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10557 bool useChecksum = checksumCalculator->getVersion() > 0;
10558
10559 unsigned char *ptr;
10560 unsigned char *buf;
10561 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10562 const size_t checksumSize = checksumCalculator->checksumByteSize();
10563 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10564 buf = stream->alloc(totalSize);
10565 ptr = buf;
10566 int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
10567 memcpy(ptr, &totalSize, 4); ptr += 4;
10568
10569 memcpy(ptr, &bindingindex, 4); ptr += 4;
10570 memcpy(ptr, &buffer, 4); ptr += 4;
10571 memcpy(ptr, &offset, 4); ptr += 4;
10572 memcpy(ptr, &stride, 4); ptr += 4;
10573
10574 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10575 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10576
10577}
10578
10579void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex)
10580{
10581
10582 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10583 IOStream *stream = ctx->m_stream;
10584 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10585 bool useChecksum = checksumCalculator->getVersion() > 0;
10586
10587 unsigned char *ptr;
10588 unsigned char *buf;
10589 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10590 const size_t checksumSize = checksumCalculator->checksumByteSize();
10591 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10592 buf = stream->alloc(totalSize);
10593 ptr = buf;
10594 int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4;
10595 memcpy(ptr, &totalSize, 4); ptr += 4;
10596
10597 memcpy(ptr, &attribindex, 4); ptr += 4;
10598 memcpy(ptr, &bindingindex, 4); ptr += 4;
10599
10600 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10601 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10602
10603}
10604
10605void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
10606{
10607
10608 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10609 IOStream *stream = ctx->m_stream;
10610 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10611 bool useChecksum = checksumCalculator->getVersion() > 0;
10612
10613 unsigned char *ptr;
10614 unsigned char *buf;
10615 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4;
10616 const size_t checksumSize = checksumCalculator->checksumByteSize();
10617 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10618 buf = stream->alloc(totalSize);
10619 ptr = buf;
10620 int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10621 memcpy(ptr, &totalSize, 4); ptr += 4;
10622
10623 memcpy(ptr, &attribindex, 4); ptr += 4;
10624 memcpy(ptr, &size, 4); ptr += 4;
10625 memcpy(ptr, &type, 4); ptr += 4;
10626 memcpy(ptr, &normalized, 1); ptr += 1;
10627 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10628
10629 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10630 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10631
10632}
10633
10634void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
10635{
10636
10637 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10638 IOStream *stream = ctx->m_stream;
10639 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10640 bool useChecksum = checksumCalculator->getVersion() > 0;
10641
10642 unsigned char *ptr;
10643 unsigned char *buf;
10644 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10645 const size_t checksumSize = checksumCalculator->checksumByteSize();
10646 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10647 buf = stream->alloc(totalSize);
10648 ptr = buf;
10649 int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10650 memcpy(ptr, &totalSize, 4); ptr += 4;
10651
10652 memcpy(ptr, &attribindex, 4); ptr += 4;
10653 memcpy(ptr, &size, 4); ptr += 4;
10654 memcpy(ptr, &type, 4); ptr += 4;
10655 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10656
10657 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10658 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10659
10660}
10661
10662void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor)
10663{
10664
10665 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10666 IOStream *stream = ctx->m_stream;
10667 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10668 bool useChecksum = checksumCalculator->getVersion() > 0;
10669
10670 unsigned char *ptr;
10671 unsigned char *buf;
10672 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10673 const size_t checksumSize = checksumCalculator->checksumByteSize();
10674 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10675 buf = stream->alloc(totalSize);
10676 ptr = buf;
10677 int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
10678 memcpy(ptr, &totalSize, 4); ptr += 4;
10679
10680 memcpy(ptr, &bindingindex, 4); ptr += 4;
10681 memcpy(ptr, &divisor, 4); ptr += 4;
10682
10683 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10684 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10685
10686}
10687
10688void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen)
10689{
10690
10691 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10692 IOStream *stream = ctx->m_stream;
10693 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10694 bool useChecksum = checksumCalculator->getVersion() > 0;
10695
10696 const unsigned int __size_indirect = datalen;
10697 unsigned char *ptr;
10698 unsigned char *buf;
10699 const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4;
10700 const size_t checksumSize = checksumCalculator->checksumByteSize();
10701 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10702 buf = stream->alloc(totalSize);
10703 ptr = buf;
10704 int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10705 memcpy(ptr, &totalSize, 4); ptr += 4;
10706
10707 memcpy(ptr, &mode, 4); ptr += 4;
10708 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10709 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10710 memcpy(ptr, &datalen, 4); ptr += 4;
10711
10712 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10713 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10714
10715}
10716
10717void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset)
10718{
10719
10720 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10721 IOStream *stream = ctx->m_stream;
10722 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10723 bool useChecksum = checksumCalculator->getVersion() > 0;
10724
10725 unsigned char *ptr;
10726 unsigned char *buf;
10727 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10728 const size_t checksumSize = checksumCalculator->checksumByteSize();
10729 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10730 buf = stream->alloc(totalSize);
10731 ptr = buf;
10732 int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10733 memcpy(ptr, &totalSize, 4); ptr += 4;
10734
10735 memcpy(ptr, &mode, 4); ptr += 4;
10736 memcpy(ptr, &offset, 4); ptr += 4;
10737
10738 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10739 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10740
10741}
10742
10743void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen)
10744{
10745
10746 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10747 IOStream *stream = ctx->m_stream;
10748 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10749 bool useChecksum = checksumCalculator->getVersion() > 0;
10750
10751 const unsigned int __size_indirect = datalen;
10752 unsigned char *ptr;
10753 unsigned char *buf;
10754 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4;
10755 const size_t checksumSize = checksumCalculator->checksumByteSize();
10756 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10757 buf = stream->alloc(totalSize);
10758 ptr = buf;
10759 int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10760 memcpy(ptr, &totalSize, 4); ptr += 4;
10761
10762 memcpy(ptr, &mode, 4); ptr += 4;
10763 memcpy(ptr, &type, 4); ptr += 4;
10764 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10765 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10766 memcpy(ptr, &datalen, 4); ptr += 4;
10767
10768 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10769 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10770
10771}
10772
10773void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset)
10774{
10775
10776 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10777 IOStream *stream = ctx->m_stream;
10778 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10779 bool useChecksum = checksumCalculator->getVersion() > 0;
10780
10781 unsigned char *ptr;
10782 unsigned char *buf;
10783 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10784 const size_t checksumSize = checksumCalculator->checksumByteSize();
10785 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10786 buf = stream->alloc(totalSize);
10787 ptr = buf;
10788 int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10789 memcpy(ptr, &totalSize, 4); ptr += 4;
10790
10791 memcpy(ptr, &mode, 4); ptr += 4;
10792 memcpy(ptr, &type, 4); ptr += 4;
10793 memcpy(ptr, &offset, 4); ptr += 4;
10794
10795 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10796 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10797
10798}
10799
10800void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
10801{
10802
10803 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10804 IOStream *stream = ctx->m_stream;
10805 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10806 bool useChecksum = checksumCalculator->getVersion() > 0;
10807
10808 unsigned char *ptr;
10809 unsigned char *buf;
10810 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1;
10811 const size_t checksumSize = checksumCalculator->checksumByteSize();
10812 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10813 buf = stream->alloc(totalSize);
10814 ptr = buf;
10815 int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
10816 memcpy(ptr, &totalSize, 4); ptr += 4;
10817
10818 memcpy(ptr, &target, 4); ptr += 4;
10819 memcpy(ptr, &samples, 4); ptr += 4;
10820 memcpy(ptr, &internalformat, 4); ptr += 4;
10821 memcpy(ptr, &width, 4); ptr += 4;
10822 memcpy(ptr, &height, 4); ptr += 4;
10823 memcpy(ptr, &fixedsamplelocations, 1); ptr += 1;
10824
10825 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10826 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10827
10828}
10829
10830void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask)
10831{
10832
10833 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10834 IOStream *stream = ctx->m_stream;
10835 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10836 bool useChecksum = checksumCalculator->getVersion() > 0;
10837
10838 unsigned char *ptr;
10839 unsigned char *buf;
10840 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10841 const size_t checksumSize = checksumCalculator->checksumByteSize();
10842 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10843 buf = stream->alloc(totalSize);
10844 ptr = buf;
10845 int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4;
10846 memcpy(ptr, &totalSize, 4); ptr += 4;
10847
10848 memcpy(ptr, &maskNumber, 4); ptr += 4;
10849 memcpy(ptr, &mask, 4); ptr += 4;
10850
10851 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10852 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10853
10854}
10855
10856void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val)
10857{
10858
10859 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10860 IOStream *stream = ctx->m_stream;
10861 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10862 bool useChecksum = checksumCalculator->getVersion() > 0;
10863
10864 const unsigned int __size_val = (glUtilsParamSize(pname) * sizeof(GLfloat));
10865 unsigned char *ptr;
10866 unsigned char *buf;
10867 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10868 const size_t checksumSize = checksumCalculator->checksumByteSize();
10869 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10870 buf = stream->alloc(totalSize);
10871 ptr = buf;
10872 int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4;
10873 memcpy(ptr, &totalSize, 4); ptr += 4;
10874
10875 memcpy(ptr, &pname, 4); ptr += 4;
10876 memcpy(ptr, &index, 4); ptr += 4;
10877 *(unsigned int *)(ptr) = __size_val; ptr += 4;
10878
10879 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10880 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10881
10882 stream->readback(val, __size_val);
10883 if (useChecksum) checksumCalculator->addBuffer(val, __size_val);
10884 if (useChecksum) {
10885 unsigned char *checksumBufPtr = NULL;
10886 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10887 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10888 stream->readback(checksumBufPtr, checksumSize);
10889 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10890 ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n");
10891 abort();
10892 }
10893 }
10894}
10895
10896void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
10897{
10898
10899 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10900 IOStream *stream = ctx->m_stream;
10901 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10902 bool useChecksum = checksumCalculator->getVersion() > 0;
10903
10904 unsigned char *ptr;
10905 unsigned char *buf;
10906 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10907 const size_t checksumSize = checksumCalculator->checksumByteSize();
10908 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10909 buf = stream->alloc(totalSize);
10910 ptr = buf;
10911 int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
10912 memcpy(ptr, &totalSize, 4); ptr += 4;
10913
10914 memcpy(ptr, &target, 4); ptr += 4;
10915 memcpy(ptr, &pname, 4); ptr += 4;
10916 memcpy(ptr, &param, 4); ptr += 4;
10917
10918 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10919 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10920
10921}
10922
10923void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
10924{
10925
10926 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10927 IOStream *stream = ctx->m_stream;
10928 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10929 bool useChecksum = checksumCalculator->getVersion() > 0;
10930
10931 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10932 unsigned char *ptr;
10933 unsigned char *buf;
10934 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10935 const size_t checksumSize = checksumCalculator->checksumByteSize();
10936 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10937 buf = stream->alloc(totalSize);
10938 ptr = buf;
10939 int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
10940 memcpy(ptr, &totalSize, 4); ptr += 4;
10941
10942 memcpy(ptr, &target, 4); ptr += 4;
10943 memcpy(ptr, &pname, 4); ptr += 4;
10944 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10945
10946 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10947 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10948
10949 stream->readback(params, __size_params);
10950 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10951 if (useChecksum) {
10952 unsigned char *checksumBufPtr = NULL;
10953 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10954 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10955 stream->readback(checksumBufPtr, checksumSize);
10956 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10957 ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
10958 abort();
10959 }
10960 }
10961}
10962
10963void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params)
10964{
10965
10966 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10967 IOStream *stream = ctx->m_stream;
10968 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10969 bool useChecksum = checksumCalculator->getVersion() > 0;
10970
10971 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
10972 unsigned char *ptr;
10973 unsigned char *buf;
10974 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10975 const size_t checksumSize = checksumCalculator->checksumByteSize();
10976 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10977 buf = stream->alloc(totalSize);
10978 ptr = buf;
10979 int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
10980 memcpy(ptr, &totalSize, 4); ptr += 4;
10981
10982 memcpy(ptr, &target, 4); ptr += 4;
10983 memcpy(ptr, &level, 4); ptr += 4;
10984 memcpy(ptr, &pname, 4); ptr += 4;
10985 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10986
10987 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10988 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10989
10990 stream->readback(params, __size_params);
10991 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10992 if (useChecksum) {
10993 unsigned char *checksumBufPtr = NULL;
10994 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10995 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10996 stream->readback(checksumBufPtr, checksumSize);
10997 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10998 ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n");
10999 abort();
11000 }
11001 }
11002}
11003
11004void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params)
11005{
11006
11007 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11008 IOStream *stream = ctx->m_stream;
11009 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11010 bool useChecksum = checksumCalculator->getVersion() > 0;
11011
11012 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
11013 unsigned char *ptr;
11014 unsigned char *buf;
11015 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11016 const size_t checksumSize = checksumCalculator->checksumByteSize();
11017 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11018 buf = stream->alloc(totalSize);
11019 ptr = buf;
11020 int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
11021 memcpy(ptr, &totalSize, 4); ptr += 4;
11022
11023 memcpy(ptr, &target, 4); ptr += 4;
11024 memcpy(ptr, &level, 4); ptr += 4;
11025 memcpy(ptr, &pname, 4); ptr += 4;
11026 *(unsigned int *)(ptr) = __size_params; ptr += 4;
11027
11028 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11029 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11030
11031 stream->readback(params, __size_params);
11032 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11033 if (useChecksum) {
11034 unsigned char *checksumBufPtr = NULL;
11035 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11036 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11037 stream->readback(checksumBufPtr, checksumSize);
11038 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11039 ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n");
11040 abort();
11041 }
11042 }
11043}
11044
Roman Kiryanovbe1c0c22018-10-02 18:07:14 -070011045void glMapBufferRangeDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr)
11046{
11047
11048 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11049 IOStream *stream = ctx->m_stream;
11050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11051 bool useChecksum = checksumCalculator->getVersion() > 0;
11052
11053 unsigned char *ptr;
11054 unsigned char *buf;
11055 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8;
11056 const size_t checksumSize = checksumCalculator->checksumByteSize();
11057 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11058 buf = stream->alloc(totalSize);
11059 ptr = buf;
11060 int tmp = OP_glMapBufferRangeDMA;memcpy(ptr, &tmp, 4); ptr += 4;
11061 memcpy(ptr, &totalSize, 4); ptr += 4;
11062
11063 memcpy(ptr, &target, 4); ptr += 4;
11064 memcpy(ptr, &offset, 4); ptr += 4;
11065 memcpy(ptr, &length, 4); ptr += 4;
11066 memcpy(ptr, &access, 4); ptr += 4;
11067 memcpy(ptr, &paddr, 8); ptr += 8;
11068
11069 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11070 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11071
11072}
11073
11074void glUnmapBufferDMA_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, GLboolean* out_res)
11075{
11076
11077 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11078 IOStream *stream = ctx->m_stream;
11079 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11080 bool useChecksum = checksumCalculator->getVersion() > 0;
11081
11082 const unsigned int __size_out_res = (sizeof(GLboolean));
11083 unsigned char *ptr;
11084 unsigned char *buf;
11085 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 0 + 1*4;
11086 const size_t checksumSize = checksumCalculator->checksumByteSize();
11087 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11088 buf = stream->alloc(totalSize);
11089 ptr = buf;
11090 int tmp = OP_glUnmapBufferDMA;memcpy(ptr, &tmp, 4); ptr += 4;
11091 memcpy(ptr, &totalSize, 4); ptr += 4;
11092
11093 memcpy(ptr, &target, 4); ptr += 4;
11094 memcpy(ptr, &offset, 4); ptr += 4;
11095 memcpy(ptr, &length, 4); ptr += 4;
11096 memcpy(ptr, &access, 4); ptr += 4;
11097 memcpy(ptr, &paddr, 8); ptr += 8;
11098 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11099
11100 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11101 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11102
11103 stream->readback(out_res, __size_out_res);
11104 if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
11105 if (useChecksum) {
11106 unsigned char *checksumBufPtr = NULL;
11107 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11108 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11109 stream->readback(checksumBufPtr, checksumSize);
11110 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11111 ALOGE("glUnmapBufferDMA: GL communication error, please report this issue to b.android.com.\n");
11112 abort();
11113 }
11114 }
11115}
11116
Roman Kiryanovdaecd142018-11-14 14:56:27 -080011117uint64_t glMapBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr)
11118{
11119
11120 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11121 IOStream *stream = ctx->m_stream;
11122 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11123 bool useChecksum = checksumCalculator->getVersion() > 0;
11124
11125 unsigned char *ptr;
11126 unsigned char *buf;
11127 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8;
11128 const size_t checksumSize = checksumCalculator->checksumByteSize();
11129 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11130 buf = stream->alloc(totalSize);
11131 ptr = buf;
11132 int tmp = OP_glMapBufferRangeDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11133 memcpy(ptr, &totalSize, 4); ptr += 4;
11134
11135 memcpy(ptr, &target, 4); ptr += 4;
11136 memcpy(ptr, &offset, 4); ptr += 4;
11137 memcpy(ptr, &length, 4); ptr += 4;
11138 memcpy(ptr, &access, 4); ptr += 4;
11139 memcpy(ptr, &paddr, 8); ptr += 8;
11140
11141 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11142 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11143
11144
11145 uint64_t retval;
11146 stream->readback(&retval, 8);
11147 if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
11148 if (useChecksum) {
11149 unsigned char *checksumBufPtr = NULL;
11150 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11151 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11152 stream->readback(checksumBufPtr, checksumSize);
11153 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11154 ALOGE("glMapBufferRangeDirect: GL communication error, please report this issue to b.android.com.\n");
11155 abort();
11156 }
11157 }
11158 return retval;
11159}
11160
11161void glUnmapBufferDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, uint64_t paddr, uint64_t guest_ptr, GLboolean* out_res)
11162{
11163
11164 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11165 IOStream *stream = ctx->m_stream;
11166 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11167 bool useChecksum = checksumCalculator->getVersion() > 0;
11168
11169 const unsigned int __size_out_res = (sizeof(GLboolean));
11170 unsigned char *ptr;
11171 unsigned char *buf;
11172 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 8 + 8 + 0 + 1*4;
11173 const size_t checksumSize = checksumCalculator->checksumByteSize();
11174 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11175 buf = stream->alloc(totalSize);
11176 ptr = buf;
11177 int tmp = OP_glUnmapBufferDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11178 memcpy(ptr, &totalSize, 4); ptr += 4;
11179
11180 memcpy(ptr, &target, 4); ptr += 4;
11181 memcpy(ptr, &offset, 4); ptr += 4;
11182 memcpy(ptr, &length, 4); ptr += 4;
11183 memcpy(ptr, &access, 4); ptr += 4;
11184 memcpy(ptr, &paddr, 8); ptr += 8;
11185 memcpy(ptr, &guest_ptr, 8); ptr += 8;
11186 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11187
11188 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11189 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11190
11191 stream->readback(out_res, __size_out_res);
11192 if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
11193 if (useChecksum) {
11194 unsigned char *checksumBufPtr = NULL;
11195 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11196 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11197 stream->readback(checksumBufPtr, checksumSize);
11198 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11199 ALOGE("glUnmapBufferDirect: GL communication error, please report this issue to b.android.com.\n");
11200 abort();
11201 }
11202 }
11203}
11204
11205void glFlushMappedBufferRangeDirect_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
11206{
11207
11208 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11209 IOStream *stream = ctx->m_stream;
11210 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11211 bool useChecksum = checksumCalculator->getVersion() > 0;
11212
11213 unsigned char *ptr;
11214 unsigned char *buf;
11215 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
11216 const size_t checksumSize = checksumCalculator->checksumByteSize();
11217 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11218 buf = stream->alloc(totalSize);
11219 ptr = buf;
11220 int tmp = OP_glFlushMappedBufferRangeDirect;memcpy(ptr, &tmp, 4); ptr += 4;
11221 memcpy(ptr, &totalSize, 4); ptr += 4;
11222
11223 memcpy(ptr, &target, 4); ptr += 4;
11224 memcpy(ptr, &offset, 4); ptr += 4;
11225 memcpy(ptr, &length, 4); ptr += 4;
11226 memcpy(ptr, &access, 4); ptr += 4;
11227
11228 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11229 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11230
11231}
11232
Yahan Zhou72944ba2019-01-02 15:43:46 -080011233GLenum glGetGraphicsResetStatusEXT_enc(void *self )
11234{
11235
11236 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11237 IOStream *stream = ctx->m_stream;
11238 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11239 bool useChecksum = checksumCalculator->getVersion() > 0;
11240
11241 unsigned char *ptr;
11242 unsigned char *buf;
11243 const size_t sizeWithoutChecksum = 8;
11244 const size_t checksumSize = checksumCalculator->checksumByteSize();
11245 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11246 buf = stream->alloc(totalSize);
11247 ptr = buf;
11248 int tmp = OP_glGetGraphicsResetStatusEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11249 memcpy(ptr, &totalSize, 4); ptr += 4;
11250
11251
11252 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11253 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11254
11255
11256 GLenum retval;
11257 stream->readback(&retval, 4);
11258 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
11259 if (useChecksum) {
11260 unsigned char *checksumBufPtr = NULL;
11261 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11262 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11263 stream->readback(checksumBufPtr, checksumSize);
11264 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11265 ALOGE("glGetGraphicsResetStatusEXT: GL communication error, please report this issue to b.android.com.\n");
11266 abort();
11267 }
11268 }
11269 return retval;
11270}
11271
11272void glReadnPixelsEXT_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid* data)
11273{
11274
11275 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11276 IOStream *stream = ctx->m_stream;
11277 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11278 bool useChecksum = checksumCalculator->getVersion() > 0;
11279
11280 const unsigned int __size_data = bufSize;
11281 unsigned char *ptr;
11282 unsigned char *buf;
11283 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
11284 const size_t checksumSize = checksumCalculator->checksumByteSize();
11285 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11286 buf = stream->alloc(totalSize);
11287 ptr = buf;
11288 int tmp = OP_glReadnPixelsEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11289 memcpy(ptr, &totalSize, 4); ptr += 4;
11290
11291 memcpy(ptr, &x, 4); ptr += 4;
11292 memcpy(ptr, &y, 4); ptr += 4;
11293 memcpy(ptr, &width, 4); ptr += 4;
11294 memcpy(ptr, &height, 4); ptr += 4;
11295 memcpy(ptr, &format, 4); ptr += 4;
11296 memcpy(ptr, &type, 4); ptr += 4;
11297 memcpy(ptr, &bufSize, 4); ptr += 4;
11298 *(unsigned int *)(ptr) = __size_data; ptr += 4;
11299
11300 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11301 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11302
11303 stream->readback(data, __size_data);
11304 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
11305 if (useChecksum) {
11306 unsigned char *checksumBufPtr = NULL;
11307 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11308 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11309 stream->readback(checksumBufPtr, checksumSize);
11310 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11311 ALOGE("glReadnPixelsEXT: GL communication error, please report this issue to b.android.com.\n");
11312 abort();
11313 }
11314 }
11315}
11316
11317void glGetnUniformfvEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
11318{
11319
11320 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11321 IOStream *stream = ctx->m_stream;
11322 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11323 bool useChecksum = checksumCalculator->getVersion() > 0;
11324
11325 const unsigned int __size_params = bufSize;
11326 unsigned char *ptr;
11327 unsigned char *buf;
11328 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11329 const size_t checksumSize = checksumCalculator->checksumByteSize();
11330 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11331 buf = stream->alloc(totalSize);
11332 ptr = buf;
11333 int tmp = OP_glGetnUniformfvEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11334 memcpy(ptr, &totalSize, 4); ptr += 4;
11335
11336 memcpy(ptr, &program, 4); ptr += 4;
11337 memcpy(ptr, &location, 4); ptr += 4;
11338 memcpy(ptr, &bufSize, 4); ptr += 4;
11339 *(unsigned int *)(ptr) = __size_params; ptr += 4;
11340
11341 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11342 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11343
11344 stream->readback(params, __size_params);
11345 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11346 if (useChecksum) {
11347 unsigned char *checksumBufPtr = NULL;
11348 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11349 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11350 stream->readback(checksumBufPtr, checksumSize);
11351 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11352 ALOGE("glGetnUniformfvEXT: GL communication error, please report this issue to b.android.com.\n");
11353 abort();
11354 }
11355 }
11356}
11357
11358void glGetnUniformivEXT_enc(void *self , GLuint program, GLint location, GLsizei bufSize, GLint* params)
11359{
11360
11361 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11362 IOStream *stream = ctx->m_stream;
11363 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11364 bool useChecksum = checksumCalculator->getVersion() > 0;
11365
11366 const unsigned int __size_params = bufSize;
11367 unsigned char *ptr;
11368 unsigned char *buf;
11369 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11370 const size_t checksumSize = checksumCalculator->checksumByteSize();
11371 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11372 buf = stream->alloc(totalSize);
11373 ptr = buf;
11374 int tmp = OP_glGetnUniformivEXT;memcpy(ptr, &tmp, 4); ptr += 4;
11375 memcpy(ptr, &totalSize, 4); ptr += 4;
11376
11377 memcpy(ptr, &program, 4); ptr += 4;
11378 memcpy(ptr, &location, 4); ptr += 4;
11379 memcpy(ptr, &bufSize, 4); ptr += 4;
11380 *(unsigned int *)(ptr) = __size_params; ptr += 4;
11381
11382 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11383 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11384
11385 stream->readback(params, __size_params);
11386 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11387 if (useChecksum) {
11388 unsigned char *checksumBufPtr = NULL;
11389 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11390 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11391 stream->readback(checksumBufPtr, checksumSize);
11392 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11393 ALOGE("glGetnUniformivEXT: GL communication error, please report this issue to b.android.com.\n");
11394 abort();
11395 }
11396 }
11397}
11398
Lingfeng Yang09545912019-01-30 09:22:38 -080011399void glDrawArraysNullAEMU_enc(void *self , GLenum mode, GLint first, GLsizei count)
11400{
11401
11402 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11403 IOStream *stream = ctx->m_stream;
11404 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11405 bool useChecksum = checksumCalculator->getVersion() > 0;
11406
11407 unsigned char *ptr;
11408 unsigned char *buf;
11409 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
11410 const size_t checksumSize = checksumCalculator->checksumByteSize();
11411 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11412 buf = stream->alloc(totalSize);
11413 ptr = buf;
11414 int tmp = OP_glDrawArraysNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11415 memcpy(ptr, &totalSize, 4); ptr += 4;
11416
11417 memcpy(ptr, &mode, 4); ptr += 4;
11418 memcpy(ptr, &first, 4); ptr += 4;
11419 memcpy(ptr, &count, 4); ptr += 4;
11420
11421 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11422 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11423
11424}
11425
11426void glDrawElementsOffsetNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
11427{
11428
11429 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11430 IOStream *stream = ctx->m_stream;
11431 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11432 bool useChecksum = checksumCalculator->getVersion() > 0;
11433
11434 unsigned char *ptr;
11435 unsigned char *buf;
11436 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
11437 const size_t checksumSize = checksumCalculator->checksumByteSize();
11438 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11439 buf = stream->alloc(totalSize);
11440 ptr = buf;
11441 int tmp = OP_glDrawElementsOffsetNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11442 memcpy(ptr, &totalSize, 4); ptr += 4;
11443
11444 memcpy(ptr, &mode, 4); ptr += 4;
11445 memcpy(ptr, &count, 4); ptr += 4;
11446 memcpy(ptr, &type, 4); ptr += 4;
11447 memcpy(ptr, &offset, 4); ptr += 4;
11448
11449 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11450 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11451
11452}
11453
11454void glDrawElementsDataNullAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
11455{
11456
11457 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11458 IOStream *stream = ctx->m_stream;
11459 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11460 bool useChecksum = checksumCalculator->getVersion() > 0;
11461
11462 const unsigned int __size_data = datalen;
11463 unsigned char *ptr;
11464 unsigned char *buf;
11465 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
11466 const size_t checksumSize = checksumCalculator->checksumByteSize();
11467 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11468 buf = stream->alloc(totalSize);
11469 ptr = buf;
11470 int tmp = OP_glDrawElementsDataNullAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11471 memcpy(ptr, &totalSize, 4); ptr += 4;
11472
11473 memcpy(ptr, &mode, 4); ptr += 4;
11474 memcpy(ptr, &count, 4); ptr += 4;
11475 memcpy(ptr, &type, 4); ptr += 4;
11476 *(unsigned int *)(ptr) = __size_data; ptr += 4;
11477 memcpy(ptr, data, __size_data);ptr += __size_data;
11478 memcpy(ptr, &datalen, 4); ptr += 4;
11479
11480 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11481 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11482
11483}
11484
Lingfeng Yang22e361a2019-10-12 07:19:00 -070011485void glUnmapBufferAsyncAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
11486{
11487
11488 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11489 IOStream *stream = ctx->m_stream;
11490 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11491 bool useChecksum = checksumCalculator->getVersion() > 0;
11492
11493 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
11494 const unsigned int __size_out_res = (sizeof(GLboolean));
11495 unsigned char *ptr;
11496 unsigned char *buf;
11497 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + __size_out_res + 2*4;
11498 const size_t checksumSize = checksumCalculator->checksumByteSize();
11499 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11500 buf = stream->alloc(8 + 4 + 4 + 4 + 4);
11501 ptr = buf;
11502 int tmp = OP_glUnmapBufferAsyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
11503 memcpy(ptr, &totalSize, 4); ptr += 4;
11504
11505 memcpy(ptr, &target, 4); ptr += 4;
11506 memcpy(ptr, &offset, 4); ptr += 4;
11507 memcpy(ptr, &length, 4); ptr += 4;
11508 memcpy(ptr, &access, 4); ptr += 4;
11509
11510 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11511 stream->flush();
11512 stream->writeFully(&__size_guest_buffer,4);
11513 if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4);
11514 if (guest_buffer != NULL) {
11515 stream->writeFully(guest_buffer, __size_guest_buffer);
11516 if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer);
11517 }
11518 buf = stream->alloc(__size_out_res + 1*4);
11519 ptr = buf;
11520 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
11521 memcpy(ptr, out_res, __size_out_res);ptr += __size_out_res;
11522
11523 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11524 buf = stream->alloc(checksumSize);
11525 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
11526
11527}
11528
11529void glFlushMappedBufferRangeAEMU2_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
11530{
11531
11532 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11533 IOStream *stream = ctx->m_stream;
11534 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11535 bool useChecksum = checksumCalculator->getVersion() > 0;
11536
11537 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
11538 unsigned char *ptr;
11539 unsigned char *buf;
11540 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
11541 const size_t checksumSize = checksumCalculator->checksumByteSize();
11542 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11543 buf = stream->alloc(8 + 4 + 4 + 4 + 4);
11544 ptr = buf;
11545 int tmp = OP_glFlushMappedBufferRangeAEMU2;memcpy(ptr, &tmp, 4); ptr += 4;
11546 memcpy(ptr, &totalSize, 4); ptr += 4;
11547
11548 memcpy(ptr, &target, 4); ptr += 4;
11549 memcpy(ptr, &offset, 4); ptr += 4;
11550 memcpy(ptr, &length, 4); ptr += 4;
11551 memcpy(ptr, &access, 4); ptr += 4;
11552
11553 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11554 stream->flush();
11555 stream->writeFully(&__size_guest_buffer,4);
11556 if (useChecksum) checksumCalculator->addBuffer(&__size_guest_buffer,4);
11557 if (guest_buffer != NULL) {
11558 stream->writeFully(guest_buffer, __size_guest_buffer);
11559 if (useChecksum) checksumCalculator->addBuffer(guest_buffer, __size_guest_buffer);
11560 }
11561 buf = stream->alloc(checksumSize);
11562 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
11563
11564}
11565
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010011566} // namespace
David 'Digit' Turner3372af92014-10-29 09:55:08 +010011567
Yahan Zhoub7f09082016-03-10 11:45:02 -080011568gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
keunyoungb85b2752013-03-08 12:28:03 -080011569{
11570 m_stream = stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080011571 m_checksumCalculator = checksumCalculator;
keunyoungb85b2752013-03-08 12:28:03 -080011572
David 'Digit' Turner3afd44b2014-10-30 18:15:04 +010011573 this->glActiveTexture = &glActiveTexture_enc;
11574 this->glAttachShader = &glAttachShader_enc;
11575 this->glBindAttribLocation = &glBindAttribLocation_enc;
11576 this->glBindBuffer = &glBindBuffer_enc;
11577 this->glBindFramebuffer = &glBindFramebuffer_enc;
11578 this->glBindRenderbuffer = &glBindRenderbuffer_enc;
11579 this->glBindTexture = &glBindTexture_enc;
11580 this->glBlendColor = &glBlendColor_enc;
11581 this->glBlendEquation = &glBlendEquation_enc;
11582 this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
11583 this->glBlendFunc = &glBlendFunc_enc;
11584 this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
11585 this->glBufferData = &glBufferData_enc;
11586 this->glBufferSubData = &glBufferSubData_enc;
11587 this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
11588 this->glClear = &glClear_enc;
11589 this->glClearColor = &glClearColor_enc;
11590 this->glClearDepthf = &glClearDepthf_enc;
11591 this->glClearStencil = &glClearStencil_enc;
11592 this->glColorMask = &glColorMask_enc;
11593 this->glCompileShader = &glCompileShader_enc;
11594 this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
11595 this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
11596 this->glCopyTexImage2D = &glCopyTexImage2D_enc;
11597 this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
11598 this->glCreateProgram = &glCreateProgram_enc;
11599 this->glCreateShader = &glCreateShader_enc;
11600 this->glCullFace = &glCullFace_enc;
11601 this->glDeleteBuffers = &glDeleteBuffers_enc;
11602 this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
11603 this->glDeleteProgram = &glDeleteProgram_enc;
11604 this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
11605 this->glDeleteShader = &glDeleteShader_enc;
11606 this->glDeleteTextures = &glDeleteTextures_enc;
11607 this->glDepthFunc = &glDepthFunc_enc;
11608 this->glDepthMask = &glDepthMask_enc;
11609 this->glDepthRangef = &glDepthRangef_enc;
11610 this->glDetachShader = &glDetachShader_enc;
11611 this->glDisable = &glDisable_enc;
11612 this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
11613 this->glDrawArrays = &glDrawArrays_enc;
11614 this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
11615 this->glEnable = &glEnable_enc;
11616 this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
11617 this->glFinish = &glFinish_enc;
11618 this->glFlush = &glFlush_enc;
11619 this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
11620 this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
11621 this->glFrontFace = &glFrontFace_enc;
11622 this->glGenBuffers = &glGenBuffers_enc;
11623 this->glGenerateMipmap = &glGenerateMipmap_enc;
11624 this->glGenFramebuffers = &glGenFramebuffers_enc;
11625 this->glGenRenderbuffers = &glGenRenderbuffers_enc;
11626 this->glGenTextures = &glGenTextures_enc;
11627 this->glGetActiveAttrib = &glGetActiveAttrib_enc;
11628 this->glGetActiveUniform = &glGetActiveUniform_enc;
11629 this->glGetAttachedShaders = &glGetAttachedShaders_enc;
11630 this->glGetAttribLocation = &glGetAttribLocation_enc;
11631 this->glGetBooleanv = &glGetBooleanv_enc;
11632 this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
11633 this->glGetError = &glGetError_enc;
11634 this->glGetFloatv = &glGetFloatv_enc;
11635 this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
11636 this->glGetIntegerv = &glGetIntegerv_enc;
11637 this->glGetProgramiv = &glGetProgramiv_enc;
11638 this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
11639 this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
11640 this->glGetShaderiv = &glGetShaderiv_enc;
11641 this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
11642 this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
11643 this->glGetShaderSource = &glGetShaderSource_enc;
11644 this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
11645 this->glGetTexParameterfv = &glGetTexParameterfv_enc;
11646 this->glGetTexParameteriv = &glGetTexParameteriv_enc;
11647 this->glGetUniformfv = &glGetUniformfv_enc;
11648 this->glGetUniformiv = &glGetUniformiv_enc;
11649 this->glGetUniformLocation = &glGetUniformLocation_enc;
11650 this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
11651 this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
11652 this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
11653 this->glHint = &glHint_enc;
11654 this->glIsBuffer = &glIsBuffer_enc;
11655 this->glIsEnabled = &glIsEnabled_enc;
11656 this->glIsFramebuffer = &glIsFramebuffer_enc;
11657 this->glIsProgram = &glIsProgram_enc;
11658 this->glIsRenderbuffer = &glIsRenderbuffer_enc;
11659 this->glIsShader = &glIsShader_enc;
11660 this->glIsTexture = &glIsTexture_enc;
11661 this->glLineWidth = &glLineWidth_enc;
11662 this->glLinkProgram = &glLinkProgram_enc;
11663 this->glPixelStorei = &glPixelStorei_enc;
11664 this->glPolygonOffset = &glPolygonOffset_enc;
11665 this->glReadPixels = &glReadPixels_enc;
11666 this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
11667 this->glRenderbufferStorage = &glRenderbufferStorage_enc;
11668 this->glSampleCoverage = &glSampleCoverage_enc;
11669 this->glScissor = &glScissor_enc;
11670 this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
11671 this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
11672 this->glStencilFunc = &glStencilFunc_enc;
11673 this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
11674 this->glStencilMask = &glStencilMask_enc;
11675 this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
11676 this->glStencilOp = &glStencilOp_enc;
11677 this->glStencilOpSeparate = &glStencilOpSeparate_enc;
11678 this->glTexImage2D = &glTexImage2D_enc;
11679 this->glTexParameterf = &glTexParameterf_enc;
11680 this->glTexParameterfv = &glTexParameterfv_enc;
11681 this->glTexParameteri = &glTexParameteri_enc;
11682 this->glTexParameteriv = &glTexParameteriv_enc;
11683 this->glTexSubImage2D = &glTexSubImage2D_enc;
11684 this->glUniform1f = &glUniform1f_enc;
11685 this->glUniform1fv = &glUniform1fv_enc;
11686 this->glUniform1i = &glUniform1i_enc;
11687 this->glUniform1iv = &glUniform1iv_enc;
11688 this->glUniform2f = &glUniform2f_enc;
11689 this->glUniform2fv = &glUniform2fv_enc;
11690 this->glUniform2i = &glUniform2i_enc;
11691 this->glUniform2iv = &glUniform2iv_enc;
11692 this->glUniform3f = &glUniform3f_enc;
11693 this->glUniform3fv = &glUniform3fv_enc;
11694 this->glUniform3i = &glUniform3i_enc;
11695 this->glUniform3iv = &glUniform3iv_enc;
11696 this->glUniform4f = &glUniform4f_enc;
11697 this->glUniform4fv = &glUniform4fv_enc;
11698 this->glUniform4i = &glUniform4i_enc;
11699 this->glUniform4iv = &glUniform4iv_enc;
11700 this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
11701 this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
11702 this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
11703 this->glUseProgram = &glUseProgram_enc;
11704 this->glValidateProgram = &glValidateProgram_enc;
11705 this->glVertexAttrib1f = &glVertexAttrib1f_enc;
11706 this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
11707 this->glVertexAttrib2f = &glVertexAttrib2f_enc;
11708 this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
11709 this->glVertexAttrib3f = &glVertexAttrib3f_enc;
11710 this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
11711 this->glVertexAttrib4f = &glVertexAttrib4f_enc;
11712 this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
11713 this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
11714 this->glViewport = &glViewport_enc;
11715 this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
11716 this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
11717 this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
11718 this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
11719 this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
11720 this->glUnmapBufferOES = &glUnmapBufferOES_enc;
11721 this->glTexImage3DOES = &glTexImage3DOES_enc;
11722 this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
11723 this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
11724 this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
11725 this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
11726 this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
11727 this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
11728 this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
11729 this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
11730 this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
11731 this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
11732 this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
11733 this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
11734 this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
11735 this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11736 this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
11737 this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
11738 this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
11739 this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
11740 this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
11741 this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11742 this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
11743 this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
11744 this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
11745 this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
11746 this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
11747 this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
11748 this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
11749 this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
11750 this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
11751 this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
11752 this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
11753 this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
11754 this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
11755 this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
11756 this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
11757 this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
11758 this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
11759 this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
11760 this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
11761 this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
11762 this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
11763 this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
11764 this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
11765 this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
11766 this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
11767 this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
11768 this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
11769 this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
11770 this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
11771 this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
11772 this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
11773 this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
11774 this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
11775 this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
11776 this->glDrawElementsOffset = &glDrawElementsOffset_enc;
11777 this->glDrawElementsData = &glDrawElementsData_enc;
11778 this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
11779 this->glShaderString = &glShaderString_enc;
11780 this->glFinishRoundTrip = &glFinishRoundTrip_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011781 this->glGenVertexArrays = &glGenVertexArrays_enc;
11782 this->glBindVertexArray = &glBindVertexArray_enc;
11783 this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
11784 this->glIsVertexArray = &glIsVertexArray_enc;
11785 this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
11786 this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
11787 this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
11788 this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
11789 this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
11790 this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
11791 this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
11792 this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
11793 this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
11794 this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
11795 this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
11796 this->glBindBufferRange = &glBindBufferRange_enc;
11797 this->glBindBufferBase = &glBindBufferBase_enc;
11798 this->glCopyBufferSubData = &glCopyBufferSubData_enc;
11799 this->glClearBufferiv = &glClearBufferiv_enc;
11800 this->glClearBufferuiv = &glClearBufferuiv_enc;
11801 this->glClearBufferfv = &glClearBufferfv_enc;
11802 this->glClearBufferfi = &glClearBufferfi_enc;
11803 this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
11804 this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
11805 this->glUniformBlockBinding = &glUniformBlockBinding_enc;
11806 this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
11807 this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
11808 this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
11809 this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
11810 this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
11811 this->glUniform1ui = &glUniform1ui_enc;
11812 this->glUniform2ui = &glUniform2ui_enc;
11813 this->glUniform3ui = &glUniform3ui_enc;
11814 this->glUniform4ui = &glUniform4ui_enc;
11815 this->glUniform1uiv = &glUniform1uiv_enc;
11816 this->glUniform2uiv = &glUniform2uiv_enc;
11817 this->glUniform3uiv = &glUniform3uiv_enc;
11818 this->glUniform4uiv = &glUniform4uiv_enc;
11819 this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
11820 this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
11821 this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
11822 this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
11823 this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
11824 this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
11825 this->glGetUniformuiv = &glGetUniformuiv_enc;
11826 this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
11827 this->glVertexAttribI4i = &glVertexAttribI4i_enc;
11828 this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
11829 this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
11830 this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
11831 this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
11832 this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
11833 this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
11834 this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
11835 this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
11836 this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
11837 this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
11838 this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
11839 this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
11840 this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
11841 this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
11842 this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
11843 this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
Lingfeng Yangf000ab42017-01-11 18:31:38 -080011844 this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
11845 this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
11846 this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
11847 this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
11848 this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
11849 this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
11850 this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
11851 this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
11852 this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
11853 this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
11854 this->glIsSyncAEMU = &glIsSyncAEMU_enc;
11855 this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011856 this->glDrawBuffers = &glDrawBuffers_enc;
11857 this->glReadBuffer = &glReadBuffer_enc;
11858 this->glBlitFramebuffer = &glBlitFramebuffer_enc;
11859 this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
11860 this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
11861 this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
11862 this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
11863 this->glTexStorage2D = &glTexStorage2D_enc;
11864 this->glGetInternalformativ = &glGetInternalformativ_enc;
11865 this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
11866 this->glEndTransformFeedback = &glEndTransformFeedback_enc;
11867 this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
11868 this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
11869 this->glBindTransformFeedback = &glBindTransformFeedback_enc;
11870 this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
11871 this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
11872 this->glIsTransformFeedback = &glIsTransformFeedback_enc;
11873 this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
11874 this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
11875 this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
11876 this->glGenSamplers = &glGenSamplers_enc;
11877 this->glDeleteSamplers = &glDeleteSamplers_enc;
11878 this->glBindSampler = &glBindSampler_enc;
11879 this->glSamplerParameterf = &glSamplerParameterf_enc;
11880 this->glSamplerParameteri = &glSamplerParameteri_enc;
11881 this->glSamplerParameterfv = &glSamplerParameterfv_enc;
11882 this->glSamplerParameteriv = &glSamplerParameteriv_enc;
11883 this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
11884 this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
11885 this->glIsSampler = &glIsSampler_enc;
11886 this->glGenQueries = &glGenQueries_enc;
11887 this->glDeleteQueries = &glDeleteQueries_enc;
11888 this->glBeginQuery = &glBeginQuery_enc;
11889 this->glEndQuery = &glEndQuery_enc;
11890 this->glGetQueryiv = &glGetQueryiv_enc;
11891 this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
11892 this->glIsQuery = &glIsQuery_enc;
11893 this->glProgramParameteri = &glProgramParameteri_enc;
11894 this->glProgramBinary = &glProgramBinary_enc;
11895 this->glGetProgramBinary = &glGetProgramBinary_enc;
11896 this->glGetFragDataLocation = &glGetFragDataLocation_enc;
11897 this->glGetInteger64v = &glGetInteger64v_enc;
11898 this->glGetIntegeri_v = &glGetIntegeri_v_enc;
11899 this->glGetInteger64i_v = &glGetInteger64i_v_enc;
11900 this->glTexImage3D = &glTexImage3D_enc;
11901 this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
11902 this->glTexStorage3D = &glTexStorage3D_enc;
11903 this->glTexSubImage3D = &glTexSubImage3D_enc;
11904 this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
11905 this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
11906 this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
11907 this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
11908 this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
11909 this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
11910 this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
11911 this->glGetBooleani_v = &glGetBooleani_v_enc;
11912 this->glMemoryBarrier = &glMemoryBarrier_enc;
11913 this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
11914 this->glGenProgramPipelines = &glGenProgramPipelines_enc;
11915 this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
11916 this->glBindProgramPipeline = &glBindProgramPipeline_enc;
11917 this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
11918 this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
11919 this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
11920 this->glIsProgramPipeline = &glIsProgramPipeline_enc;
11921 this->glUseProgramStages = &glUseProgramStages_enc;
Lingfeng Yangd3ae1062017-01-18 11:42:04 -080011922 this->glActiveShaderProgram = &glActiveShaderProgram_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011923 this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
11924 this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
11925 this->glProgramUniform1f = &glProgramUniform1f_enc;
11926 this->glProgramUniform2f = &glProgramUniform2f_enc;
11927 this->glProgramUniform3f = &glProgramUniform3f_enc;
11928 this->glProgramUniform4f = &glProgramUniform4f_enc;
11929 this->glProgramUniform1i = &glProgramUniform1i_enc;
11930 this->glProgramUniform2i = &glProgramUniform2i_enc;
11931 this->glProgramUniform3i = &glProgramUniform3i_enc;
11932 this->glProgramUniform4i = &glProgramUniform4i_enc;
11933 this->glProgramUniform1ui = &glProgramUniform1ui_enc;
11934 this->glProgramUniform2ui = &glProgramUniform2ui_enc;
11935 this->glProgramUniform3ui = &glProgramUniform3ui_enc;
11936 this->glProgramUniform4ui = &glProgramUniform4ui_enc;
11937 this->glProgramUniform1fv = &glProgramUniform1fv_enc;
11938 this->glProgramUniform2fv = &glProgramUniform2fv_enc;
11939 this->glProgramUniform3fv = &glProgramUniform3fv_enc;
11940 this->glProgramUniform4fv = &glProgramUniform4fv_enc;
11941 this->glProgramUniform1iv = &glProgramUniform1iv_enc;
11942 this->glProgramUniform2iv = &glProgramUniform2iv_enc;
11943 this->glProgramUniform3iv = &glProgramUniform3iv_enc;
11944 this->glProgramUniform4iv = &glProgramUniform4iv_enc;
11945 this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
11946 this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
11947 this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
11948 this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
11949 this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
11950 this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
11951 this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
11952 this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
11953 this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
11954 this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
11955 this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
11956 this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
11957 this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
11958 this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
11959 this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
11960 this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
11961 this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
11962 this->glGetProgramResourceName = &glGetProgramResourceName_enc;
11963 this->glBindImageTexture = &glBindImageTexture_enc;
11964 this->glDispatchCompute = &glDispatchCompute_enc;
11965 this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
11966 this->glBindVertexBuffer = &glBindVertexBuffer_enc;
11967 this->glVertexAttribBinding = &glVertexAttribBinding_enc;
11968 this->glVertexAttribFormat = &glVertexAttribFormat_enc;
11969 this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
11970 this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
11971 this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
11972 this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
11973 this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
11974 this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
11975 this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
11976 this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
11977 this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
11978 this->glSampleMaski = &glSampleMaski_enc;
11979 this->glGetMultisamplefv = &glGetMultisamplefv_enc;
11980 this->glFramebufferParameteri = &glFramebufferParameteri_enc;
11981 this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
11982 this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
11983 this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
Roman Kiryanovbe1c0c22018-10-02 18:07:14 -070011984 this->glMapBufferRangeDMA = &glMapBufferRangeDMA_enc;
11985 this->glUnmapBufferDMA = &glUnmapBufferDMA_enc;
Roman Kiryanovdaecd142018-11-14 14:56:27 -080011986 this->glMapBufferRangeDirect = &glMapBufferRangeDirect_enc;
11987 this->glUnmapBufferDirect = &glUnmapBufferDirect_enc;
11988 this->glFlushMappedBufferRangeDirect = &glFlushMappedBufferRangeDirect_enc;
Yahan Zhou72944ba2019-01-02 15:43:46 -080011989 this->glGetGraphicsResetStatusEXT = &glGetGraphicsResetStatusEXT_enc;
11990 this->glReadnPixelsEXT = &glReadnPixelsEXT_enc;
11991 this->glGetnUniformfvEXT = &glGetnUniformfvEXT_enc;
11992 this->glGetnUniformivEXT = &glGetnUniformivEXT_enc;
Lingfeng Yang09545912019-01-30 09:22:38 -080011993 this->glDrawArraysNullAEMU = &glDrawArraysNullAEMU_enc;
11994 this->glDrawElementsNullAEMU = (glDrawElementsNullAEMU_client_proc_t) &enc_unsupported;
11995 this->glDrawElementsOffsetNullAEMU = &glDrawElementsOffsetNullAEMU_enc;
11996 this->glDrawElementsDataNullAEMU = &glDrawElementsDataNullAEMU_enc;
Lingfeng Yang22e361a2019-10-12 07:19:00 -070011997 this->glUnmapBufferAsyncAEMU = &glUnmapBufferAsyncAEMU_enc;
11998 this->glFlushMappedBufferRangeAEMU2 = &glFlushMappedBufferRangeAEMU2_enc;
keunyoungb85b2752013-03-08 12:28:03 -080011999}
12000