Home | History | Annotate | Download | only in driver
      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 "rsdPath.h"
     28 #include "rsdAllocation.h"
     29 #include "rsdShaderCache.h"
     30 #include "rsdVertexArray.h"
     31 
     32 #include <time.h>
     33 
     34 using namespace android;
     35 using namespace android::renderscript;
     36 
     37 typedef float float2 __attribute__((ext_vector_type(2)));
     38 typedef float float3 __attribute__((ext_vector_type(3)));
     39 typedef float float4 __attribute__((ext_vector_type(4)));
     40 typedef double double2 __attribute__((ext_vector_type(2)));
     41 typedef double double3 __attribute__((ext_vector_type(3)));
     42 typedef double double4 __attribute__((ext_vector_type(4)));
     43 typedef char char2 __attribute__((ext_vector_type(2)));
     44 typedef char char3 __attribute__((ext_vector_type(3)));
     45 typedef char char4 __attribute__((ext_vector_type(4)));
     46 typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
     47 typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
     48 typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
     49 typedef short short2 __attribute__((ext_vector_type(2)));
     50 typedef short short3 __attribute__((ext_vector_type(3)));
     51 typedef short short4 __attribute__((ext_vector_type(4)));
     52 typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
     53 typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
     54 typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
     55 typedef int32_t int2 __attribute__((ext_vector_type(2)));
     56 typedef int32_t int3 __attribute__((ext_vector_type(3)));
     57 typedef int32_t int4 __attribute__((ext_vector_type(4)));
     58 typedef uint32_t uint2 __attribute__((ext_vector_type(2)));
     59 typedef uint32_t uint3 __attribute__((ext_vector_type(3)));
     60 typedef uint32_t uint4 __attribute__((ext_vector_type(4)));
     61 typedef long long long2 __attribute__((ext_vector_type(2)));
     62 typedef long long long3 __attribute__((ext_vector_type(3)));
     63 typedef long long long4 __attribute__((ext_vector_type(4)));
     64 typedef unsigned long long ulong2 __attribute__((ext_vector_type(2)));
     65 typedef unsigned long long ulong3 __attribute__((ext_vector_type(3)));
     66 typedef unsigned long long ulong4 __attribute__((ext_vector_type(4)));
     67 
     68 typedef uint8_t uchar;
     69 typedef uint16_t ushort;
     70 typedef uint32_t uint;
     71 #ifndef RS_SERVER
     72 typedef uint64_t ulong;
     73 #endif
     74 
     75 #ifdef RS_COMPATIBILITY_LIB
     76 #define OPAQUETYPE(t) \
     77     typedef struct { const int* const p; } __attribute__((packed, aligned(4))) t;
     78 
     79 OPAQUETYPE(rs_element)
     80 OPAQUETYPE(rs_type)
     81 OPAQUETYPE(rs_allocation)
     82 OPAQUETYPE(rs_sampler)
     83 OPAQUETYPE(rs_script)
     84 OPAQUETYPE(rs_script_call)
     85 #undef OPAQUETYPE
     86 
     87 typedef struct {
     88     int tm_sec;     ///< seconds
     89     int tm_min;     ///< minutes
     90     int tm_hour;    ///< hours
     91     int tm_mday;    ///< day of the month
     92     int tm_mon;     ///< month
     93     int tm_year;    ///< year
     94     int tm_wday;    ///< day of the week
     95     int tm_yday;    ///< day of the year
     96     int tm_isdst;   ///< daylight savings time
     97 } rs_tm;
     98 #endif
     99 
    100 //////////////////////////////////////////////////////////////////////////////
    101 // Allocation
    102 //////////////////////////////////////////////////////////////////////////////
    103 
    104 
    105 static void SC_AllocationSyncAll2(Allocation *a, RsAllocationUsageType source) {
    106     Context *rsc = RsdCpuReference::getTlsContext();
    107     rsrAllocationSyncAll(rsc, a, source);
    108 }
    109 
    110 static void SC_AllocationSyncAll(Allocation *a) {
    111     Context *rsc = RsdCpuReference::getTlsContext();
    112     rsrAllocationSyncAll(rsc, a, RS_ALLOCATION_USAGE_SCRIPT);
    113 }
    114 
    115 static void SC_AllocationCopy1DRange(Allocation *dstAlloc,
    116                                      uint32_t dstOff,
    117                                      uint32_t dstMip,
    118                                      uint32_t count,
    119                                      Allocation *srcAlloc,
    120                                      uint32_t srcOff, uint32_t srcMip) {
    121     Context *rsc = RsdCpuReference::getTlsContext();
    122     rsrAllocationCopy1DRange(rsc, dstAlloc, dstOff, dstMip, count,
    123                              srcAlloc, srcOff, srcMip);
    124 }
    125 
    126 static void SC_AllocationCopy2DRange(Allocation *dstAlloc,
    127                                      uint32_t dstXoff, uint32_t dstYoff,
    128                                      uint32_t dstMip, uint32_t dstFace,
    129                                      uint32_t width, uint32_t height,
    130                                      Allocation *srcAlloc,
    131                                      uint32_t srcXoff, uint32_t srcYoff,
    132                                      uint32_t srcMip, uint32_t srcFace) {
    133     Context *rsc = RsdCpuReference::getTlsContext();
    134     rsrAllocationCopy2DRange(rsc, dstAlloc,
    135                              dstXoff, dstYoff, dstMip, dstFace,
    136                              width, height,
    137                              srcAlloc,
    138                              srcXoff, srcYoff, srcMip, srcFace);
    139 }
    140 
    141 #ifndef RS_COMPATIBILITY_LIB
    142 static void SC_AllocationIoSend(Allocation *alloc) {
    143     Context *rsc = RsdCpuReference::getTlsContext();
    144     rsdAllocationIoSend(rsc, alloc);
    145 }
    146 
    147 
    148 static void SC_AllocationIoReceive(Allocation *alloc) {
    149     Context *rsc = RsdCpuReference::getTlsContext();
    150     rsdAllocationIoReceive(rsc, alloc);
    151 }
    152 
    153 
    154 
    155 //////////////////////////////////////////////////////////////////////////////
    156 // Context
    157 //////////////////////////////////////////////////////////////////////////////
    158 
    159 static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) {
    160     Context *rsc = RsdCpuReference::getTlsContext();
    161     rsrBindTexture(rsc, pf, slot, a);
    162 }
    163 
    164 static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) {
    165     Context *rsc = RsdCpuReference::getTlsContext();
    166     rsrBindConstant(rsc, pv, slot, a);
    167 }
    168 
    169 static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) {
    170     Context *rsc = RsdCpuReference::getTlsContext();
    171     rsrBindConstant(rsc, pf, slot, a);
    172 }
    173 
    174 static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) {
    175     Context *rsc = RsdCpuReference::getTlsContext();
    176     rsrBindSampler(rsc, pf, slot, s);
    177 }
    178 
    179 static void SC_BindProgramStore(ProgramStore *ps) {
    180     Context *rsc = RsdCpuReference::getTlsContext();
    181     rsrBindProgramStore(rsc, ps);
    182 }
    183 
    184 static void SC_BindProgramFragment(ProgramFragment *pf) {
    185     Context *rsc = RsdCpuReference::getTlsContext();
    186     rsrBindProgramFragment(rsc, pf);
    187 }
    188 
    189 static void SC_BindProgramVertex(ProgramVertex *pv) {
    190     Context *rsc = RsdCpuReference::getTlsContext();
    191     rsrBindProgramVertex(rsc, pv);
    192 }
    193 
    194 static void SC_BindProgramRaster(ProgramRaster *pr) {
    195     Context *rsc = RsdCpuReference::getTlsContext();
    196     rsrBindProgramRaster(rsc, pr);
    197 }
    198 
    199 static void SC_BindFrameBufferObjectColorTarget(Allocation *a, uint32_t slot) {
    200     Context *rsc = RsdCpuReference::getTlsContext();
    201     rsrBindFrameBufferObjectColorTarget(rsc, a, slot);
    202 }
    203 
    204 static void SC_BindFrameBufferObjectDepthTarget(Allocation *a) {
    205     Context *rsc = RsdCpuReference::getTlsContext();
    206     rsrBindFrameBufferObjectDepthTarget(rsc, a);
    207 }
    208 
    209 static void SC_ClearFrameBufferObjectColorTarget(uint32_t slot) {
    210     Context *rsc = RsdCpuReference::getTlsContext();
    211     rsrClearFrameBufferObjectColorTarget(rsc, slot);
    212 }
    213 
    214 static void SC_ClearFrameBufferObjectDepthTarget(Context *, Script *) {
    215     Context *rsc = RsdCpuReference::getTlsContext();
    216     rsrClearFrameBufferObjectDepthTarget(rsc);
    217 }
    218 
    219 static void SC_ClearFrameBufferObjectTargets(Context *, Script *) {
    220     Context *rsc = RsdCpuReference::getTlsContext();
    221     rsrClearFrameBufferObjectTargets(rsc);
    222 }
    223 
    224 
    225 //////////////////////////////////////////////////////////////////////////////
    226 // VP
    227 //////////////////////////////////////////////////////////////////////////////
    228 
    229 static void SC_VpLoadProjectionMatrix(const rsc_Matrix *m) {
    230     Context *rsc = RsdCpuReference::getTlsContext();
    231     rsrVpLoadProjectionMatrix(rsc, m);
    232 }
    233 
    234 static void SC_VpLoadModelMatrix(const rsc_Matrix *m) {
    235     Context *rsc = RsdCpuReference::getTlsContext();
    236     rsrVpLoadModelMatrix(rsc, m);
    237 }
    238 
    239 static void SC_VpLoadTextureMatrix(const rsc_Matrix *m) {
    240     Context *rsc = RsdCpuReference::getTlsContext();
    241     rsrVpLoadTextureMatrix(rsc, m);
    242 }
    243 
    244 static void SC_PfConstantColor(ProgramFragment *pf, float r, float g, float b, float a) {
    245     Context *rsc = RsdCpuReference::getTlsContext();
    246     rsrPfConstantColor(rsc, pf, r, g, b, a);
    247 }
    248 
    249 static void SC_VpGetProjectionMatrix(rsc_Matrix *m) {
    250     Context *rsc = RsdCpuReference::getTlsContext();
    251     rsrVpGetProjectionMatrix(rsc, m);
    252 }
    253 
    254 
    255 //////////////////////////////////////////////////////////////////////////////
    256 // Drawing
    257 //////////////////////////////////////////////////////////////////////////////
    258 
    259 static void SC_DrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
    260                                  float x2, float y2, float z2, float u2, float v2,
    261                                  float x3, float y3, float z3, float u3, float v3,
    262                                  float x4, float y4, float z4, float u4, float v4) {
    263     Context *rsc = RsdCpuReference::getTlsContext();
    264 
    265     if (!rsc->setupCheck()) {
    266         return;
    267     }
    268 
    269     RsdHal *dc = (RsdHal *)rsc->mHal.drv;
    270     if (!dc->gl.shaderCache->setup(rsc)) {
    271         return;
    272     }
    273 
    274     //ALOGE("Quad");
    275     //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
    276     //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
    277     //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
    278     //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
    279 
    280     float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
    281     const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
    282 
    283     RsdVertexArray::Attrib attribs[2];
    284     attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position");
    285     attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0");
    286 
    287     RsdVertexArray va(attribs, 2);
    288     va.setup(rsc);
    289 
    290     RSD_CALL_GL(glDrawArrays, GL_TRIANGLE_FAN, 0, 4);
    291 }
    292 
    293 static void SC_DrawQuad(float x1, float y1, float z1,
    294                         float x2, float y2, float z2,
    295                         float x3, float y3, float z3,
    296                         float x4, float y4, float z4) {
    297     SC_DrawQuadTexCoords(x1, y1, z1, 0, 1,
    298                          x2, y2, z2, 1, 1,
    299                          x3, y3, z3, 1, 0,
    300                          x4, y4, z4, 0, 0);
    301 }
    302 
    303 static void SC_DrawSpriteScreenspace(float x, float y, float z, float w, float h) {
    304     Context *rsc = RsdCpuReference::getTlsContext();
    305 
    306     ObjectBaseRef<const ProgramVertex> tmp(rsc->getProgramVertex());
    307     rsc->setProgramVertex(rsc->getDefaultProgramVertex());
    308     //rsc->setupCheck();
    309 
    310     //GLint crop[4] = {0, h, w, -h};
    311 
    312     float sh = rsc->getHeight();
    313 
    314     SC_DrawQuad(x,   sh - y,     z,
    315                 x+w, sh - y,     z,
    316                 x+w, sh - (y+h), z,
    317                 x,   sh - (y+h), z);
    318     rsc->setProgramVertex((ProgramVertex *)tmp.get());
    319 }
    320 
    321 static void SC_DrawRect(float x1, float y1, float x2, float y2, float z) {
    322     SC_DrawQuad(x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z);
    323 }
    324 
    325 static void SC_DrawPath(Path *p) {
    326     Context *rsc = RsdCpuReference::getTlsContext();
    327     rsdPathDraw(rsc, p);
    328 }
    329 
    330 static void SC_DrawMesh(Mesh *m) {
    331     Context *rsc = RsdCpuReference::getTlsContext();
    332     rsrDrawMesh(rsc, m);
    333 }
    334 
    335 static void SC_DrawMeshPrimitive(Mesh *m, uint32_t primIndex) {
    336     Context *rsc = RsdCpuReference::getTlsContext();
    337     rsrDrawMeshPrimitive(rsc, m, primIndex);
    338 }
    339 
    340 static void SC_DrawMeshPrimitiveRange(Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len) {
    341     Context *rsc = RsdCpuReference::getTlsContext();
    342     rsrDrawMeshPrimitiveRange(rsc, m, primIndex, start, len);
    343 }
    344 
    345 static void SC_MeshComputeBoundingBox(Mesh *m,
    346                                float *minX, float *minY, float *minZ,
    347                                float *maxX, float *maxY, float *maxZ) {
    348     Context *rsc = RsdCpuReference::getTlsContext();
    349     rsrMeshComputeBoundingBox(rsc, m, minX, minY, minZ, maxX, maxY, maxZ);
    350 }
    351 
    352 
    353 
    354 //////////////////////////////////////////////////////////////////////////////
    355 //
    356 //////////////////////////////////////////////////////////////////////////////
    357 
    358 
    359 static void SC_Color(float r, float g, float b, float a) {
    360     Context *rsc = RsdCpuReference::getTlsContext();
    361     rsrColor(rsc, r, g, b, a);
    362 }
    363 
    364 static void SC_Finish() {
    365     Context *rsc = RsdCpuReference::getTlsContext();
    366     rsdGLFinish(rsc);
    367 }
    368 
    369 static void SC_ClearColor(float r, float g, float b, float a) {
    370     Context *rsc = RsdCpuReference::getTlsContext();
    371     rsrPrepareClear(rsc);
    372     rsdGLClearColor(rsc, r, g, b, a);
    373 }
    374 
    375 static void SC_ClearDepth(float v) {
    376     Context *rsc = RsdCpuReference::getTlsContext();
    377     rsrPrepareClear(rsc);
    378     rsdGLClearDepth(rsc, v);
    379 }
    380 
    381 static uint32_t SC_GetWidth() {
    382     Context *rsc = RsdCpuReference::getTlsContext();
    383     return rsrGetWidth(rsc);
    384 }
    385 
    386 static uint32_t SC_GetHeight() {
    387     Context *rsc = RsdCpuReference::getTlsContext();
    388     return rsrGetHeight(rsc);
    389 }
    390 
    391 static void SC_DrawTextAlloc(Allocation *a, int x, int y) {
    392     Context *rsc = RsdCpuReference::getTlsContext();
    393     rsrDrawTextAlloc(rsc, a, x, y);
    394 }
    395 
    396 static void SC_DrawText(const char *text, int x, int y) {
    397     Context *rsc = RsdCpuReference::getTlsContext();
    398     rsrDrawText(rsc, text, x, y);
    399 }
    400 
    401 static void SC_MeasureTextAlloc(Allocation *a,
    402                          int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
    403     Context *rsc = RsdCpuReference::getTlsContext();
    404     rsrMeasureTextAlloc(rsc, a, left, right, top, bottom);
    405 }
    406 
    407 static void SC_MeasureText(const char *text,
    408                     int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
    409     Context *rsc = RsdCpuReference::getTlsContext();
    410     rsrMeasureText(rsc, text, left, right, top, bottom);
    411 }
    412 
    413 static void SC_BindFont(Font *f) {
    414     Context *rsc = RsdCpuReference::getTlsContext();
    415     rsrBindFont(rsc, f);
    416 }
    417 
    418 static void SC_FontColor(float r, float g, float b, float a) {
    419     Context *rsc = RsdCpuReference::getTlsContext();
    420     rsrFontColor(rsc, r, g, b, a);
    421 }
    422 #endif
    423 
    424 
    425 //////////////////////////////////////////////////////////////////////////////
    426 //
    427 //////////////////////////////////////////////////////////////////////////////
    428 
    429 static void SC_SetObject(ObjectBase **dst, ObjectBase * src) {
    430     Context *rsc = RsdCpuReference::getTlsContext();
    431     rsrSetObject(rsc, dst, src);
    432 }
    433 
    434 static void SC_ClearObject(ObjectBase **dst) {
    435     Context *rsc = RsdCpuReference::getTlsContext();
    436     rsrClearObject(rsc, dst);
    437 }
    438 
    439 static bool SC_IsObject(const ObjectBase *src) {
    440     Context *rsc = RsdCpuReference::getTlsContext();
    441     return rsrIsObject(rsc, src);
    442 }
    443 
    444 
    445 
    446 
    447 static const Allocation * SC_GetAllocation(const void *ptr) {
    448     Context *rsc = RsdCpuReference::getTlsContext();
    449     const Script *sc = RsdCpuReference::getTlsScript();
    450     return rsdScriptGetAllocationForPointer(rsc, sc, ptr);
    451 }
    452 
    453 static void SC_ForEach_SAA(Script *target,
    454                             Allocation *in,
    455                             Allocation *out) {
    456     Context *rsc = RsdCpuReference::getTlsContext();
    457     rsrForEach(rsc, target, in, out, NULL, 0, NULL);
    458 }
    459 
    460 static void SC_ForEach_SAAU(Script *target,
    461                             Allocation *in,
    462                             Allocation *out,
    463                             const void *usr) {
    464     Context *rsc = RsdCpuReference::getTlsContext();
    465     rsrForEach(rsc, target, in, out, usr, 0, NULL);
    466 }
    467 
    468 static void SC_ForEach_SAAUS(Script *target,
    469                              Allocation *in,
    470                              Allocation *out,
    471                              const void *usr,
    472                              const RsScriptCall *call) {
    473     Context *rsc = RsdCpuReference::getTlsContext();
    474     rsrForEach(rsc, target, in, out, usr, 0, call);
    475 }
    476 
    477 static void SC_ForEach_SAAUL(Script *target,
    478                              Allocation *in,
    479                              Allocation *out,
    480                              const void *usr,
    481                              uint32_t usrLen) {
    482     Context *rsc = RsdCpuReference::getTlsContext();
    483     rsrForEach(rsc, target, in, out, usr, usrLen, NULL);
    484 }
    485 
    486 static void SC_ForEach_SAAULS(Script *target,
    487                               Allocation *in,
    488                               Allocation *out,
    489                               const void *usr,
    490                               uint32_t usrLen,
    491                               const RsScriptCall *call) {
    492     Context *rsc = RsdCpuReference::getTlsContext();
    493     rsrForEach(rsc, target, in, out, usr, usrLen, call);
    494 }
    495 
    496 
    497 
    498 //////////////////////////////////////////////////////////////////////////////
    499 // Time routines
    500 //////////////////////////////////////////////////////////////////////////////
    501 
    502 static float SC_GetDt() {
    503     Context *rsc = RsdCpuReference::getTlsContext();
    504     const Script *sc = RsdCpuReference::getTlsScript();
    505     return rsrGetDt(rsc, sc);
    506 }
    507 
    508 #ifndef RS_COMPATIBILITY_LIB
    509 time_t SC_Time(time_t *timer) {
    510     Context *rsc = RsdCpuReference::getTlsContext();
    511     return rsrTime(rsc, timer);
    512 }
    513 #else
    514 static int SC_Time(int *timer) {
    515     Context *rsc = RsdCpuReference::getTlsContext();
    516     return rsrTime(rsc, (long*)timer);
    517 }
    518 #endif
    519 
    520 tm* SC_LocalTime(tm *local, time_t *timer) {
    521     Context *rsc = RsdCpuReference::getTlsContext();
    522     return rsrLocalTime(rsc, local, timer);
    523 }
    524 
    525 int64_t SC_UptimeMillis() {
    526     Context *rsc = RsdCpuReference::getTlsContext();
    527     return rsrUptimeMillis(rsc);
    528 }
    529 
    530 int64_t SC_UptimeNanos() {
    531     Context *rsc = RsdCpuReference::getTlsContext();
    532     return rsrUptimeNanos(rsc);
    533 }
    534 
    535 //////////////////////////////////////////////////////////////////////////////
    536 // Message routines
    537 //////////////////////////////////////////////////////////////////////////////
    538 
    539 static uint32_t SC_ToClient2(int cmdID, void *data, int len) {
    540     Context *rsc = RsdCpuReference::getTlsContext();
    541     return rsrToClient(rsc, cmdID, data, len);
    542 }
    543 
    544 static uint32_t SC_ToClient(int cmdID) {
    545     Context *rsc = RsdCpuReference::getTlsContext();
    546     return rsrToClient(rsc, cmdID, NULL, 0);
    547 }
    548 
    549 static uint32_t SC_ToClientBlocking2(int cmdID, void *data, int len) {
    550     Context *rsc = RsdCpuReference::getTlsContext();
    551     return rsrToClientBlocking(rsc, cmdID, data, len);
    552 }
    553 
    554 static uint32_t SC_ToClientBlocking(int cmdID) {
    555     Context *rsc = RsdCpuReference::getTlsContext();
    556     return rsrToClientBlocking(rsc, cmdID, NULL, 0);
    557 }
    558 
    559 
    560 static void * ElementAt1D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x) {
    561     Context *rsc = RsdCpuReference::getTlsContext();
    562     const Type *t = a->getType();
    563     const Element *e = t->getElement();
    564 
    565     char buf[256];
    566     if (x >= t->getLODDimX(0)) {
    567         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
    568         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    569         return NULL;
    570     }
    571 
    572     if (vecSize > 0) {
    573         if (vecSize != e->getVectorSize()) {
    574             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
    575             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    576             return NULL;
    577         }
    578 
    579         if (dt != e->getType()) {
    580             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
    581             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    582             return NULL;
    583         }
    584     }
    585 
    586     uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
    587     const uint32_t eSize = e->getSizeBytes();
    588     return &p[(eSize * x)];
    589 }
    590 
    591 static void * ElementAt2D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y) {
    592     Context *rsc = RsdCpuReference::getTlsContext();
    593     const Type *t = a->getType();
    594     const Element *e = t->getElement();
    595 
    596     char buf[256];
    597     if (x >= t->getLODDimX(0)) {
    598         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
    599         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    600         return NULL;
    601     }
    602 
    603     if (y >= t->getLODDimY(0)) {
    604         sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
    605         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    606         return NULL;
    607     }
    608 
    609     if (vecSize > 0) {
    610         if (vecSize != e->getVectorSize()) {
    611             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
    612             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    613             return NULL;
    614         }
    615 
    616         if (dt != e->getType()) {
    617             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
    618             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    619             return NULL;
    620         }
    621     }
    622 
    623     uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
    624     const uint32_t eSize = e->getSizeBytes();
    625     const uint32_t stride = a->mHal.drvState.lod[0].stride;
    626     return &p[(eSize * x) + (y * stride)];
    627 }
    628 
    629 static void * ElementAt3D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y, uint32_t z) {
    630     Context *rsc = RsdCpuReference::getTlsContext();
    631     const Type *t = a->getType();
    632     const Element *e = t->getElement();
    633 
    634     char buf[256];
    635     if (x >= t->getLODDimX(0)) {
    636         sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
    637         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    638         return NULL;
    639     }
    640 
    641     if (y >= t->getLODDimY(0)) {
    642         sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
    643         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    644         return NULL;
    645     }
    646 
    647     if (z >= t->getLODDimZ(0)) {
    648         sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0));
    649         rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    650         return NULL;
    651     }
    652 
    653     if (vecSize > 0) {
    654         if (vecSize != e->getVectorSize()) {
    655             sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
    656             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    657             return NULL;
    658         }
    659 
    660         if (dt != e->getType()) {
    661             sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
    662             rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
    663             return NULL;
    664         }
    665     }
    666 
    667     uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
    668     const uint32_t eSize = e->getSizeBytes();
    669     const uint32_t stride = a->mHal.drvState.lod[0].stride;
    670     return &p[(eSize * x) + (y * stride)];
    671 }
    672 
    673 static const void * SC_GetElementAt1D(Allocation *a, uint32_t x) {
    674     return ElementAt1D(a, RS_TYPE_UNSIGNED_8, 0, x);
    675 }
    676 static const void * SC_GetElementAt2D(Allocation *a, uint32_t x, uint32_t y) {
    677     return ElementAt2D(a, RS_TYPE_UNSIGNED_8, 0, x, y);
    678 }
    679 static const void * SC_GetElementAt3D(Allocation *a, uint32_t x, uint32_t y, uint32_t z) {
    680     return ElementAt3D(a, RS_TYPE_UNSIGNED_8, 0, x, y, z);
    681 }
    682 
    683 static void SC_SetElementAt1D(Allocation *a, const void *ptr, uint32_t x) {
    684     const Type *t = a->getType();
    685     const Element *e = t->getElement();
    686     void *tmp = ElementAt1D(a, RS_TYPE_UNSIGNED_8, 0, x);
    687     if (tmp != NULL) {
    688         memcpy(tmp, ptr, e->getSizeBytes());
    689     }
    690 }
    691 static void SC_SetElementAt2D(Allocation *a, const void *ptr, uint32_t x, uint32_t y) {
    692     const Type *t = a->getType();
    693     const Element *e = t->getElement();
    694     void *tmp = ElementAt2D(a, RS_TYPE_UNSIGNED_8, 0, x, y);
    695     if (tmp != NULL) {
    696         memcpy(tmp, ptr, e->getSizeBytes());
    697     }
    698 }
    699 static void SC_SetElementAt3D(Allocation *a, const void *ptr, uint32_t x, uint32_t y, uint32_t z) {
    700     const Type *t = a->getType();
    701     const Element *e = t->getElement();
    702     void *tmp = ElementAt3D(a, RS_TYPE_UNSIGNED_8, 0, x, y, z);
    703     if (tmp != NULL) {
    704         memcpy(tmp, ptr, e->getSizeBytes());
    705     }
    706 }
    707 
    708 #define ELEMENT_AT(T, DT, VS)                                               \
    709     static void SC_SetElementAt1_##T(Allocation *a, const T *val, uint32_t x) {           \
    710         void *r = ElementAt1D(a, DT, VS, x);                            \
    711         if (r != NULL) ((T *)r)[0] = *val;                               \
    712         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
    713     }                                                                   \
    714     static void SC_SetElementAt2_##T(Allocation * a, const T * val, uint32_t x, uint32_t y) { \
    715         void *r = ElementAt2D(a, DT, VS, x, y);            \
    716         if (r != NULL) ((T *)r)[0] = *val;                               \
    717         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
    718     }                                                                   \
    719     static void SC_SetElementAt3_##T(Allocation * a, const T * val, uint32_t x, uint32_t y, uint32_t z) { \
    720         void *r = ElementAt3D(a, DT, VS, x, y, z);         \
    721         if (r != NULL) ((T *)r)[0] = *val;                               \
    722         else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
    723     }                                                                   \
    724     static void SC_GetElementAt1_##T(Allocation * a, T *val, uint32_t x) {                  \
    725         void *r = ElementAt1D(a, DT, VS, x);               \
    726         if (r != NULL) *val = ((T *)r)[0];                              \
    727         else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
    728     }                                                                   \
    729     static void SC_GetElementAt2_##T(Allocation * a, T *val, uint32_t x, uint32_t y) {      \
    730         void *r = ElementAt2D(a, DT, VS, x, y);            \
    731         if (r != NULL) *val = ((T *)r)[0];                              \
    732         else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
    733     }                                                                   \
    734     static void SC_GetElementAt3_##T(Allocation * a, T *val, uint32_t x, uint32_t y, uint32_t z) { \
    735         void *r = ElementAt3D(a, DT, VS, x, y, z);         \
    736         if (r != NULL) *val = ((T *)r)[0];                              \
    737         else ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
    738     }
    739 
    740 ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1)
    741 ELEMENT_AT(char2, RS_TYPE_SIGNED_8, 2)
    742 ELEMENT_AT(char3, RS_TYPE_SIGNED_8, 3)
    743 ELEMENT_AT(char4, RS_TYPE_SIGNED_8, 4)
    744 ELEMENT_AT(uchar, RS_TYPE_UNSIGNED_8, 1)
    745 ELEMENT_AT(uchar2, RS_TYPE_UNSIGNED_8, 2)
    746 ELEMENT_AT(uchar3, RS_TYPE_UNSIGNED_8, 3)
    747 ELEMENT_AT(uchar4, RS_TYPE_UNSIGNED_8, 4)
    748 ELEMENT_AT(short, RS_TYPE_SIGNED_16, 1)
    749 ELEMENT_AT(short2, RS_TYPE_SIGNED_16, 2)
    750 ELEMENT_AT(short3, RS_TYPE_SIGNED_16, 3)
    751 ELEMENT_AT(short4, RS_TYPE_SIGNED_16, 4)
    752 ELEMENT_AT(ushort, RS_TYPE_UNSIGNED_16, 1)
    753 ELEMENT_AT(ushort2, RS_TYPE_UNSIGNED_16, 2)
    754 ELEMENT_AT(ushort3, RS_TYPE_UNSIGNED_16, 3)
    755 ELEMENT_AT(ushort4, RS_TYPE_UNSIGNED_16, 4)
    756 ELEMENT_AT(int, RS_TYPE_SIGNED_32, 1)
    757 ELEMENT_AT(int2, RS_TYPE_SIGNED_32, 2)
    758 ELEMENT_AT(int3, RS_TYPE_SIGNED_32, 3)
    759 ELEMENT_AT(int4, RS_TYPE_SIGNED_32, 4)
    760 ELEMENT_AT(uint, RS_TYPE_UNSIGNED_32, 1)
    761 ELEMENT_AT(uint2, RS_TYPE_UNSIGNED_32, 2)
    762 ELEMENT_AT(uint3, RS_TYPE_UNSIGNED_32, 3)
    763 ELEMENT_AT(uint4, RS_TYPE_UNSIGNED_32, 4)
    764 ELEMENT_AT(long, RS_TYPE_SIGNED_64, 1)
    765 ELEMENT_AT(long2, RS_TYPE_SIGNED_64, 2)
    766 ELEMENT_AT(long3, RS_TYPE_SIGNED_64, 3)
    767 ELEMENT_AT(long4, RS_TYPE_SIGNED_64, 4)
    768 ELEMENT_AT(ulong, RS_TYPE_UNSIGNED_64, 1)
    769 ELEMENT_AT(ulong2, RS_TYPE_UNSIGNED_64, 2)
    770 ELEMENT_AT(ulong3, RS_TYPE_UNSIGNED_64, 3)
    771 ELEMENT_AT(ulong4, RS_TYPE_UNSIGNED_64, 4)
    772 ELEMENT_AT(float, RS_TYPE_FLOAT_32, 1)
    773 ELEMENT_AT(float2, RS_TYPE_FLOAT_32, 2)
    774 ELEMENT_AT(float3, RS_TYPE_FLOAT_32, 3)
    775 ELEMENT_AT(float4, RS_TYPE_FLOAT_32, 4)
    776 ELEMENT_AT(double, RS_TYPE_FLOAT_64, 1)
    777 ELEMENT_AT(double2, RS_TYPE_FLOAT_64, 2)
    778 ELEMENT_AT(double3, RS_TYPE_FLOAT_64, 3)
    779 ELEMENT_AT(double4, RS_TYPE_FLOAT_64, 4)
    780 
    781 #undef ELEMENT_AT
    782 
    783 //////////////////////////////////////////////////////////////////////////////
    784 // Stub implementation
    785 //////////////////////////////////////////////////////////////////////////////
    786 
    787 // llvm name mangling ref
    788 //  <builtin-type> ::= v  # void
    789 //                 ::= b  # bool
    790 //                 ::= c  # char
    791 //                 ::= a  # signed char
    792 //                 ::= h  # unsigned char
    793 //                 ::= s  # short
    794 //                 ::= t  # unsigned short
    795 //                 ::= i  # int
    796 //                 ::= j  # unsigned int
    797 //                 ::= l  # long
    798 //                 ::= m  # unsigned long
    799 //                 ::= x  # long long, __int64
    800 //                 ::= y  # unsigned long long, __int64
    801 //                 ::= f  # float
    802 //                 ::= d  # double
    803 
    804 static RsdCpuReference::CpuSymbol gSyms[] = {
    805     // Debug runtime
    806     { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_GetElementAt1D, true },
    807     { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_GetElementAt2D, true },
    808     { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_GetElementAt3D, true },
    809     { "_Z14rsSetElementAt13rs_allocationPKvj", (void *)&SC_SetElementAt1D, true },
    810     { "_Z14rsSetElementAt13rs_allocationPKvjj", (void *)&SC_SetElementAt2D, true },
    811     { "_Z14rsSetElementAt13rs_allocationPKvjjj", (void *)&SC_SetElementAt3D, true },
    812 
    813 
    814     { "_Z20rsGetElementAt_uchar13rs_allocationPhj", (void *)&SC_GetElementAt1_uchar, true },
    815     { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hj", (void *)&SC_GetElementAt1_uchar2, true },
    816     { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hj", (void *)&SC_GetElementAt1_uchar3, true },
    817     { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hj", (void *)&SC_GetElementAt1_uchar4, true },
    818     { "_Z20rsGetElementAt_uchar13rs_allocationPhjj", (void *)&SC_GetElementAt2_uchar, true },
    819     { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjj", (void *)&SC_GetElementAt2_uchar2, true },
    820     { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjj", (void *)&SC_GetElementAt2_uchar3, true },
    821     { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjj", (void *)&SC_GetElementAt2_uchar4, true },
    822     { "_Z20rsGetElementAt_uchar13rs_allocationPhjjj", (void *)&SC_GetElementAt3_uchar, true },
    823     { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjjj", (void *)&SC_GetElementAt3_uchar2, true },
    824     { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjjj", (void *)&SC_GetElementAt3_uchar3, true },
    825     { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjjj", (void *)&SC_GetElementAt3_uchar4, true },
    826 
    827     { "_Z19rsGetElementAt_char13rs_allocationPcj", (void *)&SC_GetElementAt1_char, true },
    828     { "_Z20rsGetElementAt_char213rs_allocationPDv2_cj", (void *)&SC_GetElementAt1_char2, true },
    829     { "_Z20rsGetElementAt_char313rs_allocationPDv3_cj", (void *)&SC_GetElementAt1_char3, true },
    830     { "_Z20rsGetElementAt_char413rs_allocationPDv4_cj", (void *)&SC_GetElementAt1_char4, true },
    831     { "_Z19rsGetElementAt_char13rs_allocationPcjj", (void *)&SC_GetElementAt2_char, true },
    832     { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjj", (void *)&SC_GetElementAt2_char2, true },
    833     { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjj", (void *)&SC_GetElementAt2_char3, true },
    834     { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjj", (void *)&SC_GetElementAt2_char4, true },
    835     { "_Z19rsGetElementAt_char13rs_allocationPcjjj", (void *)&SC_GetElementAt3_char, true },
    836     { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjjj", (void *)&SC_GetElementAt3_char2, true },
    837     { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjjj", (void *)&SC_GetElementAt3_char3, true },
    838     { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjjj", (void *)&SC_GetElementAt3_char4, true },
    839 
    840     { "_Z21rsGetElementAt_ushort13rs_allocationPtj", (void *)&SC_GetElementAt1_ushort, true },
    841     { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tj", (void *)&SC_GetElementAt1_ushort2, true },
    842     { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tj", (void *)&SC_GetElementAt1_ushort3, true },
    843     { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tj", (void *)&SC_GetElementAt1_ushort4, true },
    844     { "_Z21rsGetElementAt_ushort13rs_allocationPtjj", (void *)&SC_GetElementAt2_ushort, true },
    845     { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjj", (void *)&SC_GetElementAt2_ushort2, true },
    846     { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjj", (void *)&SC_GetElementAt2_ushort3, true },
    847     { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjj", (void *)&SC_GetElementAt2_ushort4, true },
    848     { "_Z21rsGetElementAt_ushort13rs_allocationPtjjj", (void *)&SC_GetElementAt3_ushort, true },
    849     { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjjj", (void *)&SC_GetElementAt3_ushort2, true },
    850     { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjjj", (void *)&SC_GetElementAt3_ushort3, true },
    851     { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjjj", (void *)&SC_GetElementAt3_ushort4, true },
    852 
    853     { "_Z20rsGetElementAt_short13rs_allocationPsj", (void *)&SC_GetElementAt1_short, true },
    854     { "_Z21rsGetElementAt_short213rs_allocationPDv2_sj", (void *)&SC_GetElementAt1_short2, true },
    855     { "_Z21rsGetElementAt_short313rs_allocationPDv3_sj", (void *)&SC_GetElementAt1_short3, true },
    856     { "_Z21rsGetElementAt_short413rs_allocationPDv4_sj", (void *)&SC_GetElementAt1_short4, true },
    857     { "_Z20rsGetElementAt_short13rs_allocationPsjj", (void *)&SC_GetElementAt2_short, true },
    858     { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjj", (void *)&SC_GetElementAt2_short2, true },
    859     { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjj", (void *)&SC_GetElementAt2_short3, true },
    860     { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjj", (void *)&SC_GetElementAt2_short4, true },
    861     { "_Z20rsGetElementAt_short13rs_allocationPsjjj", (void *)&SC_GetElementAt3_short, true },
    862     { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjjj", (void *)&SC_GetElementAt3_short2, true },
    863     { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjjj", (void *)&SC_GetElementAt3_short3, true },
    864     { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjjj", (void *)&SC_GetElementAt3_short4, true },
    865 
    866     { "_Z19rsGetElementAt_uint13rs_allocationPjj", (void *)&SC_GetElementAt1_uint, true },
    867     { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jj", (void *)&SC_GetElementAt1_uint2, true },
    868     { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jj", (void *)&SC_GetElementAt1_uint3, true },
    869     { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jj", (void *)&SC_GetElementAt1_uint4, true },
    870     { "_Z19rsGetElementAt_uint13rs_allocationPjjj", (void *)&SC_GetElementAt2_uint, true },
    871     { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjj", (void *)&SC_GetElementAt2_uint2, true },
    872     { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjj", (void *)&SC_GetElementAt2_uint3, true },
    873     { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjj", (void *)&SC_GetElementAt2_uint4, true },
    874     { "_Z19rsGetElementAt_uint13rs_allocationPjjjj", (void *)&SC_GetElementAt3_uint, true },
    875     { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjjj", (void *)&SC_GetElementAt3_uint2, true },
    876     { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjjj", (void *)&SC_GetElementAt3_uint3, true },
    877     { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjjj", (void *)&SC_GetElementAt3_uint4, true },
    878 
    879     { "_Z18rsGetElementAt_int13rs_allocationPij", (void *)&SC_GetElementAt1_int, true },
    880     { "_Z19rsGetElementAt_int213rs_allocationPDv2_ij", (void *)&SC_GetElementAt1_int2, true },
    881     { "_Z19rsGetElementAt_int313rs_allocationPDv3_ij", (void *)&SC_GetElementAt1_int3, true },
    882     { "_Z19rsGetElementAt_int413rs_allocationPDv4_ij", (void *)&SC_GetElementAt1_int4, true },
    883     { "_Z18rsGetElementAt_int13rs_allocationPijj", (void *)&SC_GetElementAt2_int, true },
    884     { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijj", (void *)&SC_GetElementAt2_int2, true },
    885     { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijj", (void *)&SC_GetElementAt2_int3, true },
    886     { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijj", (void *)&SC_GetElementAt2_int4, true },
    887     { "_Z18rsGetElementAt_int13rs_allocationPijjj", (void *)&SC_GetElementAt3_int, true },
    888     { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijjj", (void *)&SC_GetElementAt3_int2, true },
    889     { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijjj", (void *)&SC_GetElementAt3_int3, true },
    890     { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijjj", (void *)&SC_GetElementAt3_int4, true },
    891 
    892     { "_Z20rsGetElementAt_ulong13rs_allocationPmj", (void *)&SC_GetElementAt1_ulong, true },
    893     { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mj", (void *)&SC_GetElementAt1_ulong2, true },
    894     { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mj", (void *)&SC_GetElementAt1_ulong3, true },
    895     { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mj", (void *)&SC_GetElementAt1_ulong4, true },
    896     { "_Z20rsGetElementAt_ulong13rs_allocationPmjj", (void *)&SC_GetElementAt2_ulong, true },
    897     { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjj", (void *)&SC_GetElementAt2_ulong2, true },
    898     { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjj", (void *)&SC_GetElementAt2_ulong3, true },
    899     { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjj", (void *)&SC_GetElementAt2_ulong4, true },
    900     { "_Z20rsGetElementAt_ulong13rs_allocationPmjjj", (void *)&SC_GetElementAt3_ulong, true },
    901     { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjjj", (void *)&SC_GetElementAt3_ulong2, true },
    902     { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjjj", (void *)&SC_GetElementAt3_ulong3, true },
    903     { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjjj", (void *)&SC_GetElementAt3_ulong4, true },
    904 
    905     { "_Z19rsGetElementAt_long13rs_allocationPlj", (void *)&SC_GetElementAt1_long, true },
    906     { "_Z20rsGetElementAt_long213rs_allocationPDv2_lj", (void *)&SC_GetElementAt1_long2, true },
    907     { "_Z20rsGetElementAt_long313rs_allocationPDv3_lj", (void *)&SC_GetElementAt1_long3, true },
    908     { "_Z20rsGetElementAt_long413rs_allocationPDv4_lj", (void *)&SC_GetElementAt1_long4, true },
    909     { "_Z19rsGetElementAt_long13rs_allocationPljj", (void *)&SC_GetElementAt2_long, true },
    910     { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljj", (void *)&SC_GetElementAt2_long2, true },
    911     { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljj", (void *)&SC_GetElementAt2_long3, true },
    912     { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljj", (void *)&SC_GetElementAt2_long4, true },
    913     { "_Z19rsGetElementAt_long13rs_allocationPljjj", (void *)&SC_GetElementAt3_long, true },
    914     { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljjj", (void *)&SC_GetElementAt3_long2, true },
    915     { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljjj", (void *)&SC_GetElementAt3_long3, true },
    916     { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljjj", (void *)&SC_GetElementAt3_long4, true },
    917 
    918     { "_Z20rsGetElementAt_float13rs_allocationPfj", (void *)&SC_GetElementAt1_float, true },
    919     { "_Z21rsGetElementAt_float213rs_allocationPDv2_fj", (void *)&SC_GetElementAt1_float2, true },
    920     { "_Z21rsGetElementAt_float313rs_allocationPDv3_fj", (void *)&SC_GetElementAt1_float3, true },
    921     { "_Z21rsGetElementAt_float413rs_allocationPDv4_fj", (void *)&SC_GetElementAt1_float4, true },
    922     { "_Z20rsGetElementAt_float13rs_allocationPfjj", (void *)&SC_GetElementAt2_float, true },
    923     { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjj", (void *)&SC_GetElementAt2_float2, true },
    924     { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjj", (void *)&SC_GetElementAt2_float3, true },
    925     { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjj", (void *)&SC_GetElementAt2_float4, true },
    926     { "_Z20rsGetElementAt_float13rs_allocationPfjjj", (void *)&SC_GetElementAt3_float, true },
    927     { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjjj", (void *)&SC_GetElementAt3_float2, true },
    928     { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjjj", (void *)&SC_GetElementAt3_float3, true },
    929     { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjjj", (void *)&SC_GetElementAt3_float4, true },
    930 
    931     { "_Z21rsGetElementAt_double13rs_allocationPdj", (void *)&SC_GetElementAt1_double, true },
    932     { "_Z22rsGetElementAt_double213rs_allocationPDv2_dj", (void *)&SC_GetElementAt1_double2, true },
    933     { "_Z22rsGetElementAt_double313rs_allocationPDv3_dj", (void *)&SC_GetElementAt1_double3, true },
    934     { "_Z22rsGetElementAt_double413rs_allocationPDv4_dj", (void *)&SC_GetElementAt1_double4, true },
    935     { "_Z21rsGetElementAt_double13rs_allocationPdjj", (void *)&SC_GetElementAt2_double, true },
    936     { "_Z22rsGetElementAt_double213rs_allocationPDv2_djj", (void *)&SC_GetElementAt2_double2, true },
    937     { "_Z22rsGetElementAt_double313rs_allocationPDv3_djj", (void *)&SC_GetElementAt2_double3, true },
    938     { "_Z22rsGetElementAt_double413rs_allocationPDv4_djj", (void *)&SC_GetElementAt2_double4, true },
    939     { "_Z21rsGetElementAt_double13rs_allocationPdjjj", (void *)&SC_GetElementAt3_double, true },
    940     { "_Z22rsGetElementAt_double213rs_allocationPDv2_djjj", (void *)&SC_GetElementAt3_double2, true },
    941     { "_Z22rsGetElementAt_double313rs_allocationPDv3_djjj", (void *)&SC_GetElementAt3_double3, true },
    942     { "_Z22rsGetElementAt_double413rs_allocationPDv4_djjj", (void *)&SC_GetElementAt3_double4, true },
    943 
    944 
    945 
    946     { "_Z20rsSetElementAt_uchar13rs_allocationPKhj", (void *)&SC_SetElementAt1_uchar, true },
    947     { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hj", (void *)&SC_SetElementAt1_uchar2, true },
    948     { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hj", (void *)&SC_SetElementAt1_uchar3, true },
    949     { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hj", (void *)&SC_SetElementAt1_uchar4, true },
    950     { "_Z20rsSetElementAt_uchar13rs_allocationPKhjj", (void *)&SC_SetElementAt2_uchar, true },
    951     { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjj", (void *)&SC_SetElementAt2_uchar2, true },
    952     { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjj", (void *)&SC_SetElementAt2_uchar3, true },
    953     { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjj", (void *)&SC_SetElementAt2_uchar4, true },
    954     { "_Z20rsSetElementAt_uchar13rs_allocationPKhjjj", (void *)&SC_SetElementAt3_uchar, true },
    955     { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjjj", (void *)&SC_SetElementAt3_uchar2, true },
    956     { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjjj", (void *)&SC_SetElementAt3_uchar3, true },
    957     { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjjj", (void *)&SC_SetElementAt3_uchar4, true },
    958 
    959     { "_Z19rsSetElementAt_char13rs_allocationPKcj", (void *)&SC_SetElementAt1_char, true },
    960     { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cj", (void *)&SC_SetElementAt1_char2, true },
    961     { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cj", (void *)&SC_SetElementAt1_char3, true },
    962     { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cj", (void *)&SC_SetElementAt1_char4, true },
    963     { "_Z19rsSetElementAt_char13rs_allocationPKcjj", (void *)&SC_SetElementAt2_char, true },
    964     { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjj", (void *)&SC_SetElementAt2_char2, true },
    965     { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjj", (void *)&SC_SetElementAt2_char3, true },
    966     { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjj", (void *)&SC_SetElementAt2_char4, true },
    967     { "_Z19rsSetElementAt_char13rs_allocationPKcjjj", (void *)&SC_SetElementAt3_char, true },
    968     { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjjj", (void *)&SC_SetElementAt3_char2, true },
    969     { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjjj", (void *)&SC_SetElementAt3_char3, true },
    970     { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjjj", (void *)&SC_SetElementAt3_char4, true },
    971 
    972     { "_Z21rsSetElementAt_ushort13rs_allocationPKht", (void *)&SC_SetElementAt1_ushort, true },
    973     { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tj", (void *)&SC_SetElementAt1_ushort2, true },
    974     { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tj", (void *)&SC_SetElementAt1_ushort3, true },
    975     { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tj", (void *)&SC_SetElementAt1_ushort4, true },
    976     { "_Z21rsSetElementAt_ushort13rs_allocationPKtjj", (void *)&SC_SetElementAt2_ushort, true },
    977     { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjj", (void *)&SC_SetElementAt2_ushort2, true },
    978     { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjj", (void *)&SC_SetElementAt2_ushort3, true },
    979     { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjj", (void *)&SC_SetElementAt2_ushort4, true },
    980     { "_Z21rsSetElementAt_ushort13rs_allocationPKtjjj", (void *)&SC_SetElementAt3_ushort, true },
    981     { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjjj", (void *)&SC_SetElementAt3_ushort2, true },
    982     { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjjj", (void *)&SC_SetElementAt3_ushort3, true },
    983     { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjjj", (void *)&SC_SetElementAt3_ushort4, true },
    984 
    985     { "_Z20rsSetElementAt_short13rs_allocationPKsj", (void *)&SC_SetElementAt1_short, true },
    986     { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sj", (void *)&SC_SetElementAt1_short2, true },
    987     { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sj", (void *)&SC_SetElementAt1_short3, true },
    988     { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sj", (void *)&SC_SetElementAt1_short4, true },
    989     { "_Z20rsSetElementAt_short13rs_allocationPKsjj", (void *)&SC_SetElementAt2_short, true },
    990     { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjj", (void *)&SC_SetElementAt2_short2, true },
    991     { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjj", (void *)&SC_SetElementAt2_short3, true },
    992     { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjj", (void *)&SC_SetElementAt2_short4, true },
    993     { "_Z20rsSetElementAt_short13rs_allocationPKsjjj", (void *)&SC_SetElementAt3_short, true },
    994     { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjjj", (void *)&SC_SetElementAt3_short2, true },
    995     { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjjj", (void *)&SC_SetElementAt3_short3, true },
    996     { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjjj", (void *)&SC_SetElementAt3_short4, true },
    997 
    998     { "_Z19rsSetElementAt_uint13rs_allocationPKjj", (void *)&SC_SetElementAt1_uint, true },
    999     { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jj", (void *)&SC_SetElementAt1_uint2, true },
   1000     { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jj", (void *)&SC_SetElementAt1_uint3, true },
   1001     { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jj", (void *)&SC_SetElementAt1_uint4, true },
   1002     { "_Z19rsSetElementAt_uint13rs_allocationPKjjj", (void *)&SC_SetElementAt2_uint, true },
   1003     { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjj", (void *)&SC_SetElementAt2_uint2, true },
   1004     { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjj", (void *)&SC_SetElementAt2_uint3, true },
   1005     { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjj", (void *)&SC_SetElementAt2_uint4, true },
   1006     { "_Z19rsSetElementAt_uint13rs_allocationPKjjjj", (void *)&SC_SetElementAt3_uint, true },
   1007     { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjjj", (void *)&SC_SetElementAt3_uint2, true },
   1008     { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjjj", (void *)&SC_SetElementAt3_uint3, true },
   1009     { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjjj", (void *)&SC_SetElementAt3_uint4, true },
   1010 
   1011     { "_Z18rsSetElementAt_int13rs_allocationPKij", (void *)&SC_SetElementAt1_int, true },
   1012     { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ij", (void *)&SC_SetElementAt1_int2, true },
   1013     { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ij", (void *)&SC_SetElementAt1_int3, true },
   1014     { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ij", (void *)&SC_SetElementAt1_int4, true },
   1015     { "_Z18rsSetElementAt_int13rs_allocationPKijj", (void *)&SC_SetElementAt2_int, true },
   1016     { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijj", (void *)&SC_SetElementAt2_int2, true },
   1017     { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijj", (void *)&SC_SetElementAt2_int3, true },
   1018     { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijj", (void *)&SC_SetElementAt2_int4, true },
   1019     { "_Z18rsSetElementAt_int13rs_allocationPKijjj", (void *)&SC_SetElementAt3_int, true },
   1020     { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijjj", (void *)&SC_SetElementAt3_int2, true },
   1021     { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijjj", (void *)&SC_SetElementAt3_int3, true },
   1022     { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijjj", (void *)&SC_SetElementAt3_int4, true },
   1023 
   1024     { "_Z20rsSetElementAt_ulong13rs_allocationPKmt", (void *)&SC_SetElementAt1_ulong, true },
   1025     { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mj", (void *)&SC_SetElementAt1_ulong2, true },
   1026     { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mj", (void *)&SC_SetElementAt1_ulong3, true },
   1027     { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mj", (void *)&SC_SetElementAt1_ulong4, true },
   1028     { "_Z20rsSetElementAt_ulong13rs_allocationPKmjj", (void *)&SC_SetElementAt2_ulong, true },
   1029     { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjj", (void *)&SC_SetElementAt2_ulong2, true },
   1030     { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjj", (void *)&SC_SetElementAt2_ulong3, true },
   1031     { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjj", (void *)&SC_SetElementAt2_ulong4, true },
   1032     { "_Z20rsSetElementAt_ulong13rs_allocationPKmjjj", (void *)&SC_SetElementAt3_ulong, true },
   1033     { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjjj", (void *)&SC_SetElementAt3_ulong2, true },
   1034     { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjjj", (void *)&SC_SetElementAt3_ulong3, true },
   1035     { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjjj", (void *)&SC_SetElementAt3_ulong4, true },
   1036 
   1037     { "_Z19rsSetElementAt_long13rs_allocationPKlj", (void *)&SC_SetElementAt1_long, true },
   1038     { "_Z20rsSetElementAt_long213rs_allocationPKDv2_lj", (void *)&SC_SetElementAt1_long2, true },
   1039     { "_Z20rsSetElementAt_long313rs_allocationPKDv3_lj", (void *)&SC_SetElementAt1_long3, true },
   1040     { "_Z20rsSetElementAt_long413rs_allocationPKDv4_lj", (void *)&SC_SetElementAt1_long4, true },
   1041     { "_Z19rsSetElementAt_long13rs_allocationPKljj", (void *)&SC_SetElementAt2_long, true },
   1042     { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljj", (void *)&SC_SetElementAt2_long2, true },
   1043     { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljj", (void *)&SC_SetElementAt2_long3, true },
   1044     { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljj", (void *)&SC_SetElementAt2_long4, true },
   1045     { "_Z19rsSetElementAt_long13rs_allocationPKljjj", (void *)&SC_SetElementAt3_long, true },
   1046     { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljjj", (void *)&SC_SetElementAt3_long2, true },
   1047     { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljjj", (void *)&SC_SetElementAt3_long3, true },
   1048     { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljjj", (void *)&SC_SetElementAt3_long4, true },
   1049 
   1050     { "_Z20rsSetElementAt_float13rs_allocationPKft", (void *)&SC_SetElementAt1_float, true },
   1051     { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fj", (void *)&SC_SetElementAt1_float2, true },
   1052     { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fj", (void *)&SC_SetElementAt1_float3, true },
   1053     { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fj", (void *)&SC_SetElementAt1_float4, true },
   1054     { "_Z20rsSetElementAt_float13rs_allocationPKfjj", (void *)&SC_SetElementAt2_float, true },
   1055     { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjj", (void *)&SC_SetElementAt2_float2, true },
   1056     { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjj", (void *)&SC_SetElementAt2_float3, true },
   1057     { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjj", (void *)&SC_SetElementAt2_float4, true },
   1058     { "_Z20rsSetElementAt_float13rs_allocationPKfjjj", (void *)&SC_SetElementAt3_float, true },
   1059     { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjjj", (void *)&SC_SetElementAt3_float2, true },
   1060     { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjjj", (void *)&SC_SetElementAt3_float3, true },
   1061     { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjjj", (void *)&SC_SetElementAt3_float4, true },
   1062 
   1063     { "_Z21rsSetElementAt_double13rs_allocationPKdt", (void *)&SC_SetElementAt1_double, true },
   1064     { "_Z22rsSetElementAt_double213rs_allocationPKDv2_dj", (void *)&SC_SetElementAt1_double2, true },
   1065     { "_Z22rsSetElementAt_double313rs_allocationPKDv3_dj", (void *)&SC_SetElementAt1_double3, true },
   1066     { "_Z22rsSetElementAt_double413rs_allocationPKDv4_dj", (void *)&SC_SetElementAt1_double4, true },
   1067     { "_Z21rsSetElementAt_double13rs_allocationPKdjj", (void *)&SC_SetElementAt2_double, true },
   1068     { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djj", (void *)&SC_SetElementAt2_double2, true },
   1069     { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djj", (void *)&SC_SetElementAt2_double3, true },
   1070     { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djj", (void *)&SC_SetElementAt2_double4, true },
   1071     { "_Z21rsSetElementAt_double13rs_allocationPKdjjj", (void *)&SC_SetElementAt3_double, true },
   1072     { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djjj", (void *)&SC_SetElementAt3_double2, true },
   1073     { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djjj", (void *)&SC_SetElementAt3_double3, true },
   1074     { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djjj", (void *)&SC_SetElementAt3_double4, true },
   1075 
   1076 
   1077     // Refcounting
   1078     { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_SetObject, true },
   1079     { "_Z13rsClearObjectP10rs_element", (void *)&SC_ClearObject, true },
   1080     { "_Z10rsIsObject10rs_element", (void *)&SC_IsObject, true },
   1081 
   1082     { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_SetObject, true },
   1083     { "_Z13rsClearObjectP7rs_type", (void *)&SC_ClearObject, true },
   1084     { "_Z10rsIsObject7rs_type", (void *)&SC_IsObject, true },
   1085 
   1086     { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_SetObject, true },
   1087     { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_ClearObject, true },
   1088     { "_Z10rsIsObject13rs_allocation", (void *)&SC_IsObject, true },
   1089 
   1090     { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_SetObject, true },
   1091     { "_Z13rsClearObjectP10rs_sampler", (void *)&SC_ClearObject, true },
   1092     { "_Z10rsIsObject10rs_sampler", (void *)&SC_IsObject, true },
   1093 
   1094     { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_SetObject, true },
   1095     { "_Z13rsClearObjectP9rs_script", (void *)&SC_ClearObject, true },
   1096     { "_Z10rsIsObject9rs_script", (void *)&SC_IsObject, true },
   1097 
   1098     { "_Z11rsSetObjectP7rs_pathS_", (void *)&SC_SetObject, true },
   1099     { "_Z13rsClearObjectP7rs_path", (void *)&SC_ClearObject, true },
   1100     { "_Z10rsIsObject7rs_path", (void *)&SC_IsObject, true },
   1101 
   1102     { "_Z11rsSetObjectP7rs_meshS_", (void *)&SC_SetObject, true },
   1103     { "_Z13rsClearObjectP7rs_mesh", (void *)&SC_ClearObject, true },
   1104     { "_Z10rsIsObject7rs_mesh", (void *)&SC_IsObject, true },
   1105 
   1106     { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&SC_SetObject, true },
   1107     { "_Z13rsClearObjectP19rs_program_fragment", (void *)&SC_ClearObject, true },
   1108     { "_Z10rsIsObject19rs_program_fragment", (void *)&SC_IsObject, true },
   1109 
   1110     { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&SC_SetObject, true },
   1111     { "_Z13rsClearObjectP17rs_program_vertex", (void *)&SC_ClearObject, true },
   1112     { "_Z10rsIsObject17rs_program_vertex", (void *)&SC_IsObject, true },
   1113 
   1114     { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&SC_SetObject, true },
   1115     { "_Z13rsClearObjectP17rs_program_raster", (void *)&SC_ClearObject, true },
   1116     { "_Z10rsIsObject17rs_program_raster", (void *)&SC_IsObject, true },
   1117 
   1118     { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&SC_SetObject, true },
   1119     { "_Z13rsClearObjectP16rs_program_store", (void *)&SC_ClearObject, true },
   1120     { "_Z10rsIsObject16rs_program_store", (void *)&SC_IsObject, true },
   1121 
   1122     { "_Z11rsSetObjectP7rs_fontS_", (void *)&SC_SetObject, true },
   1123     { "_Z13rsClearObjectP7rs_font", (void *)&SC_ClearObject, true },
   1124     { "_Z10rsIsObject7rs_font", (void *)&SC_IsObject, true },
   1125 
   1126     // Allocation ops
   1127     { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_AllocationSyncAll, true },
   1128     { "_Z20rsgAllocationSyncAll13rs_allocation", (void *)&SC_AllocationSyncAll, false },
   1129     { "_Z20rsgAllocationSyncAll13rs_allocationj", (void *)&SC_AllocationSyncAll2, false },
   1130     { "_Z20rsgAllocationSyncAll13rs_allocation24rs_allocation_usage_type", (void *)&SC_AllocationSyncAll2, false },
   1131     { "_Z15rsGetAllocationPKv", (void *)&SC_GetAllocation, true },
   1132 #ifndef RS_COMPATIBILITY_LIB
   1133     { "_Z18rsAllocationIoSend13rs_allocation", (void *)&SC_AllocationIoSend, false },
   1134     { "_Z21rsAllocationIoReceive13rs_allocation", (void *)&SC_AllocationIoReceive, false },
   1135 #endif
   1136     { "_Z23rsAllocationCopy1DRange13rs_allocationjjjS_jj", (void *)&SC_AllocationCopy1DRange, false },
   1137     { "_Z23rsAllocationCopy2DRange13rs_allocationjjj26rs_allocation_cubemap_facejjS_jjjS0_", (void *)&SC_AllocationCopy2DRange, false },
   1138 
   1139     // Messaging
   1140 
   1141     { "_Z14rsSendToClienti", (void *)&SC_ToClient, false },
   1142     { "_Z14rsSendToClientiPKvj", (void *)&SC_ToClient2, false },
   1143     { "_Z22rsSendToClientBlockingi", (void *)&SC_ToClientBlocking, false },
   1144     { "_Z22rsSendToClientBlockingiPKvj", (void *)&SC_ToClientBlocking2, false },
   1145 #ifndef RS_COMPATIBILITY_LIB
   1146     { "_Z22rsgBindProgramFragment19rs_program_fragment", (void *)&SC_BindProgramFragment, false },
   1147     { "_Z19rsgBindProgramStore16rs_program_store", (void *)&SC_BindProgramStore, false },
   1148     { "_Z20rsgBindProgramVertex17rs_program_vertex", (void *)&SC_BindProgramVertex, false },
   1149     { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_BindProgramRaster, false },
   1150     { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_BindSampler, false },
   1151     { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_BindTexture, false },
   1152     { "_Z15rsgBindConstant19rs_program_fragmentj13rs_allocation", (void *)&SC_BindFragmentConstant, false },
   1153     { "_Z15rsgBindConstant17rs_program_vertexj13rs_allocation", (void *)&SC_BindVertexConstant, false },
   1154 
   1155     { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadProjectionMatrix, false },
   1156     { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadModelMatrix, false },
   1157     { "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadTextureMatrix, false },
   1158 
   1159     { "_Z35rsgProgramVertexGetProjectionMatrixP12rs_matrix4x4", (void *)&SC_VpGetProjectionMatrix, false },
   1160 
   1161     { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_PfConstantColor, false },
   1162 
   1163     { "_Z11rsgGetWidthv", (void *)&SC_GetWidth, false },
   1164     { "_Z12rsgGetHeightv", (void *)&SC_GetHeight, false },
   1165 
   1166 
   1167     { "_Z11rsgDrawRectfffff", (void *)&SC_DrawRect, false },
   1168     { "_Z11rsgDrawQuadffffffffffff", (void *)&SC_DrawQuad, false },
   1169     { "_Z20rsgDrawQuadTexCoordsffffffffffffffffffff", (void *)&SC_DrawQuadTexCoords, false },
   1170     { "_Z24rsgDrawSpriteScreenspacefffff", (void *)&SC_DrawSpriteScreenspace, false },
   1171 
   1172     { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_DrawMesh, false },
   1173     { "_Z11rsgDrawMesh7rs_meshj", (void *)&SC_DrawMeshPrimitive, false },
   1174     { "_Z11rsgDrawMesh7rs_meshjjj", (void *)&SC_DrawMeshPrimitiveRange, false },
   1175     { "_Z25rsgMeshComputeBoundingBox7rs_meshPfS0_S0_S0_S0_S0_", (void *)&SC_MeshComputeBoundingBox, false },
   1176 
   1177     { "_Z11rsgDrawPath7rs_path", (void *)&SC_DrawPath, false },
   1178 
   1179     { "_Z13rsgClearColorffff", (void *)&SC_ClearColor, false },
   1180     { "_Z13rsgClearDepthf", (void *)&SC_ClearDepth, false },
   1181 
   1182     { "_Z11rsgDrawTextPKcii", (void *)&SC_DrawText, false },
   1183     { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc, false },
   1184     { "_Z14rsgMeasureTextPKcPiS1_S1_S1_", (void *)&SC_MeasureText, false },
   1185     { "_Z14rsgMeasureText13rs_allocationPiS0_S0_S0_", (void *)&SC_MeasureTextAlloc, false },
   1186 
   1187     { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont, false },
   1188     { "_Z12rsgFontColorffff", (void *)&SC_FontColor, false },
   1189 
   1190     { "_Z18rsgBindColorTarget13rs_allocationj", (void *)&SC_BindFrameBufferObjectColorTarget, false },
   1191     { "_Z18rsgBindDepthTarget13rs_allocation", (void *)&SC_BindFrameBufferObjectDepthTarget, false },
   1192     { "_Z19rsgClearColorTargetj", (void *)&SC_ClearFrameBufferObjectColorTarget, false },
   1193     { "_Z19rsgClearDepthTargetv", (void *)&SC_ClearFrameBufferObjectDepthTarget, false },
   1194     { "_Z24rsgClearAllRenderTargetsv", (void *)&SC_ClearFrameBufferObjectTargets, false },
   1195 #endif // RS_COMPATIBILITY_LIB
   1196 
   1197     { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, true },
   1198     { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, true },
   1199     { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK14rs_script_call", (void *)&SC_ForEach_SAAUS, true },
   1200     { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, true },
   1201     { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK14rs_script_call", (void *)&SC_ForEach_SAAULS, true },
   1202 
   1203     // time
   1204     { "_Z6rsTimePi", (void *)&SC_Time, true },
   1205     { "_Z11rsLocaltimeP5rs_tmPKi", (void *)&SC_LocalTime, true },
   1206     { "_Z14rsUptimeMillisv", (void*)&SC_UptimeMillis, true },
   1207     { "_Z13rsUptimeNanosv", (void*)&SC_UptimeNanos, true },
   1208     { "_Z7rsGetDtv", (void*)&SC_GetDt, false },
   1209 
   1210     // misc
   1211 #ifndef RS_COMPATIBILITY_LIB
   1212     { "_Z5colorffff", (void *)&SC_Color, false },
   1213     { "_Z9rsgFinishv", (void *)&SC_Finish, false },
   1214 #endif
   1215 
   1216     { NULL, NULL, false }
   1217 };
   1218 
   1219 #ifdef RS_COMPATIBILITY_LIB
   1220 
   1221 //////////////////////////////////////////////////////////////////////////////
   1222 // Compatibility Library entry points
   1223 //////////////////////////////////////////////////////////////////////////////
   1224 
   1225 bool rsIsObject(rs_element src) {
   1226     return SC_IsObject((ObjectBase*)src.p);
   1227 }
   1228 
   1229 #define CLEAR_SET_OBJ(t) \
   1230     void __attribute__((overloadable)) rsClearObject(t *dst) { \
   1231     return SC_ClearObject((ObjectBase**) dst); \
   1232     } \
   1233     void __attribute__((overloadable)) rsSetObject(t *dst, t src) { \
   1234     return SC_SetObject((ObjectBase**) dst, (ObjectBase*) src.p); \
   1235     }
   1236 
   1237 CLEAR_SET_OBJ(rs_element)
   1238 CLEAR_SET_OBJ(rs_type)
   1239 CLEAR_SET_OBJ(rs_allocation)
   1240 CLEAR_SET_OBJ(rs_sampler)
   1241 CLEAR_SET_OBJ(rs_script)
   1242 #undef CLEAR_SET_OBJ
   1243 
   1244 const Allocation * rsGetAllocation(const void *ptr) {
   1245     return SC_GetAllocation(ptr);
   1246 }
   1247 
   1248 void __attribute__((overloadable)) rsForEach(rs_script script,
   1249                                              rs_allocation in,
   1250                                              rs_allocation out,
   1251                                              const void *usr,
   1252                                              const rs_script_call *call) {
   1253     return SC_ForEach_SAAUS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, (RsScriptCall*)call);
   1254 }
   1255 
   1256 void __attribute__((overloadable)) rsForEach(rs_script script,
   1257                                              rs_allocation in,
   1258                                              rs_allocation out,
   1259                                              const void *usr,
   1260                                              uint32_t usrLen,
   1261                                              const rs_script_call *call) {
   1262     return SC_ForEach_SAAULS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, (RsScriptCall*)call);
   1263 }
   1264 
   1265 int rsTime(int *timer) {
   1266     return SC_Time(timer);
   1267 }
   1268 
   1269 rs_tm* rsLocaltime(rs_tm* local, const int *timer) {
   1270     return (rs_tm*)(SC_LocalTime((tm*)local, (long*)timer));
   1271 }
   1272 
   1273 int64_t rsUptimeMillis() {
   1274     Context *rsc = RsdCpuReference::getTlsContext();
   1275     return rsrUptimeMillis(rsc);
   1276 }
   1277 
   1278 uint32_t rsSendToClientBlocking2(int cmdID, void *data, int len) {
   1279     Context *rsc = RsdCpuReference::getTlsContext();
   1280     return rsrToClientBlocking(rsc, cmdID, data, len);
   1281 }
   1282 
   1283 uint32_t rsSendToClientBlocking(int cmdID) {
   1284     Context *rsc = RsdCpuReference::getTlsContext();
   1285     return rsrToClientBlocking(rsc, cmdID, NULL, 0);
   1286 }
   1287 
   1288 static void SC_debugF(const char *s, float f) {
   1289     ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
   1290 }
   1291 static void SC_debugFv2(const char *s, float f1, float f2) {
   1292     ALOGD("%s {%f, %f}", s, f1, f2);
   1293 }
   1294 static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
   1295     ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
   1296 }
   1297 static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
   1298     ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
   1299 }
   1300 static void SC_debugF2(const char *s, float2 f) {
   1301     ALOGD("%s {%f, %f}", s, f.x, f.y);
   1302 }
   1303 static void SC_debugF3(const char *s, float3 f) {
   1304     ALOGD("%s {%f, %f, %f}", s, f.x, f.y, f.z);
   1305 }
   1306 static void SC_debugF4(const char *s, float4 f) {
   1307     ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w);
   1308 }
   1309 static void SC_debugD(const char *s, double d) {
   1310     ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
   1311 }
   1312 static void SC_debugFM4v4(const char *s, const float *f) {
   1313     ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
   1314     ALOGD("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
   1315     ALOGD("%s  %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
   1316     ALOGD("%s  %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
   1317 }
   1318 static void SC_debugFM3v3(const char *s, const float *f) {
   1319     ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
   1320     ALOGD("%s  %f, %f, %f", s, f[1], f[4], f[7]);
   1321     ALOGD("%s  %f, %f, %f}",s, f[2], f[5], f[8]);
   1322 }
   1323 static void SC_debugFM2v2(const char *s, const float *f) {
   1324     ALOGD("%s {%f, %f", s, f[0], f[2]);
   1325     ALOGD("%s  %f, %f}",s, f[1], f[3]);
   1326 }
   1327 static void SC_debugI8(const char *s, char c) {
   1328     ALOGD("%s %hhd  0x%hhx", s, c, (unsigned char)c);
   1329 }
   1330 static void SC_debugC2(const char *s, char2 c) {
   1331     ALOGD("%s {%hhd, %hhd}  0x%hhx 0x%hhx", s, c.x, c.y, (unsigned char)c.x, (unsigned char)c.y);
   1332 }
   1333 static void SC_debugC3(const char *s, char3 c) {
   1334     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);
   1335 }
   1336 static void SC_debugC4(const char *s, char4 c) {
   1337     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);
   1338 }
   1339 static void SC_debugU8(const char *s, unsigned char c) {
   1340     ALOGD("%s %hhu  0x%hhx", s, c, c);
   1341 }
   1342 static void SC_debugUC2(const char *s, uchar2 c) {
   1343     ALOGD("%s {%hhu, %hhu}  0x%hhx 0x%hhx", s, c.x, c.y, c.x, c.y);
   1344 }
   1345 static void SC_debugUC3(const char *s, uchar3 c) {
   1346     ALOGD("%s {%hhu, %hhu, %hhu}  0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.x, c.y, c.z);
   1347 }
   1348 static void SC_debugUC4(const char *s, uchar4 c) {
   1349     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);
   1350 }
   1351 static void SC_debugI16(const char *s, short c) {
   1352     ALOGD("%s %hd  0x%hx", s, c, c);
   1353 }
   1354 static void SC_debugS2(const char *s, short2 c) {
   1355     ALOGD("%s {%hd, %hd}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
   1356 }
   1357 static void SC_debugS3(const char *s, short3 c) {
   1358     ALOGD("%s {%hd, %hd, %hd}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
   1359 }
   1360 static void SC_debugS4(const char *s, short4 c) {
   1361     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);
   1362 }
   1363 static void SC_debugU16(const char *s, unsigned short c) {
   1364     ALOGD("%s %hu  0x%hx", s, c, c);
   1365 }
   1366 static void SC_debugUS2(const char *s, ushort2 c) {
   1367     ALOGD("%s {%hu, %hu}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
   1368 }
   1369 static void SC_debugUS3(const char *s, ushort3 c) {
   1370     ALOGD("%s {%hu, %hu, %hu}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
   1371 }
   1372 static void SC_debugUS4(const char *s, ushort4 c) {
   1373     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);
   1374 }
   1375 static void SC_debugI32(const char *s, int32_t i) {
   1376     ALOGD("%s %d  0x%x", s, i, i);
   1377 }
   1378 static void SC_debugI2(const char *s, int2 i) {
   1379     ALOGD("%s {%d, %d}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
   1380 }
   1381 static void SC_debugI3(const char *s, int3 i) {
   1382     ALOGD("%s {%d, %d, %d}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
   1383 }
   1384 static void SC_debugI4(const char *s, int4 i) {
   1385     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);
   1386 }
   1387 static void SC_debugU32(const char *s, uint32_t i) {
   1388     ALOGD("%s %u  0x%x", s, i, i);
   1389 }
   1390 static void SC_debugUI2(const char *s, uint2 i) {
   1391     ALOGD("%s {%u, %u}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
   1392 }
   1393 static void SC_debugUI3(const char *s, uint3 i) {
   1394     ALOGD("%s {%u, %u, %u}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
   1395 }
   1396 static void SC_debugUI4(const char *s, uint4 i) {
   1397     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);
   1398 }
   1399 static void SC_debugLL64(const char *s, long long ll) {
   1400     ALOGD("%s %lld  0x%llx", s, ll, ll);
   1401 }
   1402 static void SC_debugL2(const char *s, long2 ll) {
   1403     ALOGD("%s {%lld, %lld}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
   1404 }
   1405 static void SC_debugL3(const char *s, long3 ll) {
   1406     ALOGD("%s {%lld, %lld, %lld}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
   1407 }
   1408 static void SC_debugL4(const char *s, long4 ll) {
   1409     ALOGD("%s {%lld, %lld, %lld, %lld}  0x%llx 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.w, ll.x, ll.y, ll.z, ll.w);
   1410 }
   1411 static void SC_debugULL64(const char *s, unsigned long long ll) {
   1412     ALOGD("%s %llu  0x%llx", s, ll, ll);
   1413 }
   1414 static void SC_debugUL2(const char *s, ulong2 ll) {
   1415     ALOGD("%s {%llu, %llu}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
   1416 }
   1417 static void SC_debugUL3(const char *s, ulong3 ll) {
   1418     ALOGD("%s {%llu, %llu, %llu}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
   1419 }
   1420 static void SC_debugUL4(const char *s, ulong4 ll) {
   1421     ALOGD("%s {%llu, %llu, %llu, %llu}  0x%llx 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.w, ll.x, ll.y, ll.z, ll.w);
   1422 }
   1423 static void SC_debugP(const char *s, const void *p) {
   1424     ALOGD("%s %p", s, p);
   1425 }
   1426 
   1427 // TODO: allocation ops, messaging, time
   1428 
   1429 void rsDebug(const char *s, float f) {
   1430     SC_debugF(s, f);
   1431 }
   1432 
   1433 void rsDebug(const char *s, float f1, float f2) {
   1434     SC_debugFv2(s, f1, f2);
   1435 }
   1436 
   1437 void rsDebug(const char *s, float f1, float f2, float f3) {
   1438     SC_debugFv3(s, f1, f2, f3);
   1439 }
   1440 
   1441 void rsDebug(const char *s, float f1, float f2, float f3, float f4) {
   1442     SC_debugFv4(s, f1, f2, f3, f4);
   1443 }
   1444 
   1445 void rsDebug(const char *s, const float2 *f) {
   1446     SC_debugF2(s, *f);
   1447 }
   1448 
   1449 void rsDebug(const char *s, const float3 *f) {
   1450     SC_debugF3(s, *f);
   1451 }
   1452 
   1453 void rsDebug(const char *s, const float4 *f) {
   1454     SC_debugF4(s, *f);
   1455 }
   1456 
   1457 void rsDebug(const char *s, double d) {
   1458     SC_debugD(s, d);
   1459 }
   1460 
   1461 void rsDebug(const char *s, const rs_matrix4x4 *m) {
   1462     SC_debugFM4v4(s, (float *) m);
   1463 }
   1464 
   1465 void rsDebug(const char *s, const rs_matrix3x3 *m) {
   1466     SC_debugFM3v3(s, (float *) m);
   1467 }
   1468 
   1469 void rsDebug(const char *s, const rs_matrix2x2 *m) {
   1470     SC_debugFM2v2(s, (float *) m);
   1471 }
   1472 
   1473 void rsDebug(const char *s, char c) {
   1474     SC_debugI8(s, c);
   1475 }
   1476 
   1477 void rsDebug(const char *s, const char2 *c) {
   1478     SC_debugC2(s, *c);
   1479 }
   1480 
   1481 void rsDebug(const char *s, const char3 *c) {
   1482     SC_debugC3(s, *c);
   1483 }
   1484 
   1485 void rsDebug(const char *s, const char4 *c) {
   1486     SC_debugC4(s, *c);
   1487 }
   1488 
   1489 void rsDebug(const char *s, unsigned char c) {
   1490     SC_debugU8(s, c);
   1491 }
   1492 
   1493 void rsDebug(const char *s, const uchar2 *c) {
   1494     SC_debugUC2(s, *c);
   1495 }
   1496 
   1497 void rsDebug(const char *s, const uchar3 *c) {
   1498     SC_debugUC3(s, *c);
   1499 }
   1500 
   1501 void rsDebug(const char *s, const uchar4 *c) {
   1502     SC_debugUC4(s, *c);
   1503 }
   1504 
   1505 void rsDebug(const char *s, short c) {
   1506     SC_debugI16(s, c);
   1507 }
   1508 
   1509 void rsDebug(const char *s, const short2 *c) {
   1510     SC_debugS2(s, *c);
   1511 }
   1512 
   1513 void rsDebug(const char *s, const short3 *c) {
   1514     SC_debugS3(s, *c);
   1515 }
   1516 
   1517 void rsDebug(const char *s, const short4 *c) {
   1518     SC_debugS4(s, *c);
   1519 }
   1520 
   1521 void rsDebug(const char *s, unsigned short c) {
   1522     SC_debugU16(s, c);
   1523 }
   1524 
   1525 void rsDebug(const char *s, const ushort2 *c) {
   1526     SC_debugUS2(s, *c);
   1527 }
   1528 
   1529 void rsDebug(const char *s, const ushort3 *c) {
   1530     SC_debugUS3(s, *c);
   1531 }
   1532 
   1533 void rsDebug(const char *s, const ushort4 *c) {
   1534     SC_debugUS4(s, *c);
   1535 }
   1536 
   1537 void rsDebug(const char *s, int c) {
   1538     SC_debugI32(s, c);
   1539 }
   1540 
   1541 void rsDebug(const char *s, const int2 *c) {
   1542     SC_debugI2(s, *c);
   1543 }
   1544 
   1545 void rsDebug(const char *s, const int3 *c) {
   1546     SC_debugI3(s, *c);
   1547 }
   1548 
   1549 void rsDebug(const char *s, const int4 *c) {
   1550     SC_debugI4(s, *c);
   1551 }
   1552 
   1553 void rsDebug(const char *s, unsigned int c) {
   1554     SC_debugU32(s, c);
   1555 }
   1556 
   1557 void rsDebug(const char *s, const uint2 *c) {
   1558     SC_debugUI2(s, *c);
   1559 }
   1560 
   1561 void rsDebug(const char *s, const uint3 *c) {
   1562     SC_debugUI3(s, *c);
   1563 }
   1564 
   1565 void rsDebug(const char *s, const uint4 *c) {
   1566     SC_debugUI4(s, *c);
   1567 }
   1568 
   1569 void rsDebug(const char *s, long c) {
   1570     SC_debugLL64(s, c);
   1571 }
   1572 
   1573 void rsDebug(const char *s, long long c) {
   1574     SC_debugLL64(s, c);
   1575 }
   1576 
   1577 void rsDebug(const char *s, const long2 *c) {
   1578     SC_debugL2(s, *c);
   1579 }
   1580 
   1581 void rsDebug(const char *s, const long3 *c) {
   1582     SC_debugL3(s, *c);
   1583 }
   1584 
   1585 void rsDebug(const char *s, const long4 *c) {
   1586     SC_debugL4(s, *c);
   1587 }
   1588 
   1589 void rsDebug(const char *s, unsigned long c) {
   1590     SC_debugULL64(s, c);
   1591 }
   1592 
   1593 void rsDebug(const char *s, unsigned long long c) {
   1594     SC_debugULL64(s, c);
   1595 }
   1596 
   1597 void rsDebug(const char *s, const ulong2 *c) {
   1598     SC_debugUL2(s, *c);
   1599 }
   1600 
   1601 void rsDebug(const char *s, const ulong3 *c) {
   1602     SC_debugUL3(s, *c);
   1603 }
   1604 
   1605 void rsDebug(const char *s, const ulong4 *c) {
   1606     SC_debugUL4(s, *c);
   1607 }
   1608 
   1609 void rsDebug(const char *s, const void *p) {
   1610     SC_debugP(s, p);
   1611 }
   1612 #endif // RS_COMPATIBILITY_LIB
   1613 
   1614 extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) {
   1615     ScriptC *s = (ScriptC *)pContext;
   1616     const RsdCpuReference::CpuSymbol *syms = gSyms;
   1617     const RsdCpuReference::CpuSymbol *sym = NULL;
   1618 
   1619     if (!sym) {
   1620         while (syms->fnPtr) {
   1621             if (!strcmp(syms->name, name)) {
   1622                 return syms;
   1623             }
   1624             syms++;
   1625         }
   1626     }
   1627 
   1628     return NULL;
   1629 }
   1630 
   1631 
   1632