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