rsdRuntimeStubs.cpp revision b1d64031183c6c450d902db7d4497bedeb4a0e45
1/* 2 * Copyright (C) 2011-2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "rsContext.h" 18#include "rsScriptC.h" 19#include "rsMatrix4x4.h" 20#include "rsMatrix3x3.h" 21#include "rsMatrix2x2.h" 22#include "rsRuntime.h" 23 24#include "rsdCore.h" 25#include "rsdBcc.h" 26 27#include "rsdAllocation.h" 28#include "rsdShaderCache.h" 29#include "rsdVertexArray.h" 30 31#include <time.h> 32 33using namespace android; 34using namespace android::renderscript; 35 36typedef float float2 __attribute__((ext_vector_type(2))); 37typedef float float3 __attribute__((ext_vector_type(3))); 38typedef float float4 __attribute__((ext_vector_type(4))); 39typedef double double2 __attribute__((ext_vector_type(2))); 40typedef double double3 __attribute__((ext_vector_type(3))); 41typedef double double4 __attribute__((ext_vector_type(4))); 42typedef char char2 __attribute__((ext_vector_type(2))); 43typedef char char3 __attribute__((ext_vector_type(3))); 44typedef char char4 __attribute__((ext_vector_type(4))); 45typedef unsigned char uchar2 __attribute__((ext_vector_type(2))); 46typedef unsigned char uchar3 __attribute__((ext_vector_type(3))); 47typedef unsigned char uchar4 __attribute__((ext_vector_type(4))); 48typedef int16_t short2 __attribute__((ext_vector_type(2))); 49typedef int16_t short3 __attribute__((ext_vector_type(3))); 50typedef int16_t short4 __attribute__((ext_vector_type(4))); 51typedef uint16_t ushort2 __attribute__((ext_vector_type(2))); 52typedef uint16_t ushort3 __attribute__((ext_vector_type(3))); 53typedef uint16_t ushort4 __attribute__((ext_vector_type(4))); 54typedef int32_t int2 __attribute__((ext_vector_type(2))); 55typedef int32_t int3 __attribute__((ext_vector_type(3))); 56typedef int32_t int4 __attribute__((ext_vector_type(4))); 57typedef uint32_t uint2 __attribute__((ext_vector_type(2))); 58typedef uint32_t uint3 __attribute__((ext_vector_type(3))); 59typedef uint32_t uint4 __attribute__((ext_vector_type(4))); 60typedef int64_t long2 __attribute__((ext_vector_type(2))); 61typedef int64_t long3 __attribute__((ext_vector_type(3))); 62typedef int64_t long4 __attribute__((ext_vector_type(4))); 63typedef uint64_t ulong2 __attribute__((ext_vector_type(2))); 64typedef uint64_t ulong3 __attribute__((ext_vector_type(3))); 65typedef uint64_t ulong4 __attribute__((ext_vector_type(4))); 66 67typedef uint8_t uchar; 68typedef uint16_t ushort; 69typedef uint32_t uint; 70#ifndef RS_SERVER 71typedef uint64_t ulong; 72#endif 73 74#ifndef __LP64__ 75#define OPAQUETYPE(t) \ 76 typedef struct { const int* const p; } __attribute__((packed, aligned(4))) t; 77#else 78#define OPAQUETYPE(t) \ 79 typedef struct { const void* p; const void* r; const void* v1; const void* v2; } t; 80#endif 81 82OPAQUETYPE(rs_element) 83OPAQUETYPE(rs_type) 84OPAQUETYPE(rs_allocation) 85OPAQUETYPE(rs_sampler) 86OPAQUETYPE(rs_script) 87OPAQUETYPE(rs_script_call) 88 89OPAQUETYPE(rs_program_fragment); 90OPAQUETYPE(rs_program_store); 91OPAQUETYPE(rs_program_vertex); 92OPAQUETYPE(rs_program_raster); 93 94OPAQUETYPE(rs_mesh); 95OPAQUETYPE(rs_font); 96 97#undef OPAQUETYPE 98 99typedef enum { 100 // Empty to avoid conflicting definitions with RsAllocationCubemapFace 101} rs_allocation_cubemap_face; 102 103typedef struct { 104 int tm_sec; ///< seconds 105 int tm_min; ///< minutes 106 int tm_hour; ///< hours 107 int tm_mday; ///< day of the month 108 int tm_mon; ///< month 109 int tm_year; ///< year 110 int tm_wday; ///< day of the week 111 int tm_yday; ///< day of the year 112 int tm_isdst; ///< daylight savings time 113} rs_tm; 114 115#ifndef __LP64__ 116typedef android::renderscript::rs_script RS_TY_SCRIPT; 117typedef android::renderscript::rs_allocation RS_TY_ALLOC; 118 119static inline Script* rsGetObjPtr(RS_TY_SCRIPT s) { 120 return const_cast<Script*>(s.p); 121} 122static inline Allocation* rsGetObjPtr(RS_TY_ALLOC a) { 123 return const_cast<Allocation*>(a.p); 124} 125static inline RS_TY_SCRIPT rsTyCast(::rs_script s) { 126 RS_TY_SCRIPT cast; 127 cast.p = (const Script*)s.p; 128 return cast; 129} 130static inline RS_TY_ALLOC rsTyCast(::rs_allocation a) { 131 RS_TY_ALLOC cast; 132 cast.p = (const Allocation*)a.p; 133 return cast; 134} 135#define RS_CAST(a) rsTyCast(a) 136 137#else 138 139typedef android::renderscript::rs_script* RS_TY_SCRIPT; 140typedef android::renderscript::rs_allocation* RS_TY_ALLOC; 141 142static inline Script* rsGetObjPtr(RS_TY_SCRIPT s) { 143 return const_cast<Script*>(s->p); 144} 145static inline Allocation* rsGetObjPtr(RS_TY_ALLOC a) { 146 return const_cast<Allocation*>(a->p); 147} 148static inline RS_TY_SCRIPT rsTyCast(::rs_script *s) { 149 return reinterpret_cast<RS_TY_SCRIPT>(s); 150} 151static inline RS_TY_ALLOC rsTyCast(::rs_allocation *a) { 152 return reinterpret_cast<RS_TY_ALLOC>(a); 153} 154#define RS_CAST(a) rsTyCast(&(a)) 155 156#endif 157 158// Some RS functions are not threadsafe but can be called from an invoke 159// function. Instead of summarily marking scripts that call these functions as 160// not-threadable we detect calls to them in the driver and sends a fatal error 161// message. 162static bool failIfInKernel(Context *rsc, const char *funcName) { 163 RsdHal *dc = (RsdHal *)rsc->mHal.drv; 164 RsdCpuReference *impl = (RsdCpuReference *) dc->mCpuRef; 165 166 if (impl->getInForEach()) { 167 char buf[256]; 168 sprintf(buf, "Error: Call to unsupported function %s " 169 "in kernel", funcName); 170 rsc->setError(RS_ERROR_FATAL_DRIVER, buf); 171 return true; 172 } 173 return false; 174} 175 176////////////////////////////////////////////////////////////////////////////// 177// Allocation 178////////////////////////////////////////////////////////////////////////////// 179 180 181static void SC_AllocationSyncAll2(RS_TY_ALLOC a, RsAllocationUsageType source) { 182 Context *rsc = RsdCpuReference::getTlsContext(); 183 rsrAllocationSyncAll(rsc, rsGetObjPtr(a), source); 184} 185 186static void SC_AllocationSyncAll(RS_TY_ALLOC a) { 187 Context *rsc = RsdCpuReference::getTlsContext(); 188 rsrAllocationSyncAll(rsc, rsGetObjPtr(a), RS_ALLOCATION_USAGE_SCRIPT); 189} 190 191#ifndef RS_COMPATIBILITY_LIB 192 193static void SC_AllocationCopy1DRange(RS_TY_ALLOC dstAlloc, 194 uint32_t dstOff, 195 uint32_t dstMip, 196 uint32_t count, 197 RS_TY_ALLOC srcAlloc, 198 uint32_t srcOff, uint32_t srcMip) { 199 Context *rsc = RsdCpuReference::getTlsContext(); 200 if (failIfInKernel(rsc, "rsAllocationCopy1DRange")) 201 return; 202 203 rsrAllocationCopy1DRange(rsc, rsGetObjPtr(dstAlloc), dstOff, dstMip, count, 204 rsGetObjPtr(srcAlloc), srcOff, srcMip); 205} 206 207static void SC_AllocationCopy2DRange(RS_TY_ALLOC dstAlloc, 208 uint32_t dstXoff, uint32_t dstYoff, 209 uint32_t dstMip, uint32_t dstFace, 210 uint32_t width, uint32_t height, 211 RS_TY_ALLOC srcAlloc, 212 uint32_t srcXoff, uint32_t srcYoff, 213 uint32_t srcMip, uint32_t srcFace) { 214 Context *rsc = RsdCpuReference::getTlsContext(); 215 if (failIfInKernel(rsc, "rsAllocationCopy2DRange")) 216 return; 217 218 rsrAllocationCopy2DRange(rsc, rsGetObjPtr(dstAlloc), 219 dstXoff, dstYoff, dstMip, dstFace, 220 width, height, rsGetObjPtr(srcAlloc), 221 srcXoff, srcYoff, srcMip, srcFace); 222} 223 224static void SC_AllocationIoSend(RS_TY_ALLOC alloc) { 225 Context *rsc = RsdCpuReference::getTlsContext(); 226 if (failIfInKernel(rsc, "rsAllocationIoSend")) 227 return; 228 229 rsrAllocationIoSend(rsc, rsGetObjPtr(alloc)); 230} 231 232 233static void SC_AllocationIoReceive(RS_TY_ALLOC alloc) { 234 Context *rsc = RsdCpuReference::getTlsContext(); 235 if (failIfInKernel(rsc, "rsAllocationIoReceive")) 236 return; 237 238 rsrAllocationIoReceive(rsc, rsGetObjPtr(alloc)); 239} 240 241#else 242 243static void SC_AllocationCopy1DRange(RS_TY_ALLOC dstAlloc, 244 uint32_t dstOff, 245 uint32_t dstMip, 246 uint32_t count, 247 RS_TY_ALLOC srcAlloc, 248 uint32_t srcOff, uint32_t srcMip) { 249 Context *rsc = RsdCpuReference::getTlsContext(); 250 if (failIfInKernel(rsc, "rsAllocationCopy1DRange")) 251 return; 252 253 rsrAllocationCopy1DRange(rsc, rsGetObjPtr(dstAlloc), dstOff, dstMip, count, 254 rsGetObjPtr(srcAlloc), srcOff, srcMip); 255} 256 257static void SC_AllocationCopy2DRange(RS_TY_ALLOC dstAlloc, 258 uint32_t dstXoff, uint32_t dstYoff, 259 uint32_t dstMip, uint32_t dstFace, 260 uint32_t width, uint32_t height, 261 RS_TY_ALLOC srcAlloc, 262 uint32_t srcXoff, uint32_t srcYoff, 263 uint32_t srcMip, uint32_t srcFace) { 264 Context *rsc = RsdCpuReference::getTlsContext(); 265 if (failIfInKernel(rsc, "rsAllocationCopy2DRange")) 266 return; 267 268 rsrAllocationCopy2DRange(rsc, rsGetObjPtr(dstAlloc), 269 dstXoff, dstYoff, dstMip, dstFace, 270 width, height, 271 rsGetObjPtr(srcAlloc), 272 srcXoff, srcYoff, srcMip, srcFace); 273} 274 275static void SC_AllocationIoSend(RS_TY_ALLOC alloc) { 276 Context *rsc = RsdCpuReference::getTlsContext(); 277 if (failIfInKernel(rsc, "rsAllocationIoSend")) 278 return; 279 280 rsrAllocationIoSend(rsc, rsGetObjPtr(alloc)); 281} 282 283 284static void SC_AllocationIoReceive(RS_TY_ALLOC alloc) { 285 Context *rsc = RsdCpuReference::getTlsContext(); 286 if (failIfInKernel(rsc, "rsAllocationIoReceive")) 287 return; 288 289 rsrAllocationIoReceive(rsc, rsGetObjPtr(alloc)); 290} 291 292#endif 293 294#ifndef RS_COMPATIBILITY_LIB 295 296////////////////////////////////////////////////////////////////////////////// 297// Context 298////////////////////////////////////////////////////////////////////////////// 299 300static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) { 301 Context *rsc = RsdCpuReference::getTlsContext(); 302 rsrBindTexture(rsc, pf, slot, a); 303} 304 305static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) { 306 Context *rsc = RsdCpuReference::getTlsContext(); 307 rsrBindConstant(rsc, pv, slot, a); 308} 309 310static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) { 311 Context *rsc = RsdCpuReference::getTlsContext(); 312 rsrBindConstant(rsc, pf, slot, a); 313} 314 315static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) { 316 Context *rsc = RsdCpuReference::getTlsContext(); 317 rsrBindSampler(rsc, pf, slot, s); 318} 319 320static void SC_BindProgramStore(ProgramStore *ps) { 321 Context *rsc = RsdCpuReference::getTlsContext(); 322 rsrBindProgramStore(rsc, ps); 323} 324 325static void SC_BindProgramFragment(ProgramFragment *pf) { 326 Context *rsc = RsdCpuReference::getTlsContext(); 327 rsrBindProgramFragment(rsc, pf); 328} 329 330static void SC_BindProgramVertex(ProgramVertex *pv) { 331 Context *rsc = RsdCpuReference::getTlsContext(); 332 rsrBindProgramVertex(rsc, pv); 333} 334 335static void SC_BindProgramRaster(ProgramRaster *pr) { 336 Context *rsc = RsdCpuReference::getTlsContext(); 337 rsrBindProgramRaster(rsc, pr); 338} 339 340static void SC_BindFrameBufferObjectColorTarget(Allocation *a, uint32_t slot) { 341 Context *rsc = RsdCpuReference::getTlsContext(); 342 rsrBindFrameBufferObjectColorTarget(rsc, a, slot); 343} 344 345static void SC_BindFrameBufferObjectDepthTarget(Allocation *a) { 346 Context *rsc = RsdCpuReference::getTlsContext(); 347 rsrBindFrameBufferObjectDepthTarget(rsc, a); 348} 349 350static void SC_ClearFrameBufferObjectColorTarget(uint32_t slot) { 351 Context *rsc = RsdCpuReference::getTlsContext(); 352 rsrClearFrameBufferObjectColorTarget(rsc, slot); 353} 354 355static void SC_ClearFrameBufferObjectDepthTarget(Context *, Script *) { 356 Context *rsc = RsdCpuReference::getTlsContext(); 357 rsrClearFrameBufferObjectDepthTarget(rsc); 358} 359 360static void SC_ClearFrameBufferObjectTargets(Context *, Script *) { 361 Context *rsc = RsdCpuReference::getTlsContext(); 362 rsrClearFrameBufferObjectTargets(rsc); 363} 364 365 366////////////////////////////////////////////////////////////////////////////// 367// VP 368////////////////////////////////////////////////////////////////////////////// 369 370static void SC_VpLoadProjectionMatrix(const rsc_Matrix *m) { 371 Context *rsc = RsdCpuReference::getTlsContext(); 372 rsrVpLoadProjectionMatrix(rsc, m); 373} 374 375static void SC_VpLoadModelMatrix(const rsc_Matrix *m) { 376 Context *rsc = RsdCpuReference::getTlsContext(); 377 rsrVpLoadModelMatrix(rsc, m); 378} 379 380static void SC_VpLoadTextureMatrix(const rsc_Matrix *m) { 381 Context *rsc = RsdCpuReference::getTlsContext(); 382 rsrVpLoadTextureMatrix(rsc, m); 383} 384 385static void SC_PfConstantColor(ProgramFragment *pf, float r, float g, float b, float a) { 386 Context *rsc = RsdCpuReference::getTlsContext(); 387 rsrPfConstantColor(rsc, pf, r, g, b, a); 388} 389 390static void SC_VpGetProjectionMatrix(rsc_Matrix *m) { 391 Context *rsc = RsdCpuReference::getTlsContext(); 392 rsrVpGetProjectionMatrix(rsc, m); 393} 394 395 396////////////////////////////////////////////////////////////////////////////// 397// Drawing 398////////////////////////////////////////////////////////////////////////////// 399 400static void SC_DrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, 401 float x2, float y2, float z2, float u2, float v2, 402 float x3, float y3, float z3, float u3, float v3, 403 float x4, float y4, float z4, float u4, float v4) { 404 Context *rsc = RsdCpuReference::getTlsContext(); 405 406 if (!rsc->setupCheck()) { 407 return; 408 } 409 410 RsdHal *dc = (RsdHal *)rsc->mHal.drv; 411 if (!dc->gl.shaderCache->setup(rsc)) { 412 return; 413 } 414 415 //ALOGE("Quad"); 416 //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1); 417 //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2); 418 //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3); 419 //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4); 420 421 float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4}; 422 const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4}; 423 424 RsdVertexArray::Attrib attribs[2]; 425 attribs[0].set(GL_FLOAT, 3, 12, false, (size_t)vtx, "ATTRIB_position"); 426 attribs[1].set(GL_FLOAT, 2, 8, false, (size_t)tex, "ATTRIB_texture0"); 427 428 RsdVertexArray va(attribs, 2); 429 va.setup(rsc); 430 431 RSD_CALL_GL(glDrawArrays, GL_TRIANGLE_FAN, 0, 4); 432} 433 434static void SC_DrawQuad(float x1, float y1, float z1, 435 float x2, float y2, float z2, 436 float x3, float y3, float z3, 437 float x4, float y4, float z4) { 438 SC_DrawQuadTexCoords(x1, y1, z1, 0, 1, 439 x2, y2, z2, 1, 1, 440 x3, y3, z3, 1, 0, 441 x4, y4, z4, 0, 0); 442} 443 444static void SC_DrawSpriteScreenspace(float x, float y, float z, float w, float h) { 445 Context *rsc = RsdCpuReference::getTlsContext(); 446 447 ObjectBaseRef<const ProgramVertex> tmp(rsc->getProgramVertex()); 448 rsc->setProgramVertex(rsc->getDefaultProgramVertex()); 449 //rsc->setupCheck(); 450 451 //GLint crop[4] = {0, h, w, -h}; 452 453 float sh = rsc->getHeight(); 454 455 SC_DrawQuad(x, sh - y, z, 456 x+w, sh - y, z, 457 x+w, sh - (y+h), z, 458 x, sh - (y+h), z); 459 rsc->setProgramVertex((ProgramVertex *)tmp.get()); 460} 461 462static void SC_DrawRect(float x1, float y1, float x2, float y2, float z) { 463 SC_DrawQuad(x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z); 464} 465 466static void SC_DrawMesh(Mesh *m) { 467 Context *rsc = RsdCpuReference::getTlsContext(); 468 rsrDrawMesh(rsc, m); 469} 470 471static void SC_DrawMeshPrimitive(Mesh *m, uint32_t primIndex) { 472 Context *rsc = RsdCpuReference::getTlsContext(); 473 rsrDrawMeshPrimitive(rsc, m, primIndex); 474} 475 476static void SC_DrawMeshPrimitiveRange(Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len) { 477 Context *rsc = RsdCpuReference::getTlsContext(); 478 rsrDrawMeshPrimitiveRange(rsc, m, primIndex, start, len); 479} 480 481static void SC_MeshComputeBoundingBox(Mesh *m, 482 float *minX, float *minY, float *minZ, 483 float *maxX, float *maxY, float *maxZ) { 484 Context *rsc = RsdCpuReference::getTlsContext(); 485 rsrMeshComputeBoundingBox(rsc, m, minX, minY, minZ, maxX, maxY, maxZ); 486} 487 488 489 490////////////////////////////////////////////////////////////////////////////// 491// 492////////////////////////////////////////////////////////////////////////////// 493 494 495static void SC_Color(float r, float g, float b, float a) { 496 Context *rsc = RsdCpuReference::getTlsContext(); 497 rsrColor(rsc, r, g, b, a); 498} 499 500static void SC_Finish() { 501 Context *rsc = RsdCpuReference::getTlsContext(); 502 rsdGLFinish(rsc); 503} 504 505static void SC_ClearColor(float r, float g, float b, float a) { 506 Context *rsc = RsdCpuReference::getTlsContext(); 507 rsrPrepareClear(rsc); 508 rsdGLClearColor(rsc, r, g, b, a); 509} 510 511static void SC_ClearDepth(float v) { 512 Context *rsc = RsdCpuReference::getTlsContext(); 513 rsrPrepareClear(rsc); 514 rsdGLClearDepth(rsc, v); 515} 516 517static uint32_t SC_GetWidth() { 518 Context *rsc = RsdCpuReference::getTlsContext(); 519 return rsrGetWidth(rsc); 520} 521 522static uint32_t SC_GetHeight() { 523 Context *rsc = RsdCpuReference::getTlsContext(); 524 return rsrGetHeight(rsc); 525} 526 527static void SC_DrawTextAlloc(Allocation *a, int x, int y) { 528 Context *rsc = RsdCpuReference::getTlsContext(); 529 rsrDrawTextAlloc(rsc, a, x, y); 530} 531 532static void SC_DrawText(const char *text, int x, int y) { 533 Context *rsc = RsdCpuReference::getTlsContext(); 534 rsrDrawText(rsc, text, x, y); 535} 536 537static void SC_MeasureTextAlloc(Allocation *a, 538 int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) { 539 Context *rsc = RsdCpuReference::getTlsContext(); 540 rsrMeasureTextAlloc(rsc, a, left, right, top, bottom); 541} 542 543static void SC_MeasureText(const char *text, 544 int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) { 545 Context *rsc = RsdCpuReference::getTlsContext(); 546 rsrMeasureText(rsc, text, left, right, top, bottom); 547} 548 549static void SC_BindFont(Font *f) { 550 Context *rsc = RsdCpuReference::getTlsContext(); 551 rsrBindFont(rsc, f); 552} 553 554static void SC_FontColor(float r, float g, float b, float a) { 555 Context *rsc = RsdCpuReference::getTlsContext(); 556 rsrFontColor(rsc, r, g, b, a); 557} 558#endif 559 560 561////////////////////////////////////////////////////////////////////////////// 562// 563////////////////////////////////////////////////////////////////////////////// 564 565static void SC_ClearObject(rs_object_base *dst) { 566 Context *rsc = RsdCpuReference::getTlsContext(); 567 rsrClearObject(rsc, dst); 568} 569 570static void SC_SetObject(rs_object_base *dst, rs_object_base src) { 571 // ALOGE("SC_SetObject: dst = %p, src = %p", dst, src.p); 572 // ALOGE("SC_SetObject: dst[0] = %p", dst[0]); 573 Context *rsc = RsdCpuReference::getTlsContext(); 574 rsrSetObject(rsc, dst, (ObjectBase*)src.p); 575} 576 577static bool SC_IsObject(rs_object_base o) { 578 Context *rsc = RsdCpuReference::getTlsContext(); 579 return rsrIsObject(rsc, o); 580} 581 582#ifdef __LP64__ 583static void SC_SetObject_ByRef(rs_object_base *dst, rs_object_base *src) { 584 // ALOGE("SC_SetObject_ByRef: dst = %p, src = %p", dst, src->p); 585 Context *rsc = RsdCpuReference::getTlsContext(); 586 rsrSetObject(rsc, dst, (ObjectBase*)src->p); 587} 588 589static bool SC_IsObject_ByRef(rs_object_base *o) { 590 Context *rsc = RsdCpuReference::getTlsContext(); 591 return rsrIsObject(rsc, *o); 592} 593#endif 594 595 596#ifndef RS_COMPATIBILITY_LIB 597#ifndef __LP64__ 598 599// i386 has different struct return passing to ARM; emulate with void* 600#ifdef __i386__ 601static const void* SC_GetAllocation(const void *ptr) { 602 Context *rsc = RsdCpuReference::getTlsContext(); 603 const Script *sc = RsdCpuReference::getTlsScript(); 604 Allocation* alloc = rsdScriptGetAllocationForPointer(rsc, sc, ptr); 605 android::renderscript::rs_allocation obj = {0}; 606 alloc->callUpdateCacheObject(rsc, &obj); 607 return (void*)obj.p; 608} 609#else 610// ARMv7/MIPS 611static const android::renderscript::rs_allocation SC_GetAllocation(const void *ptr) { 612 Context *rsc = RsdCpuReference::getTlsContext(); 613 const Script *sc = RsdCpuReference::getTlsScript(); 614 Allocation* alloc = rsdScriptGetAllocationForPointer(rsc, sc, ptr); 615 android::renderscript::rs_allocation obj = {0}; 616 alloc->callUpdateCacheObject(rsc, &obj); 617 return obj; 618} 619#endif 620#else 621// AArch64/x86_64/MIPS64 622static const android::renderscript::rs_allocation SC_GetAllocation(const void *ptr) { 623 Context *rsc = RsdCpuReference::getTlsContext(); 624 const Script *sc = RsdCpuReference::getTlsScript(); 625 Allocation* alloc = rsdScriptGetAllocationForPointer(rsc, sc, ptr); 626 android::renderscript::rs_allocation obj = {0, 0, 0, 0}; 627 alloc->callUpdateCacheObject(rsc, &obj); 628 return obj; 629} 630#endif 631#endif 632 633 634static void SC_ForEach_SAA(RS_TY_SCRIPT target, RS_TY_ALLOC in, RS_TY_ALLOC out) { 635 Context *rsc = RsdCpuReference::getTlsContext(); 636 rsrForEach(rsc, rsGetObjPtr(target), rsGetObjPtr(in), rsGetObjPtr(out), nullptr, 0, nullptr); 637} 638 639static void SC_ForEach_SAAU(RS_TY_SCRIPT target, RS_TY_ALLOC in, 640 RS_TY_ALLOC out, const void *usr) { 641 Context *rsc = RsdCpuReference::getTlsContext(); 642 rsrForEach(rsc, rsGetObjPtr(target), rsGetObjPtr(in), rsGetObjPtr(out), usr, 0, nullptr); 643} 644 645static void SC_ForEach_SAAUS(RS_TY_SCRIPT target, RS_TY_ALLOC in, 646 RS_TY_ALLOC out, const void *usr, const RsScriptCall *call) { 647 Context *rsc = RsdCpuReference::getTlsContext(); 648 rsrForEach(rsc, rsGetObjPtr(target), rsGetObjPtr(in), rsGetObjPtr(out), usr, 0, call); 649} 650 651// These functions are only supported in 32-bit. 652#ifndef __LP64__ 653static void SC_ForEach_SAAUL(RS_TY_SCRIPT target, RS_TY_ALLOC in, 654 RS_TY_ALLOC out, const void *usr, uint32_t usrLen) { 655 Context *rsc = RsdCpuReference::getTlsContext(); 656 rsrForEach(rsc, rsGetObjPtr(target), rsGetObjPtr(in), rsGetObjPtr(out), usr, usrLen, nullptr); 657} 658 659static void SC_ForEach_SAAULS(RS_TY_SCRIPT target, RS_TY_ALLOC in, RS_TY_ALLOC out, 660 const void *usr, uint32_t usrLen, const RsScriptCall *call) { 661 Context *rsc = RsdCpuReference::getTlsContext(); 662 rsrForEach(rsc, rsGetObjPtr(target), rsGetObjPtr(in), rsGetObjPtr(out), usr, usrLen, call); 663} 664#endif 665 666 667////////////////////////////////////////////////////////////////////////////// 668// Time routines 669////////////////////////////////////////////////////////////////////////////// 670 671static float SC_GetDt() { 672 Context *rsc = RsdCpuReference::getTlsContext(); 673 const Script *sc = RsdCpuReference::getTlsScript(); 674 return rsrGetDt(rsc, sc); 675} 676 677// #if !defined(RS_COMPATIBILITY_LIB) && defined(__LP64__) 678#ifdef __LP64__ 679time_t SC_Time(time_t *timer) { 680 Context *rsc = RsdCpuReference::getTlsContext(); 681 return rsrTime(rsc, timer); 682} 683#else 684static int SC_Time(int *timer) { 685 Context *rsc = RsdCpuReference::getTlsContext(); 686 return rsrTime(rsc, (long*)timer); 687} 688#endif 689 690tm* SC_LocalTime(tm *local, time_t *timer) { 691 Context *rsc = RsdCpuReference::getTlsContext(); 692 return rsrLocalTime(rsc, local, timer); 693} 694 695int64_t SC_UptimeMillis() { 696 Context *rsc = RsdCpuReference::getTlsContext(); 697 return rsrUptimeMillis(rsc); 698} 699 700int64_t SC_UptimeNanos() { 701 Context *rsc = RsdCpuReference::getTlsContext(); 702 return rsrUptimeNanos(rsc); 703} 704 705////////////////////////////////////////////////////////////////////////////// 706// Message routines 707////////////////////////////////////////////////////////////////////////////// 708 709static uint32_t SC_ToClient2(int cmdID, const void *data, uint32_t len) { 710 Context *rsc = RsdCpuReference::getTlsContext(); 711 return rsrToClient(rsc, cmdID, data, len); 712} 713 714static uint32_t SC_ToClient(int cmdID) { 715 Context *rsc = RsdCpuReference::getTlsContext(); 716 return rsrToClient(rsc, cmdID, (const void *)nullptr, 0); 717} 718 719static uint32_t SC_ToClientBlocking2(int cmdID, const void *data, uint32_t len) { 720 Context *rsc = RsdCpuReference::getTlsContext(); 721 return rsrToClientBlocking(rsc, cmdID, data, len); 722} 723 724static uint32_t SC_ToClientBlocking(int cmdID) { 725 Context *rsc = RsdCpuReference::getTlsContext(); 726 return rsrToClientBlocking(rsc, cmdID, (const void *)nullptr, 0); 727} 728 729 730static void * ElementAt1D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x) { 731 Context *rsc = RsdCpuReference::getTlsContext(); 732 const Type *t = a->getType(); 733 const Element *e = t->getElement(); 734 735 char buf[256]; 736 if (x >= t->getLODDimX(0)) { 737 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0)); 738 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 739 return nullptr; 740 } 741 742 if (vecSize > 0) { 743 if (vecSize != e->getVectorSize()) { 744 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize()); 745 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 746 return nullptr; 747 } 748 749 if (dt != e->getType()) { 750 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType()); 751 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 752 return nullptr; 753 } 754 } 755 756 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr; 757 const uint32_t eSize = e->getSizeBytes(); 758 return &p[(eSize * x)]; 759} 760 761static void * ElementAt2D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y) { 762 Context *rsc = RsdCpuReference::getTlsContext(); 763 const Type *t = a->getType(); 764 const Element *e = t->getElement(); 765 766 char buf[256]; 767 if (x >= t->getLODDimX(0)) { 768 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0)); 769 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 770 return nullptr; 771 } 772 773 if (y >= t->getLODDimY(0)) { 774 sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0)); 775 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 776 return nullptr; 777 } 778 779 if (vecSize > 0) { 780 if (vecSize != e->getVectorSize()) { 781 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize()); 782 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 783 return nullptr; 784 } 785 786 if (dt != e->getType()) { 787 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType()); 788 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 789 return nullptr; 790 } 791 } 792 793 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr; 794 const uint32_t eSize = e->getSizeBytes(); 795 const uint32_t stride = a->mHal.drvState.lod[0].stride; 796 return &p[(eSize * x) + (y * stride)]; 797} 798 799static void * ElementAt3D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y, uint32_t z) { 800 Context *rsc = RsdCpuReference::getTlsContext(); 801 const Type *t = a->getType(); 802 const Element *e = t->getElement(); 803 804 char buf[256]; 805 if (x >= t->getLODDimX(0)) { 806 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0)); 807 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 808 return nullptr; 809 } 810 811 if (y >= t->getLODDimY(0)) { 812 sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0)); 813 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 814 return nullptr; 815 } 816 817 if (z >= t->getLODDimZ(0)) { 818 sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0)); 819 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 820 return nullptr; 821 } 822 823 if (vecSize > 0) { 824 if (vecSize != e->getVectorSize()) { 825 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize()); 826 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 827 return nullptr; 828 } 829 830 if (dt != e->getType()) { 831 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType()); 832 rsc->setError(RS_ERROR_FATAL_DEBUG, buf); 833 return nullptr; 834 } 835 } 836 837 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr; 838 const uint32_t eSize = e->getSizeBytes(); 839 const uint32_t stride = a->mHal.drvState.lod[0].stride; 840 return &p[(eSize * x) + (y * stride)]; 841} 842 843static const void * SC_GetElementAt1D(RS_TY_ALLOC a, uint32_t x) { 844 return ElementAt1D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x); 845} 846static const void * SC_GetElementAt2D(RS_TY_ALLOC a, uint32_t x, uint32_t y) { 847 return ElementAt2D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x, y); 848} 849static const void * SC_GetElementAt3D(RS_TY_ALLOC a, uint32_t x, uint32_t y, uint32_t z) { 850 return ElementAt3D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x, y, z); 851} 852 853static void SC_SetElementAt1D(RS_TY_ALLOC a, const void *ptr, uint32_t x) { 854 const Type *t = rsGetObjPtr(a)->getType(); 855 const Element *e = t->getElement(); 856 void *tmp = ElementAt1D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x); 857 if (tmp != nullptr) { 858 memcpy(tmp, ptr, e->getSizeBytes()); 859 } 860} 861static void SC_SetElementAt2D(RS_TY_ALLOC a, const void *ptr, uint32_t x, uint32_t y) { 862 const Type *t = rsGetObjPtr(a)->getType(); 863 const Element *e = t->getElement(); 864 void *tmp = ElementAt2D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x, y); 865 if (tmp != nullptr) { 866 memcpy(tmp, ptr, e->getSizeBytes()); 867 } 868} 869static void SC_SetElementAt3D(RS_TY_ALLOC a, const void *ptr, uint32_t x, uint32_t y, uint32_t z) { 870 const Type *t = rsGetObjPtr(a)->getType(); 871 const Element *e = t->getElement(); 872 void *tmp = ElementAt3D(rsGetObjPtr(a), RS_TYPE_UNSIGNED_8, 0, x, y, z); 873 if (tmp != nullptr) { 874 memcpy(tmp, ptr, e->getSizeBytes()); 875 } 876} 877 878const void *rsGetElementAt(::rs_allocation a, uint32_t x) { 879 return SC_GetElementAt1D(RS_CAST(a), x); 880} 881 882const void *rsGetElementAt(::rs_allocation a, uint32_t x, uint32_t y) { 883 return SC_GetElementAt2D(RS_CAST(a), x, y); 884} 885 886const void *rsGetElementAt(::rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { 887 return SC_GetElementAt3D(RS_CAST(a), x, y, z); 888} 889 890void rsSetElementAt(::rs_allocation a, const void *ptr, uint32_t x) { 891 SC_SetElementAt1D(RS_CAST(a), ptr, x); 892} 893 894void rsSetElementAt(::rs_allocation a, const void *ptr, uint32_t x, uint32_t y) { 895 SC_SetElementAt2D(RS_CAST(a), ptr, x, y); 896} 897 898void rsSetElementAt(::rs_allocation a, const void *ptr, uint32_t x, uint32_t y, uint32_t z) { 899 SC_SetElementAt3D(RS_CAST(a), ptr, x, y, z); 900} 901 902 903#define ELEMENT_AT(T, DT, VS) \ 904 static void SC_SetElementAt1_##T(RS_TY_ALLOC a, const T *val, uint32_t x) { \ 905 void *r = ElementAt1D(rsGetObjPtr(a), DT, VS, x); \ 906 if (r != nullptr) ((T *)r)[0] = *val; \ 907 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 908 } \ 909 static void SC_SetElementAt2_##T(RS_TY_ALLOC a, const T * val, uint32_t x, uint32_t y) { \ 910 void *r = ElementAt2D(rsGetObjPtr(a), DT, VS, x, y); \ 911 if (r != nullptr) ((T *)r)[0] = *val; \ 912 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 913 } \ 914 static void SC_SetElementAt3_##T(RS_TY_ALLOC a, const T * val, uint32_t x, uint32_t y, uint32_t z) { \ 915 void *r = ElementAt3D(rsGetObjPtr(a), DT, VS, x, y, z); \ 916 if (r != nullptr) ((T *)r)[0] = *val; \ 917 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 918 } \ 919 static void SC_GetElementAt1_##T(RS_TY_ALLOC a, T *val, uint32_t x) { \ 920 void *r = ElementAt1D(rsGetObjPtr(a), DT, VS, x); \ 921 if (r != nullptr) *val = ((T *)r)[0]; \ 922 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 923 } \ 924 static void SC_GetElementAt2_##T(RS_TY_ALLOC a, T *val, uint32_t x, uint32_t y) { \ 925 void *r = ElementAt2D(rsGetObjPtr(a), DT, VS, x, y); \ 926 if (r != nullptr) *val = ((T *)r)[0]; \ 927 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 928 } \ 929 static void SC_GetElementAt3_##T(RS_TY_ALLOC a, T *val, uint32_t x, uint32_t y, uint32_t z) { \ 930 void *r = ElementAt3D(rsGetObjPtr(a), DT, VS, x, y, z); \ 931 if (r != nullptr) *val = ((T *)r)[0]; \ 932 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \ 933 } \ 934 void rsSetElementAt_##T(::rs_allocation a, const T *val, uint32_t x) { \ 935 SC_SetElementAt1_##T(RS_CAST(a), val, x); \ 936 } \ 937 void rsSetElementAt_##T(::rs_allocation a, const T *val, uint32_t x, uint32_t y) { \ 938 SC_SetElementAt2_##T(RS_CAST(a), val, x, y); \ 939 } \ 940 void rsSetElementAt_##T(::rs_allocation a, const T *val, uint32_t x, uint32_t y, uint32_t z) { \ 941 SC_SetElementAt3_##T(RS_CAST(a), val, x, y, z); \ 942 } \ 943 void rsGetElementAt_##T(::rs_allocation a, T *val, uint32_t x) { \ 944 SC_GetElementAt1_##T(RS_CAST(a), val, x); \ 945 } \ 946 void rsGetElementAt_##T(::rs_allocation a, T *val, uint32_t x, uint32_t y) { \ 947 SC_GetElementAt2_##T(RS_CAST(a), val, x, y); \ 948 } \ 949 void rsGetElementAt_##T(::rs_allocation a, T *val, uint32_t x, uint32_t y, uint32_t z) { \ 950 SC_GetElementAt3_##T(RS_CAST(a), val, x, y, z); \ 951 } \ 952 953ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1) 954ELEMENT_AT(char2, RS_TYPE_SIGNED_8, 2) 955ELEMENT_AT(char3, RS_TYPE_SIGNED_8, 3) 956ELEMENT_AT(char4, RS_TYPE_SIGNED_8, 4) 957ELEMENT_AT(uchar, RS_TYPE_UNSIGNED_8, 1) 958ELEMENT_AT(uchar2, RS_TYPE_UNSIGNED_8, 2) 959ELEMENT_AT(uchar3, RS_TYPE_UNSIGNED_8, 3) 960ELEMENT_AT(uchar4, RS_TYPE_UNSIGNED_8, 4) 961ELEMENT_AT(short, RS_TYPE_SIGNED_16, 1) 962ELEMENT_AT(short2, RS_TYPE_SIGNED_16, 2) 963ELEMENT_AT(short3, RS_TYPE_SIGNED_16, 3) 964ELEMENT_AT(short4, RS_TYPE_SIGNED_16, 4) 965ELEMENT_AT(ushort, RS_TYPE_UNSIGNED_16, 1) 966ELEMENT_AT(ushort2, RS_TYPE_UNSIGNED_16, 2) 967ELEMENT_AT(ushort3, RS_TYPE_UNSIGNED_16, 3) 968ELEMENT_AT(ushort4, RS_TYPE_UNSIGNED_16, 4) 969ELEMENT_AT(int, RS_TYPE_SIGNED_32, 1) 970ELEMENT_AT(int2, RS_TYPE_SIGNED_32, 2) 971ELEMENT_AT(int3, RS_TYPE_SIGNED_32, 3) 972ELEMENT_AT(int4, RS_TYPE_SIGNED_32, 4) 973ELEMENT_AT(uint, RS_TYPE_UNSIGNED_32, 1) 974ELEMENT_AT(uint2, RS_TYPE_UNSIGNED_32, 2) 975ELEMENT_AT(uint3, RS_TYPE_UNSIGNED_32, 3) 976ELEMENT_AT(uint4, RS_TYPE_UNSIGNED_32, 4) 977ELEMENT_AT(long, RS_TYPE_SIGNED_64, 1) 978ELEMENT_AT(long2, RS_TYPE_SIGNED_64, 2) 979ELEMENT_AT(long3, RS_TYPE_SIGNED_64, 3) 980ELEMENT_AT(long4, RS_TYPE_SIGNED_64, 4) 981ELEMENT_AT(ulong, RS_TYPE_UNSIGNED_64, 1) 982ELEMENT_AT(ulong2, RS_TYPE_UNSIGNED_64, 2) 983ELEMENT_AT(ulong3, RS_TYPE_UNSIGNED_64, 3) 984ELEMENT_AT(ulong4, RS_TYPE_UNSIGNED_64, 4) 985ELEMENT_AT(float, RS_TYPE_FLOAT_32, 1) 986ELEMENT_AT(float2, RS_TYPE_FLOAT_32, 2) 987ELEMENT_AT(float3, RS_TYPE_FLOAT_32, 3) 988ELEMENT_AT(float4, RS_TYPE_FLOAT_32, 4) 989ELEMENT_AT(double, RS_TYPE_FLOAT_64, 1) 990ELEMENT_AT(double2, RS_TYPE_FLOAT_64, 2) 991ELEMENT_AT(double3, RS_TYPE_FLOAT_64, 3) 992ELEMENT_AT(double4, RS_TYPE_FLOAT_64, 4) 993 994#undef ELEMENT_AT 995 996#ifndef __LP64__ 997/* 998 * We miss some symbols for rs{Get,Set}Element_long,ulong variants because 64 999 * bit integer values are 'long' in RS-land but might be 'long long' in the 1000 * driver. Define native_long* and native_ulong* types to be vectors of 1001 * 'long' as seen by the driver and define overloaded versions of 1002 * rsSetElementAt_* and rsGetElementAt_*. This should get us the correct 1003 * mangled names in the driver. 1004 */ 1005 1006typedef long native_long2 __attribute__((ext_vector_type(2))); 1007typedef long native_long3 __attribute__((ext_vector_type(3))); 1008typedef long native_long4 __attribute__((ext_vector_type(4))); 1009typedef unsigned long native_ulong2 __attribute__((ext_vector_type(2))); 1010typedef unsigned long native_ulong3 __attribute__((ext_vector_type(3))); 1011typedef unsigned long native_ulong4 __attribute__((ext_vector_type(4))); 1012 1013#define ELEMENT_AT_OVERLOADS(T, U) \ 1014 void rsSetElementAt_##T(::rs_allocation a, const U *val, uint32_t x) { \ 1015 SC_SetElementAt1_##T(RS_CAST(a), (T *) val, x); \ 1016 } \ 1017 void rsSetElementAt_##T(::rs_allocation a, const U *val, uint32_t x, uint32_t y) { \ 1018 SC_SetElementAt2_##T(RS_CAST(a), (T *) val, x, y); \ 1019 } \ 1020 void rsSetElementAt_##T(::rs_allocation a, const U *val, uint32_t x, uint32_t y, uint32_t z) { \ 1021 SC_SetElementAt3_##T(RS_CAST(a), (T *) val, x, y, z); \ 1022 } \ 1023 void rsGetElementAt_##T(::rs_allocation a, U *val, uint32_t x) { \ 1024 SC_GetElementAt1_##T(RS_CAST(a), (T *) val, x); \ 1025 } \ 1026 void rsGetElementAt_##T(::rs_allocation a, U *val, uint32_t x, uint32_t y) { \ 1027 SC_GetElementAt2_##T(RS_CAST(a), (T *) val, x, y); \ 1028 } \ 1029 void rsGetElementAt_##T(::rs_allocation a, U *val, uint32_t x, uint32_t y, uint32_t z) { \ 1030 SC_GetElementAt3_##T(RS_CAST(a), (T *) val, x, y, z); \ 1031 } \ 1032 1033ELEMENT_AT_OVERLOADS(long2, native_long2) 1034ELEMENT_AT_OVERLOADS(long3, native_long3) 1035ELEMENT_AT_OVERLOADS(long4, native_long4) 1036ELEMENT_AT_OVERLOADS(ulong, unsigned long) 1037ELEMENT_AT_OVERLOADS(ulong2, native_ulong2) 1038ELEMENT_AT_OVERLOADS(ulong3, native_ulong3) 1039ELEMENT_AT_OVERLOADS(ulong4, native_ulong4) 1040 1041// We also need variants of rs{Get,Set}ElementAt_long that take 'long long *' as 1042// we might have this overloaded variant in old APKs. 1043ELEMENT_AT_OVERLOADS(long, long long) 1044 1045#undef ELEMENT_AT_OVERLOADS 1046#endif 1047 1048 1049////////////////////////////////////////////////////////////////////////////// 1050// Stub implementation 1051////////////////////////////////////////////////////////////////////////////// 1052 1053// llvm name mangling ref 1054// <builtin-type> ::= v # void 1055// ::= b # bool 1056// ::= c # char 1057// ::= a # signed char 1058// ::= h # unsigned char 1059// ::= s # short 1060// ::= t # unsigned short 1061// ::= i # int 1062// ::= j # unsigned int 1063// ::= l # long 1064// ::= m # unsigned long 1065// ::= x # long long, __int64 1066// ::= y # unsigned long long, __int64 1067// ::= f # float 1068// ::= d # double 1069 1070static RsdCpuReference::CpuSymbol gSyms[] = { 1071 // Debug runtime 1072 { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_GetElementAt1D, true }, 1073 { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_GetElementAt2D, true }, 1074 { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_GetElementAt3D, true }, 1075 { "_Z14rsSetElementAt13rs_allocationPKvj", (void *)&SC_SetElementAt1D, true }, 1076 { "_Z14rsSetElementAt13rs_allocationPKvjj", (void *)&SC_SetElementAt2D, true }, 1077 { "_Z14rsSetElementAt13rs_allocationPKvjjj", (void *)&SC_SetElementAt3D, true }, 1078 1079 1080 { "_Z20rsGetElementAt_uchar13rs_allocationPhj", (void *)&SC_GetElementAt1_uchar, true }, 1081 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hj", (void *)&SC_GetElementAt1_uchar2, true }, 1082 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hj", (void *)&SC_GetElementAt1_uchar3, true }, 1083 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hj", (void *)&SC_GetElementAt1_uchar4, true }, 1084 { "_Z20rsGetElementAt_uchar13rs_allocationPhjj", (void *)&SC_GetElementAt2_uchar, true }, 1085 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjj", (void *)&SC_GetElementAt2_uchar2, true }, 1086 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjj", (void *)&SC_GetElementAt2_uchar3, true }, 1087 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjj", (void *)&SC_GetElementAt2_uchar4, true }, 1088 { "_Z20rsGetElementAt_uchar13rs_allocationPhjjj", (void *)&SC_GetElementAt3_uchar, true }, 1089 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjjj", (void *)&SC_GetElementAt3_uchar2, true }, 1090 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjjj", (void *)&SC_GetElementAt3_uchar3, true }, 1091 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjjj", (void *)&SC_GetElementAt3_uchar4, true }, 1092 1093 { "_Z19rsGetElementAt_char13rs_allocationPcj", (void *)&SC_GetElementAt1_char, true }, 1094 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cj", (void *)&SC_GetElementAt1_char2, true }, 1095 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cj", (void *)&SC_GetElementAt1_char3, true }, 1096 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cj", (void *)&SC_GetElementAt1_char4, true }, 1097 { "_Z19rsGetElementAt_char13rs_allocationPcjj", (void *)&SC_GetElementAt2_char, true }, 1098 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjj", (void *)&SC_GetElementAt2_char2, true }, 1099 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjj", (void *)&SC_GetElementAt2_char3, true }, 1100 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjj", (void *)&SC_GetElementAt2_char4, true }, 1101 { "_Z19rsGetElementAt_char13rs_allocationPcjjj", (void *)&SC_GetElementAt3_char, true }, 1102 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjjj", (void *)&SC_GetElementAt3_char2, true }, 1103 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjjj", (void *)&SC_GetElementAt3_char3, true }, 1104 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjjj", (void *)&SC_GetElementAt3_char4, true }, 1105 1106 { "_Z21rsGetElementAt_ushort13rs_allocationPtj", (void *)&SC_GetElementAt1_ushort, true }, 1107 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tj", (void *)&SC_GetElementAt1_ushort2, true }, 1108 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tj", (void *)&SC_GetElementAt1_ushort3, true }, 1109 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tj", (void *)&SC_GetElementAt1_ushort4, true }, 1110 { "_Z21rsGetElementAt_ushort13rs_allocationPtjj", (void *)&SC_GetElementAt2_ushort, true }, 1111 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjj", (void *)&SC_GetElementAt2_ushort2, true }, 1112 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjj", (void *)&SC_GetElementAt2_ushort3, true }, 1113 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjj", (void *)&SC_GetElementAt2_ushort4, true }, 1114 { "_Z21rsGetElementAt_ushort13rs_allocationPtjjj", (void *)&SC_GetElementAt3_ushort, true }, 1115 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjjj", (void *)&SC_GetElementAt3_ushort2, true }, 1116 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjjj", (void *)&SC_GetElementAt3_ushort3, true }, 1117 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjjj", (void *)&SC_GetElementAt3_ushort4, true }, 1118 1119 { "_Z20rsGetElementAt_short13rs_allocationPsj", (void *)&SC_GetElementAt1_short, true }, 1120 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sj", (void *)&SC_GetElementAt1_short2, true }, 1121 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sj", (void *)&SC_GetElementAt1_short3, true }, 1122 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sj", (void *)&SC_GetElementAt1_short4, true }, 1123 { "_Z20rsGetElementAt_short13rs_allocationPsjj", (void *)&SC_GetElementAt2_short, true }, 1124 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjj", (void *)&SC_GetElementAt2_short2, true }, 1125 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjj", (void *)&SC_GetElementAt2_short3, true }, 1126 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjj", (void *)&SC_GetElementAt2_short4, true }, 1127 { "_Z20rsGetElementAt_short13rs_allocationPsjjj", (void *)&SC_GetElementAt3_short, true }, 1128 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjjj", (void *)&SC_GetElementAt3_short2, true }, 1129 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjjj", (void *)&SC_GetElementAt3_short3, true }, 1130 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjjj", (void *)&SC_GetElementAt3_short4, true }, 1131 1132 { "_Z19rsGetElementAt_uint13rs_allocationPjj", (void *)&SC_GetElementAt1_uint, true }, 1133 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jj", (void *)&SC_GetElementAt1_uint2, true }, 1134 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jj", (void *)&SC_GetElementAt1_uint3, true }, 1135 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jj", (void *)&SC_GetElementAt1_uint4, true }, 1136 { "_Z19rsGetElementAt_uint13rs_allocationPjjj", (void *)&SC_GetElementAt2_uint, true }, 1137 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjj", (void *)&SC_GetElementAt2_uint2, true }, 1138 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjj", (void *)&SC_GetElementAt2_uint3, true }, 1139 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjj", (void *)&SC_GetElementAt2_uint4, true }, 1140 { "_Z19rsGetElementAt_uint13rs_allocationPjjjj", (void *)&SC_GetElementAt3_uint, true }, 1141 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjjj", (void *)&SC_GetElementAt3_uint2, true }, 1142 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjjj", (void *)&SC_GetElementAt3_uint3, true }, 1143 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjjj", (void *)&SC_GetElementAt3_uint4, true }, 1144 1145 { "_Z18rsGetElementAt_int13rs_allocationPij", (void *)&SC_GetElementAt1_int, true }, 1146 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ij", (void *)&SC_GetElementAt1_int2, true }, 1147 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ij", (void *)&SC_GetElementAt1_int3, true }, 1148 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ij", (void *)&SC_GetElementAt1_int4, true }, 1149 { "_Z18rsGetElementAt_int13rs_allocationPijj", (void *)&SC_GetElementAt2_int, true }, 1150 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijj", (void *)&SC_GetElementAt2_int2, true }, 1151 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijj", (void *)&SC_GetElementAt2_int3, true }, 1152 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijj", (void *)&SC_GetElementAt2_int4, true }, 1153 { "_Z18rsGetElementAt_int13rs_allocationPijjj", (void *)&SC_GetElementAt3_int, true }, 1154 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijjj", (void *)&SC_GetElementAt3_int2, true }, 1155 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijjj", (void *)&SC_GetElementAt3_int3, true }, 1156 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijjj", (void *)&SC_GetElementAt3_int4, true }, 1157 1158 { "_Z20rsGetElementAt_ulong13rs_allocationPmj", (void *)&SC_GetElementAt1_ulong, true }, 1159 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mj", (void *)&SC_GetElementAt1_ulong2, true }, 1160 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mj", (void *)&SC_GetElementAt1_ulong3, true }, 1161 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mj", (void *)&SC_GetElementAt1_ulong4, true }, 1162 { "_Z20rsGetElementAt_ulong13rs_allocationPmjj", (void *)&SC_GetElementAt2_ulong, true }, 1163 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjj", (void *)&SC_GetElementAt2_ulong2, true }, 1164 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjj", (void *)&SC_GetElementAt2_ulong3, true }, 1165 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjj", (void *)&SC_GetElementAt2_ulong4, true }, 1166 { "_Z20rsGetElementAt_ulong13rs_allocationPmjjj", (void *)&SC_GetElementAt3_ulong, true }, 1167 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjjj", (void *)&SC_GetElementAt3_ulong2, true }, 1168 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjjj", (void *)&SC_GetElementAt3_ulong3, true }, 1169 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjjj", (void *)&SC_GetElementAt3_ulong4, true }, 1170 1171 { "_Z19rsGetElementAt_long13rs_allocationPlj", (void *)&SC_GetElementAt1_long, true }, 1172 { "_Z20rsGetElementAt_long213rs_allocationPDv2_lj", (void *)&SC_GetElementAt1_long2, true }, 1173 { "_Z20rsGetElementAt_long313rs_allocationPDv3_lj", (void *)&SC_GetElementAt1_long3, true }, 1174 { "_Z20rsGetElementAt_long413rs_allocationPDv4_lj", (void *)&SC_GetElementAt1_long4, true }, 1175 { "_Z19rsGetElementAt_long13rs_allocationPljj", (void *)&SC_GetElementAt2_long, true }, 1176 { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljj", (void *)&SC_GetElementAt2_long2, true }, 1177 { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljj", (void *)&SC_GetElementAt2_long3, true }, 1178 { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljj", (void *)&SC_GetElementAt2_long4, true }, 1179 { "_Z19rsGetElementAt_long13rs_allocationPljjj", (void *)&SC_GetElementAt3_long, true }, 1180 { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljjj", (void *)&SC_GetElementAt3_long2, true }, 1181 { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljjj", (void *)&SC_GetElementAt3_long3, true }, 1182 { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljjj", (void *)&SC_GetElementAt3_long4, true }, 1183 1184 { "_Z20rsGetElementAt_float13rs_allocationPfj", (void *)&SC_GetElementAt1_float, true }, 1185 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fj", (void *)&SC_GetElementAt1_float2, true }, 1186 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fj", (void *)&SC_GetElementAt1_float3, true }, 1187 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fj", (void *)&SC_GetElementAt1_float4, true }, 1188 { "_Z20rsGetElementAt_float13rs_allocationPfjj", (void *)&SC_GetElementAt2_float, true }, 1189 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjj", (void *)&SC_GetElementAt2_float2, true }, 1190 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjj", (void *)&SC_GetElementAt2_float3, true }, 1191 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjj", (void *)&SC_GetElementAt2_float4, true }, 1192 { "_Z20rsGetElementAt_float13rs_allocationPfjjj", (void *)&SC_GetElementAt3_float, true }, 1193 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjjj", (void *)&SC_GetElementAt3_float2, true }, 1194 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjjj", (void *)&SC_GetElementAt3_float3, true }, 1195 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjjj", (void *)&SC_GetElementAt3_float4, true }, 1196 1197 { "_Z21rsGetElementAt_double13rs_allocationPdj", (void *)&SC_GetElementAt1_double, true }, 1198 { "_Z22rsGetElementAt_double213rs_allocationPDv2_dj", (void *)&SC_GetElementAt1_double2, true }, 1199 { "_Z22rsGetElementAt_double313rs_allocationPDv3_dj", (void *)&SC_GetElementAt1_double3, true }, 1200 { "_Z22rsGetElementAt_double413rs_allocationPDv4_dj", (void *)&SC_GetElementAt1_double4, true }, 1201 { "_Z21rsGetElementAt_double13rs_allocationPdjj", (void *)&SC_GetElementAt2_double, true }, 1202 { "_Z22rsGetElementAt_double213rs_allocationPDv2_djj", (void *)&SC_GetElementAt2_double2, true }, 1203 { "_Z22rsGetElementAt_double313rs_allocationPDv3_djj", (void *)&SC_GetElementAt2_double3, true }, 1204 { "_Z22rsGetElementAt_double413rs_allocationPDv4_djj", (void *)&SC_GetElementAt2_double4, true }, 1205 { "_Z21rsGetElementAt_double13rs_allocationPdjjj", (void *)&SC_GetElementAt3_double, true }, 1206 { "_Z22rsGetElementAt_double213rs_allocationPDv2_djjj", (void *)&SC_GetElementAt3_double2, true }, 1207 { "_Z22rsGetElementAt_double313rs_allocationPDv3_djjj", (void *)&SC_GetElementAt3_double3, true }, 1208 { "_Z22rsGetElementAt_double413rs_allocationPDv4_djjj", (void *)&SC_GetElementAt3_double4, true }, 1209 1210 1211 1212 { "_Z20rsSetElementAt_uchar13rs_allocationPKhj", (void *)&SC_SetElementAt1_uchar, true }, 1213 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hj", (void *)&SC_SetElementAt1_uchar2, true }, 1214 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hj", (void *)&SC_SetElementAt1_uchar3, true }, 1215 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hj", (void *)&SC_SetElementAt1_uchar4, true }, 1216 { "_Z20rsSetElementAt_uchar13rs_allocationPKhjj", (void *)&SC_SetElementAt2_uchar, true }, 1217 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjj", (void *)&SC_SetElementAt2_uchar2, true }, 1218 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjj", (void *)&SC_SetElementAt2_uchar3, true }, 1219 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjj", (void *)&SC_SetElementAt2_uchar4, true }, 1220 { "_Z20rsSetElementAt_uchar13rs_allocationPKhjjj", (void *)&SC_SetElementAt3_uchar, true }, 1221 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjjj", (void *)&SC_SetElementAt3_uchar2, true }, 1222 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjjj", (void *)&SC_SetElementAt3_uchar3, true }, 1223 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjjj", (void *)&SC_SetElementAt3_uchar4, true }, 1224 1225 { "_Z19rsSetElementAt_char13rs_allocationPKcj", (void *)&SC_SetElementAt1_char, true }, 1226 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cj", (void *)&SC_SetElementAt1_char2, true }, 1227 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cj", (void *)&SC_SetElementAt1_char3, true }, 1228 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cj", (void *)&SC_SetElementAt1_char4, true }, 1229 { "_Z19rsSetElementAt_char13rs_allocationPKcjj", (void *)&SC_SetElementAt2_char, true }, 1230 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjj", (void *)&SC_SetElementAt2_char2, true }, 1231 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjj", (void *)&SC_SetElementAt2_char3, true }, 1232 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjj", (void *)&SC_SetElementAt2_char4, true }, 1233 { "_Z19rsSetElementAt_char13rs_allocationPKcjjj", (void *)&SC_SetElementAt3_char, true }, 1234 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjjj", (void *)&SC_SetElementAt3_char2, true }, 1235 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjjj", (void *)&SC_SetElementAt3_char3, true }, 1236 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjjj", (void *)&SC_SetElementAt3_char4, true }, 1237 1238 { "_Z21rsSetElementAt_ushort13rs_allocationPKtj", (void *)&SC_SetElementAt1_ushort, true }, 1239 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tj", (void *)&SC_SetElementAt1_ushort2, true }, 1240 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tj", (void *)&SC_SetElementAt1_ushort3, true }, 1241 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tj", (void *)&SC_SetElementAt1_ushort4, true }, 1242 { "_Z21rsSetElementAt_ushort13rs_allocationPKtjj", (void *)&SC_SetElementAt2_ushort, true }, 1243 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjj", (void *)&SC_SetElementAt2_ushort2, true }, 1244 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjj", (void *)&SC_SetElementAt2_ushort3, true }, 1245 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjj", (void *)&SC_SetElementAt2_ushort4, true }, 1246 { "_Z21rsSetElementAt_ushort13rs_allocationPKtjjj", (void *)&SC_SetElementAt3_ushort, true }, 1247 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjjj", (void *)&SC_SetElementAt3_ushort2, true }, 1248 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjjj", (void *)&SC_SetElementAt3_ushort3, true }, 1249 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjjj", (void *)&SC_SetElementAt3_ushort4, true }, 1250 1251 { "_Z20rsSetElementAt_short13rs_allocationPKsj", (void *)&SC_SetElementAt1_short, true }, 1252 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sj", (void *)&SC_SetElementAt1_short2, true }, 1253 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sj", (void *)&SC_SetElementAt1_short3, true }, 1254 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sj", (void *)&SC_SetElementAt1_short4, true }, 1255 { "_Z20rsSetElementAt_short13rs_allocationPKsjj", (void *)&SC_SetElementAt2_short, true }, 1256 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjj", (void *)&SC_SetElementAt2_short2, true }, 1257 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjj", (void *)&SC_SetElementAt2_short3, true }, 1258 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjj", (void *)&SC_SetElementAt2_short4, true }, 1259 { "_Z20rsSetElementAt_short13rs_allocationPKsjjj", (void *)&SC_SetElementAt3_short, true }, 1260 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjjj", (void *)&SC_SetElementAt3_short2, true }, 1261 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjjj", (void *)&SC_SetElementAt3_short3, true }, 1262 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjjj", (void *)&SC_SetElementAt3_short4, true }, 1263 1264 { "_Z19rsSetElementAt_uint13rs_allocationPKjj", (void *)&SC_SetElementAt1_uint, true }, 1265 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jj", (void *)&SC_SetElementAt1_uint2, true }, 1266 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jj", (void *)&SC_SetElementAt1_uint3, true }, 1267 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jj", (void *)&SC_SetElementAt1_uint4, true }, 1268 { "_Z19rsSetElementAt_uint13rs_allocationPKjjj", (void *)&SC_SetElementAt2_uint, true }, 1269 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjj", (void *)&SC_SetElementAt2_uint2, true }, 1270 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjj", (void *)&SC_SetElementAt2_uint3, true }, 1271 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjj", (void *)&SC_SetElementAt2_uint4, true }, 1272 { "_Z19rsSetElementAt_uint13rs_allocationPKjjjj", (void *)&SC_SetElementAt3_uint, true }, 1273 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjjj", (void *)&SC_SetElementAt3_uint2, true }, 1274 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjjj", (void *)&SC_SetElementAt3_uint3, true }, 1275 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjjj", (void *)&SC_SetElementAt3_uint4, true }, 1276 1277 { "_Z18rsSetElementAt_int13rs_allocationPKij", (void *)&SC_SetElementAt1_int, true }, 1278 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ij", (void *)&SC_SetElementAt1_int2, true }, 1279 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ij", (void *)&SC_SetElementAt1_int3, true }, 1280 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ij", (void *)&SC_SetElementAt1_int4, true }, 1281 { "_Z18rsSetElementAt_int13rs_allocationPKijj", (void *)&SC_SetElementAt2_int, true }, 1282 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijj", (void *)&SC_SetElementAt2_int2, true }, 1283 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijj", (void *)&SC_SetElementAt2_int3, true }, 1284 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijj", (void *)&SC_SetElementAt2_int4, true }, 1285 { "_Z18rsSetElementAt_int13rs_allocationPKijjj", (void *)&SC_SetElementAt3_int, true }, 1286 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijjj", (void *)&SC_SetElementAt3_int2, true }, 1287 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijjj", (void *)&SC_SetElementAt3_int3, true }, 1288 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijjj", (void *)&SC_SetElementAt3_int4, true }, 1289 1290 { "_Z20rsSetElementAt_ulong13rs_allocationPKmj", (void *)&SC_SetElementAt1_ulong, true }, 1291 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mj", (void *)&SC_SetElementAt1_ulong2, true }, 1292 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mj", (void *)&SC_SetElementAt1_ulong3, true }, 1293 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mj", (void *)&SC_SetElementAt1_ulong4, true }, 1294 { "_Z20rsSetElementAt_ulong13rs_allocationPKmjj", (void *)&SC_SetElementAt2_ulong, true }, 1295 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjj", (void *)&SC_SetElementAt2_ulong2, true }, 1296 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjj", (void *)&SC_SetElementAt2_ulong3, true }, 1297 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjj", (void *)&SC_SetElementAt2_ulong4, true }, 1298 { "_Z20rsSetElementAt_ulong13rs_allocationPKmjjj", (void *)&SC_SetElementAt3_ulong, true }, 1299 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjjj", (void *)&SC_SetElementAt3_ulong2, true }, 1300 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjjj", (void *)&SC_SetElementAt3_ulong3, true }, 1301 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjjj", (void *)&SC_SetElementAt3_ulong4, true }, 1302 1303 // Pre-21 compatibility path 1304 { "_Z20rsSetElementAt_ulong13rs_allocationPKyj", (void *)&SC_SetElementAt1_ulong, true }, 1305 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_yj", (void *)&SC_SetElementAt1_ulong2, true }, 1306 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_yj", (void *)&SC_SetElementAt1_ulong3, true }, 1307 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_yj", (void *)&SC_SetElementAt1_ulong4, true }, 1308 { "_Z20rsSetElementAt_ulong13rs_allocationPKyjj", (void *)&SC_SetElementAt2_ulong, true }, 1309 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_yjj", (void *)&SC_SetElementAt2_ulong2, true }, 1310 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_yjj", (void *)&SC_SetElementAt2_ulong3, true }, 1311 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_yjj", (void *)&SC_SetElementAt2_ulong4, true }, 1312 { "_Z20rsSetElementAt_ulong13rs_allocationPKyjjj", (void *)&SC_SetElementAt3_ulong, true }, 1313 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_yjjj", (void *)&SC_SetElementAt3_ulong2, true }, 1314 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_yjjj", (void *)&SC_SetElementAt3_ulong3, true }, 1315 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_yjjj", (void *)&SC_SetElementAt3_ulong4, true }, 1316 1317 { "_Z19rsSetElementAt_long13rs_allocationPKlj", (void *)&SC_SetElementAt1_long, true }, 1318 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_lj", (void *)&SC_SetElementAt1_long2, true }, 1319 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_lj", (void *)&SC_SetElementAt1_long3, true }, 1320 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_lj", (void *)&SC_SetElementAt1_long4, true }, 1321 { "_Z19rsSetElementAt_long13rs_allocationPKljj", (void *)&SC_SetElementAt2_long, true }, 1322 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljj", (void *)&SC_SetElementAt2_long2, true }, 1323 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljj", (void *)&SC_SetElementAt2_long3, true }, 1324 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljj", (void *)&SC_SetElementAt2_long4, true }, 1325 { "_Z19rsSetElementAt_long13rs_allocationPKljjj", (void *)&SC_SetElementAt3_long, true }, 1326 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljjj", (void *)&SC_SetElementAt3_long2, true }, 1327 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljjj", (void *)&SC_SetElementAt3_long3, true }, 1328 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljjj", (void *)&SC_SetElementAt3_long4, true }, 1329 1330 // Pre-21 compatibility path 1331 { "_Z19rsSetElementAt_long13rs_allocationPKxj", (void *)&SC_SetElementAt1_long, true }, 1332 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_xj", (void *)&SC_SetElementAt1_long2, true }, 1333 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_xj", (void *)&SC_SetElementAt1_long3, true }, 1334 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_xj", (void *)&SC_SetElementAt1_long4, true }, 1335 { "_Z19rsSetElementAt_long13rs_allocationPKxjj", (void *)&SC_SetElementAt2_long, true }, 1336 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_xjj", (void *)&SC_SetElementAt2_long2, true }, 1337 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_xjj", (void *)&SC_SetElementAt2_long3, true }, 1338 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_xjj", (void *)&SC_SetElementAt2_long4, true }, 1339 { "_Z19rsSetElementAt_long13rs_allocationPKxjjj", (void *)&SC_SetElementAt3_long, true }, 1340 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_xjjj", (void *)&SC_SetElementAt3_long2, true }, 1341 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_xjjj", (void *)&SC_SetElementAt3_long3, true }, 1342 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_xjjj", (void *)&SC_SetElementAt3_long4, true }, 1343 1344 { "_Z20rsSetElementAt_float13rs_allocationPKfj", (void *)&SC_SetElementAt1_float, true }, 1345 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fj", (void *)&SC_SetElementAt1_float2, true }, 1346 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fj", (void *)&SC_SetElementAt1_float3, true }, 1347 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fj", (void *)&SC_SetElementAt1_float4, true }, 1348 { "_Z20rsSetElementAt_float13rs_allocationPKfjj", (void *)&SC_SetElementAt2_float, true }, 1349 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjj", (void *)&SC_SetElementAt2_float2, true }, 1350 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjj", (void *)&SC_SetElementAt2_float3, true }, 1351 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjj", (void *)&SC_SetElementAt2_float4, true }, 1352 { "_Z20rsSetElementAt_float13rs_allocationPKfjjj", (void *)&SC_SetElementAt3_float, true }, 1353 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjjj", (void *)&SC_SetElementAt3_float2, true }, 1354 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjjj", (void *)&SC_SetElementAt3_float3, true }, 1355 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjjj", (void *)&SC_SetElementAt3_float4, true }, 1356 1357 { "_Z21rsSetElementAt_double13rs_allocationPKdj", (void *)&SC_SetElementAt1_double, true }, 1358 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_dj", (void *)&SC_SetElementAt1_double2, true }, 1359 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_dj", (void *)&SC_SetElementAt1_double3, true }, 1360 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_dj", (void *)&SC_SetElementAt1_double4, true }, 1361 { "_Z21rsSetElementAt_double13rs_allocationPKdjj", (void *)&SC_SetElementAt2_double, true }, 1362 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djj", (void *)&SC_SetElementAt2_double2, true }, 1363 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djj", (void *)&SC_SetElementAt2_double3, true }, 1364 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djj", (void *)&SC_SetElementAt2_double4, true }, 1365 { "_Z21rsSetElementAt_double13rs_allocationPKdjjj", (void *)&SC_SetElementAt3_double, true }, 1366 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djjj", (void *)&SC_SetElementAt3_double2, true }, 1367 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djjj", (void *)&SC_SetElementAt3_double3, true }, 1368 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djjj", (void *)&SC_SetElementAt3_double4, true }, 1369 1370 1371 // Refcounting 1372#ifndef __LP64__ 1373 { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_SetObject, true }, 1374 { "_Z10rsIsObject10rs_element", (void *)&SC_IsObject, true }, 1375 1376 { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_SetObject, true }, 1377 { "_Z10rsIsObject7rs_type", (void *)&SC_IsObject, true }, 1378 1379 { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_SetObject, true }, 1380 { "_Z10rsIsObject13rs_allocation", (void *)&SC_IsObject, true }, 1381 1382 { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_SetObject, true }, 1383 { "_Z10rsIsObject10rs_sampler", (void *)&SC_IsObject, true }, 1384 1385 { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_SetObject, true }, 1386 { "_Z10rsIsObject9rs_script", (void *)&SC_IsObject, true }, 1387#else 1388 { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_SetObject_ByRef, true }, 1389 { "_Z10rsIsObject10rs_element", (void *)&SC_IsObject_ByRef, true }, 1390 1391 { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_SetObject_ByRef, true }, 1392 { "_Z10rsIsObject7rs_type", (void *)&SC_IsObject_ByRef, true }, 1393 1394 { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_SetObject_ByRef, true }, 1395 { "_Z10rsIsObject13rs_allocation", (void *)&SC_IsObject_ByRef, true }, 1396 1397 { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_SetObject_ByRef, true }, 1398 { "_Z10rsIsObject10rs_sampler", (void *)&SC_IsObject_ByRef, true }, 1399 1400 { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_SetObject_ByRef, true }, 1401 { "_Z10rsIsObject9rs_script", (void *)&SC_IsObject_ByRef, true }, 1402#endif 1403 { "_Z13rsClearObjectP10rs_element", (void *)&SC_ClearObject, true }, 1404 { "_Z13rsClearObjectP7rs_type", (void *)&SC_ClearObject, true }, 1405 { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_ClearObject, true }, 1406 { "_Z13rsClearObjectP10rs_sampler", (void *)&SC_ClearObject, true }, 1407 { "_Z13rsClearObjectP9rs_script", (void *)&SC_ClearObject, true }, 1408 1409 1410 { "_Z11rsSetObjectP7rs_meshS_", (void *)&SC_SetObject, true }, 1411 { "_Z13rsClearObjectP7rs_mesh", (void *)&SC_ClearObject, true }, 1412 { "_Z10rsIsObject7rs_mesh", (void *)&SC_IsObject, true }, 1413 1414 { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&SC_SetObject, true }, 1415 { "_Z13rsClearObjectP19rs_program_fragment", (void *)&SC_ClearObject, true }, 1416 { "_Z10rsIsObject19rs_program_fragment", (void *)&SC_IsObject, true }, 1417 1418 { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&SC_SetObject, true }, 1419 { "_Z13rsClearObjectP17rs_program_vertex", (void *)&SC_ClearObject, true }, 1420 { "_Z10rsIsObject17rs_program_vertex", (void *)&SC_IsObject, true }, 1421 1422 { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&SC_SetObject, true }, 1423 { "_Z13rsClearObjectP17rs_program_raster", (void *)&SC_ClearObject, true }, 1424 { "_Z10rsIsObject17rs_program_raster", (void *)&SC_IsObject, true }, 1425 1426 { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&SC_SetObject, true }, 1427 { "_Z13rsClearObjectP16rs_program_store", (void *)&SC_ClearObject, true }, 1428 { "_Z10rsIsObject16rs_program_store", (void *)&SC_IsObject, true }, 1429 1430 { "_Z11rsSetObjectP7rs_fontS_", (void *)&SC_SetObject, true }, 1431 { "_Z13rsClearObjectP7rs_font", (void *)&SC_ClearObject, true }, 1432 { "_Z10rsIsObject7rs_font", (void *)&SC_IsObject, true }, 1433 1434 // Allocation ops 1435 { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_AllocationSyncAll, true }, 1436 { "_Z20rsgAllocationSyncAll13rs_allocation", (void *)&SC_AllocationSyncAll, false }, 1437 { "_Z20rsgAllocationSyncAll13rs_allocationj", (void *)&SC_AllocationSyncAll2, false }, 1438 { "_Z20rsgAllocationSyncAll13rs_allocation24rs_allocation_usage_type", (void *)&SC_AllocationSyncAll2, false }, 1439#ifndef RS_COMPATIBILITY_LIB 1440 { "_Z15rsGetAllocationPKv", (void *)&SC_GetAllocation, true }, 1441 { "_Z18rsAllocationIoSend13rs_allocation", (void *)&SC_AllocationIoSend, false }, 1442 { "_Z21rsAllocationIoReceive13rs_allocation", (void *)&SC_AllocationIoReceive, false }, 1443#endif 1444 { "_Z23rsAllocationCopy1DRange13rs_allocationjjjS_jj", (void *)&SC_AllocationCopy1DRange, false }, 1445 { "_Z23rsAllocationCopy2DRange13rs_allocationjjj26rs_allocation_cubemap_facejjS_jjjS0_", (void *)&SC_AllocationCopy2DRange, false }, 1446 1447 // Messaging 1448 1449 { "_Z14rsSendToClienti", (void *)&SC_ToClient, false }, 1450 { "_Z14rsSendToClientiPKvj", (void *)&SC_ToClient2, false }, 1451 { "_Z22rsSendToClientBlockingi", (void *)&SC_ToClientBlocking, false }, 1452 { "_Z22rsSendToClientBlockingiPKvj", (void *)&SC_ToClientBlocking2, false }, 1453#ifndef RS_COMPATIBILITY_LIB 1454 { "_Z22rsgBindProgramFragment19rs_program_fragment", (void *)&SC_BindProgramFragment, false }, 1455 { "_Z19rsgBindProgramStore16rs_program_store", (void *)&SC_BindProgramStore, false }, 1456 { "_Z20rsgBindProgramVertex17rs_program_vertex", (void *)&SC_BindProgramVertex, false }, 1457 { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_BindProgramRaster, false }, 1458 { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_BindSampler, false }, 1459 { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_BindTexture, false }, 1460 { "_Z15rsgBindConstant19rs_program_fragmentj13rs_allocation", (void *)&SC_BindFragmentConstant, false }, 1461 { "_Z15rsgBindConstant17rs_program_vertexj13rs_allocation", (void *)&SC_BindVertexConstant, false }, 1462 1463 { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadProjectionMatrix, false }, 1464 { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadModelMatrix, false }, 1465 { "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadTextureMatrix, false }, 1466 1467 { "_Z35rsgProgramVertexGetProjectionMatrixP12rs_matrix4x4", (void *)&SC_VpGetProjectionMatrix, false }, 1468 1469 { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_PfConstantColor, false }, 1470 1471 { "_Z11rsgGetWidthv", (void *)&SC_GetWidth, false }, 1472 { "_Z12rsgGetHeightv", (void *)&SC_GetHeight, false }, 1473 1474 1475 { "_Z11rsgDrawRectfffff", (void *)&SC_DrawRect, false }, 1476 { "_Z11rsgDrawQuadffffffffffff", (void *)&SC_DrawQuad, false }, 1477 { "_Z20rsgDrawQuadTexCoordsffffffffffffffffffff", (void *)&SC_DrawQuadTexCoords, false }, 1478 { "_Z24rsgDrawSpriteScreenspacefffff", (void *)&SC_DrawSpriteScreenspace, false }, 1479 1480 { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_DrawMesh, false }, 1481 { "_Z11rsgDrawMesh7rs_meshj", (void *)&SC_DrawMeshPrimitive, false }, 1482 { "_Z11rsgDrawMesh7rs_meshjjj", (void *)&SC_DrawMeshPrimitiveRange, false }, 1483 { "_Z25rsgMeshComputeBoundingBox7rs_meshPfS0_S0_S0_S0_S0_", (void *)&SC_MeshComputeBoundingBox, false }, 1484 1485 { "_Z13rsgClearColorffff", (void *)&SC_ClearColor, false }, 1486 { "_Z13rsgClearDepthf", (void *)&SC_ClearDepth, false }, 1487 1488 { "_Z11rsgDrawTextPKcii", (void *)&SC_DrawText, false }, 1489 { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc, false }, 1490 { "_Z14rsgMeasureTextPKcPiS1_S1_S1_", (void *)&SC_MeasureText, false }, 1491 { "_Z14rsgMeasureText13rs_allocationPiS0_S0_S0_", (void *)&SC_MeasureTextAlloc, false }, 1492 1493 { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont, false }, 1494 { "_Z12rsgFontColorffff", (void *)&SC_FontColor, false }, 1495 1496 { "_Z18rsgBindColorTarget13rs_allocationj", (void *)&SC_BindFrameBufferObjectColorTarget, false }, 1497 { "_Z18rsgBindDepthTarget13rs_allocation", (void *)&SC_BindFrameBufferObjectDepthTarget, false }, 1498 { "_Z19rsgClearColorTargetj", (void *)&SC_ClearFrameBufferObjectColorTarget, false }, 1499 { "_Z19rsgClearDepthTargetv", (void *)&SC_ClearFrameBufferObjectDepthTarget, false }, 1500 { "_Z24rsgClearAllRenderTargetsv", (void *)&SC_ClearFrameBufferObjectTargets, false }, 1501 1502 1503 { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, true }, 1504 { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, true }, 1505 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK14rs_script_call", (void *)&SC_ForEach_SAAUS, true }, 1506 1507 //rsForEach with usrdata is not supported in 64-bit 1508#ifndef __LP64__ 1509 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, true }, 1510 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK14rs_script_call", (void *)&SC_ForEach_SAAULS, true }, 1511#endif 1512#endif // RS_COMPATIBILITY_LIB 1513 1514#ifndef __LP64__ 1515 // time 1516 { "_Z6rsTimePi", (void *)&SC_Time, true }, 1517 { "_Z11rsLocaltimeP5rs_tmPKi", (void *)&SC_LocalTime, true }, 1518#else 1519 // time 1520 { "_Z6rsTimePl", (void *)&SC_Time, true }, 1521 { "_Z11rsLocaltimeP5rs_tmPKl", (void *)&SC_LocalTime, true }, 1522#endif 1523 { "_Z14rsUptimeMillisv", (void*)&SC_UptimeMillis, true }, 1524 { "_Z13rsUptimeNanosv", (void*)&SC_UptimeNanos, true }, 1525 { "_Z7rsGetDtv", (void*)&SC_GetDt, false }, 1526 1527 // misc 1528#ifndef RS_COMPATIBILITY_LIB 1529 { "_Z5colorffff", (void *)&SC_Color, false }, 1530 { "_Z9rsgFinishv", (void *)&SC_Finish, false }, 1531#endif 1532 1533 { nullptr, nullptr, false } 1534}; 1535 1536#ifndef RS_COMPATIBILITY_LIB 1537 1538typedef struct { unsigned int val; } rs_allocation_usage_type; 1539 1540void rsAllocationMarkDirty(::rs_allocation a) { 1541 return SC_AllocationSyncAll(RS_CAST(a)); 1542} 1543 1544void rsgAllocationSyncAll(::rs_allocation a) { 1545 return SC_AllocationSyncAll(RS_CAST(a)); 1546} 1547 1548void rsgAllocationSyncAll(::rs_allocation a, 1549 unsigned int usage) { 1550 return SC_AllocationSyncAll2(RS_CAST(a), (RsAllocationUsageType) usage); 1551} 1552void rsgAllocationSyncAll(::rs_allocation a, 1553 rs_allocation_usage_type source) { 1554 return SC_AllocationSyncAll2(RS_CAST(a), (RsAllocationUsageType) source.val); 1555} 1556 1557void rsgBindProgramFragment(::rs_program_fragment pf) { 1558 return SC_BindProgramFragment((ProgramFragment *) pf.p); 1559} 1560 1561void rsgBindProgramStore(::rs_program_store ps) { 1562 return SC_BindProgramStore((ProgramStore *) ps.p); 1563} 1564 1565void rsgBindProgramVertex(::rs_program_vertex pv) { 1566 return SC_BindProgramVertex((ProgramVertex *) pv.p); 1567} 1568 1569void rsgBindProgramRaster(::rs_program_raster pr) { 1570 return SC_BindProgramRaster((ProgramRaster *) pr.p); 1571} 1572 1573void rsgBindSampler(::rs_program_fragment pf, 1574 uint32_t slot, 1575 ::rs_sampler s) { 1576 return SC_BindSampler((ProgramFragment *) pf.p, slot, (Sampler *) s.p); 1577} 1578 1579void rsgBindTexture(::rs_program_fragment pf, 1580 uint32_t slot, 1581 ::rs_allocation a) { 1582 return SC_BindTexture((ProgramFragment *) pf.p, 1583 slot, 1584 (Allocation *) a.p); 1585} 1586 1587void rsgBindConstant(::rs_program_fragment pf, 1588 uint32_t slot, 1589 ::rs_allocation a) { 1590 return SC_BindFragmentConstant((ProgramFragment *) pf.p, 1591 slot, 1592 (Allocation *) a.p); 1593} 1594 1595void rsgBindConstant(::rs_program_vertex pv, 1596 uint32_t slot, 1597 ::rs_allocation a) { 1598 return SC_BindVertexConstant((ProgramVertex *) pv.p, 1599 slot, 1600 (Allocation *) a.p); 1601} 1602 1603void rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *m) { 1604 return SC_VpLoadProjectionMatrix((const rsc_Matrix *) m); 1605} 1606 1607void rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *m) { 1608 return SC_VpLoadModelMatrix((const rsc_Matrix *) m); 1609} 1610 1611void rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *m) { 1612 return SC_VpLoadTextureMatrix((const rsc_Matrix *) m); 1613} 1614 1615void rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *m) { 1616 return SC_VpGetProjectionMatrix((rsc_Matrix *) m); 1617} 1618 1619void rsgProgramFragmentConstantColor(::rs_program_fragment pf, 1620 float r, float g, 1621 float b, float a) { 1622 1623 return SC_PfConstantColor((ProgramFragment *) pf.p, r, g, b, a); 1624} 1625 1626uint32_t rsgGetWidth(void) { 1627 return SC_GetWidth(); 1628} 1629 1630uint32_t rsgGetHeight(void) { 1631 return SC_GetHeight(); 1632} 1633 1634void rsgDrawRect(float x1, float y1, float x2, float y2, float z) { 1635 return SC_DrawRect(x1, y1, x2, y2, z); 1636} 1637 1638void rsgDrawQuad(float x1, float y1, float z1, 1639 float x2, float y2, float z2, 1640 float x3, float y3, float z3, 1641 float x4, float y4, float z4) { 1642 1643 SC_DrawQuad(x1, y1, z1, 1644 x2, y2, z2, 1645 x3, y3, z3, 1646 x4, y4, z4); 1647} 1648 1649void rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, 1650 float x2, float y2, float z2, float u2, float v2, 1651 float x3, float y3, float z3, float u3, float v3, 1652 float x4, float y4, float z4, float u4, float v4) { 1653 1654 return rsgDrawQuadTexCoords(x1, y1, z1, u1, v1, 1655 x2, y2, z2, u2, v2, 1656 x3, y3, z3, u3, v3, 1657 x4, y4, z4, u4, v4); 1658} 1659 1660void rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h) { 1661 return SC_DrawSpriteScreenspace(x, y, z, w, h); 1662} 1663 1664void rsgDrawMesh(::rs_mesh ism) { 1665 return SC_DrawMesh((Mesh *) ism.p); 1666} 1667 1668void rsgDrawMesh(::rs_mesh ism, uint primitiveIndex) { 1669 return SC_DrawMeshPrimitive((Mesh *) ism.p, primitiveIndex); 1670} 1671 1672void rsgDrawMesh(::rs_mesh ism, uint primitiveIndex, uint start, uint len) { 1673 return SC_DrawMeshPrimitiveRange((Mesh *) ism.p, primitiveIndex, start, len); 1674} 1675 1676void rsgMeshComputeBoundingBox(::rs_mesh mesh, 1677 float *minX, float *minY, float *minZ, 1678 float *maxX, float *maxY, float *maxZ) { 1679 1680 return SC_MeshComputeBoundingBox((Mesh *) mesh.p, 1681 minX, minY, minZ, 1682 maxX, maxY, maxZ); 1683} 1684 1685void rsgClearColor(float r, float g, float b, float a) { 1686 return SC_ClearColor(r, g, b, a); 1687} 1688 1689void rsgClearDepth(float value) { 1690 return SC_ClearDepth(value); 1691} 1692 1693void rsgDrawText(const char *text, int x, int y) { 1694 return SC_DrawText(text, x, y); 1695} 1696 1697void rsgDrawText(::rs_allocation a, int x, int y) { 1698 return SC_DrawTextAlloc((Allocation *) a.p, x, y); 1699} 1700 1701void rsgMeasureText(const char *text, int *left, int *right, 1702 int *top, int *bottom) { 1703 return SC_MeasureText(text, left, right, top, bottom); 1704} 1705 1706void rsgMeasureText(::rs_allocation a, int *left, int *right, 1707 int *top, int *bottom) { 1708 return SC_MeasureTextAlloc((Allocation *) a.p, left, right, top, bottom); 1709} 1710 1711void rsgBindFont(::rs_font font) { 1712 return SC_BindFont((Font *) font.p); 1713} 1714 1715void rsgFontColor(float r, float g, float b, float a) { 1716 return SC_FontColor(r, g, b, a); 1717} 1718 1719void rsgBindColorTarget(::rs_allocation a, uint slot) { 1720 return SC_BindFrameBufferObjectColorTarget((Allocation *) a.p, slot); 1721} 1722 1723void rsgBindDepthTarget(::rs_allocation a) { 1724 return SC_BindFrameBufferObjectDepthTarget((Allocation *) a.p); 1725} 1726 1727void rsgClearColorTarget(uint slot) { 1728 return SC_ClearFrameBufferObjectColorTarget(slot); 1729} 1730 1731void rsgClearDepthTarget(void) { 1732 return SC_ClearFrameBufferObjectDepthTarget(nullptr, nullptr); 1733} 1734 1735void rsgClearAllRenderTargets(void) { 1736 return SC_ClearFrameBufferObjectTargets(nullptr, nullptr); 1737} 1738 1739void color(float r, float g, float b, float a) { 1740 return SC_Color(r, g, b, a); 1741} 1742 1743void rsgFinish(void) { 1744 return SC_Finish(); 1745} 1746 1747#endif 1748 1749////////////////////////////////////////////////////////////////////////////// 1750// Compatibility Library entry points 1751////////////////////////////////////////////////////////////////////////////// 1752 1753#ifndef __LP64__ 1754#define IS_CLEAR_SET_OBJ(t, u, v) \ 1755 bool rsIsObject(t src) { \ 1756 return src.p != nullptr; \ 1757 } \ 1758 void __attribute__((overloadable)) rsClearObject(t *dst) { \ 1759 return SC_ClearObject(reinterpret_cast<rs_object_base *>(dst)); \ 1760 } \ 1761 void __attribute__((overloadable)) rsSetObject(t *dst, t src) { \ 1762 android::renderscript::rs_object_base cast; \ 1763 cast.p = (ObjectBase *) src.p; \ 1764 return SC_SetObject(reinterpret_cast<rs_object_base *>(dst), cast);\ 1765 } 1766#else 1767#define IS_CLEAR_SET_OBJ(t, u, v) \ 1768 extern "C" { bool u(t* src) { \ 1769 return src->p != nullptr; \ 1770 } }\ 1771 void __attribute__((overloadable)) rsClearObject(t *dst) { \ 1772 return SC_ClearObject(reinterpret_cast<rs_object_base *>(dst)); \ 1773 } \ 1774 extern "C" {\ 1775 void v (t *dst, t *src) { \ 1776 return SC_SetObject_ByRef(reinterpret_cast<rs_object_base *>(dst),\ 1777 reinterpret_cast<rs_object_base *>(src));\ 1778 } } 1779#endif 1780 1781IS_CLEAR_SET_OBJ(::rs_element, _Z10rsIsObject10rs_element, _Z11rsSetObjectP10rs_elementS_) 1782IS_CLEAR_SET_OBJ(::rs_type, _Z10rsIsObject7rs_type, _Z11rsSetObjectP7rs_typeS_) 1783IS_CLEAR_SET_OBJ(::rs_allocation, _Z10rsIsObject13rs_allocation, _Z11rsSetObjectP13rs_allocationS_) 1784IS_CLEAR_SET_OBJ(::rs_sampler, _Z10rsIsObject10rs_sampler, _Z11rsSetObjectP10rs_samplerS_) 1785IS_CLEAR_SET_OBJ(::rs_script, _Z10rsIsObject9rs_script, _Z11rsSetObjectP9rs_scriptS_) 1786 1787IS_CLEAR_SET_OBJ(::rs_mesh, _Z10rsIsObject7rs_mesh, _Z11rsSetObjectP7rs_meshS_) 1788IS_CLEAR_SET_OBJ(::rs_program_fragment, _Z10rsIsObject19rs_program_fragment, _Z11rsSetObjectP19rs_program_fragmentS_) 1789IS_CLEAR_SET_OBJ(::rs_program_vertex, _Z10rsIsObject17rs_program_vertex, _Z11rsSetObjectP17rs_program_vertexS_) 1790IS_CLEAR_SET_OBJ(::rs_program_raster, _Z10rsIsObject17rs_program_raster, _Z11rsSetObjectP17rs_program_rasterS_) 1791IS_CLEAR_SET_OBJ(::rs_program_store, _Z10rsIsObject16rs_program_store, _Z11rsSetObjectP16rs_program_storeS_) 1792IS_CLEAR_SET_OBJ(::rs_font, _Z10rsIsObject7rs_font, _Z11rsSetObjectP7rs_fontS_) 1793 1794 1795#undef IS_CLEAR_SET_OBJ 1796 1797#ifdef RS_COMPATIBILITY_LIB 1798static const Allocation * SC_GetAllocation(const void *ptr) { 1799 Context *rsc = RsdCpuReference::getTlsContext(); 1800 const Script *sc = RsdCpuReference::getTlsScript(); 1801 return rsdScriptGetAllocationForPointer(rsc, sc, ptr); 1802} 1803 1804const Allocation * rsGetAllocation(const void *ptr) { 1805 return SC_GetAllocation(ptr); 1806} 1807 1808#else 1809const android::renderscript::rs_allocation rsGetAllocation(const void *ptr) { 1810#ifdef __i386__ 1811 android::renderscript::rs_allocation obj; 1812 obj.p = (Allocation *) SC_GetAllocation(ptr); 1813 return obj; 1814#else 1815 return SC_GetAllocation(ptr); 1816#endif 1817} 1818#endif 1819 1820 1821void __attribute__((overloadable)) rsAllocationIoSend(::rs_allocation a) { 1822 SC_AllocationIoSend(RS_CAST(a)); 1823} 1824 1825void __attribute__((overloadable)) rsAllocationIoReceive(::rs_allocation a) { 1826 SC_AllocationIoReceive(RS_CAST(a)); 1827} 1828 1829 1830void __attribute__((overloadable)) rsAllocationCopy1DRange( 1831 ::rs_allocation dstAlloc, 1832 uint32_t dstOff, uint32_t dstMip, uint32_t count, 1833 ::rs_allocation srcAlloc, 1834 uint32_t srcOff, uint32_t srcMip) { 1835 SC_AllocationCopy1DRange(RS_CAST(dstAlloc), dstOff, dstMip, count, 1836 RS_CAST(srcAlloc), srcOff, srcMip); 1837} 1838 1839void __attribute__((overloadable)) rsAllocationCopy2DRange( 1840 ::rs_allocation dstAlloc, 1841 uint32_t dstXoff, uint32_t dstYoff, 1842 uint32_t dstMip, rs_allocation_cubemap_face dstFace, 1843 uint32_t width, uint32_t height, 1844 ::rs_allocation srcAlloc, 1845 uint32_t srcXoff, uint32_t srcYoff, 1846 uint32_t srcMip, rs_allocation_cubemap_face srcFace) { 1847 SC_AllocationCopy2DRange(RS_CAST(dstAlloc), dstXoff, dstYoff, 1848 dstMip, dstFace, width, height, 1849 RS_CAST(srcAlloc), srcXoff, srcYoff, 1850 srcMip, srcFace); 1851} 1852 1853void __attribute__((overloadable)) rsForEach(::rs_script script, 1854 ::rs_allocation in, 1855 ::rs_allocation out, 1856 const void *usr, 1857 const rs_script_call *call) { 1858 return SC_ForEach_SAAUS(RS_CAST(script), RS_CAST(in), RS_CAST(out), usr, (RsScriptCall*)call); 1859} 1860 1861void __attribute__((overloadable)) rsForEach(::rs_script script, 1862 ::rs_allocation in, 1863 ::rs_allocation out, 1864 const void *usr) { 1865 return SC_ForEach_SAAU(RS_CAST(script), RS_CAST(in), RS_CAST(out), usr); 1866} 1867 1868void __attribute__((overloadable)) rsForEach(::rs_script script, 1869 ::rs_allocation in, 1870 ::rs_allocation out) { 1871 return SC_ForEach_SAA(RS_CAST(script), RS_CAST(in), RS_CAST(out)); 1872} 1873 1874#ifndef __LP64__ 1875void __attribute__((overloadable)) rsForEach(::rs_script script, 1876 ::rs_allocation in, 1877 ::rs_allocation out, 1878 const void *usr, 1879 uint32_t usrLen) { 1880 return SC_ForEach_SAAUL(RS_CAST(script), RS_CAST(in), RS_CAST(out), usr, usrLen); 1881} 1882 1883void __attribute__((overloadable)) rsForEach(::rs_script script, 1884 ::rs_allocation in, 1885 ::rs_allocation out, 1886 const void *usr, 1887 uint32_t usrLen, 1888 const rs_script_call *call) { 1889 return SC_ForEach_SAAULS(RS_CAST(script), RS_CAST(in), RS_CAST(out), usr, usrLen, (RsScriptCall*)call); 1890} 1891#endif 1892 1893// #if defined(RS_COMPATIBILITY_LIB) || !defined(__LP64__) 1894#ifndef __LP64__ 1895int rsTime(int *timer) { 1896 return SC_Time(timer); 1897} 1898 1899rs_tm* rsLocaltime(rs_tm* local, const int *timer) { 1900 return (rs_tm*)(SC_LocalTime((tm*)local, (time_t *)timer)); 1901} 1902#else 1903time_t rsTime(time_t * timer) { 1904 return SC_Time(timer); 1905} 1906 1907rs_tm* rsLocaltime(rs_tm* local, const time_t *timer) { 1908 return (rs_tm*)(SC_LocalTime((tm*)local, (time_t *)timer)); 1909} 1910#endif // RS_COMPATIBILITY_LIB 1911 1912int64_t rsUptimeMillis() { 1913 Context *rsc = RsdCpuReference::getTlsContext(); 1914 return rsrUptimeMillis(rsc); 1915} 1916 1917int64_t rsUptimeNanos() { 1918 return SC_UptimeNanos(); 1919} 1920 1921float rsGetDt() { 1922 return SC_GetDt(); 1923} 1924 1925uint32_t rsSendToClient(int cmdID) { 1926 return SC_ToClient(cmdID); 1927} 1928 1929uint32_t rsSendToClient(int cmdID, const void *data, uint32_t len) { 1930 return SC_ToClient2(cmdID, data, len); 1931} 1932 1933uint32_t rsSendToClientBlocking(int cmdID) { 1934 return SC_ToClientBlocking(cmdID); 1935} 1936 1937uint32_t rsSendToClientBlocking(int cmdID, const void *data, uint32_t len) { 1938 return SC_ToClientBlocking2(cmdID, data, len); 1939} 1940 1941static void SC_debugF(const char *s, float f) { 1942 ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f))); 1943} 1944static void SC_debugFv2(const char *s, float f1, float f2) { 1945 ALOGD("%s {%f, %f}", s, f1, f2); 1946} 1947static void SC_debugFv3(const char *s, float f1, float f2, float f3) { 1948 ALOGD("%s {%f, %f, %f}", s, f1, f2, f3); 1949} 1950static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) { 1951 ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4); 1952} 1953static void SC_debugF2(const char *s, float2 f) { 1954 ALOGD("%s {%f, %f}", s, f.x, f.y); 1955} 1956static void SC_debugF3(const char *s, float3 f) { 1957 ALOGD("%s {%f, %f, %f}", s, f.x, f.y, f.z); 1958} 1959static void SC_debugF4(const char *s, float4 f) { 1960 ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w); 1961} 1962static void SC_debugD(const char *s, double d) { 1963 ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d))); 1964} 1965static void SC_debugFM4v4(const char *s, const float *f) { 1966 ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]); 1967 ALOGD("%s %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]); 1968 ALOGD("%s %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]); 1969 ALOGD("%s %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]); 1970} 1971static void SC_debugFM3v3(const char *s, const float *f) { 1972 ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]); 1973 ALOGD("%s %f, %f, %f", s, f[1], f[4], f[7]); 1974 ALOGD("%s %f, %f, %f}",s, f[2], f[5], f[8]); 1975} 1976static void SC_debugFM2v2(const char *s, const float *f) { 1977 ALOGD("%s {%f, %f", s, f[0], f[2]); 1978 ALOGD("%s %f, %f}",s, f[1], f[3]); 1979} 1980static void SC_debugI8(const char *s, char c) { 1981 ALOGD("%s %hhd 0x%hhx", s, c, (unsigned char)c); 1982} 1983static void SC_debugC2(const char *s, char2 c) { 1984 ALOGD("%s {%hhd, %hhd} 0x%hhx 0x%hhx", s, c.x, c.y, (unsigned char)c.x, (unsigned char)c.y); 1985} 1986static void SC_debugC3(const char *s, char3 c) { 1987 ALOGD("%s {%hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, (unsigned char)c.x, (unsigned char)c.y, (unsigned char)c.z); 1988} 1989static void SC_debugC4(const char *s, char4 c) { 1990 ALOGD("%s {%hhd, %hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.w, (unsigned char)c.x, (unsigned char)c.y, (unsigned char)c.z, (unsigned char)c.w); 1991} 1992static void SC_debugU8(const char *s, unsigned char c) { 1993 ALOGD("%s %hhu 0x%hhx", s, c, c); 1994} 1995static void SC_debugUC2(const char *s, uchar2 c) { 1996 ALOGD("%s {%hhu, %hhu} 0x%hhx 0x%hhx", s, c.x, c.y, c.x, c.y); 1997} 1998static void SC_debugUC3(const char *s, uchar3 c) { 1999 ALOGD("%s {%hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.x, c.y, c.z); 2000} 2001static void SC_debugUC4(const char *s, uchar4 c) { 2002 ALOGD("%s {%hhu, %hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w); 2003} 2004static void SC_debugI16(const char *s, short c) { 2005 ALOGD("%s %hd 0x%hx", s, c, c); 2006} 2007static void SC_debugS2(const char *s, short2 c) { 2008 ALOGD("%s {%hd, %hd} 0x%hx 0x%hx", s, c.x, c.y, c.x, c.y); 2009} 2010static void SC_debugS3(const char *s, short3 c) { 2011 ALOGD("%s {%hd, %hd, %hd} 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z); 2012} 2013static void SC_debugS4(const char *s, short4 c) { 2014 ALOGD("%s {%hd, %hd, %hd, %hd} 0x%hx 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w); 2015} 2016static void SC_debugU16(const char *s, unsigned short c) { 2017 ALOGD("%s %hu 0x%hx", s, c, c); 2018} 2019static void SC_debugUS2(const char *s, ushort2 c) { 2020 ALOGD("%s {%hu, %hu} 0x%hx 0x%hx", s, c.x, c.y, c.x, c.y); 2021} 2022static void SC_debugUS3(const char *s, ushort3 c) { 2023 ALOGD("%s {%hu, %hu, %hu} 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z); 2024} 2025static void SC_debugUS4(const char *s, ushort4 c) { 2026 ALOGD("%s {%hu, %hu, %hu, %hu} 0x%hx 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w); 2027} 2028static void SC_debugI32(const char *s, int32_t i) { 2029 ALOGD("%s %d 0x%x", s, i, i); 2030} 2031static void SC_debugI2(const char *s, int2 i) { 2032 ALOGD("%s {%d, %d} 0x%x 0x%x", s, i.x, i.y, i.x, i.y); 2033} 2034static void SC_debugI3(const char *s, int3 i) { 2035 ALOGD("%s {%d, %d, %d} 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z); 2036} 2037static void SC_debugI4(const char *s, int4 i) { 2038 ALOGD("%s {%d, %d, %d, %d} 0x%x 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.w, i.x, i.y, i.z, i.w); 2039} 2040static void SC_debugU32(const char *s, uint32_t i) { 2041 ALOGD("%s %u 0x%x", s, i, i); 2042} 2043static void SC_debugUI2(const char *s, uint2 i) { 2044 ALOGD("%s {%u, %u} 0x%x 0x%x", s, i.x, i.y, i.x, i.y); 2045} 2046static void SC_debugUI3(const char *s, uint3 i) { 2047 ALOGD("%s {%u, %u, %u} 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z); 2048} 2049static void SC_debugUI4(const char *s, uint4 i) { 2050 ALOGD("%s {%u, %u, %u, %u} 0x%x 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.w, i.x, i.y, i.z, i.w); 2051} 2052 2053template <typename T> 2054static inline long long LL(const T &x) { 2055 return static_cast<long long>(x); 2056} 2057 2058template <typename T> 2059static inline unsigned long long LLu(const T &x) { 2060 return static_cast<unsigned long long>(x); 2061} 2062 2063static void SC_debugLL64(const char *s, long long ll) { 2064 ALOGD("%s %lld 0x%llx", s, LL(ll), LL(ll)); 2065} 2066 2067static void SC_debugL2(const char *s, long2 ll) { 2068 ALOGD("%s {%lld, %lld} 0x%llx 0x%llx", s, LL(ll.x), LL(ll.y), LL(ll.x), LL(ll.y)); 2069} 2070static void SC_debugL3(const char *s, long3 ll) { 2071 ALOGD("%s {%lld, %lld, %lld} 0x%llx 0x%llx 0x%llx", s, LL(ll.x), LL(ll.y), LL(ll.z), LL(ll.x), LL(ll.y), LL(ll.z)); 2072} 2073static void SC_debugL4(const char *s, long4 ll) { 2074 ALOGD("%s {%lld, %lld, %lld, %lld} 0x%llx 0x%llx 0x%llx 0x%llx", s, LL(ll.x), LL(ll.y), LL(ll.z), LL(ll.w), LL(ll.x), LL(ll.y), LL(ll.z), LL(ll.w)); 2075} 2076static void SC_debugULL64(const char *s, unsigned long long ll) { 2077 ALOGD("%s %llu 0x%llx", s, ll, ll); 2078} 2079static void SC_debugUL2(const char *s, ulong2 ll) { 2080 ALOGD("%s {%llu, %llu} 0x%llx 0x%llx", s, LLu(ll.x), LLu(ll.y), LLu(ll.x), LLu(ll.y)); 2081} 2082static void SC_debugUL3(const char *s, ulong3 ll) { 2083 ALOGD("%s {%llu, %llu, %llu} 0x%llx 0x%llx 0x%llx", s, LLu(ll.x), LLu(ll.y), LLu(ll.z), LLu(ll.x), LLu(ll.y), LLu(ll.z)); 2084} 2085static void SC_debugUL4(const char *s, ulong4 ll) { 2086 ALOGD("%s {%llu, %llu, %llu, %llu} 0x%llx 0x%llx 0x%llx 0x%llx", s, LLu(ll.x), LLu(ll.y), LLu(ll.z), LLu(ll.w), LLu(ll.x), LLu(ll.y), LLu(ll.z), LLu(ll.w)); 2087} 2088 2089static void SC_debugP(const char *s, const void *p) { 2090 ALOGD("%s %p", s, p); 2091} 2092 2093// TODO: allocation ops, messaging, time 2094 2095void rsDebug(const char *s, float f) { 2096 SC_debugF(s, f); 2097} 2098 2099void rsDebug(const char *s, float f1, float f2) { 2100 SC_debugFv2(s, f1, f2); 2101} 2102 2103void rsDebug(const char *s, float f1, float f2, float f3) { 2104 SC_debugFv3(s, f1, f2, f3); 2105} 2106 2107void rsDebug(const char *s, float f1, float f2, float f3, float f4) { 2108 SC_debugFv4(s, f1, f2, f3, f4); 2109} 2110 2111void rsDebug(const char *s, const float2 *f) { 2112 SC_debugF2(s, *f); 2113} 2114 2115void rsDebug(const char *s, const float3 *f) { 2116 SC_debugF3(s, *f); 2117} 2118 2119void rsDebug(const char *s, const float4 *f) { 2120 SC_debugF4(s, *f); 2121} 2122 2123void rsDebug(const char *s, double d) { 2124 SC_debugD(s, d); 2125} 2126 2127void rsDebug(const char *s, const rs_matrix4x4 *m) { 2128 SC_debugFM4v4(s, (float *) m); 2129} 2130 2131void rsDebug(const char *s, const rs_matrix3x3 *m) { 2132 SC_debugFM3v3(s, (float *) m); 2133} 2134 2135void rsDebug(const char *s, const rs_matrix2x2 *m) { 2136 SC_debugFM2v2(s, (float *) m); 2137} 2138 2139void rsDebug(const char *s, char c) { 2140 SC_debugI8(s, c); 2141} 2142 2143void rsDebug(const char *s, const char2 *c) { 2144 SC_debugC2(s, *c); 2145} 2146 2147void rsDebug(const char *s, const char3 *c) { 2148 SC_debugC3(s, *c); 2149} 2150 2151void rsDebug(const char *s, const char4 *c) { 2152 SC_debugC4(s, *c); 2153} 2154 2155void rsDebug(const char *s, unsigned char c) { 2156 SC_debugU8(s, c); 2157} 2158 2159void rsDebug(const char *s, const uchar2 *c) { 2160 SC_debugUC2(s, *c); 2161} 2162 2163void rsDebug(const char *s, const uchar3 *c) { 2164 SC_debugUC3(s, *c); 2165} 2166 2167void rsDebug(const char *s, const uchar4 *c) { 2168 SC_debugUC4(s, *c); 2169} 2170 2171void rsDebug(const char *s, short c) { 2172 SC_debugI16(s, c); 2173} 2174 2175void rsDebug(const char *s, const short2 *c) { 2176 SC_debugS2(s, *c); 2177} 2178 2179void rsDebug(const char *s, const short3 *c) { 2180 SC_debugS3(s, *c); 2181} 2182 2183void rsDebug(const char *s, const short4 *c) { 2184 SC_debugS4(s, *c); 2185} 2186 2187void rsDebug(const char *s, unsigned short c) { 2188 SC_debugU16(s, c); 2189} 2190 2191void rsDebug(const char *s, const ushort2 *c) { 2192 SC_debugUS2(s, *c); 2193} 2194 2195void rsDebug(const char *s, const ushort3 *c) { 2196 SC_debugUS3(s, *c); 2197} 2198 2199void rsDebug(const char *s, const ushort4 *c) { 2200 SC_debugUS4(s, *c); 2201} 2202 2203void rsDebug(const char *s, int c) { 2204 SC_debugI32(s, c); 2205} 2206 2207void rsDebug(const char *s, const int2 *c) { 2208 SC_debugI2(s, *c); 2209} 2210 2211void rsDebug(const char *s, const int3 *c) { 2212 SC_debugI3(s, *c); 2213} 2214 2215void rsDebug(const char *s, const int4 *c) { 2216 SC_debugI4(s, *c); 2217} 2218 2219void rsDebug(const char *s, unsigned int c) { 2220 SC_debugU32(s, c); 2221} 2222 2223void rsDebug(const char *s, const uint2 *c) { 2224 SC_debugUI2(s, *c); 2225} 2226 2227void rsDebug(const char *s, const uint3 *c) { 2228 SC_debugUI3(s, *c); 2229} 2230 2231void rsDebug(const char *s, const uint4 *c) { 2232 SC_debugUI4(s, *c); 2233} 2234 2235void rsDebug(const char *s, long c) { 2236 SC_debugLL64(s, c); 2237} 2238 2239void rsDebug(const char *s, long long c) { 2240 SC_debugLL64(s, c); 2241} 2242 2243void rsDebug(const char *s, const long2 *c) { 2244 SC_debugL2(s, *c); 2245} 2246 2247void rsDebug(const char *s, const long3 *c) { 2248 SC_debugL3(s, *c); 2249} 2250 2251void rsDebug(const char *s, const long4 *c) { 2252 SC_debugL4(s, *c); 2253} 2254 2255void rsDebug(const char *s, unsigned long c) { 2256 SC_debugULL64(s, c); 2257} 2258 2259void rsDebug(const char *s, unsigned long long c) { 2260 SC_debugULL64(s, c); 2261} 2262 2263void rsDebug(const char *s, const ulong2 *c) { 2264 SC_debugUL2(s, *c); 2265} 2266 2267void rsDebug(const char *s, const ulong3 *c) { 2268 SC_debugUL3(s, *c); 2269} 2270 2271void rsDebug(const char *s, const ulong4 *c) { 2272 SC_debugUL4(s, *c); 2273} 2274 2275// FIXME: We need to export these function signatures for the compatibility 2276// library. The C++ name mangling that LLVM uses for ext_vector_type requires 2277// different versions for "long" vs. "long long". Note that the called 2278// functions are still using the appropriate 64-bit sizes. 2279 2280#ifndef __LP64__ 2281typedef long l2 __attribute__((ext_vector_type(2))); 2282typedef long l3 __attribute__((ext_vector_type(3))); 2283typedef long l4 __attribute__((ext_vector_type(4))); 2284typedef unsigned long ul2 __attribute__((ext_vector_type(2))); 2285typedef unsigned long ul3 __attribute__((ext_vector_type(3))); 2286typedef unsigned long ul4 __attribute__((ext_vector_type(4))); 2287 2288void rsDebug(const char *s, const l2 *c) { 2289 SC_debugL2(s, *(const long2 *)c); 2290} 2291 2292void rsDebug(const char *s, const l3 *c) { 2293 SC_debugL3(s, *(const long3 *)c); 2294} 2295 2296void rsDebug(const char *s, const l4 *c) { 2297 SC_debugL4(s, *(const long4 *)c); 2298} 2299 2300void rsDebug(const char *s, const ul2 *c) { 2301 SC_debugUL2(s, *(const ulong2 *)c); 2302} 2303 2304void rsDebug(const char *s, const ul3 *c) { 2305 SC_debugUL3(s, *(const ulong3 *)c); 2306} 2307 2308void rsDebug(const char *s, const ul4 *c) { 2309 SC_debugUL4(s, *(const ulong4 *)c); 2310} 2311#endif 2312 2313void rsDebug(const char *s, const long2 c) { 2314 SC_debugL2(s, c); 2315} 2316 2317void rsDebug(const char *s, const long3 c) { 2318 SC_debugL3(s, c); 2319} 2320 2321void rsDebug(const char *s, const long4 c) { 2322 SC_debugL4(s, c); 2323} 2324 2325void rsDebug(const char *s, const ulong2 c) { 2326 SC_debugUL2(s, c); 2327} 2328 2329void rsDebug(const char *s, const ulong3 c) { 2330 SC_debugUL3(s, c); 2331} 2332 2333void rsDebug(const char *s, const ulong4 c) { 2334 SC_debugUL4(s, c); 2335} 2336 2337 2338void rsDebug(const char *s, const void *p) { 2339 SC_debugP(s, p); 2340} 2341 2342extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) { 2343 ScriptC *s = (ScriptC *)pContext; 2344 const RsdCpuReference::CpuSymbol *syms = gSyms; 2345 const RsdCpuReference::CpuSymbol *sym = nullptr; 2346 2347 if (!sym) { 2348 while (syms->fnPtr) { 2349 if (!strcmp(syms->name, name)) { 2350 return syms; 2351 } 2352 syms++; 2353 } 2354 } 2355 2356 return nullptr; 2357} 2358