rsdRuntimeStubs.cpp revision f827cadde659212b266b9635128c98515a7dcb01
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
34using namespace android;
35using namespace android::renderscript;
36
37typedef float float2 __attribute__((ext_vector_type(2)));
38typedef float float3 __attribute__((ext_vector_type(3)));
39typedef float float4 __attribute__((ext_vector_type(4)));
40typedef double double2 __attribute__((ext_vector_type(2)));
41typedef double double3 __attribute__((ext_vector_type(3)));
42typedef double double4 __attribute__((ext_vector_type(4)));
43typedef char char2 __attribute__((ext_vector_type(2)));
44typedef char char3 __attribute__((ext_vector_type(3)));
45typedef char char4 __attribute__((ext_vector_type(4)));
46typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
47typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
48typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
49typedef short short2 __attribute__((ext_vector_type(2)));
50typedef short short3 __attribute__((ext_vector_type(3)));
51typedef short short4 __attribute__((ext_vector_type(4)));
52typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
53typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
54typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
55typedef int32_t int2 __attribute__((ext_vector_type(2)));
56typedef int32_t int3 __attribute__((ext_vector_type(3)));
57typedef int32_t int4 __attribute__((ext_vector_type(4)));
58typedef uint32_t uint2 __attribute__((ext_vector_type(2)));
59typedef uint32_t uint3 __attribute__((ext_vector_type(3)));
60typedef uint32_t uint4 __attribute__((ext_vector_type(4)));
61typedef long long long2 __attribute__((ext_vector_type(2)));
62typedef long long long3 __attribute__((ext_vector_type(3)));
63typedef long long long4 __attribute__((ext_vector_type(4)));
64typedef unsigned long long ulong2 __attribute__((ext_vector_type(2)));
65typedef unsigned long long ulong3 __attribute__((ext_vector_type(3)));
66typedef unsigned long long ulong4 __attribute__((ext_vector_type(4)));
67
68typedef uint8_t uchar;
69typedef uint16_t ushort;
70typedef uint32_t uint;
71#ifndef RS_SERVER
72typedef 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
79OPAQUETYPE(rs_element)
80OPAQUETYPE(rs_type)
81OPAQUETYPE(rs_allocation)
82OPAQUETYPE(rs_sampler)
83OPAQUETYPE(rs_script)
84OPAQUETYPE(rs_script_call)
85#undef OPAQUETYPE
86
87typedef 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
105static void SC_AllocationSyncAll2(Allocation *a, RsAllocationUsageType source) {
106    Context *rsc = RsdCpuReference::getTlsContext();
107    rsrAllocationSyncAll(rsc, a, source);
108}
109
110static void SC_AllocationSyncAll(Allocation *a) {
111    Context *rsc = RsdCpuReference::getTlsContext();
112    rsrAllocationSyncAll(rsc, a, RS_ALLOCATION_USAGE_SCRIPT);
113}
114
115static 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
126static 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
142static void SC_AllocationIoSend(Allocation *alloc) {
143    Context *rsc = RsdCpuReference::getTlsContext();
144    rsrAllocationIoSend(rsc, alloc);
145}
146
147
148static void SC_AllocationIoReceive(Allocation *alloc) {
149    Context *rsc = RsdCpuReference::getTlsContext();
150    rsrAllocationIoReceive(rsc, alloc);
151}
152
153
154
155//////////////////////////////////////////////////////////////////////////////
156// Context
157//////////////////////////////////////////////////////////////////////////////
158
159static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) {
160    Context *rsc = RsdCpuReference::getTlsContext();
161    rsrBindTexture(rsc, pf, slot, a);
162}
163
164static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) {
165    Context *rsc = RsdCpuReference::getTlsContext();
166    rsrBindConstant(rsc, pv, slot, a);
167}
168
169static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) {
170    Context *rsc = RsdCpuReference::getTlsContext();
171    rsrBindConstant(rsc, pf, slot, a);
172}
173
174static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) {
175    Context *rsc = RsdCpuReference::getTlsContext();
176    rsrBindSampler(rsc, pf, slot, s);
177}
178
179static void SC_BindProgramStore(ProgramStore *ps) {
180    Context *rsc = RsdCpuReference::getTlsContext();
181    rsrBindProgramStore(rsc, ps);
182}
183
184static void SC_BindProgramFragment(ProgramFragment *pf) {
185    Context *rsc = RsdCpuReference::getTlsContext();
186    rsrBindProgramFragment(rsc, pf);
187}
188
189static void SC_BindProgramVertex(ProgramVertex *pv) {
190    Context *rsc = RsdCpuReference::getTlsContext();
191    rsrBindProgramVertex(rsc, pv);
192}
193
194static void SC_BindProgramRaster(ProgramRaster *pr) {
195    Context *rsc = RsdCpuReference::getTlsContext();
196    rsrBindProgramRaster(rsc, pr);
197}
198
199static void SC_BindFrameBufferObjectColorTarget(Allocation *a, uint32_t slot) {
200    Context *rsc = RsdCpuReference::getTlsContext();
201    rsrBindFrameBufferObjectColorTarget(rsc, a, slot);
202}
203
204static void SC_BindFrameBufferObjectDepthTarget(Allocation *a) {
205    Context *rsc = RsdCpuReference::getTlsContext();
206    rsrBindFrameBufferObjectDepthTarget(rsc, a);
207}
208
209static void SC_ClearFrameBufferObjectColorTarget(uint32_t slot) {
210    Context *rsc = RsdCpuReference::getTlsContext();
211    rsrClearFrameBufferObjectColorTarget(rsc, slot);
212}
213
214static void SC_ClearFrameBufferObjectDepthTarget(Context *, Script *) {
215    Context *rsc = RsdCpuReference::getTlsContext();
216    rsrClearFrameBufferObjectDepthTarget(rsc);
217}
218
219static void SC_ClearFrameBufferObjectTargets(Context *, Script *) {
220    Context *rsc = RsdCpuReference::getTlsContext();
221    rsrClearFrameBufferObjectTargets(rsc);
222}
223
224
225//////////////////////////////////////////////////////////////////////////////
226// VP
227//////////////////////////////////////////////////////////////////////////////
228
229static void SC_VpLoadProjectionMatrix(const rsc_Matrix *m) {
230    Context *rsc = RsdCpuReference::getTlsContext();
231    rsrVpLoadProjectionMatrix(rsc, m);
232}
233
234static void SC_VpLoadModelMatrix(const rsc_Matrix *m) {
235    Context *rsc = RsdCpuReference::getTlsContext();
236    rsrVpLoadModelMatrix(rsc, m);
237}
238
239static void SC_VpLoadTextureMatrix(const rsc_Matrix *m) {
240    Context *rsc = RsdCpuReference::getTlsContext();
241    rsrVpLoadTextureMatrix(rsc, m);
242}
243
244static 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
249static void SC_VpGetProjectionMatrix(rsc_Matrix *m) {
250    Context *rsc = RsdCpuReference::getTlsContext();
251    rsrVpGetProjectionMatrix(rsc, m);
252}
253
254
255//////////////////////////////////////////////////////////////////////////////
256// Drawing
257//////////////////////////////////////////////////////////////////////////////
258
259static 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
293static 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
303static 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
321static 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
325static void SC_DrawPath(Path *p) {
326    Context *rsc = RsdCpuReference::getTlsContext();
327    rsdPathDraw(rsc, p);
328}
329
330static void SC_DrawMesh(Mesh *m) {
331    Context *rsc = RsdCpuReference::getTlsContext();
332    rsrDrawMesh(rsc, m);
333}
334
335static void SC_DrawMeshPrimitive(Mesh *m, uint32_t primIndex) {
336    Context *rsc = RsdCpuReference::getTlsContext();
337    rsrDrawMeshPrimitive(rsc, m, primIndex);
338}
339
340static 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
345static 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
359static 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
364static void SC_Finish() {
365    Context *rsc = RsdCpuReference::getTlsContext();
366    rsdGLFinish(rsc);
367}
368
369static 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
375static void SC_ClearDepth(float v) {
376    Context *rsc = RsdCpuReference::getTlsContext();
377    rsrPrepareClear(rsc);
378    rsdGLClearDepth(rsc, v);
379}
380
381static uint32_t SC_GetWidth() {
382    Context *rsc = RsdCpuReference::getTlsContext();
383    return rsrGetWidth(rsc);
384}
385
386static uint32_t SC_GetHeight() {
387    Context *rsc = RsdCpuReference::getTlsContext();
388    return rsrGetHeight(rsc);
389}
390
391static void SC_DrawTextAlloc(Allocation *a, int x, int y) {
392    Context *rsc = RsdCpuReference::getTlsContext();
393    rsrDrawTextAlloc(rsc, a, x, y);
394}
395
396static void SC_DrawText(const char *text, int x, int y) {
397    Context *rsc = RsdCpuReference::getTlsContext();
398    rsrDrawText(rsc, text, x, y);
399}
400
401static 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
407static 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
413static void SC_BindFont(Font *f) {
414    Context *rsc = RsdCpuReference::getTlsContext();
415    rsrBindFont(rsc, f);
416}
417
418static 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
429static void SC_SetObject(ObjectBase **dst, ObjectBase * src) {
430    Context *rsc = RsdCpuReference::getTlsContext();
431    rsrSetObject(rsc, dst, src);
432}
433
434static void SC_ClearObject(ObjectBase **dst) {
435    Context *rsc = RsdCpuReference::getTlsContext();
436    rsrClearObject(rsc, dst);
437}
438
439static bool SC_IsObject(const ObjectBase *src) {
440    Context *rsc = RsdCpuReference::getTlsContext();
441    return rsrIsObject(rsc, src);
442}
443
444
445
446
447static 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
453static 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
460static 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
468static 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
477static 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
486static 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
502static 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
509time_t SC_Time(time_t *timer) {
510    Context *rsc = RsdCpuReference::getTlsContext();
511    return rsrTime(rsc, timer);
512}
513#else
514static int SC_Time(int *timer) {
515    Context *rsc = RsdCpuReference::getTlsContext();
516    return rsrTime(rsc, (long*)timer);
517}
518#endif
519
520tm* SC_LocalTime(tm *local, time_t *timer) {
521    Context *rsc = RsdCpuReference::getTlsContext();
522    return rsrLocalTime(rsc, local, timer);
523}
524
525int64_t SC_UptimeMillis() {
526    Context *rsc = RsdCpuReference::getTlsContext();
527    return rsrUptimeMillis(rsc);
528}
529
530int64_t SC_UptimeNanos() {
531    Context *rsc = RsdCpuReference::getTlsContext();
532    return rsrUptimeNanos(rsc);
533}
534
535//////////////////////////////////////////////////////////////////////////////
536// Message routines
537//////////////////////////////////////////////////////////////////////////////
538
539static uint32_t SC_ToClient2(int cmdID, void *data, int len) {
540    Context *rsc = RsdCpuReference::getTlsContext();
541    return rsrToClient(rsc, cmdID, data, len);
542}
543
544static uint32_t SC_ToClient(int cmdID) {
545    Context *rsc = RsdCpuReference::getTlsContext();
546    return rsrToClient(rsc, cmdID, NULL, 0);
547}
548
549static uint32_t SC_ToClientBlocking2(int cmdID, void *data, int len) {
550    Context *rsc = RsdCpuReference::getTlsContext();
551    return rsrToClientBlocking(rsc, cmdID, data, len);
552}
553
554static uint32_t SC_ToClientBlocking(int cmdID) {
555    Context *rsc = RsdCpuReference::getTlsContext();
556    return rsrToClientBlocking(rsc, cmdID, NULL, 0);
557}
558
559
560static 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
591static 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
629static 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
673static const void * SC_GetElementAt1D(Allocation *a, uint32_t x) {
674    return ElementAt1D(a, RS_TYPE_UNSIGNED_8, 0, x);
675}
676static const void * SC_GetElementAt2D(Allocation *a, uint32_t x, uint32_t y) {
677    return ElementAt2D(a, RS_TYPE_UNSIGNED_8, 0, x, y);
678}
679static 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
683static 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}
691static 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}
699static 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
740ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1)
741ELEMENT_AT(char2, RS_TYPE_SIGNED_8, 2)
742ELEMENT_AT(char3, RS_TYPE_SIGNED_8, 3)
743ELEMENT_AT(char4, RS_TYPE_SIGNED_8, 4)
744ELEMENT_AT(uchar, RS_TYPE_UNSIGNED_8, 1)
745ELEMENT_AT(uchar2, RS_TYPE_UNSIGNED_8, 2)
746ELEMENT_AT(uchar3, RS_TYPE_UNSIGNED_8, 3)
747ELEMENT_AT(uchar4, RS_TYPE_UNSIGNED_8, 4)
748ELEMENT_AT(short, RS_TYPE_SIGNED_16, 1)
749ELEMENT_AT(short2, RS_TYPE_SIGNED_16, 2)
750ELEMENT_AT(short3, RS_TYPE_SIGNED_16, 3)
751ELEMENT_AT(short4, RS_TYPE_SIGNED_16, 4)
752ELEMENT_AT(ushort, RS_TYPE_UNSIGNED_16, 1)
753ELEMENT_AT(ushort2, RS_TYPE_UNSIGNED_16, 2)
754ELEMENT_AT(ushort3, RS_TYPE_UNSIGNED_16, 3)
755ELEMENT_AT(ushort4, RS_TYPE_UNSIGNED_16, 4)
756ELEMENT_AT(int, RS_TYPE_SIGNED_32, 1)
757ELEMENT_AT(int2, RS_TYPE_SIGNED_32, 2)
758ELEMENT_AT(int3, RS_TYPE_SIGNED_32, 3)
759ELEMENT_AT(int4, RS_TYPE_SIGNED_32, 4)
760ELEMENT_AT(uint, RS_TYPE_UNSIGNED_32, 1)
761ELEMENT_AT(uint2, RS_TYPE_UNSIGNED_32, 2)
762ELEMENT_AT(uint3, RS_TYPE_UNSIGNED_32, 3)
763ELEMENT_AT(uint4, RS_TYPE_UNSIGNED_32, 4)
764ELEMENT_AT(long, RS_TYPE_SIGNED_64, 1)
765ELEMENT_AT(long2, RS_TYPE_SIGNED_64, 2)
766ELEMENT_AT(long3, RS_TYPE_SIGNED_64, 3)
767ELEMENT_AT(long4, RS_TYPE_SIGNED_64, 4)
768ELEMENT_AT(ulong, RS_TYPE_UNSIGNED_64, 1)
769ELEMENT_AT(ulong2, RS_TYPE_UNSIGNED_64, 2)
770ELEMENT_AT(ulong3, RS_TYPE_UNSIGNED_64, 3)
771ELEMENT_AT(ulong4, RS_TYPE_UNSIGNED_64, 4)
772ELEMENT_AT(float, RS_TYPE_FLOAT_32, 1)
773ELEMENT_AT(float2, RS_TYPE_FLOAT_32, 2)
774ELEMENT_AT(float3, RS_TYPE_FLOAT_32, 3)
775ELEMENT_AT(float4, RS_TYPE_FLOAT_32, 4)
776ELEMENT_AT(double, RS_TYPE_FLOAT_64, 1)
777ELEMENT_AT(double2, RS_TYPE_FLOAT_64, 2)
778ELEMENT_AT(double3, RS_TYPE_FLOAT_64, 3)
779ELEMENT_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
804static 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#define IS_CLEAR_SET_OBJ(t) \
1226    bool rsIsObject(t src) { \
1227        return SC_IsObject((ObjectBase*)src.p); \
1228    } \
1229    void __attribute__((overloadable)) rsClearObject(t *dst) { \
1230        return SC_ClearObject((ObjectBase**) dst); \
1231    } \
1232    void __attribute__((overloadable)) rsSetObject(t *dst, t src) { \
1233        return SC_SetObject((ObjectBase**) dst, (ObjectBase*) src.p); \
1234    }
1235
1236IS_CLEAR_SET_OBJ(rs_element)
1237IS_CLEAR_SET_OBJ(rs_type)
1238IS_CLEAR_SET_OBJ(rs_allocation)
1239IS_CLEAR_SET_OBJ(rs_sampler)
1240IS_CLEAR_SET_OBJ(rs_script)
1241#undef IS_CLEAR_SET_OBJ
1242
1243const Allocation * rsGetAllocation(const void *ptr) {
1244    return SC_GetAllocation(ptr);
1245}
1246
1247void __attribute__((overloadable)) rsForEach(rs_script script,
1248                                             rs_allocation in,
1249                                             rs_allocation out,
1250                                             const void *usr,
1251                                             const rs_script_call *call) {
1252    return SC_ForEach_SAAUS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, (RsScriptCall*)call);
1253}
1254
1255void __attribute__((overloadable)) rsForEach(rs_script script,
1256                                             rs_allocation in,
1257                                             rs_allocation out,
1258                                             const void *usr,
1259                                             uint32_t usrLen,
1260                                             const rs_script_call *call) {
1261    return SC_ForEach_SAAULS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, (RsScriptCall*)call);
1262}
1263
1264int rsTime(int *timer) {
1265    return SC_Time(timer);
1266}
1267
1268rs_tm* rsLocaltime(rs_tm* local, const int *timer) {
1269    return (rs_tm*)(SC_LocalTime((tm*)local, (long*)timer));
1270}
1271
1272int64_t rsUptimeMillis() {
1273    Context *rsc = RsdCpuReference::getTlsContext();
1274    return rsrUptimeMillis(rsc);
1275}
1276
1277uint32_t rsSendToClientBlocking2(int cmdID, void *data, int len) {
1278    Context *rsc = RsdCpuReference::getTlsContext();
1279    return rsrToClientBlocking(rsc, cmdID, data, len);
1280}
1281
1282uint32_t rsSendToClientBlocking(int cmdID) {
1283    Context *rsc = RsdCpuReference::getTlsContext();
1284    return rsrToClientBlocking(rsc, cmdID, NULL, 0);
1285}
1286
1287static void SC_debugF(const char *s, float f) {
1288    ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
1289}
1290static void SC_debugFv2(const char *s, float f1, float f2) {
1291    ALOGD("%s {%f, %f}", s, f1, f2);
1292}
1293static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
1294    ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
1295}
1296static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
1297    ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
1298}
1299static void SC_debugF2(const char *s, float2 f) {
1300    ALOGD("%s {%f, %f}", s, f.x, f.y);
1301}
1302static void SC_debugF3(const char *s, float3 f) {
1303    ALOGD("%s {%f, %f, %f}", s, f.x, f.y, f.z);
1304}
1305static void SC_debugF4(const char *s, float4 f) {
1306    ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w);
1307}
1308static void SC_debugD(const char *s, double d) {
1309    ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
1310}
1311static void SC_debugFM4v4(const char *s, const float *f) {
1312    ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
1313    ALOGD("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
1314    ALOGD("%s  %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
1315    ALOGD("%s  %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
1316}
1317static void SC_debugFM3v3(const char *s, const float *f) {
1318    ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
1319    ALOGD("%s  %f, %f, %f", s, f[1], f[4], f[7]);
1320    ALOGD("%s  %f, %f, %f}",s, f[2], f[5], f[8]);
1321}
1322static void SC_debugFM2v2(const char *s, const float *f) {
1323    ALOGD("%s {%f, %f", s, f[0], f[2]);
1324    ALOGD("%s  %f, %f}",s, f[1], f[3]);
1325}
1326static void SC_debugI8(const char *s, char c) {
1327    ALOGD("%s %hhd  0x%hhx", s, c, (unsigned char)c);
1328}
1329static void SC_debugC2(const char *s, char2 c) {
1330    ALOGD("%s {%hhd, %hhd}  0x%hhx 0x%hhx", s, c.x, c.y, (unsigned char)c.x, (unsigned char)c.y);
1331}
1332static void SC_debugC3(const char *s, char3 c) {
1333    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);
1334}
1335static void SC_debugC4(const char *s, char4 c) {
1336    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);
1337}
1338static void SC_debugU8(const char *s, unsigned char c) {
1339    ALOGD("%s %hhu  0x%hhx", s, c, c);
1340}
1341static void SC_debugUC2(const char *s, uchar2 c) {
1342    ALOGD("%s {%hhu, %hhu}  0x%hhx 0x%hhx", s, c.x, c.y, c.x, c.y);
1343}
1344static void SC_debugUC3(const char *s, uchar3 c) {
1345    ALOGD("%s {%hhu, %hhu, %hhu}  0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1346}
1347static void SC_debugUC4(const char *s, uchar4 c) {
1348    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);
1349}
1350static void SC_debugI16(const char *s, short c) {
1351    ALOGD("%s %hd  0x%hx", s, c, c);
1352}
1353static void SC_debugS2(const char *s, short2 c) {
1354    ALOGD("%s {%hd, %hd}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1355}
1356static void SC_debugS3(const char *s, short3 c) {
1357    ALOGD("%s {%hd, %hd, %hd}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1358}
1359static void SC_debugS4(const char *s, short4 c) {
1360    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);
1361}
1362static void SC_debugU16(const char *s, unsigned short c) {
1363    ALOGD("%s %hu  0x%hx", s, c, c);
1364}
1365static void SC_debugUS2(const char *s, ushort2 c) {
1366    ALOGD("%s {%hu, %hu}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1367}
1368static void SC_debugUS3(const char *s, ushort3 c) {
1369    ALOGD("%s {%hu, %hu, %hu}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1370}
1371static void SC_debugUS4(const char *s, ushort4 c) {
1372    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);
1373}
1374static void SC_debugI32(const char *s, int32_t i) {
1375    ALOGD("%s %d  0x%x", s, i, i);
1376}
1377static void SC_debugI2(const char *s, int2 i) {
1378    ALOGD("%s {%d, %d}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1379}
1380static void SC_debugI3(const char *s, int3 i) {
1381    ALOGD("%s {%d, %d, %d}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1382}
1383static void SC_debugI4(const char *s, int4 i) {
1384    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);
1385}
1386static void SC_debugU32(const char *s, uint32_t i) {
1387    ALOGD("%s %u  0x%x", s, i, i);
1388}
1389static void SC_debugUI2(const char *s, uint2 i) {
1390    ALOGD("%s {%u, %u}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1391}
1392static void SC_debugUI3(const char *s, uint3 i) {
1393    ALOGD("%s {%u, %u, %u}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1394}
1395static void SC_debugUI4(const char *s, uint4 i) {
1396    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);
1397}
1398static void SC_debugLL64(const char *s, long long ll) {
1399    ALOGD("%s %lld  0x%llx", s, ll, ll);
1400}
1401static void SC_debugL2(const char *s, long2 ll) {
1402    ALOGD("%s {%lld, %lld}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1403}
1404static void SC_debugL3(const char *s, long3 ll) {
1405    ALOGD("%s {%lld, %lld, %lld}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1406}
1407static void SC_debugL4(const char *s, long4 ll) {
1408    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);
1409}
1410static void SC_debugULL64(const char *s, unsigned long long ll) {
1411    ALOGD("%s %llu  0x%llx", s, ll, ll);
1412}
1413static void SC_debugUL2(const char *s, ulong2 ll) {
1414    ALOGD("%s {%llu, %llu}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1415}
1416static void SC_debugUL3(const char *s, ulong3 ll) {
1417    ALOGD("%s {%llu, %llu, %llu}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1418}
1419static void SC_debugUL4(const char *s, ulong4 ll) {
1420    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);
1421}
1422static void SC_debugP(const char *s, const void *p) {
1423    ALOGD("%s %p", s, p);
1424}
1425
1426// TODO: allocation ops, messaging, time
1427
1428void rsDebug(const char *s, float f) {
1429    SC_debugF(s, f);
1430}
1431
1432void rsDebug(const char *s, float f1, float f2) {
1433    SC_debugFv2(s, f1, f2);
1434}
1435
1436void rsDebug(const char *s, float f1, float f2, float f3) {
1437    SC_debugFv3(s, f1, f2, f3);
1438}
1439
1440void rsDebug(const char *s, float f1, float f2, float f3, float f4) {
1441    SC_debugFv4(s, f1, f2, f3, f4);
1442}
1443
1444void rsDebug(const char *s, const float2 *f) {
1445    SC_debugF2(s, *f);
1446}
1447
1448void rsDebug(const char *s, const float3 *f) {
1449    SC_debugF3(s, *f);
1450}
1451
1452void rsDebug(const char *s, const float4 *f) {
1453    SC_debugF4(s, *f);
1454}
1455
1456void rsDebug(const char *s, double d) {
1457    SC_debugD(s, d);
1458}
1459
1460void rsDebug(const char *s, const rs_matrix4x4 *m) {
1461    SC_debugFM4v4(s, (float *) m);
1462}
1463
1464void rsDebug(const char *s, const rs_matrix3x3 *m) {
1465    SC_debugFM3v3(s, (float *) m);
1466}
1467
1468void rsDebug(const char *s, const rs_matrix2x2 *m) {
1469    SC_debugFM2v2(s, (float *) m);
1470}
1471
1472void rsDebug(const char *s, char c) {
1473    SC_debugI8(s, c);
1474}
1475
1476void rsDebug(const char *s, const char2 *c) {
1477    SC_debugC2(s, *c);
1478}
1479
1480void rsDebug(const char *s, const char3 *c) {
1481    SC_debugC3(s, *c);
1482}
1483
1484void rsDebug(const char *s, const char4 *c) {
1485    SC_debugC4(s, *c);
1486}
1487
1488void rsDebug(const char *s, unsigned char c) {
1489    SC_debugU8(s, c);
1490}
1491
1492void rsDebug(const char *s, const uchar2 *c) {
1493    SC_debugUC2(s, *c);
1494}
1495
1496void rsDebug(const char *s, const uchar3 *c) {
1497    SC_debugUC3(s, *c);
1498}
1499
1500void rsDebug(const char *s, const uchar4 *c) {
1501    SC_debugUC4(s, *c);
1502}
1503
1504void rsDebug(const char *s, short c) {
1505    SC_debugI16(s, c);
1506}
1507
1508void rsDebug(const char *s, const short2 *c) {
1509    SC_debugS2(s, *c);
1510}
1511
1512void rsDebug(const char *s, const short3 *c) {
1513    SC_debugS3(s, *c);
1514}
1515
1516void rsDebug(const char *s, const short4 *c) {
1517    SC_debugS4(s, *c);
1518}
1519
1520void rsDebug(const char *s, unsigned short c) {
1521    SC_debugU16(s, c);
1522}
1523
1524void rsDebug(const char *s, const ushort2 *c) {
1525    SC_debugUS2(s, *c);
1526}
1527
1528void rsDebug(const char *s, const ushort3 *c) {
1529    SC_debugUS3(s, *c);
1530}
1531
1532void rsDebug(const char *s, const ushort4 *c) {
1533    SC_debugUS4(s, *c);
1534}
1535
1536void rsDebug(const char *s, int c) {
1537    SC_debugI32(s, c);
1538}
1539
1540void rsDebug(const char *s, const int2 *c) {
1541    SC_debugI2(s, *c);
1542}
1543
1544void rsDebug(const char *s, const int3 *c) {
1545    SC_debugI3(s, *c);
1546}
1547
1548void rsDebug(const char *s, const int4 *c) {
1549    SC_debugI4(s, *c);
1550}
1551
1552void rsDebug(const char *s, unsigned int c) {
1553    SC_debugU32(s, c);
1554}
1555
1556void rsDebug(const char *s, const uint2 *c) {
1557    SC_debugUI2(s, *c);
1558}
1559
1560void rsDebug(const char *s, const uint3 *c) {
1561    SC_debugUI3(s, *c);
1562}
1563
1564void rsDebug(const char *s, const uint4 *c) {
1565    SC_debugUI4(s, *c);
1566}
1567
1568void rsDebug(const char *s, long c) {
1569    SC_debugLL64(s, c);
1570}
1571
1572void rsDebug(const char *s, long long c) {
1573    SC_debugLL64(s, c);
1574}
1575
1576void rsDebug(const char *s, const long2 *c) {
1577    SC_debugL2(s, *c);
1578}
1579
1580void rsDebug(const char *s, const long3 *c) {
1581    SC_debugL3(s, *c);
1582}
1583
1584void rsDebug(const char *s, const long4 *c) {
1585    SC_debugL4(s, *c);
1586}
1587
1588void rsDebug(const char *s, unsigned long c) {
1589    SC_debugULL64(s, c);
1590}
1591
1592void rsDebug(const char *s, unsigned long long c) {
1593    SC_debugULL64(s, c);
1594}
1595
1596void rsDebug(const char *s, const ulong2 *c) {
1597    SC_debugUL2(s, *c);
1598}
1599
1600void rsDebug(const char *s, const ulong3 *c) {
1601    SC_debugUL3(s, *c);
1602}
1603
1604void rsDebug(const char *s, const ulong4 *c) {
1605    SC_debugUL4(s, *c);
1606}
1607
1608void rsDebug(const char *s, const void *p) {
1609    SC_debugP(s, p);
1610}
1611#endif // RS_COMPATIBILITY_LIB
1612
1613extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) {
1614    ScriptC *s = (ScriptC *)pContext;
1615    const RsdCpuReference::CpuSymbol *syms = gSyms;
1616    const RsdCpuReference::CpuSymbol *sym = NULL;
1617
1618    if (!sym) {
1619        while (syms->fnPtr) {
1620            if (!strcmp(syms->name, name)) {
1621                return syms;
1622            }
1623            syms++;
1624        }
1625    }
1626
1627    return NULL;
1628}
1629
1630
1631