• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated Code - DO NOT EDIT !!
2 // generated by 'emugen'
3 
4 
5 #include <string.h>
6 #include "renderControl_opcodes.h"
7 
8 #include "renderControl_enc.h"
9 
10 
11 #include <stdio.h>
12 
13 namespace {
14 
enc_unsupported()15 void enc_unsupported()
16 {
17 	ALOGE("Function is unsupported\n");
18 }
19 
rcGetRendererVersion_enc(void * self)20 GLint rcGetRendererVersion_enc(void *self )
21 {
22 
23 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
24 	IOStream *stream = ctx->m_stream;
25 
26 	 unsigned char *ptr;
27 	 const size_t packetSize = 8;
28 	ptr = stream->alloc(packetSize);
29 	int tmp = OP_rcGetRendererVersion;memcpy(ptr, &tmp, 4); ptr += 4;
30 	memcpy(ptr, &packetSize, 4);  ptr += 4;
31 
32 
33 	GLint retval;
34 	stream->readback(&retval, 4);
35 	return retval;
36 }
37 
rcGetEGLVersion_enc(void * self,EGLint * major,EGLint * minor)38 EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor)
39 {
40 
41 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
42 	IOStream *stream = ctx->m_stream;
43 
44 	const unsigned int __size_major =  sizeof(EGLint);
45 	const unsigned int __size_minor =  sizeof(EGLint);
46 	 unsigned char *ptr;
47 	 const size_t packetSize = 8 + __size_major + __size_minor + 2*4;
48 	ptr = stream->alloc(packetSize);
49 	int tmp = OP_rcGetEGLVersion;memcpy(ptr, &tmp, 4); ptr += 4;
50 	memcpy(ptr, &packetSize, 4);  ptr += 4;
51 
52 	*(unsigned int *)(ptr) = __size_major; ptr += 4;
53 	*(unsigned int *)(ptr) = __size_minor; ptr += 4;
54 	stream->readback(major, __size_major);
55 	stream->readback(minor, __size_minor);
56 
57 	EGLint retval;
58 	stream->readback(&retval, 4);
59 	return retval;
60 }
61 
rcQueryEGLString_enc(void * self,EGLenum name,void * buffer,EGLint bufferSize)62 EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize)
63 {
64 
65 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
66 	IOStream *stream = ctx->m_stream;
67 
68 	const unsigned int __size_buffer =  bufferSize;
69 	 unsigned char *ptr;
70 	 const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4;
71 	ptr = stream->alloc(packetSize);
72 	int tmp = OP_rcQueryEGLString;memcpy(ptr, &tmp, 4); ptr += 4;
73 	memcpy(ptr, &packetSize, 4);  ptr += 4;
74 
75 		memcpy(ptr, &name, 4); ptr += 4;
76 	*(unsigned int *)(ptr) = __size_buffer; ptr += 4;
77 		memcpy(ptr, &bufferSize, 4); ptr += 4;
78 	stream->readback(buffer, __size_buffer);
79 
80 	EGLint retval;
81 	stream->readback(&retval, 4);
82 	return retval;
83 }
84 
rcGetGLString_enc(void * self,EGLenum name,void * buffer,EGLint bufferSize)85 EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize)
86 {
87 
88 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
89 	IOStream *stream = ctx->m_stream;
90 
91 	const unsigned int __size_buffer =  bufferSize;
92 	 unsigned char *ptr;
93 	 const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4;
94 	ptr = stream->alloc(packetSize);
95 	int tmp = OP_rcGetGLString;memcpy(ptr, &tmp, 4); ptr += 4;
96 	memcpy(ptr, &packetSize, 4);  ptr += 4;
97 
98 		memcpy(ptr, &name, 4); ptr += 4;
99 	*(unsigned int *)(ptr) = __size_buffer; ptr += 4;
100 		memcpy(ptr, &bufferSize, 4); ptr += 4;
101 	stream->readback(buffer, __size_buffer);
102 
103 	EGLint retval;
104 	stream->readback(&retval, 4);
105 	return retval;
106 }
107 
rcGetNumConfigs_enc(void * self,uint32_t * numAttribs)108 EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs)
109 {
110 
111 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
112 	IOStream *stream = ctx->m_stream;
113 
114 	const unsigned int __size_numAttribs =  sizeof(uint32_t);
115 	 unsigned char *ptr;
116 	 const size_t packetSize = 8 + __size_numAttribs + 1*4;
117 	ptr = stream->alloc(packetSize);
118 	int tmp = OP_rcGetNumConfigs;memcpy(ptr, &tmp, 4); ptr += 4;
119 	memcpy(ptr, &packetSize, 4);  ptr += 4;
120 
121 	*(unsigned int *)(ptr) = __size_numAttribs; ptr += 4;
122 	stream->readback(numAttribs, __size_numAttribs);
123 
124 	EGLint retval;
125 	stream->readback(&retval, 4);
126 	return retval;
127 }
128 
rcGetConfigs_enc(void * self,uint32_t bufSize,GLuint * buffer)129 EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer)
130 {
131 
132 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
133 	IOStream *stream = ctx->m_stream;
134 
135 	const unsigned int __size_buffer =  bufSize;
136 	 unsigned char *ptr;
137 	 const size_t packetSize = 8 + 4 + __size_buffer + 1*4;
138 	ptr = stream->alloc(packetSize);
139 	int tmp = OP_rcGetConfigs;memcpy(ptr, &tmp, 4); ptr += 4;
140 	memcpy(ptr, &packetSize, 4);  ptr += 4;
141 
142 		memcpy(ptr, &bufSize, 4); ptr += 4;
143 	*(unsigned int *)(ptr) = __size_buffer; ptr += 4;
144 	stream->readback(buffer, __size_buffer);
145 
146 	EGLint retval;
147 	stream->readback(&retval, 4);
148 	return retval;
149 }
150 
rcChooseConfig_enc(void * self,EGLint * attribs,uint32_t attribs_size,uint32_t * configs,uint32_t configs_size)151 EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size)
152 {
153 
154 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
155 	IOStream *stream = ctx->m_stream;
156 
157 	const unsigned int __size_attribs =  attribs_size;
158 	const unsigned int __size_configs = ((configs != NULL) ?  configs_size*sizeof(uint32_t) : 0);
159 	 unsigned char *ptr;
160 	 const size_t packetSize = 8 + __size_attribs + 4 + __size_configs + 4 + 2*4;
161 	ptr = stream->alloc(packetSize);
162 	int tmp = OP_rcChooseConfig;memcpy(ptr, &tmp, 4); ptr += 4;
163 	memcpy(ptr, &packetSize, 4);  ptr += 4;
164 
165 	*(unsigned int *)(ptr) = __size_attribs; ptr += 4;
166 	memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs;
167 		memcpy(ptr, &attribs_size, 4); ptr += 4;
168 	*(unsigned int *)(ptr) = __size_configs; ptr += 4;
169 		memcpy(ptr, &configs_size, 4); ptr += 4;
170 	if (configs != NULL) stream->readback(configs, __size_configs);
171 
172 	EGLint retval;
173 	stream->readback(&retval, 4);
174 	return retval;
175 }
176 
rcGetFBParam_enc(void * self,EGLint param)177 EGLint rcGetFBParam_enc(void *self , EGLint param)
178 {
179 
180 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
181 	IOStream *stream = ctx->m_stream;
182 
183 	 unsigned char *ptr;
184 	 const size_t packetSize = 8 + 4;
185 	ptr = stream->alloc(packetSize);
186 	int tmp = OP_rcGetFBParam;memcpy(ptr, &tmp, 4); ptr += 4;
187 	memcpy(ptr, &packetSize, 4);  ptr += 4;
188 
189 		memcpy(ptr, &param, 4); ptr += 4;
190 
191 	EGLint retval;
192 	stream->readback(&retval, 4);
193 	return retval;
194 }
195 
rcCreateContext_enc(void * self,uint32_t config,uint32_t share,uint32_t glVersion)196 uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion)
197 {
198 
199 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
200 	IOStream *stream = ctx->m_stream;
201 
202 	 unsigned char *ptr;
203 	 const size_t packetSize = 8 + 4 + 4 + 4;
204 	ptr = stream->alloc(packetSize);
205 	int tmp = OP_rcCreateContext;memcpy(ptr, &tmp, 4); ptr += 4;
206 	memcpy(ptr, &packetSize, 4);  ptr += 4;
207 
208 		memcpy(ptr, &config, 4); ptr += 4;
209 		memcpy(ptr, &share, 4); ptr += 4;
210 		memcpy(ptr, &glVersion, 4); ptr += 4;
211 
212 	uint32_t retval;
213 	stream->readback(&retval, 4);
214 	return retval;
215 }
216 
rcDestroyContext_enc(void * self,uint32_t context)217 void rcDestroyContext_enc(void *self , uint32_t context)
218 {
219 
220 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
221 	IOStream *stream = ctx->m_stream;
222 
223 	 unsigned char *ptr;
224 	 const size_t packetSize = 8 + 4;
225 	ptr = stream->alloc(packetSize);
226 	int tmp = OP_rcDestroyContext;memcpy(ptr, &tmp, 4); ptr += 4;
227 	memcpy(ptr, &packetSize, 4);  ptr += 4;
228 
229 		memcpy(ptr, &context, 4); ptr += 4;
230 }
231 
rcCreateWindowSurface_enc(void * self,uint32_t config,uint32_t width,uint32_t height)232 uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height)
233 {
234 
235 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
236 	IOStream *stream = ctx->m_stream;
237 
238 	 unsigned char *ptr;
239 	 const size_t packetSize = 8 + 4 + 4 + 4;
240 	ptr = stream->alloc(packetSize);
241 	int tmp = OP_rcCreateWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4;
242 	memcpy(ptr, &packetSize, 4);  ptr += 4;
243 
244 		memcpy(ptr, &config, 4); ptr += 4;
245 		memcpy(ptr, &width, 4); ptr += 4;
246 		memcpy(ptr, &height, 4); ptr += 4;
247 
248 	uint32_t retval;
249 	stream->readback(&retval, 4);
250 	return retval;
251 }
252 
rcDestroyWindowSurface_enc(void * self,uint32_t windowSurface)253 void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface)
254 {
255 
256 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
257 	IOStream *stream = ctx->m_stream;
258 
259 	 unsigned char *ptr;
260 	 const size_t packetSize = 8 + 4;
261 	ptr = stream->alloc(packetSize);
262 	int tmp = OP_rcDestroyWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4;
263 	memcpy(ptr, &packetSize, 4);  ptr += 4;
264 
265 		memcpy(ptr, &windowSurface, 4); ptr += 4;
266 }
267 
rcCreateColorBuffer_enc(void * self,uint32_t width,uint32_t height,GLenum internalFormat)268 uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat)
269 {
270 
271 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
272 	IOStream *stream = ctx->m_stream;
273 
274 	 unsigned char *ptr;
275 	 const size_t packetSize = 8 + 4 + 4 + 4;
276 	ptr = stream->alloc(packetSize);
277 	int tmp = OP_rcCreateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
278 	memcpy(ptr, &packetSize, 4);  ptr += 4;
279 
280 		memcpy(ptr, &width, 4); ptr += 4;
281 		memcpy(ptr, &height, 4); ptr += 4;
282 		memcpy(ptr, &internalFormat, 4); ptr += 4;
283 
284 	uint32_t retval;
285 	stream->readback(&retval, 4);
286 	return retval;
287 }
288 
rcOpenColorBuffer_enc(void * self,uint32_t colorbuffer)289 void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer)
290 {
291 
292 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
293 	IOStream *stream = ctx->m_stream;
294 
295 	 unsigned char *ptr;
296 	 const size_t packetSize = 8 + 4;
297 	ptr = stream->alloc(packetSize);
298 	int tmp = OP_rcOpenColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
299 	memcpy(ptr, &packetSize, 4);  ptr += 4;
300 
301 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
302 }
303 
rcCloseColorBuffer_enc(void * self,uint32_t colorbuffer)304 void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer)
305 {
306 
307 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
308 	IOStream *stream = ctx->m_stream;
309 
310 	 unsigned char *ptr;
311 	 const size_t packetSize = 8 + 4;
312 	ptr = stream->alloc(packetSize);
313 	int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
314 	memcpy(ptr, &packetSize, 4);  ptr += 4;
315 
316 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
317 	stream->flush();
318 }
319 
rcSetWindowColorBuffer_enc(void * self,uint32_t windowSurface,uint32_t colorBuffer)320 void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer)
321 {
322 
323 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
324 	IOStream *stream = ctx->m_stream;
325 
326 	 unsigned char *ptr;
327 	 const size_t packetSize = 8 + 4 + 4;
328 	ptr = stream->alloc(packetSize);
329 	int tmp = OP_rcSetWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
330 	memcpy(ptr, &packetSize, 4);  ptr += 4;
331 
332 		memcpy(ptr, &windowSurface, 4); ptr += 4;
333 		memcpy(ptr, &colorBuffer, 4); ptr += 4;
334 }
335 
rcFlushWindowColorBuffer_enc(void * self,uint32_t windowSurface)336 int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface)
337 {
338 
339 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
340 	IOStream *stream = ctx->m_stream;
341 
342 	 unsigned char *ptr;
343 	 const size_t packetSize = 8 + 4;
344 	ptr = stream->alloc(packetSize);
345 	int tmp = OP_rcFlushWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
346 	memcpy(ptr, &packetSize, 4);  ptr += 4;
347 
348 		memcpy(ptr, &windowSurface, 4); ptr += 4;
349 
350 	int retval;
351 	stream->readback(&retval, 4);
352 	return retval;
353 }
354 
rcMakeCurrent_enc(void * self,uint32_t context,uint32_t drawSurf,uint32_t readSurf)355 EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf)
356 {
357 
358 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
359 	IOStream *stream = ctx->m_stream;
360 
361 	 unsigned char *ptr;
362 	 const size_t packetSize = 8 + 4 + 4 + 4;
363 	ptr = stream->alloc(packetSize);
364 	int tmp = OP_rcMakeCurrent;memcpy(ptr, &tmp, 4); ptr += 4;
365 	memcpy(ptr, &packetSize, 4);  ptr += 4;
366 
367 		memcpy(ptr, &context, 4); ptr += 4;
368 		memcpy(ptr, &drawSurf, 4); ptr += 4;
369 		memcpy(ptr, &readSurf, 4); ptr += 4;
370 
371 	EGLint retval;
372 	stream->readback(&retval, 4);
373 	return retval;
374 }
375 
rcFBPost_enc(void * self,uint32_t colorBuffer)376 void rcFBPost_enc(void *self , uint32_t colorBuffer)
377 {
378 
379 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
380 	IOStream *stream = ctx->m_stream;
381 
382 	 unsigned char *ptr;
383 	 const size_t packetSize = 8 + 4;
384 	ptr = stream->alloc(packetSize);
385 	int tmp = OP_rcFBPost;memcpy(ptr, &tmp, 4); ptr += 4;
386 	memcpy(ptr, &packetSize, 4);  ptr += 4;
387 
388 		memcpy(ptr, &colorBuffer, 4); ptr += 4;
389 }
390 
rcFBSetSwapInterval_enc(void * self,EGLint interval)391 void rcFBSetSwapInterval_enc(void *self , EGLint interval)
392 {
393 
394 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
395 	IOStream *stream = ctx->m_stream;
396 
397 	 unsigned char *ptr;
398 	 const size_t packetSize = 8 + 4;
399 	ptr = stream->alloc(packetSize);
400 	int tmp = OP_rcFBSetSwapInterval;memcpy(ptr, &tmp, 4); ptr += 4;
401 	memcpy(ptr, &packetSize, 4);  ptr += 4;
402 
403 		memcpy(ptr, &interval, 4); ptr += 4;
404 }
405 
rcBindTexture_enc(void * self,uint32_t colorBuffer)406 void rcBindTexture_enc(void *self , uint32_t colorBuffer)
407 {
408 
409 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
410 	IOStream *stream = ctx->m_stream;
411 
412 	 unsigned char *ptr;
413 	 const size_t packetSize = 8 + 4;
414 	ptr = stream->alloc(packetSize);
415 	int tmp = OP_rcBindTexture;memcpy(ptr, &tmp, 4); ptr += 4;
416 	memcpy(ptr, &packetSize, 4);  ptr += 4;
417 
418 		memcpy(ptr, &colorBuffer, 4); ptr += 4;
419 }
420 
rcBindRenderbuffer_enc(void * self,uint32_t colorBuffer)421 void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer)
422 {
423 
424 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
425 	IOStream *stream = ctx->m_stream;
426 
427 	 unsigned char *ptr;
428 	 const size_t packetSize = 8 + 4;
429 	ptr = stream->alloc(packetSize);
430 	int tmp = OP_rcBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4;
431 	memcpy(ptr, &packetSize, 4);  ptr += 4;
432 
433 		memcpy(ptr, &colorBuffer, 4); ptr += 4;
434 }
435 
rcColorBufferCacheFlush_enc(void * self,uint32_t colorbuffer,EGLint postCount,int forRead)436 EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead)
437 {
438 
439 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
440 	IOStream *stream = ctx->m_stream;
441 
442 	 unsigned char *ptr;
443 	 const size_t packetSize = 8 + 4 + 4 + 4;
444 	ptr = stream->alloc(packetSize);
445 	int tmp = OP_rcColorBufferCacheFlush;memcpy(ptr, &tmp, 4); ptr += 4;
446 	memcpy(ptr, &packetSize, 4);  ptr += 4;
447 
448 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
449 		memcpy(ptr, &postCount, 4); ptr += 4;
450 		memcpy(ptr, &forRead, 4); ptr += 4;
451 
452 	EGLint retval;
453 	stream->readback(&retval, 4);
454 	return retval;
455 }
456 
rcReadColorBuffer_enc(void * self,uint32_t colorbuffer,GLint x,GLint y,GLint width,GLint height,GLenum format,GLenum type,void * pixels)457 void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
458 {
459 
460 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
461 	IOStream *stream = ctx->m_stream;
462 
463 	const unsigned int __size_pixels =  (((glUtilsPixelBitSize(format, type) * width) >> 3) * height);
464 	 unsigned char *ptr;
465 	 const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
466 	ptr = stream->alloc(packetSize);
467 	int tmp = OP_rcReadColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
468 	memcpy(ptr, &packetSize, 4);  ptr += 4;
469 
470 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
471 		memcpy(ptr, &x, 4); ptr += 4;
472 		memcpy(ptr, &y, 4); ptr += 4;
473 		memcpy(ptr, &width, 4); ptr += 4;
474 		memcpy(ptr, &height, 4); ptr += 4;
475 		memcpy(ptr, &format, 4); ptr += 4;
476 		memcpy(ptr, &type, 4); ptr += 4;
477 	*(unsigned int *)(ptr) = __size_pixels; ptr += 4;
478 	stream->readback(pixels, __size_pixels);
479 }
480 
rcUpdateColorBuffer_enc(void * self,uint32_t colorbuffer,GLint x,GLint y,GLint width,GLint height,GLenum format,GLenum type,void * pixels)481 int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels)
482 {
483 
484 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
485 	IOStream *stream = ctx->m_stream;
486 
487 	const unsigned int __size_pixels =  (((glUtilsPixelBitSize(format, type) * width) >> 3) * height);
488 	 unsigned char *ptr;
489 	 const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4;
490 	ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
491 	int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
492 	memcpy(ptr, &packetSize, 4);  ptr += 4;
493 
494 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
495 		memcpy(ptr, &x, 4); ptr += 4;
496 		memcpy(ptr, &y, 4); ptr += 4;
497 		memcpy(ptr, &width, 4); ptr += 4;
498 		memcpy(ptr, &height, 4); ptr += 4;
499 		memcpy(ptr, &format, 4); ptr += 4;
500 		memcpy(ptr, &type, 4); ptr += 4;
501 	stream->flush();
502 	stream->writeFully(&__size_pixels,4);
503 	stream->writeFully(pixels, __size_pixels);
504 
505 	int retval;
506 	stream->readback(&retval, 4);
507 	return retval;
508 }
509 
rcOpenColorBuffer2_enc(void * self,uint32_t colorbuffer)510 int rcOpenColorBuffer2_enc(void *self , uint32_t colorbuffer)
511 {
512 
513 	renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
514 	IOStream *stream = ctx->m_stream;
515 
516 	 unsigned char *ptr;
517 	 const size_t packetSize = 8 + 4;
518 	ptr = stream->alloc(packetSize);
519 	int tmp = OP_rcOpenColorBuffer2;memcpy(ptr, &tmp, 4); ptr += 4;
520 	memcpy(ptr, &packetSize, 4);  ptr += 4;
521 
522 		memcpy(ptr, &colorbuffer, 4); ptr += 4;
523 
524 	int retval;
525 	stream->readback(&retval, 4);
526 	return retval;
527 }
528 
529 }  // namespace
530 
renderControl_encoder_context_t(IOStream * stream)531 renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream)
532 {
533 	m_stream = stream;
534 
535 	this->rcGetRendererVersion = &rcGetRendererVersion_enc;
536 	this->rcGetEGLVersion = &rcGetEGLVersion_enc;
537 	this->rcQueryEGLString = &rcQueryEGLString_enc;
538 	this->rcGetGLString = &rcGetGLString_enc;
539 	this->rcGetNumConfigs = &rcGetNumConfigs_enc;
540 	this->rcGetConfigs = &rcGetConfigs_enc;
541 	this->rcChooseConfig = &rcChooseConfig_enc;
542 	this->rcGetFBParam = &rcGetFBParam_enc;
543 	this->rcCreateContext = &rcCreateContext_enc;
544 	this->rcDestroyContext = &rcDestroyContext_enc;
545 	this->rcCreateWindowSurface = &rcCreateWindowSurface_enc;
546 	this->rcDestroyWindowSurface = &rcDestroyWindowSurface_enc;
547 	this->rcCreateColorBuffer = &rcCreateColorBuffer_enc;
548 	this->rcOpenColorBuffer = &rcOpenColorBuffer_enc;
549 	this->rcCloseColorBuffer = &rcCloseColorBuffer_enc;
550 	this->rcSetWindowColorBuffer = &rcSetWindowColorBuffer_enc;
551 	this->rcFlushWindowColorBuffer = &rcFlushWindowColorBuffer_enc;
552 	this->rcMakeCurrent = &rcMakeCurrent_enc;
553 	this->rcFBPost = &rcFBPost_enc;
554 	this->rcFBSetSwapInterval = &rcFBSetSwapInterval_enc;
555 	this->rcBindTexture = &rcBindTexture_enc;
556 	this->rcBindRenderbuffer = &rcBindRenderbuffer_enc;
557 	this->rcColorBufferCacheFlush = &rcColorBufferCacheFlush_enc;
558 	this->rcReadColorBuffer = &rcReadColorBuffer_enc;
559 	this->rcUpdateColorBuffer = &rcUpdateColorBuffer_enc;
560 	this->rcOpenColorBuffer2 = &rcOpenColorBuffer2_enc;
561 }
562 
563