blob: f42e7ba3c16b12bbfe0856e8af9d273636173e31 [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
11#include <stdio.h>
David 'Digit' Turner3372af92014-10-29 09:55:08 +010012
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010013namespace {
David 'Digit' Turner3372af92014-10-29 09:55:08 +010014
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010015void enc_unsupported()
keunyoungb85b2752013-03-08 12:28:03 -080016{
17 ALOGE("Function is unsupported\n");
18}
19
20void glActiveTexture_enc(void *self , GLenum texture)
21{
22
23 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
24 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070026 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080027
28 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080029 unsigned char *buf;
30 const size_t sizeWithoutChecksum = 8 + 4;
31 const size_t checksumSize = checksumCalculator->checksumByteSize();
32 const size_t totalSize = sizeWithoutChecksum + checksumSize;
33 buf = stream->alloc(totalSize);
34 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -080035 int tmp = OP_glActiveTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080036 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080037
38 memcpy(ptr, &texture, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080039
Yahan Zhoue222fd52016-03-16 12:41:08 -070040 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
41 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
42
keunyoungb85b2752013-03-08 12:28:03 -080043}
44
45void glAttachShader_enc(void *self , GLuint program, GLuint shader)
46{
47
48 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
49 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070051 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080052
53 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080054 unsigned char *buf;
55 const size_t sizeWithoutChecksum = 8 + 4 + 4;
56 const size_t checksumSize = checksumCalculator->checksumByteSize();
57 const size_t totalSize = sizeWithoutChecksum + checksumSize;
58 buf = stream->alloc(totalSize);
59 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -080060 int tmp = OP_glAttachShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080061 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080062
63 memcpy(ptr, &program, 4); ptr += 4;
64 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080065
Yahan Zhoue222fd52016-03-16 12:41:08 -070066 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
67 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
68
keunyoungb85b2752013-03-08 12:28:03 -080069}
70
71void glBindAttribLocation_enc(void *self , GLuint program, GLuint index, const GLchar* name)
72{
73
74 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
75 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080076 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -070077 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -080078
79 const unsigned int __size_name = (strlen(name) + 1);
80 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -080081 unsigned char *buf;
82 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
83 const size_t checksumSize = checksumCalculator->checksumByteSize();
84 const size_t totalSize = sizeWithoutChecksum + checksumSize;
85 buf = stream->alloc(totalSize);
86 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -080087 int tmp = OP_glBindAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -080088 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -080089
90 memcpy(ptr, &program, 4); ptr += 4;
91 memcpy(ptr, &index, 4); ptr += 4;
92 *(unsigned int *)(ptr) = __size_name; ptr += 4;
93 memcpy(ptr, name, __size_name);ptr += __size_name;
Yahan Zhoub7f09082016-03-10 11:45:02 -080094
Yahan Zhoue222fd52016-03-16 12:41:08 -070095 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
96 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
97
keunyoungb85b2752013-03-08 12:28:03 -080098}
99
100void glBindBuffer_enc(void *self , GLenum target, GLuint buffer)
101{
102
103 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
104 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800105 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700106 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800107
108 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800109 unsigned char *buf;
110 const size_t sizeWithoutChecksum = 8 + 4 + 4;
111 const size_t checksumSize = checksumCalculator->checksumByteSize();
112 const size_t totalSize = sizeWithoutChecksum + checksumSize;
113 buf = stream->alloc(totalSize);
114 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800115 int tmp = OP_glBindBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800116 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800117
118 memcpy(ptr, &target, 4); ptr += 4;
119 memcpy(ptr, &buffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800120
Yahan Zhoue222fd52016-03-16 12:41:08 -0700121 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
122 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
123
keunyoungb85b2752013-03-08 12:28:03 -0800124}
125
126void glBindFramebuffer_enc(void *self , GLenum target, GLuint framebuffer)
127{
128
129 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
130 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800131 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700132 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800133
134 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800135 unsigned char *buf;
136 const size_t sizeWithoutChecksum = 8 + 4 + 4;
137 const size_t checksumSize = checksumCalculator->checksumByteSize();
138 const size_t totalSize = sizeWithoutChecksum + checksumSize;
139 buf = stream->alloc(totalSize);
140 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800141 int tmp = OP_glBindFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800142 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800143
144 memcpy(ptr, &target, 4); ptr += 4;
145 memcpy(ptr, &framebuffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800146
Yahan Zhoue222fd52016-03-16 12:41:08 -0700147 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
148 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
149
keunyoungb85b2752013-03-08 12:28:03 -0800150}
151
152void glBindRenderbuffer_enc(void *self , GLenum target, GLuint renderbuffer)
153{
154
155 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
156 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800157 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700158 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800159
160 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800161 unsigned char *buf;
162 const size_t sizeWithoutChecksum = 8 + 4 + 4;
163 const size_t checksumSize = checksumCalculator->checksumByteSize();
164 const size_t totalSize = sizeWithoutChecksum + checksumSize;
165 buf = stream->alloc(totalSize);
166 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800167 int tmp = OP_glBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800168 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800169
170 memcpy(ptr, &target, 4); ptr += 4;
171 memcpy(ptr, &renderbuffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800172
Yahan Zhoue222fd52016-03-16 12:41:08 -0700173 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
174 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
175
keunyoungb85b2752013-03-08 12:28:03 -0800176}
177
178void glBindTexture_enc(void *self , GLenum target, GLuint texture)
179{
180
181 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
182 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800183 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700184 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800185
186 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800187 unsigned char *buf;
188 const size_t sizeWithoutChecksum = 8 + 4 + 4;
189 const size_t checksumSize = checksumCalculator->checksumByteSize();
190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
191 buf = stream->alloc(totalSize);
192 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800193 int tmp = OP_glBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800194 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800195
196 memcpy(ptr, &target, 4); ptr += 4;
197 memcpy(ptr, &texture, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800198
Yahan Zhoue222fd52016-03-16 12:41:08 -0700199 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
200 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
201
keunyoungb85b2752013-03-08 12:28:03 -0800202}
203
204void glBlendColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
205{
206
207 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
208 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800209 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700210 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800211
212 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800213 unsigned char *buf;
214 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
215 const size_t checksumSize = checksumCalculator->checksumByteSize();
216 const size_t totalSize = sizeWithoutChecksum + checksumSize;
217 buf = stream->alloc(totalSize);
218 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800219 int tmp = OP_glBlendColor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800220 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800221
222 memcpy(ptr, &red, 4); ptr += 4;
223 memcpy(ptr, &green, 4); ptr += 4;
224 memcpy(ptr, &blue, 4); ptr += 4;
225 memcpy(ptr, &alpha, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800226
Yahan Zhoue222fd52016-03-16 12:41:08 -0700227 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
228 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
229
keunyoungb85b2752013-03-08 12:28:03 -0800230}
231
232void glBlendEquation_enc(void *self , GLenum mode)
233{
234
235 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
236 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800237 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700238 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800239
240 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800241 unsigned char *buf;
242 const size_t sizeWithoutChecksum = 8 + 4;
243 const size_t checksumSize = checksumCalculator->checksumByteSize();
244 const size_t totalSize = sizeWithoutChecksum + checksumSize;
245 buf = stream->alloc(totalSize);
246 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800247 int tmp = OP_glBlendEquation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800248 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800249
250 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800251
Yahan Zhoue222fd52016-03-16 12:41:08 -0700252 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
253 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
254
keunyoungb85b2752013-03-08 12:28:03 -0800255}
256
257void glBlendEquationSeparate_enc(void *self , GLenum modeRGB, GLenum modeAlpha)
258{
259
260 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
261 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800262 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700263 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800264
265 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800266 unsigned char *buf;
267 const size_t sizeWithoutChecksum = 8 + 4 + 4;
268 const size_t checksumSize = checksumCalculator->checksumByteSize();
269 const size_t totalSize = sizeWithoutChecksum + checksumSize;
270 buf = stream->alloc(totalSize);
271 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800272 int tmp = OP_glBlendEquationSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800273 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800274
275 memcpy(ptr, &modeRGB, 4); ptr += 4;
276 memcpy(ptr, &modeAlpha, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800277
Yahan Zhoue222fd52016-03-16 12:41:08 -0700278 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
279 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
280
keunyoungb85b2752013-03-08 12:28:03 -0800281}
282
283void glBlendFunc_enc(void *self , GLenum sfactor, GLenum dfactor)
284{
285
286 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
287 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800288 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700289 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800290
291 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800292 unsigned char *buf;
293 const size_t sizeWithoutChecksum = 8 + 4 + 4;
294 const size_t checksumSize = checksumCalculator->checksumByteSize();
295 const size_t totalSize = sizeWithoutChecksum + checksumSize;
296 buf = stream->alloc(totalSize);
297 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800298 int tmp = OP_glBlendFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800299 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800300
301 memcpy(ptr, &sfactor, 4); ptr += 4;
302 memcpy(ptr, &dfactor, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800303
Yahan Zhoue222fd52016-03-16 12:41:08 -0700304 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
305 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
306
keunyoungb85b2752013-03-08 12:28:03 -0800307}
308
309void glBlendFuncSeparate_enc(void *self , GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
310{
311
312 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
313 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800314 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700315 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800316
317 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800318 unsigned char *buf;
319 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
320 const size_t checksumSize = checksumCalculator->checksumByteSize();
321 const size_t totalSize = sizeWithoutChecksum + checksumSize;
322 buf = stream->alloc(totalSize);
323 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800324 int tmp = OP_glBlendFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800325 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800326
327 memcpy(ptr, &srcRGB, 4); ptr += 4;
328 memcpy(ptr, &dstRGB, 4); ptr += 4;
329 memcpy(ptr, &srcAlpha, 4); ptr += 4;
330 memcpy(ptr, &dstAlpha, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800331
Yahan Zhoue222fd52016-03-16 12:41:08 -0700332 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
333 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
334
keunyoungb85b2752013-03-08 12:28:03 -0800335}
336
337void glBufferData_enc(void *self , GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
338{
339
340 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
341 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800342 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700343 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800344
345 const unsigned int __size_data = ((data != NULL) ? size : 0);
346 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800347 unsigned char *buf;
348 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_data + 4 + 1*4;
349 const size_t checksumSize = checksumCalculator->checksumByteSize();
350 const size_t totalSize = sizeWithoutChecksum + checksumSize;
351 buf = stream->alloc(8 + 4 + 4);
352 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800353 int tmp = OP_glBufferData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800354 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800355
356 memcpy(ptr, &target, 4); ptr += 4;
357 memcpy(ptr, &size, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800358
Yahan Zhoue222fd52016-03-16 12:41:08 -0700359 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800360 stream->flush();
361 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700362 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800363 if (data != NULL) {
364 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700365 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800366 }
367 buf = stream->alloc(4);
368 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800369 memcpy(ptr, &usage, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800370
Yahan Zhoue222fd52016-03-16 12:41:08 -0700371 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800372 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700373 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
374
keunyoungb85b2752013-03-08 12:28:03 -0800375}
376
377void glBufferSubData_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
378{
379
380 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
381 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800382 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700383 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800384
Yahan Zhou268e85c2016-02-19 13:59:34 -0800385 const unsigned int __size_data = ((data != NULL) ? size : 0);
keunyoungb85b2752013-03-08 12:28:03 -0800386 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800387 unsigned char *buf;
388 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 1*4;
389 const size_t checksumSize = checksumCalculator->checksumByteSize();
390 const size_t totalSize = sizeWithoutChecksum + checksumSize;
391 buf = stream->alloc(8 + 4 + 4 + 4);
392 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800393 int tmp = OP_glBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800394 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800395
396 memcpy(ptr, &target, 4); ptr += 4;
397 memcpy(ptr, &offset, 4); ptr += 4;
398 memcpy(ptr, &size, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800399
Yahan Zhoue222fd52016-03-16 12:41:08 -0700400 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800401 stream->flush();
402 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700403 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800404 if (data != NULL) {
405 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700406 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800407 }
408 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700409 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
410
keunyoungb85b2752013-03-08 12:28:03 -0800411}
412
413GLenum glCheckFramebufferStatus_enc(void *self , GLenum target)
414{
415
416 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
417 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800418 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700419 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800420
421 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800422 unsigned char *buf;
423 const size_t sizeWithoutChecksum = 8 + 4;
424 const size_t checksumSize = checksumCalculator->checksumByteSize();
425 const size_t totalSize = sizeWithoutChecksum + checksumSize;
426 buf = stream->alloc(totalSize);
427 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800428 int tmp = OP_glCheckFramebufferStatus;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800429 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800430
431 memcpy(ptr, &target, 4); ptr += 4;
432
Yahan Zhoue222fd52016-03-16 12:41:08 -0700433 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
434 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
435
Yahan Zhoub7f09082016-03-10 11:45:02 -0800436
keunyoungb85b2752013-03-08 12:28:03 -0800437 GLenum retval;
438 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700439 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
440 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700441 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700442 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700443 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
444 stream->readback(checksumBufPtr, checksumSize);
445 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700446 ALOGE("glCheckFramebufferStatus: GL communication error, please report this issue to b.android.com.\n");
447 abort();
448 }
449 }
keunyoungb85b2752013-03-08 12:28:03 -0800450 return retval;
451}
452
453void glClear_enc(void *self , GLbitfield mask)
454{
455
456 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
457 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800458 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700459 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800460
461 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800462 unsigned char *buf;
463 const size_t sizeWithoutChecksum = 8 + 4;
464 const size_t checksumSize = checksumCalculator->checksumByteSize();
465 const size_t totalSize = sizeWithoutChecksum + checksumSize;
466 buf = stream->alloc(totalSize);
467 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800468 int tmp = OP_glClear;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800469 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800470
471 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800472
Yahan Zhoue222fd52016-03-16 12:41:08 -0700473 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
474 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
475
keunyoungb85b2752013-03-08 12:28:03 -0800476}
477
478void glClearColor_enc(void *self , GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
479{
480
481 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
482 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800483 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700484 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800485
486 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800487 unsigned char *buf;
488 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
489 const size_t checksumSize = checksumCalculator->checksumByteSize();
490 const size_t totalSize = sizeWithoutChecksum + checksumSize;
491 buf = stream->alloc(totalSize);
492 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800493 int tmp = OP_glClearColor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800494 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800495
496 memcpy(ptr, &red, 4); ptr += 4;
497 memcpy(ptr, &green, 4); ptr += 4;
498 memcpy(ptr, &blue, 4); ptr += 4;
499 memcpy(ptr, &alpha, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800500
Yahan Zhoue222fd52016-03-16 12:41:08 -0700501 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
502 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
503
keunyoungb85b2752013-03-08 12:28:03 -0800504}
505
506void glClearDepthf_enc(void *self , GLclampf depth)
507{
508
509 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
510 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800511 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700512 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800513
514 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800515 unsigned char *buf;
516 const size_t sizeWithoutChecksum = 8 + 4;
517 const size_t checksumSize = checksumCalculator->checksumByteSize();
518 const size_t totalSize = sizeWithoutChecksum + checksumSize;
519 buf = stream->alloc(totalSize);
520 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800521 int tmp = OP_glClearDepthf;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800522 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800523
524 memcpy(ptr, &depth, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800525
Yahan Zhoue222fd52016-03-16 12:41:08 -0700526 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
527 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
528
keunyoungb85b2752013-03-08 12:28:03 -0800529}
530
531void glClearStencil_enc(void *self , GLint s)
532{
533
534 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
535 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800536 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700537 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800538
539 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800540 unsigned char *buf;
541 const size_t sizeWithoutChecksum = 8 + 4;
542 const size_t checksumSize = checksumCalculator->checksumByteSize();
543 const size_t totalSize = sizeWithoutChecksum + checksumSize;
544 buf = stream->alloc(totalSize);
545 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800546 int tmp = OP_glClearStencil;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800547 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800548
549 memcpy(ptr, &s, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800550
Yahan Zhoue222fd52016-03-16 12:41:08 -0700551 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
552 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
553
keunyoungb85b2752013-03-08 12:28:03 -0800554}
555
556void glColorMask_enc(void *self , GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
557{
558
559 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
560 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800561 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700562 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800563
564 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800565 unsigned char *buf;
566 const size_t sizeWithoutChecksum = 8 + 1 + 1 + 1 + 1;
567 const size_t checksumSize = checksumCalculator->checksumByteSize();
568 const size_t totalSize = sizeWithoutChecksum + checksumSize;
569 buf = stream->alloc(totalSize);
570 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800571 int tmp = OP_glColorMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800572 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800573
574 memcpy(ptr, &red, 1); ptr += 1;
575 memcpy(ptr, &green, 1); ptr += 1;
576 memcpy(ptr, &blue, 1); ptr += 1;
577 memcpy(ptr, &alpha, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800578
Yahan Zhoue222fd52016-03-16 12:41:08 -0700579 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
580 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
581
keunyoungb85b2752013-03-08 12:28:03 -0800582}
583
584void glCompileShader_enc(void *self , GLuint shader)
585{
586
587 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
588 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800589 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700590 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800591
592 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800593 unsigned char *buf;
594 const size_t sizeWithoutChecksum = 8 + 4;
595 const size_t checksumSize = checksumCalculator->checksumByteSize();
596 const size_t totalSize = sizeWithoutChecksum + checksumSize;
597 buf = stream->alloc(totalSize);
598 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800599 int tmp = OP_glCompileShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800600 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800601
602 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800603
Yahan Zhoue222fd52016-03-16 12:41:08 -0700604 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
605 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
606
keunyoungb85b2752013-03-08 12:28:03 -0800607}
608
609void glCompressedTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
610{
611
612 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
613 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800614 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700615 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800616
617 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
618 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800619 unsigned char *buf;
620 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
621 const size_t checksumSize = checksumCalculator->checksumByteSize();
622 const size_t totalSize = sizeWithoutChecksum + checksumSize;
623 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
624 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800625 int tmp = OP_glCompressedTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800626 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800627
628 memcpy(ptr, &target, 4); ptr += 4;
629 memcpy(ptr, &level, 4); ptr += 4;
630 memcpy(ptr, &internalformat, 4); ptr += 4;
631 memcpy(ptr, &width, 4); ptr += 4;
632 memcpy(ptr, &height, 4); ptr += 4;
633 memcpy(ptr, &border, 4); ptr += 4;
634 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800635
Yahan Zhoue222fd52016-03-16 12:41:08 -0700636 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800637 stream->flush();
638 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700639 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800640 if (data != NULL) {
641 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700642 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800643 }
644 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700645 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
646
keunyoungb85b2752013-03-08 12:28:03 -0800647}
648
649void glCompressedTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
650{
651
652 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
653 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800654 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700655 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800656
Yahan Zhou268e85c2016-02-19 13:59:34 -0800657 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -0800658 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800659 unsigned char *buf;
660 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
661 const size_t checksumSize = checksumCalculator->checksumByteSize();
662 const size_t totalSize = sizeWithoutChecksum + checksumSize;
663 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
664 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800665 int tmp = OP_glCompressedTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800666 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800667
668 memcpy(ptr, &target, 4); ptr += 4;
669 memcpy(ptr, &level, 4); ptr += 4;
670 memcpy(ptr, &xoffset, 4); ptr += 4;
671 memcpy(ptr, &yoffset, 4); ptr += 4;
672 memcpy(ptr, &width, 4); ptr += 4;
673 memcpy(ptr, &height, 4); ptr += 4;
674 memcpy(ptr, &format, 4); ptr += 4;
675 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800676
Yahan Zhoue222fd52016-03-16 12:41:08 -0700677 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -0800678 stream->flush();
679 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700680 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800681 if (data != NULL) {
682 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700683 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -0800684 }
685 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700686 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
687
keunyoungb85b2752013-03-08 12:28:03 -0800688}
689
690void glCopyTexImage2D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
691{
692
693 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
694 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800695 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700696 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800697
698 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800699 unsigned char *buf;
700 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
701 const size_t checksumSize = checksumCalculator->checksumByteSize();
702 const size_t totalSize = sizeWithoutChecksum + checksumSize;
703 buf = stream->alloc(totalSize);
704 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800705 int tmp = OP_glCopyTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800706 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800707
708 memcpy(ptr, &target, 4); ptr += 4;
709 memcpy(ptr, &level, 4); ptr += 4;
710 memcpy(ptr, &internalformat, 4); ptr += 4;
711 memcpy(ptr, &x, 4); ptr += 4;
712 memcpy(ptr, &y, 4); ptr += 4;
713 memcpy(ptr, &width, 4); ptr += 4;
714 memcpy(ptr, &height, 4); ptr += 4;
715 memcpy(ptr, &border, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800716
Yahan Zhoue222fd52016-03-16 12:41:08 -0700717 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
718 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
719
keunyoungb85b2752013-03-08 12:28:03 -0800720}
721
722void glCopyTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
723{
724
725 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
726 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800727 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700728 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800729
730 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800731 unsigned char *buf;
732 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
733 const size_t checksumSize = checksumCalculator->checksumByteSize();
734 const size_t totalSize = sizeWithoutChecksum + checksumSize;
735 buf = stream->alloc(totalSize);
736 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800737 int tmp = OP_glCopyTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800738 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800739
740 memcpy(ptr, &target, 4); ptr += 4;
741 memcpy(ptr, &level, 4); ptr += 4;
742 memcpy(ptr, &xoffset, 4); ptr += 4;
743 memcpy(ptr, &yoffset, 4); ptr += 4;
744 memcpy(ptr, &x, 4); ptr += 4;
745 memcpy(ptr, &y, 4); ptr += 4;
746 memcpy(ptr, &width, 4); ptr += 4;
747 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800748
Yahan Zhoue222fd52016-03-16 12:41:08 -0700749 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
750 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
751
keunyoungb85b2752013-03-08 12:28:03 -0800752}
753
754GLuint glCreateProgram_enc(void *self )
755{
756
757 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
758 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800759 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700760 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800761
762 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800763 unsigned char *buf;
764 const size_t sizeWithoutChecksum = 8;
765 const size_t checksumSize = checksumCalculator->checksumByteSize();
766 const size_t totalSize = sizeWithoutChecksum + checksumSize;
767 buf = stream->alloc(totalSize);
768 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800769 int tmp = OP_glCreateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800770 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800771
772
Yahan Zhoue222fd52016-03-16 12:41:08 -0700773 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
774 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
775
Yahan Zhoub7f09082016-03-10 11:45:02 -0800776
keunyoungb85b2752013-03-08 12:28:03 -0800777 GLuint retval;
778 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700779 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
780 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700781 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700782 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700783 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
784 stream->readback(checksumBufPtr, checksumSize);
785 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700786 ALOGE("glCreateProgram: GL communication error, please report this issue to b.android.com.\n");
787 abort();
788 }
789 }
keunyoungb85b2752013-03-08 12:28:03 -0800790 return retval;
791}
792
793GLuint glCreateShader_enc(void *self , GLenum type)
794{
795
796 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
797 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800798 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700799 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800800
801 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800802 unsigned char *buf;
803 const size_t sizeWithoutChecksum = 8 + 4;
804 const size_t checksumSize = checksumCalculator->checksumByteSize();
805 const size_t totalSize = sizeWithoutChecksum + checksumSize;
806 buf = stream->alloc(totalSize);
807 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800808 int tmp = OP_glCreateShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800809 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800810
811 memcpy(ptr, &type, 4); ptr += 4;
812
Yahan Zhoue222fd52016-03-16 12:41:08 -0700813 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
814 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
815
Yahan Zhoub7f09082016-03-10 11:45:02 -0800816
keunyoungb85b2752013-03-08 12:28:03 -0800817 GLuint retval;
818 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -0700819 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
820 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700821 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -0700822 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -0700823 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
824 stream->readback(checksumBufPtr, checksumSize);
825 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -0700826 ALOGE("glCreateShader: GL communication error, please report this issue to b.android.com.\n");
827 abort();
828 }
829 }
keunyoungb85b2752013-03-08 12:28:03 -0800830 return retval;
831}
832
833void glCullFace_enc(void *self , GLenum mode)
834{
835
836 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
837 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800838 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700839 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800840
841 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800842 unsigned char *buf;
843 const size_t sizeWithoutChecksum = 8 + 4;
844 const size_t checksumSize = checksumCalculator->checksumByteSize();
845 const size_t totalSize = sizeWithoutChecksum + checksumSize;
846 buf = stream->alloc(totalSize);
847 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800848 int tmp = OP_glCullFace;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800849 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800850
851 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800852
Yahan Zhoue222fd52016-03-16 12:41:08 -0700853 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
854 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
855
keunyoungb85b2752013-03-08 12:28:03 -0800856}
857
858void glDeleteBuffers_enc(void *self , GLsizei n, const GLuint* buffers)
859{
860
861 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
862 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800863 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700864 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800865
866 const unsigned int __size_buffers = (n * sizeof(GLuint));
867 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800868 unsigned char *buf;
869 const size_t sizeWithoutChecksum = 8 + 4 + __size_buffers + 1*4;
870 const size_t checksumSize = checksumCalculator->checksumByteSize();
871 const size_t totalSize = sizeWithoutChecksum + checksumSize;
872 buf = stream->alloc(totalSize);
873 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800874 int tmp = OP_glDeleteBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800875 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800876
877 memcpy(ptr, &n, 4); ptr += 4;
878 *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
879 memcpy(ptr, buffers, __size_buffers);ptr += __size_buffers;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800880
Yahan Zhoue222fd52016-03-16 12:41:08 -0700881 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
882 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
883
keunyoungb85b2752013-03-08 12:28:03 -0800884}
885
886void glDeleteFramebuffers_enc(void *self , GLsizei n, const GLuint* framebuffers)
887{
888
889 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
890 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800891 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700892 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800893
894 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
895 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800896 unsigned char *buf;
897 const size_t sizeWithoutChecksum = 8 + 4 + __size_framebuffers + 1*4;
898 const size_t checksumSize = checksumCalculator->checksumByteSize();
899 const size_t totalSize = sizeWithoutChecksum + checksumSize;
900 buf = stream->alloc(totalSize);
901 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800902 int tmp = OP_glDeleteFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800903 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800904
905 memcpy(ptr, &n, 4); ptr += 4;
906 *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
907 memcpy(ptr, framebuffers, __size_framebuffers);ptr += __size_framebuffers;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800908
Yahan Zhoue222fd52016-03-16 12:41:08 -0700909 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
910 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
911
keunyoungb85b2752013-03-08 12:28:03 -0800912}
913
914void glDeleteProgram_enc(void *self , GLuint program)
915{
916
917 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
918 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800919 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700920 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800921
922 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800923 unsigned char *buf;
924 const size_t sizeWithoutChecksum = 8 + 4;
925 const size_t checksumSize = checksumCalculator->checksumByteSize();
926 const size_t totalSize = sizeWithoutChecksum + checksumSize;
927 buf = stream->alloc(totalSize);
928 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800929 int tmp = OP_glDeleteProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800930 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800931
932 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800933
Yahan Zhoue222fd52016-03-16 12:41:08 -0700934 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
935 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
936
keunyoungb85b2752013-03-08 12:28:03 -0800937}
938
939void glDeleteRenderbuffers_enc(void *self , GLsizei n, const GLuint* renderbuffers)
940{
941
942 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
943 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800944 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700945 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800946
947 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
948 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800949 unsigned char *buf;
950 const size_t sizeWithoutChecksum = 8 + 4 + __size_renderbuffers + 1*4;
951 const size_t checksumSize = checksumCalculator->checksumByteSize();
952 const size_t totalSize = sizeWithoutChecksum + checksumSize;
953 buf = stream->alloc(totalSize);
954 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800955 int tmp = OP_glDeleteRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800956 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800957
958 memcpy(ptr, &n, 4); ptr += 4;
959 *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
960 memcpy(ptr, renderbuffers, __size_renderbuffers);ptr += __size_renderbuffers;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800961
Yahan Zhoue222fd52016-03-16 12:41:08 -0700962 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
963 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
964
keunyoungb85b2752013-03-08 12:28:03 -0800965}
966
967void glDeleteShader_enc(void *self , GLuint shader)
968{
969
970 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
971 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800972 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700973 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800974
975 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800976 unsigned char *buf;
977 const size_t sizeWithoutChecksum = 8 + 4;
978 const size_t checksumSize = checksumCalculator->checksumByteSize();
979 const size_t totalSize = sizeWithoutChecksum + checksumSize;
980 buf = stream->alloc(totalSize);
981 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -0800982 int tmp = OP_glDeleteShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800983 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -0800984
985 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800986
Yahan Zhoue222fd52016-03-16 12:41:08 -0700987 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
988 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
989
keunyoungb85b2752013-03-08 12:28:03 -0800990}
991
992void glDeleteTextures_enc(void *self , GLsizei n, const GLuint* textures)
993{
994
995 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
996 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -0800997 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -0700998 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -0800999
1000 const unsigned int __size_textures = (n * sizeof(GLuint));
1001 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001002 unsigned char *buf;
1003 const size_t sizeWithoutChecksum = 8 + 4 + __size_textures + 1*4;
1004 const size_t checksumSize = checksumCalculator->checksumByteSize();
1005 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1006 buf = stream->alloc(totalSize);
1007 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001008 int tmp = OP_glDeleteTextures;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001009 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001010
1011 memcpy(ptr, &n, 4); ptr += 4;
1012 *(unsigned int *)(ptr) = __size_textures; ptr += 4;
1013 memcpy(ptr, textures, __size_textures);ptr += __size_textures;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001014
Yahan Zhoue222fd52016-03-16 12:41:08 -07001015 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1016 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1017
keunyoungb85b2752013-03-08 12:28:03 -08001018}
1019
1020void glDepthFunc_enc(void *self , GLenum func)
1021{
1022
1023 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1024 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001025 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001026 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001027
1028 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001029 unsigned char *buf;
1030 const size_t sizeWithoutChecksum = 8 + 4;
1031 const size_t checksumSize = checksumCalculator->checksumByteSize();
1032 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1033 buf = stream->alloc(totalSize);
1034 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001035 int tmp = OP_glDepthFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001036 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001037
1038 memcpy(ptr, &func, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001039
Yahan Zhoue222fd52016-03-16 12:41:08 -07001040 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1041 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1042
keunyoungb85b2752013-03-08 12:28:03 -08001043}
1044
1045void glDepthMask_enc(void *self , GLboolean flag)
1046{
1047
1048 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1049 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001051 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001052
1053 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001054 unsigned char *buf;
1055 const size_t sizeWithoutChecksum = 8 + 1;
1056 const size_t checksumSize = checksumCalculator->checksumByteSize();
1057 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1058 buf = stream->alloc(totalSize);
1059 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001060 int tmp = OP_glDepthMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001061 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001062
1063 memcpy(ptr, &flag, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001064
Yahan Zhoue222fd52016-03-16 12:41:08 -07001065 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1066 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1067
keunyoungb85b2752013-03-08 12:28:03 -08001068}
1069
1070void glDepthRangef_enc(void *self , GLclampf zNear, GLclampf zFar)
1071{
1072
1073 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1074 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001075 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001076 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001077
1078 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001079 unsigned char *buf;
1080 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1081 const size_t checksumSize = checksumCalculator->checksumByteSize();
1082 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1083 buf = stream->alloc(totalSize);
1084 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001085 int tmp = OP_glDepthRangef;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001086 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001087
1088 memcpy(ptr, &zNear, 4); ptr += 4;
1089 memcpy(ptr, &zFar, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001090
Yahan Zhoue222fd52016-03-16 12:41:08 -07001091 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1092 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1093
keunyoungb85b2752013-03-08 12:28:03 -08001094}
1095
1096void glDetachShader_enc(void *self , GLuint program, GLuint shader)
1097{
1098
1099 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1100 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001101 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001102 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001103
1104 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001105 unsigned char *buf;
1106 const size_t sizeWithoutChecksum = 8 + 4 + 4;
1107 const size_t checksumSize = checksumCalculator->checksumByteSize();
1108 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1109 buf = stream->alloc(totalSize);
1110 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001111 int tmp = OP_glDetachShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001112 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001113
1114 memcpy(ptr, &program, 4); ptr += 4;
1115 memcpy(ptr, &shader, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001116
Yahan Zhoue222fd52016-03-16 12:41:08 -07001117 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1118 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1119
keunyoungb85b2752013-03-08 12:28:03 -08001120}
1121
1122void glDisable_enc(void *self , GLenum cap)
1123{
1124
1125 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1126 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001127 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001128 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001129
1130 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001131 unsigned char *buf;
1132 const size_t sizeWithoutChecksum = 8 + 4;
1133 const size_t checksumSize = checksumCalculator->checksumByteSize();
1134 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1135 buf = stream->alloc(totalSize);
1136 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001137 int tmp = OP_glDisable;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001138 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001139
1140 memcpy(ptr, &cap, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001141
Yahan Zhoue222fd52016-03-16 12:41:08 -07001142 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1143 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1144
keunyoungb85b2752013-03-08 12:28:03 -08001145}
1146
1147void glDisableVertexAttribArray_enc(void *self , GLuint index)
1148{
1149
1150 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1151 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001152 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001153 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001154
1155 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001156 unsigned char *buf;
1157 const size_t sizeWithoutChecksum = 8 + 4;
1158 const size_t checksumSize = checksumCalculator->checksumByteSize();
1159 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1160 buf = stream->alloc(totalSize);
1161 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001162 int tmp = OP_glDisableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001163 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001164
1165 memcpy(ptr, &index, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001166
Yahan Zhoue222fd52016-03-16 12:41:08 -07001167 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1168 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1169
keunyoungb85b2752013-03-08 12:28:03 -08001170}
1171
1172void glDrawArrays_enc(void *self , GLenum mode, GLint first, GLsizei count)
1173{
1174
1175 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1176 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001177 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001178 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001179
1180 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001181 unsigned char *buf;
1182 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
1183 const size_t checksumSize = checksumCalculator->checksumByteSize();
1184 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1185 buf = stream->alloc(totalSize);
1186 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001187 int tmp = OP_glDrawArrays;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001188 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001189
1190 memcpy(ptr, &mode, 4); ptr += 4;
1191 memcpy(ptr, &first, 4); ptr += 4;
1192 memcpy(ptr, &count, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001193
Yahan Zhoue222fd52016-03-16 12:41:08 -07001194 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1195 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1196
keunyoungb85b2752013-03-08 12:28:03 -08001197}
1198
1199void glEnable_enc(void *self , GLenum cap)
1200{
1201
1202 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1203 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001204 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001205 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001206
1207 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001208 unsigned char *buf;
1209 const size_t sizeWithoutChecksum = 8 + 4;
1210 const size_t checksumSize = checksumCalculator->checksumByteSize();
1211 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1212 buf = stream->alloc(totalSize);
1213 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001214 int tmp = OP_glEnable;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001215 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001216
1217 memcpy(ptr, &cap, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001218
Yahan Zhoue222fd52016-03-16 12:41:08 -07001219 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1220 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1221
keunyoungb85b2752013-03-08 12:28:03 -08001222}
1223
1224void glEnableVertexAttribArray_enc(void *self , GLuint index)
1225{
1226
1227 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1228 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001229 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001230 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001231
1232 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001233 unsigned char *buf;
1234 const size_t sizeWithoutChecksum = 8 + 4;
1235 const size_t checksumSize = checksumCalculator->checksumByteSize();
1236 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1237 buf = stream->alloc(totalSize);
1238 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001239 int tmp = OP_glEnableVertexAttribArray;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001240 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001241
1242 memcpy(ptr, &index, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001243
Yahan Zhoue222fd52016-03-16 12:41:08 -07001244 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1245 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1246
keunyoungb85b2752013-03-08 12:28:03 -08001247}
1248
1249void glFinish_enc(void *self )
1250{
1251
1252 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1253 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001254 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001255 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001256
1257 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001258 unsigned char *buf;
1259 const size_t sizeWithoutChecksum = 8;
1260 const size_t checksumSize = checksumCalculator->checksumByteSize();
1261 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1262 buf = stream->alloc(totalSize);
1263 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001264 int tmp = OP_glFinish;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001265 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001266
Yahan Zhoub7f09082016-03-10 11:45:02 -08001267
Yahan Zhoue222fd52016-03-16 12:41:08 -07001268 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1269 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1270
keunyoungb85b2752013-03-08 12:28:03 -08001271}
1272
1273void glFlush_enc(void *self )
1274{
1275
1276 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1277 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001278 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001279 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001280
1281 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001282 unsigned char *buf;
1283 const size_t sizeWithoutChecksum = 8;
1284 const size_t checksumSize = checksumCalculator->checksumByteSize();
1285 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1286 buf = stream->alloc(totalSize);
1287 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001288 int tmp = OP_glFlush;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001289 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001290
Yahan Zhoub7f09082016-03-10 11:45:02 -08001291
Yahan Zhoue222fd52016-03-16 12:41:08 -07001292 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1293 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1294
keunyoungb85b2752013-03-08 12:28:03 -08001295}
1296
1297void glFramebufferRenderbuffer_enc(void *self , GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1298{
1299
1300 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1301 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001302 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001303 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001304
1305 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001306 unsigned char *buf;
1307 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
1308 const size_t checksumSize = checksumCalculator->checksumByteSize();
1309 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1310 buf = stream->alloc(totalSize);
1311 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001312 int tmp = OP_glFramebufferRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001313 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001314
1315 memcpy(ptr, &target, 4); ptr += 4;
1316 memcpy(ptr, &attachment, 4); ptr += 4;
1317 memcpy(ptr, &renderbuffertarget, 4); ptr += 4;
1318 memcpy(ptr, &renderbuffer, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001319
Yahan Zhoue222fd52016-03-16 12:41:08 -07001320 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1321 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1322
keunyoungb85b2752013-03-08 12:28:03 -08001323}
1324
1325void glFramebufferTexture2D_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
1326{
1327
1328 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1329 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001330 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001331 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001332
1333 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001334 unsigned char *buf;
1335 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
1336 const size_t checksumSize = checksumCalculator->checksumByteSize();
1337 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1338 buf = stream->alloc(totalSize);
1339 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001340 int tmp = OP_glFramebufferTexture2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001341 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001342
1343 memcpy(ptr, &target, 4); ptr += 4;
1344 memcpy(ptr, &attachment, 4); ptr += 4;
1345 memcpy(ptr, &textarget, 4); ptr += 4;
1346 memcpy(ptr, &texture, 4); ptr += 4;
1347 memcpy(ptr, &level, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001348
Yahan Zhoue222fd52016-03-16 12:41:08 -07001349 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1350 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1351
keunyoungb85b2752013-03-08 12:28:03 -08001352}
1353
1354void glFrontFace_enc(void *self , GLenum mode)
1355{
1356
1357 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1358 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001359 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001360 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001361
1362 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001363 unsigned char *buf;
1364 const size_t sizeWithoutChecksum = 8 + 4;
1365 const size_t checksumSize = checksumCalculator->checksumByteSize();
1366 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1367 buf = stream->alloc(totalSize);
1368 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001369 int tmp = OP_glFrontFace;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001370 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001371
1372 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001373
Yahan Zhoue222fd52016-03-16 12:41:08 -07001374 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1375 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1376
keunyoungb85b2752013-03-08 12:28:03 -08001377}
1378
1379void glGenBuffers_enc(void *self , GLsizei n, GLuint* buffers)
1380{
1381
1382 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1383 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001384 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001385 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001386
1387 const unsigned int __size_buffers = (n * sizeof(GLuint));
1388 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001389 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001390 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001391 const size_t checksumSize = checksumCalculator->checksumByteSize();
1392 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1393 buf = stream->alloc(totalSize);
1394 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001395 int tmp = OP_glGenBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001396 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001397
1398 memcpy(ptr, &n, 4); ptr += 4;
1399 *(unsigned int *)(ptr) = __size_buffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001400
Yahan Zhoue222fd52016-03-16 12:41:08 -07001401 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1402 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1403
keunyoungb85b2752013-03-08 12:28:03 -08001404 stream->readback(buffers, __size_buffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001405 if (useChecksum) checksumCalculator->addBuffer(buffers, __size_buffers);
1406 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001407 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001408 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001409 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1410 stream->readback(checksumBufPtr, checksumSize);
1411 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001412 ALOGE("glGenBuffers: GL communication error, please report this issue to b.android.com.\n");
1413 abort();
1414 }
1415 }
keunyoungb85b2752013-03-08 12:28:03 -08001416}
1417
1418void glGenerateMipmap_enc(void *self , GLenum target)
1419{
1420
1421 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1422 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001423 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001424 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001425
1426 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001427 unsigned char *buf;
1428 const size_t sizeWithoutChecksum = 8 + 4;
1429 const size_t checksumSize = checksumCalculator->checksumByteSize();
1430 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1431 buf = stream->alloc(totalSize);
1432 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001433 int tmp = OP_glGenerateMipmap;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001434 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001435
1436 memcpy(ptr, &target, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001437
Yahan Zhoue222fd52016-03-16 12:41:08 -07001438 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1439 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1440
keunyoungb85b2752013-03-08 12:28:03 -08001441}
1442
1443void glGenFramebuffers_enc(void *self , GLsizei n, GLuint* framebuffers)
1444{
1445
1446 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1447 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001448 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001449 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001450
1451 const unsigned int __size_framebuffers = (n * sizeof(GLuint));
1452 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001453 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001454 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001455 const size_t checksumSize = checksumCalculator->checksumByteSize();
1456 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1457 buf = stream->alloc(totalSize);
1458 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001459 int tmp = OP_glGenFramebuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001460 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001461
1462 memcpy(ptr, &n, 4); ptr += 4;
1463 *(unsigned int *)(ptr) = __size_framebuffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001464
Yahan Zhoue222fd52016-03-16 12:41:08 -07001465 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1466 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1467
keunyoungb85b2752013-03-08 12:28:03 -08001468 stream->readback(framebuffers, __size_framebuffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001469 if (useChecksum) checksumCalculator->addBuffer(framebuffers, __size_framebuffers);
1470 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001471 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001472 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001473 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1474 stream->readback(checksumBufPtr, checksumSize);
1475 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001476 ALOGE("glGenFramebuffers: GL communication error, please report this issue to b.android.com.\n");
1477 abort();
1478 }
1479 }
keunyoungb85b2752013-03-08 12:28:03 -08001480}
1481
1482void glGenRenderbuffers_enc(void *self , GLsizei n, GLuint* renderbuffers)
1483{
1484
1485 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1486 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001487 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001488 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001489
1490 const unsigned int __size_renderbuffers = (n * sizeof(GLuint));
1491 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001492 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001493 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001494 const size_t checksumSize = checksumCalculator->checksumByteSize();
1495 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1496 buf = stream->alloc(totalSize);
1497 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001498 int tmp = OP_glGenRenderbuffers;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001499 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001500
1501 memcpy(ptr, &n, 4); ptr += 4;
1502 *(unsigned int *)(ptr) = __size_renderbuffers; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001503
Yahan Zhoue222fd52016-03-16 12:41:08 -07001504 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1505 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1506
keunyoungb85b2752013-03-08 12:28:03 -08001507 stream->readback(renderbuffers, __size_renderbuffers);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001508 if (useChecksum) checksumCalculator->addBuffer(renderbuffers, __size_renderbuffers);
1509 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001510 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001511 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001512 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1513 stream->readback(checksumBufPtr, checksumSize);
1514 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001515 ALOGE("glGenRenderbuffers: GL communication error, please report this issue to b.android.com.\n");
1516 abort();
1517 }
1518 }
keunyoungb85b2752013-03-08 12:28:03 -08001519}
1520
1521void glGenTextures_enc(void *self , GLsizei n, GLuint* textures)
1522{
1523
1524 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1525 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001526 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001527 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001528
1529 const unsigned int __size_textures = (n * sizeof(GLuint));
1530 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001531 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001532 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001533 const size_t checksumSize = checksumCalculator->checksumByteSize();
1534 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1535 buf = stream->alloc(totalSize);
1536 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001537 int tmp = OP_glGenTextures;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001538 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001539
1540 memcpy(ptr, &n, 4); ptr += 4;
1541 *(unsigned int *)(ptr) = __size_textures; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001542
Yahan Zhoue222fd52016-03-16 12:41:08 -07001543 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1544 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1545
keunyoungb85b2752013-03-08 12:28:03 -08001546 stream->readback(textures, __size_textures);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001547 if (useChecksum) checksumCalculator->addBuffer(textures, __size_textures);
1548 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001549 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001550 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001551 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1552 stream->readback(checksumBufPtr, checksumSize);
1553 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001554 ALOGE("glGenTextures: GL communication error, please report this issue to b.android.com.\n");
1555 abort();
1556 }
1557 }
keunyoungb85b2752013-03-08 12:28:03 -08001558}
1559
1560void glGetActiveAttrib_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1561{
1562
1563 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1564 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001565 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001566 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001567
1568 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
bohua9ce3ca2015-01-14 09:46:36 -08001569 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1570 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08001571 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1572 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001573 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001574 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001575 const size_t checksumSize = checksumCalculator->checksumByteSize();
1576 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1577 buf = stream->alloc(totalSize);
1578 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001579 int tmp = OP_glGetActiveAttrib;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001580 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001581
1582 memcpy(ptr, &program, 4); ptr += 4;
1583 memcpy(ptr, &index, 4); ptr += 4;
1584 memcpy(ptr, &bufsize, 4); ptr += 4;
1585 *(unsigned int *)(ptr) = __size_length; ptr += 4;
1586 *(unsigned int *)(ptr) = __size_size; ptr += 4;
1587 *(unsigned int *)(ptr) = __size_type; ptr += 4;
1588 *(unsigned int *)(ptr) = __size_name; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001589
Yahan Zhoue222fd52016-03-16 12:41:08 -07001590 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1591 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1592
1593 if (length != NULL) {
1594 stream->readback(length, __size_length);
1595 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1596 }
1597 if (size != NULL) {
1598 stream->readback(size, __size_size);
1599 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1600 }
1601 if (type != NULL) {
1602 stream->readback(type, __size_type);
1603 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1604 }
1605 if (name != NULL) {
1606 stream->readback(name, __size_name);
1607 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1608 }
1609 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001610 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001611 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001612 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1613 stream->readback(checksumBufPtr, checksumSize);
1614 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001615 ALOGE("glGetActiveAttrib: GL communication error, please report this issue to b.android.com.\n");
1616 abort();
1617 }
1618 }
keunyoungb85b2752013-03-08 12:28:03 -08001619}
1620
1621void glGetActiveUniform_enc(void *self , GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
1622{
1623
1624 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1625 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001626 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001627 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001628
1629 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
bohua9ce3ca2015-01-14 09:46:36 -08001630 const unsigned int __size_size = ((size != NULL) ? (sizeof(GLint)) : 0);
1631 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08001632 const unsigned int __size_name = ((name != NULL) ? bufsize : 0);
1633 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001634 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001635 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001636 const size_t checksumSize = checksumCalculator->checksumByteSize();
1637 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1638 buf = stream->alloc(totalSize);
1639 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001640 int tmp = OP_glGetActiveUniform;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001641 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001642
1643 memcpy(ptr, &program, 4); ptr += 4;
1644 memcpy(ptr, &index, 4); ptr += 4;
1645 memcpy(ptr, &bufsize, 4); ptr += 4;
1646 *(unsigned int *)(ptr) = __size_length; ptr += 4;
1647 *(unsigned int *)(ptr) = __size_size; ptr += 4;
1648 *(unsigned int *)(ptr) = __size_type; ptr += 4;
1649 *(unsigned int *)(ptr) = __size_name; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001650
Yahan Zhoue222fd52016-03-16 12:41:08 -07001651 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1652 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1653
1654 if (length != NULL) {
1655 stream->readback(length, __size_length);
1656 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
1657 }
1658 if (size != NULL) {
1659 stream->readback(size, __size_size);
1660 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
1661 }
1662 if (type != NULL) {
1663 stream->readback(type, __size_type);
1664 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
1665 }
1666 if (name != NULL) {
1667 stream->readback(name, __size_name);
1668 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
1669 }
1670 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001671 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001672 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001673 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1674 stream->readback(checksumBufPtr, checksumSize);
1675 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001676 ALOGE("glGetActiveUniform: GL communication error, please report this issue to b.android.com.\n");
1677 abort();
1678 }
1679 }
keunyoungb85b2752013-03-08 12:28:03 -08001680}
1681
1682void glGetAttachedShaders_enc(void *self , GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1683{
1684
1685 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1686 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001687 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001688 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001689
1690 const unsigned int __size_count = ((count != NULL) ? (sizeof(GLsizei)) : 0);
1691 const unsigned int __size_shaders = (maxcount*sizeof(GLuint));
1692 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001693 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001694 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001695 const size_t checksumSize = checksumCalculator->checksumByteSize();
1696 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1697 buf = stream->alloc(totalSize);
1698 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001699 int tmp = OP_glGetAttachedShaders;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001700 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001701
1702 memcpy(ptr, &program, 4); ptr += 4;
1703 memcpy(ptr, &maxcount, 4); ptr += 4;
1704 *(unsigned int *)(ptr) = __size_count; ptr += 4;
1705 *(unsigned int *)(ptr) = __size_shaders; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001706
Yahan Zhoue222fd52016-03-16 12:41:08 -07001707 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1708 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1709
1710 if (count != NULL) {
1711 stream->readback(count, __size_count);
1712 if (useChecksum) checksumCalculator->addBuffer(count, __size_count);
1713 }
keunyoungb85b2752013-03-08 12:28:03 -08001714 stream->readback(shaders, __size_shaders);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001715 if (useChecksum) checksumCalculator->addBuffer(shaders, __size_shaders);
1716 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001717 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001718 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001719 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1720 stream->readback(checksumBufPtr, checksumSize);
1721 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001722 ALOGE("glGetAttachedShaders: GL communication error, please report this issue to b.android.com.\n");
1723 abort();
1724 }
1725 }
keunyoungb85b2752013-03-08 12:28:03 -08001726}
1727
1728int glGetAttribLocation_enc(void *self , GLuint program, const GLchar* name)
1729{
1730
1731 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1732 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001733 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001734 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001735
1736 const unsigned int __size_name = (strlen(name) + 1);
1737 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001738 unsigned char *buf;
1739 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
1740 const size_t checksumSize = checksumCalculator->checksumByteSize();
1741 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1742 buf = stream->alloc(totalSize);
1743 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001744 int tmp = OP_glGetAttribLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001745 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001746
1747 memcpy(ptr, &program, 4); ptr += 4;
1748 *(unsigned int *)(ptr) = __size_name; ptr += 4;
1749 memcpy(ptr, name, __size_name);ptr += __size_name;
1750
Yahan Zhoue222fd52016-03-16 12:41:08 -07001751 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1752 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1753
Yahan Zhoub7f09082016-03-10 11:45:02 -08001754
keunyoungb85b2752013-03-08 12:28:03 -08001755 int retval;
1756 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001757 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1758 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001759 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001760 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001761 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1762 stream->readback(checksumBufPtr, checksumSize);
1763 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001764 ALOGE("glGetAttribLocation: GL communication error, please report this issue to b.android.com.\n");
1765 abort();
1766 }
1767 }
keunyoungb85b2752013-03-08 12:28:03 -08001768 return retval;
1769}
1770
1771void glGetBooleanv_enc(void *self , GLenum pname, GLboolean* params)
1772{
1773
1774 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1775 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001776 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001777 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001778
1779 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLboolean));
1780 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001781 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001782 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001783 const size_t checksumSize = checksumCalculator->checksumByteSize();
1784 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1785 buf = stream->alloc(totalSize);
1786 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001787 int tmp = OP_glGetBooleanv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001788 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001789
1790 memcpy(ptr, &pname, 4); ptr += 4;
1791 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001792
Yahan Zhoue222fd52016-03-16 12:41:08 -07001793 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1794 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1795
keunyoungb85b2752013-03-08 12:28:03 -08001796 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001797 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1798 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001799 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001800 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001801 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1802 stream->readback(checksumBufPtr, checksumSize);
1803 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001804 ALOGE("glGetBooleanv: GL communication error, please report this issue to b.android.com.\n");
1805 abort();
1806 }
1807 }
keunyoungb85b2752013-03-08 12:28:03 -08001808}
1809
1810void glGetBufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
1811{
1812
1813 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1814 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001815 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001816 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001817
1818 const unsigned int __size_params = (sizeof(GLint));
1819 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001820 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001821 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001822 const size_t checksumSize = checksumCalculator->checksumByteSize();
1823 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1824 buf = stream->alloc(totalSize);
1825 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001826 int tmp = OP_glGetBufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001827 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001828
1829 memcpy(ptr, &target, 4); ptr += 4;
1830 memcpy(ptr, &pname, 4); ptr += 4;
1831 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001832
Yahan Zhoue222fd52016-03-16 12:41:08 -07001833 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1834 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1835
keunyoungb85b2752013-03-08 12:28:03 -08001836 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001837 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1838 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001839 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001840 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001841 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1842 stream->readback(checksumBufPtr, checksumSize);
1843 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001844 ALOGE("glGetBufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
1845 abort();
1846 }
1847 }
keunyoungb85b2752013-03-08 12:28:03 -08001848}
1849
1850GLenum glGetError_enc(void *self )
1851{
1852
1853 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1854 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001855 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001856 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001857
1858 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001859 unsigned char *buf;
1860 const size_t sizeWithoutChecksum = 8;
1861 const size_t checksumSize = checksumCalculator->checksumByteSize();
1862 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1863 buf = stream->alloc(totalSize);
1864 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001865 int tmp = OP_glGetError;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001866 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001867
1868
Yahan Zhoue222fd52016-03-16 12:41:08 -07001869 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1870 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1871
Yahan Zhoub7f09082016-03-10 11:45:02 -08001872
keunyoungb85b2752013-03-08 12:28:03 -08001873 GLenum retval;
1874 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001875 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
1876 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001877 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001878 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001879 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1880 stream->readback(checksumBufPtr, checksumSize);
1881 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001882 ALOGE("glGetError: GL communication error, please report this issue to b.android.com.\n");
1883 abort();
1884 }
1885 }
keunyoungb85b2752013-03-08 12:28:03 -08001886 return retval;
1887}
1888
1889void glGetFloatv_enc(void *self , GLenum pname, GLfloat* params)
1890{
1891
1892 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1893 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001894 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001895 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001896
1897 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
1898 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001899 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001900 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001901 const size_t checksumSize = checksumCalculator->checksumByteSize();
1902 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1903 buf = stream->alloc(totalSize);
1904 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001905 int tmp = OP_glGetFloatv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001906 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001907
1908 memcpy(ptr, &pname, 4); ptr += 4;
1909 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001910
Yahan Zhoue222fd52016-03-16 12:41:08 -07001911 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1912 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1913
keunyoungb85b2752013-03-08 12:28:03 -08001914 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001915 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1916 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001917 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001918 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001919 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1920 stream->readback(checksumBufPtr, checksumSize);
1921 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001922 ALOGE("glGetFloatv: GL communication error, please report this issue to b.android.com.\n");
1923 abort();
1924 }
1925 }
keunyoungb85b2752013-03-08 12:28:03 -08001926}
1927
1928void glGetFramebufferAttachmentParameteriv_enc(void *self , GLenum target, GLenum attachment, GLenum pname, GLint* params)
1929{
1930
1931 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1932 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001933 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001934 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001935
1936 const unsigned int __size_params = (sizeof(GLint));
1937 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001938 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001939 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001940 const size_t checksumSize = checksumCalculator->checksumByteSize();
1941 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1942 buf = stream->alloc(totalSize);
1943 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001944 int tmp = OP_glGetFramebufferAttachmentParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001945 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001946
1947 memcpy(ptr, &target, 4); ptr += 4;
1948 memcpy(ptr, &attachment, 4); ptr += 4;
1949 memcpy(ptr, &pname, 4); ptr += 4;
1950 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001951
Yahan Zhoue222fd52016-03-16 12:41:08 -07001952 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1953 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1954
keunyoungb85b2752013-03-08 12:28:03 -08001955 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001956 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1957 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001958 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001959 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001960 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
1961 stream->readback(checksumBufPtr, checksumSize);
1962 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07001963 ALOGE("glGetFramebufferAttachmentParameteriv: GL communication error, please report this issue to b.android.com.\n");
1964 abort();
1965 }
1966 }
keunyoungb85b2752013-03-08 12:28:03 -08001967}
1968
1969void glGetIntegerv_enc(void *self , GLenum pname, GLint* params)
1970{
1971
1972 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
1973 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001974 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07001975 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08001976
1977 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
1978 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001979 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001980 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001981 const size_t checksumSize = checksumCalculator->checksumByteSize();
1982 const size_t totalSize = sizeWithoutChecksum + checksumSize;
1983 buf = stream->alloc(totalSize);
1984 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08001985 int tmp = OP_glGetIntegerv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001986 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08001987
1988 memcpy(ptr, &pname, 4); ptr += 4;
1989 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08001990
Yahan Zhoue222fd52016-03-16 12:41:08 -07001991 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
1992 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
1993
keunyoungb85b2752013-03-08 12:28:03 -08001994 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07001995 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
1996 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001997 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07001998 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07001999 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2000 stream->readback(checksumBufPtr, checksumSize);
2001 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002002 ALOGE("glGetIntegerv: GL communication error, please report this issue to b.android.com.\n");
2003 abort();
2004 }
2005 }
keunyoungb85b2752013-03-08 12:28:03 -08002006}
2007
2008void glGetProgramiv_enc(void *self , GLuint program, GLenum pname, GLint* params)
2009{
2010
2011 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2012 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002013 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002014 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002015
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08002016 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
keunyoungb85b2752013-03-08 12:28:03 -08002017 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002018 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002019 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002020 const size_t checksumSize = checksumCalculator->checksumByteSize();
2021 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2022 buf = stream->alloc(totalSize);
2023 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002024 int tmp = OP_glGetProgramiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002025 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002026
2027 memcpy(ptr, &program, 4); ptr += 4;
2028 memcpy(ptr, &pname, 4); ptr += 4;
2029 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002030
Yahan Zhoue222fd52016-03-16 12:41:08 -07002031 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2032 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2033
keunyoungb85b2752013-03-08 12:28:03 -08002034 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002035 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2036 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002037 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002038 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002039 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2040 stream->readback(checksumBufPtr, checksumSize);
2041 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002042 ALOGE("glGetProgramiv: GL communication error, please report this issue to b.android.com.\n");
2043 abort();
2044 }
2045 }
keunyoungb85b2752013-03-08 12:28:03 -08002046}
2047
2048void glGetProgramInfoLog_enc(void *self , GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2049{
2050
2051 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2052 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002053 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002054 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002055
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +01002056 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08002057 const unsigned int __size_infolog = bufsize;
2058 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002059 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002060 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002061 const size_t checksumSize = checksumCalculator->checksumByteSize();
2062 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2063 buf = stream->alloc(totalSize);
2064 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002065 int tmp = OP_glGetProgramInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002066 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002067
2068 memcpy(ptr, &program, 4); ptr += 4;
2069 memcpy(ptr, &bufsize, 4); ptr += 4;
2070 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2071 *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002072
Yahan Zhoue222fd52016-03-16 12:41:08 -07002073 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2074 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2075
2076 if (length != NULL) {
2077 stream->readback(length, __size_length);
2078 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2079 }
keunyoungb85b2752013-03-08 12:28:03 -08002080 stream->readback(infolog, __size_infolog);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002081 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2082 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002083 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002084 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002085 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2086 stream->readback(checksumBufPtr, checksumSize);
2087 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002088 ALOGE("glGetProgramInfoLog: GL communication error, please report this issue to b.android.com.\n");
2089 abort();
2090 }
2091 }
keunyoungb85b2752013-03-08 12:28:03 -08002092}
2093
2094void glGetRenderbufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2095{
2096
2097 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2098 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002099 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002100 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002101
2102 const unsigned int __size_params = sizeof(GLint);
2103 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002104 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002105 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002106 const size_t checksumSize = checksumCalculator->checksumByteSize();
2107 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2108 buf = stream->alloc(totalSize);
2109 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002110 int tmp = OP_glGetRenderbufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002111 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002112
2113 memcpy(ptr, &target, 4); ptr += 4;
2114 memcpy(ptr, &pname, 4); ptr += 4;
2115 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002116
Yahan Zhoue222fd52016-03-16 12:41:08 -07002117 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2118 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2119
keunyoungb85b2752013-03-08 12:28:03 -08002120 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002121 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2122 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002123 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002124 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002125 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2126 stream->readback(checksumBufPtr, checksumSize);
2127 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002128 ALOGE("glGetRenderbufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
2129 abort();
2130 }
2131 }
keunyoungb85b2752013-03-08 12:28:03 -08002132}
2133
2134void glGetShaderiv_enc(void *self , GLuint shader, GLenum pname, GLint* params)
2135{
2136
2137 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2138 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002139 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002140 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002141
2142 const unsigned int __size_params = sizeof(GLint);
2143 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002144 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002145 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002146 const size_t checksumSize = checksumCalculator->checksumByteSize();
2147 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2148 buf = stream->alloc(totalSize);
2149 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002150 int tmp = OP_glGetShaderiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002151 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002152
2153 memcpy(ptr, &shader, 4); ptr += 4;
2154 memcpy(ptr, &pname, 4); ptr += 4;
2155 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002156
Yahan Zhoue222fd52016-03-16 12:41:08 -07002157 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2158 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2159
keunyoungb85b2752013-03-08 12:28:03 -08002160 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002161 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2162 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002163 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002164 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002165 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2166 stream->readback(checksumBufPtr, checksumSize);
2167 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002168 ALOGE("glGetShaderiv: GL communication error, please report this issue to b.android.com.\n");
2169 abort();
2170 }
2171 }
keunyoungb85b2752013-03-08 12:28:03 -08002172}
2173
2174void glGetShaderInfoLog_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
2175{
2176
2177 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2178 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002179 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002180 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002181
2182 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2183 const unsigned int __size_infolog = bufsize;
2184 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002185 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002186 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002187 const size_t checksumSize = checksumCalculator->checksumByteSize();
2188 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2189 buf = stream->alloc(totalSize);
2190 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002191 int tmp = OP_glGetShaderInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002192 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002193
2194 memcpy(ptr, &shader, 4); ptr += 4;
2195 memcpy(ptr, &bufsize, 4); ptr += 4;
2196 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2197 *(unsigned int *)(ptr) = __size_infolog; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002198
Yahan Zhoue222fd52016-03-16 12:41:08 -07002199 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2200 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2201
2202 if (length != NULL) {
2203 stream->readback(length, __size_length);
2204 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2205 }
keunyoungb85b2752013-03-08 12:28:03 -08002206 stream->readback(infolog, __size_infolog);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002207 if (useChecksum) checksumCalculator->addBuffer(infolog, __size_infolog);
2208 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002209 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002210 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002211 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2212 stream->readback(checksumBufPtr, checksumSize);
2213 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002214 ALOGE("glGetShaderInfoLog: GL communication error, please report this issue to b.android.com.\n");
2215 abort();
2216 }
2217 }
keunyoungb85b2752013-03-08 12:28:03 -08002218}
2219
2220void glGetShaderPrecisionFormat_enc(void *self , GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
2221{
2222
2223 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2224 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002225 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002226 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002227
2228 const unsigned int __size_range = (2 * sizeof(GLint));
2229 const unsigned int __size_precision = (sizeof(GLint));
2230 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002231 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002232 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002233 const size_t checksumSize = checksumCalculator->checksumByteSize();
2234 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2235 buf = stream->alloc(totalSize);
2236 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002237 int tmp = OP_glGetShaderPrecisionFormat;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002238 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002239
2240 memcpy(ptr, &shadertype, 4); ptr += 4;
2241 memcpy(ptr, &precisiontype, 4); ptr += 4;
2242 *(unsigned int *)(ptr) = __size_range; ptr += 4;
2243 *(unsigned int *)(ptr) = __size_precision; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002244
Yahan Zhoue222fd52016-03-16 12:41:08 -07002245 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2246 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2247
keunyoungb85b2752013-03-08 12:28:03 -08002248 stream->readback(range, __size_range);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002249 if (useChecksum) checksumCalculator->addBuffer(range, __size_range);
keunyoungb85b2752013-03-08 12:28:03 -08002250 stream->readback(precision, __size_precision);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002251 if (useChecksum) checksumCalculator->addBuffer(precision, __size_precision);
2252 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002253 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002254 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002255 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2256 stream->readback(checksumBufPtr, checksumSize);
2257 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002258 ALOGE("glGetShaderPrecisionFormat: GL communication error, please report this issue to b.android.com.\n");
2259 abort();
2260 }
2261 }
keunyoungb85b2752013-03-08 12:28:03 -08002262}
2263
2264void glGetShaderSource_enc(void *self , GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
2265{
2266
2267 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2268 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002269 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002270 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002271
2272 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
2273 const unsigned int __size_source = bufsize;
2274 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002275 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002276 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002277 const size_t checksumSize = checksumCalculator->checksumByteSize();
2278 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2279 buf = stream->alloc(totalSize);
2280 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002281 int tmp = OP_glGetShaderSource;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002282 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002283
2284 memcpy(ptr, &shader, 4); ptr += 4;
2285 memcpy(ptr, &bufsize, 4); ptr += 4;
2286 *(unsigned int *)(ptr) = __size_length; ptr += 4;
2287 *(unsigned int *)(ptr) = __size_source; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002288
Yahan Zhoue222fd52016-03-16 12:41:08 -07002289 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2290 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2291
2292 if (length != NULL) {
2293 stream->readback(length, __size_length);
2294 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
2295 }
keunyoungb85b2752013-03-08 12:28:03 -08002296 stream->readback(source, __size_source);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002297 if (useChecksum) checksumCalculator->addBuffer(source, __size_source);
2298 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002299 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002300 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002301 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2302 stream->readback(checksumBufPtr, checksumSize);
2303 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002304 ALOGE("glGetShaderSource: GL communication error, please report this issue to b.android.com.\n");
2305 abort();
2306 }
2307 }
keunyoungb85b2752013-03-08 12:28:03 -08002308}
2309
2310void glGetTexParameterfv_enc(void *self , GLenum target, GLenum pname, GLfloat* params)
2311{
2312
2313 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2314 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002315 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002316 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002317
2318 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2319 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002320 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002321 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002322 const size_t checksumSize = checksumCalculator->checksumByteSize();
2323 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2324 buf = stream->alloc(totalSize);
2325 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002326 int tmp = OP_glGetTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002327 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002328
2329 memcpy(ptr, &target, 4); ptr += 4;
2330 memcpy(ptr, &pname, 4); ptr += 4;
2331 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002332
Yahan Zhoue222fd52016-03-16 12:41:08 -07002333 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2334 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2335
keunyoungb85b2752013-03-08 12:28:03 -08002336 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002337 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2338 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002339 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002340 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002341 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2342 stream->readback(checksumBufPtr, checksumSize);
2343 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002344 ALOGE("glGetTexParameterfv: GL communication error, please report this issue to b.android.com.\n");
2345 abort();
2346 }
2347 }
keunyoungb85b2752013-03-08 12:28:03 -08002348}
2349
2350void glGetTexParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
2351{
2352
2353 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2354 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002355 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002356 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002357
2358 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2359 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002360 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002361 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002362 const size_t checksumSize = checksumCalculator->checksumByteSize();
2363 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2364 buf = stream->alloc(totalSize);
2365 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002366 int tmp = OP_glGetTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002367 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002368
2369 memcpy(ptr, &target, 4); ptr += 4;
2370 memcpy(ptr, &pname, 4); ptr += 4;
2371 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002372
Yahan Zhoue222fd52016-03-16 12:41:08 -07002373 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2374 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2375
keunyoungb85b2752013-03-08 12:28:03 -08002376 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002377 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2378 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002379 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002380 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002381 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2382 stream->readback(checksumBufPtr, checksumSize);
2383 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002384 ALOGE("glGetTexParameteriv: GL communication error, please report this issue to b.android.com.\n");
2385 abort();
2386 }
2387 }
keunyoungb85b2752013-03-08 12:28:03 -08002388}
2389
2390void glGetUniformfv_enc(void *self , GLuint program, GLint location, GLfloat* params)
2391{
2392
2393 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2394 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002395 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002396 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002397
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01002398 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
keunyoungb85b2752013-03-08 12:28:03 -08002399 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002400 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002401 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002402 const size_t checksumSize = checksumCalculator->checksumByteSize();
2403 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2404 buf = stream->alloc(totalSize);
2405 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002406 int tmp = OP_glGetUniformfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002407 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002408
2409 memcpy(ptr, &program, 4); ptr += 4;
2410 memcpy(ptr, &location, 4); ptr += 4;
2411 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002412
Yahan Zhoue222fd52016-03-16 12:41:08 -07002413 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2414 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2415
keunyoungb85b2752013-03-08 12:28:03 -08002416 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002417 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2418 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002419 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002420 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002421 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2422 stream->readback(checksumBufPtr, checksumSize);
2423 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002424 ALOGE("glGetUniformfv: GL communication error, please report this issue to b.android.com.\n");
2425 abort();
2426 }
2427 }
keunyoungb85b2752013-03-08 12:28:03 -08002428}
2429
2430void glGetUniformiv_enc(void *self , GLuint program, GLint location, GLint* params)
2431{
2432
2433 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2434 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002435 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002436 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002437
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01002438 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
keunyoungb85b2752013-03-08 12:28:03 -08002439 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002440 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002441 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002442 const size_t checksumSize = checksumCalculator->checksumByteSize();
2443 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2444 buf = stream->alloc(totalSize);
2445 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002446 int tmp = OP_glGetUniformiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002447 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002448
2449 memcpy(ptr, &program, 4); ptr += 4;
2450 memcpy(ptr, &location, 4); ptr += 4;
2451 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002452
Yahan Zhoue222fd52016-03-16 12:41:08 -07002453 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2454 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2455
keunyoungb85b2752013-03-08 12:28:03 -08002456 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002457 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2458 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002459 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002460 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002461 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2462 stream->readback(checksumBufPtr, checksumSize);
2463 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002464 ALOGE("glGetUniformiv: GL communication error, please report this issue to b.android.com.\n");
2465 abort();
2466 }
2467 }
keunyoungb85b2752013-03-08 12:28:03 -08002468}
2469
2470int glGetUniformLocation_enc(void *self , GLuint program, const GLchar* name)
2471{
2472
2473 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2474 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002475 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002476 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002477
2478 const unsigned int __size_name = (strlen(name) + 1);
2479 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002480 unsigned char *buf;
2481 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
2482 const size_t checksumSize = checksumCalculator->checksumByteSize();
2483 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2484 buf = stream->alloc(totalSize);
2485 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002486 int tmp = OP_glGetUniformLocation;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002487 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002488
2489 memcpy(ptr, &program, 4); ptr += 4;
2490 *(unsigned int *)(ptr) = __size_name; ptr += 4;
2491 memcpy(ptr, name, __size_name);ptr += __size_name;
2492
Yahan Zhoue222fd52016-03-16 12:41:08 -07002493 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2494 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2495
Yahan Zhoub7f09082016-03-10 11:45:02 -08002496
keunyoungb85b2752013-03-08 12:28:03 -08002497 int retval;
2498 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002499 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
2500 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002501 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002502 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002503 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2504 stream->readback(checksumBufPtr, checksumSize);
2505 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002506 ALOGE("glGetUniformLocation: GL communication error, please report this issue to b.android.com.\n");
2507 abort();
2508 }
2509 }
keunyoungb85b2752013-03-08 12:28:03 -08002510 return retval;
2511}
2512
2513void glGetVertexAttribfv_enc(void *self , GLuint index, GLenum pname, GLfloat* params)
2514{
2515
2516 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2517 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002518 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002519 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002520
2521 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
2522 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002523 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002524 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002525 const size_t checksumSize = checksumCalculator->checksumByteSize();
2526 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2527 buf = stream->alloc(totalSize);
2528 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002529 int tmp = OP_glGetVertexAttribfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002530 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002531
2532 memcpy(ptr, &index, 4); ptr += 4;
2533 memcpy(ptr, &pname, 4); ptr += 4;
2534 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002535
Yahan Zhoue222fd52016-03-16 12:41:08 -07002536 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2537 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2538
keunyoungb85b2752013-03-08 12:28:03 -08002539 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002540 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2541 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002542 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002543 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002544 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2545 stream->readback(checksumBufPtr, checksumSize);
2546 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002547 ALOGE("glGetVertexAttribfv: GL communication error, please report this issue to b.android.com.\n");
2548 abort();
2549 }
2550 }
keunyoungb85b2752013-03-08 12:28:03 -08002551}
2552
2553void glGetVertexAttribiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
2554{
2555
2556 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2557 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002558 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002559 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002560
2561 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
2562 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002563 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002564 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002565 const size_t checksumSize = checksumCalculator->checksumByteSize();
2566 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2567 buf = stream->alloc(totalSize);
2568 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002569 int tmp = OP_glGetVertexAttribiv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002570 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002571
2572 memcpy(ptr, &index, 4); ptr += 4;
2573 memcpy(ptr, &pname, 4); ptr += 4;
2574 *(unsigned int *)(ptr) = __size_params; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002575
Yahan Zhoue222fd52016-03-16 12:41:08 -07002576 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2577 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2578
keunyoungb85b2752013-03-08 12:28:03 -08002579 stream->readback(params, __size_params);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002580 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
2581 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002582 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002583 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002584 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2585 stream->readback(checksumBufPtr, checksumSize);
2586 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002587 ALOGE("glGetVertexAttribiv: GL communication error, please report this issue to b.android.com.\n");
2588 abort();
2589 }
2590 }
keunyoungb85b2752013-03-08 12:28:03 -08002591}
2592
2593void glHint_enc(void *self , GLenum target, GLenum mode)
2594{
2595
2596 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2597 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002598 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002599 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002600
2601 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002602 unsigned char *buf;
2603 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2604 const size_t checksumSize = checksumCalculator->checksumByteSize();
2605 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2606 buf = stream->alloc(totalSize);
2607 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002608 int tmp = OP_glHint;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002609 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002610
2611 memcpy(ptr, &target, 4); ptr += 4;
2612 memcpy(ptr, &mode, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002613
Yahan Zhoue222fd52016-03-16 12:41:08 -07002614 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2615 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2616
keunyoungb85b2752013-03-08 12:28:03 -08002617}
2618
2619GLboolean glIsBuffer_enc(void *self , GLuint buffer)
2620{
2621
2622 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2623 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002624 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002625 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002626
2627 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002628 unsigned char *buf;
2629 const size_t sizeWithoutChecksum = 8 + 4;
2630 const size_t checksumSize = checksumCalculator->checksumByteSize();
2631 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2632 buf = stream->alloc(totalSize);
2633 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002634 int tmp = OP_glIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002635 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002636
2637 memcpy(ptr, &buffer, 4); ptr += 4;
2638
Yahan Zhoue222fd52016-03-16 12:41:08 -07002639 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2640 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2641
Yahan Zhoub7f09082016-03-10 11:45:02 -08002642
keunyoungb85b2752013-03-08 12:28:03 -08002643 GLboolean retval;
2644 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002645 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2646 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002647 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002648 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002649 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2650 stream->readback(checksumBufPtr, checksumSize);
2651 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002652 ALOGE("glIsBuffer: GL communication error, please report this issue to b.android.com.\n");
2653 abort();
2654 }
2655 }
keunyoungb85b2752013-03-08 12:28:03 -08002656 return retval;
2657}
2658
2659GLboolean glIsEnabled_enc(void *self , GLenum cap)
2660{
2661
2662 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2663 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002664 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002665 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002666
2667 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002668 unsigned char *buf;
2669 const size_t sizeWithoutChecksum = 8 + 4;
2670 const size_t checksumSize = checksumCalculator->checksumByteSize();
2671 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2672 buf = stream->alloc(totalSize);
2673 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002674 int tmp = OP_glIsEnabled;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002675 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002676
2677 memcpy(ptr, &cap, 4); ptr += 4;
2678
Yahan Zhoue222fd52016-03-16 12:41:08 -07002679 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2680 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2681
Yahan Zhoub7f09082016-03-10 11:45:02 -08002682
keunyoungb85b2752013-03-08 12:28:03 -08002683 GLboolean retval;
2684 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002685 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2686 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002687 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002688 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002689 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2690 stream->readback(checksumBufPtr, checksumSize);
2691 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002692 ALOGE("glIsEnabled: GL communication error, please report this issue to b.android.com.\n");
2693 abort();
2694 }
2695 }
keunyoungb85b2752013-03-08 12:28:03 -08002696 return retval;
2697}
2698
2699GLboolean glIsFramebuffer_enc(void *self , GLuint framebuffer)
2700{
2701
2702 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2703 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002704 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002705 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002706
2707 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002708 unsigned char *buf;
2709 const size_t sizeWithoutChecksum = 8 + 4;
2710 const size_t checksumSize = checksumCalculator->checksumByteSize();
2711 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2712 buf = stream->alloc(totalSize);
2713 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002714 int tmp = OP_glIsFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002715 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002716
2717 memcpy(ptr, &framebuffer, 4); ptr += 4;
2718
Yahan Zhoue222fd52016-03-16 12:41:08 -07002719 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2720 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2721
Yahan Zhoub7f09082016-03-10 11:45:02 -08002722
keunyoungb85b2752013-03-08 12:28:03 -08002723 GLboolean retval;
2724 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002725 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2726 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002727 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002728 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002729 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2730 stream->readback(checksumBufPtr, checksumSize);
2731 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002732 ALOGE("glIsFramebuffer: GL communication error, please report this issue to b.android.com.\n");
2733 abort();
2734 }
2735 }
keunyoungb85b2752013-03-08 12:28:03 -08002736 return retval;
2737}
2738
2739GLboolean glIsProgram_enc(void *self , GLuint program)
2740{
2741
2742 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2743 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002744 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002745 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002746
2747 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002748 unsigned char *buf;
2749 const size_t sizeWithoutChecksum = 8 + 4;
2750 const size_t checksumSize = checksumCalculator->checksumByteSize();
2751 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2752 buf = stream->alloc(totalSize);
2753 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002754 int tmp = OP_glIsProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002755 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002756
2757 memcpy(ptr, &program, 4); ptr += 4;
2758
Yahan Zhoue222fd52016-03-16 12:41:08 -07002759 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2760 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2761
Yahan Zhoub7f09082016-03-10 11:45:02 -08002762
keunyoungb85b2752013-03-08 12:28:03 -08002763 GLboolean retval;
2764 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002765 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2766 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002767 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002768 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002769 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2770 stream->readback(checksumBufPtr, checksumSize);
2771 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002772 ALOGE("glIsProgram: GL communication error, please report this issue to b.android.com.\n");
2773 abort();
2774 }
2775 }
keunyoungb85b2752013-03-08 12:28:03 -08002776 return retval;
2777}
2778
2779GLboolean glIsRenderbuffer_enc(void *self , GLuint renderbuffer)
2780{
2781
2782 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2783 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002784 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002785 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002786
2787 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002788 unsigned char *buf;
2789 const size_t sizeWithoutChecksum = 8 + 4;
2790 const size_t checksumSize = checksumCalculator->checksumByteSize();
2791 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2792 buf = stream->alloc(totalSize);
2793 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002794 int tmp = OP_glIsRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002795 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002796
2797 memcpy(ptr, &renderbuffer, 4); ptr += 4;
2798
Yahan Zhoue222fd52016-03-16 12:41:08 -07002799 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2800 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2801
Yahan Zhoub7f09082016-03-10 11:45:02 -08002802
keunyoungb85b2752013-03-08 12:28:03 -08002803 GLboolean retval;
2804 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002805 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2806 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002807 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002808 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002809 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2810 stream->readback(checksumBufPtr, checksumSize);
2811 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002812 ALOGE("glIsRenderbuffer: GL communication error, please report this issue to b.android.com.\n");
2813 abort();
2814 }
2815 }
keunyoungb85b2752013-03-08 12:28:03 -08002816 return retval;
2817}
2818
2819GLboolean glIsShader_enc(void *self , GLuint shader)
2820{
2821
2822 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2823 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002824 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002825 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002826
2827 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002828 unsigned char *buf;
2829 const size_t sizeWithoutChecksum = 8 + 4;
2830 const size_t checksumSize = checksumCalculator->checksumByteSize();
2831 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2832 buf = stream->alloc(totalSize);
2833 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002834 int tmp = OP_glIsShader;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002835 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002836
2837 memcpy(ptr, &shader, 4); ptr += 4;
2838
Yahan Zhoue222fd52016-03-16 12:41:08 -07002839 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2840 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2841
Yahan Zhoub7f09082016-03-10 11:45:02 -08002842
keunyoungb85b2752013-03-08 12:28:03 -08002843 GLboolean retval;
2844 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002845 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2846 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002847 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002848 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002849 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2850 stream->readback(checksumBufPtr, checksumSize);
2851 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002852 ALOGE("glIsShader: GL communication error, please report this issue to b.android.com.\n");
2853 abort();
2854 }
2855 }
keunyoungb85b2752013-03-08 12:28:03 -08002856 return retval;
2857}
2858
2859GLboolean glIsTexture_enc(void *self , GLuint texture)
2860{
2861
2862 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2863 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002864 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002865 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002866
2867 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002868 unsigned char *buf;
2869 const size_t sizeWithoutChecksum = 8 + 4;
2870 const size_t checksumSize = checksumCalculator->checksumByteSize();
2871 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2872 buf = stream->alloc(totalSize);
2873 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002874 int tmp = OP_glIsTexture;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002875 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002876
2877 memcpy(ptr, &texture, 4); ptr += 4;
2878
Yahan Zhoue222fd52016-03-16 12:41:08 -07002879 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2880 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2881
Yahan Zhoub7f09082016-03-10 11:45:02 -08002882
keunyoungb85b2752013-03-08 12:28:03 -08002883 GLboolean retval;
2884 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07002885 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
2886 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002887 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07002888 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07002889 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
2890 stream->readback(checksumBufPtr, checksumSize);
2891 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07002892 ALOGE("glIsTexture: GL communication error, please report this issue to b.android.com.\n");
2893 abort();
2894 }
2895 }
keunyoungb85b2752013-03-08 12:28:03 -08002896 return retval;
2897}
2898
2899void glLineWidth_enc(void *self , GLfloat width)
2900{
2901
2902 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2903 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002904 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002905 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002906
2907 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002908 unsigned char *buf;
2909 const size_t sizeWithoutChecksum = 8 + 4;
2910 const size_t checksumSize = checksumCalculator->checksumByteSize();
2911 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2912 buf = stream->alloc(totalSize);
2913 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002914 int tmp = OP_glLineWidth;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002915 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002916
2917 memcpy(ptr, &width, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002918
Yahan Zhoue222fd52016-03-16 12:41:08 -07002919 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2920 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2921
keunyoungb85b2752013-03-08 12:28:03 -08002922}
2923
2924void glLinkProgram_enc(void *self , GLuint program)
2925{
2926
2927 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2928 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002929 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002930 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002931
2932 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002933 unsigned char *buf;
2934 const size_t sizeWithoutChecksum = 8 + 4;
2935 const size_t checksumSize = checksumCalculator->checksumByteSize();
2936 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2937 buf = stream->alloc(totalSize);
2938 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002939 int tmp = OP_glLinkProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002940 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002941
2942 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002943
Yahan Zhoue222fd52016-03-16 12:41:08 -07002944 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2945 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2946
keunyoungb85b2752013-03-08 12:28:03 -08002947}
2948
2949void glPixelStorei_enc(void *self , GLenum pname, GLint param)
2950{
2951
2952 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2953 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002954 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002955 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002956
2957 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002958 unsigned char *buf;
2959 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2960 const size_t checksumSize = checksumCalculator->checksumByteSize();
2961 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2962 buf = stream->alloc(totalSize);
2963 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002964 int tmp = OP_glPixelStorei;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002965 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002966
2967 memcpy(ptr, &pname, 4); ptr += 4;
2968 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002969
Yahan Zhoue222fd52016-03-16 12:41:08 -07002970 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2971 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2972
keunyoungb85b2752013-03-08 12:28:03 -08002973}
2974
2975void glPolygonOffset_enc(void *self , GLfloat factor, GLfloat units)
2976{
2977
2978 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
2979 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002980 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07002981 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08002982
2983 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002984 unsigned char *buf;
2985 const size_t sizeWithoutChecksum = 8 + 4 + 4;
2986 const size_t checksumSize = checksumCalculator->checksumByteSize();
2987 const size_t totalSize = sizeWithoutChecksum + checksumSize;
2988 buf = stream->alloc(totalSize);
2989 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08002990 int tmp = OP_glPolygonOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002991 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08002992
2993 memcpy(ptr, &factor, 4); ptr += 4;
2994 memcpy(ptr, &units, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08002995
Yahan Zhoue222fd52016-03-16 12:41:08 -07002996 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
2997 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
2998
keunyoungb85b2752013-03-08 12:28:03 -08002999}
3000
3001void glReadPixels_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
3002{
3003
3004 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3005 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003006 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003007 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003008
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003009 const unsigned int __size_pixels = glesv2_enc::pixelDataSize(self, width, height, format, type, 1);
keunyoungb85b2752013-03-08 12:28:03 -08003010 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003011 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07003012 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003013 const size_t checksumSize = checksumCalculator->checksumByteSize();
3014 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3015 buf = stream->alloc(totalSize);
3016 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003017 int tmp = OP_glReadPixels;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003018 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003019
3020 memcpy(ptr, &x, 4); ptr += 4;
3021 memcpy(ptr, &y, 4); ptr += 4;
3022 memcpy(ptr, &width, 4); ptr += 4;
3023 memcpy(ptr, &height, 4); ptr += 4;
3024 memcpy(ptr, &format, 4); ptr += 4;
3025 memcpy(ptr, &type, 4); ptr += 4;
3026 *(unsigned int *)(ptr) = __size_pixels; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003027
Yahan Zhoue222fd52016-03-16 12:41:08 -07003028 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3029 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3030
Lingfeng Yang22dc42d2018-05-29 10:11:38 -07003031 // TODO: make this part of autogenerated pipe code.
3032 // b/79208762
3033 stream->readbackPixels(self, width, height, format, type, pixels);
3034
Yahan Zhoue222fd52016-03-16 12:41:08 -07003035 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
3036 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003037 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07003038 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07003039 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
3040 stream->readback(checksumBufPtr, checksumSize);
3041 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07003042 ALOGE("glReadPixels: GL communication error, please report this issue to b.android.com.\n");
3043 abort();
3044 }
3045 }
keunyoungb85b2752013-03-08 12:28:03 -08003046}
3047
3048void glReleaseShaderCompiler_enc(void *self )
3049{
3050
3051 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3052 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003053 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003054 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003055
3056 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003057 unsigned char *buf;
3058 const size_t sizeWithoutChecksum = 8;
3059 const size_t checksumSize = checksumCalculator->checksumByteSize();
3060 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3061 buf = stream->alloc(totalSize);
3062 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003063 int tmp = OP_glReleaseShaderCompiler;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003064 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003065
Yahan Zhoub7f09082016-03-10 11:45:02 -08003066
Yahan Zhoue222fd52016-03-16 12:41:08 -07003067 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3068 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3069
keunyoungb85b2752013-03-08 12:28:03 -08003070}
3071
3072void glRenderbufferStorage_enc(void *self , GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
3073{
3074
3075 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3076 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003077 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003078 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003079
3080 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003081 unsigned char *buf;
3082 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3083 const size_t checksumSize = checksumCalculator->checksumByteSize();
3084 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3085 buf = stream->alloc(totalSize);
3086 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003087 int tmp = OP_glRenderbufferStorage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003088 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003089
3090 memcpy(ptr, &target, 4); ptr += 4;
3091 memcpy(ptr, &internalformat, 4); ptr += 4;
3092 memcpy(ptr, &width, 4); ptr += 4;
3093 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003094
Yahan Zhoue222fd52016-03-16 12:41:08 -07003095 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3096 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3097
keunyoungb85b2752013-03-08 12:28:03 -08003098}
3099
3100void glSampleCoverage_enc(void *self , GLclampf value, GLboolean invert)
3101{
3102
3103 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3104 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003105 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003106 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003107
3108 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003109 unsigned char *buf;
3110 const size_t sizeWithoutChecksum = 8 + 4 + 1;
3111 const size_t checksumSize = checksumCalculator->checksumByteSize();
3112 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3113 buf = stream->alloc(totalSize);
3114 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003115 int tmp = OP_glSampleCoverage;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003116 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003117
3118 memcpy(ptr, &value, 4); ptr += 4;
3119 memcpy(ptr, &invert, 1); ptr += 1;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003120
Yahan Zhoue222fd52016-03-16 12:41:08 -07003121 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3122 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3123
keunyoungb85b2752013-03-08 12:28:03 -08003124}
3125
3126void glScissor_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
3127{
3128
3129 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3130 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003131 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003132 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003133
3134 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003135 unsigned char *buf;
3136 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3137 const size_t checksumSize = checksumCalculator->checksumByteSize();
3138 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3139 buf = stream->alloc(totalSize);
3140 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003141 int tmp = OP_glScissor;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003142 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003143
3144 memcpy(ptr, &x, 4); ptr += 4;
3145 memcpy(ptr, &y, 4); ptr += 4;
3146 memcpy(ptr, &width, 4); ptr += 4;
3147 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003148
Yahan Zhoue222fd52016-03-16 12:41:08 -07003149 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3150 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3151
keunyoungb85b2752013-03-08 12:28:03 -08003152}
3153
3154void glStencilFunc_enc(void *self , GLenum func, GLint ref, GLuint mask)
3155{
3156
3157 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3158 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003159 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003160 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003161
3162 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003163 unsigned char *buf;
3164 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3165 const size_t checksumSize = checksumCalculator->checksumByteSize();
3166 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3167 buf = stream->alloc(totalSize);
3168 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003169 int tmp = OP_glStencilFunc;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003170 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003171
3172 memcpy(ptr, &func, 4); ptr += 4;
3173 memcpy(ptr, &ref, 4); ptr += 4;
3174 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003175
Yahan Zhoue222fd52016-03-16 12:41:08 -07003176 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3177 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3178
keunyoungb85b2752013-03-08 12:28:03 -08003179}
3180
3181void glStencilFuncSeparate_enc(void *self , GLenum face, GLenum func, GLint ref, GLuint mask)
3182{
3183
3184 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3185 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003186 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003187 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003188
3189 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003190 unsigned char *buf;
3191 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3192 const size_t checksumSize = checksumCalculator->checksumByteSize();
3193 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3194 buf = stream->alloc(totalSize);
3195 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003196 int tmp = OP_glStencilFuncSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003197 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003198
3199 memcpy(ptr, &face, 4); ptr += 4;
3200 memcpy(ptr, &func, 4); ptr += 4;
3201 memcpy(ptr, &ref, 4); ptr += 4;
3202 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003203
Yahan Zhoue222fd52016-03-16 12:41:08 -07003204 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3205 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3206
keunyoungb85b2752013-03-08 12:28:03 -08003207}
3208
3209void glStencilMask_enc(void *self , GLuint mask)
3210{
3211
3212 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3213 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003214 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003215 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003216
3217 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003218 unsigned char *buf;
3219 const size_t sizeWithoutChecksum = 8 + 4;
3220 const size_t checksumSize = checksumCalculator->checksumByteSize();
3221 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3222 buf = stream->alloc(totalSize);
3223 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003224 int tmp = OP_glStencilMask;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003225 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003226
3227 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003228
Yahan Zhoue222fd52016-03-16 12:41:08 -07003229 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3230 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3231
keunyoungb85b2752013-03-08 12:28:03 -08003232}
3233
3234void glStencilMaskSeparate_enc(void *self , GLenum face, GLuint mask)
3235{
3236
3237 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3238 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003239 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003240 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003241
3242 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003243 unsigned char *buf;
3244 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3245 const size_t checksumSize = checksumCalculator->checksumByteSize();
3246 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3247 buf = stream->alloc(totalSize);
3248 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003249 int tmp = OP_glStencilMaskSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003250 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003251
3252 memcpy(ptr, &face, 4); ptr += 4;
3253 memcpy(ptr, &mask, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003254
Yahan Zhoue222fd52016-03-16 12:41:08 -07003255 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3256 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3257
keunyoungb85b2752013-03-08 12:28:03 -08003258}
3259
3260void glStencilOp_enc(void *self , GLenum fail, GLenum zfail, GLenum zpass)
3261{
3262
3263 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3264 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003265 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003266 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003267
3268 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003269 unsigned char *buf;
3270 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3271 const size_t checksumSize = checksumCalculator->checksumByteSize();
3272 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3273 buf = stream->alloc(totalSize);
3274 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003275 int tmp = OP_glStencilOp;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003276 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003277
3278 memcpy(ptr, &fail, 4); ptr += 4;
3279 memcpy(ptr, &zfail, 4); ptr += 4;
3280 memcpy(ptr, &zpass, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003281
Yahan Zhoue222fd52016-03-16 12:41:08 -07003282 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3283 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3284
keunyoungb85b2752013-03-08 12:28:03 -08003285}
3286
3287void glStencilOpSeparate_enc(void *self , GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3288{
3289
3290 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3291 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003292 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003293 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003294
3295 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003296 unsigned char *buf;
3297 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3298 const size_t checksumSize = checksumCalculator->checksumByteSize();
3299 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3300 buf = stream->alloc(totalSize);
3301 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003302 int tmp = OP_glStencilOpSeparate;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003303 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003304
3305 memcpy(ptr, &face, 4); ptr += 4;
3306 memcpy(ptr, &fail, 4); ptr += 4;
3307 memcpy(ptr, &zfail, 4); ptr += 4;
3308 memcpy(ptr, &zpass, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003309
Yahan Zhoue222fd52016-03-16 12:41:08 -07003310 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3311 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3312
keunyoungb85b2752013-03-08 12:28:03 -08003313}
3314
3315void glTexImage2D_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
3316{
3317
3318 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3319 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003320 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003321 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003322
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003323 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003324 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003325 unsigned char *buf;
3326 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3327 const size_t checksumSize = checksumCalculator->checksumByteSize();
3328 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3329 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3330 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003331 int tmp = OP_glTexImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003332 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003333
3334 memcpy(ptr, &target, 4); ptr += 4;
3335 memcpy(ptr, &level, 4); ptr += 4;
3336 memcpy(ptr, &internalformat, 4); ptr += 4;
3337 memcpy(ptr, &width, 4); ptr += 4;
3338 memcpy(ptr, &height, 4); ptr += 4;
3339 memcpy(ptr, &border, 4); ptr += 4;
3340 memcpy(ptr, &format, 4); ptr += 4;
3341 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003342
Yahan Zhoue222fd52016-03-16 12:41:08 -07003343 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003344 stream->flush();
3345 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003346 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003347 if (pixels != NULL) {
3348 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003349 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003350 }
3351 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003352 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3353
keunyoungb85b2752013-03-08 12:28:03 -08003354}
3355
3356void glTexParameterf_enc(void *self , GLenum target, GLenum pname, GLfloat param)
3357{
3358
3359 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3360 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003361 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003362 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003363
3364 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003365 unsigned char *buf;
3366 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3367 const size_t checksumSize = checksumCalculator->checksumByteSize();
3368 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3369 buf = stream->alloc(totalSize);
3370 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003371 int tmp = OP_glTexParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003372 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003373
3374 memcpy(ptr, &target, 4); ptr += 4;
3375 memcpy(ptr, &pname, 4); ptr += 4;
3376 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003377
Yahan Zhoue222fd52016-03-16 12:41:08 -07003378 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3379 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3380
keunyoungb85b2752013-03-08 12:28:03 -08003381}
3382
3383void glTexParameterfv_enc(void *self , GLenum target, GLenum pname, const GLfloat* params)
3384{
3385
3386 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3387 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003388 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003389 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003390
3391 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
3392 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003393 unsigned char *buf;
3394 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3395 const size_t checksumSize = checksumCalculator->checksumByteSize();
3396 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3397 buf = stream->alloc(totalSize);
3398 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003399 int tmp = OP_glTexParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003400 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003401
3402 memcpy(ptr, &target, 4); ptr += 4;
3403 memcpy(ptr, &pname, 4); ptr += 4;
3404 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3405 memcpy(ptr, params, __size_params);ptr += __size_params;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003406
Yahan Zhoue222fd52016-03-16 12:41:08 -07003407 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3408 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3409
keunyoungb85b2752013-03-08 12:28:03 -08003410}
3411
3412void glTexParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
3413{
3414
3415 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3416 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003417 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003418 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003419
3420 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003421 unsigned char *buf;
3422 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3423 const size_t checksumSize = checksumCalculator->checksumByteSize();
3424 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3425 buf = stream->alloc(totalSize);
3426 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003427 int tmp = OP_glTexParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003428 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003429
3430 memcpy(ptr, &target, 4); ptr += 4;
3431 memcpy(ptr, &pname, 4); ptr += 4;
3432 memcpy(ptr, &param, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003433
Yahan Zhoue222fd52016-03-16 12:41:08 -07003434 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3435 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3436
keunyoungb85b2752013-03-08 12:28:03 -08003437}
3438
3439void glTexParameteriv_enc(void *self , GLenum target, GLenum pname, const GLint* params)
3440{
3441
3442 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3443 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003444 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003445 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003446
3447 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
3448 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003449 unsigned char *buf;
3450 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
3451 const size_t checksumSize = checksumCalculator->checksumByteSize();
3452 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3453 buf = stream->alloc(totalSize);
3454 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003455 int tmp = OP_glTexParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003456 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003457
3458 memcpy(ptr, &target, 4); ptr += 4;
3459 memcpy(ptr, &pname, 4); ptr += 4;
3460 *(unsigned int *)(ptr) = __size_params; ptr += 4;
3461 memcpy(ptr, params, __size_params);ptr += __size_params;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003462
Yahan Zhoue222fd52016-03-16 12:41:08 -07003463 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3464 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3465
keunyoungb85b2752013-03-08 12:28:03 -08003466}
3467
3468void glTexSubImage2D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
3469{
3470
3471 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3472 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003473 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003474 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003475
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01003476 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize(self, width, height, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08003477 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003478 unsigned char *buf;
3479 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
3480 const size_t checksumSize = checksumCalculator->checksumByteSize();
3481 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3482 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
3483 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003484 int tmp = OP_glTexSubImage2D;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003485 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003486
3487 memcpy(ptr, &target, 4); ptr += 4;
3488 memcpy(ptr, &level, 4); ptr += 4;
3489 memcpy(ptr, &xoffset, 4); ptr += 4;
3490 memcpy(ptr, &yoffset, 4); ptr += 4;
3491 memcpy(ptr, &width, 4); ptr += 4;
3492 memcpy(ptr, &height, 4); ptr += 4;
3493 memcpy(ptr, &format, 4); ptr += 4;
3494 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003495
Yahan Zhoue222fd52016-03-16 12:41:08 -07003496 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08003497 stream->flush();
3498 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003499 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003500 if (pixels != NULL) {
3501 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003502 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08003503 }
3504 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07003505 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
3506
keunyoungb85b2752013-03-08 12:28:03 -08003507}
3508
3509void glUniform1f_enc(void *self , GLint location, GLfloat x)
3510{
3511
3512 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3513 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003514 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003515 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003516
3517 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003518 unsigned char *buf;
3519 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3520 const size_t checksumSize = checksumCalculator->checksumByteSize();
3521 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3522 buf = stream->alloc(totalSize);
3523 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003524 int tmp = OP_glUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003525 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003526
3527 memcpy(ptr, &location, 4); ptr += 4;
3528 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003529
Yahan Zhoue222fd52016-03-16 12:41:08 -07003530 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3531 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3532
keunyoungb85b2752013-03-08 12:28:03 -08003533}
3534
3535void glUniform1fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3536{
3537
3538 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3539 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003540 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003541 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003542
3543 const unsigned int __size_v = (count * sizeof(GLfloat));
3544 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003545 unsigned char *buf;
3546 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3547 const size_t checksumSize = checksumCalculator->checksumByteSize();
3548 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3549 buf = stream->alloc(totalSize);
3550 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003551 int tmp = OP_glUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003552 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003553
3554 memcpy(ptr, &location, 4); ptr += 4;
3555 memcpy(ptr, &count, 4); ptr += 4;
3556 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3557 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003558
Yahan Zhoue222fd52016-03-16 12:41:08 -07003559 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3560 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3561
keunyoungb85b2752013-03-08 12:28:03 -08003562}
3563
3564void glUniform1i_enc(void *self , GLint location, GLint x)
3565{
3566
3567 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3568 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003569 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003570 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003571
3572 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003573 unsigned char *buf;
3574 const size_t sizeWithoutChecksum = 8 + 4 + 4;
3575 const size_t checksumSize = checksumCalculator->checksumByteSize();
3576 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3577 buf = stream->alloc(totalSize);
3578 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003579 int tmp = OP_glUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003580 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003581
3582 memcpy(ptr, &location, 4); ptr += 4;
3583 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003584
Yahan Zhoue222fd52016-03-16 12:41:08 -07003585 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3586 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3587
keunyoungb85b2752013-03-08 12:28:03 -08003588}
3589
3590void glUniform1iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3591{
3592
3593 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3594 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003595 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003596 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003597
3598 const unsigned int __size_v = (count * sizeof(GLint));
3599 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003600 unsigned char *buf;
3601 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3602 const size_t checksumSize = checksumCalculator->checksumByteSize();
3603 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3604 buf = stream->alloc(totalSize);
3605 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003606 int tmp = OP_glUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003607 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003608
3609 memcpy(ptr, &location, 4); ptr += 4;
3610 memcpy(ptr, &count, 4); ptr += 4;
3611 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3612 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003613
Yahan Zhoue222fd52016-03-16 12:41:08 -07003614 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3615 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3616
keunyoungb85b2752013-03-08 12:28:03 -08003617}
3618
3619void glUniform2f_enc(void *self , GLint location, GLfloat x, GLfloat y)
3620{
3621
3622 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3623 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003624 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003625 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003626
3627 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003628 unsigned char *buf;
3629 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3630 const size_t checksumSize = checksumCalculator->checksumByteSize();
3631 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3632 buf = stream->alloc(totalSize);
3633 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003634 int tmp = OP_glUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003635 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003636
3637 memcpy(ptr, &location, 4); ptr += 4;
3638 memcpy(ptr, &x, 4); ptr += 4;
3639 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003640
Yahan Zhoue222fd52016-03-16 12:41:08 -07003641 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3642 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3643
keunyoungb85b2752013-03-08 12:28:03 -08003644}
3645
3646void glUniform2fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3647{
3648
3649 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3650 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003651 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003652 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003653
3654 const unsigned int __size_v = (count * 2 * sizeof(GLfloat));
3655 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003656 unsigned char *buf;
3657 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3658 const size_t checksumSize = checksumCalculator->checksumByteSize();
3659 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3660 buf = stream->alloc(totalSize);
3661 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003662 int tmp = OP_glUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003663 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003664
3665 memcpy(ptr, &location, 4); ptr += 4;
3666 memcpy(ptr, &count, 4); ptr += 4;
3667 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3668 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003669
Yahan Zhoue222fd52016-03-16 12:41:08 -07003670 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3671 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3672
keunyoungb85b2752013-03-08 12:28:03 -08003673}
3674
3675void glUniform2i_enc(void *self , GLint location, GLint x, GLint y)
3676{
3677
3678 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3679 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003680 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003681 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003682
3683 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003684 unsigned char *buf;
3685 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
3686 const size_t checksumSize = checksumCalculator->checksumByteSize();
3687 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3688 buf = stream->alloc(totalSize);
3689 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003690 int tmp = OP_glUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003691 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003692
3693 memcpy(ptr, &location, 4); ptr += 4;
3694 memcpy(ptr, &x, 4); ptr += 4;
3695 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003696
Yahan Zhoue222fd52016-03-16 12:41:08 -07003697 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3698 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3699
keunyoungb85b2752013-03-08 12:28:03 -08003700}
3701
3702void glUniform2iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3703{
3704
3705 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3706 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003707 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003708 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003709
3710 const unsigned int __size_v = (count * 2 * sizeof(GLint));
3711 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003712 unsigned char *buf;
3713 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3714 const size_t checksumSize = checksumCalculator->checksumByteSize();
3715 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3716 buf = stream->alloc(totalSize);
3717 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003718 int tmp = OP_glUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003719 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003720
3721 memcpy(ptr, &location, 4); ptr += 4;
3722 memcpy(ptr, &count, 4); ptr += 4;
3723 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3724 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003725
Yahan Zhoue222fd52016-03-16 12:41:08 -07003726 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3727 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3728
keunyoungb85b2752013-03-08 12:28:03 -08003729}
3730
3731void glUniform3f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
3732{
3733
3734 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3735 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003736 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003737 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003738
3739 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003740 unsigned char *buf;
3741 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3742 const size_t checksumSize = checksumCalculator->checksumByteSize();
3743 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3744 buf = stream->alloc(totalSize);
3745 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003746 int tmp = OP_glUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003747 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003748
3749 memcpy(ptr, &location, 4); ptr += 4;
3750 memcpy(ptr, &x, 4); ptr += 4;
3751 memcpy(ptr, &y, 4); ptr += 4;
3752 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003753
Yahan Zhoue222fd52016-03-16 12:41:08 -07003754 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3755 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3756
keunyoungb85b2752013-03-08 12:28:03 -08003757}
3758
3759void glUniform3fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3760{
3761
3762 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3763 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003764 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003765 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003766
3767 const unsigned int __size_v = (count * 3 * sizeof(GLfloat));
3768 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003769 unsigned char *buf;
3770 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3771 const size_t checksumSize = checksumCalculator->checksumByteSize();
3772 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3773 buf = stream->alloc(totalSize);
3774 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003775 int tmp = OP_glUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003776 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003777
3778 memcpy(ptr, &location, 4); ptr += 4;
3779 memcpy(ptr, &count, 4); ptr += 4;
3780 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3781 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003782
Yahan Zhoue222fd52016-03-16 12:41:08 -07003783 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3784 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3785
keunyoungb85b2752013-03-08 12:28:03 -08003786}
3787
3788void glUniform3i_enc(void *self , GLint location, GLint x, GLint y, GLint z)
3789{
3790
3791 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3792 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003793 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003794 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003795
3796 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003797 unsigned char *buf;
3798 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
3799 const size_t checksumSize = checksumCalculator->checksumByteSize();
3800 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3801 buf = stream->alloc(totalSize);
3802 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003803 int tmp = OP_glUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003804 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003805
3806 memcpy(ptr, &location, 4); ptr += 4;
3807 memcpy(ptr, &x, 4); ptr += 4;
3808 memcpy(ptr, &y, 4); ptr += 4;
3809 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003810
Yahan Zhoue222fd52016-03-16 12:41:08 -07003811 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3812 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3813
keunyoungb85b2752013-03-08 12:28:03 -08003814}
3815
3816void glUniform3iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3817{
3818
3819 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3820 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003821 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003822 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003823
3824 const unsigned int __size_v = (3 * count * sizeof(GLint));
3825 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003826 unsigned char *buf;
3827 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3828 const size_t checksumSize = checksumCalculator->checksumByteSize();
3829 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3830 buf = stream->alloc(totalSize);
3831 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003832 int tmp = OP_glUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003833 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003834
3835 memcpy(ptr, &location, 4); ptr += 4;
3836 memcpy(ptr, &count, 4); ptr += 4;
3837 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3838 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003839
Yahan Zhoue222fd52016-03-16 12:41:08 -07003840 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3841 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3842
keunyoungb85b2752013-03-08 12:28:03 -08003843}
3844
3845void glUniform4f_enc(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3846{
3847
3848 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3849 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003850 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003851 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003852
3853 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003854 unsigned char *buf;
3855 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3856 const size_t checksumSize = checksumCalculator->checksumByteSize();
3857 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3858 buf = stream->alloc(totalSize);
3859 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003860 int tmp = OP_glUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003861 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003862
3863 memcpy(ptr, &location, 4); ptr += 4;
3864 memcpy(ptr, &x, 4); ptr += 4;
3865 memcpy(ptr, &y, 4); ptr += 4;
3866 memcpy(ptr, &z, 4); ptr += 4;
3867 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003868
Yahan Zhoue222fd52016-03-16 12:41:08 -07003869 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3870 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3871
keunyoungb85b2752013-03-08 12:28:03 -08003872}
3873
3874void glUniform4fv_enc(void *self , GLint location, GLsizei count, const GLfloat* v)
3875{
3876
3877 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3878 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003879 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003880 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003881
3882 const unsigned int __size_v = (4 * count * sizeof(GLfloat));
3883 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003884 unsigned char *buf;
3885 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3886 const size_t checksumSize = checksumCalculator->checksumByteSize();
3887 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3888 buf = stream->alloc(totalSize);
3889 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003890 int tmp = OP_glUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003891 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003892
3893 memcpy(ptr, &location, 4); ptr += 4;
3894 memcpy(ptr, &count, 4); ptr += 4;
3895 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3896 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003897
Yahan Zhoue222fd52016-03-16 12:41:08 -07003898 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3899 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3900
keunyoungb85b2752013-03-08 12:28:03 -08003901}
3902
3903void glUniform4i_enc(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
3904{
3905
3906 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3907 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003908 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003909 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003910
3911 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003912 unsigned char *buf;
3913 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
3914 const size_t checksumSize = checksumCalculator->checksumByteSize();
3915 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3916 buf = stream->alloc(totalSize);
3917 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003918 int tmp = OP_glUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003919 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003920
3921 memcpy(ptr, &location, 4); ptr += 4;
3922 memcpy(ptr, &x, 4); ptr += 4;
3923 memcpy(ptr, &y, 4); ptr += 4;
3924 memcpy(ptr, &z, 4); ptr += 4;
3925 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003926
Yahan Zhoue222fd52016-03-16 12:41:08 -07003927 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3928 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3929
keunyoungb85b2752013-03-08 12:28:03 -08003930}
3931
3932void glUniform4iv_enc(void *self , GLint location, GLsizei count, const GLint* v)
3933{
3934
3935 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3936 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003937 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003938 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003939
3940 const unsigned int __size_v = (4 * count * sizeof(GLint));
3941 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003942 unsigned char *buf;
3943 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_v + 1*4;
3944 const size_t checksumSize = checksumCalculator->checksumByteSize();
3945 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3946 buf = stream->alloc(totalSize);
3947 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003948 int tmp = OP_glUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003949 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003950
3951 memcpy(ptr, &location, 4); ptr += 4;
3952 memcpy(ptr, &count, 4); ptr += 4;
3953 *(unsigned int *)(ptr) = __size_v; ptr += 4;
3954 memcpy(ptr, v, __size_v);ptr += __size_v;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003955
Yahan Zhoue222fd52016-03-16 12:41:08 -07003956 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3957 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3958
keunyoungb85b2752013-03-08 12:28:03 -08003959}
3960
3961void glUniformMatrix2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3962{
3963
3964 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3965 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003966 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003967 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003968
3969 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
3970 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003971 unsigned char *buf;
3972 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
3973 const size_t checksumSize = checksumCalculator->checksumByteSize();
3974 const size_t totalSize = sizeWithoutChecksum + checksumSize;
3975 buf = stream->alloc(totalSize);
3976 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08003977 int tmp = OP_glUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003978 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08003979
3980 memcpy(ptr, &location, 4); ptr += 4;
3981 memcpy(ptr, &count, 4); ptr += 4;
3982 memcpy(ptr, &transpose, 1); ptr += 1;
3983 *(unsigned int *)(ptr) = __size_value; ptr += 4;
3984 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003985
Yahan Zhoue222fd52016-03-16 12:41:08 -07003986 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
3987 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
3988
keunyoungb85b2752013-03-08 12:28:03 -08003989}
3990
3991void glUniformMatrix3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
3992{
3993
3994 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
3995 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08003996 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07003997 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08003998
3999 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
4000 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004001 unsigned char *buf;
4002 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4003 const size_t checksumSize = checksumCalculator->checksumByteSize();
4004 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4005 buf = stream->alloc(totalSize);
4006 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004007 int tmp = OP_glUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004008 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004009
4010 memcpy(ptr, &location, 4); ptr += 4;
4011 memcpy(ptr, &count, 4); ptr += 4;
4012 memcpy(ptr, &transpose, 1); ptr += 1;
4013 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4014 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004015
Yahan Zhoue222fd52016-03-16 12:41:08 -07004016 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4017 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4018
keunyoungb85b2752013-03-08 12:28:03 -08004019}
4020
4021void glUniformMatrix4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
4022{
4023
4024 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4025 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004026 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004027 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004028
4029 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
4030 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004031 unsigned char *buf;
4032 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
4033 const size_t checksumSize = checksumCalculator->checksumByteSize();
4034 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4035 buf = stream->alloc(totalSize);
4036 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004037 int tmp = OP_glUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004038 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004039
4040 memcpy(ptr, &location, 4); ptr += 4;
4041 memcpy(ptr, &count, 4); ptr += 4;
4042 memcpy(ptr, &transpose, 1); ptr += 1;
4043 *(unsigned int *)(ptr) = __size_value; ptr += 4;
4044 memcpy(ptr, value, __size_value);ptr += __size_value;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004045
Yahan Zhoue222fd52016-03-16 12:41:08 -07004046 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4047 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4048
keunyoungb85b2752013-03-08 12:28:03 -08004049}
4050
4051void glUseProgram_enc(void *self , GLuint program)
4052{
4053
4054 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4055 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004056 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004057 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004058
4059 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004060 unsigned char *buf;
4061 const size_t sizeWithoutChecksum = 8 + 4;
4062 const size_t checksumSize = checksumCalculator->checksumByteSize();
4063 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4064 buf = stream->alloc(totalSize);
4065 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004066 int tmp = OP_glUseProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004067 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004068
4069 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004070
Yahan Zhoue222fd52016-03-16 12:41:08 -07004071 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4072 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4073
keunyoungb85b2752013-03-08 12:28:03 -08004074}
4075
4076void glValidateProgram_enc(void *self , GLuint program)
4077{
4078
4079 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4080 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004081 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004082 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004083
4084 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004085 unsigned char *buf;
4086 const size_t sizeWithoutChecksum = 8 + 4;
4087 const size_t checksumSize = checksumCalculator->checksumByteSize();
4088 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4089 buf = stream->alloc(totalSize);
4090 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004091 int tmp = OP_glValidateProgram;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004092 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004093
4094 memcpy(ptr, &program, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004095
Yahan Zhoue222fd52016-03-16 12:41:08 -07004096 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4097 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4098
keunyoungb85b2752013-03-08 12:28:03 -08004099}
4100
4101void glVertexAttrib1f_enc(void *self , GLuint indx, GLfloat x)
4102{
4103
4104 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4105 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004106 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004107 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004108
4109 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004110 unsigned char *buf;
4111 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4112 const size_t checksumSize = checksumCalculator->checksumByteSize();
4113 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4114 buf = stream->alloc(totalSize);
4115 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004116 int tmp = OP_glVertexAttrib1f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004117 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004118
4119 memcpy(ptr, &indx, 4); ptr += 4;
4120 memcpy(ptr, &x, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004121
Yahan Zhoue222fd52016-03-16 12:41:08 -07004122 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4123 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4124
keunyoungb85b2752013-03-08 12:28:03 -08004125}
4126
4127void glVertexAttrib1fv_enc(void *self , GLuint indx, const GLfloat* values)
4128{
4129
4130 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4131 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004132 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004133 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004134
4135 const unsigned int __size_values = (sizeof(GLfloat));
4136 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004137 unsigned char *buf;
4138 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4139 const size_t checksumSize = checksumCalculator->checksumByteSize();
4140 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4141 buf = stream->alloc(totalSize);
4142 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004143 int tmp = OP_glVertexAttrib1fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004144 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004145
4146 memcpy(ptr, &indx, 4); ptr += 4;
4147 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4148 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004149
Yahan Zhoue222fd52016-03-16 12:41:08 -07004150 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4151 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4152
keunyoungb85b2752013-03-08 12:28:03 -08004153}
4154
4155void glVertexAttrib2f_enc(void *self , GLuint indx, GLfloat x, GLfloat y)
4156{
4157
4158 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4159 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004160 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004161 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004162
4163 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004164 unsigned char *buf;
4165 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
4166 const size_t checksumSize = checksumCalculator->checksumByteSize();
4167 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4168 buf = stream->alloc(totalSize);
4169 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004170 int tmp = OP_glVertexAttrib2f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004171 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004172
4173 memcpy(ptr, &indx, 4); ptr += 4;
4174 memcpy(ptr, &x, 4); ptr += 4;
4175 memcpy(ptr, &y, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004176
Yahan Zhoue222fd52016-03-16 12:41:08 -07004177 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4178 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4179
keunyoungb85b2752013-03-08 12:28:03 -08004180}
4181
4182void glVertexAttrib2fv_enc(void *self , GLuint indx, const GLfloat* values)
4183{
4184
4185 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4186 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004187 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004188 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004189
4190 const unsigned int __size_values = (2 * sizeof(GLfloat));
4191 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004192 unsigned char *buf;
4193 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4194 const size_t checksumSize = checksumCalculator->checksumByteSize();
4195 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4196 buf = stream->alloc(totalSize);
4197 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004198 int tmp = OP_glVertexAttrib2fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004199 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004200
4201 memcpy(ptr, &indx, 4); ptr += 4;
4202 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4203 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004204
Yahan Zhoue222fd52016-03-16 12:41:08 -07004205 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4206 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4207
keunyoungb85b2752013-03-08 12:28:03 -08004208}
4209
4210void glVertexAttrib3f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z)
4211{
4212
4213 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4214 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004215 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004216 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004217
4218 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004219 unsigned char *buf;
4220 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4221 const size_t checksumSize = checksumCalculator->checksumByteSize();
4222 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4223 buf = stream->alloc(totalSize);
4224 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004225 int tmp = OP_glVertexAttrib3f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004226 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004227
4228 memcpy(ptr, &indx, 4); ptr += 4;
4229 memcpy(ptr, &x, 4); ptr += 4;
4230 memcpy(ptr, &y, 4); ptr += 4;
4231 memcpy(ptr, &z, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004232
Yahan Zhoue222fd52016-03-16 12:41:08 -07004233 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4234 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4235
keunyoungb85b2752013-03-08 12:28:03 -08004236}
4237
4238void glVertexAttrib3fv_enc(void *self , GLuint indx, const GLfloat* values)
4239{
4240
4241 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4242 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004243 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004244 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004245
4246 const unsigned int __size_values = (3 * sizeof(GLfloat));
4247 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004248 unsigned char *buf;
4249 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4250 const size_t checksumSize = checksumCalculator->checksumByteSize();
4251 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4252 buf = stream->alloc(totalSize);
4253 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004254 int tmp = OP_glVertexAttrib3fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004255 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004256
4257 memcpy(ptr, &indx, 4); ptr += 4;
4258 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4259 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004260
Yahan Zhoue222fd52016-03-16 12:41:08 -07004261 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4262 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4263
keunyoungb85b2752013-03-08 12:28:03 -08004264}
4265
4266void glVertexAttrib4f_enc(void *self , GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
4267{
4268
4269 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4270 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004271 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004272 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004273
4274 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004275 unsigned char *buf;
4276 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
4277 const size_t checksumSize = checksumCalculator->checksumByteSize();
4278 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4279 buf = stream->alloc(totalSize);
4280 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004281 int tmp = OP_glVertexAttrib4f;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004282 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004283
4284 memcpy(ptr, &indx, 4); ptr += 4;
4285 memcpy(ptr, &x, 4); ptr += 4;
4286 memcpy(ptr, &y, 4); ptr += 4;
4287 memcpy(ptr, &z, 4); ptr += 4;
4288 memcpy(ptr, &w, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004289
Yahan Zhoue222fd52016-03-16 12:41:08 -07004290 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4291 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4292
keunyoungb85b2752013-03-08 12:28:03 -08004293}
4294
4295void glVertexAttrib4fv_enc(void *self , GLuint indx, const GLfloat* values)
4296{
4297
4298 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4299 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004300 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004301 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004302
4303 const unsigned int __size_values = (4 * sizeof(GLfloat));
4304 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004305 unsigned char *buf;
4306 const size_t sizeWithoutChecksum = 8 + 4 + __size_values + 1*4;
4307 const size_t checksumSize = checksumCalculator->checksumByteSize();
4308 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4309 buf = stream->alloc(totalSize);
4310 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004311 int tmp = OP_glVertexAttrib4fv;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004312 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004313
4314 memcpy(ptr, &indx, 4); ptr += 4;
4315 *(unsigned int *)(ptr) = __size_values; ptr += 4;
4316 memcpy(ptr, values, __size_values);ptr += __size_values;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004317
Yahan Zhoue222fd52016-03-16 12:41:08 -07004318 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4319 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4320
keunyoungb85b2752013-03-08 12:28:03 -08004321}
4322
4323void glViewport_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height)
4324{
4325
4326 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4327 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004328 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004329 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004330
4331 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004332 unsigned char *buf;
4333 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4334 const size_t checksumSize = checksumCalculator->checksumByteSize();
4335 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4336 buf = stream->alloc(totalSize);
4337 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004338 int tmp = OP_glViewport;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004339 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004340
4341 memcpy(ptr, &x, 4); ptr += 4;
4342 memcpy(ptr, &y, 4); ptr += 4;
4343 memcpy(ptr, &width, 4); ptr += 4;
4344 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004345
Yahan Zhoue222fd52016-03-16 12:41:08 -07004346 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4347 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4348
keunyoungb85b2752013-03-08 12:28:03 -08004349}
4350
4351void glEGLImageTargetTexture2DOES_enc(void *self , GLenum target, GLeglImageOES image)
4352{
4353
4354 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4355 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004356 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004357 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004358
4359 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004360 unsigned char *buf;
4361 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4362 const size_t checksumSize = checksumCalculator->checksumByteSize();
4363 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4364 buf = stream->alloc(totalSize);
4365 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004366 int tmp = OP_glEGLImageTargetTexture2DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004367 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004368
4369 memcpy(ptr, &target, 4); ptr += 4;
4370 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004371
Yahan Zhoue222fd52016-03-16 12:41:08 -07004372 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4373 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4374
keunyoungb85b2752013-03-08 12:28:03 -08004375}
4376
4377void glEGLImageTargetRenderbufferStorageOES_enc(void *self , GLenum target, GLeglImageOES image)
4378{
4379
4380 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4381 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004382 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004383 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004384
4385 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004386 unsigned char *buf;
4387 const size_t sizeWithoutChecksum = 8 + 4 + 4;
4388 const size_t checksumSize = checksumCalculator->checksumByteSize();
4389 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4390 buf = stream->alloc(totalSize);
4391 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004392 int tmp = OP_glEGLImageTargetRenderbufferStorageOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004393 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004394
4395 memcpy(ptr, &target, 4); ptr += 4;
4396 memcpy(ptr, &image, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004397
Yahan Zhoue222fd52016-03-16 12:41:08 -07004398 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4399 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4400
keunyoungb85b2752013-03-08 12:28:03 -08004401}
4402
4403GLboolean glUnmapBufferOES_enc(void *self , GLenum target)
4404{
4405
4406 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4407 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004408 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004409 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004410
4411 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004412 unsigned char *buf;
4413 const size_t sizeWithoutChecksum = 8 + 4;
4414 const size_t checksumSize = checksumCalculator->checksumByteSize();
4415 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4416 buf = stream->alloc(totalSize);
4417 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004418 int tmp = OP_glUnmapBufferOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004419 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004420
4421 memcpy(ptr, &target, 4); ptr += 4;
4422
Yahan Zhoue222fd52016-03-16 12:41:08 -07004423 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4424 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4425
Yahan Zhoub7f09082016-03-10 11:45:02 -08004426
keunyoungb85b2752013-03-08 12:28:03 -08004427 GLboolean retval;
4428 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004429 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4430 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004431 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004432 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004433 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4434 stream->readback(checksumBufPtr, checksumSize);
4435 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004436 ALOGE("glUnmapBufferOES: GL communication error, please report this issue to b.android.com.\n");
4437 abort();
4438 }
4439 }
keunyoungb85b2752013-03-08 12:28:03 -08004440 return retval;
4441}
4442
4443void 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)
4444{
4445
4446 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4447 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004448 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004449 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004450
David 'Digit' Turner0f788d82014-11-27 18:05:34 +01004451 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004452 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004453 unsigned char *buf;
4454 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4455 const size_t checksumSize = checksumCalculator->checksumByteSize();
4456 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4457 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4458 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004459 int tmp = OP_glTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004460 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004461
4462 memcpy(ptr, &target, 4); ptr += 4;
4463 memcpy(ptr, &level, 4); ptr += 4;
4464 memcpy(ptr, &internalformat, 4); ptr += 4;
4465 memcpy(ptr, &width, 4); ptr += 4;
4466 memcpy(ptr, &height, 4); ptr += 4;
4467 memcpy(ptr, &depth, 4); ptr += 4;
4468 memcpy(ptr, &border, 4); ptr += 4;
4469 memcpy(ptr, &format, 4); ptr += 4;
4470 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004471
Yahan Zhoue222fd52016-03-16 12:41:08 -07004472 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004473 stream->flush();
4474 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004475 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004476 if (pixels != NULL) {
4477 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004478 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004479 }
4480 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004481 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4482
keunyoungb85b2752013-03-08 12:28:03 -08004483}
4484
4485void 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)
4486{
4487
4488 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4489 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004490 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004491 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004492
Yahan Zhou268e85c2016-02-19 13:59:34 -08004493 const unsigned int __size_pixels = ((pixels != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004494 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004495 unsigned char *buf;
4496 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
4497 const size_t checksumSize = checksumCalculator->checksumByteSize();
4498 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4499 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4500 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004501 int tmp = OP_glTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004502 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004503
4504 memcpy(ptr, &target, 4); ptr += 4;
4505 memcpy(ptr, &level, 4); ptr += 4;
4506 memcpy(ptr, &xoffset, 4); ptr += 4;
4507 memcpy(ptr, &yoffset, 4); ptr += 4;
4508 memcpy(ptr, &zoffset, 4); ptr += 4;
4509 memcpy(ptr, &width, 4); ptr += 4;
4510 memcpy(ptr, &height, 4); ptr += 4;
4511 memcpy(ptr, &depth, 4); ptr += 4;
4512 memcpy(ptr, &format, 4); ptr += 4;
4513 memcpy(ptr, &type, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004514
Yahan Zhoue222fd52016-03-16 12:41:08 -07004515 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004516 stream->flush();
4517 stream->writeFully(&__size_pixels,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004518 if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004519 if (pixels != NULL) {
4520 stream->writeFully(pixels, __size_pixels);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004521 if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004522 }
4523 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004524 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4525
keunyoungb85b2752013-03-08 12:28:03 -08004526}
4527
4528void glCopyTexSubImage3DOES_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
4529{
4530
4531 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4532 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004533 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004534 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004535
4536 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004537 unsigned char *buf;
4538 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
4539 const size_t checksumSize = checksumCalculator->checksumByteSize();
4540 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4541 buf = stream->alloc(totalSize);
4542 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004543 int tmp = OP_glCopyTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004544 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004545
4546 memcpy(ptr, &target, 4); ptr += 4;
4547 memcpy(ptr, &level, 4); ptr += 4;
4548 memcpy(ptr, &xoffset, 4); ptr += 4;
4549 memcpy(ptr, &yoffset, 4); ptr += 4;
4550 memcpy(ptr, &zoffset, 4); ptr += 4;
4551 memcpy(ptr, &x, 4); ptr += 4;
4552 memcpy(ptr, &y, 4); ptr += 4;
4553 memcpy(ptr, &width, 4); ptr += 4;
4554 memcpy(ptr, &height, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004555
Yahan Zhoue222fd52016-03-16 12:41:08 -07004556 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4557 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4558
keunyoungb85b2752013-03-08 12:28:03 -08004559}
4560
4561void glCompressedTexImage3DOES_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
4562{
4563
4564 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4565 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004566 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004567 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004568
Yahan Zhou268e85c2016-02-19 13:59:34 -08004569 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004570 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004571 unsigned char *buf;
4572 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4573 const size_t checksumSize = checksumCalculator->checksumByteSize();
4574 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4575 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4576 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004577 int tmp = OP_glCompressedTexImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004578 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004579
4580 memcpy(ptr, &target, 4); ptr += 4;
4581 memcpy(ptr, &level, 4); ptr += 4;
4582 memcpy(ptr, &internalformat, 4); ptr += 4;
4583 memcpy(ptr, &width, 4); ptr += 4;
4584 memcpy(ptr, &height, 4); ptr += 4;
4585 memcpy(ptr, &depth, 4); ptr += 4;
4586 memcpy(ptr, &border, 4); ptr += 4;
4587 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004588
Yahan Zhoue222fd52016-03-16 12:41:08 -07004589 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004590 stream->flush();
4591 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004592 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004593 if (data != NULL) {
4594 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004595 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004596 }
4597 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004598 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4599
keunyoungb85b2752013-03-08 12:28:03 -08004600}
4601
4602void 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)
4603{
4604
4605 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4606 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004607 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004608 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004609
Yahan Zhou268e85c2016-02-19 13:59:34 -08004610 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
keunyoungb85b2752013-03-08 12:28:03 -08004611 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004612 unsigned char *buf;
4613 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
4614 const size_t checksumSize = checksumCalculator->checksumByteSize();
4615 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4616 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
4617 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004618 int tmp = OP_glCompressedTexSubImage3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004619 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004620
4621 memcpy(ptr, &target, 4); ptr += 4;
4622 memcpy(ptr, &level, 4); ptr += 4;
4623 memcpy(ptr, &xoffset, 4); ptr += 4;
4624 memcpy(ptr, &yoffset, 4); ptr += 4;
4625 memcpy(ptr, &zoffset, 4); ptr += 4;
4626 memcpy(ptr, &width, 4); ptr += 4;
4627 memcpy(ptr, &height, 4); ptr += 4;
4628 memcpy(ptr, &depth, 4); ptr += 4;
4629 memcpy(ptr, &format, 4); ptr += 4;
4630 memcpy(ptr, &imageSize, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004631
Yahan Zhoue222fd52016-03-16 12:41:08 -07004632 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
keunyoungb85b2752013-03-08 12:28:03 -08004633 stream->flush();
4634 stream->writeFully(&__size_data,4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004635 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004636 if (data != NULL) {
4637 stream->writeFully(data, __size_data);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004638 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
Yahan Zhoub7f09082016-03-10 11:45:02 -08004639 }
4640 buf = stream->alloc(checksumSize);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004641 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
4642
keunyoungb85b2752013-03-08 12:28:03 -08004643}
4644
4645void glFramebufferTexture3DOES_enc(void *self , GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
4646{
4647
4648 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4649 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004650 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004651 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004652
4653 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004654 unsigned char *buf;
4655 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
4656 const size_t checksumSize = checksumCalculator->checksumByteSize();
4657 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4658 buf = stream->alloc(totalSize);
4659 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004660 int tmp = OP_glFramebufferTexture3DOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004661 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004662
4663 memcpy(ptr, &target, 4); ptr += 4;
4664 memcpy(ptr, &attachment, 4); ptr += 4;
4665 memcpy(ptr, &textarget, 4); ptr += 4;
4666 memcpy(ptr, &texture, 4); ptr += 4;
4667 memcpy(ptr, &level, 4); ptr += 4;
4668 memcpy(ptr, &zoffset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004669
Yahan Zhoue222fd52016-03-16 12:41:08 -07004670 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4671 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4672
keunyoungb85b2752013-03-08 12:28:03 -08004673}
4674
4675void glBindVertexArrayOES_enc(void *self , GLuint array)
4676{
4677
4678 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4679 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004680 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004681 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004682
4683 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004684 unsigned char *buf;
4685 const size_t sizeWithoutChecksum = 8 + 4;
4686 const size_t checksumSize = checksumCalculator->checksumByteSize();
4687 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4688 buf = stream->alloc(totalSize);
4689 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004690 int tmp = OP_glBindVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004691 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004692
4693 memcpy(ptr, &array, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004694
Yahan Zhoue222fd52016-03-16 12:41:08 -07004695 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4696 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4697
keunyoungb85b2752013-03-08 12:28:03 -08004698}
4699
4700void glDeleteVertexArraysOES_enc(void *self , GLsizei n, const GLuint* arrays)
4701{
4702
4703 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4704 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004705 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004706 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004707
4708 const unsigned int __size_arrays = (n * sizeof(GLuint));
4709 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004710 unsigned char *buf;
4711 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
4712 const size_t checksumSize = checksumCalculator->checksumByteSize();
4713 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4714 buf = stream->alloc(totalSize);
4715 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004716 int tmp = OP_glDeleteVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004717 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004718
4719 memcpy(ptr, &n, 4); ptr += 4;
4720 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
4721 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004722
Yahan Zhoue222fd52016-03-16 12:41:08 -07004723 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4724 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4725
keunyoungb85b2752013-03-08 12:28:03 -08004726}
4727
4728void glGenVertexArraysOES_enc(void *self , GLsizei n, GLuint* arrays)
4729{
4730
4731 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4732 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004733 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004734 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004735
4736 const unsigned int __size_arrays = (n * sizeof(GLuint));
4737 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004738 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004739 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004740 const size_t checksumSize = checksumCalculator->checksumByteSize();
4741 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4742 buf = stream->alloc(totalSize);
4743 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004744 int tmp = OP_glGenVertexArraysOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004745 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004746
4747 memcpy(ptr, &n, 4); ptr += 4;
4748 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004749
Yahan Zhoue222fd52016-03-16 12:41:08 -07004750 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4751 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4752
keunyoungb85b2752013-03-08 12:28:03 -08004753 stream->readback(arrays, __size_arrays);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004754 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
4755 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004756 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004757 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004758 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4759 stream->readback(checksumBufPtr, checksumSize);
4760 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004761 ALOGE("glGenVertexArraysOES: GL communication error, please report this issue to b.android.com.\n");
4762 abort();
4763 }
4764 }
keunyoungb85b2752013-03-08 12:28:03 -08004765}
4766
4767GLboolean glIsVertexArrayOES_enc(void *self , GLuint array)
4768{
4769
4770 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4771 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004772 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004773 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004774
4775 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004776 unsigned char *buf;
4777 const size_t sizeWithoutChecksum = 8 + 4;
4778 const size_t checksumSize = checksumCalculator->checksumByteSize();
4779 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4780 buf = stream->alloc(totalSize);
4781 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004782 int tmp = OP_glIsVertexArrayOES;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004783 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004784
4785 memcpy(ptr, &array, 4); ptr += 4;
4786
Yahan Zhoue222fd52016-03-16 12:41:08 -07004787 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4788 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4789
Yahan Zhoub7f09082016-03-10 11:45:02 -08004790
keunyoungb85b2752013-03-08 12:28:03 -08004791 GLboolean retval;
4792 stream->readback(&retval, 1);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004793 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
4794 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004795 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004796 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004797 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4798 stream->readback(checksumBufPtr, checksumSize);
4799 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004800 ALOGE("glIsVertexArrayOES: GL communication error, please report this issue to b.android.com.\n");
4801 abort();
4802 }
4803 }
keunyoungb85b2752013-03-08 12:28:03 -08004804 return retval;
4805}
4806
4807void glDiscardFramebufferEXT_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
4808{
4809
4810 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4811 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004812 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004813 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004814
4815 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
4816 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004817 unsigned char *buf;
4818 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
4819 const size_t checksumSize = checksumCalculator->checksumByteSize();
4820 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4821 buf = stream->alloc(totalSize);
4822 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004823 int tmp = OP_glDiscardFramebufferEXT;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004824 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004825
4826 memcpy(ptr, &target, 4); ptr += 4;
4827 memcpy(ptr, &numAttachments, 4); ptr += 4;
4828 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
4829 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004830
Yahan Zhoue222fd52016-03-16 12:41:08 -07004831 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4832 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4833
keunyoungb85b2752013-03-08 12:28:03 -08004834}
4835
4836void glVertexAttribPointerData_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, void* data, GLuint datalen)
4837{
4838
4839 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4840 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004841 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004842 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004843
4844 const unsigned int __size_data = datalen;
4845 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004846 unsigned char *buf;
4847 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + __size_data + 4 + 1*4;
4848 const size_t checksumSize = checksumCalculator->checksumByteSize();
4849 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4850 buf = stream->alloc(totalSize);
4851 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004852 int tmp = OP_glVertexAttribPointerData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004853 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004854
4855 memcpy(ptr, &indx, 4); ptr += 4;
4856 memcpy(ptr, &size, 4); ptr += 4;
4857 memcpy(ptr, &type, 4); ptr += 4;
4858 memcpy(ptr, &normalized, 1); ptr += 1;
4859 memcpy(ptr, &stride, 4); ptr += 4;
4860 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4861 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
4862 memcpy(ptr, &datalen, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004863
Yahan Zhoue222fd52016-03-16 12:41:08 -07004864 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4865 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4866
keunyoungb85b2752013-03-08 12:28:03 -08004867}
4868
4869void glVertexAttribPointerOffset_enc(void *self , GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint offset)
4870{
4871
4872 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4873 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004874 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004875 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004876
4877 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004878 unsigned char *buf;
4879 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4;
4880 const size_t checksumSize = checksumCalculator->checksumByteSize();
4881 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4882 buf = stream->alloc(totalSize);
4883 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004884 int tmp = OP_glVertexAttribPointerOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004885 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004886
4887 memcpy(ptr, &indx, 4); ptr += 4;
4888 memcpy(ptr, &size, 4); ptr += 4;
4889 memcpy(ptr, &type, 4); ptr += 4;
4890 memcpy(ptr, &normalized, 1); ptr += 1;
4891 memcpy(ptr, &stride, 4); ptr += 4;
4892 memcpy(ptr, &offset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004893
Yahan Zhoue222fd52016-03-16 12:41:08 -07004894 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4895 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4896
keunyoungb85b2752013-03-08 12:28:03 -08004897}
4898
4899void glDrawElementsOffset_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset)
4900{
4901
4902 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4903 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004904 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004905 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004906
4907 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004908 unsigned char *buf;
4909 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
4910 const size_t checksumSize = checksumCalculator->checksumByteSize();
4911 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4912 buf = stream->alloc(totalSize);
4913 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004914 int tmp = OP_glDrawElementsOffset;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004915 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004916
4917 memcpy(ptr, &mode, 4); ptr += 4;
4918 memcpy(ptr, &count, 4); ptr += 4;
4919 memcpy(ptr, &type, 4); ptr += 4;
4920 memcpy(ptr, &offset, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004921
Yahan Zhoue222fd52016-03-16 12:41:08 -07004922 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4923 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004924
keunyoungb85b2752013-03-08 12:28:03 -08004925}
4926
4927void glDrawElementsData_enc(void *self , GLenum mode, GLsizei count, GLenum type, void* data, GLuint datalen)
4928{
4929
4930 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4931 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004932 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004933 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004934
4935 const unsigned int __size_data = datalen;
4936 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004937 unsigned char *buf;
4938 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_data + 4 + 1*4;
4939 const size_t checksumSize = checksumCalculator->checksumByteSize();
4940 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4941 buf = stream->alloc(totalSize);
4942 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004943 int tmp = OP_glDrawElementsData;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004944 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004945
4946 memcpy(ptr, &mode, 4); ptr += 4;
4947 memcpy(ptr, &count, 4); ptr += 4;
4948 memcpy(ptr, &type, 4); ptr += 4;
4949 *(unsigned int *)(ptr) = __size_data; ptr += 4;
4950 memcpy(ptr, data, __size_data);ptr += __size_data;
4951 memcpy(ptr, &datalen, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004952
Yahan Zhoue222fd52016-03-16 12:41:08 -07004953 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4954 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
Yahan Zhoue57bd752016-06-06 12:30:39 -07004955
keunyoungb85b2752013-03-08 12:28:03 -08004956}
4957
4958void glGetCompressedTextureFormats_enc(void *self , int count, GLint* formats)
4959{
4960
4961 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
4962 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004963 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07004964 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08004965
4966 const unsigned int __size_formats = (count * sizeof(GLint));
4967 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004968 unsigned char *buf;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004969 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004970 const size_t checksumSize = checksumCalculator->checksumByteSize();
4971 const size_t totalSize = sizeWithoutChecksum + checksumSize;
4972 buf = stream->alloc(totalSize);
4973 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08004974 int tmp = OP_glGetCompressedTextureFormats;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004975 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08004976
4977 memcpy(ptr, &count, 4); ptr += 4;
4978 *(unsigned int *)(ptr) = __size_formats; ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08004979
Yahan Zhoue222fd52016-03-16 12:41:08 -07004980 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
4981 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
4982
keunyoungb85b2752013-03-08 12:28:03 -08004983 stream->readback(formats, __size_formats);
Yahan Zhoue222fd52016-03-16 12:41:08 -07004984 if (useChecksum) checksumCalculator->addBuffer(formats, __size_formats);
4985 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004986 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07004987 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07004988 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
4989 stream->readback(checksumBufPtr, checksumSize);
4990 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07004991 ALOGE("glGetCompressedTextureFormats: GL communication error, please report this issue to b.android.com.\n");
4992 abort();
4993 }
4994 }
keunyoungb85b2752013-03-08 12:28:03 -08004995}
4996
4997void glShaderString_enc(void *self , GLuint shader, const GLchar* string, GLsizei len)
4998{
4999
5000 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5001 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005002 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005003 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005004
5005 const unsigned int __size_string = len;
5006 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005007 unsigned char *buf;
5008 const size_t sizeWithoutChecksum = 8 + 4 + __size_string + 4 + 1*4;
5009 const size_t checksumSize = checksumCalculator->checksumByteSize();
5010 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5011 buf = stream->alloc(totalSize);
5012 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08005013 int tmp = OP_glShaderString;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005014 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005015
5016 memcpy(ptr, &shader, 4); ptr += 4;
5017 *(unsigned int *)(ptr) = __size_string; ptr += 4;
5018 memcpy(ptr, string, __size_string);ptr += __size_string;
5019 memcpy(ptr, &len, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005020
Yahan Zhoue222fd52016-03-16 12:41:08 -07005021 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5022 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5023
keunyoungb85b2752013-03-08 12:28:03 -08005024}
5025
5026int glFinishRoundTrip_enc(void *self )
5027{
5028
5029 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5030 IOStream *stream = ctx->m_stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005031 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
Yahan Zhoue222fd52016-03-16 12:41:08 -07005032 bool useChecksum = checksumCalculator->getVersion() > 0;
keunyoungb85b2752013-03-08 12:28:03 -08005033
5034 unsigned char *ptr;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005035 unsigned char *buf;
5036 const size_t sizeWithoutChecksum = 8;
5037 const size_t checksumSize = checksumCalculator->checksumByteSize();
5038 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5039 buf = stream->alloc(totalSize);
5040 ptr = buf;
keunyoungb85b2752013-03-08 12:28:03 -08005041 int tmp = OP_glFinishRoundTrip;memcpy(ptr, &tmp, 4); ptr += 4;
Yahan Zhoub7f09082016-03-10 11:45:02 -08005042 memcpy(ptr, &totalSize, 4); ptr += 4;
keunyoungb85b2752013-03-08 12:28:03 -08005043
5044
Yahan Zhoue222fd52016-03-16 12:41:08 -07005045 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5046 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5047
Yahan Zhoub7f09082016-03-10 11:45:02 -08005048
keunyoungb85b2752013-03-08 12:28:03 -08005049 int retval;
5050 stream->readback(&retval, 4);
Yahan Zhoue222fd52016-03-16 12:41:08 -07005051 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5052 if (useChecksum) {
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005053 unsigned char *checksumBufPtr = NULL;
Yurii Zubrytskyi1d1fc8d2016-11-04 11:59:27 -07005054 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
Yahan Zhoua9aee9f2016-06-17 15:06:37 -07005055 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5056 stream->readback(checksumBufPtr, checksumSize);
5057 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Yahan Zhoue222fd52016-03-16 12:41:08 -07005058 ALOGE("glFinishRoundTrip: GL communication error, please report this issue to b.android.com.\n");
5059 abort();
5060 }
5061 }
keunyoungb85b2752013-03-08 12:28:03 -08005062 return retval;
5063}
5064
Lingfeng Yange6556dc2017-01-09 12:04:12 -08005065void glGenVertexArrays_enc(void *self , GLsizei n, GLuint* arrays)
5066{
5067
5068 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5069 IOStream *stream = ctx->m_stream;
5070 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5071 bool useChecksum = checksumCalculator->getVersion() > 0;
5072
5073 const unsigned int __size_arrays = (n * sizeof(GLuint));
5074 unsigned char *ptr;
5075 unsigned char *buf;
5076 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
5077 const size_t checksumSize = checksumCalculator->checksumByteSize();
5078 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5079 buf = stream->alloc(totalSize);
5080 ptr = buf;
5081 int tmp = OP_glGenVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5082 memcpy(ptr, &totalSize, 4); ptr += 4;
5083
5084 memcpy(ptr, &n, 4); ptr += 4;
5085 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5086
5087 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5088 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5089
5090 stream->readback(arrays, __size_arrays);
5091 if (useChecksum) checksumCalculator->addBuffer(arrays, __size_arrays);
5092 if (useChecksum) {
5093 unsigned char *checksumBufPtr = NULL;
5094 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5095 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5096 stream->readback(checksumBufPtr, checksumSize);
5097 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5098 ALOGE("glGenVertexArrays: GL communication error, please report this issue to b.android.com.\n");
5099 abort();
5100 }
5101 }
5102}
5103
5104void glBindVertexArray_enc(void *self , GLuint array)
5105{
5106
5107 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5108 IOStream *stream = ctx->m_stream;
5109 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5110 bool useChecksum = checksumCalculator->getVersion() > 0;
5111
5112 unsigned char *ptr;
5113 unsigned char *buf;
5114 const size_t sizeWithoutChecksum = 8 + 4;
5115 const size_t checksumSize = checksumCalculator->checksumByteSize();
5116 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5117 buf = stream->alloc(totalSize);
5118 ptr = buf;
5119 int tmp = OP_glBindVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5120 memcpy(ptr, &totalSize, 4); ptr += 4;
5121
5122 memcpy(ptr, &array, 4); ptr += 4;
5123
5124 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5125 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5126
5127}
5128
5129void glDeleteVertexArrays_enc(void *self , GLsizei n, const GLuint* arrays)
5130{
5131
5132 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5133 IOStream *stream = ctx->m_stream;
5134 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5135 bool useChecksum = checksumCalculator->getVersion() > 0;
5136
5137 const unsigned int __size_arrays = (n * sizeof(GLuint));
5138 unsigned char *ptr;
5139 unsigned char *buf;
5140 const size_t sizeWithoutChecksum = 8 + 4 + __size_arrays + 1*4;
5141 const size_t checksumSize = checksumCalculator->checksumByteSize();
5142 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5143 buf = stream->alloc(totalSize);
5144 ptr = buf;
5145 int tmp = OP_glDeleteVertexArrays;memcpy(ptr, &tmp, 4); ptr += 4;
5146 memcpy(ptr, &totalSize, 4); ptr += 4;
5147
5148 memcpy(ptr, &n, 4); ptr += 4;
5149 *(unsigned int *)(ptr) = __size_arrays; ptr += 4;
5150 memcpy(ptr, arrays, __size_arrays);ptr += __size_arrays;
5151
5152 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5153 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5154
5155}
5156
5157GLboolean glIsVertexArray_enc(void *self , GLuint array)
5158{
5159
5160 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5161 IOStream *stream = ctx->m_stream;
5162 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5163 bool useChecksum = checksumCalculator->getVersion() > 0;
5164
5165 unsigned char *ptr;
5166 unsigned char *buf;
5167 const size_t sizeWithoutChecksum = 8 + 4;
5168 const size_t checksumSize = checksumCalculator->checksumByteSize();
5169 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5170 buf = stream->alloc(totalSize);
5171 ptr = buf;
5172 int tmp = OP_glIsVertexArray;memcpy(ptr, &tmp, 4); ptr += 4;
5173 memcpy(ptr, &totalSize, 4); ptr += 4;
5174
5175 memcpy(ptr, &array, 4); ptr += 4;
5176
5177 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5178 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5179
5180
5181 GLboolean retval;
5182 stream->readback(&retval, 1);
5183 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
5184 if (useChecksum) {
5185 unsigned char *checksumBufPtr = NULL;
5186 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5187 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5188 stream->readback(checksumBufPtr, checksumSize);
5189 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5190 ALOGE("glIsVertexArray: GL communication error, please report this issue to b.android.com.\n");
5191 abort();
5192 }
5193 }
5194 return retval;
5195}
5196
5197void glMapBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* mapped)
5198{
5199
5200 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5201 IOStream *stream = ctx->m_stream;
5202 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5203 bool useChecksum = checksumCalculator->getVersion() > 0;
5204
5205 const unsigned int __size_mapped = ((mapped != NULL) ? length : 0);
5206 unsigned char *ptr;
5207 unsigned char *buf;
5208 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
5209 const size_t checksumSize = checksumCalculator->checksumByteSize();
5210 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5211 buf = stream->alloc(totalSize);
5212 ptr = buf;
5213 int tmp = OP_glMapBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5214 memcpy(ptr, &totalSize, 4); ptr += 4;
5215
5216 memcpy(ptr, &target, 4); ptr += 4;
5217 memcpy(ptr, &offset, 4); ptr += 4;
5218 memcpy(ptr, &length, 4); ptr += 4;
5219 memcpy(ptr, &access, 4); ptr += 4;
5220 *(unsigned int *)(ptr) = __size_mapped; ptr += 4;
5221
5222 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5223 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5224
5225 if (mapped != NULL) {
5226 stream->readback(mapped, __size_mapped);
5227 if (useChecksum) checksumCalculator->addBuffer(mapped, __size_mapped);
5228 }
5229 if (useChecksum) {
5230 unsigned char *checksumBufPtr = NULL;
5231 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5232 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5233 stream->readback(checksumBufPtr, checksumSize);
5234 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5235 ALOGE("glMapBufferRangeAEMU: GL communication error, please report this issue to b.android.com.\n");
5236 abort();
5237 }
5238 }
5239}
5240
5241void glUnmapBufferAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer, GLboolean* out_res)
5242{
5243
5244 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5245 IOStream *stream = ctx->m_stream;
5246 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5247 bool useChecksum = checksumCalculator->getVersion() > 0;
5248
5249 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5250 const unsigned int __size_out_res = (sizeof(GLboolean));
5251 unsigned char *ptr;
5252 unsigned char *buf;
5253 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 0 + 2*4;
5254 const size_t checksumSize = checksumCalculator->checksumByteSize();
5255 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5256 buf = stream->alloc(totalSize);
5257 ptr = buf;
5258 int tmp = OP_glUnmapBufferAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5259 memcpy(ptr, &totalSize, 4); ptr += 4;
5260
5261 memcpy(ptr, &target, 4); ptr += 4;
5262 memcpy(ptr, &offset, 4); ptr += 4;
5263 memcpy(ptr, &length, 4); ptr += 4;
5264 memcpy(ptr, &access, 4); ptr += 4;
5265 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5266 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5267 *(unsigned int *)(ptr) = __size_out_res; ptr += 4;
5268
5269 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5270 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5271
5272 stream->readback(out_res, __size_out_res);
5273 if (useChecksum) checksumCalculator->addBuffer(out_res, __size_out_res);
5274 if (useChecksum) {
5275 unsigned char *checksumBufPtr = NULL;
5276 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5277 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5278 stream->readback(checksumBufPtr, checksumSize);
5279 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5280 ALOGE("glUnmapBufferAEMU: GL communication error, please report this issue to b.android.com.\n");
5281 abort();
5282 }
5283 }
5284}
5285
5286void glFlushMappedBufferRangeAEMU_enc(void *self , GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access, void* guest_buffer)
5287{
5288
5289 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5290 IOStream *stream = ctx->m_stream;
5291 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5292 bool useChecksum = checksumCalculator->getVersion() > 0;
5293
5294 const unsigned int __size_guest_buffer = ((guest_buffer != NULL) ? length : 0);
5295 unsigned char *ptr;
5296 unsigned char *buf;
5297 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_guest_buffer + 1*4;
5298 const size_t checksumSize = checksumCalculator->checksumByteSize();
5299 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5300 buf = stream->alloc(totalSize);
5301 ptr = buf;
5302 int tmp = OP_glFlushMappedBufferRangeAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5303 memcpy(ptr, &totalSize, 4); ptr += 4;
5304
5305 memcpy(ptr, &target, 4); ptr += 4;
5306 memcpy(ptr, &offset, 4); ptr += 4;
5307 memcpy(ptr, &length, 4); ptr += 4;
5308 memcpy(ptr, &access, 4); ptr += 4;
5309 *(unsigned int *)(ptr) = __size_guest_buffer; ptr += 4;
5310 if (guest_buffer != NULL) memcpy(ptr, guest_buffer, __size_guest_buffer);ptr += __size_guest_buffer;
5311
5312 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5313 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5314
5315}
5316
5317void glReadPixelsOffsetAEMU_enc(void *self , GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5318{
5319
5320 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5321 IOStream *stream = ctx->m_stream;
5322 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5323 bool useChecksum = checksumCalculator->getVersion() > 0;
5324
5325 unsigned char *ptr;
5326 unsigned char *buf;
5327 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5328 const size_t checksumSize = checksumCalculator->checksumByteSize();
5329 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5330 buf = stream->alloc(totalSize);
5331 ptr = buf;
5332 int tmp = OP_glReadPixelsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5333 memcpy(ptr, &totalSize, 4); ptr += 4;
5334
5335 memcpy(ptr, &x, 4); ptr += 4;
5336 memcpy(ptr, &y, 4); ptr += 4;
5337 memcpy(ptr, &width, 4); ptr += 4;
5338 memcpy(ptr, &height, 4); ptr += 4;
5339 memcpy(ptr, &format, 4); ptr += 4;
5340 memcpy(ptr, &type, 4); ptr += 4;
5341 memcpy(ptr, &offset, 4); ptr += 4;
5342
5343 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5344 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5345
5346}
5347
5348void glCompressedTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLuint offset)
5349{
5350
5351 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5352 IOStream *stream = ctx->m_stream;
5353 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5354 bool useChecksum = checksumCalculator->getVersion() > 0;
5355
5356 unsigned char *ptr;
5357 unsigned char *buf;
5358 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5359 const size_t checksumSize = checksumCalculator->checksumByteSize();
5360 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5361 buf = stream->alloc(totalSize);
5362 ptr = buf;
5363 int tmp = OP_glCompressedTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5364 memcpy(ptr, &totalSize, 4); ptr += 4;
5365
5366 memcpy(ptr, &target, 4); ptr += 4;
5367 memcpy(ptr, &level, 4); ptr += 4;
5368 memcpy(ptr, &internalformat, 4); ptr += 4;
5369 memcpy(ptr, &width, 4); ptr += 4;
5370 memcpy(ptr, &height, 4); ptr += 4;
5371 memcpy(ptr, &border, 4); ptr += 4;
5372 memcpy(ptr, &imageSize, 4); ptr += 4;
5373 memcpy(ptr, &offset, 4); ptr += 4;
5374
5375 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5376 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5377
5378}
5379
5380void glCompressedTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLuint offset)
5381{
5382
5383 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5384 IOStream *stream = ctx->m_stream;
5385 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5386 bool useChecksum = checksumCalculator->getVersion() > 0;
5387
5388 unsigned char *ptr;
5389 unsigned char *buf;
5390 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5391 const size_t checksumSize = checksumCalculator->checksumByteSize();
5392 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5393 buf = stream->alloc(totalSize);
5394 ptr = buf;
5395 int tmp = OP_glCompressedTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5396 memcpy(ptr, &totalSize, 4); ptr += 4;
5397
5398 memcpy(ptr, &target, 4); ptr += 4;
5399 memcpy(ptr, &level, 4); ptr += 4;
5400 memcpy(ptr, &xoffset, 4); ptr += 4;
5401 memcpy(ptr, &yoffset, 4); ptr += 4;
5402 memcpy(ptr, &width, 4); ptr += 4;
5403 memcpy(ptr, &height, 4); ptr += 4;
5404 memcpy(ptr, &format, 4); ptr += 4;
5405 memcpy(ptr, &imageSize, 4); ptr += 4;
5406 memcpy(ptr, &offset, 4); ptr += 4;
5407
5408 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5409 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5410
5411}
5412
5413void glTexImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLuint offset)
5414{
5415
5416 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5417 IOStream *stream = ctx->m_stream;
5418 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5419 bool useChecksum = checksumCalculator->getVersion() > 0;
5420
5421 unsigned char *ptr;
5422 unsigned char *buf;
5423 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5424 const size_t checksumSize = checksumCalculator->checksumByteSize();
5425 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5426 buf = stream->alloc(totalSize);
5427 ptr = buf;
5428 int tmp = OP_glTexImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5429 memcpy(ptr, &totalSize, 4); ptr += 4;
5430
5431 memcpy(ptr, &target, 4); ptr += 4;
5432 memcpy(ptr, &level, 4); ptr += 4;
5433 memcpy(ptr, &internalformat, 4); ptr += 4;
5434 memcpy(ptr, &width, 4); ptr += 4;
5435 memcpy(ptr, &height, 4); ptr += 4;
5436 memcpy(ptr, &border, 4); ptr += 4;
5437 memcpy(ptr, &format, 4); ptr += 4;
5438 memcpy(ptr, &type, 4); ptr += 4;
5439 memcpy(ptr, &offset, 4); ptr += 4;
5440
5441 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5442 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5443
5444}
5445
5446void glTexSubImage2DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLuint offset)
5447{
5448
5449 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5450 IOStream *stream = ctx->m_stream;
5451 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5452 bool useChecksum = checksumCalculator->getVersion() > 0;
5453
5454 unsigned char *ptr;
5455 unsigned char *buf;
5456 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
5457 const size_t checksumSize = checksumCalculator->checksumByteSize();
5458 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5459 buf = stream->alloc(totalSize);
5460 ptr = buf;
5461 int tmp = OP_glTexSubImage2DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5462 memcpy(ptr, &totalSize, 4); ptr += 4;
5463
5464 memcpy(ptr, &target, 4); ptr += 4;
5465 memcpy(ptr, &level, 4); ptr += 4;
5466 memcpy(ptr, &xoffset, 4); ptr += 4;
5467 memcpy(ptr, &yoffset, 4); ptr += 4;
5468 memcpy(ptr, &width, 4); ptr += 4;
5469 memcpy(ptr, &height, 4); ptr += 4;
5470 memcpy(ptr, &format, 4); ptr += 4;
5471 memcpy(ptr, &type, 4); ptr += 4;
5472 memcpy(ptr, &offset, 4); ptr += 4;
5473
5474 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5475 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5476
5477}
5478
5479void glBindBufferRange_enc(void *self , GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5480{
5481
5482 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5483 IOStream *stream = ctx->m_stream;
5484 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5485 bool useChecksum = checksumCalculator->getVersion() > 0;
5486
5487 unsigned char *ptr;
5488 unsigned char *buf;
5489 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5490 const size_t checksumSize = checksumCalculator->checksumByteSize();
5491 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5492 buf = stream->alloc(totalSize);
5493 ptr = buf;
5494 int tmp = OP_glBindBufferRange;memcpy(ptr, &tmp, 4); ptr += 4;
5495 memcpy(ptr, &totalSize, 4); ptr += 4;
5496
5497 memcpy(ptr, &target, 4); ptr += 4;
5498 memcpy(ptr, &index, 4); ptr += 4;
5499 memcpy(ptr, &buffer, 4); ptr += 4;
5500 memcpy(ptr, &offset, 4); ptr += 4;
5501 memcpy(ptr, &size, 4); ptr += 4;
5502
5503 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5504 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5505
5506}
5507
5508void glBindBufferBase_enc(void *self , GLenum target, GLuint index, GLuint buffer)
5509{
5510
5511 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5512 IOStream *stream = ctx->m_stream;
5513 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5514 bool useChecksum = checksumCalculator->getVersion() > 0;
5515
5516 unsigned char *ptr;
5517 unsigned char *buf;
5518 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5519 const size_t checksumSize = checksumCalculator->checksumByteSize();
5520 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5521 buf = stream->alloc(totalSize);
5522 ptr = buf;
5523 int tmp = OP_glBindBufferBase;memcpy(ptr, &tmp, 4); ptr += 4;
5524 memcpy(ptr, &totalSize, 4); ptr += 4;
5525
5526 memcpy(ptr, &target, 4); ptr += 4;
5527 memcpy(ptr, &index, 4); ptr += 4;
5528 memcpy(ptr, &buffer, 4); ptr += 4;
5529
5530 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5531 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5532
5533}
5534
5535void glCopyBufferSubData_enc(void *self , GLenum readtarget, GLenum writetarget, GLintptr readoffset, GLintptr writeoffset, GLsizeiptr size)
5536{
5537
5538 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5539 IOStream *stream = ctx->m_stream;
5540 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5541 bool useChecksum = checksumCalculator->getVersion() > 0;
5542
5543 unsigned char *ptr;
5544 unsigned char *buf;
5545 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5546 const size_t checksumSize = checksumCalculator->checksumByteSize();
5547 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5548 buf = stream->alloc(totalSize);
5549 ptr = buf;
5550 int tmp = OP_glCopyBufferSubData;memcpy(ptr, &tmp, 4); ptr += 4;
5551 memcpy(ptr, &totalSize, 4); ptr += 4;
5552
5553 memcpy(ptr, &readtarget, 4); ptr += 4;
5554 memcpy(ptr, &writetarget, 4); ptr += 4;
5555 memcpy(ptr, &readoffset, 4); ptr += 4;
5556 memcpy(ptr, &writeoffset, 4); ptr += 4;
5557 memcpy(ptr, &size, 4); ptr += 4;
5558
5559 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5560 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5561
5562 stream->flush();
5563}
5564
5565void glClearBufferiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLint* value)
5566{
5567
5568 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5569 IOStream *stream = ctx->m_stream;
5570 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5571 bool useChecksum = checksumCalculator->getVersion() > 0;
5572
5573 const unsigned int __size_value = (sizeof(GLint) * glesv2_enc::clearBufferNumElts(self, buffer));
5574 unsigned char *ptr;
5575 unsigned char *buf;
5576 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5577 const size_t checksumSize = checksumCalculator->checksumByteSize();
5578 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5579 buf = stream->alloc(totalSize);
5580 ptr = buf;
5581 int tmp = OP_glClearBufferiv;memcpy(ptr, &tmp, 4); ptr += 4;
5582 memcpy(ptr, &totalSize, 4); ptr += 4;
5583
5584 memcpy(ptr, &buffer, 4); ptr += 4;
5585 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5586 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5587 memcpy(ptr, value, __size_value);ptr += __size_value;
5588
5589 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5590 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5591
5592}
5593
5594void glClearBufferuiv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLuint* value)
5595{
5596
5597 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5598 IOStream *stream = ctx->m_stream;
5599 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5600 bool useChecksum = checksumCalculator->getVersion() > 0;
5601
5602 const unsigned int __size_value = (sizeof(GLuint) * glesv2_enc::clearBufferNumElts(self, buffer));
5603 unsigned char *ptr;
5604 unsigned char *buf;
5605 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5606 const size_t checksumSize = checksumCalculator->checksumByteSize();
5607 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5608 buf = stream->alloc(totalSize);
5609 ptr = buf;
5610 int tmp = OP_glClearBufferuiv;memcpy(ptr, &tmp, 4); ptr += 4;
5611 memcpy(ptr, &totalSize, 4); ptr += 4;
5612
5613 memcpy(ptr, &buffer, 4); ptr += 4;
5614 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5615 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5616 memcpy(ptr, value, __size_value);ptr += __size_value;
5617
5618 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5619 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5620
5621}
5622
5623void glClearBufferfv_enc(void *self , GLenum buffer, GLint drawBuffer, const GLfloat* value)
5624{
5625
5626 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5627 IOStream *stream = ctx->m_stream;
5628 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5629 bool useChecksum = checksumCalculator->getVersion() > 0;
5630
5631 const unsigned int __size_value = (sizeof(GLfloat) * glesv2_enc::clearBufferNumElts(self, buffer));
5632 unsigned char *ptr;
5633 unsigned char *buf;
5634 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
5635 const size_t checksumSize = checksumCalculator->checksumByteSize();
5636 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5637 buf = stream->alloc(totalSize);
5638 ptr = buf;
5639 int tmp = OP_glClearBufferfv;memcpy(ptr, &tmp, 4); ptr += 4;
5640 memcpy(ptr, &totalSize, 4); ptr += 4;
5641
5642 memcpy(ptr, &buffer, 4); ptr += 4;
5643 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5644 *(unsigned int *)(ptr) = __size_value; ptr += 4;
5645 memcpy(ptr, value, __size_value);ptr += __size_value;
5646
5647 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5648 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5649
5650}
5651
5652void glClearBufferfi_enc(void *self , GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
5653{
5654
5655 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5656 IOStream *stream = ctx->m_stream;
5657 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5658 bool useChecksum = checksumCalculator->getVersion() > 0;
5659
5660 unsigned char *ptr;
5661 unsigned char *buf;
5662 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5663 const size_t checksumSize = checksumCalculator->checksumByteSize();
5664 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5665 buf = stream->alloc(totalSize);
5666 ptr = buf;
5667 int tmp = OP_glClearBufferfi;memcpy(ptr, &tmp, 4); ptr += 4;
5668 memcpy(ptr, &totalSize, 4); ptr += 4;
5669
5670 memcpy(ptr, &buffer, 4); ptr += 4;
5671 memcpy(ptr, &drawBuffer, 4); ptr += 4;
5672 memcpy(ptr, &depth, 4); ptr += 4;
5673 memcpy(ptr, &stencil, 4); ptr += 4;
5674
5675 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5676 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5677
5678}
5679
5680void glUniformBlockBinding_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5681{
5682
5683 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5684 IOStream *stream = ctx->m_stream;
5685 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5686 bool useChecksum = checksumCalculator->getVersion() > 0;
5687
5688 unsigned char *ptr;
5689 unsigned char *buf;
5690 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5691 const size_t checksumSize = checksumCalculator->checksumByteSize();
5692 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5693 buf = stream->alloc(totalSize);
5694 ptr = buf;
5695 int tmp = OP_glUniformBlockBinding;memcpy(ptr, &tmp, 4); ptr += 4;
5696 memcpy(ptr, &totalSize, 4); ptr += 4;
5697
5698 memcpy(ptr, &program, 4); ptr += 4;
5699 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5700 memcpy(ptr, &uniformBlockBinding, 4); ptr += 4;
5701
5702 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5703 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5704
5705}
5706
5707GLuint glGetUniformBlockIndex_enc(void *self , GLuint program, const GLchar* uniformBlockName)
5708{
5709
5710 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5711 IOStream *stream = ctx->m_stream;
5712 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5713 bool useChecksum = checksumCalculator->getVersion() > 0;
5714
5715 const unsigned int __size_uniformBlockName = (strlen(uniformBlockName) + 1);
5716 unsigned char *ptr;
5717 unsigned char *buf;
5718 const size_t sizeWithoutChecksum = 8 + 4 + __size_uniformBlockName + 1*4;
5719 const size_t checksumSize = checksumCalculator->checksumByteSize();
5720 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5721 buf = stream->alloc(totalSize);
5722 ptr = buf;
5723 int tmp = OP_glGetUniformBlockIndex;memcpy(ptr, &tmp, 4); ptr += 4;
5724 memcpy(ptr, &totalSize, 4); ptr += 4;
5725
5726 memcpy(ptr, &program, 4); ptr += 4;
5727 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5728 memcpy(ptr, uniformBlockName, __size_uniformBlockName);ptr += __size_uniformBlockName;
5729
5730 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5731 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5732
5733
5734 GLuint retval;
5735 stream->readback(&retval, 4);
5736 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
5737 if (useChecksum) {
5738 unsigned char *checksumBufPtr = NULL;
5739 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5740 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5741 stream->readback(checksumBufPtr, checksumSize);
5742 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5743 ALOGE("glGetUniformBlockIndex: GL communication error, please report this issue to b.android.com.\n");
5744 abort();
5745 }
5746 }
5747 return retval;
5748}
5749
5750void glGetUniformIndicesAEMU_enc(void *self , GLuint program, GLsizei uniformCount, const GLchar* packedUniformNames, GLsizei packedLen, GLuint* uniformIndices)
5751{
5752
5753 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5754 IOStream *stream = ctx->m_stream;
5755 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5756 bool useChecksum = checksumCalculator->getVersion() > 0;
5757
5758 const unsigned int __size_packedUniformNames = packedLen;
5759 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
5760 unsigned char *ptr;
5761 unsigned char *buf;
5762 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedUniformNames + 4 + 0 + 2*4;
5763 const size_t checksumSize = checksumCalculator->checksumByteSize();
5764 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5765 buf = stream->alloc(totalSize);
5766 ptr = buf;
5767 int tmp = OP_glGetUniformIndicesAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
5768 memcpy(ptr, &totalSize, 4); ptr += 4;
5769
5770 memcpy(ptr, &program, 4); ptr += 4;
5771 memcpy(ptr, &uniformCount, 4); ptr += 4;
5772 *(unsigned int *)(ptr) = __size_packedUniformNames; ptr += 4;
5773 memcpy(ptr, packedUniformNames, __size_packedUniformNames);ptr += __size_packedUniformNames;
5774 memcpy(ptr, &packedLen, 4); ptr += 4;
5775 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
5776
5777 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5778 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5779
5780 stream->readback(uniformIndices, __size_uniformIndices);
5781 if (useChecksum) checksumCalculator->addBuffer(uniformIndices, __size_uniformIndices);
5782 if (useChecksum) {
5783 unsigned char *checksumBufPtr = NULL;
5784 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5785 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5786 stream->readback(checksumBufPtr, checksumSize);
5787 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5788 ALOGE("glGetUniformIndicesAEMU: GL communication error, please report this issue to b.android.com.\n");
5789 abort();
5790 }
5791 }
5792}
5793
5794void glGetActiveUniformBlockiv_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5795{
5796
5797 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5798 IOStream *stream = ctx->m_stream;
5799 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5800 bool useChecksum = checksumCalculator->getVersion() > 0;
5801
5802 const unsigned int __size_params = (glesv2_enc::glActiveUniformBlockivParamSize(self, program, uniformBlockIndex, pname) * sizeof(GLint));
5803 unsigned char *ptr;
5804 unsigned char *buf;
5805 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
5806 const size_t checksumSize = checksumCalculator->checksumByteSize();
5807 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5808 buf = stream->alloc(totalSize);
5809 ptr = buf;
5810 int tmp = OP_glGetActiveUniformBlockiv;memcpy(ptr, &tmp, 4); ptr += 4;
5811 memcpy(ptr, &totalSize, 4); ptr += 4;
5812
5813 memcpy(ptr, &program, 4); ptr += 4;
5814 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5815 memcpy(ptr, &pname, 4); ptr += 4;
5816 *(unsigned int *)(ptr) = __size_params; ptr += 4;
5817
5818 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5819 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5820
5821 stream->readback(params, __size_params);
5822 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
5823 if (useChecksum) {
5824 unsigned char *checksumBufPtr = NULL;
5825 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5826 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5827 stream->readback(checksumBufPtr, checksumSize);
5828 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5829 ALOGE("glGetActiveUniformBlockiv: GL communication error, please report this issue to b.android.com.\n");
5830 abort();
5831 }
5832 }
5833}
5834
5835void glGetActiveUniformBlockName_enc(void *self , GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5836{
5837
5838 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5839 IOStream *stream = ctx->m_stream;
5840 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5841 bool useChecksum = checksumCalculator->getVersion() > 0;
5842
5843 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
5844 const unsigned int __size_uniformBlockName = ((uniformBlockName != NULL) ? bufSize : 0);
5845 unsigned char *ptr;
5846 unsigned char *buf;
5847 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 2*4;
5848 const size_t checksumSize = checksumCalculator->checksumByteSize();
5849 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5850 buf = stream->alloc(totalSize);
5851 ptr = buf;
5852 int tmp = OP_glGetActiveUniformBlockName;memcpy(ptr, &tmp, 4); ptr += 4;
5853 memcpy(ptr, &totalSize, 4); ptr += 4;
5854
5855 memcpy(ptr, &program, 4); ptr += 4;
5856 memcpy(ptr, &uniformBlockIndex, 4); ptr += 4;
5857 memcpy(ptr, &bufSize, 4); ptr += 4;
5858 *(unsigned int *)(ptr) = __size_length; ptr += 4;
5859 *(unsigned int *)(ptr) = __size_uniformBlockName; ptr += 4;
5860
5861 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5862 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5863
5864 if (length != NULL) {
5865 stream->readback(length, __size_length);
5866 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
5867 }
5868 if (uniformBlockName != NULL) {
5869 stream->readback(uniformBlockName, __size_uniformBlockName);
5870 if (useChecksum) checksumCalculator->addBuffer(uniformBlockName, __size_uniformBlockName);
5871 }
5872 if (useChecksum) {
5873 unsigned char *checksumBufPtr = NULL;
5874 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
5875 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
5876 stream->readback(checksumBufPtr, checksumSize);
5877 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
5878 ALOGE("glGetActiveUniformBlockName: GL communication error, please report this issue to b.android.com.\n");
5879 abort();
5880 }
5881 }
5882}
5883
5884void glUniform1ui_enc(void *self , GLint location, GLuint v0)
5885{
5886
5887 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5888 IOStream *stream = ctx->m_stream;
5889 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5890 bool useChecksum = checksumCalculator->getVersion() > 0;
5891
5892 unsigned char *ptr;
5893 unsigned char *buf;
5894 const size_t sizeWithoutChecksum = 8 + 4 + 4;
5895 const size_t checksumSize = checksumCalculator->checksumByteSize();
5896 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5897 buf = stream->alloc(totalSize);
5898 ptr = buf;
5899 int tmp = OP_glUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
5900 memcpy(ptr, &totalSize, 4); ptr += 4;
5901
5902 memcpy(ptr, &location, 4); ptr += 4;
5903 memcpy(ptr, &v0, 4); ptr += 4;
5904
5905 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5906 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5907
5908}
5909
5910void glUniform2ui_enc(void *self , GLint location, GLuint v0, GLuint v1)
5911{
5912
5913 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5914 IOStream *stream = ctx->m_stream;
5915 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5916 bool useChecksum = checksumCalculator->getVersion() > 0;
5917
5918 unsigned char *ptr;
5919 unsigned char *buf;
5920 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
5921 const size_t checksumSize = checksumCalculator->checksumByteSize();
5922 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5923 buf = stream->alloc(totalSize);
5924 ptr = buf;
5925 int tmp = OP_glUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
5926 memcpy(ptr, &totalSize, 4); ptr += 4;
5927
5928 memcpy(ptr, &location, 4); ptr += 4;
5929 memcpy(ptr, &v0, 4); ptr += 4;
5930 memcpy(ptr, &v1, 4); ptr += 4;
5931
5932 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5933 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5934
5935}
5936
5937void glUniform3ui_enc(void *self , GLint location, GLuint v0, GLuint v1, GLuint v2)
5938{
5939
5940 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5941 IOStream *stream = ctx->m_stream;
5942 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5943 bool useChecksum = checksumCalculator->getVersion() > 0;
5944
5945 unsigned char *ptr;
5946 unsigned char *buf;
5947 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
5948 const size_t checksumSize = checksumCalculator->checksumByteSize();
5949 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5950 buf = stream->alloc(totalSize);
5951 ptr = buf;
5952 int tmp = OP_glUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
5953 memcpy(ptr, &totalSize, 4); ptr += 4;
5954
5955 memcpy(ptr, &location, 4); ptr += 4;
5956 memcpy(ptr, &v0, 4); ptr += 4;
5957 memcpy(ptr, &v1, 4); ptr += 4;
5958 memcpy(ptr, &v2, 4); ptr += 4;
5959
5960 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5961 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5962
5963}
5964
5965void glUniform4ui_enc(void *self , GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3)
5966{
5967
5968 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5969 IOStream *stream = ctx->m_stream;
5970 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
5971 bool useChecksum = checksumCalculator->getVersion() > 0;
5972
5973 unsigned char *ptr;
5974 unsigned char *buf;
5975 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
5976 const size_t checksumSize = checksumCalculator->checksumByteSize();
5977 const size_t totalSize = sizeWithoutChecksum + checksumSize;
5978 buf = stream->alloc(totalSize);
5979 ptr = buf;
5980 int tmp = OP_glUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
5981 memcpy(ptr, &totalSize, 4); ptr += 4;
5982
5983 memcpy(ptr, &location, 4); ptr += 4;
5984 memcpy(ptr, &v0, 4); ptr += 4;
5985 memcpy(ptr, &v1, 4); ptr += 4;
5986 memcpy(ptr, &v2, 4); ptr += 4;
5987 memcpy(ptr, &v3, 4); ptr += 4;
5988
5989 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
5990 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
5991
5992}
5993
5994void glUniform1uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
5995{
5996
5997 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
5998 IOStream *stream = ctx->m_stream;
5999 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6000 bool useChecksum = checksumCalculator->getVersion() > 0;
6001
6002 const unsigned int __size_value = (count * sizeof(GLuint));
6003 unsigned char *ptr;
6004 unsigned char *buf;
6005 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6006 const size_t checksumSize = checksumCalculator->checksumByteSize();
6007 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6008 buf = stream->alloc(totalSize);
6009 ptr = buf;
6010 int tmp = OP_glUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6011 memcpy(ptr, &totalSize, 4); ptr += 4;
6012
6013 memcpy(ptr, &location, 4); ptr += 4;
6014 memcpy(ptr, &count, 4); ptr += 4;
6015 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6016 memcpy(ptr, value, __size_value);ptr += __size_value;
6017
6018 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6019 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6020
6021}
6022
6023void glUniform2uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6024{
6025
6026 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6027 IOStream *stream = ctx->m_stream;
6028 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6029 bool useChecksum = checksumCalculator->getVersion() > 0;
6030
6031 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
6032 unsigned char *ptr;
6033 unsigned char *buf;
6034 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6035 const size_t checksumSize = checksumCalculator->checksumByteSize();
6036 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6037 buf = stream->alloc(totalSize);
6038 ptr = buf;
6039 int tmp = OP_glUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6040 memcpy(ptr, &totalSize, 4); ptr += 4;
6041
6042 memcpy(ptr, &location, 4); ptr += 4;
6043 memcpy(ptr, &count, 4); ptr += 4;
6044 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6045 memcpy(ptr, value, __size_value);ptr += __size_value;
6046
6047 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6048 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6049
6050}
6051
6052void glUniform3uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6053{
6054
6055 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6056 IOStream *stream = ctx->m_stream;
6057 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6058 bool useChecksum = checksumCalculator->getVersion() > 0;
6059
6060 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
6061 unsigned char *ptr;
6062 unsigned char *buf;
6063 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6064 const size_t checksumSize = checksumCalculator->checksumByteSize();
6065 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6066 buf = stream->alloc(totalSize);
6067 ptr = buf;
6068 int tmp = OP_glUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6069 memcpy(ptr, &totalSize, 4); ptr += 4;
6070
6071 memcpy(ptr, &location, 4); ptr += 4;
6072 memcpy(ptr, &count, 4); ptr += 4;
6073 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6074 memcpy(ptr, value, __size_value);ptr += __size_value;
6075
6076 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6077 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6078
6079}
6080
6081void glUniform4uiv_enc(void *self , GLint location, GLsizei count, const GLuint* value)
6082{
6083
6084 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6085 IOStream *stream = ctx->m_stream;
6086 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6087 bool useChecksum = checksumCalculator->getVersion() > 0;
6088
6089 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
6090 unsigned char *ptr;
6091 unsigned char *buf;
6092 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_value + 1*4;
6093 const size_t checksumSize = checksumCalculator->checksumByteSize();
6094 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6095 buf = stream->alloc(totalSize);
6096 ptr = buf;
6097 int tmp = OP_glUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6098 memcpy(ptr, &totalSize, 4); ptr += 4;
6099
6100 memcpy(ptr, &location, 4); ptr += 4;
6101 memcpy(ptr, &count, 4); ptr += 4;
6102 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6103 memcpy(ptr, value, __size_value);ptr += __size_value;
6104
6105 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6106 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6107
6108}
6109
6110void glUniformMatrix2x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6111{
6112
6113 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6114 IOStream *stream = ctx->m_stream;
6115 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6116 bool useChecksum = checksumCalculator->getVersion() > 0;
6117
6118 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6119 unsigned char *ptr;
6120 unsigned char *buf;
6121 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6122 const size_t checksumSize = checksumCalculator->checksumByteSize();
6123 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6124 buf = stream->alloc(totalSize);
6125 ptr = buf;
6126 int tmp = OP_glUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6127 memcpy(ptr, &totalSize, 4); ptr += 4;
6128
6129 memcpy(ptr, &location, 4); ptr += 4;
6130 memcpy(ptr, &count, 4); ptr += 4;
6131 memcpy(ptr, &transpose, 1); ptr += 1;
6132 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6133 memcpy(ptr, value, __size_value);ptr += __size_value;
6134
6135 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6136 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6137
6138}
6139
6140void glUniformMatrix3x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6141{
6142
6143 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6144 IOStream *stream = ctx->m_stream;
6145 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6146 bool useChecksum = checksumCalculator->getVersion() > 0;
6147
6148 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
6149 unsigned char *ptr;
6150 unsigned char *buf;
6151 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6152 const size_t checksumSize = checksumCalculator->checksumByteSize();
6153 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6154 buf = stream->alloc(totalSize);
6155 ptr = buf;
6156 int tmp = OP_glUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6157 memcpy(ptr, &totalSize, 4); ptr += 4;
6158
6159 memcpy(ptr, &location, 4); ptr += 4;
6160 memcpy(ptr, &count, 4); ptr += 4;
6161 memcpy(ptr, &transpose, 1); ptr += 1;
6162 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6163 memcpy(ptr, value, __size_value);ptr += __size_value;
6164
6165 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6166 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6167
6168}
6169
6170void glUniformMatrix2x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6171{
6172
6173 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6174 IOStream *stream = ctx->m_stream;
6175 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6176 bool useChecksum = checksumCalculator->getVersion() > 0;
6177
6178 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6179 unsigned char *ptr;
6180 unsigned char *buf;
6181 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6182 const size_t checksumSize = checksumCalculator->checksumByteSize();
6183 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6184 buf = stream->alloc(totalSize);
6185 ptr = buf;
6186 int tmp = OP_glUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6187 memcpy(ptr, &totalSize, 4); ptr += 4;
6188
6189 memcpy(ptr, &location, 4); ptr += 4;
6190 memcpy(ptr, &count, 4); ptr += 4;
6191 memcpy(ptr, &transpose, 1); ptr += 1;
6192 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6193 memcpy(ptr, value, __size_value);ptr += __size_value;
6194
6195 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6196 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6197
6198}
6199
6200void glUniformMatrix4x2fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6201{
6202
6203 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6204 IOStream *stream = ctx->m_stream;
6205 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6206 bool useChecksum = checksumCalculator->getVersion() > 0;
6207
6208 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
6209 unsigned char *ptr;
6210 unsigned char *buf;
6211 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6212 const size_t checksumSize = checksumCalculator->checksumByteSize();
6213 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6214 buf = stream->alloc(totalSize);
6215 ptr = buf;
6216 int tmp = OP_glUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
6217 memcpy(ptr, &totalSize, 4); ptr += 4;
6218
6219 memcpy(ptr, &location, 4); ptr += 4;
6220 memcpy(ptr, &count, 4); ptr += 4;
6221 memcpy(ptr, &transpose, 1); ptr += 1;
6222 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6223 memcpy(ptr, value, __size_value);ptr += __size_value;
6224
6225 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6226 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6227
6228}
6229
6230void glUniformMatrix3x4fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6231{
6232
6233 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6234 IOStream *stream = ctx->m_stream;
6235 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6236 bool useChecksum = checksumCalculator->getVersion() > 0;
6237
6238 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6239 unsigned char *ptr;
6240 unsigned char *buf;
6241 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6242 const size_t checksumSize = checksumCalculator->checksumByteSize();
6243 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6244 buf = stream->alloc(totalSize);
6245 ptr = buf;
6246 int tmp = OP_glUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
6247 memcpy(ptr, &totalSize, 4); ptr += 4;
6248
6249 memcpy(ptr, &location, 4); ptr += 4;
6250 memcpy(ptr, &count, 4); ptr += 4;
6251 memcpy(ptr, &transpose, 1); ptr += 1;
6252 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6253 memcpy(ptr, value, __size_value);ptr += __size_value;
6254
6255 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6256 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6257
6258}
6259
6260void glUniformMatrix4x3fv_enc(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
6261{
6262
6263 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6264 IOStream *stream = ctx->m_stream;
6265 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6266 bool useChecksum = checksumCalculator->getVersion() > 0;
6267
6268 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
6269 unsigned char *ptr;
6270 unsigned char *buf;
6271 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 1 + __size_value + 1*4;
6272 const size_t checksumSize = checksumCalculator->checksumByteSize();
6273 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6274 buf = stream->alloc(totalSize);
6275 ptr = buf;
6276 int tmp = OP_glUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
6277 memcpy(ptr, &totalSize, 4); ptr += 4;
6278
6279 memcpy(ptr, &location, 4); ptr += 4;
6280 memcpy(ptr, &count, 4); ptr += 4;
6281 memcpy(ptr, &transpose, 1); ptr += 1;
6282 *(unsigned int *)(ptr) = __size_value; ptr += 4;
6283 memcpy(ptr, value, __size_value);ptr += __size_value;
6284
6285 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6286 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6287
6288}
6289
6290void glGetUniformuiv_enc(void *self , GLuint program, GLint location, GLuint* params)
6291{
6292
6293 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6294 IOStream *stream = ctx->m_stream;
6295 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6296 bool useChecksum = checksumCalculator->getVersion() > 0;
6297
6298 const unsigned int __size_params = glSizeof(glesv2_enc::uniformType(self, program, location));
6299 unsigned char *ptr;
6300 unsigned char *buf;
6301 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6302 const size_t checksumSize = checksumCalculator->checksumByteSize();
6303 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6304 buf = stream->alloc(totalSize);
6305 ptr = buf;
6306 int tmp = OP_glGetUniformuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6307 memcpy(ptr, &totalSize, 4); ptr += 4;
6308
6309 memcpy(ptr, &program, 4); ptr += 4;
6310 memcpy(ptr, &location, 4); ptr += 4;
6311 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6312
6313 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6314 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6315
6316 stream->readback(params, __size_params);
6317 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6318 if (useChecksum) {
6319 unsigned char *checksumBufPtr = NULL;
6320 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6321 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6322 stream->readback(checksumBufPtr, checksumSize);
6323 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6324 ALOGE("glGetUniformuiv: GL communication error, please report this issue to b.android.com.\n");
6325 abort();
6326 }
6327 }
6328}
6329
6330void glGetActiveUniformsiv_enc(void *self , GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
6331{
6332
6333 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6334 IOStream *stream = ctx->m_stream;
6335 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6336 bool useChecksum = checksumCalculator->getVersion() > 0;
6337
6338 const unsigned int __size_uniformIndices = (uniformCount * sizeof(GLuint));
6339 const unsigned int __size_params = (uniformCount * sizeof(GLint));
6340 unsigned char *ptr;
6341 unsigned char *buf;
6342 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_uniformIndices + 4 + 0 + 2*4;
6343 const size_t checksumSize = checksumCalculator->checksumByteSize();
6344 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6345 buf = stream->alloc(totalSize);
6346 ptr = buf;
6347 int tmp = OP_glGetActiveUniformsiv;memcpy(ptr, &tmp, 4); ptr += 4;
6348 memcpy(ptr, &totalSize, 4); ptr += 4;
6349
6350 memcpy(ptr, &program, 4); ptr += 4;
6351 memcpy(ptr, &uniformCount, 4); ptr += 4;
6352 *(unsigned int *)(ptr) = __size_uniformIndices; ptr += 4;
6353 memcpy(ptr, uniformIndices, __size_uniformIndices);ptr += __size_uniformIndices;
6354 memcpy(ptr, &pname, 4); ptr += 4;
6355 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6356
6357 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6358 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6359
6360 stream->readback(params, __size_params);
6361 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6362 if (useChecksum) {
6363 unsigned char *checksumBufPtr = NULL;
6364 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6365 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6366 stream->readback(checksumBufPtr, checksumSize);
6367 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6368 ALOGE("glGetActiveUniformsiv: GL communication error, please report this issue to b.android.com.\n");
6369 abort();
6370 }
6371 }
6372}
6373
6374void glVertexAttribI4i_enc(void *self , GLuint index, GLint v0, GLint v1, GLint v2, GLint v3)
6375{
6376
6377 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6378 IOStream *stream = ctx->m_stream;
6379 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6380 bool useChecksum = checksumCalculator->getVersion() > 0;
6381
6382 unsigned char *ptr;
6383 unsigned char *buf;
6384 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6385 const size_t checksumSize = checksumCalculator->checksumByteSize();
6386 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6387 buf = stream->alloc(totalSize);
6388 ptr = buf;
6389 int tmp = OP_glVertexAttribI4i;memcpy(ptr, &tmp, 4); ptr += 4;
6390 memcpy(ptr, &totalSize, 4); ptr += 4;
6391
6392 memcpy(ptr, &index, 4); ptr += 4;
6393 memcpy(ptr, &v0, 4); ptr += 4;
6394 memcpy(ptr, &v1, 4); ptr += 4;
6395 memcpy(ptr, &v2, 4); ptr += 4;
6396 memcpy(ptr, &v3, 4); ptr += 4;
6397
6398 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6399 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6400
6401}
6402
6403void glVertexAttribI4ui_enc(void *self , GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
6404{
6405
6406 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6407 IOStream *stream = ctx->m_stream;
6408 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6409 bool useChecksum = checksumCalculator->getVersion() > 0;
6410
6411 unsigned char *ptr;
6412 unsigned char *buf;
6413 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6414 const size_t checksumSize = checksumCalculator->checksumByteSize();
6415 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6416 buf = stream->alloc(totalSize);
6417 ptr = buf;
6418 int tmp = OP_glVertexAttribI4ui;memcpy(ptr, &tmp, 4); ptr += 4;
6419 memcpy(ptr, &totalSize, 4); ptr += 4;
6420
6421 memcpy(ptr, &index, 4); ptr += 4;
6422 memcpy(ptr, &v0, 4); ptr += 4;
6423 memcpy(ptr, &v1, 4); ptr += 4;
6424 memcpy(ptr, &v2, 4); ptr += 4;
6425 memcpy(ptr, &v3, 4); ptr += 4;
6426
6427 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6428 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6429
6430}
6431
6432void glVertexAttribI4iv_enc(void *self , GLuint index, const GLint* v)
6433{
6434
6435 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6436 IOStream *stream = ctx->m_stream;
6437 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6438 bool useChecksum = checksumCalculator->getVersion() > 0;
6439
6440 const unsigned int __size_v = (4 * sizeof(GLint));
6441 unsigned char *ptr;
6442 unsigned char *buf;
6443 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6444 const size_t checksumSize = checksumCalculator->checksumByteSize();
6445 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6446 buf = stream->alloc(totalSize);
6447 ptr = buf;
6448 int tmp = OP_glVertexAttribI4iv;memcpy(ptr, &tmp, 4); ptr += 4;
6449 memcpy(ptr, &totalSize, 4); ptr += 4;
6450
6451 memcpy(ptr, &index, 4); ptr += 4;
6452 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6453 memcpy(ptr, v, __size_v);ptr += __size_v;
6454
6455 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6456 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6457
6458}
6459
6460void glVertexAttribI4uiv_enc(void *self , GLuint index, const GLuint* v)
6461{
6462
6463 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6464 IOStream *stream = ctx->m_stream;
6465 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6466 bool useChecksum = checksumCalculator->getVersion() > 0;
6467
6468 const unsigned int __size_v = (4 * sizeof(GLuint));
6469 unsigned char *ptr;
6470 unsigned char *buf;
6471 const size_t sizeWithoutChecksum = 8 + 4 + __size_v + 1*4;
6472 const size_t checksumSize = checksumCalculator->checksumByteSize();
6473 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6474 buf = stream->alloc(totalSize);
6475 ptr = buf;
6476 int tmp = OP_glVertexAttribI4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
6477 memcpy(ptr, &totalSize, 4); ptr += 4;
6478
6479 memcpy(ptr, &index, 4); ptr += 4;
6480 *(unsigned int *)(ptr) = __size_v; ptr += 4;
6481 memcpy(ptr, v, __size_v);ptr += __size_v;
6482
6483 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6484 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6485
6486}
6487
6488void glVertexAttribIPointerOffsetAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset)
6489{
6490
6491 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6492 IOStream *stream = ctx->m_stream;
6493 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6494 bool useChecksum = checksumCalculator->getVersion() > 0;
6495
6496 unsigned char *ptr;
6497 unsigned char *buf;
6498 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6499 const size_t checksumSize = checksumCalculator->checksumByteSize();
6500 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6501 buf = stream->alloc(totalSize);
6502 ptr = buf;
6503 int tmp = OP_glVertexAttribIPointerOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6504 memcpy(ptr, &totalSize, 4); ptr += 4;
6505
6506 memcpy(ptr, &index, 4); ptr += 4;
6507 memcpy(ptr, &size, 4); ptr += 4;
6508 memcpy(ptr, &type, 4); ptr += 4;
6509 memcpy(ptr, &stride, 4); ptr += 4;
6510 memcpy(ptr, &offset, 4); ptr += 4;
6511
6512 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6513 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6514
6515}
6516
6517void glVertexAttribIPointerDataAEMU_enc(void *self , GLuint index, GLint size, GLenum type, GLsizei stride, void* data, GLuint datalen)
6518{
6519
6520 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6521 IOStream *stream = ctx->m_stream;
6522 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6523 bool useChecksum = checksumCalculator->getVersion() > 0;
6524
6525 const unsigned int __size_data = datalen;
6526 unsigned char *ptr;
6527 unsigned char *buf;
6528 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_data + 4 + 1*4;
6529 const size_t checksumSize = checksumCalculator->checksumByteSize();
6530 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6531 buf = stream->alloc(totalSize);
6532 ptr = buf;
6533 int tmp = OP_glVertexAttribIPointerDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6534 memcpy(ptr, &totalSize, 4); ptr += 4;
6535
6536 memcpy(ptr, &index, 4); ptr += 4;
6537 memcpy(ptr, &size, 4); ptr += 4;
6538 memcpy(ptr, &type, 4); ptr += 4;
6539 memcpy(ptr, &stride, 4); ptr += 4;
6540 *(unsigned int *)(ptr) = __size_data; ptr += 4;
6541 glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen);ptr += __size_data;
6542 memcpy(ptr, &datalen, 4); ptr += 4;
6543
6544 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6545 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6546
6547}
6548
6549void glGetVertexAttribIiv_enc(void *self , GLuint index, GLenum pname, GLint* params)
6550{
6551
6552 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6553 IOStream *stream = ctx->m_stream;
6554 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6555 bool useChecksum = checksumCalculator->getVersion() > 0;
6556
6557 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
6558 unsigned char *ptr;
6559 unsigned char *buf;
6560 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6561 const size_t checksumSize = checksumCalculator->checksumByteSize();
6562 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6563 buf = stream->alloc(totalSize);
6564 ptr = buf;
6565 int tmp = OP_glGetVertexAttribIiv;memcpy(ptr, &tmp, 4); ptr += 4;
6566 memcpy(ptr, &totalSize, 4); ptr += 4;
6567
6568 memcpy(ptr, &index, 4); ptr += 4;
6569 memcpy(ptr, &pname, 4); ptr += 4;
6570 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6571
6572 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6573 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6574
6575 stream->readback(params, __size_params);
6576 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6577 if (useChecksum) {
6578 unsigned char *checksumBufPtr = NULL;
6579 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6580 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6581 stream->readback(checksumBufPtr, checksumSize);
6582 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6583 ALOGE("glGetVertexAttribIiv: GL communication error, please report this issue to b.android.com.\n");
6584 abort();
6585 }
6586 }
6587}
6588
6589void glGetVertexAttribIuiv_enc(void *self , GLuint index, GLenum pname, GLuint* params)
6590{
6591
6592 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6593 IOStream *stream = ctx->m_stream;
6594 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6595 bool useChecksum = checksumCalculator->getVersion() > 0;
6596
6597 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
6598 unsigned char *ptr;
6599 unsigned char *buf;
6600 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
6601 const size_t checksumSize = checksumCalculator->checksumByteSize();
6602 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6603 buf = stream->alloc(totalSize);
6604 ptr = buf;
6605 int tmp = OP_glGetVertexAttribIuiv;memcpy(ptr, &tmp, 4); ptr += 4;
6606 memcpy(ptr, &totalSize, 4); ptr += 4;
6607
6608 memcpy(ptr, &index, 4); ptr += 4;
6609 memcpy(ptr, &pname, 4); ptr += 4;
6610 *(unsigned int *)(ptr) = __size_params; ptr += 4;
6611
6612 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6613 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6614
6615 stream->readback(params, __size_params);
6616 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
6617 if (useChecksum) {
6618 unsigned char *checksumBufPtr = NULL;
6619 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6620 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6621 stream->readback(checksumBufPtr, checksumSize);
6622 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
6623 ALOGE("glGetVertexAttribIuiv: GL communication error, please report this issue to b.android.com.\n");
6624 abort();
6625 }
6626 }
6627}
6628
6629void glVertexAttribDivisor_enc(void *self , GLuint index, GLuint divisor)
6630{
6631
6632 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6633 IOStream *stream = ctx->m_stream;
6634 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6635 bool useChecksum = checksumCalculator->getVersion() > 0;
6636
6637 unsigned char *ptr;
6638 unsigned char *buf;
6639 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6640 const size_t checksumSize = checksumCalculator->checksumByteSize();
6641 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6642 buf = stream->alloc(totalSize);
6643 ptr = buf;
6644 int tmp = OP_glVertexAttribDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
6645 memcpy(ptr, &totalSize, 4); ptr += 4;
6646
6647 memcpy(ptr, &index, 4); ptr += 4;
6648 memcpy(ptr, &divisor, 4); ptr += 4;
6649
6650 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6651 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6652
6653}
6654
6655void glDrawArraysInstanced_enc(void *self , GLenum mode, GLint first, GLsizei count, GLsizei primcount)
6656{
6657
6658 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6659 IOStream *stream = ctx->m_stream;
6660 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6661 bool useChecksum = checksumCalculator->getVersion() > 0;
6662
6663 unsigned char *ptr;
6664 unsigned char *buf;
6665 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
6666 const size_t checksumSize = checksumCalculator->checksumByteSize();
6667 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6668 buf = stream->alloc(totalSize);
6669 ptr = buf;
6670 int tmp = OP_glDrawArraysInstanced;memcpy(ptr, &tmp, 4); ptr += 4;
6671 memcpy(ptr, &totalSize, 4); ptr += 4;
6672
6673 memcpy(ptr, &mode, 4); ptr += 4;
6674 memcpy(ptr, &first, 4); ptr += 4;
6675 memcpy(ptr, &count, 4); ptr += 4;
6676 memcpy(ptr, &primcount, 4); ptr += 4;
6677
6678 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6679 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6680
6681}
6682
6683void glDrawElementsInstancedDataAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount, GLsizei datalen)
6684{
6685
6686 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6687 IOStream *stream = ctx->m_stream;
6688 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6689 bool useChecksum = checksumCalculator->getVersion() > 0;
6690
6691 const unsigned int __size_indices = datalen;
6692 unsigned char *ptr;
6693 unsigned char *buf;
6694 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_indices + 4 + 4 + 1*4;
6695 const size_t checksumSize = checksumCalculator->checksumByteSize();
6696 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6697 buf = stream->alloc(totalSize);
6698 ptr = buf;
6699 int tmp = OP_glDrawElementsInstancedDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6700 memcpy(ptr, &totalSize, 4); ptr += 4;
6701
6702 memcpy(ptr, &mode, 4); ptr += 4;
6703 memcpy(ptr, &count, 4); ptr += 4;
6704 memcpy(ptr, &type, 4); ptr += 4;
6705 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6706 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6707 memcpy(ptr, &primcount, 4); ptr += 4;
6708 memcpy(ptr, &datalen, 4); ptr += 4;
6709
6710 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6711 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6712
6713}
6714
6715void glDrawElementsInstancedOffsetAEMU_enc(void *self , GLenum mode, GLsizei count, GLenum type, GLuint offset, GLsizei primcount)
6716{
6717
6718 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6719 IOStream *stream = ctx->m_stream;
6720 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6721 bool useChecksum = checksumCalculator->getVersion() > 0;
6722
6723 unsigned char *ptr;
6724 unsigned char *buf;
6725 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
6726 const size_t checksumSize = checksumCalculator->checksumByteSize();
6727 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6728 buf = stream->alloc(totalSize);
6729 ptr = buf;
6730 int tmp = OP_glDrawElementsInstancedOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6731 memcpy(ptr, &totalSize, 4); ptr += 4;
6732
6733 memcpy(ptr, &mode, 4); ptr += 4;
6734 memcpy(ptr, &count, 4); ptr += 4;
6735 memcpy(ptr, &type, 4); ptr += 4;
6736 memcpy(ptr, &offset, 4); ptr += 4;
6737 memcpy(ptr, &primcount, 4); ptr += 4;
6738
6739 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6740 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6741
6742}
6743
6744void glDrawRangeElementsDataAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices, GLsizei datalen)
6745{
6746
6747 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6748 IOStream *stream = ctx->m_stream;
6749 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6750 bool useChecksum = checksumCalculator->getVersion() > 0;
6751
6752 const unsigned int __size_indices = datalen;
6753 unsigned char *ptr;
6754 unsigned char *buf;
6755 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + __size_indices + 4 + 1*4;
6756 const size_t checksumSize = checksumCalculator->checksumByteSize();
6757 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6758 buf = stream->alloc(totalSize);
6759 ptr = buf;
6760 int tmp = OP_glDrawRangeElementsDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6761 memcpy(ptr, &totalSize, 4); ptr += 4;
6762
6763 memcpy(ptr, &mode, 4); ptr += 4;
6764 memcpy(ptr, &start, 4); ptr += 4;
6765 memcpy(ptr, &end, 4); ptr += 4;
6766 memcpy(ptr, &count, 4); ptr += 4;
6767 memcpy(ptr, &type, 4); ptr += 4;
6768 *(unsigned int *)(ptr) = __size_indices; ptr += 4;
6769 memcpy(ptr, indices, __size_indices);ptr += __size_indices;
6770 memcpy(ptr, &datalen, 4); ptr += 4;
6771
6772 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6773 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6774
6775}
6776
6777void glDrawRangeElementsOffsetAEMU_enc(void *self , GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLuint offset)
6778{
6779
6780 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6781 IOStream *stream = ctx->m_stream;
6782 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6783 bool useChecksum = checksumCalculator->getVersion() > 0;
6784
6785 unsigned char *ptr;
6786 unsigned char *buf;
6787 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
6788 const size_t checksumSize = checksumCalculator->checksumByteSize();
6789 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6790 buf = stream->alloc(totalSize);
6791 ptr = buf;
6792 int tmp = OP_glDrawRangeElementsOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
6793 memcpy(ptr, &totalSize, 4); ptr += 4;
6794
6795 memcpy(ptr, &mode, 4); ptr += 4;
6796 memcpy(ptr, &start, 4); ptr += 4;
6797 memcpy(ptr, &end, 4); ptr += 4;
6798 memcpy(ptr, &count, 4); ptr += 4;
6799 memcpy(ptr, &type, 4); ptr += 4;
6800 memcpy(ptr, &offset, 4); ptr += 4;
6801
6802 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6803 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6804
6805}
6806
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006807uint64_t glFenceSyncAEMU_enc(void *self , GLenum condition, GLbitfield flags)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006808{
6809
6810 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6811 IOStream *stream = ctx->m_stream;
6812 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6813 bool useChecksum = checksumCalculator->getVersion() > 0;
6814
6815 unsigned char *ptr;
6816 unsigned char *buf;
6817 const size_t sizeWithoutChecksum = 8 + 4 + 4;
6818 const size_t checksumSize = checksumCalculator->checksumByteSize();
6819 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6820 buf = stream->alloc(totalSize);
6821 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006822 int tmp = OP_glFenceSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006823 memcpy(ptr, &totalSize, 4); ptr += 4;
6824
6825 memcpy(ptr, &condition, 4); ptr += 4;
6826 memcpy(ptr, &flags, 4); ptr += 4;
6827
6828 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6829 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6830
6831
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006832 uint64_t retval;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006833 stream->readback(&retval, 8);
6834 if (useChecksum) checksumCalculator->addBuffer(&retval, 8);
6835 if (useChecksum) {
6836 unsigned char *checksumBufPtr = NULL;
6837 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6838 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6839 stream->readback(checksumBufPtr, checksumSize);
6840 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006841 ALOGE("glFenceSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006842 abort();
6843 }
6844 }
6845 return retval;
6846}
6847
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006848GLenum glClientWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006849{
6850
6851 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6852 IOStream *stream = ctx->m_stream;
6853 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6854 bool useChecksum = checksumCalculator->getVersion() > 0;
6855
6856 unsigned char *ptr;
6857 unsigned char *buf;
6858 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6859 const size_t checksumSize = checksumCalculator->checksumByteSize();
6860 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6861 buf = stream->alloc(totalSize);
6862 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006863 int tmp = OP_glClientWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006864 memcpy(ptr, &totalSize, 4); ptr += 4;
6865
6866 memcpy(ptr, &wait_on, 8); ptr += 8;
6867 memcpy(ptr, &flags, 4); ptr += 4;
6868 memcpy(ptr, &timeout, 8); ptr += 8;
6869
6870 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6871 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6872
6873
6874 GLenum retval;
6875 stream->readback(&retval, 4);
6876 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
6877 if (useChecksum) {
6878 unsigned char *checksumBufPtr = NULL;
6879 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6880 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6881 stream->readback(checksumBufPtr, checksumSize);
6882 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006883 ALOGE("glClientWaitSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006884 abort();
6885 }
6886 }
6887 return retval;
6888}
6889
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006890void glWaitSyncAEMU_enc(void *self , uint64_t wait_on, GLbitfield flags, GLuint64 timeout)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006891{
6892
6893 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6894 IOStream *stream = ctx->m_stream;
6895 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6896 bool useChecksum = checksumCalculator->getVersion() > 0;
6897
6898 unsigned char *ptr;
6899 unsigned char *buf;
6900 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8;
6901 const size_t checksumSize = checksumCalculator->checksumByteSize();
6902 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6903 buf = stream->alloc(totalSize);
6904 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006905 int tmp = OP_glWaitSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006906 memcpy(ptr, &totalSize, 4); ptr += 4;
6907
6908 memcpy(ptr, &wait_on, 8); ptr += 8;
6909 memcpy(ptr, &flags, 4); ptr += 4;
6910 memcpy(ptr, &timeout, 8); ptr += 8;
6911
6912 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6913 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6914
6915}
6916
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006917void glDeleteSyncAEMU_enc(void *self , uint64_t to_delete)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006918{
6919
6920 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6921 IOStream *stream = ctx->m_stream;
6922 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6923 bool useChecksum = checksumCalculator->getVersion() > 0;
6924
6925 unsigned char *ptr;
6926 unsigned char *buf;
6927 const size_t sizeWithoutChecksum = 8 + 8;
6928 const size_t checksumSize = checksumCalculator->checksumByteSize();
6929 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6930 buf = stream->alloc(totalSize);
6931 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006932 int tmp = OP_glDeleteSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006933 memcpy(ptr, &totalSize, 4); ptr += 4;
6934
6935 memcpy(ptr, &to_delete, 8); ptr += 8;
6936
6937 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6938 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6939
6940}
6941
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006942GLboolean glIsSyncAEMU_enc(void *self , uint64_t sync)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006943{
6944
6945 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6946 IOStream *stream = ctx->m_stream;
6947 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6948 bool useChecksum = checksumCalculator->getVersion() > 0;
6949
6950 unsigned char *ptr;
6951 unsigned char *buf;
6952 const size_t sizeWithoutChecksum = 8 + 8;
6953 const size_t checksumSize = checksumCalculator->checksumByteSize();
6954 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6955 buf = stream->alloc(totalSize);
6956 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006957 int tmp = OP_glIsSyncAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006958 memcpy(ptr, &totalSize, 4); ptr += 4;
6959
6960 memcpy(ptr, &sync, 8); ptr += 8;
6961
6962 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
6963 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
6964
6965
6966 GLboolean retval;
6967 stream->readback(&retval, 1);
6968 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
6969 if (useChecksum) {
6970 unsigned char *checksumBufPtr = NULL;
6971 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
6972 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
6973 stream->readback(checksumBufPtr, checksumSize);
6974 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006975 ALOGE("glIsSyncAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006976 abort();
6977 }
6978 }
6979 return retval;
6980}
6981
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006982void glGetSyncivAEMU_enc(void *self , uint64_t sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006983{
6984
6985 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
6986 IOStream *stream = ctx->m_stream;
6987 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
6988 bool useChecksum = checksumCalculator->getVersion() > 0;
6989
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08006990 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
6991 const unsigned int __size_values = (bufSize * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08006992 unsigned char *ptr;
6993 unsigned char *buf;
6994 const size_t sizeWithoutChecksum = 8 + 8 + 4 + 4 + 0 + 0 + 2*4;
6995 const size_t checksumSize = checksumCalculator->checksumByteSize();
6996 const size_t totalSize = sizeWithoutChecksum + checksumSize;
6997 buf = stream->alloc(totalSize);
6998 ptr = buf;
Lingfeng Yangf000ab42017-01-11 18:31:38 -08006999 int tmp = OP_glGetSyncivAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007000 memcpy(ptr, &totalSize, 4); ptr += 4;
7001
7002 memcpy(ptr, &sync, 8); ptr += 8;
7003 memcpy(ptr, &pname, 4); ptr += 4;
7004 memcpy(ptr, &bufSize, 4); ptr += 4;
7005 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7006 *(unsigned int *)(ptr) = __size_values; ptr += 4;
7007
7008 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7009 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7010
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08007011 if (length != NULL) {
7012 stream->readback(length, __size_length);
7013 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7014 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007015 stream->readback(values, __size_values);
7016 if (useChecksum) checksumCalculator->addBuffer(values, __size_values);
7017 if (useChecksum) {
7018 unsigned char *checksumBufPtr = NULL;
7019 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7020 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7021 stream->readback(checksumBufPtr, checksumSize);
7022 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
Lingfeng Yangf000ab42017-01-11 18:31:38 -08007023 ALOGE("glGetSyncivAEMU: GL communication error, please report this issue to b.android.com.\n");
Lingfeng Yange6556dc2017-01-09 12:04:12 -08007024 abort();
7025 }
7026 }
7027}
7028
7029void glDrawBuffers_enc(void *self , GLsizei n, const GLenum* bufs)
7030{
7031
7032 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7033 IOStream *stream = ctx->m_stream;
7034 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7035 bool useChecksum = checksumCalculator->getVersion() > 0;
7036
7037 const unsigned int __size_bufs = (n * sizeof(GLenum));
7038 unsigned char *ptr;
7039 unsigned char *buf;
7040 const size_t sizeWithoutChecksum = 8 + 4 + __size_bufs + 1*4;
7041 const size_t checksumSize = checksumCalculator->checksumByteSize();
7042 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7043 buf = stream->alloc(totalSize);
7044 ptr = buf;
7045 int tmp = OP_glDrawBuffers;memcpy(ptr, &tmp, 4); ptr += 4;
7046 memcpy(ptr, &totalSize, 4); ptr += 4;
7047
7048 memcpy(ptr, &n, 4); ptr += 4;
7049 *(unsigned int *)(ptr) = __size_bufs; ptr += 4;
7050 memcpy(ptr, bufs, __size_bufs);ptr += __size_bufs;
7051
7052 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7053 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7054
7055}
7056
7057void glReadBuffer_enc(void *self , GLenum src)
7058{
7059
7060 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7061 IOStream *stream = ctx->m_stream;
7062 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7063 bool useChecksum = checksumCalculator->getVersion() > 0;
7064
7065 unsigned char *ptr;
7066 unsigned char *buf;
7067 const size_t sizeWithoutChecksum = 8 + 4;
7068 const size_t checksumSize = checksumCalculator->checksumByteSize();
7069 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7070 buf = stream->alloc(totalSize);
7071 ptr = buf;
7072 int tmp = OP_glReadBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7073 memcpy(ptr, &totalSize, 4); ptr += 4;
7074
7075 memcpy(ptr, &src, 4); ptr += 4;
7076
7077 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7078 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7079
7080}
7081
7082void glBlitFramebuffer_enc(void *self , GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
7083{
7084
7085 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7086 IOStream *stream = ctx->m_stream;
7087 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7088 bool useChecksum = checksumCalculator->getVersion() > 0;
7089
7090 unsigned char *ptr;
7091 unsigned char *buf;
7092 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
7093 const size_t checksumSize = checksumCalculator->checksumByteSize();
7094 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7095 buf = stream->alloc(totalSize);
7096 ptr = buf;
7097 int tmp = OP_glBlitFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7098 memcpy(ptr, &totalSize, 4); ptr += 4;
7099
7100 memcpy(ptr, &srcX0, 4); ptr += 4;
7101 memcpy(ptr, &srcY0, 4); ptr += 4;
7102 memcpy(ptr, &srcX1, 4); ptr += 4;
7103 memcpy(ptr, &srcY1, 4); ptr += 4;
7104 memcpy(ptr, &dstX0, 4); ptr += 4;
7105 memcpy(ptr, &dstY0, 4); ptr += 4;
7106 memcpy(ptr, &dstX1, 4); ptr += 4;
7107 memcpy(ptr, &dstY1, 4); ptr += 4;
7108 memcpy(ptr, &mask, 4); ptr += 4;
7109 memcpy(ptr, &filter, 4); ptr += 4;
7110
7111 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7112 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7113
7114}
7115
7116void glInvalidateFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments)
7117{
7118
7119 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7120 IOStream *stream = ctx->m_stream;
7121 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7122 bool useChecksum = checksumCalculator->getVersion() > 0;
7123
7124 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7125 unsigned char *ptr;
7126 unsigned char *buf;
7127 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 1*4;
7128 const size_t checksumSize = checksumCalculator->checksumByteSize();
7129 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7130 buf = stream->alloc(totalSize);
7131 ptr = buf;
7132 int tmp = OP_glInvalidateFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7133 memcpy(ptr, &totalSize, 4); ptr += 4;
7134
7135 memcpy(ptr, &target, 4); ptr += 4;
7136 memcpy(ptr, &numAttachments, 4); ptr += 4;
7137 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7138 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7139
7140 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7141 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7142
7143}
7144
7145void glInvalidateSubFramebuffer_enc(void *self , GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
7146{
7147
7148 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7149 IOStream *stream = ctx->m_stream;
7150 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7151 bool useChecksum = checksumCalculator->getVersion() > 0;
7152
7153 const unsigned int __size_attachments = (numAttachments * sizeof(GLenum));
7154 unsigned char *ptr;
7155 unsigned char *buf;
7156 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_attachments + 4 + 4 + 4 + 4 + 1*4;
7157 const size_t checksumSize = checksumCalculator->checksumByteSize();
7158 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7159 buf = stream->alloc(totalSize);
7160 ptr = buf;
7161 int tmp = OP_glInvalidateSubFramebuffer;memcpy(ptr, &tmp, 4); ptr += 4;
7162 memcpy(ptr, &totalSize, 4); ptr += 4;
7163
7164 memcpy(ptr, &target, 4); ptr += 4;
7165 memcpy(ptr, &numAttachments, 4); ptr += 4;
7166 *(unsigned int *)(ptr) = __size_attachments; ptr += 4;
7167 memcpy(ptr, attachments, __size_attachments);ptr += __size_attachments;
7168 memcpy(ptr, &x, 4); ptr += 4;
7169 memcpy(ptr, &y, 4); ptr += 4;
7170 memcpy(ptr, &width, 4); ptr += 4;
7171 memcpy(ptr, &height, 4); ptr += 4;
7172
7173 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7174 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7175
7176}
7177
7178void glFramebufferTextureLayer_enc(void *self , GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
7179{
7180
7181 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7182 IOStream *stream = ctx->m_stream;
7183 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7184 bool useChecksum = checksumCalculator->getVersion() > 0;
7185
7186 unsigned char *ptr;
7187 unsigned char *buf;
7188 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7189 const size_t checksumSize = checksumCalculator->checksumByteSize();
7190 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7191 buf = stream->alloc(totalSize);
7192 ptr = buf;
7193 int tmp = OP_glFramebufferTextureLayer;memcpy(ptr, &tmp, 4); ptr += 4;
7194 memcpy(ptr, &totalSize, 4); ptr += 4;
7195
7196 memcpy(ptr, &target, 4); ptr += 4;
7197 memcpy(ptr, &attachment, 4); ptr += 4;
7198 memcpy(ptr, &texture, 4); ptr += 4;
7199 memcpy(ptr, &level, 4); ptr += 4;
7200 memcpy(ptr, &layer, 4); ptr += 4;
7201
7202 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7203 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7204
7205}
7206
7207void glRenderbufferStorageMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
7208{
7209
7210 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7211 IOStream *stream = ctx->m_stream;
7212 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7213 bool useChecksum = checksumCalculator->getVersion() > 0;
7214
7215 unsigned char *ptr;
7216 unsigned char *buf;
7217 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7218 const size_t checksumSize = checksumCalculator->checksumByteSize();
7219 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7220 buf = stream->alloc(totalSize);
7221 ptr = buf;
7222 int tmp = OP_glRenderbufferStorageMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
7223 memcpy(ptr, &totalSize, 4); ptr += 4;
7224
7225 memcpy(ptr, &target, 4); ptr += 4;
7226 memcpy(ptr, &samples, 4); ptr += 4;
7227 memcpy(ptr, &internalformat, 4); ptr += 4;
7228 memcpy(ptr, &width, 4); ptr += 4;
7229 memcpy(ptr, &height, 4); ptr += 4;
7230
7231 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7232 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7233
7234}
7235
7236void glTexStorage2D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
7237{
7238
7239 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7240 IOStream *stream = ctx->m_stream;
7241 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7242 bool useChecksum = checksumCalculator->getVersion() > 0;
7243
7244 unsigned char *ptr;
7245 unsigned char *buf;
7246 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
7247 const size_t checksumSize = checksumCalculator->checksumByteSize();
7248 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7249 buf = stream->alloc(totalSize);
7250 ptr = buf;
7251 int tmp = OP_glTexStorage2D;memcpy(ptr, &tmp, 4); ptr += 4;
7252 memcpy(ptr, &totalSize, 4); ptr += 4;
7253
7254 memcpy(ptr, &target, 4); ptr += 4;
7255 memcpy(ptr, &levels, 4); ptr += 4;
7256 memcpy(ptr, &internalformat, 4); ptr += 4;
7257 memcpy(ptr, &width, 4); ptr += 4;
7258 memcpy(ptr, &height, 4); ptr += 4;
7259
7260 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7261 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7262
7263}
7264
7265void glGetInternalformativ_enc(void *self , GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
7266{
7267
7268 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7269 IOStream *stream = ctx->m_stream;
7270 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7271 bool useChecksum = checksumCalculator->getVersion() > 0;
7272
7273 const unsigned int __size_params = (sizeof(GLint) * bufSize);
7274 unsigned char *ptr;
7275 unsigned char *buf;
7276 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 1*4;
7277 const size_t checksumSize = checksumCalculator->checksumByteSize();
7278 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7279 buf = stream->alloc(totalSize);
7280 ptr = buf;
7281 int tmp = OP_glGetInternalformativ;memcpy(ptr, &tmp, 4); ptr += 4;
7282 memcpy(ptr, &totalSize, 4); ptr += 4;
7283
7284 memcpy(ptr, &target, 4); ptr += 4;
7285 memcpy(ptr, &internalformat, 4); ptr += 4;
7286 memcpy(ptr, &pname, 4); ptr += 4;
7287 memcpy(ptr, &bufSize, 4); ptr += 4;
7288 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7289
7290 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7291 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7292
7293 stream->readback(params, __size_params);
7294 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7295 if (useChecksum) {
7296 unsigned char *checksumBufPtr = NULL;
7297 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7298 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7299 stream->readback(checksumBufPtr, checksumSize);
7300 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7301 ALOGE("glGetInternalformativ: GL communication error, please report this issue to b.android.com.\n");
7302 abort();
7303 }
7304 }
7305}
7306
7307void glBeginTransformFeedback_enc(void *self , GLenum primitiveMode)
7308{
7309
7310 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7311 IOStream *stream = ctx->m_stream;
7312 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7313 bool useChecksum = checksumCalculator->getVersion() > 0;
7314
7315 unsigned char *ptr;
7316 unsigned char *buf;
7317 const size_t sizeWithoutChecksum = 8 + 4;
7318 const size_t checksumSize = checksumCalculator->checksumByteSize();
7319 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7320 buf = stream->alloc(totalSize);
7321 ptr = buf;
7322 int tmp = OP_glBeginTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7323 memcpy(ptr, &totalSize, 4); ptr += 4;
7324
7325 memcpy(ptr, &primitiveMode, 4); ptr += 4;
7326
7327 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7328 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7329
7330}
7331
7332void glEndTransformFeedback_enc(void *self )
7333{
7334
7335 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7336 IOStream *stream = ctx->m_stream;
7337 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7338 bool useChecksum = checksumCalculator->getVersion() > 0;
7339
7340 unsigned char *ptr;
7341 unsigned char *buf;
7342 const size_t sizeWithoutChecksum = 8;
7343 const size_t checksumSize = checksumCalculator->checksumByteSize();
7344 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7345 buf = stream->alloc(totalSize);
7346 ptr = buf;
7347 int tmp = OP_glEndTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7348 memcpy(ptr, &totalSize, 4); ptr += 4;
7349
7350
7351 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7352 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7353
7354}
7355
7356void glGenTransformFeedbacks_enc(void *self , GLsizei n, GLuint* ids)
7357{
7358
7359 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7360 IOStream *stream = ctx->m_stream;
7361 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7362 bool useChecksum = checksumCalculator->getVersion() > 0;
7363
7364 const unsigned int __size_ids = (n * sizeof(GLuint));
7365 unsigned char *ptr;
7366 unsigned char *buf;
7367 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7368 const size_t checksumSize = checksumCalculator->checksumByteSize();
7369 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7370 buf = stream->alloc(totalSize);
7371 ptr = buf;
7372 int tmp = OP_glGenTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7373 memcpy(ptr, &totalSize, 4); ptr += 4;
7374
7375 memcpy(ptr, &n, 4); ptr += 4;
7376 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7377
7378 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7379 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7380
7381 stream->readback(ids, __size_ids);
7382 if (useChecksum) checksumCalculator->addBuffer(ids, __size_ids);
7383 if (useChecksum) {
7384 unsigned char *checksumBufPtr = NULL;
7385 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7386 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7387 stream->readback(checksumBufPtr, checksumSize);
7388 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7389 ALOGE("glGenTransformFeedbacks: GL communication error, please report this issue to b.android.com.\n");
7390 abort();
7391 }
7392 }
7393}
7394
7395void glDeleteTransformFeedbacks_enc(void *self , GLsizei n, const GLuint* ids)
7396{
7397
7398 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7399 IOStream *stream = ctx->m_stream;
7400 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7401 bool useChecksum = checksumCalculator->getVersion() > 0;
7402
7403 const unsigned int __size_ids = (n * sizeof(GLuint));
7404 unsigned char *ptr;
7405 unsigned char *buf;
7406 const size_t sizeWithoutChecksum = 8 + 4 + __size_ids + 1*4;
7407 const size_t checksumSize = checksumCalculator->checksumByteSize();
7408 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7409 buf = stream->alloc(totalSize);
7410 ptr = buf;
7411 int tmp = OP_glDeleteTransformFeedbacks;memcpy(ptr, &tmp, 4); ptr += 4;
7412 memcpy(ptr, &totalSize, 4); ptr += 4;
7413
7414 memcpy(ptr, &n, 4); ptr += 4;
7415 *(unsigned int *)(ptr) = __size_ids; ptr += 4;
7416 memcpy(ptr, ids, __size_ids);ptr += __size_ids;
7417
7418 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7419 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7420
7421}
7422
7423void glBindTransformFeedback_enc(void *self , GLenum target, GLuint id)
7424{
7425
7426 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7427 IOStream *stream = ctx->m_stream;
7428 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7429 bool useChecksum = checksumCalculator->getVersion() > 0;
7430
7431 unsigned char *ptr;
7432 unsigned char *buf;
7433 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7434 const size_t checksumSize = checksumCalculator->checksumByteSize();
7435 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7436 buf = stream->alloc(totalSize);
7437 ptr = buf;
7438 int tmp = OP_glBindTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7439 memcpy(ptr, &totalSize, 4); ptr += 4;
7440
7441 memcpy(ptr, &target, 4); ptr += 4;
7442 memcpy(ptr, &id, 4); ptr += 4;
7443
7444 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7445 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7446
7447}
7448
7449void glPauseTransformFeedback_enc(void *self )
7450{
7451
7452 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7453 IOStream *stream = ctx->m_stream;
7454 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7455 bool useChecksum = checksumCalculator->getVersion() > 0;
7456
7457 unsigned char *ptr;
7458 unsigned char *buf;
7459 const size_t sizeWithoutChecksum = 8;
7460 const size_t checksumSize = checksumCalculator->checksumByteSize();
7461 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7462 buf = stream->alloc(totalSize);
7463 ptr = buf;
7464 int tmp = OP_glPauseTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7465 memcpy(ptr, &totalSize, 4); ptr += 4;
7466
7467
7468 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7469 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7470
7471}
7472
7473void glResumeTransformFeedback_enc(void *self )
7474{
7475
7476 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7477 IOStream *stream = ctx->m_stream;
7478 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7479 bool useChecksum = checksumCalculator->getVersion() > 0;
7480
7481 unsigned char *ptr;
7482 unsigned char *buf;
7483 const size_t sizeWithoutChecksum = 8;
7484 const size_t checksumSize = checksumCalculator->checksumByteSize();
7485 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7486 buf = stream->alloc(totalSize);
7487 ptr = buf;
7488 int tmp = OP_glResumeTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7489 memcpy(ptr, &totalSize, 4); ptr += 4;
7490
7491
7492 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7493 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7494
7495}
7496
7497GLboolean glIsTransformFeedback_enc(void *self , GLuint id)
7498{
7499
7500 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7501 IOStream *stream = ctx->m_stream;
7502 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7503 bool useChecksum = checksumCalculator->getVersion() > 0;
7504
7505 unsigned char *ptr;
7506 unsigned char *buf;
7507 const size_t sizeWithoutChecksum = 8 + 4;
7508 const size_t checksumSize = checksumCalculator->checksumByteSize();
7509 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7510 buf = stream->alloc(totalSize);
7511 ptr = buf;
7512 int tmp = OP_glIsTransformFeedback;memcpy(ptr, &tmp, 4); ptr += 4;
7513 memcpy(ptr, &totalSize, 4); ptr += 4;
7514
7515 memcpy(ptr, &id, 4); ptr += 4;
7516
7517 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7518 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7519
7520
7521 GLboolean retval;
7522 stream->readback(&retval, 1);
7523 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7524 if (useChecksum) {
7525 unsigned char *checksumBufPtr = NULL;
7526 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7527 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7528 stream->readback(checksumBufPtr, checksumSize);
7529 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7530 ALOGE("glIsTransformFeedback: GL communication error, please report this issue to b.android.com.\n");
7531 abort();
7532 }
7533 }
7534 return retval;
7535}
7536
7537void glTransformFeedbackVaryingsAEMU_enc(void *self , GLuint program, GLsizei count, const char* packedVaryings, GLuint packedVaryingsLen, GLenum bufferMode)
7538{
7539
7540 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7541 IOStream *stream = ctx->m_stream;
7542 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7543 bool useChecksum = checksumCalculator->getVersion() > 0;
7544
7545 const unsigned int __size_packedVaryings = packedVaryingsLen;
7546 unsigned char *ptr;
7547 unsigned char *buf;
7548 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedVaryings + 4 + 4 + 1*4;
7549 const size_t checksumSize = checksumCalculator->checksumByteSize();
7550 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7551 buf = stream->alloc(totalSize);
7552 ptr = buf;
7553 int tmp = OP_glTransformFeedbackVaryingsAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
7554 memcpy(ptr, &totalSize, 4); ptr += 4;
7555
7556 memcpy(ptr, &program, 4); ptr += 4;
7557 memcpy(ptr, &count, 4); ptr += 4;
7558 *(unsigned int *)(ptr) = __size_packedVaryings; ptr += 4;
7559 memcpy(ptr, packedVaryings, __size_packedVaryings);ptr += __size_packedVaryings;
7560 memcpy(ptr, &packedVaryingsLen, 4); ptr += 4;
7561 memcpy(ptr, &bufferMode, 4); ptr += 4;
7562
7563 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7564 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7565
7566}
7567
7568void glGetTransformFeedbackVarying_enc(void *self , GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, char* name)
7569{
7570
7571 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7572 IOStream *stream = ctx->m_stream;
7573 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7574 bool useChecksum = checksumCalculator->getVersion() > 0;
7575
7576 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
7577 const unsigned int __size_size = (sizeof(GLsizei));
7578 const unsigned int __size_type = ((type != NULL) ? (sizeof(GLenum)) : 0);
7579 const unsigned int __size_name = ((name != NULL) ? bufSize : 0);
7580 unsigned char *ptr;
7581 unsigned char *buf;
7582 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 0 + 0 + 0 + 4*4;
7583 const size_t checksumSize = checksumCalculator->checksumByteSize();
7584 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7585 buf = stream->alloc(totalSize);
7586 ptr = buf;
7587 int tmp = OP_glGetTransformFeedbackVarying;memcpy(ptr, &tmp, 4); ptr += 4;
7588 memcpy(ptr, &totalSize, 4); ptr += 4;
7589
7590 memcpy(ptr, &program, 4); ptr += 4;
7591 memcpy(ptr, &index, 4); ptr += 4;
7592 memcpy(ptr, &bufSize, 4); ptr += 4;
7593 *(unsigned int *)(ptr) = __size_length; ptr += 4;
7594 *(unsigned int *)(ptr) = __size_size; ptr += 4;
7595 *(unsigned int *)(ptr) = __size_type; ptr += 4;
7596 *(unsigned int *)(ptr) = __size_name; ptr += 4;
7597
7598 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7599 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7600
7601 if (length != NULL) {
7602 stream->readback(length, __size_length);
7603 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
7604 }
7605 stream->readback(size, __size_size);
7606 if (useChecksum) checksumCalculator->addBuffer(size, __size_size);
7607 if (type != NULL) {
7608 stream->readback(type, __size_type);
7609 if (useChecksum) checksumCalculator->addBuffer(type, __size_type);
7610 }
7611 if (name != NULL) {
7612 stream->readback(name, __size_name);
7613 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
7614 }
7615 if (useChecksum) {
7616 unsigned char *checksumBufPtr = NULL;
7617 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7618 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7619 stream->readback(checksumBufPtr, checksumSize);
7620 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7621 ALOGE("glGetTransformFeedbackVarying: GL communication error, please report this issue to b.android.com.\n");
7622 abort();
7623 }
7624 }
7625}
7626
7627void glGenSamplers_enc(void *self , GLsizei n, GLuint* samplers)
7628{
7629
7630 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7631 IOStream *stream = ctx->m_stream;
7632 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7633 bool useChecksum = checksumCalculator->getVersion() > 0;
7634
7635 const unsigned int __size_samplers = (n * sizeof(GLuint));
7636 unsigned char *ptr;
7637 unsigned char *buf;
7638 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7639 const size_t checksumSize = checksumCalculator->checksumByteSize();
7640 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7641 buf = stream->alloc(totalSize);
7642 ptr = buf;
7643 int tmp = OP_glGenSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7644 memcpy(ptr, &totalSize, 4); ptr += 4;
7645
7646 memcpy(ptr, &n, 4); ptr += 4;
7647 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7648
7649 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7650 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7651
7652 stream->readback(samplers, __size_samplers);
7653 if (useChecksum) checksumCalculator->addBuffer(samplers, __size_samplers);
7654 if (useChecksum) {
7655 unsigned char *checksumBufPtr = NULL;
7656 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7657 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7658 stream->readback(checksumBufPtr, checksumSize);
7659 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7660 ALOGE("glGenSamplers: GL communication error, please report this issue to b.android.com.\n");
7661 abort();
7662 }
7663 }
7664}
7665
7666void glDeleteSamplers_enc(void *self , GLsizei n, const GLuint* samplers)
7667{
7668
7669 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7670 IOStream *stream = ctx->m_stream;
7671 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7672 bool useChecksum = checksumCalculator->getVersion() > 0;
7673
7674 const unsigned int __size_samplers = (n * sizeof(GLuint));
7675 unsigned char *ptr;
7676 unsigned char *buf;
7677 const size_t sizeWithoutChecksum = 8 + 4 + __size_samplers + 1*4;
7678 const size_t checksumSize = checksumCalculator->checksumByteSize();
7679 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7680 buf = stream->alloc(totalSize);
7681 ptr = buf;
7682 int tmp = OP_glDeleteSamplers;memcpy(ptr, &tmp, 4); ptr += 4;
7683 memcpy(ptr, &totalSize, 4); ptr += 4;
7684
7685 memcpy(ptr, &n, 4); ptr += 4;
7686 *(unsigned int *)(ptr) = __size_samplers; ptr += 4;
7687 memcpy(ptr, samplers, __size_samplers);ptr += __size_samplers;
7688
7689 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7690 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7691
7692}
7693
7694void glBindSampler_enc(void *self , GLuint unit, GLuint sampler)
7695{
7696
7697 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7698 IOStream *stream = ctx->m_stream;
7699 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7700 bool useChecksum = checksumCalculator->getVersion() > 0;
7701
7702 unsigned char *ptr;
7703 unsigned char *buf;
7704 const size_t sizeWithoutChecksum = 8 + 4 + 4;
7705 const size_t checksumSize = checksumCalculator->checksumByteSize();
7706 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7707 buf = stream->alloc(totalSize);
7708 ptr = buf;
7709 int tmp = OP_glBindSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7710 memcpy(ptr, &totalSize, 4); ptr += 4;
7711
7712 memcpy(ptr, &unit, 4); ptr += 4;
7713 memcpy(ptr, &sampler, 4); ptr += 4;
7714
7715 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7716 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7717
7718}
7719
7720void glSamplerParameterf_enc(void *self , GLuint sampler, GLenum pname, GLfloat param)
7721{
7722
7723 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7724 IOStream *stream = ctx->m_stream;
7725 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7726 bool useChecksum = checksumCalculator->getVersion() > 0;
7727
7728 unsigned char *ptr;
7729 unsigned char *buf;
7730 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7731 const size_t checksumSize = checksumCalculator->checksumByteSize();
7732 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7733 buf = stream->alloc(totalSize);
7734 ptr = buf;
7735 int tmp = OP_glSamplerParameterf;memcpy(ptr, &tmp, 4); ptr += 4;
7736 memcpy(ptr, &totalSize, 4); ptr += 4;
7737
7738 memcpy(ptr, &sampler, 4); ptr += 4;
7739 memcpy(ptr, &pname, 4); ptr += 4;
7740 memcpy(ptr, &param, 4); ptr += 4;
7741
7742 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7743 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7744
7745}
7746
7747void glSamplerParameteri_enc(void *self , GLuint sampler, GLenum pname, GLint param)
7748{
7749
7750 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7751 IOStream *stream = ctx->m_stream;
7752 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7753 bool useChecksum = checksumCalculator->getVersion() > 0;
7754
7755 unsigned char *ptr;
7756 unsigned char *buf;
7757 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
7758 const size_t checksumSize = checksumCalculator->checksumByteSize();
7759 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7760 buf = stream->alloc(totalSize);
7761 ptr = buf;
7762 int tmp = OP_glSamplerParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
7763 memcpy(ptr, &totalSize, 4); ptr += 4;
7764
7765 memcpy(ptr, &sampler, 4); ptr += 4;
7766 memcpy(ptr, &pname, 4); ptr += 4;
7767 memcpy(ptr, &param, 4); ptr += 4;
7768
7769 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7770 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7771
7772}
7773
7774void glSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, const GLfloat* params)
7775{
7776
7777 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7778 IOStream *stream = ctx->m_stream;
7779 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7780 bool useChecksum = checksumCalculator->getVersion() > 0;
7781
7782 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7783 unsigned char *ptr;
7784 unsigned char *buf;
7785 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7786 const size_t checksumSize = checksumCalculator->checksumByteSize();
7787 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7788 buf = stream->alloc(totalSize);
7789 ptr = buf;
7790 int tmp = OP_glSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7791 memcpy(ptr, &totalSize, 4); ptr += 4;
7792
7793 memcpy(ptr, &sampler, 4); ptr += 4;
7794 memcpy(ptr, &pname, 4); ptr += 4;
7795 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7796 memcpy(ptr, params, __size_params);ptr += __size_params;
7797
7798 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7799 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7800
7801}
7802
7803void glSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, const GLint* params)
7804{
7805
7806 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7807 IOStream *stream = ctx->m_stream;
7808 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7809 bool useChecksum = checksumCalculator->getVersion() > 0;
7810
7811 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7812 unsigned char *ptr;
7813 unsigned char *buf;
7814 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_params + 1*4;
7815 const size_t checksumSize = checksumCalculator->checksumByteSize();
7816 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7817 buf = stream->alloc(totalSize);
7818 ptr = buf;
7819 int tmp = OP_glSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7820 memcpy(ptr, &totalSize, 4); ptr += 4;
7821
7822 memcpy(ptr, &sampler, 4); ptr += 4;
7823 memcpy(ptr, &pname, 4); ptr += 4;
7824 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7825 memcpy(ptr, params, __size_params);ptr += __size_params;
7826
7827 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7828 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7829
7830}
7831
7832void glGetSamplerParameterfv_enc(void *self , GLuint sampler, GLenum pname, GLfloat* params)
7833{
7834
7835 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7836 IOStream *stream = ctx->m_stream;
7837 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7838 bool useChecksum = checksumCalculator->getVersion() > 0;
7839
7840 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
7841 unsigned char *ptr;
7842 unsigned char *buf;
7843 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7844 const size_t checksumSize = checksumCalculator->checksumByteSize();
7845 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7846 buf = stream->alloc(totalSize);
7847 ptr = buf;
7848 int tmp = OP_glGetSamplerParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
7849 memcpy(ptr, &totalSize, 4); ptr += 4;
7850
7851 memcpy(ptr, &sampler, 4); ptr += 4;
7852 memcpy(ptr, &pname, 4); ptr += 4;
7853 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7854
7855 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7856 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7857
7858 stream->readback(params, __size_params);
7859 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7860 if (useChecksum) {
7861 unsigned char *checksumBufPtr = NULL;
7862 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7863 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7864 stream->readback(checksumBufPtr, checksumSize);
7865 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7866 ALOGE("glGetSamplerParameterfv: GL communication error, please report this issue to b.android.com.\n");
7867 abort();
7868 }
7869 }
7870}
7871
7872void glGetSamplerParameteriv_enc(void *self , GLuint sampler, GLenum pname, GLint* params)
7873{
7874
7875 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7876 IOStream *stream = ctx->m_stream;
7877 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7878 bool useChecksum = checksumCalculator->getVersion() > 0;
7879
7880 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
7881 unsigned char *ptr;
7882 unsigned char *buf;
7883 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
7884 const size_t checksumSize = checksumCalculator->checksumByteSize();
7885 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7886 buf = stream->alloc(totalSize);
7887 ptr = buf;
7888 int tmp = OP_glGetSamplerParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
7889 memcpy(ptr, &totalSize, 4); ptr += 4;
7890
7891 memcpy(ptr, &sampler, 4); ptr += 4;
7892 memcpy(ptr, &pname, 4); ptr += 4;
7893 *(unsigned int *)(ptr) = __size_params; ptr += 4;
7894
7895 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7896 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7897
7898 stream->readback(params, __size_params);
7899 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
7900 if (useChecksum) {
7901 unsigned char *checksumBufPtr = NULL;
7902 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7903 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7904 stream->readback(checksumBufPtr, checksumSize);
7905 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7906 ALOGE("glGetSamplerParameteriv: GL communication error, please report this issue to b.android.com.\n");
7907 abort();
7908 }
7909 }
7910}
7911
7912GLboolean glIsSampler_enc(void *self , GLuint sampler)
7913{
7914
7915 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7916 IOStream *stream = ctx->m_stream;
7917 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7918 bool useChecksum = checksumCalculator->getVersion() > 0;
7919
7920 unsigned char *ptr;
7921 unsigned char *buf;
7922 const size_t sizeWithoutChecksum = 8 + 4;
7923 const size_t checksumSize = checksumCalculator->checksumByteSize();
7924 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7925 buf = stream->alloc(totalSize);
7926 ptr = buf;
7927 int tmp = OP_glIsSampler;memcpy(ptr, &tmp, 4); ptr += 4;
7928 memcpy(ptr, &totalSize, 4); ptr += 4;
7929
7930 memcpy(ptr, &sampler, 4); ptr += 4;
7931
7932 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7933 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7934
7935
7936 GLboolean retval;
7937 stream->readback(&retval, 1);
7938 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
7939 if (useChecksum) {
7940 unsigned char *checksumBufPtr = NULL;
7941 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7942 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7943 stream->readback(checksumBufPtr, checksumSize);
7944 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7945 ALOGE("glIsSampler: GL communication error, please report this issue to b.android.com.\n");
7946 abort();
7947 }
7948 }
7949 return retval;
7950}
7951
7952void glGenQueries_enc(void *self , GLsizei n, GLuint* queries)
7953{
7954
7955 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7956 IOStream *stream = ctx->m_stream;
7957 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7958 bool useChecksum = checksumCalculator->getVersion() > 0;
7959
7960 const unsigned int __size_queries = (n * sizeof(GLuint));
7961 unsigned char *ptr;
7962 unsigned char *buf;
7963 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
7964 const size_t checksumSize = checksumCalculator->checksumByteSize();
7965 const size_t totalSize = sizeWithoutChecksum + checksumSize;
7966 buf = stream->alloc(totalSize);
7967 ptr = buf;
7968 int tmp = OP_glGenQueries;memcpy(ptr, &tmp, 4); ptr += 4;
7969 memcpy(ptr, &totalSize, 4); ptr += 4;
7970
7971 memcpy(ptr, &n, 4); ptr += 4;
7972 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
7973
7974 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
7975 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
7976
7977 stream->readback(queries, __size_queries);
7978 if (useChecksum) checksumCalculator->addBuffer(queries, __size_queries);
7979 if (useChecksum) {
7980 unsigned char *checksumBufPtr = NULL;
7981 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
7982 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
7983 stream->readback(checksumBufPtr, checksumSize);
7984 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
7985 ALOGE("glGenQueries: GL communication error, please report this issue to b.android.com.\n");
7986 abort();
7987 }
7988 }
7989}
7990
7991void glDeleteQueries_enc(void *self , GLsizei n, const GLuint* queries)
7992{
7993
7994 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
7995 IOStream *stream = ctx->m_stream;
7996 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
7997 bool useChecksum = checksumCalculator->getVersion() > 0;
7998
7999 const unsigned int __size_queries = (n * sizeof(GLuint));
8000 unsigned char *ptr;
8001 unsigned char *buf;
8002 const size_t sizeWithoutChecksum = 8 + 4 + __size_queries + 1*4;
8003 const size_t checksumSize = checksumCalculator->checksumByteSize();
8004 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8005 buf = stream->alloc(totalSize);
8006 ptr = buf;
8007 int tmp = OP_glDeleteQueries;memcpy(ptr, &tmp, 4); ptr += 4;
8008 memcpy(ptr, &totalSize, 4); ptr += 4;
8009
8010 memcpy(ptr, &n, 4); ptr += 4;
8011 *(unsigned int *)(ptr) = __size_queries; ptr += 4;
8012 memcpy(ptr, queries, __size_queries);ptr += __size_queries;
8013
8014 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8015 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8016
8017}
8018
8019void glBeginQuery_enc(void *self , GLenum target, GLuint query)
8020{
8021
8022 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8023 IOStream *stream = ctx->m_stream;
8024 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8025 bool useChecksum = checksumCalculator->getVersion() > 0;
8026
8027 unsigned char *ptr;
8028 unsigned char *buf;
8029 const size_t sizeWithoutChecksum = 8 + 4 + 4;
8030 const size_t checksumSize = checksumCalculator->checksumByteSize();
8031 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8032 buf = stream->alloc(totalSize);
8033 ptr = buf;
8034 int tmp = OP_glBeginQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8035 memcpy(ptr, &totalSize, 4); ptr += 4;
8036
8037 memcpy(ptr, &target, 4); ptr += 4;
8038 memcpy(ptr, &query, 4); ptr += 4;
8039
8040 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8041 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8042
8043}
8044
8045void glEndQuery_enc(void *self , GLenum target)
8046{
8047
8048 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8049 IOStream *stream = ctx->m_stream;
8050 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8051 bool useChecksum = checksumCalculator->getVersion() > 0;
8052
8053 unsigned char *ptr;
8054 unsigned char *buf;
8055 const size_t sizeWithoutChecksum = 8 + 4;
8056 const size_t checksumSize = checksumCalculator->checksumByteSize();
8057 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8058 buf = stream->alloc(totalSize);
8059 ptr = buf;
8060 int tmp = OP_glEndQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8061 memcpy(ptr, &totalSize, 4); ptr += 4;
8062
8063 memcpy(ptr, &target, 4); ptr += 4;
8064
8065 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8066 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8067
8068}
8069
8070void glGetQueryiv_enc(void *self , GLenum target, GLenum pname, GLint* params)
8071{
8072
8073 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8074 IOStream *stream = ctx->m_stream;
8075 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8076 bool useChecksum = checksumCalculator->getVersion() > 0;
8077
8078 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
8079 unsigned char *ptr;
8080 unsigned char *buf;
8081 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8082 const size_t checksumSize = checksumCalculator->checksumByteSize();
8083 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8084 buf = stream->alloc(totalSize);
8085 ptr = buf;
8086 int tmp = OP_glGetQueryiv;memcpy(ptr, &tmp, 4); ptr += 4;
8087 memcpy(ptr, &totalSize, 4); ptr += 4;
8088
8089 memcpy(ptr, &target, 4); ptr += 4;
8090 memcpy(ptr, &pname, 4); ptr += 4;
8091 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8092
8093 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8094 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8095
8096 stream->readback(params, __size_params);
8097 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8098 if (useChecksum) {
8099 unsigned char *checksumBufPtr = NULL;
8100 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8101 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8102 stream->readback(checksumBufPtr, checksumSize);
8103 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8104 ALOGE("glGetQueryiv: GL communication error, please report this issue to b.android.com.\n");
8105 abort();
8106 }
8107 }
8108}
8109
8110void glGetQueryObjectuiv_enc(void *self , GLuint query, GLenum pname, GLuint* params)
8111{
8112
8113 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8114 IOStream *stream = ctx->m_stream;
8115 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8116 bool useChecksum = checksumCalculator->getVersion() > 0;
8117
8118 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLuint));
8119 unsigned char *ptr;
8120 unsigned char *buf;
8121 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8122 const size_t checksumSize = checksumCalculator->checksumByteSize();
8123 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8124 buf = stream->alloc(totalSize);
8125 ptr = buf;
8126 int tmp = OP_glGetQueryObjectuiv;memcpy(ptr, &tmp, 4); ptr += 4;
8127 memcpy(ptr, &totalSize, 4); ptr += 4;
8128
8129 memcpy(ptr, &query, 4); ptr += 4;
8130 memcpy(ptr, &pname, 4); ptr += 4;
8131 *(unsigned int *)(ptr) = __size_params; ptr += 4;
8132
8133 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8134 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8135
8136 stream->readback(params, __size_params);
8137 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
8138 if (useChecksum) {
8139 unsigned char *checksumBufPtr = NULL;
8140 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8141 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8142 stream->readback(checksumBufPtr, checksumSize);
8143 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8144 ALOGE("glGetQueryObjectuiv: GL communication error, please report this issue to b.android.com.\n");
8145 abort();
8146 }
8147 }
8148}
8149
8150GLboolean glIsQuery_enc(void *self , GLuint query)
8151{
8152
8153 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8154 IOStream *stream = ctx->m_stream;
8155 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8156 bool useChecksum = checksumCalculator->getVersion() > 0;
8157
8158 unsigned char *ptr;
8159 unsigned char *buf;
8160 const size_t sizeWithoutChecksum = 8 + 4;
8161 const size_t checksumSize = checksumCalculator->checksumByteSize();
8162 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8163 buf = stream->alloc(totalSize);
8164 ptr = buf;
8165 int tmp = OP_glIsQuery;memcpy(ptr, &tmp, 4); ptr += 4;
8166 memcpy(ptr, &totalSize, 4); ptr += 4;
8167
8168 memcpy(ptr, &query, 4); ptr += 4;
8169
8170 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8171 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8172
8173
8174 GLboolean retval;
8175 stream->readback(&retval, 1);
8176 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
8177 if (useChecksum) {
8178 unsigned char *checksumBufPtr = NULL;
8179 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8180 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8181 stream->readback(checksumBufPtr, checksumSize);
8182 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8183 ALOGE("glIsQuery: GL communication error, please report this issue to b.android.com.\n");
8184 abort();
8185 }
8186 }
8187 return retval;
8188}
8189
8190void glProgramParameteri_enc(void *self , GLuint program, GLenum pname, GLint value)
8191{
8192
8193 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8194 IOStream *stream = ctx->m_stream;
8195 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8196 bool useChecksum = checksumCalculator->getVersion() > 0;
8197
8198 unsigned char *ptr;
8199 unsigned char *buf;
8200 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
8201 const size_t checksumSize = checksumCalculator->checksumByteSize();
8202 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8203 buf = stream->alloc(totalSize);
8204 ptr = buf;
8205 int tmp = OP_glProgramParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
8206 memcpy(ptr, &totalSize, 4); ptr += 4;
8207
8208 memcpy(ptr, &program, 4); ptr += 4;
8209 memcpy(ptr, &pname, 4); ptr += 4;
8210 memcpy(ptr, &value, 4); ptr += 4;
8211
8212 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8213 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8214
8215}
8216
8217void glProgramBinary_enc(void *self , GLuint program, GLenum binaryFormat, const void* binary, GLsizei length)
8218{
8219
8220 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8221 IOStream *stream = ctx->m_stream;
8222 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8223 bool useChecksum = checksumCalculator->getVersion() > 0;
8224
8225 const unsigned int __size_binary = length;
8226 unsigned char *ptr;
8227 unsigned char *buf;
8228 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_binary + 4 + 1*4;
8229 const size_t checksumSize = checksumCalculator->checksumByteSize();
8230 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8231 buf = stream->alloc(totalSize);
8232 ptr = buf;
8233 int tmp = OP_glProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8234 memcpy(ptr, &totalSize, 4); ptr += 4;
8235
8236 memcpy(ptr, &program, 4); ptr += 4;
8237 memcpy(ptr, &binaryFormat, 4); ptr += 4;
8238 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8239 memcpy(ptr, binary, __size_binary);ptr += __size_binary;
8240 memcpy(ptr, &length, 4); ptr += 4;
8241
8242 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8243 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8244
8245}
8246
8247void glGetProgramBinary_enc(void *self , GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, void* binary)
8248{
8249
8250 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8251 IOStream *stream = ctx->m_stream;
8252 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8253 bool useChecksum = checksumCalculator->getVersion() > 0;
8254
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08008255 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008256 const unsigned int __size_binaryFormat = (sizeof(GLenum));
8257 const unsigned int __size_binary = bufSize;
8258 unsigned char *ptr;
8259 unsigned char *buf;
8260 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 0 + 3*4;
8261 const size_t checksumSize = checksumCalculator->checksumByteSize();
8262 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8263 buf = stream->alloc(totalSize);
8264 ptr = buf;
8265 int tmp = OP_glGetProgramBinary;memcpy(ptr, &tmp, 4); ptr += 4;
8266 memcpy(ptr, &totalSize, 4); ptr += 4;
8267
8268 memcpy(ptr, &program, 4); ptr += 4;
8269 memcpy(ptr, &bufSize, 4); ptr += 4;
8270 *(unsigned int *)(ptr) = __size_length; ptr += 4;
8271 *(unsigned int *)(ptr) = __size_binaryFormat; ptr += 4;
8272 *(unsigned int *)(ptr) = __size_binary; ptr += 4;
8273
8274 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8275 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8276
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08008277 if (length != NULL) {
8278 stream->readback(length, __size_length);
8279 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
8280 }
Lingfeng Yange6556dc2017-01-09 12:04:12 -08008281 stream->readback(binaryFormat, __size_binaryFormat);
8282 if (useChecksum) checksumCalculator->addBuffer(binaryFormat, __size_binaryFormat);
8283 stream->readback(binary, __size_binary);
8284 if (useChecksum) checksumCalculator->addBuffer(binary, __size_binary);
8285 if (useChecksum) {
8286 unsigned char *checksumBufPtr = NULL;
8287 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8288 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8289 stream->readback(checksumBufPtr, checksumSize);
8290 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8291 ALOGE("glGetProgramBinary: GL communication error, please report this issue to b.android.com.\n");
8292 abort();
8293 }
8294 }
8295}
8296
8297GLint glGetFragDataLocation_enc(void *self , GLuint program, const char* name)
8298{
8299
8300 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8301 IOStream *stream = ctx->m_stream;
8302 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8303 bool useChecksum = checksumCalculator->getVersion() > 0;
8304
8305 const unsigned int __size_name = (strlen(name) + 1);
8306 unsigned char *ptr;
8307 unsigned char *buf;
8308 const size_t sizeWithoutChecksum = 8 + 4 + __size_name + 1*4;
8309 const size_t checksumSize = checksumCalculator->checksumByteSize();
8310 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8311 buf = stream->alloc(totalSize);
8312 ptr = buf;
8313 int tmp = OP_glGetFragDataLocation;memcpy(ptr, &tmp, 4); ptr += 4;
8314 memcpy(ptr, &totalSize, 4); ptr += 4;
8315
8316 memcpy(ptr, &program, 4); ptr += 4;
8317 *(unsigned int *)(ptr) = __size_name; ptr += 4;
8318 memcpy(ptr, name, __size_name);ptr += __size_name;
8319
8320 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8321 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8322
8323
8324 GLint retval;
8325 stream->readback(&retval, 4);
8326 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
8327 if (useChecksum) {
8328 unsigned char *checksumBufPtr = NULL;
8329 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8330 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8331 stream->readback(checksumBufPtr, checksumSize);
8332 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8333 ALOGE("glGetFragDataLocation: GL communication error, please report this issue to b.android.com.\n");
8334 abort();
8335 }
8336 }
8337 return retval;
8338}
8339
8340void glGetInteger64v_enc(void *self , GLenum pname, GLint64* data)
8341{
8342
8343 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8344 IOStream *stream = ctx->m_stream;
8345 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8346 bool useChecksum = checksumCalculator->getVersion() > 0;
8347
8348 const unsigned int __size_data = (glUtilsParamSize(pname) * sizeof(GLint64));
8349 unsigned char *ptr;
8350 unsigned char *buf;
8351 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8352 const size_t checksumSize = checksumCalculator->checksumByteSize();
8353 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8354 buf = stream->alloc(totalSize);
8355 ptr = buf;
8356 int tmp = OP_glGetInteger64v;memcpy(ptr, &tmp, 4); ptr += 4;
8357 memcpy(ptr, &totalSize, 4); ptr += 4;
8358
8359 memcpy(ptr, &pname, 4); ptr += 4;
8360 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8361
8362 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8363 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8364
8365 stream->readback(data, __size_data);
8366 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8367 if (useChecksum) {
8368 unsigned char *checksumBufPtr = NULL;
8369 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8370 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8371 stream->readback(checksumBufPtr, checksumSize);
8372 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8373 ALOGE("glGetInteger64v: GL communication error, please report this issue to b.android.com.\n");
8374 abort();
8375 }
8376 }
8377}
8378
8379void glGetIntegeri_v_enc(void *self , GLenum target, GLuint index, GLint* data)
8380{
8381
8382 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8383 IOStream *stream = ctx->m_stream;
8384 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8385 bool useChecksum = checksumCalculator->getVersion() > 0;
8386
8387 const unsigned int __size_data = (sizeof(GLint));
8388 unsigned char *ptr;
8389 unsigned char *buf;
8390 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8391 const size_t checksumSize = checksumCalculator->checksumByteSize();
8392 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8393 buf = stream->alloc(totalSize);
8394 ptr = buf;
8395 int tmp = OP_glGetIntegeri_v;memcpy(ptr, &tmp, 4); ptr += 4;
8396 memcpy(ptr, &totalSize, 4); ptr += 4;
8397
8398 memcpy(ptr, &target, 4); ptr += 4;
8399 memcpy(ptr, &index, 4); ptr += 4;
8400 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8401
8402 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8403 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8404
8405 stream->readback(data, __size_data);
8406 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8407 if (useChecksum) {
8408 unsigned char *checksumBufPtr = NULL;
8409 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8410 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8411 stream->readback(checksumBufPtr, checksumSize);
8412 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8413 ALOGE("glGetIntegeri_v: GL communication error, please report this issue to b.android.com.\n");
8414 abort();
8415 }
8416 }
8417}
8418
8419void glGetInteger64i_v_enc(void *self , GLenum target, GLuint index, GLint64* data)
8420{
8421
8422 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8423 IOStream *stream = ctx->m_stream;
8424 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8425 bool useChecksum = checksumCalculator->getVersion() > 0;
8426
8427 const unsigned int __size_data = (sizeof(GLint64));
8428 unsigned char *ptr;
8429 unsigned char *buf;
8430 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8431 const size_t checksumSize = checksumCalculator->checksumByteSize();
8432 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8433 buf = stream->alloc(totalSize);
8434 ptr = buf;
8435 int tmp = OP_glGetInteger64i_v;memcpy(ptr, &tmp, 4); ptr += 4;
8436 memcpy(ptr, &totalSize, 4); ptr += 4;
8437
8438 memcpy(ptr, &target, 4); ptr += 4;
8439 memcpy(ptr, &index, 4); ptr += 4;
8440 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8441
8442 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8443 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8444
8445 stream->readback(data, __size_data);
8446 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8447 if (useChecksum) {
8448 unsigned char *checksumBufPtr = NULL;
8449 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8450 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8451 stream->readback(checksumBufPtr, checksumSize);
8452 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8453 ALOGE("glGetInteger64i_v: GL communication error, please report this issue to b.android.com.\n");
8454 abort();
8455 }
8456 }
8457}
8458
8459void 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)
8460{
8461
8462 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8463 IOStream *stream = ctx->m_stream;
8464 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8465 bool useChecksum = checksumCalculator->getVersion() > 0;
8466
8467 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8468 unsigned char *ptr;
8469 unsigned char *buf;
8470 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8471 const size_t checksumSize = checksumCalculator->checksumByteSize();
8472 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8473 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8474 ptr = buf;
8475 int tmp = OP_glTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8476 memcpy(ptr, &totalSize, 4); ptr += 4;
8477
8478 memcpy(ptr, &target, 4); ptr += 4;
8479 memcpy(ptr, &level, 4); ptr += 4;
8480 memcpy(ptr, &internalFormat, 4); ptr += 4;
8481 memcpy(ptr, &width, 4); ptr += 4;
8482 memcpy(ptr, &height, 4); ptr += 4;
8483 memcpy(ptr, &depth, 4); ptr += 4;
8484 memcpy(ptr, &border, 4); ptr += 4;
8485 memcpy(ptr, &format, 4); ptr += 4;
8486 memcpy(ptr, &type, 4); ptr += 4;
8487
8488 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8489 stream->flush();
8490 stream->writeFully(&__size_data,4);
8491 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8492 if (data != NULL) {
8493 stream->writeFully(data, __size_data);
8494 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8495 }
8496 buf = stream->alloc(checksumSize);
8497 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8498
8499}
8500
8501void glTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLuint offset)
8502{
8503
8504 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8505 IOStream *stream = ctx->m_stream;
8506 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8507 bool useChecksum = checksumCalculator->getVersion() > 0;
8508
8509 unsigned char *ptr;
8510 unsigned char *buf;
8511 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8512 const size_t checksumSize = checksumCalculator->checksumByteSize();
8513 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8514 buf = stream->alloc(totalSize);
8515 ptr = buf;
8516 int tmp = OP_glTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8517 memcpy(ptr, &totalSize, 4); ptr += 4;
8518
8519 memcpy(ptr, &target, 4); ptr += 4;
8520 memcpy(ptr, &level, 4); ptr += 4;
8521 memcpy(ptr, &internalFormat, 4); ptr += 4;
8522 memcpy(ptr, &width, 4); ptr += 4;
8523 memcpy(ptr, &height, 4); ptr += 4;
8524 memcpy(ptr, &depth, 4); ptr += 4;
8525 memcpy(ptr, &border, 4); ptr += 4;
8526 memcpy(ptr, &format, 4); ptr += 4;
8527 memcpy(ptr, &type, 4); ptr += 4;
8528 memcpy(ptr, &offset, 4); ptr += 4;
8529
8530 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8531 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8532
8533}
8534
8535void glTexStorage3D_enc(void *self , GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
8536{
8537
8538 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8539 IOStream *stream = ctx->m_stream;
8540 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8541 bool useChecksum = checksumCalculator->getVersion() > 0;
8542
8543 unsigned char *ptr;
8544 unsigned char *buf;
8545 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
8546 const size_t checksumSize = checksumCalculator->checksumByteSize();
8547 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8548 buf = stream->alloc(totalSize);
8549 ptr = buf;
8550 int tmp = OP_glTexStorage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8551 memcpy(ptr, &totalSize, 4); ptr += 4;
8552
8553 memcpy(ptr, &target, 4); ptr += 4;
8554 memcpy(ptr, &levels, 4); ptr += 4;
8555 memcpy(ptr, &internalformat, 4); ptr += 4;
8556 memcpy(ptr, &width, 4); ptr += 4;
8557 memcpy(ptr, &height, 4); ptr += 4;
8558 memcpy(ptr, &depth, 4); ptr += 4;
8559
8560 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8561 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8562
8563}
8564
8565void 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)
8566{
8567
8568 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8569 IOStream *stream = ctx->m_stream;
8570 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8571 bool useChecksum = checksumCalculator->getVersion() > 0;
8572
8573 const unsigned int __size_data = ((data != NULL) ? glesv2_enc::pixelDataSize3D(self, width, height, depth, format, type, 0) : 0);
8574 unsigned char *ptr;
8575 unsigned char *buf;
8576 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8577 const size_t checksumSize = checksumCalculator->checksumByteSize();
8578 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8579 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8580 ptr = buf;
8581 int tmp = OP_glTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8582 memcpy(ptr, &totalSize, 4); ptr += 4;
8583
8584 memcpy(ptr, &target, 4); ptr += 4;
8585 memcpy(ptr, &level, 4); ptr += 4;
8586 memcpy(ptr, &xoffset, 4); ptr += 4;
8587 memcpy(ptr, &yoffset, 4); ptr += 4;
8588 memcpy(ptr, &zoffset, 4); ptr += 4;
8589 memcpy(ptr, &width, 4); ptr += 4;
8590 memcpy(ptr, &height, 4); ptr += 4;
8591 memcpy(ptr, &depth, 4); ptr += 4;
8592 memcpy(ptr, &format, 4); ptr += 4;
8593 memcpy(ptr, &type, 4); ptr += 4;
8594
8595 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8596 stream->flush();
8597 stream->writeFully(&__size_data,4);
8598 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8599 if (data != NULL) {
8600 stream->writeFully(data, __size_data);
8601 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8602 }
8603 buf = stream->alloc(checksumSize);
8604 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8605
8606}
8607
8608void 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)
8609{
8610
8611 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8612 IOStream *stream = ctx->m_stream;
8613 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8614 bool useChecksum = checksumCalculator->getVersion() > 0;
8615
8616 unsigned char *ptr;
8617 unsigned char *buf;
8618 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8619 const size_t checksumSize = checksumCalculator->checksumByteSize();
8620 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8621 buf = stream->alloc(totalSize);
8622 ptr = buf;
8623 int tmp = OP_glTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8624 memcpy(ptr, &totalSize, 4); ptr += 4;
8625
8626 memcpy(ptr, &target, 4); ptr += 4;
8627 memcpy(ptr, &level, 4); ptr += 4;
8628 memcpy(ptr, &xoffset, 4); ptr += 4;
8629 memcpy(ptr, &yoffset, 4); ptr += 4;
8630 memcpy(ptr, &zoffset, 4); ptr += 4;
8631 memcpy(ptr, &width, 4); ptr += 4;
8632 memcpy(ptr, &height, 4); ptr += 4;
8633 memcpy(ptr, &depth, 4); ptr += 4;
8634 memcpy(ptr, &format, 4); ptr += 4;
8635 memcpy(ptr, &type, 4); ptr += 4;
8636 memcpy(ptr, &offset, 4); ptr += 4;
8637
8638 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8639 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8640
8641}
8642
8643void glCompressedTexImage3D_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
8644{
8645
8646 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8647 IOStream *stream = ctx->m_stream;
8648 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8649 bool useChecksum = checksumCalculator->getVersion() > 0;
8650
8651 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8652 unsigned char *ptr;
8653 unsigned char *buf;
8654 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8655 const size_t checksumSize = checksumCalculator->checksumByteSize();
8656 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8657 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8658 ptr = buf;
8659 int tmp = OP_glCompressedTexImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8660 memcpy(ptr, &totalSize, 4); ptr += 4;
8661
8662 memcpy(ptr, &target, 4); ptr += 4;
8663 memcpy(ptr, &level, 4); ptr += 4;
8664 memcpy(ptr, &internalformat, 4); ptr += 4;
8665 memcpy(ptr, &width, 4); ptr += 4;
8666 memcpy(ptr, &height, 4); ptr += 4;
8667 memcpy(ptr, &depth, 4); ptr += 4;
8668 memcpy(ptr, &border, 4); ptr += 4;
8669 memcpy(ptr, &imageSize, 4); ptr += 4;
8670
8671 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8672 stream->flush();
8673 stream->writeFully(&__size_data,4);
8674 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8675 if (data != NULL) {
8676 stream->writeFully(data, __size_data);
8677 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8678 }
8679 buf = stream->alloc(checksumSize);
8680 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8681
8682}
8683
8684void glCompressedTexImage3DOffsetAEMU_enc(void *self , GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLuint offset)
8685{
8686
8687 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8688 IOStream *stream = ctx->m_stream;
8689 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8690 bool useChecksum = checksumCalculator->getVersion() > 0;
8691
8692 unsigned char *ptr;
8693 unsigned char *buf;
8694 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8695 const size_t checksumSize = checksumCalculator->checksumByteSize();
8696 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8697 buf = stream->alloc(totalSize);
8698 ptr = buf;
8699 int tmp = OP_glCompressedTexImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8700 memcpy(ptr, &totalSize, 4); ptr += 4;
8701
8702 memcpy(ptr, &target, 4); ptr += 4;
8703 memcpy(ptr, &level, 4); ptr += 4;
8704 memcpy(ptr, &internalformat, 4); ptr += 4;
8705 memcpy(ptr, &width, 4); ptr += 4;
8706 memcpy(ptr, &height, 4); ptr += 4;
8707 memcpy(ptr, &depth, 4); ptr += 4;
8708 memcpy(ptr, &border, 4); ptr += 4;
8709 memcpy(ptr, &imageSize, 4); ptr += 4;
8710 memcpy(ptr, &offset, 4); ptr += 4;
8711
8712 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8713 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8714
8715}
8716
8717void 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)
8718{
8719
8720 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8721 IOStream *stream = ctx->m_stream;
8722 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8723 bool useChecksum = checksumCalculator->getVersion() > 0;
8724
8725 const unsigned int __size_data = ((data != NULL) ? imageSize : 0);
8726 unsigned char *ptr;
8727 unsigned char *buf;
8728 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_data + 1*4;
8729 const size_t checksumSize = checksumCalculator->checksumByteSize();
8730 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8731 buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
8732 ptr = buf;
8733 int tmp = OP_glCompressedTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8734 memcpy(ptr, &totalSize, 4); ptr += 4;
8735
8736 memcpy(ptr, &target, 4); ptr += 4;
8737 memcpy(ptr, &level, 4); ptr += 4;
8738 memcpy(ptr, &xoffset, 4); ptr += 4;
8739 memcpy(ptr, &yoffset, 4); ptr += 4;
8740 memcpy(ptr, &zoffset, 4); ptr += 4;
8741 memcpy(ptr, &width, 4); ptr += 4;
8742 memcpy(ptr, &height, 4); ptr += 4;
8743 memcpy(ptr, &depth, 4); ptr += 4;
8744 memcpy(ptr, &format, 4); ptr += 4;
8745 memcpy(ptr, &imageSize, 4); ptr += 4;
8746
8747 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8748 stream->flush();
8749 stream->writeFully(&__size_data,4);
8750 if (useChecksum) checksumCalculator->addBuffer(&__size_data,4);
8751 if (data != NULL) {
8752 stream->writeFully(data, __size_data);
8753 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8754 }
8755 buf = stream->alloc(checksumSize);
8756 if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize);
8757
8758}
8759
8760void 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)
8761{
8762
8763 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8764 IOStream *stream = ctx->m_stream;
8765 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8766 bool useChecksum = checksumCalculator->getVersion() > 0;
8767
8768 unsigned char *ptr;
8769 unsigned char *buf;
8770 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8771 const size_t checksumSize = checksumCalculator->checksumByteSize();
8772 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8773 buf = stream->alloc(totalSize);
8774 ptr = buf;
8775 int tmp = OP_glCompressedTexSubImage3DOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
8776 memcpy(ptr, &totalSize, 4); ptr += 4;
8777
8778 memcpy(ptr, &target, 4); ptr += 4;
8779 memcpy(ptr, &level, 4); ptr += 4;
8780 memcpy(ptr, &xoffset, 4); ptr += 4;
8781 memcpy(ptr, &yoffset, 4); ptr += 4;
8782 memcpy(ptr, &zoffset, 4); ptr += 4;
8783 memcpy(ptr, &width, 4); ptr += 4;
8784 memcpy(ptr, &height, 4); ptr += 4;
8785 memcpy(ptr, &depth, 4); ptr += 4;
8786 memcpy(ptr, &format, 4); ptr += 4;
8787 memcpy(ptr, &imageSize, 4); ptr += 4;
8788 memcpy(ptr, &data, 4); ptr += 4;
8789
8790 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8791 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8792
8793}
8794
8795void glCopyTexSubImage3D_enc(void *self , GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
8796{
8797
8798 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8799 IOStream *stream = ctx->m_stream;
8800 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8801 bool useChecksum = checksumCalculator->getVersion() > 0;
8802
8803 unsigned char *ptr;
8804 unsigned char *buf;
8805 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
8806 const size_t checksumSize = checksumCalculator->checksumByteSize();
8807 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8808 buf = stream->alloc(totalSize);
8809 ptr = buf;
8810 int tmp = OP_glCopyTexSubImage3D;memcpy(ptr, &tmp, 4); ptr += 4;
8811 memcpy(ptr, &totalSize, 4); ptr += 4;
8812
8813 memcpy(ptr, &target, 4); ptr += 4;
8814 memcpy(ptr, &level, 4); ptr += 4;
8815 memcpy(ptr, &xoffset, 4); ptr += 4;
8816 memcpy(ptr, &yoffset, 4); ptr += 4;
8817 memcpy(ptr, &zoffset, 4); ptr += 4;
8818 memcpy(ptr, &x, 4); ptr += 4;
8819 memcpy(ptr, &y, 4); ptr += 4;
8820 memcpy(ptr, &width, 4); ptr += 4;
8821 memcpy(ptr, &height, 4); ptr += 4;
8822
8823 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8824 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8825
8826}
8827
8828void glGetBooleani_v_enc(void *self , GLenum target, GLuint index, GLboolean* data)
8829{
8830
8831 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8832 IOStream *stream = ctx->m_stream;
8833 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8834 bool useChecksum = checksumCalculator->getVersion() > 0;
8835
8836 const unsigned int __size_data = (sizeof(GLboolean));
8837 unsigned char *ptr;
8838 unsigned char *buf;
8839 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
8840 const size_t checksumSize = checksumCalculator->checksumByteSize();
8841 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8842 buf = stream->alloc(totalSize);
8843 ptr = buf;
8844 int tmp = OP_glGetBooleani_v;memcpy(ptr, &tmp, 4); ptr += 4;
8845 memcpy(ptr, &totalSize, 4); ptr += 4;
8846
8847 memcpy(ptr, &target, 4); ptr += 4;
8848 memcpy(ptr, &index, 4); ptr += 4;
8849 *(unsigned int *)(ptr) = __size_data; ptr += 4;
8850
8851 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8852 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8853
8854 stream->readback(data, __size_data);
8855 if (useChecksum) checksumCalculator->addBuffer(data, __size_data);
8856 if (useChecksum) {
8857 unsigned char *checksumBufPtr = NULL;
8858 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8859 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8860 stream->readback(checksumBufPtr, checksumSize);
8861 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8862 ALOGE("glGetBooleani_v: GL communication error, please report this issue to b.android.com.\n");
8863 abort();
8864 }
8865 }
8866}
8867
8868void glMemoryBarrier_enc(void *self , GLbitfield barriers)
8869{
8870
8871 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8872 IOStream *stream = ctx->m_stream;
8873 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8874 bool useChecksum = checksumCalculator->getVersion() > 0;
8875
8876 unsigned char *ptr;
8877 unsigned char *buf;
8878 const size_t sizeWithoutChecksum = 8 + 4;
8879 const size_t checksumSize = checksumCalculator->checksumByteSize();
8880 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8881 buf = stream->alloc(totalSize);
8882 ptr = buf;
8883 int tmp = OP_glMemoryBarrier;memcpy(ptr, &tmp, 4); ptr += 4;
8884 memcpy(ptr, &totalSize, 4); ptr += 4;
8885
8886 memcpy(ptr, &barriers, 4); ptr += 4;
8887
8888 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8889 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8890
8891}
8892
8893void glMemoryBarrierByRegion_enc(void *self , GLbitfield barriers)
8894{
8895
8896 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8897 IOStream *stream = ctx->m_stream;
8898 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8899 bool useChecksum = checksumCalculator->getVersion() > 0;
8900
8901 unsigned char *ptr;
8902 unsigned char *buf;
8903 const size_t sizeWithoutChecksum = 8 + 4;
8904 const size_t checksumSize = checksumCalculator->checksumByteSize();
8905 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8906 buf = stream->alloc(totalSize);
8907 ptr = buf;
8908 int tmp = OP_glMemoryBarrierByRegion;memcpy(ptr, &tmp, 4); ptr += 4;
8909 memcpy(ptr, &totalSize, 4); ptr += 4;
8910
8911 memcpy(ptr, &barriers, 4); ptr += 4;
8912
8913 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8914 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8915
8916}
8917
8918void glGenProgramPipelines_enc(void *self , GLsizei n, GLuint* pipelines)
8919{
8920
8921 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8922 IOStream *stream = ctx->m_stream;
8923 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8924 bool useChecksum = checksumCalculator->getVersion() > 0;
8925
8926 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8927 unsigned char *ptr;
8928 unsigned char *buf;
8929 const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4;
8930 const size_t checksumSize = checksumCalculator->checksumByteSize();
8931 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8932 buf = stream->alloc(totalSize);
8933 ptr = buf;
8934 int tmp = OP_glGenProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8935 memcpy(ptr, &totalSize, 4); ptr += 4;
8936
8937 memcpy(ptr, &n, 4); ptr += 4;
8938 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8939
8940 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8941 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8942
8943 stream->readback(pipelines, __size_pipelines);
8944 if (useChecksum) checksumCalculator->addBuffer(pipelines, __size_pipelines);
8945 if (useChecksum) {
8946 unsigned char *checksumBufPtr = NULL;
8947 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
8948 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
8949 stream->readback(checksumBufPtr, checksumSize);
8950 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
8951 ALOGE("glGenProgramPipelines: GL communication error, please report this issue to b.android.com.\n");
8952 abort();
8953 }
8954 }
8955}
8956
8957void glDeleteProgramPipelines_enc(void *self , GLsizei n, const GLuint* pipelines)
8958{
8959
8960 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8961 IOStream *stream = ctx->m_stream;
8962 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8963 bool useChecksum = checksumCalculator->getVersion() > 0;
8964
8965 const unsigned int __size_pipelines = (n * sizeof(GLuint));
8966 unsigned char *ptr;
8967 unsigned char *buf;
8968 const size_t sizeWithoutChecksum = 8 + 4 + __size_pipelines + 1*4;
8969 const size_t checksumSize = checksumCalculator->checksumByteSize();
8970 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8971 buf = stream->alloc(totalSize);
8972 ptr = buf;
8973 int tmp = OP_glDeleteProgramPipelines;memcpy(ptr, &tmp, 4); ptr += 4;
8974 memcpy(ptr, &totalSize, 4); ptr += 4;
8975
8976 memcpy(ptr, &n, 4); ptr += 4;
8977 *(unsigned int *)(ptr) = __size_pipelines; ptr += 4;
8978 memcpy(ptr, pipelines, __size_pipelines);ptr += __size_pipelines;
8979
8980 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
8981 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
8982
8983}
8984
8985void glBindProgramPipeline_enc(void *self , GLuint pipeline)
8986{
8987
8988 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
8989 IOStream *stream = ctx->m_stream;
8990 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
8991 bool useChecksum = checksumCalculator->getVersion() > 0;
8992
8993 unsigned char *ptr;
8994 unsigned char *buf;
8995 const size_t sizeWithoutChecksum = 8 + 4;
8996 const size_t checksumSize = checksumCalculator->checksumByteSize();
8997 const size_t totalSize = sizeWithoutChecksum + checksumSize;
8998 buf = stream->alloc(totalSize);
8999 ptr = buf;
9000 int tmp = OP_glBindProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9001 memcpy(ptr, &totalSize, 4); ptr += 4;
9002
9003 memcpy(ptr, &pipeline, 4); ptr += 4;
9004
9005 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9006 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9007
9008}
9009
9010void glGetProgramPipelineiv_enc(void *self , GLuint pipeline, GLenum pname, GLint* params)
9011{
9012
9013 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9014 IOStream *stream = ctx->m_stream;
9015 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9016 bool useChecksum = checksumCalculator->getVersion() > 0;
9017
9018 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
9019 unsigned char *ptr;
9020 unsigned char *buf;
9021 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
9022 const size_t checksumSize = checksumCalculator->checksumByteSize();
9023 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9024 buf = stream->alloc(totalSize);
9025 ptr = buf;
9026 int tmp = OP_glGetProgramPipelineiv;memcpy(ptr, &tmp, 4); ptr += 4;
9027 memcpy(ptr, &totalSize, 4); ptr += 4;
9028
9029 memcpy(ptr, &pipeline, 4); ptr += 4;
9030 memcpy(ptr, &pname, 4); ptr += 4;
9031 *(unsigned int *)(ptr) = __size_params; ptr += 4;
9032
9033 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9034 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9035
9036 stream->readback(params, __size_params);
9037 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
9038 if (useChecksum) {
9039 unsigned char *checksumBufPtr = NULL;
9040 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9041 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9042 stream->readback(checksumBufPtr, checksumSize);
9043 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9044 ALOGE("glGetProgramPipelineiv: GL communication error, please report this issue to b.android.com.\n");
9045 abort();
9046 }
9047 }
9048}
9049
9050void glGetProgramPipelineInfoLog_enc(void *self , GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog)
9051{
9052
9053 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9054 IOStream *stream = ctx->m_stream;
9055 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9056 bool useChecksum = checksumCalculator->getVersion() > 0;
9057
9058 const unsigned int __size_length = ((length != NULL) ? sizeof(GLsizei) : 0);
9059 const unsigned int __size_infoLog = bufSize;
9060 unsigned char *ptr;
9061 unsigned char *buf;
9062 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 0 + 2*4;
9063 const size_t checksumSize = checksumCalculator->checksumByteSize();
9064 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9065 buf = stream->alloc(totalSize);
9066 ptr = buf;
9067 int tmp = OP_glGetProgramPipelineInfoLog;memcpy(ptr, &tmp, 4); ptr += 4;
9068 memcpy(ptr, &totalSize, 4); ptr += 4;
9069
9070 memcpy(ptr, &pipeline, 4); ptr += 4;
9071 memcpy(ptr, &bufSize, 4); ptr += 4;
9072 *(unsigned int *)(ptr) = __size_length; ptr += 4;
9073 *(unsigned int *)(ptr) = __size_infoLog; ptr += 4;
9074
9075 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9076 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9077
9078 if (length != NULL) {
9079 stream->readback(length, __size_length);
9080 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
9081 }
9082 stream->readback(infoLog, __size_infoLog);
9083 if (useChecksum) checksumCalculator->addBuffer(infoLog, __size_infoLog);
9084 if (useChecksum) {
9085 unsigned char *checksumBufPtr = NULL;
9086 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9087 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9088 stream->readback(checksumBufPtr, checksumSize);
9089 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9090 ALOGE("glGetProgramPipelineInfoLog: GL communication error, please report this issue to b.android.com.\n");
9091 abort();
9092 }
9093 }
9094}
9095
9096void glValidateProgramPipeline_enc(void *self , GLuint pipeline)
9097{
9098
9099 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9100 IOStream *stream = ctx->m_stream;
9101 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9102 bool useChecksum = checksumCalculator->getVersion() > 0;
9103
9104 unsigned char *ptr;
9105 unsigned char *buf;
9106 const size_t sizeWithoutChecksum = 8 + 4;
9107 const size_t checksumSize = checksumCalculator->checksumByteSize();
9108 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9109 buf = stream->alloc(totalSize);
9110 ptr = buf;
9111 int tmp = OP_glValidateProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9112 memcpy(ptr, &totalSize, 4); ptr += 4;
9113
9114 memcpy(ptr, &pipeline, 4); ptr += 4;
9115
9116 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9117 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9118
9119}
9120
9121GLboolean glIsProgramPipeline_enc(void *self , GLuint pipeline)
9122{
9123
9124 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9125 IOStream *stream = ctx->m_stream;
9126 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9127 bool useChecksum = checksumCalculator->getVersion() > 0;
9128
9129 unsigned char *ptr;
9130 unsigned char *buf;
9131 const size_t sizeWithoutChecksum = 8 + 4;
9132 const size_t checksumSize = checksumCalculator->checksumByteSize();
9133 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9134 buf = stream->alloc(totalSize);
9135 ptr = buf;
9136 int tmp = OP_glIsProgramPipeline;memcpy(ptr, &tmp, 4); ptr += 4;
9137 memcpy(ptr, &totalSize, 4); ptr += 4;
9138
9139 memcpy(ptr, &pipeline, 4); ptr += 4;
9140
9141 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9142 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9143
9144
9145 GLboolean retval;
9146 stream->readback(&retval, 1);
9147 if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
9148 if (useChecksum) {
9149 unsigned char *checksumBufPtr = NULL;
9150 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9151 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9152 stream->readback(checksumBufPtr, checksumSize);
9153 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9154 ALOGE("glIsProgramPipeline: GL communication error, please report this issue to b.android.com.\n");
9155 abort();
9156 }
9157 }
9158 return retval;
9159}
9160
9161void glUseProgramStages_enc(void *self , GLuint pipeline, GLbitfield stages, GLuint program)
9162{
9163
9164 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9165 IOStream *stream = ctx->m_stream;
9166 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9167 bool useChecksum = checksumCalculator->getVersion() > 0;
9168
9169 unsigned char *ptr;
9170 unsigned char *buf;
9171 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9172 const size_t checksumSize = checksumCalculator->checksumByteSize();
9173 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9174 buf = stream->alloc(totalSize);
9175 ptr = buf;
9176 int tmp = OP_glUseProgramStages;memcpy(ptr, &tmp, 4); ptr += 4;
9177 memcpy(ptr, &totalSize, 4); ptr += 4;
9178
9179 memcpy(ptr, &pipeline, 4); ptr += 4;
9180 memcpy(ptr, &stages, 4); ptr += 4;
9181 memcpy(ptr, &program, 4); ptr += 4;
9182
9183 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9184 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9185
9186}
9187
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009188void glActiveShaderProgram_enc(void *self , GLuint pipeline, GLuint program)
9189{
9190
9191 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9192 IOStream *stream = ctx->m_stream;
9193 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9194 bool useChecksum = checksumCalculator->getVersion() > 0;
9195
9196 unsigned char *ptr;
9197 unsigned char *buf;
9198 const size_t sizeWithoutChecksum = 8 + 4 + 4;
9199 const size_t checksumSize = checksumCalculator->checksumByteSize();
9200 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9201 buf = stream->alloc(totalSize);
9202 ptr = buf;
9203 int tmp = OP_glActiveShaderProgram;memcpy(ptr, &tmp, 4); ptr += 4;
9204 memcpy(ptr, &totalSize, 4); ptr += 4;
9205
9206 memcpy(ptr, &pipeline, 4); ptr += 4;
9207 memcpy(ptr, &program, 4); ptr += 4;
9208
9209 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9210 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9211
9212}
9213
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009214GLuint glCreateShaderProgramvAEMU_enc(void *self , GLenum type, GLsizei count, const char* packedStrings, GLuint packedLen)
9215{
9216
9217 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9218 IOStream *stream = ctx->m_stream;
9219 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9220 bool useChecksum = checksumCalculator->getVersion() > 0;
9221
9222 const unsigned int __size_packedStrings = packedLen;
9223 unsigned char *ptr;
9224 unsigned char *buf;
9225 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_packedStrings + 4 + 1*4;
9226 const size_t checksumSize = checksumCalculator->checksumByteSize();
9227 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9228 buf = stream->alloc(totalSize);
9229 ptr = buf;
9230 int tmp = OP_glCreateShaderProgramvAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
9231 memcpy(ptr, &totalSize, 4); ptr += 4;
9232
9233 memcpy(ptr, &type, 4); ptr += 4;
9234 memcpy(ptr, &count, 4); ptr += 4;
9235 *(unsigned int *)(ptr) = __size_packedStrings; ptr += 4;
9236 memcpy(ptr, packedStrings, __size_packedStrings);ptr += __size_packedStrings;
9237 memcpy(ptr, &packedLen, 4); ptr += 4;
9238
9239 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9240 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9241
9242
9243 GLuint retval;
9244 stream->readback(&retval, 4);
9245 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
9246 if (useChecksum) {
9247 unsigned char *checksumBufPtr = NULL;
9248 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
9249 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
9250 stream->readback(checksumBufPtr, checksumSize);
9251 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
9252 ALOGE("glCreateShaderProgramvAEMU: GL communication error, please report this issue to b.android.com.\n");
9253 abort();
9254 }
9255 }
9256 return retval;
9257}
9258
9259void glProgramUniform1f_enc(void *self , GLuint program, GLint location, GLfloat v0)
9260{
9261
9262 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9263 IOStream *stream = ctx->m_stream;
9264 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9265 bool useChecksum = checksumCalculator->getVersion() > 0;
9266
9267 unsigned char *ptr;
9268 unsigned char *buf;
9269 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9270 const size_t checksumSize = checksumCalculator->checksumByteSize();
9271 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9272 buf = stream->alloc(totalSize);
9273 ptr = buf;
9274 int tmp = OP_glProgramUniform1f;memcpy(ptr, &tmp, 4); ptr += 4;
9275 memcpy(ptr, &totalSize, 4); ptr += 4;
9276
9277 memcpy(ptr, &program, 4); ptr += 4;
9278 memcpy(ptr, &location, 4); ptr += 4;
9279 memcpy(ptr, &v0, 4); ptr += 4;
9280
9281 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9282 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9283
9284}
9285
9286void glProgramUniform2f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1)
9287{
9288
9289 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9290 IOStream *stream = ctx->m_stream;
9291 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9292 bool useChecksum = checksumCalculator->getVersion() > 0;
9293
9294 unsigned char *ptr;
9295 unsigned char *buf;
9296 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9297 const size_t checksumSize = checksumCalculator->checksumByteSize();
9298 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9299 buf = stream->alloc(totalSize);
9300 ptr = buf;
9301 int tmp = OP_glProgramUniform2f;memcpy(ptr, &tmp, 4); ptr += 4;
9302 memcpy(ptr, &totalSize, 4); ptr += 4;
9303
9304 memcpy(ptr, &program, 4); ptr += 4;
9305 memcpy(ptr, &location, 4); ptr += 4;
9306 memcpy(ptr, &v0, 4); ptr += 4;
9307 memcpy(ptr, &v1, 4); ptr += 4;
9308
9309 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9310 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9311
9312}
9313
9314void glProgramUniform3f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
9315{
9316
9317 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9318 IOStream *stream = ctx->m_stream;
9319 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9320 bool useChecksum = checksumCalculator->getVersion() > 0;
9321
9322 unsigned char *ptr;
9323 unsigned char *buf;
9324 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9325 const size_t checksumSize = checksumCalculator->checksumByteSize();
9326 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9327 buf = stream->alloc(totalSize);
9328 ptr = buf;
9329 int tmp = OP_glProgramUniform3f;memcpy(ptr, &tmp, 4); ptr += 4;
9330 memcpy(ptr, &totalSize, 4); ptr += 4;
9331
9332 memcpy(ptr, &program, 4); ptr += 4;
9333 memcpy(ptr, &location, 4); ptr += 4;
9334 memcpy(ptr, &v0, 4); ptr += 4;
9335 memcpy(ptr, &v1, 4); ptr += 4;
9336 memcpy(ptr, &v2, 4); ptr += 4;
9337
9338 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9339 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9340
9341}
9342
9343void glProgramUniform4f_enc(void *self , GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
9344{
9345
9346 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9347 IOStream *stream = ctx->m_stream;
9348 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9349 bool useChecksum = checksumCalculator->getVersion() > 0;
9350
9351 unsigned char *ptr;
9352 unsigned char *buf;
9353 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9354 const size_t checksumSize = checksumCalculator->checksumByteSize();
9355 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9356 buf = stream->alloc(totalSize);
9357 ptr = buf;
9358 int tmp = OP_glProgramUniform4f;memcpy(ptr, &tmp, 4); ptr += 4;
9359 memcpy(ptr, &totalSize, 4); ptr += 4;
9360
9361 memcpy(ptr, &program, 4); ptr += 4;
9362 memcpy(ptr, &location, 4); ptr += 4;
9363 memcpy(ptr, &v0, 4); ptr += 4;
9364 memcpy(ptr, &v1, 4); ptr += 4;
9365 memcpy(ptr, &v2, 4); ptr += 4;
9366 memcpy(ptr, &v3, 4); ptr += 4;
9367
9368 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9369 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9370
9371}
9372
9373void glProgramUniform1i_enc(void *self , GLuint program, GLint location, GLint v0)
9374{
9375
9376 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9377 IOStream *stream = ctx->m_stream;
9378 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9379 bool useChecksum = checksumCalculator->getVersion() > 0;
9380
9381 unsigned char *ptr;
9382 unsigned char *buf;
9383 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9384 const size_t checksumSize = checksumCalculator->checksumByteSize();
9385 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9386 buf = stream->alloc(totalSize);
9387 ptr = buf;
9388 int tmp = OP_glProgramUniform1i;memcpy(ptr, &tmp, 4); ptr += 4;
9389 memcpy(ptr, &totalSize, 4); ptr += 4;
9390
9391 memcpy(ptr, &program, 4); ptr += 4;
9392 memcpy(ptr, &location, 4); ptr += 4;
9393 memcpy(ptr, &v0, 4); ptr += 4;
9394
9395 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9396 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9397
9398}
9399
9400void glProgramUniform2i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1)
9401{
9402
9403 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9404 IOStream *stream = ctx->m_stream;
9405 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9406 bool useChecksum = checksumCalculator->getVersion() > 0;
9407
9408 unsigned char *ptr;
9409 unsigned char *buf;
9410 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9411 const size_t checksumSize = checksumCalculator->checksumByteSize();
9412 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9413 buf = stream->alloc(totalSize);
9414 ptr = buf;
9415 int tmp = OP_glProgramUniform2i;memcpy(ptr, &tmp, 4); ptr += 4;
9416 memcpy(ptr, &totalSize, 4); ptr += 4;
9417
9418 memcpy(ptr, &program, 4); ptr += 4;
9419 memcpy(ptr, &location, 4); ptr += 4;
9420 memcpy(ptr, &v0, 4); ptr += 4;
9421 memcpy(ptr, &v1, 4); ptr += 4;
9422
9423 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9424 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9425
9426}
9427
9428void glProgramUniform3i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
9429{
9430
9431 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9432 IOStream *stream = ctx->m_stream;
9433 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9434 bool useChecksum = checksumCalculator->getVersion() > 0;
9435
9436 unsigned char *ptr;
9437 unsigned char *buf;
9438 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9439 const size_t checksumSize = checksumCalculator->checksumByteSize();
9440 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9441 buf = stream->alloc(totalSize);
9442 ptr = buf;
9443 int tmp = OP_glProgramUniform3i;memcpy(ptr, &tmp, 4); ptr += 4;
9444 memcpy(ptr, &totalSize, 4); ptr += 4;
9445
9446 memcpy(ptr, &program, 4); ptr += 4;
9447 memcpy(ptr, &location, 4); ptr += 4;
9448 memcpy(ptr, &v0, 4); ptr += 4;
9449 memcpy(ptr, &v1, 4); ptr += 4;
9450 memcpy(ptr, &v2, 4); ptr += 4;
9451
9452 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9453 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9454
9455}
9456
9457void glProgramUniform4i_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
9458{
9459
9460 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9461 IOStream *stream = ctx->m_stream;
9462 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9463 bool useChecksum = checksumCalculator->getVersion() > 0;
9464
9465 unsigned char *ptr;
9466 unsigned char *buf;
9467 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9468 const size_t checksumSize = checksumCalculator->checksumByteSize();
9469 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9470 buf = stream->alloc(totalSize);
9471 ptr = buf;
9472 int tmp = OP_glProgramUniform4i;memcpy(ptr, &tmp, 4); ptr += 4;
9473 memcpy(ptr, &totalSize, 4); ptr += 4;
9474
9475 memcpy(ptr, &program, 4); ptr += 4;
9476 memcpy(ptr, &location, 4); ptr += 4;
9477 memcpy(ptr, &v0, 4); ptr += 4;
9478 memcpy(ptr, &v1, 4); ptr += 4;
9479 memcpy(ptr, &v2, 4); ptr += 4;
9480 memcpy(ptr, &v3, 4); ptr += 4;
9481
9482 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9483 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9484
9485}
9486
9487void glProgramUniform1ui_enc(void *self , GLuint program, GLint location, GLuint v0)
9488{
9489
9490 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9491 IOStream *stream = ctx->m_stream;
9492 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9493 bool useChecksum = checksumCalculator->getVersion() > 0;
9494
9495 unsigned char *ptr;
9496 unsigned char *buf;
9497 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
9498 const size_t checksumSize = checksumCalculator->checksumByteSize();
9499 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9500 buf = stream->alloc(totalSize);
9501 ptr = buf;
9502 int tmp = OP_glProgramUniform1ui;memcpy(ptr, &tmp, 4); ptr += 4;
9503 memcpy(ptr, &totalSize, 4); ptr += 4;
9504
9505 memcpy(ptr, &program, 4); ptr += 4;
9506 memcpy(ptr, &location, 4); ptr += 4;
9507 memcpy(ptr, &v0, 4); ptr += 4;
9508
9509 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9510 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9511
9512}
9513
9514void glProgramUniform2ui_enc(void *self , GLuint program, GLint location, GLint v0, GLuint v1)
9515{
9516
9517 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9518 IOStream *stream = ctx->m_stream;
9519 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9520 bool useChecksum = checksumCalculator->getVersion() > 0;
9521
9522 unsigned char *ptr;
9523 unsigned char *buf;
9524 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
9525 const size_t checksumSize = checksumCalculator->checksumByteSize();
9526 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9527 buf = stream->alloc(totalSize);
9528 ptr = buf;
9529 int tmp = OP_glProgramUniform2ui;memcpy(ptr, &tmp, 4); ptr += 4;
9530 memcpy(ptr, &totalSize, 4); ptr += 4;
9531
9532 memcpy(ptr, &program, 4); ptr += 4;
9533 memcpy(ptr, &location, 4); ptr += 4;
9534 memcpy(ptr, &v0, 4); ptr += 4;
9535 memcpy(ptr, &v1, 4); ptr += 4;
9536
9537 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9538 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9539
9540}
9541
9542void glProgramUniform3ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
9543{
9544
9545 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9546 IOStream *stream = ctx->m_stream;
9547 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9548 bool useChecksum = checksumCalculator->getVersion() > 0;
9549
9550 unsigned char *ptr;
9551 unsigned char *buf;
9552 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4;
9553 const size_t checksumSize = checksumCalculator->checksumByteSize();
9554 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9555 buf = stream->alloc(totalSize);
9556 ptr = buf;
9557 int tmp = OP_glProgramUniform3ui;memcpy(ptr, &tmp, 4); ptr += 4;
9558 memcpy(ptr, &totalSize, 4); ptr += 4;
9559
9560 memcpy(ptr, &program, 4); ptr += 4;
9561 memcpy(ptr, &location, 4); ptr += 4;
9562 memcpy(ptr, &v0, 4); ptr += 4;
9563 memcpy(ptr, &v1, 4); ptr += 4;
9564 memcpy(ptr, &v2, 4); ptr += 4;
9565
9566 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9567 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9568
9569}
9570
9571void glProgramUniform4ui_enc(void *self , GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
9572{
9573
9574 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9575 IOStream *stream = ctx->m_stream;
9576 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9577 bool useChecksum = checksumCalculator->getVersion() > 0;
9578
9579 unsigned char *ptr;
9580 unsigned char *buf;
9581 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4;
9582 const size_t checksumSize = checksumCalculator->checksumByteSize();
9583 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9584 buf = stream->alloc(totalSize);
9585 ptr = buf;
9586 int tmp = OP_glProgramUniform4ui;memcpy(ptr, &tmp, 4); ptr += 4;
9587 memcpy(ptr, &totalSize, 4); ptr += 4;
9588
9589 memcpy(ptr, &program, 4); ptr += 4;
9590 memcpy(ptr, &location, 4); ptr += 4;
9591 memcpy(ptr, &v0, 4); ptr += 4;
9592 memcpy(ptr, &v1, 4); ptr += 4;
9593 memcpy(ptr, &v2, 4); ptr += 4;
9594 memcpy(ptr, &v3, 4); ptr += 4;
9595
9596 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9597 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9598
9599}
9600
9601void glProgramUniform1fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9602{
9603
9604 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9605 IOStream *stream = ctx->m_stream;
9606 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9607 bool useChecksum = checksumCalculator->getVersion() > 0;
9608
9609 const unsigned int __size_value = (count * sizeof(GLfloat));
9610 unsigned char *ptr;
9611 unsigned char *buf;
9612 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9613 const size_t checksumSize = checksumCalculator->checksumByteSize();
9614 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9615 buf = stream->alloc(totalSize);
9616 ptr = buf;
9617 int tmp = OP_glProgramUniform1fv;memcpy(ptr, &tmp, 4); ptr += 4;
9618 memcpy(ptr, &totalSize, 4); ptr += 4;
9619
9620 memcpy(ptr, &program, 4); ptr += 4;
9621 memcpy(ptr, &location, 4); ptr += 4;
9622 memcpy(ptr, &count, 4); ptr += 4;
9623 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9624 memcpy(ptr, value, __size_value);ptr += __size_value;
9625
9626 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9627 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9628
9629}
9630
9631void glProgramUniform2fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9632{
9633
9634 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9635 IOStream *stream = ctx->m_stream;
9636 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9637 bool useChecksum = checksumCalculator->getVersion() > 0;
9638
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009639 const unsigned int __size_value = (count * 2 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009640 unsigned char *ptr;
9641 unsigned char *buf;
9642 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9643 const size_t checksumSize = checksumCalculator->checksumByteSize();
9644 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9645 buf = stream->alloc(totalSize);
9646 ptr = buf;
9647 int tmp = OP_glProgramUniform2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9648 memcpy(ptr, &totalSize, 4); ptr += 4;
9649
9650 memcpy(ptr, &program, 4); ptr += 4;
9651 memcpy(ptr, &location, 4); ptr += 4;
9652 memcpy(ptr, &count, 4); ptr += 4;
9653 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9654 memcpy(ptr, value, __size_value);ptr += __size_value;
9655
9656 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9657 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9658
9659}
9660
9661void glProgramUniform3fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9662{
9663
9664 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9665 IOStream *stream = ctx->m_stream;
9666 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9667 bool useChecksum = checksumCalculator->getVersion() > 0;
9668
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009669 const unsigned int __size_value = (count * 3 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009670 unsigned char *ptr;
9671 unsigned char *buf;
9672 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9673 const size_t checksumSize = checksumCalculator->checksumByteSize();
9674 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9675 buf = stream->alloc(totalSize);
9676 ptr = buf;
9677 int tmp = OP_glProgramUniform3fv;memcpy(ptr, &tmp, 4); ptr += 4;
9678 memcpy(ptr, &totalSize, 4); ptr += 4;
9679
9680 memcpy(ptr, &program, 4); ptr += 4;
9681 memcpy(ptr, &location, 4); ptr += 4;
9682 memcpy(ptr, &count, 4); ptr += 4;
9683 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9684 memcpy(ptr, value, __size_value);ptr += __size_value;
9685
9686 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9687 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9688
9689}
9690
9691void glProgramUniform4fv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLfloat* value)
9692{
9693
9694 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9695 IOStream *stream = ctx->m_stream;
9696 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9697 bool useChecksum = checksumCalculator->getVersion() > 0;
9698
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009699 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009700 unsigned char *ptr;
9701 unsigned char *buf;
9702 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9703 const size_t checksumSize = checksumCalculator->checksumByteSize();
9704 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9705 buf = stream->alloc(totalSize);
9706 ptr = buf;
9707 int tmp = OP_glProgramUniform4fv;memcpy(ptr, &tmp, 4); ptr += 4;
9708 memcpy(ptr, &totalSize, 4); ptr += 4;
9709
9710 memcpy(ptr, &program, 4); ptr += 4;
9711 memcpy(ptr, &location, 4); ptr += 4;
9712 memcpy(ptr, &count, 4); ptr += 4;
9713 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9714 memcpy(ptr, value, __size_value);ptr += __size_value;
9715
9716 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9717 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9718
9719}
9720
9721void glProgramUniform1iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9722{
9723
9724 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9725 IOStream *stream = ctx->m_stream;
9726 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9727 bool useChecksum = checksumCalculator->getVersion() > 0;
9728
9729 const unsigned int __size_value = (count * sizeof(GLint));
9730 unsigned char *ptr;
9731 unsigned char *buf;
9732 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9733 const size_t checksumSize = checksumCalculator->checksumByteSize();
9734 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9735 buf = stream->alloc(totalSize);
9736 ptr = buf;
9737 int tmp = OP_glProgramUniform1iv;memcpy(ptr, &tmp, 4); ptr += 4;
9738 memcpy(ptr, &totalSize, 4); ptr += 4;
9739
9740 memcpy(ptr, &program, 4); ptr += 4;
9741 memcpy(ptr, &location, 4); ptr += 4;
9742 memcpy(ptr, &count, 4); ptr += 4;
9743 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9744 memcpy(ptr, value, __size_value);ptr += __size_value;
9745
9746 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9747 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9748
9749}
9750
9751void glProgramUniform2iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9752{
9753
9754 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9755 IOStream *stream = ctx->m_stream;
9756 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9757 bool useChecksum = checksumCalculator->getVersion() > 0;
9758
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009759 const unsigned int __size_value = (count * 2 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009760 unsigned char *ptr;
9761 unsigned char *buf;
9762 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9763 const size_t checksumSize = checksumCalculator->checksumByteSize();
9764 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9765 buf = stream->alloc(totalSize);
9766 ptr = buf;
9767 int tmp = OP_glProgramUniform2iv;memcpy(ptr, &tmp, 4); ptr += 4;
9768 memcpy(ptr, &totalSize, 4); ptr += 4;
9769
9770 memcpy(ptr, &program, 4); ptr += 4;
9771 memcpy(ptr, &location, 4); ptr += 4;
9772 memcpy(ptr, &count, 4); ptr += 4;
9773 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9774 memcpy(ptr, value, __size_value);ptr += __size_value;
9775
9776 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9777 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9778
9779}
9780
9781void glProgramUniform3iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9782{
9783
9784 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9785 IOStream *stream = ctx->m_stream;
9786 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9787 bool useChecksum = checksumCalculator->getVersion() > 0;
9788
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009789 const unsigned int __size_value = (count * 3 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009790 unsigned char *ptr;
9791 unsigned char *buf;
9792 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9793 const size_t checksumSize = checksumCalculator->checksumByteSize();
9794 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9795 buf = stream->alloc(totalSize);
9796 ptr = buf;
9797 int tmp = OP_glProgramUniform3iv;memcpy(ptr, &tmp, 4); ptr += 4;
9798 memcpy(ptr, &totalSize, 4); ptr += 4;
9799
9800 memcpy(ptr, &program, 4); ptr += 4;
9801 memcpy(ptr, &location, 4); ptr += 4;
9802 memcpy(ptr, &count, 4); ptr += 4;
9803 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9804 memcpy(ptr, value, __size_value);ptr += __size_value;
9805
9806 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9807 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9808
9809}
9810
9811void glProgramUniform4iv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLint* value)
9812{
9813
9814 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9815 IOStream *stream = ctx->m_stream;
9816 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9817 bool useChecksum = checksumCalculator->getVersion() > 0;
9818
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009819 const unsigned int __size_value = (count * 4 * sizeof(GLint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009820 unsigned char *ptr;
9821 unsigned char *buf;
9822 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9823 const size_t checksumSize = checksumCalculator->checksumByteSize();
9824 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9825 buf = stream->alloc(totalSize);
9826 ptr = buf;
9827 int tmp = OP_glProgramUniform4iv;memcpy(ptr, &tmp, 4); ptr += 4;
9828 memcpy(ptr, &totalSize, 4); ptr += 4;
9829
9830 memcpy(ptr, &program, 4); ptr += 4;
9831 memcpy(ptr, &location, 4); ptr += 4;
9832 memcpy(ptr, &count, 4); ptr += 4;
9833 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9834 memcpy(ptr, value, __size_value);ptr += __size_value;
9835
9836 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9837 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9838
9839}
9840
9841void glProgramUniform1uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9842{
9843
9844 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9845 IOStream *stream = ctx->m_stream;
9846 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9847 bool useChecksum = checksumCalculator->getVersion() > 0;
9848
9849 const unsigned int __size_value = (count * sizeof(GLuint));
9850 unsigned char *ptr;
9851 unsigned char *buf;
9852 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9853 const size_t checksumSize = checksumCalculator->checksumByteSize();
9854 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9855 buf = stream->alloc(totalSize);
9856 ptr = buf;
9857 int tmp = OP_glProgramUniform1uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9858 memcpy(ptr, &totalSize, 4); ptr += 4;
9859
9860 memcpy(ptr, &program, 4); ptr += 4;
9861 memcpy(ptr, &location, 4); ptr += 4;
9862 memcpy(ptr, &count, 4); ptr += 4;
9863 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9864 memcpy(ptr, value, __size_value);ptr += __size_value;
9865
9866 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9867 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9868
9869}
9870
9871void glProgramUniform2uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9872{
9873
9874 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9875 IOStream *stream = ctx->m_stream;
9876 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9877 bool useChecksum = checksumCalculator->getVersion() > 0;
9878
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009879 const unsigned int __size_value = (count * 2 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009880 unsigned char *ptr;
9881 unsigned char *buf;
9882 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9883 const size_t checksumSize = checksumCalculator->checksumByteSize();
9884 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9885 buf = stream->alloc(totalSize);
9886 ptr = buf;
9887 int tmp = OP_glProgramUniform2uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9888 memcpy(ptr, &totalSize, 4); ptr += 4;
9889
9890 memcpy(ptr, &program, 4); ptr += 4;
9891 memcpy(ptr, &location, 4); ptr += 4;
9892 memcpy(ptr, &count, 4); ptr += 4;
9893 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9894 memcpy(ptr, value, __size_value);ptr += __size_value;
9895
9896 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9897 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9898
9899}
9900
9901void glProgramUniform3uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9902{
9903
9904 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9905 IOStream *stream = ctx->m_stream;
9906 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9907 bool useChecksum = checksumCalculator->getVersion() > 0;
9908
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009909 const unsigned int __size_value = (count * 3 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009910 unsigned char *ptr;
9911 unsigned char *buf;
9912 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9913 const size_t checksumSize = checksumCalculator->checksumByteSize();
9914 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9915 buf = stream->alloc(totalSize);
9916 ptr = buf;
9917 int tmp = OP_glProgramUniform3uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9918 memcpy(ptr, &totalSize, 4); ptr += 4;
9919
9920 memcpy(ptr, &program, 4); ptr += 4;
9921 memcpy(ptr, &location, 4); ptr += 4;
9922 memcpy(ptr, &count, 4); ptr += 4;
9923 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9924 memcpy(ptr, value, __size_value);ptr += __size_value;
9925
9926 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9927 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9928
9929}
9930
9931void glProgramUniform4uiv_enc(void *self , GLuint program, GLint location, GLsizei count, const GLuint* value)
9932{
9933
9934 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9935 IOStream *stream = ctx->m_stream;
9936 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9937 bool useChecksum = checksumCalculator->getVersion() > 0;
9938
Lingfeng Yangd3ae1062017-01-18 11:42:04 -08009939 const unsigned int __size_value = (count * 4 * sizeof(GLuint));
Lingfeng Yange6556dc2017-01-09 12:04:12 -08009940 unsigned char *ptr;
9941 unsigned char *buf;
9942 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + __size_value + 1*4;
9943 const size_t checksumSize = checksumCalculator->checksumByteSize();
9944 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9945 buf = stream->alloc(totalSize);
9946 ptr = buf;
9947 int tmp = OP_glProgramUniform4uiv;memcpy(ptr, &tmp, 4); ptr += 4;
9948 memcpy(ptr, &totalSize, 4); ptr += 4;
9949
9950 memcpy(ptr, &program, 4); ptr += 4;
9951 memcpy(ptr, &location, 4); ptr += 4;
9952 memcpy(ptr, &count, 4); ptr += 4;
9953 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9954 memcpy(ptr, value, __size_value);ptr += __size_value;
9955
9956 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9957 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9958
9959}
9960
9961void glProgramUniformMatrix2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9962{
9963
9964 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9965 IOStream *stream = ctx->m_stream;
9966 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9967 bool useChecksum = checksumCalculator->getVersion() > 0;
9968
9969 const unsigned int __size_value = (count * 4 * sizeof(GLfloat));
9970 unsigned char *ptr;
9971 unsigned char *buf;
9972 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
9973 const size_t checksumSize = checksumCalculator->checksumByteSize();
9974 const size_t totalSize = sizeWithoutChecksum + checksumSize;
9975 buf = stream->alloc(totalSize);
9976 ptr = buf;
9977 int tmp = OP_glProgramUniformMatrix2fv;memcpy(ptr, &tmp, 4); ptr += 4;
9978 memcpy(ptr, &totalSize, 4); ptr += 4;
9979
9980 memcpy(ptr, &program, 4); ptr += 4;
9981 memcpy(ptr, &location, 4); ptr += 4;
9982 memcpy(ptr, &count, 4); ptr += 4;
9983 memcpy(ptr, &transpose, 1); ptr += 1;
9984 *(unsigned int *)(ptr) = __size_value; ptr += 4;
9985 memcpy(ptr, value, __size_value);ptr += __size_value;
9986
9987 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
9988 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
9989
9990}
9991
9992void glProgramUniformMatrix3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
9993{
9994
9995 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
9996 IOStream *stream = ctx->m_stream;
9997 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
9998 bool useChecksum = checksumCalculator->getVersion() > 0;
9999
10000 const unsigned int __size_value = (count * 9 * sizeof(GLfloat));
10001 unsigned char *ptr;
10002 unsigned char *buf;
10003 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10004 const size_t checksumSize = checksumCalculator->checksumByteSize();
10005 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10006 buf = stream->alloc(totalSize);
10007 ptr = buf;
10008 int tmp = OP_glProgramUniformMatrix3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10009 memcpy(ptr, &totalSize, 4); ptr += 4;
10010
10011 memcpy(ptr, &program, 4); ptr += 4;
10012 memcpy(ptr, &location, 4); ptr += 4;
10013 memcpy(ptr, &count, 4); ptr += 4;
10014 memcpy(ptr, &transpose, 1); ptr += 1;
10015 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10016 memcpy(ptr, value, __size_value);ptr += __size_value;
10017
10018 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10019 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10020
10021}
10022
10023void glProgramUniformMatrix4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10024{
10025
10026 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10027 IOStream *stream = ctx->m_stream;
10028 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10029 bool useChecksum = checksumCalculator->getVersion() > 0;
10030
10031 const unsigned int __size_value = (count * 16 * sizeof(GLfloat));
10032 unsigned char *ptr;
10033 unsigned char *buf;
10034 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10035 const size_t checksumSize = checksumCalculator->checksumByteSize();
10036 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10037 buf = stream->alloc(totalSize);
10038 ptr = buf;
10039 int tmp = OP_glProgramUniformMatrix4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10040 memcpy(ptr, &totalSize, 4); ptr += 4;
10041
10042 memcpy(ptr, &program, 4); ptr += 4;
10043 memcpy(ptr, &location, 4); ptr += 4;
10044 memcpy(ptr, &count, 4); ptr += 4;
10045 memcpy(ptr, &transpose, 1); ptr += 1;
10046 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10047 memcpy(ptr, value, __size_value);ptr += __size_value;
10048
10049 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10050 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10051
10052}
10053
10054void glProgramUniformMatrix2x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10055{
10056
10057 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10058 IOStream *stream = ctx->m_stream;
10059 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10060 bool useChecksum = checksumCalculator->getVersion() > 0;
10061
10062 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10063 unsigned char *ptr;
10064 unsigned char *buf;
10065 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10066 const size_t checksumSize = checksumCalculator->checksumByteSize();
10067 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10068 buf = stream->alloc(totalSize);
10069 ptr = buf;
10070 int tmp = OP_glProgramUniformMatrix2x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10071 memcpy(ptr, &totalSize, 4); ptr += 4;
10072
10073 memcpy(ptr, &program, 4); ptr += 4;
10074 memcpy(ptr, &location, 4); ptr += 4;
10075 memcpy(ptr, &count, 4); ptr += 4;
10076 memcpy(ptr, &transpose, 1); ptr += 1;
10077 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10078 memcpy(ptr, value, __size_value);ptr += __size_value;
10079
10080 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10081 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10082
10083}
10084
10085void glProgramUniformMatrix3x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10086{
10087
10088 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10089 IOStream *stream = ctx->m_stream;
10090 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10091 bool useChecksum = checksumCalculator->getVersion() > 0;
10092
10093 const unsigned int __size_value = (count * 6 * sizeof(GLfloat));
10094 unsigned char *ptr;
10095 unsigned char *buf;
10096 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10097 const size_t checksumSize = checksumCalculator->checksumByteSize();
10098 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10099 buf = stream->alloc(totalSize);
10100 ptr = buf;
10101 int tmp = OP_glProgramUniformMatrix3x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10102 memcpy(ptr, &totalSize, 4); ptr += 4;
10103
10104 memcpy(ptr, &program, 4); ptr += 4;
10105 memcpy(ptr, &location, 4); ptr += 4;
10106 memcpy(ptr, &count, 4); ptr += 4;
10107 memcpy(ptr, &transpose, 1); ptr += 1;
10108 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10109 memcpy(ptr, value, __size_value);ptr += __size_value;
10110
10111 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10112 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10113
10114}
10115
10116void glProgramUniformMatrix2x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10117{
10118
10119 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10120 IOStream *stream = ctx->m_stream;
10121 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10122 bool useChecksum = checksumCalculator->getVersion() > 0;
10123
10124 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10125 unsigned char *ptr;
10126 unsigned char *buf;
10127 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10128 const size_t checksumSize = checksumCalculator->checksumByteSize();
10129 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10130 buf = stream->alloc(totalSize);
10131 ptr = buf;
10132 int tmp = OP_glProgramUniformMatrix2x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10133 memcpy(ptr, &totalSize, 4); ptr += 4;
10134
10135 memcpy(ptr, &program, 4); ptr += 4;
10136 memcpy(ptr, &location, 4); ptr += 4;
10137 memcpy(ptr, &count, 4); ptr += 4;
10138 memcpy(ptr, &transpose, 1); ptr += 1;
10139 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10140 memcpy(ptr, value, __size_value);ptr += __size_value;
10141
10142 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10143 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10144
10145}
10146
10147void glProgramUniformMatrix4x2fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10148{
10149
10150 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10151 IOStream *stream = ctx->m_stream;
10152 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10153 bool useChecksum = checksumCalculator->getVersion() > 0;
10154
10155 const unsigned int __size_value = (count * 8 * sizeof(GLfloat));
10156 unsigned char *ptr;
10157 unsigned char *buf;
10158 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10159 const size_t checksumSize = checksumCalculator->checksumByteSize();
10160 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10161 buf = stream->alloc(totalSize);
10162 ptr = buf;
10163 int tmp = OP_glProgramUniformMatrix4x2fv;memcpy(ptr, &tmp, 4); ptr += 4;
10164 memcpy(ptr, &totalSize, 4); ptr += 4;
10165
10166 memcpy(ptr, &program, 4); ptr += 4;
10167 memcpy(ptr, &location, 4); ptr += 4;
10168 memcpy(ptr, &count, 4); ptr += 4;
10169 memcpy(ptr, &transpose, 1); ptr += 1;
10170 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10171 memcpy(ptr, value, __size_value);ptr += __size_value;
10172
10173 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10174 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10175
10176}
10177
10178void glProgramUniformMatrix3x4fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10179{
10180
10181 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10182 IOStream *stream = ctx->m_stream;
10183 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10184 bool useChecksum = checksumCalculator->getVersion() > 0;
10185
10186 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10187 unsigned char *ptr;
10188 unsigned char *buf;
10189 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10190 const size_t checksumSize = checksumCalculator->checksumByteSize();
10191 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10192 buf = stream->alloc(totalSize);
10193 ptr = buf;
10194 int tmp = OP_glProgramUniformMatrix3x4fv;memcpy(ptr, &tmp, 4); ptr += 4;
10195 memcpy(ptr, &totalSize, 4); ptr += 4;
10196
10197 memcpy(ptr, &program, 4); ptr += 4;
10198 memcpy(ptr, &location, 4); ptr += 4;
10199 memcpy(ptr, &count, 4); ptr += 4;
10200 memcpy(ptr, &transpose, 1); ptr += 1;
10201 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10202 memcpy(ptr, value, __size_value);ptr += __size_value;
10203
10204 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10205 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10206
10207}
10208
10209void glProgramUniformMatrix4x3fv_enc(void *self , GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
10210{
10211
10212 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10213 IOStream *stream = ctx->m_stream;
10214 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10215 bool useChecksum = checksumCalculator->getVersion() > 0;
10216
10217 const unsigned int __size_value = (count * 12 * sizeof(GLfloat));
10218 unsigned char *ptr;
10219 unsigned char *buf;
10220 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + __size_value + 1*4;
10221 const size_t checksumSize = checksumCalculator->checksumByteSize();
10222 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10223 buf = stream->alloc(totalSize);
10224 ptr = buf;
10225 int tmp = OP_glProgramUniformMatrix4x3fv;memcpy(ptr, &tmp, 4); ptr += 4;
10226 memcpy(ptr, &totalSize, 4); ptr += 4;
10227
10228 memcpy(ptr, &program, 4); ptr += 4;
10229 memcpy(ptr, &location, 4); ptr += 4;
10230 memcpy(ptr, &count, 4); ptr += 4;
10231 memcpy(ptr, &transpose, 1); ptr += 1;
10232 *(unsigned int *)(ptr) = __size_value; ptr += 4;
10233 memcpy(ptr, value, __size_value);ptr += __size_value;
10234
10235 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10236 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10237
10238}
10239
10240void glGetProgramInterfaceiv_enc(void *self , GLuint program, GLenum programInterface, GLenum pname, GLint* params)
10241{
10242
10243 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10244 IOStream *stream = ctx->m_stream;
10245 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10246 bool useChecksum = checksumCalculator->getVersion() > 0;
10247
10248 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10249 unsigned char *ptr;
10250 unsigned char *buf;
10251 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10252 const size_t checksumSize = checksumCalculator->checksumByteSize();
10253 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10254 buf = stream->alloc(totalSize);
10255 ptr = buf;
10256 int tmp = OP_glGetProgramInterfaceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10257 memcpy(ptr, &totalSize, 4); ptr += 4;
10258
10259 memcpy(ptr, &program, 4); ptr += 4;
10260 memcpy(ptr, &programInterface, 4); ptr += 4;
10261 memcpy(ptr, &pname, 4); ptr += 4;
10262 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10263
10264 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10265 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10266
10267 stream->readback(params, __size_params);
10268 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10269 if (useChecksum) {
10270 unsigned char *checksumBufPtr = NULL;
10271 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10272 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10273 stream->readback(checksumBufPtr, checksumSize);
10274 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10275 ALOGE("glGetProgramInterfaceiv: GL communication error, please report this issue to b.android.com.\n");
10276 abort();
10277 }
10278 }
10279}
10280
10281void glGetProgramResourceiv_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum* props, GLsizei bufSize, GLsizei* length, GLint* params)
10282{
10283
10284 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10285 IOStream *stream = ctx->m_stream;
10286 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10287 bool useChecksum = checksumCalculator->getVersion() > 0;
10288
10289 const unsigned int __size_props = (propCount * sizeof(GLenum));
10290 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10291 const unsigned int __size_params = (bufSize * sizeof(GLint));
10292 unsigned char *ptr;
10293 unsigned char *buf;
10294 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + __size_props + 4 + 0 + 0 + 3*4;
10295 const size_t checksumSize = checksumCalculator->checksumByteSize();
10296 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10297 buf = stream->alloc(totalSize);
10298 ptr = buf;
10299 int tmp = OP_glGetProgramResourceiv;memcpy(ptr, &tmp, 4); ptr += 4;
10300 memcpy(ptr, &totalSize, 4); ptr += 4;
10301
10302 memcpy(ptr, &program, 4); ptr += 4;
10303 memcpy(ptr, &programInterface, 4); ptr += 4;
10304 memcpy(ptr, &index, 4); ptr += 4;
10305 memcpy(ptr, &propCount, 4); ptr += 4;
10306 *(unsigned int *)(ptr) = __size_props; ptr += 4;
10307 memcpy(ptr, props, __size_props);ptr += __size_props;
10308 memcpy(ptr, &bufSize, 4); ptr += 4;
10309 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10310 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10311
10312 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10313 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10314
10315 if (length != NULL) {
10316 stream->readback(length, __size_length);
10317 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10318 }
10319 stream->readback(params, __size_params);
10320 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10321 if (useChecksum) {
10322 unsigned char *checksumBufPtr = NULL;
10323 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10324 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10325 stream->readback(checksumBufPtr, checksumSize);
10326 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10327 ALOGE("glGetProgramResourceiv: GL communication error, please report this issue to b.android.com.\n");
10328 abort();
10329 }
10330 }
10331}
10332
10333GLuint glGetProgramResourceIndex_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10334{
10335
10336 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10337 IOStream *stream = ctx->m_stream;
10338 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10339 bool useChecksum = checksumCalculator->getVersion() > 0;
10340
10341 const unsigned int __size_name = (strlen(name) + 1);
10342 unsigned char *ptr;
10343 unsigned char *buf;
10344 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10345 const size_t checksumSize = checksumCalculator->checksumByteSize();
10346 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10347 buf = stream->alloc(totalSize);
10348 ptr = buf;
10349 int tmp = OP_glGetProgramResourceIndex;memcpy(ptr, &tmp, 4); ptr += 4;
10350 memcpy(ptr, &totalSize, 4); ptr += 4;
10351
10352 memcpy(ptr, &program, 4); ptr += 4;
10353 memcpy(ptr, &programInterface, 4); ptr += 4;
10354 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10355 memcpy(ptr, name, __size_name);ptr += __size_name;
10356
10357 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10358 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10359
10360
10361 GLuint retval;
10362 stream->readback(&retval, 4);
10363 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10364 if (useChecksum) {
10365 unsigned char *checksumBufPtr = NULL;
10366 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10367 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10368 stream->readback(checksumBufPtr, checksumSize);
10369 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10370 ALOGE("glGetProgramResourceIndex: GL communication error, please report this issue to b.android.com.\n");
10371 abort();
10372 }
10373 }
10374 return retval;
10375}
10376
10377GLint glGetProgramResourceLocation_enc(void *self , GLuint program, GLenum programInterface, const char* name)
10378{
10379
10380 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10381 IOStream *stream = ctx->m_stream;
10382 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10383 bool useChecksum = checksumCalculator->getVersion() > 0;
10384
10385 const unsigned int __size_name = (strlen(name) + 1);
10386 unsigned char *ptr;
10387 unsigned char *buf;
10388 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_name + 1*4;
10389 const size_t checksumSize = checksumCalculator->checksumByteSize();
10390 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10391 buf = stream->alloc(totalSize);
10392 ptr = buf;
10393 int tmp = OP_glGetProgramResourceLocation;memcpy(ptr, &tmp, 4); ptr += 4;
10394 memcpy(ptr, &totalSize, 4); ptr += 4;
10395
10396 memcpy(ptr, &program, 4); ptr += 4;
10397 memcpy(ptr, &programInterface, 4); ptr += 4;
10398 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10399 memcpy(ptr, name, __size_name);ptr += __size_name;
10400
10401 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10402 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10403
10404
10405 GLint retval;
10406 stream->readback(&retval, 4);
10407 if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
10408 if (useChecksum) {
10409 unsigned char *checksumBufPtr = NULL;
10410 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10411 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10412 stream->readback(checksumBufPtr, checksumSize);
10413 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10414 ALOGE("glGetProgramResourceLocation: GL communication error, please report this issue to b.android.com.\n");
10415 abort();
10416 }
10417 }
10418 return retval;
10419}
10420
10421void glGetProgramResourceName_enc(void *self , GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei* length, char* name)
10422{
10423
10424 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10425 IOStream *stream = ctx->m_stream;
10426 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10427 bool useChecksum = checksumCalculator->getVersion() > 0;
10428
10429 const unsigned int __size_length = ((length != NULL) ? (sizeof(GLsizei)) : 0);
10430 const unsigned int __size_name = bufSize;
10431 unsigned char *ptr;
10432 unsigned char *buf;
10433 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 0 + 0 + 2*4;
10434 const size_t checksumSize = checksumCalculator->checksumByteSize();
10435 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10436 buf = stream->alloc(totalSize);
10437 ptr = buf;
10438 int tmp = OP_glGetProgramResourceName;memcpy(ptr, &tmp, 4); ptr += 4;
10439 memcpy(ptr, &totalSize, 4); ptr += 4;
10440
10441 memcpy(ptr, &program, 4); ptr += 4;
10442 memcpy(ptr, &programInterface, 4); ptr += 4;
10443 memcpy(ptr, &index, 4); ptr += 4;
10444 memcpy(ptr, &bufSize, 4); ptr += 4;
10445 *(unsigned int *)(ptr) = __size_length; ptr += 4;
10446 *(unsigned int *)(ptr) = __size_name; ptr += 4;
10447
10448 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10449 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10450
10451 if (length != NULL) {
10452 stream->readback(length, __size_length);
10453 if (useChecksum) checksumCalculator->addBuffer(length, __size_length);
10454 }
10455 stream->readback(name, __size_name);
10456 if (useChecksum) checksumCalculator->addBuffer(name, __size_name);
10457 if (useChecksum) {
10458 unsigned char *checksumBufPtr = NULL;
10459 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10460 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10461 stream->readback(checksumBufPtr, checksumSize);
10462 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10463 ALOGE("glGetProgramResourceName: GL communication error, please report this issue to b.android.com.\n");
10464 abort();
10465 }
10466 }
10467}
10468
10469void glBindImageTexture_enc(void *self , GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
10470{
10471
10472 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10473 IOStream *stream = ctx->m_stream;
10474 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10475 bool useChecksum = checksumCalculator->getVersion() > 0;
10476
10477 unsigned char *ptr;
10478 unsigned char *buf;
10479 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4 + 4 + 4;
10480 const size_t checksumSize = checksumCalculator->checksumByteSize();
10481 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10482 buf = stream->alloc(totalSize);
10483 ptr = buf;
10484 int tmp = OP_glBindImageTexture;memcpy(ptr, &tmp, 4); ptr += 4;
10485 memcpy(ptr, &totalSize, 4); ptr += 4;
10486
10487 memcpy(ptr, &unit, 4); ptr += 4;
10488 memcpy(ptr, &texture, 4); ptr += 4;
10489 memcpy(ptr, &level, 4); ptr += 4;
10490 memcpy(ptr, &layered, 1); ptr += 1;
10491 memcpy(ptr, &layer, 4); ptr += 4;
10492 memcpy(ptr, &access, 4); ptr += 4;
10493 memcpy(ptr, &format, 4); ptr += 4;
10494
10495 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10496 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10497
10498}
10499
10500void glDispatchCompute_enc(void *self , GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
10501{
10502
10503 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10504 IOStream *stream = ctx->m_stream;
10505 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10506 bool useChecksum = checksumCalculator->getVersion() > 0;
10507
10508 unsigned char *ptr;
10509 unsigned char *buf;
10510 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10511 const size_t checksumSize = checksumCalculator->checksumByteSize();
10512 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10513 buf = stream->alloc(totalSize);
10514 ptr = buf;
10515 int tmp = OP_glDispatchCompute;memcpy(ptr, &tmp, 4); ptr += 4;
10516 memcpy(ptr, &totalSize, 4); ptr += 4;
10517
10518 memcpy(ptr, &num_groups_x, 4); ptr += 4;
10519 memcpy(ptr, &num_groups_y, 4); ptr += 4;
10520 memcpy(ptr, &num_groups_z, 4); ptr += 4;
10521
10522 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10523 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10524
10525}
10526
10527void glDispatchComputeIndirect_enc(void *self , GLintptr indirect)
10528{
10529
10530 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10531 IOStream *stream = ctx->m_stream;
10532 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10533 bool useChecksum = checksumCalculator->getVersion() > 0;
10534
10535 unsigned char *ptr;
10536 unsigned char *buf;
10537 const size_t sizeWithoutChecksum = 8 + 4;
10538 const size_t checksumSize = checksumCalculator->checksumByteSize();
10539 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10540 buf = stream->alloc(totalSize);
10541 ptr = buf;
10542 int tmp = OP_glDispatchComputeIndirect;memcpy(ptr, &tmp, 4); ptr += 4;
10543 memcpy(ptr, &totalSize, 4); ptr += 4;
10544
10545 memcpy(ptr, &indirect, 4); ptr += 4;
10546
10547 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10548 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10549
10550}
10551
10552void glBindVertexBuffer_enc(void *self , GLuint bindingindex, GLuint buffer, GLintptr offset, GLintptr stride)
10553{
10554
10555 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10556 IOStream *stream = ctx->m_stream;
10557 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10558 bool useChecksum = checksumCalculator->getVersion() > 0;
10559
10560 unsigned char *ptr;
10561 unsigned char *buf;
10562 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10563 const size_t checksumSize = checksumCalculator->checksumByteSize();
10564 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10565 buf = stream->alloc(totalSize);
10566 ptr = buf;
10567 int tmp = OP_glBindVertexBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
10568 memcpy(ptr, &totalSize, 4); ptr += 4;
10569
10570 memcpy(ptr, &bindingindex, 4); ptr += 4;
10571 memcpy(ptr, &buffer, 4); ptr += 4;
10572 memcpy(ptr, &offset, 4); ptr += 4;
10573 memcpy(ptr, &stride, 4); ptr += 4;
10574
10575 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10576 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10577
10578}
10579
10580void glVertexAttribBinding_enc(void *self , GLuint attribindex, GLuint bindingindex)
10581{
10582
10583 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10584 IOStream *stream = ctx->m_stream;
10585 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10586 bool useChecksum = checksumCalculator->getVersion() > 0;
10587
10588 unsigned char *ptr;
10589 unsigned char *buf;
10590 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10591 const size_t checksumSize = checksumCalculator->checksumByteSize();
10592 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10593 buf = stream->alloc(totalSize);
10594 ptr = buf;
10595 int tmp = OP_glVertexAttribBinding;memcpy(ptr, &tmp, 4); ptr += 4;
10596 memcpy(ptr, &totalSize, 4); ptr += 4;
10597
10598 memcpy(ptr, &attribindex, 4); ptr += 4;
10599 memcpy(ptr, &bindingindex, 4); ptr += 4;
10600
10601 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10602 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10603
10604}
10605
10606void glVertexAttribFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
10607{
10608
10609 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10610 IOStream *stream = ctx->m_stream;
10611 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10612 bool useChecksum = checksumCalculator->getVersion() > 0;
10613
10614 unsigned char *ptr;
10615 unsigned char *buf;
10616 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 1 + 4;
10617 const size_t checksumSize = checksumCalculator->checksumByteSize();
10618 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10619 buf = stream->alloc(totalSize);
10620 ptr = buf;
10621 int tmp = OP_glVertexAttribFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10622 memcpy(ptr, &totalSize, 4); ptr += 4;
10623
10624 memcpy(ptr, &attribindex, 4); ptr += 4;
10625 memcpy(ptr, &size, 4); ptr += 4;
10626 memcpy(ptr, &type, 4); ptr += 4;
10627 memcpy(ptr, &normalized, 1); ptr += 1;
10628 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10629
10630 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10631 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10632
10633}
10634
10635void glVertexAttribIFormat_enc(void *self , GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
10636{
10637
10638 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10639 IOStream *stream = ctx->m_stream;
10640 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10641 bool useChecksum = checksumCalculator->getVersion() > 0;
10642
10643 unsigned char *ptr;
10644 unsigned char *buf;
10645 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4;
10646 const size_t checksumSize = checksumCalculator->checksumByteSize();
10647 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10648 buf = stream->alloc(totalSize);
10649 ptr = buf;
10650 int tmp = OP_glVertexAttribIFormat;memcpy(ptr, &tmp, 4); ptr += 4;
10651 memcpy(ptr, &totalSize, 4); ptr += 4;
10652
10653 memcpy(ptr, &attribindex, 4); ptr += 4;
10654 memcpy(ptr, &size, 4); ptr += 4;
10655 memcpy(ptr, &type, 4); ptr += 4;
10656 memcpy(ptr, &relativeoffset, 4); ptr += 4;
10657
10658 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10659 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10660
10661}
10662
10663void glVertexBindingDivisor_enc(void *self , GLuint bindingindex, GLuint divisor)
10664{
10665
10666 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10667 IOStream *stream = ctx->m_stream;
10668 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10669 bool useChecksum = checksumCalculator->getVersion() > 0;
10670
10671 unsigned char *ptr;
10672 unsigned char *buf;
10673 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10674 const size_t checksumSize = checksumCalculator->checksumByteSize();
10675 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10676 buf = stream->alloc(totalSize);
10677 ptr = buf;
10678 int tmp = OP_glVertexBindingDivisor;memcpy(ptr, &tmp, 4); ptr += 4;
10679 memcpy(ptr, &totalSize, 4); ptr += 4;
10680
10681 memcpy(ptr, &bindingindex, 4); ptr += 4;
10682 memcpy(ptr, &divisor, 4); ptr += 4;
10683
10684 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10685 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10686
10687}
10688
10689void glDrawArraysIndirectDataAEMU_enc(void *self , GLenum mode, const void* indirect, GLuint datalen)
10690{
10691
10692 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10693 IOStream *stream = ctx->m_stream;
10694 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10695 bool useChecksum = checksumCalculator->getVersion() > 0;
10696
10697 const unsigned int __size_indirect = datalen;
10698 unsigned char *ptr;
10699 unsigned char *buf;
10700 const size_t sizeWithoutChecksum = 8 + 4 + __size_indirect + 4 + 1*4;
10701 const size_t checksumSize = checksumCalculator->checksumByteSize();
10702 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10703 buf = stream->alloc(totalSize);
10704 ptr = buf;
10705 int tmp = OP_glDrawArraysIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10706 memcpy(ptr, &totalSize, 4); ptr += 4;
10707
10708 memcpy(ptr, &mode, 4); ptr += 4;
10709 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10710 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10711 memcpy(ptr, &datalen, 4); ptr += 4;
10712
10713 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10714 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10715
10716}
10717
10718void glDrawArraysIndirectOffsetAEMU_enc(void *self , GLenum mode, GLuint offset)
10719{
10720
10721 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10722 IOStream *stream = ctx->m_stream;
10723 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10724 bool useChecksum = checksumCalculator->getVersion() > 0;
10725
10726 unsigned char *ptr;
10727 unsigned char *buf;
10728 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10729 const size_t checksumSize = checksumCalculator->checksumByteSize();
10730 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10731 buf = stream->alloc(totalSize);
10732 ptr = buf;
10733 int tmp = OP_glDrawArraysIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10734 memcpy(ptr, &totalSize, 4); ptr += 4;
10735
10736 memcpy(ptr, &mode, 4); ptr += 4;
10737 memcpy(ptr, &offset, 4); ptr += 4;
10738
10739 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10740 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10741
10742}
10743
10744void glDrawElementsIndirectDataAEMU_enc(void *self , GLenum mode, GLenum type, const void* indirect, GLuint datalen)
10745{
10746
10747 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10748 IOStream *stream = ctx->m_stream;
10749 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10750 bool useChecksum = checksumCalculator->getVersion() > 0;
10751
10752 const unsigned int __size_indirect = datalen;
10753 unsigned char *ptr;
10754 unsigned char *buf;
10755 const size_t sizeWithoutChecksum = 8 + 4 + 4 + __size_indirect + 4 + 1*4;
10756 const size_t checksumSize = checksumCalculator->checksumByteSize();
10757 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10758 buf = stream->alloc(totalSize);
10759 ptr = buf;
10760 int tmp = OP_glDrawElementsIndirectDataAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10761 memcpy(ptr, &totalSize, 4); ptr += 4;
10762
10763 memcpy(ptr, &mode, 4); ptr += 4;
10764 memcpy(ptr, &type, 4); ptr += 4;
10765 *(unsigned int *)(ptr) = __size_indirect; ptr += 4;
10766 memcpy(ptr, indirect, __size_indirect);ptr += __size_indirect;
10767 memcpy(ptr, &datalen, 4); ptr += 4;
10768
10769 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10770 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10771
10772}
10773
10774void glDrawElementsIndirectOffsetAEMU_enc(void *self , GLenum mode, GLenum type, GLuint offset)
10775{
10776
10777 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10778 IOStream *stream = ctx->m_stream;
10779 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10780 bool useChecksum = checksumCalculator->getVersion() > 0;
10781
10782 unsigned char *ptr;
10783 unsigned char *buf;
10784 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10785 const size_t checksumSize = checksumCalculator->checksumByteSize();
10786 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10787 buf = stream->alloc(totalSize);
10788 ptr = buf;
10789 int tmp = OP_glDrawElementsIndirectOffsetAEMU;memcpy(ptr, &tmp, 4); ptr += 4;
10790 memcpy(ptr, &totalSize, 4); ptr += 4;
10791
10792 memcpy(ptr, &mode, 4); ptr += 4;
10793 memcpy(ptr, &type, 4); ptr += 4;
10794 memcpy(ptr, &offset, 4); ptr += 4;
10795
10796 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10797 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10798
10799}
10800
10801void glTexStorage2DMultisample_enc(void *self , GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
10802{
10803
10804 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10805 IOStream *stream = ctx->m_stream;
10806 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10807 bool useChecksum = checksumCalculator->getVersion() > 0;
10808
10809 unsigned char *ptr;
10810 unsigned char *buf;
10811 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 1;
10812 const size_t checksumSize = checksumCalculator->checksumByteSize();
10813 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10814 buf = stream->alloc(totalSize);
10815 ptr = buf;
10816 int tmp = OP_glTexStorage2DMultisample;memcpy(ptr, &tmp, 4); ptr += 4;
10817 memcpy(ptr, &totalSize, 4); ptr += 4;
10818
10819 memcpy(ptr, &target, 4); ptr += 4;
10820 memcpy(ptr, &samples, 4); ptr += 4;
10821 memcpy(ptr, &internalformat, 4); ptr += 4;
10822 memcpy(ptr, &width, 4); ptr += 4;
10823 memcpy(ptr, &height, 4); ptr += 4;
10824 memcpy(ptr, &fixedsamplelocations, 1); ptr += 1;
10825
10826 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10827 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10828
10829}
10830
10831void glSampleMaski_enc(void *self , GLuint maskNumber, GLbitfield mask)
10832{
10833
10834 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10835 IOStream *stream = ctx->m_stream;
10836 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10837 bool useChecksum = checksumCalculator->getVersion() > 0;
10838
10839 unsigned char *ptr;
10840 unsigned char *buf;
10841 const size_t sizeWithoutChecksum = 8 + 4 + 4;
10842 const size_t checksumSize = checksumCalculator->checksumByteSize();
10843 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10844 buf = stream->alloc(totalSize);
10845 ptr = buf;
10846 int tmp = OP_glSampleMaski;memcpy(ptr, &tmp, 4); ptr += 4;
10847 memcpy(ptr, &totalSize, 4); ptr += 4;
10848
10849 memcpy(ptr, &maskNumber, 4); ptr += 4;
10850 memcpy(ptr, &mask, 4); ptr += 4;
10851
10852 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10853 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10854
10855}
10856
10857void glGetMultisamplefv_enc(void *self , GLenum pname, GLuint index, GLfloat* val)
10858{
10859
10860 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10861 IOStream *stream = ctx->m_stream;
10862 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10863 bool useChecksum = checksumCalculator->getVersion() > 0;
10864
10865 const unsigned int __size_val = (glUtilsParamSize(pname) * sizeof(GLfloat));
10866 unsigned char *ptr;
10867 unsigned char *buf;
10868 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10869 const size_t checksumSize = checksumCalculator->checksumByteSize();
10870 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10871 buf = stream->alloc(totalSize);
10872 ptr = buf;
10873 int tmp = OP_glGetMultisamplefv;memcpy(ptr, &tmp, 4); ptr += 4;
10874 memcpy(ptr, &totalSize, 4); ptr += 4;
10875
10876 memcpy(ptr, &pname, 4); ptr += 4;
10877 memcpy(ptr, &index, 4); ptr += 4;
10878 *(unsigned int *)(ptr) = __size_val; ptr += 4;
10879
10880 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10881 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10882
10883 stream->readback(val, __size_val);
10884 if (useChecksum) checksumCalculator->addBuffer(val, __size_val);
10885 if (useChecksum) {
10886 unsigned char *checksumBufPtr = NULL;
10887 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10888 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10889 stream->readback(checksumBufPtr, checksumSize);
10890 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10891 ALOGE("glGetMultisamplefv: GL communication error, please report this issue to b.android.com.\n");
10892 abort();
10893 }
10894 }
10895}
10896
10897void glFramebufferParameteri_enc(void *self , GLenum target, GLenum pname, GLint param)
10898{
10899
10900 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10901 IOStream *stream = ctx->m_stream;
10902 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10903 bool useChecksum = checksumCalculator->getVersion() > 0;
10904
10905 unsigned char *ptr;
10906 unsigned char *buf;
10907 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4;
10908 const size_t checksumSize = checksumCalculator->checksumByteSize();
10909 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10910 buf = stream->alloc(totalSize);
10911 ptr = buf;
10912 int tmp = OP_glFramebufferParameteri;memcpy(ptr, &tmp, 4); ptr += 4;
10913 memcpy(ptr, &totalSize, 4); ptr += 4;
10914
10915 memcpy(ptr, &target, 4); ptr += 4;
10916 memcpy(ptr, &pname, 4); ptr += 4;
10917 memcpy(ptr, &param, 4); ptr += 4;
10918
10919 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10920 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10921
10922}
10923
10924void glGetFramebufferParameteriv_enc(void *self , GLenum target, GLenum pname, GLint* params)
10925{
10926
10927 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10928 IOStream *stream = ctx->m_stream;
10929 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10930 bool useChecksum = checksumCalculator->getVersion() > 0;
10931
10932 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
10933 unsigned char *ptr;
10934 unsigned char *buf;
10935 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 0 + 1*4;
10936 const size_t checksumSize = checksumCalculator->checksumByteSize();
10937 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10938 buf = stream->alloc(totalSize);
10939 ptr = buf;
10940 int tmp = OP_glGetFramebufferParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
10941 memcpy(ptr, &totalSize, 4); ptr += 4;
10942
10943 memcpy(ptr, &target, 4); ptr += 4;
10944 memcpy(ptr, &pname, 4); ptr += 4;
10945 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10946
10947 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10948 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10949
10950 stream->readback(params, __size_params);
10951 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10952 if (useChecksum) {
10953 unsigned char *checksumBufPtr = NULL;
10954 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10955 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10956 stream->readback(checksumBufPtr, checksumSize);
10957 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10958 ALOGE("glGetFramebufferParameteriv: GL communication error, please report this issue to b.android.com.\n");
10959 abort();
10960 }
10961 }
10962}
10963
10964void glGetTexLevelParameterfv_enc(void *self , GLenum target, GLint level, GLenum pname, GLfloat* params)
10965{
10966
10967 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
10968 IOStream *stream = ctx->m_stream;
10969 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
10970 bool useChecksum = checksumCalculator->getVersion() > 0;
10971
10972 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLfloat));
10973 unsigned char *ptr;
10974 unsigned char *buf;
10975 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
10976 const size_t checksumSize = checksumCalculator->checksumByteSize();
10977 const size_t totalSize = sizeWithoutChecksum + checksumSize;
10978 buf = stream->alloc(totalSize);
10979 ptr = buf;
10980 int tmp = OP_glGetTexLevelParameterfv;memcpy(ptr, &tmp, 4); ptr += 4;
10981 memcpy(ptr, &totalSize, 4); ptr += 4;
10982
10983 memcpy(ptr, &target, 4); ptr += 4;
10984 memcpy(ptr, &level, 4); ptr += 4;
10985 memcpy(ptr, &pname, 4); ptr += 4;
10986 *(unsigned int *)(ptr) = __size_params; ptr += 4;
10987
10988 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
10989 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
10990
10991 stream->readback(params, __size_params);
10992 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
10993 if (useChecksum) {
10994 unsigned char *checksumBufPtr = NULL;
10995 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
10996 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
10997 stream->readback(checksumBufPtr, checksumSize);
10998 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
10999 ALOGE("glGetTexLevelParameterfv: GL communication error, please report this issue to b.android.com.\n");
11000 abort();
11001 }
11002 }
11003}
11004
11005void glGetTexLevelParameteriv_enc(void *self , GLenum target, GLint level, GLenum pname, GLint* params)
11006{
11007
11008 gl2_encoder_context_t *ctx = (gl2_encoder_context_t *)self;
11009 IOStream *stream = ctx->m_stream;
11010 ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
11011 bool useChecksum = checksumCalculator->getVersion() > 0;
11012
11013 const unsigned int __size_params = (glUtilsParamSize(pname) * sizeof(GLint));
11014 unsigned char *ptr;
11015 unsigned char *buf;
11016 const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 0 + 1*4;
11017 const size_t checksumSize = checksumCalculator->checksumByteSize();
11018 const size_t totalSize = sizeWithoutChecksum + checksumSize;
11019 buf = stream->alloc(totalSize);
11020 ptr = buf;
11021 int tmp = OP_glGetTexLevelParameteriv;memcpy(ptr, &tmp, 4); ptr += 4;
11022 memcpy(ptr, &totalSize, 4); ptr += 4;
11023
11024 memcpy(ptr, &target, 4); ptr += 4;
11025 memcpy(ptr, &level, 4); ptr += 4;
11026 memcpy(ptr, &pname, 4); ptr += 4;
11027 *(unsigned int *)(ptr) = __size_params; ptr += 4;
11028
11029 if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
11030 if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
11031
11032 stream->readback(params, __size_params);
11033 if (useChecksum) checksumCalculator->addBuffer(params, __size_params);
11034 if (useChecksum) {
11035 unsigned char *checksumBufPtr = NULL;
11036 unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
11037 if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
11038 stream->readback(checksumBufPtr, checksumSize);
11039 if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
11040 ALOGE("glGetTexLevelParameteriv: GL communication error, please report this issue to b.android.com.\n");
11041 abort();
11042 }
11043 }
11044}
11045
David 'Digit' Turner4f91c8e2014-10-31 11:39:38 +010011046} // namespace
David 'Digit' Turner3372af92014-10-29 09:55:08 +010011047
Yahan Zhoub7f09082016-03-10 11:45:02 -080011048gl2_encoder_context_t::gl2_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
keunyoungb85b2752013-03-08 12:28:03 -080011049{
11050 m_stream = stream;
Yahan Zhoub7f09082016-03-10 11:45:02 -080011051 m_checksumCalculator = checksumCalculator;
keunyoungb85b2752013-03-08 12:28:03 -080011052
David 'Digit' Turner3afd44b2014-10-30 18:15:04 +010011053 this->glActiveTexture = &glActiveTexture_enc;
11054 this->glAttachShader = &glAttachShader_enc;
11055 this->glBindAttribLocation = &glBindAttribLocation_enc;
11056 this->glBindBuffer = &glBindBuffer_enc;
11057 this->glBindFramebuffer = &glBindFramebuffer_enc;
11058 this->glBindRenderbuffer = &glBindRenderbuffer_enc;
11059 this->glBindTexture = &glBindTexture_enc;
11060 this->glBlendColor = &glBlendColor_enc;
11061 this->glBlendEquation = &glBlendEquation_enc;
11062 this->glBlendEquationSeparate = &glBlendEquationSeparate_enc;
11063 this->glBlendFunc = &glBlendFunc_enc;
11064 this->glBlendFuncSeparate = &glBlendFuncSeparate_enc;
11065 this->glBufferData = &glBufferData_enc;
11066 this->glBufferSubData = &glBufferSubData_enc;
11067 this->glCheckFramebufferStatus = &glCheckFramebufferStatus_enc;
11068 this->glClear = &glClear_enc;
11069 this->glClearColor = &glClearColor_enc;
11070 this->glClearDepthf = &glClearDepthf_enc;
11071 this->glClearStencil = &glClearStencil_enc;
11072 this->glColorMask = &glColorMask_enc;
11073 this->glCompileShader = &glCompileShader_enc;
11074 this->glCompressedTexImage2D = &glCompressedTexImage2D_enc;
11075 this->glCompressedTexSubImage2D = &glCompressedTexSubImage2D_enc;
11076 this->glCopyTexImage2D = &glCopyTexImage2D_enc;
11077 this->glCopyTexSubImage2D = &glCopyTexSubImage2D_enc;
11078 this->glCreateProgram = &glCreateProgram_enc;
11079 this->glCreateShader = &glCreateShader_enc;
11080 this->glCullFace = &glCullFace_enc;
11081 this->glDeleteBuffers = &glDeleteBuffers_enc;
11082 this->glDeleteFramebuffers = &glDeleteFramebuffers_enc;
11083 this->glDeleteProgram = &glDeleteProgram_enc;
11084 this->glDeleteRenderbuffers = &glDeleteRenderbuffers_enc;
11085 this->glDeleteShader = &glDeleteShader_enc;
11086 this->glDeleteTextures = &glDeleteTextures_enc;
11087 this->glDepthFunc = &glDepthFunc_enc;
11088 this->glDepthMask = &glDepthMask_enc;
11089 this->glDepthRangef = &glDepthRangef_enc;
11090 this->glDetachShader = &glDetachShader_enc;
11091 this->glDisable = &glDisable_enc;
11092 this->glDisableVertexAttribArray = &glDisableVertexAttribArray_enc;
11093 this->glDrawArrays = &glDrawArrays_enc;
11094 this->glDrawElements = (glDrawElements_client_proc_t) &enc_unsupported;
11095 this->glEnable = &glEnable_enc;
11096 this->glEnableVertexAttribArray = &glEnableVertexAttribArray_enc;
11097 this->glFinish = &glFinish_enc;
11098 this->glFlush = &glFlush_enc;
11099 this->glFramebufferRenderbuffer = &glFramebufferRenderbuffer_enc;
11100 this->glFramebufferTexture2D = &glFramebufferTexture2D_enc;
11101 this->glFrontFace = &glFrontFace_enc;
11102 this->glGenBuffers = &glGenBuffers_enc;
11103 this->glGenerateMipmap = &glGenerateMipmap_enc;
11104 this->glGenFramebuffers = &glGenFramebuffers_enc;
11105 this->glGenRenderbuffers = &glGenRenderbuffers_enc;
11106 this->glGenTextures = &glGenTextures_enc;
11107 this->glGetActiveAttrib = &glGetActiveAttrib_enc;
11108 this->glGetActiveUniform = &glGetActiveUniform_enc;
11109 this->glGetAttachedShaders = &glGetAttachedShaders_enc;
11110 this->glGetAttribLocation = &glGetAttribLocation_enc;
11111 this->glGetBooleanv = &glGetBooleanv_enc;
11112 this->glGetBufferParameteriv = &glGetBufferParameteriv_enc;
11113 this->glGetError = &glGetError_enc;
11114 this->glGetFloatv = &glGetFloatv_enc;
11115 this->glGetFramebufferAttachmentParameteriv = &glGetFramebufferAttachmentParameteriv_enc;
11116 this->glGetIntegerv = &glGetIntegerv_enc;
11117 this->glGetProgramiv = &glGetProgramiv_enc;
11118 this->glGetProgramInfoLog = &glGetProgramInfoLog_enc;
11119 this->glGetRenderbufferParameteriv = &glGetRenderbufferParameteriv_enc;
11120 this->glGetShaderiv = &glGetShaderiv_enc;
11121 this->glGetShaderInfoLog = &glGetShaderInfoLog_enc;
11122 this->glGetShaderPrecisionFormat = &glGetShaderPrecisionFormat_enc;
11123 this->glGetShaderSource = &glGetShaderSource_enc;
11124 this->glGetString = (glGetString_client_proc_t) &enc_unsupported;
11125 this->glGetTexParameterfv = &glGetTexParameterfv_enc;
11126 this->glGetTexParameteriv = &glGetTexParameteriv_enc;
11127 this->glGetUniformfv = &glGetUniformfv_enc;
11128 this->glGetUniformiv = &glGetUniformiv_enc;
11129 this->glGetUniformLocation = &glGetUniformLocation_enc;
11130 this->glGetVertexAttribfv = &glGetVertexAttribfv_enc;
11131 this->glGetVertexAttribiv = &glGetVertexAttribiv_enc;
11132 this->glGetVertexAttribPointerv = (glGetVertexAttribPointerv_client_proc_t) &enc_unsupported;
11133 this->glHint = &glHint_enc;
11134 this->glIsBuffer = &glIsBuffer_enc;
11135 this->glIsEnabled = &glIsEnabled_enc;
11136 this->glIsFramebuffer = &glIsFramebuffer_enc;
11137 this->glIsProgram = &glIsProgram_enc;
11138 this->glIsRenderbuffer = &glIsRenderbuffer_enc;
11139 this->glIsShader = &glIsShader_enc;
11140 this->glIsTexture = &glIsTexture_enc;
11141 this->glLineWidth = &glLineWidth_enc;
11142 this->glLinkProgram = &glLinkProgram_enc;
11143 this->glPixelStorei = &glPixelStorei_enc;
11144 this->glPolygonOffset = &glPolygonOffset_enc;
11145 this->glReadPixels = &glReadPixels_enc;
11146 this->glReleaseShaderCompiler = &glReleaseShaderCompiler_enc;
11147 this->glRenderbufferStorage = &glRenderbufferStorage_enc;
11148 this->glSampleCoverage = &glSampleCoverage_enc;
11149 this->glScissor = &glScissor_enc;
11150 this->glShaderBinary = (glShaderBinary_client_proc_t) &enc_unsupported;
11151 this->glShaderSource = (glShaderSource_client_proc_t) &enc_unsupported;
11152 this->glStencilFunc = &glStencilFunc_enc;
11153 this->glStencilFuncSeparate = &glStencilFuncSeparate_enc;
11154 this->glStencilMask = &glStencilMask_enc;
11155 this->glStencilMaskSeparate = &glStencilMaskSeparate_enc;
11156 this->glStencilOp = &glStencilOp_enc;
11157 this->glStencilOpSeparate = &glStencilOpSeparate_enc;
11158 this->glTexImage2D = &glTexImage2D_enc;
11159 this->glTexParameterf = &glTexParameterf_enc;
11160 this->glTexParameterfv = &glTexParameterfv_enc;
11161 this->glTexParameteri = &glTexParameteri_enc;
11162 this->glTexParameteriv = &glTexParameteriv_enc;
11163 this->glTexSubImage2D = &glTexSubImage2D_enc;
11164 this->glUniform1f = &glUniform1f_enc;
11165 this->glUniform1fv = &glUniform1fv_enc;
11166 this->glUniform1i = &glUniform1i_enc;
11167 this->glUniform1iv = &glUniform1iv_enc;
11168 this->glUniform2f = &glUniform2f_enc;
11169 this->glUniform2fv = &glUniform2fv_enc;
11170 this->glUniform2i = &glUniform2i_enc;
11171 this->glUniform2iv = &glUniform2iv_enc;
11172 this->glUniform3f = &glUniform3f_enc;
11173 this->glUniform3fv = &glUniform3fv_enc;
11174 this->glUniform3i = &glUniform3i_enc;
11175 this->glUniform3iv = &glUniform3iv_enc;
11176 this->glUniform4f = &glUniform4f_enc;
11177 this->glUniform4fv = &glUniform4fv_enc;
11178 this->glUniform4i = &glUniform4i_enc;
11179 this->glUniform4iv = &glUniform4iv_enc;
11180 this->glUniformMatrix2fv = &glUniformMatrix2fv_enc;
11181 this->glUniformMatrix3fv = &glUniformMatrix3fv_enc;
11182 this->glUniformMatrix4fv = &glUniformMatrix4fv_enc;
11183 this->glUseProgram = &glUseProgram_enc;
11184 this->glValidateProgram = &glValidateProgram_enc;
11185 this->glVertexAttrib1f = &glVertexAttrib1f_enc;
11186 this->glVertexAttrib1fv = &glVertexAttrib1fv_enc;
11187 this->glVertexAttrib2f = &glVertexAttrib2f_enc;
11188 this->glVertexAttrib2fv = &glVertexAttrib2fv_enc;
11189 this->glVertexAttrib3f = &glVertexAttrib3f_enc;
11190 this->glVertexAttrib3fv = &glVertexAttrib3fv_enc;
11191 this->glVertexAttrib4f = &glVertexAttrib4f_enc;
11192 this->glVertexAttrib4fv = &glVertexAttrib4fv_enc;
11193 this->glVertexAttribPointer = (glVertexAttribPointer_client_proc_t) &enc_unsupported;
11194 this->glViewport = &glViewport_enc;
11195 this->glEGLImageTargetTexture2DOES = &glEGLImageTargetTexture2DOES_enc;
11196 this->glEGLImageTargetRenderbufferStorageOES = &glEGLImageTargetRenderbufferStorageOES_enc;
11197 this->glGetProgramBinaryOES = (glGetProgramBinaryOES_client_proc_t) &enc_unsupported;
11198 this->glProgramBinaryOES = (glProgramBinaryOES_client_proc_t) &enc_unsupported;
11199 this->glMapBufferOES = (glMapBufferOES_client_proc_t) &enc_unsupported;
11200 this->glUnmapBufferOES = &glUnmapBufferOES_enc;
11201 this->glTexImage3DOES = &glTexImage3DOES_enc;
11202 this->glTexSubImage3DOES = &glTexSubImage3DOES_enc;
11203 this->glCopyTexSubImage3DOES = &glCopyTexSubImage3DOES_enc;
11204 this->glCompressedTexImage3DOES = &glCompressedTexImage3DOES_enc;
11205 this->glCompressedTexSubImage3DOES = &glCompressedTexSubImage3DOES_enc;
11206 this->glFramebufferTexture3DOES = &glFramebufferTexture3DOES_enc;
11207 this->glBindVertexArrayOES = &glBindVertexArrayOES_enc;
11208 this->glDeleteVertexArraysOES = &glDeleteVertexArraysOES_enc;
11209 this->glGenVertexArraysOES = &glGenVertexArraysOES_enc;
11210 this->glIsVertexArrayOES = &glIsVertexArrayOES_enc;
11211 this->glDiscardFramebufferEXT = &glDiscardFramebufferEXT_enc;
11212 this->glMultiDrawArraysEXT = (glMultiDrawArraysEXT_client_proc_t) &enc_unsupported;
11213 this->glMultiDrawElementsEXT = (glMultiDrawElementsEXT_client_proc_t) &enc_unsupported;
11214 this->glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMD_client_proc_t) &enc_unsupported;
11215 this->glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11216 this->glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMD_client_proc_t) &enc_unsupported;
11217 this->glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMD_client_proc_t) &enc_unsupported;
11218 this->glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMD_client_proc_t) &enc_unsupported;
11219 this->glGenPerfMonitorsAMD = (glGenPerfMonitorsAMD_client_proc_t) &enc_unsupported;
11220 this->glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMD_client_proc_t) &enc_unsupported;
11221 this->glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMD_client_proc_t) &enc_unsupported;
11222 this->glBeginPerfMonitorAMD = (glBeginPerfMonitorAMD_client_proc_t) &enc_unsupported;
11223 this->glEndPerfMonitorAMD = (glEndPerfMonitorAMD_client_proc_t) &enc_unsupported;
11224 this->glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMD_client_proc_t) &enc_unsupported;
11225 this->glRenderbufferStorageMultisampleIMG = (glRenderbufferStorageMultisampleIMG_client_proc_t) &enc_unsupported;
11226 this->glFramebufferTexture2DMultisampleIMG = (glFramebufferTexture2DMultisampleIMG_client_proc_t) &enc_unsupported;
11227 this->glDeleteFencesNV = (glDeleteFencesNV_client_proc_t) &enc_unsupported;
11228 this->glGenFencesNV = (glGenFencesNV_client_proc_t) &enc_unsupported;
11229 this->glIsFenceNV = (glIsFenceNV_client_proc_t) &enc_unsupported;
11230 this->glTestFenceNV = (glTestFenceNV_client_proc_t) &enc_unsupported;
11231 this->glGetFenceivNV = (glGetFenceivNV_client_proc_t) &enc_unsupported;
11232 this->glFinishFenceNV = (glFinishFenceNV_client_proc_t) &enc_unsupported;
11233 this->glSetFenceNV = (glSetFenceNV_client_proc_t) &enc_unsupported;
11234 this->glCoverageMaskNV = (glCoverageMaskNV_client_proc_t) &enc_unsupported;
11235 this->glCoverageOperationNV = (glCoverageOperationNV_client_proc_t) &enc_unsupported;
11236 this->glGetDriverControlsQCOM = (glGetDriverControlsQCOM_client_proc_t) &enc_unsupported;
11237 this->glGetDriverControlStringQCOM = (glGetDriverControlStringQCOM_client_proc_t) &enc_unsupported;
11238 this->glEnableDriverControlQCOM = (glEnableDriverControlQCOM_client_proc_t) &enc_unsupported;
11239 this->glDisableDriverControlQCOM = (glDisableDriverControlQCOM_client_proc_t) &enc_unsupported;
11240 this->glExtGetTexturesQCOM = (glExtGetTexturesQCOM_client_proc_t) &enc_unsupported;
11241 this->glExtGetBuffersQCOM = (glExtGetBuffersQCOM_client_proc_t) &enc_unsupported;
11242 this->glExtGetRenderbuffersQCOM = (glExtGetRenderbuffersQCOM_client_proc_t) &enc_unsupported;
11243 this->glExtGetFramebuffersQCOM = (glExtGetFramebuffersQCOM_client_proc_t) &enc_unsupported;
11244 this->glExtGetTexLevelParameterivQCOM = (glExtGetTexLevelParameterivQCOM_client_proc_t) &enc_unsupported;
11245 this->glExtTexObjectStateOverrideiQCOM = (glExtTexObjectStateOverrideiQCOM_client_proc_t) &enc_unsupported;
11246 this->glExtGetTexSubImageQCOM = (glExtGetTexSubImageQCOM_client_proc_t) &enc_unsupported;
11247 this->glExtGetBufferPointervQCOM = (glExtGetBufferPointervQCOM_client_proc_t) &enc_unsupported;
11248 this->glExtGetShadersQCOM = (glExtGetShadersQCOM_client_proc_t) &enc_unsupported;
11249 this->glExtGetProgramsQCOM = (glExtGetProgramsQCOM_client_proc_t) &enc_unsupported;
11250 this->glExtIsProgramBinaryQCOM = (glExtIsProgramBinaryQCOM_client_proc_t) &enc_unsupported;
11251 this->glExtGetProgramBinarySourceQCOM = (glExtGetProgramBinarySourceQCOM_client_proc_t) &enc_unsupported;
11252 this->glStartTilingQCOM = (glStartTilingQCOM_client_proc_t) &enc_unsupported;
11253 this->glEndTilingQCOM = (glEndTilingQCOM_client_proc_t) &enc_unsupported;
11254 this->glVertexAttribPointerData = &glVertexAttribPointerData_enc;
11255 this->glVertexAttribPointerOffset = &glVertexAttribPointerOffset_enc;
11256 this->glDrawElementsOffset = &glDrawElementsOffset_enc;
11257 this->glDrawElementsData = &glDrawElementsData_enc;
11258 this->glGetCompressedTextureFormats = &glGetCompressedTextureFormats_enc;
11259 this->glShaderString = &glShaderString_enc;
11260 this->glFinishRoundTrip = &glFinishRoundTrip_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011261 this->glGenVertexArrays = &glGenVertexArrays_enc;
11262 this->glBindVertexArray = &glBindVertexArray_enc;
11263 this->glDeleteVertexArrays = &glDeleteVertexArrays_enc;
11264 this->glIsVertexArray = &glIsVertexArray_enc;
11265 this->glMapBufferRange = (glMapBufferRange_client_proc_t) &enc_unsupported;
11266 this->glUnmapBuffer = (glUnmapBuffer_client_proc_t) &enc_unsupported;
11267 this->glFlushMappedBufferRange = (glFlushMappedBufferRange_client_proc_t) &enc_unsupported;
11268 this->glMapBufferRangeAEMU = &glMapBufferRangeAEMU_enc;
11269 this->glUnmapBufferAEMU = &glUnmapBufferAEMU_enc;
11270 this->glFlushMappedBufferRangeAEMU = &glFlushMappedBufferRangeAEMU_enc;
11271 this->glReadPixelsOffsetAEMU = &glReadPixelsOffsetAEMU_enc;
11272 this->glCompressedTexImage2DOffsetAEMU = &glCompressedTexImage2DOffsetAEMU_enc;
11273 this->glCompressedTexSubImage2DOffsetAEMU = &glCompressedTexSubImage2DOffsetAEMU_enc;
11274 this->glTexImage2DOffsetAEMU = &glTexImage2DOffsetAEMU_enc;
11275 this->glTexSubImage2DOffsetAEMU = &glTexSubImage2DOffsetAEMU_enc;
11276 this->glBindBufferRange = &glBindBufferRange_enc;
11277 this->glBindBufferBase = &glBindBufferBase_enc;
11278 this->glCopyBufferSubData = &glCopyBufferSubData_enc;
11279 this->glClearBufferiv = &glClearBufferiv_enc;
11280 this->glClearBufferuiv = &glClearBufferuiv_enc;
11281 this->glClearBufferfv = &glClearBufferfv_enc;
11282 this->glClearBufferfi = &glClearBufferfi_enc;
11283 this->glGetBufferParameteri64v = (glGetBufferParameteri64v_client_proc_t) &enc_unsupported;
11284 this->glGetBufferPointerv = (glGetBufferPointerv_client_proc_t) &enc_unsupported;
11285 this->glUniformBlockBinding = &glUniformBlockBinding_enc;
11286 this->glGetUniformBlockIndex = &glGetUniformBlockIndex_enc;
11287 this->glGetUniformIndices = (glGetUniformIndices_client_proc_t) &enc_unsupported;
11288 this->glGetUniformIndicesAEMU = &glGetUniformIndicesAEMU_enc;
11289 this->glGetActiveUniformBlockiv = &glGetActiveUniformBlockiv_enc;
11290 this->glGetActiveUniformBlockName = &glGetActiveUniformBlockName_enc;
11291 this->glUniform1ui = &glUniform1ui_enc;
11292 this->glUniform2ui = &glUniform2ui_enc;
11293 this->glUniform3ui = &glUniform3ui_enc;
11294 this->glUniform4ui = &glUniform4ui_enc;
11295 this->glUniform1uiv = &glUniform1uiv_enc;
11296 this->glUniform2uiv = &glUniform2uiv_enc;
11297 this->glUniform3uiv = &glUniform3uiv_enc;
11298 this->glUniform4uiv = &glUniform4uiv_enc;
11299 this->glUniformMatrix2x3fv = &glUniformMatrix2x3fv_enc;
11300 this->glUniformMatrix3x2fv = &glUniformMatrix3x2fv_enc;
11301 this->glUniformMatrix2x4fv = &glUniformMatrix2x4fv_enc;
11302 this->glUniformMatrix4x2fv = &glUniformMatrix4x2fv_enc;
11303 this->glUniformMatrix3x4fv = &glUniformMatrix3x4fv_enc;
11304 this->glUniformMatrix4x3fv = &glUniformMatrix4x3fv_enc;
11305 this->glGetUniformuiv = &glGetUniformuiv_enc;
11306 this->glGetActiveUniformsiv = &glGetActiveUniformsiv_enc;
11307 this->glVertexAttribI4i = &glVertexAttribI4i_enc;
11308 this->glVertexAttribI4ui = &glVertexAttribI4ui_enc;
11309 this->glVertexAttribI4iv = &glVertexAttribI4iv_enc;
11310 this->glVertexAttribI4uiv = &glVertexAttribI4uiv_enc;
11311 this->glVertexAttribIPointer = (glVertexAttribIPointer_client_proc_t) &enc_unsupported;
11312 this->glVertexAttribIPointerOffsetAEMU = &glVertexAttribIPointerOffsetAEMU_enc;
11313 this->glVertexAttribIPointerDataAEMU = &glVertexAttribIPointerDataAEMU_enc;
11314 this->glGetVertexAttribIiv = &glGetVertexAttribIiv_enc;
11315 this->glGetVertexAttribIuiv = &glGetVertexAttribIuiv_enc;
11316 this->glVertexAttribDivisor = &glVertexAttribDivisor_enc;
11317 this->glDrawArraysInstanced = &glDrawArraysInstanced_enc;
11318 this->glDrawElementsInstanced = (glDrawElementsInstanced_client_proc_t) &enc_unsupported;
11319 this->glDrawElementsInstancedDataAEMU = &glDrawElementsInstancedDataAEMU_enc;
11320 this->glDrawElementsInstancedOffsetAEMU = &glDrawElementsInstancedOffsetAEMU_enc;
11321 this->glDrawRangeElements = (glDrawRangeElements_client_proc_t) &enc_unsupported;
11322 this->glDrawRangeElementsDataAEMU = &glDrawRangeElementsDataAEMU_enc;
11323 this->glDrawRangeElementsOffsetAEMU = &glDrawRangeElementsOffsetAEMU_enc;
Lingfeng Yangf000ab42017-01-11 18:31:38 -080011324 this->glFenceSync = (glFenceSync_client_proc_t) &enc_unsupported;
11325 this->glClientWaitSync = (glClientWaitSync_client_proc_t) &enc_unsupported;
11326 this->glWaitSync = (glWaitSync_client_proc_t) &enc_unsupported;
11327 this->glDeleteSync = (glDeleteSync_client_proc_t) &enc_unsupported;
11328 this->glIsSync = (glIsSync_client_proc_t) &enc_unsupported;
11329 this->glGetSynciv = (glGetSynciv_client_proc_t) &enc_unsupported;
11330 this->glFenceSyncAEMU = &glFenceSyncAEMU_enc;
11331 this->glClientWaitSyncAEMU = &glClientWaitSyncAEMU_enc;
11332 this->glWaitSyncAEMU = &glWaitSyncAEMU_enc;
11333 this->glDeleteSyncAEMU = &glDeleteSyncAEMU_enc;
11334 this->glIsSyncAEMU = &glIsSyncAEMU_enc;
11335 this->glGetSyncivAEMU = &glGetSyncivAEMU_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011336 this->glDrawBuffers = &glDrawBuffers_enc;
11337 this->glReadBuffer = &glReadBuffer_enc;
11338 this->glBlitFramebuffer = &glBlitFramebuffer_enc;
11339 this->glInvalidateFramebuffer = &glInvalidateFramebuffer_enc;
11340 this->glInvalidateSubFramebuffer = &glInvalidateSubFramebuffer_enc;
11341 this->glFramebufferTextureLayer = &glFramebufferTextureLayer_enc;
11342 this->glRenderbufferStorageMultisample = &glRenderbufferStorageMultisample_enc;
11343 this->glTexStorage2D = &glTexStorage2D_enc;
11344 this->glGetInternalformativ = &glGetInternalformativ_enc;
11345 this->glBeginTransformFeedback = &glBeginTransformFeedback_enc;
11346 this->glEndTransformFeedback = &glEndTransformFeedback_enc;
11347 this->glGenTransformFeedbacks = &glGenTransformFeedbacks_enc;
11348 this->glDeleteTransformFeedbacks = &glDeleteTransformFeedbacks_enc;
11349 this->glBindTransformFeedback = &glBindTransformFeedback_enc;
11350 this->glPauseTransformFeedback = &glPauseTransformFeedback_enc;
11351 this->glResumeTransformFeedback = &glResumeTransformFeedback_enc;
11352 this->glIsTransformFeedback = &glIsTransformFeedback_enc;
11353 this->glTransformFeedbackVaryings = (glTransformFeedbackVaryings_client_proc_t) &enc_unsupported;
11354 this->glTransformFeedbackVaryingsAEMU = &glTransformFeedbackVaryingsAEMU_enc;
11355 this->glGetTransformFeedbackVarying = &glGetTransformFeedbackVarying_enc;
11356 this->glGenSamplers = &glGenSamplers_enc;
11357 this->glDeleteSamplers = &glDeleteSamplers_enc;
11358 this->glBindSampler = &glBindSampler_enc;
11359 this->glSamplerParameterf = &glSamplerParameterf_enc;
11360 this->glSamplerParameteri = &glSamplerParameteri_enc;
11361 this->glSamplerParameterfv = &glSamplerParameterfv_enc;
11362 this->glSamplerParameteriv = &glSamplerParameteriv_enc;
11363 this->glGetSamplerParameterfv = &glGetSamplerParameterfv_enc;
11364 this->glGetSamplerParameteriv = &glGetSamplerParameteriv_enc;
11365 this->glIsSampler = &glIsSampler_enc;
11366 this->glGenQueries = &glGenQueries_enc;
11367 this->glDeleteQueries = &glDeleteQueries_enc;
11368 this->glBeginQuery = &glBeginQuery_enc;
11369 this->glEndQuery = &glEndQuery_enc;
11370 this->glGetQueryiv = &glGetQueryiv_enc;
11371 this->glGetQueryObjectuiv = &glGetQueryObjectuiv_enc;
11372 this->glIsQuery = &glIsQuery_enc;
11373 this->glProgramParameteri = &glProgramParameteri_enc;
11374 this->glProgramBinary = &glProgramBinary_enc;
11375 this->glGetProgramBinary = &glGetProgramBinary_enc;
11376 this->glGetFragDataLocation = &glGetFragDataLocation_enc;
11377 this->glGetInteger64v = &glGetInteger64v_enc;
11378 this->glGetIntegeri_v = &glGetIntegeri_v_enc;
11379 this->glGetInteger64i_v = &glGetInteger64i_v_enc;
11380 this->glTexImage3D = &glTexImage3D_enc;
11381 this->glTexImage3DOffsetAEMU = &glTexImage3DOffsetAEMU_enc;
11382 this->glTexStorage3D = &glTexStorage3D_enc;
11383 this->glTexSubImage3D = &glTexSubImage3D_enc;
11384 this->glTexSubImage3DOffsetAEMU = &glTexSubImage3DOffsetAEMU_enc;
11385 this->glCompressedTexImage3D = &glCompressedTexImage3D_enc;
11386 this->glCompressedTexImage3DOffsetAEMU = &glCompressedTexImage3DOffsetAEMU_enc;
11387 this->glCompressedTexSubImage3D = &glCompressedTexSubImage3D_enc;
11388 this->glCompressedTexSubImage3DOffsetAEMU = &glCompressedTexSubImage3DOffsetAEMU_enc;
11389 this->glCopyTexSubImage3D = &glCopyTexSubImage3D_enc;
11390 this->glGetStringi = (glGetStringi_client_proc_t) &enc_unsupported;
11391 this->glGetBooleani_v = &glGetBooleani_v_enc;
11392 this->glMemoryBarrier = &glMemoryBarrier_enc;
11393 this->glMemoryBarrierByRegion = &glMemoryBarrierByRegion_enc;
11394 this->glGenProgramPipelines = &glGenProgramPipelines_enc;
11395 this->glDeleteProgramPipelines = &glDeleteProgramPipelines_enc;
11396 this->glBindProgramPipeline = &glBindProgramPipeline_enc;
11397 this->glGetProgramPipelineiv = &glGetProgramPipelineiv_enc;
11398 this->glGetProgramPipelineInfoLog = &glGetProgramPipelineInfoLog_enc;
11399 this->glValidateProgramPipeline = &glValidateProgramPipeline_enc;
11400 this->glIsProgramPipeline = &glIsProgramPipeline_enc;
11401 this->glUseProgramStages = &glUseProgramStages_enc;
Lingfeng Yangd3ae1062017-01-18 11:42:04 -080011402 this->glActiveShaderProgram = &glActiveShaderProgram_enc;
Lingfeng Yange6556dc2017-01-09 12:04:12 -080011403 this->glCreateShaderProgramv = (glCreateShaderProgramv_client_proc_t) &enc_unsupported;
11404 this->glCreateShaderProgramvAEMU = &glCreateShaderProgramvAEMU_enc;
11405 this->glProgramUniform1f = &glProgramUniform1f_enc;
11406 this->glProgramUniform2f = &glProgramUniform2f_enc;
11407 this->glProgramUniform3f = &glProgramUniform3f_enc;
11408 this->glProgramUniform4f = &glProgramUniform4f_enc;
11409 this->glProgramUniform1i = &glProgramUniform1i_enc;
11410 this->glProgramUniform2i = &glProgramUniform2i_enc;
11411 this->glProgramUniform3i = &glProgramUniform3i_enc;
11412 this->glProgramUniform4i = &glProgramUniform4i_enc;
11413 this->glProgramUniform1ui = &glProgramUniform1ui_enc;
11414 this->glProgramUniform2ui = &glProgramUniform2ui_enc;
11415 this->glProgramUniform3ui = &glProgramUniform3ui_enc;
11416 this->glProgramUniform4ui = &glProgramUniform4ui_enc;
11417 this->glProgramUniform1fv = &glProgramUniform1fv_enc;
11418 this->glProgramUniform2fv = &glProgramUniform2fv_enc;
11419 this->glProgramUniform3fv = &glProgramUniform3fv_enc;
11420 this->glProgramUniform4fv = &glProgramUniform4fv_enc;
11421 this->glProgramUniform1iv = &glProgramUniform1iv_enc;
11422 this->glProgramUniform2iv = &glProgramUniform2iv_enc;
11423 this->glProgramUniform3iv = &glProgramUniform3iv_enc;
11424 this->glProgramUniform4iv = &glProgramUniform4iv_enc;
11425 this->glProgramUniform1uiv = &glProgramUniform1uiv_enc;
11426 this->glProgramUniform2uiv = &glProgramUniform2uiv_enc;
11427 this->glProgramUniform3uiv = &glProgramUniform3uiv_enc;
11428 this->glProgramUniform4uiv = &glProgramUniform4uiv_enc;
11429 this->glProgramUniformMatrix2fv = &glProgramUniformMatrix2fv_enc;
11430 this->glProgramUniformMatrix3fv = &glProgramUniformMatrix3fv_enc;
11431 this->glProgramUniformMatrix4fv = &glProgramUniformMatrix4fv_enc;
11432 this->glProgramUniformMatrix2x3fv = &glProgramUniformMatrix2x3fv_enc;
11433 this->glProgramUniformMatrix3x2fv = &glProgramUniformMatrix3x2fv_enc;
11434 this->glProgramUniformMatrix2x4fv = &glProgramUniformMatrix2x4fv_enc;
11435 this->glProgramUniformMatrix4x2fv = &glProgramUniformMatrix4x2fv_enc;
11436 this->glProgramUniformMatrix3x4fv = &glProgramUniformMatrix3x4fv_enc;
11437 this->glProgramUniformMatrix4x3fv = &glProgramUniformMatrix4x3fv_enc;
11438 this->glGetProgramInterfaceiv = &glGetProgramInterfaceiv_enc;
11439 this->glGetProgramResourceiv = &glGetProgramResourceiv_enc;
11440 this->glGetProgramResourceIndex = &glGetProgramResourceIndex_enc;
11441 this->glGetProgramResourceLocation = &glGetProgramResourceLocation_enc;
11442 this->glGetProgramResourceName = &glGetProgramResourceName_enc;
11443 this->glBindImageTexture = &glBindImageTexture_enc;
11444 this->glDispatchCompute = &glDispatchCompute_enc;
11445 this->glDispatchComputeIndirect = &glDispatchComputeIndirect_enc;
11446 this->glBindVertexBuffer = &glBindVertexBuffer_enc;
11447 this->glVertexAttribBinding = &glVertexAttribBinding_enc;
11448 this->glVertexAttribFormat = &glVertexAttribFormat_enc;
11449 this->glVertexAttribIFormat = &glVertexAttribIFormat_enc;
11450 this->glVertexBindingDivisor = &glVertexBindingDivisor_enc;
11451 this->glDrawArraysIndirect = (glDrawArraysIndirect_client_proc_t) &enc_unsupported;
11452 this->glDrawArraysIndirectDataAEMU = &glDrawArraysIndirectDataAEMU_enc;
11453 this->glDrawArraysIndirectOffsetAEMU = &glDrawArraysIndirectOffsetAEMU_enc;
11454 this->glDrawElementsIndirect = (glDrawElementsIndirect_client_proc_t) &enc_unsupported;
11455 this->glDrawElementsIndirectDataAEMU = &glDrawElementsIndirectDataAEMU_enc;
11456 this->glDrawElementsIndirectOffsetAEMU = &glDrawElementsIndirectOffsetAEMU_enc;
11457 this->glTexStorage2DMultisample = &glTexStorage2DMultisample_enc;
11458 this->glSampleMaski = &glSampleMaski_enc;
11459 this->glGetMultisamplefv = &glGetMultisamplefv_enc;
11460 this->glFramebufferParameteri = &glFramebufferParameteri_enc;
11461 this->glGetFramebufferParameteriv = &glGetFramebufferParameteriv_enc;
11462 this->glGetTexLevelParameterfv = &glGetTexLevelParameterfv_enc;
11463 this->glGetTexLevelParameteriv = &glGetTexLevelParameteriv_enc;
keunyoungb85b2752013-03-08 12:28:03 -080011464}
11465