rsdRuntimeStubs.cpp revision 0b575de8ed0b628d84d256f5846500b0385979bd
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//////////////////////////////////////////////////////////////////////////////
76// Allocation
77//////////////////////////////////////////////////////////////////////////////
78
79
80static void SC_AllocationSyncAll2(Allocation *a, RsAllocationUsageType source) {
81    Context *rsc = RsdCpuReference::getTlsContext();
82    rsrAllocationSyncAll(rsc, a, source);
83}
84
85static void SC_AllocationSyncAll(Allocation *a) {
86    Context *rsc = RsdCpuReference::getTlsContext();
87    rsrAllocationSyncAll(rsc, a, RS_ALLOCATION_USAGE_SCRIPT);
88}
89
90static void SC_AllocationCopy1DRange(Allocation *dstAlloc,
91                                     uint32_t dstOff,
92                                     uint32_t dstMip,
93                                     uint32_t count,
94                                     Allocation *srcAlloc,
95                                     uint32_t srcOff, uint32_t srcMip) {
96    Context *rsc = RsdCpuReference::getTlsContext();
97    rsrAllocationCopy1DRange(rsc, dstAlloc, dstOff, dstMip, count,
98                             srcAlloc, srcOff, srcMip);
99}
100
101static void SC_AllocationCopy2DRange(Allocation *dstAlloc,
102                                     uint32_t dstXoff, uint32_t dstYoff,
103                                     uint32_t dstMip, uint32_t dstFace,
104                                     uint32_t width, uint32_t height,
105                                     Allocation *srcAlloc,
106                                     uint32_t srcXoff, uint32_t srcYoff,
107                                     uint32_t srcMip, uint32_t srcFace) {
108    Context *rsc = RsdCpuReference::getTlsContext();
109    rsrAllocationCopy2DRange(rsc, dstAlloc,
110                             dstXoff, dstYoff, dstMip, dstFace,
111                             width, height,
112                             srcAlloc,
113                             srcXoff, srcYoff, srcMip, srcFace);
114}
115
116#ifndef RS_COMPATIBILITY_LIB
117static void SC_AllocationIoSend(Allocation *alloc) {
118    Context *rsc = RsdCpuReference::getTlsContext();
119    rsdAllocationIoSend(rsc, alloc);
120}
121
122
123static void SC_AllocationIoReceive(Allocation *alloc) {
124    Context *rsc = RsdCpuReference::getTlsContext();
125    rsdAllocationIoReceive(rsc, alloc);
126}
127
128
129
130//////////////////////////////////////////////////////////////////////////////
131// Context
132//////////////////////////////////////////////////////////////////////////////
133
134static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) {
135    Context *rsc = RsdCpuReference::getTlsContext();
136    rsrBindTexture(rsc, pf, slot, a);
137}
138
139static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) {
140    Context *rsc = RsdCpuReference::getTlsContext();
141    rsrBindConstant(rsc, pv, slot, a);
142}
143
144static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) {
145    Context *rsc = RsdCpuReference::getTlsContext();
146    rsrBindConstant(rsc, pf, slot, a);
147}
148
149static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) {
150    Context *rsc = RsdCpuReference::getTlsContext();
151    rsrBindSampler(rsc, pf, slot, s);
152}
153
154static void SC_BindProgramStore(ProgramStore *ps) {
155    Context *rsc = RsdCpuReference::getTlsContext();
156    rsrBindProgramStore(rsc, ps);
157}
158
159static void SC_BindProgramFragment(ProgramFragment *pf) {
160    Context *rsc = RsdCpuReference::getTlsContext();
161    rsrBindProgramFragment(rsc, pf);
162}
163
164static void SC_BindProgramVertex(ProgramVertex *pv) {
165    Context *rsc = RsdCpuReference::getTlsContext();
166    rsrBindProgramVertex(rsc, pv);
167}
168
169static void SC_BindProgramRaster(ProgramRaster *pr) {
170    Context *rsc = RsdCpuReference::getTlsContext();
171    rsrBindProgramRaster(rsc, pr);
172}
173
174static void SC_BindFrameBufferObjectColorTarget(Allocation *a, uint32_t slot) {
175    Context *rsc = RsdCpuReference::getTlsContext();
176    rsrBindFrameBufferObjectColorTarget(rsc, a, slot);
177}
178
179static void SC_BindFrameBufferObjectDepthTarget(Allocation *a) {
180    Context *rsc = RsdCpuReference::getTlsContext();
181    rsrBindFrameBufferObjectDepthTarget(rsc, a);
182}
183
184static void SC_ClearFrameBufferObjectColorTarget(uint32_t slot) {
185    Context *rsc = RsdCpuReference::getTlsContext();
186    rsrClearFrameBufferObjectColorTarget(rsc, slot);
187}
188
189static void SC_ClearFrameBufferObjectDepthTarget(Context *, Script *) {
190    Context *rsc = RsdCpuReference::getTlsContext();
191    rsrClearFrameBufferObjectDepthTarget(rsc);
192}
193
194static void SC_ClearFrameBufferObjectTargets(Context *, Script *) {
195    Context *rsc = RsdCpuReference::getTlsContext();
196    rsrClearFrameBufferObjectTargets(rsc);
197}
198
199
200//////////////////////////////////////////////////////////////////////////////
201// VP
202//////////////////////////////////////////////////////////////////////////////
203
204static void SC_VpLoadProjectionMatrix(const rsc_Matrix *m) {
205    Context *rsc = RsdCpuReference::getTlsContext();
206    rsrVpLoadProjectionMatrix(rsc, m);
207}
208
209static void SC_VpLoadModelMatrix(const rsc_Matrix *m) {
210    Context *rsc = RsdCpuReference::getTlsContext();
211    rsrVpLoadModelMatrix(rsc, m);
212}
213
214static void SC_VpLoadTextureMatrix(const rsc_Matrix *m) {
215    Context *rsc = RsdCpuReference::getTlsContext();
216    rsrVpLoadTextureMatrix(rsc, m);
217}
218
219static void SC_PfConstantColor(ProgramFragment *pf, float r, float g, float b, float a) {
220    Context *rsc = RsdCpuReference::getTlsContext();
221    rsrPfConstantColor(rsc, pf, r, g, b, a);
222}
223
224static void SC_VpGetProjectionMatrix(rsc_Matrix *m) {
225    Context *rsc = RsdCpuReference::getTlsContext();
226    rsrVpGetProjectionMatrix(rsc, m);
227}
228
229
230//////////////////////////////////////////////////////////////////////////////
231// Drawing
232//////////////////////////////////////////////////////////////////////////////
233
234static void SC_DrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
235                                 float x2, float y2, float z2, float u2, float v2,
236                                 float x3, float y3, float z3, float u3, float v3,
237                                 float x4, float y4, float z4, float u4, float v4) {
238    Context *rsc = RsdCpuReference::getTlsContext();
239
240    if (!rsc->setupCheck()) {
241        return;
242    }
243
244    RsdHal *dc = (RsdHal *)rsc->mHal.drv;
245    if (!dc->gl.shaderCache->setup(rsc)) {
246        return;
247    }
248
249    //ALOGE("Quad");
250    //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
251    //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
252    //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
253    //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
254
255    float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
256    const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
257
258    RsdVertexArray::Attrib attribs[2];
259    attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position");
260    attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0");
261
262    RsdVertexArray va(attribs, 2);
263    va.setup(rsc);
264
265    RSD_CALL_GL(glDrawArrays, GL_TRIANGLE_FAN, 0, 4);
266}
267
268static void SC_DrawQuad(float x1, float y1, float z1,
269                        float x2, float y2, float z2,
270                        float x3, float y3, float z3,
271                        float x4, float y4, float z4) {
272    SC_DrawQuadTexCoords(x1, y1, z1, 0, 1,
273                         x2, y2, z2, 1, 1,
274                         x3, y3, z3, 1, 0,
275                         x4, y4, z4, 0, 0);
276}
277
278static void SC_DrawSpriteScreenspace(float x, float y, float z, float w, float h) {
279    Context *rsc = RsdCpuReference::getTlsContext();
280
281    ObjectBaseRef<const ProgramVertex> tmp(rsc->getProgramVertex());
282    rsc->setProgramVertex(rsc->getDefaultProgramVertex());
283    //rsc->setupCheck();
284
285    //GLint crop[4] = {0, h, w, -h};
286
287    float sh = rsc->getHeight();
288
289    SC_DrawQuad(x,   sh - y,     z,
290                x+w, sh - y,     z,
291                x+w, sh - (y+h), z,
292                x,   sh - (y+h), z);
293    rsc->setProgramVertex((ProgramVertex *)tmp.get());
294}
295
296static void SC_DrawRect(float x1, float y1, float x2, float y2, float z) {
297    SC_DrawQuad(x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z);
298}
299
300static void SC_DrawPath(Path *p) {
301    Context *rsc = RsdCpuReference::getTlsContext();
302    rsdPathDraw(rsc, p);
303}
304
305static void SC_DrawMesh(Mesh *m) {
306    Context *rsc = RsdCpuReference::getTlsContext();
307    rsrDrawMesh(rsc, m);
308}
309
310static void SC_DrawMeshPrimitive(Mesh *m, uint32_t primIndex) {
311    Context *rsc = RsdCpuReference::getTlsContext();
312    rsrDrawMeshPrimitive(rsc, m, primIndex);
313}
314
315static void SC_DrawMeshPrimitiveRange(Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len) {
316    Context *rsc = RsdCpuReference::getTlsContext();
317    rsrDrawMeshPrimitiveRange(rsc, m, primIndex, start, len);
318}
319
320static void SC_MeshComputeBoundingBox(Mesh *m,
321                               float *minX, float *minY, float *minZ,
322                               float *maxX, float *maxY, float *maxZ) {
323    Context *rsc = RsdCpuReference::getTlsContext();
324    rsrMeshComputeBoundingBox(rsc, m, minX, minY, minZ, maxX, maxY, maxZ);
325}
326
327
328
329//////////////////////////////////////////////////////////////////////////////
330//
331//////////////////////////////////////////////////////////////////////////////
332
333
334static void SC_Color(float r, float g, float b, float a) {
335    Context *rsc = RsdCpuReference::getTlsContext();
336    rsrColor(rsc, r, g, b, a);
337}
338
339static void SC_Finish() {
340    Context *rsc = RsdCpuReference::getTlsContext();
341    rsdGLFinish(rsc);
342}
343
344static void SC_ClearColor(float r, float g, float b, float a) {
345    Context *rsc = RsdCpuReference::getTlsContext();
346    rsrPrepareClear(rsc);
347    rsdGLClearColor(rsc, r, g, b, a);
348}
349
350static void SC_ClearDepth(float v) {
351    Context *rsc = RsdCpuReference::getTlsContext();
352    rsrPrepareClear(rsc);
353    rsdGLClearDepth(rsc, v);
354}
355
356static uint32_t SC_GetWidth() {
357    Context *rsc = RsdCpuReference::getTlsContext();
358    return rsrGetWidth(rsc);
359}
360
361static uint32_t SC_GetHeight() {
362    Context *rsc = RsdCpuReference::getTlsContext();
363    return rsrGetHeight(rsc);
364}
365
366static void SC_DrawTextAlloc(Allocation *a, int x, int y) {
367    Context *rsc = RsdCpuReference::getTlsContext();
368    rsrDrawTextAlloc(rsc, a, x, y);
369}
370
371static void SC_DrawText(const char *text, int x, int y) {
372    Context *rsc = RsdCpuReference::getTlsContext();
373    rsrDrawText(rsc, text, x, y);
374}
375
376static void SC_MeasureTextAlloc(Allocation *a,
377                         int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
378    Context *rsc = RsdCpuReference::getTlsContext();
379    rsrMeasureTextAlloc(rsc, a, left, right, top, bottom);
380}
381
382static void SC_MeasureText(const char *text,
383                    int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
384    Context *rsc = RsdCpuReference::getTlsContext();
385    rsrMeasureText(rsc, text, left, right, top, bottom);
386}
387
388static void SC_BindFont(Font *f) {
389    Context *rsc = RsdCpuReference::getTlsContext();
390    rsrBindFont(rsc, f);
391}
392
393static void SC_FontColor(float r, float g, float b, float a) {
394    Context *rsc = RsdCpuReference::getTlsContext();
395    rsrFontColor(rsc, r, g, b, a);
396}
397#endif
398
399
400//////////////////////////////////////////////////////////////////////////////
401//
402//////////////////////////////////////////////////////////////////////////////
403
404static void SC_SetObject(ObjectBase **dst, ObjectBase * src) {
405    Context *rsc = RsdCpuReference::getTlsContext();
406    rsrSetObject(rsc, dst, src);
407}
408
409static void SC_ClearObject(ObjectBase **dst) {
410    Context *rsc = RsdCpuReference::getTlsContext();
411    rsrClearObject(rsc, dst);
412}
413
414static bool SC_IsObject(const ObjectBase *src) {
415    Context *rsc = RsdCpuReference::getTlsContext();
416    return rsrIsObject(rsc, src);
417}
418
419
420
421
422static const Allocation * SC_GetAllocation(const void *ptr) {
423    Context *rsc = RsdCpuReference::getTlsContext();
424    const Script *sc = RsdCpuReference::getTlsScript();
425    return rsdScriptGetAllocationForPointer(rsc, sc, ptr);
426}
427
428static void SC_ForEach_SAA(Script *target,
429                            Allocation *in,
430                            Allocation *out) {
431    Context *rsc = RsdCpuReference::getTlsContext();
432    rsrForEach(rsc, target, in, out, NULL, 0, NULL);
433}
434
435static void SC_ForEach_SAAU(Script *target,
436                            Allocation *in,
437                            Allocation *out,
438                            const void *usr) {
439    Context *rsc = RsdCpuReference::getTlsContext();
440    rsrForEach(rsc, target, in, out, usr, 0, NULL);
441}
442
443static void SC_ForEach_SAAUS(Script *target,
444                             Allocation *in,
445                             Allocation *out,
446                             const void *usr,
447                             const RsScriptCall *call) {
448    Context *rsc = RsdCpuReference::getTlsContext();
449    rsrForEach(rsc, target, in, out, usr, 0, call);
450}
451
452static void SC_ForEach_SAAUL(Script *target,
453                             Allocation *in,
454                             Allocation *out,
455                             const void *usr,
456                             uint32_t usrLen) {
457    Context *rsc = RsdCpuReference::getTlsContext();
458    rsrForEach(rsc, target, in, out, usr, usrLen, NULL);
459}
460
461static void SC_ForEach_SAAULS(Script *target,
462                              Allocation *in,
463                              Allocation *out,
464                              const void *usr,
465                              uint32_t usrLen,
466                              const RsScriptCall *call) {
467    Context *rsc = RsdCpuReference::getTlsContext();
468    rsrForEach(rsc, target, in, out, usr, usrLen, call);
469}
470
471
472
473//////////////////////////////////////////////////////////////////////////////
474// Time routines
475//////////////////////////////////////////////////////////////////////////////
476
477static float SC_GetDt() {
478    Context *rsc = RsdCpuReference::getTlsContext();
479    const Script *sc = RsdCpuReference::getTlsScript();
480    return rsrGetDt(rsc, sc);
481}
482
483time_t SC_Time(time_t *timer) {
484    Context *rsc = RsdCpuReference::getTlsContext();
485    return rsrTime(rsc, timer);
486}
487
488tm* SC_LocalTime(tm *local, time_t *timer) {
489    Context *rsc = RsdCpuReference::getTlsContext();
490    return rsrLocalTime(rsc, local, timer);
491}
492
493int64_t SC_UptimeMillis() {
494    Context *rsc = RsdCpuReference::getTlsContext();
495    return rsrUptimeMillis(rsc);
496}
497
498int64_t SC_UptimeNanos() {
499    Context *rsc = RsdCpuReference::getTlsContext();
500    return rsrUptimeNanos(rsc);
501}
502
503//////////////////////////////////////////////////////////////////////////////
504// Message routines
505//////////////////////////////////////////////////////////////////////////////
506
507static uint32_t SC_ToClient2(int cmdID, void *data, int len) {
508    Context *rsc = RsdCpuReference::getTlsContext();
509    return rsrToClient(rsc, cmdID, data, len);
510}
511
512static uint32_t SC_ToClient(int cmdID) {
513    Context *rsc = RsdCpuReference::getTlsContext();
514    return rsrToClient(rsc, cmdID, NULL, 0);
515}
516
517static uint32_t SC_ToClientBlocking2(int cmdID, void *data, int len) {
518    Context *rsc = RsdCpuReference::getTlsContext();
519    return rsrToClientBlocking(rsc, cmdID, data, len);
520}
521
522static uint32_t SC_ToClientBlocking(int cmdID) {
523    Context *rsc = RsdCpuReference::getTlsContext();
524    return rsrToClientBlocking(rsc, cmdID, NULL, 0);
525}
526
527
528static void * ElementAt1D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x) {
529    Context *rsc = RsdCpuReference::getTlsContext();
530    const Type *t = a->getType();
531    const Element *e = t->getElement();
532
533    char buf[256];
534    if (x >= t->getLODDimX(0)) {
535        sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
536        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
537        return NULL;
538    }
539
540    if (vecSize != e->getVectorSize()) {
541        sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
542        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
543        return NULL;
544    }
545
546    if (dt != e->getType()) {
547        sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
548        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
549        return NULL;
550    }
551
552    uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
553    const uint32_t eSize = e->getSizeBytes();
554    return &p[(eSize * x)];
555}
556
557static void * ElementAt2D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y) {
558    Context *rsc = RsdCpuReference::getTlsContext();
559    const Type *t = a->getType();
560    const Element *e = t->getElement();
561
562    char buf[256];
563    if (x >= t->getLODDimX(0)) {
564        sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
565        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
566        return NULL;
567    }
568
569    if (y >= t->getLODDimY(0)) {
570        sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
571        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
572        return NULL;
573    }
574
575    if (vecSize != e->getVectorSize()) {
576        sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
577        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
578        return NULL;
579    }
580
581    if (dt != e->getType()) {
582        sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
583        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
584        return NULL;
585    }
586
587    uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
588    const uint32_t eSize = e->getSizeBytes();
589    const uint32_t stride = a->mHal.drvState.lod[0].stride;
590    return &p[(eSize * x) + (y * stride)];
591}
592
593static void * ElementAt3D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y, uint32_t z) {
594    Context *rsc = RsdCpuReference::getTlsContext();
595    const Type *t = a->getType();
596    const Element *e = t->getElement();
597
598    char buf[256];
599    if (x >= t->getLODDimX(0)) {
600        sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
601        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
602        return NULL;
603    }
604
605    if (y >= t->getLODDimY(0)) {
606        sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
607        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
608        return NULL;
609    }
610
611    if (z >= t->getLODDimZ(0)) {
612        sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0));
613        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
614        return NULL;
615    }
616
617    if (vecSize != e->getVectorSize()) {
618        sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
619        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
620        return NULL;
621    }
622
623    if (dt != e->getType()) {
624        sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
625        rsc->setError(RS_ERROR_FATAL_UNKNOWN, buf);
626        return NULL;
627    }
628
629    uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
630    const uint32_t eSize = e->getSizeBytes();
631    const uint32_t stride = a->mHal.drvState.lod[0].stride;
632    return &p[(eSize * x) + (y * stride)];
633}
634
635#define ELEMENT_AT(T, DT, VS)                                               \
636    static void SC_SetElementAt1_##T(Allocation *a, T val, uint32_t x) {           \
637        void *r = ElementAt1D(a, DT, VS, x);                            \
638        if (r != NULL) ((T *)r)[0] = val;                               \
639        else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
640    }                                                                   \
641    static void SC_SetElementAt2_##T(Allocation * a, T val, uint32_t x, uint32_t y) { \
642        void *r = ElementAt2D(a, DT, VS, x, y);            \
643        if (r != NULL) ((T *)r)[0] = val;                               \
644        else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
645    }                                                                   \
646    static void SC_SetElementAt3_##T(Allocation * a, T val, uint32_t x, uint32_t y, uint32_t z) { \
647        void *r = ElementAt3D(a, DT, VS, x, y, z);         \
648        if (r != NULL) ((T *)r)[0] = val;                               \
649        else ALOGE("Error from %s", __PRETTY_FUNCTION__);               \
650    }                                                                   \
651    static T SC_GetElementAt1_##T(Allocation * a, uint32_t x) {                  \
652        void *r = ElementAt1D(a, DT, VS, x);               \
653        if (r != NULL) return ((T *)r)[0];                              \
654        ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
655        return 0;                                                       \
656    }                                                                   \
657    static T SC_GetElementAt2_##T(Allocation * a, uint32_t x, uint32_t y) {      \
658        void *r = ElementAt2D(a, DT, VS, x, y);            \
659        if (r != NULL) return ((T *)r)[0];                              \
660        ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
661        return 0;                                                       \
662    }                                                                   \
663    static T SC_GetElementAt3_##T(Allocation * a, uint32_t x, uint32_t y, uint32_t z) { \
664        void *r = ElementAt3D(a, DT, VS, x, y, z);         \
665        if (r != NULL) return ((T *)r)[0];                              \
666        ALOGE("Error from %s", __PRETTY_FUNCTION__);                    \
667        return 0;                                                       \
668    }
669
670ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1)
671ELEMENT_AT(char2, RS_TYPE_SIGNED_8, 2)
672ELEMENT_AT(char3, RS_TYPE_SIGNED_8, 3)
673ELEMENT_AT(char4, RS_TYPE_SIGNED_8, 4)
674ELEMENT_AT(uchar, RS_TYPE_UNSIGNED_8, 1)
675ELEMENT_AT(uchar2, RS_TYPE_UNSIGNED_8, 2)
676ELEMENT_AT(uchar3, RS_TYPE_UNSIGNED_8, 3)
677ELEMENT_AT(uchar4, RS_TYPE_UNSIGNED_8, 4)
678ELEMENT_AT(short, RS_TYPE_SIGNED_16, 1)
679ELEMENT_AT(short2, RS_TYPE_SIGNED_16, 2)
680ELEMENT_AT(short3, RS_TYPE_SIGNED_16, 3)
681ELEMENT_AT(short4, RS_TYPE_SIGNED_16, 4)
682ELEMENT_AT(ushort, RS_TYPE_UNSIGNED_16, 1)
683ELEMENT_AT(ushort2, RS_TYPE_UNSIGNED_16, 2)
684ELEMENT_AT(ushort3, RS_TYPE_UNSIGNED_16, 3)
685ELEMENT_AT(ushort4, RS_TYPE_UNSIGNED_16, 4)
686ELEMENT_AT(int, RS_TYPE_SIGNED_32, 1)
687ELEMENT_AT(int2, RS_TYPE_SIGNED_32, 2)
688ELEMENT_AT(int3, RS_TYPE_SIGNED_32, 3)
689ELEMENT_AT(int4, RS_TYPE_SIGNED_32, 4)
690ELEMENT_AT(uint, RS_TYPE_UNSIGNED_32, 1)
691ELEMENT_AT(uint2, RS_TYPE_UNSIGNED_32, 2)
692ELEMENT_AT(uint3, RS_TYPE_UNSIGNED_32, 3)
693ELEMENT_AT(uint4, RS_TYPE_UNSIGNED_32, 4)
694ELEMENT_AT(long, RS_TYPE_SIGNED_64, 1)
695ELEMENT_AT(long2, RS_TYPE_SIGNED_64, 2)
696ELEMENT_AT(long3, RS_TYPE_SIGNED_64, 3)
697ELEMENT_AT(long4, RS_TYPE_SIGNED_64, 4)
698ELEMENT_AT(ulong, RS_TYPE_UNSIGNED_64, 1)
699ELEMENT_AT(ulong2, RS_TYPE_UNSIGNED_64, 2)
700ELEMENT_AT(ulong3, RS_TYPE_UNSIGNED_64, 3)
701ELEMENT_AT(ulong4, RS_TYPE_UNSIGNED_64, 4)
702ELEMENT_AT(float, RS_TYPE_FLOAT_32, 1)
703ELEMENT_AT(float2, RS_TYPE_FLOAT_32, 2)
704ELEMENT_AT(float3, RS_TYPE_FLOAT_32, 3)
705ELEMENT_AT(float4, RS_TYPE_FLOAT_32, 4)
706ELEMENT_AT(double, RS_TYPE_FLOAT_64, 1)
707ELEMENT_AT(double2, RS_TYPE_FLOAT_64, 2)
708ELEMENT_AT(double3, RS_TYPE_FLOAT_64, 3)
709ELEMENT_AT(double4, RS_TYPE_FLOAT_64, 4)
710
711#undef ELEMENT_AT
712
713//////////////////////////////////////////////////////////////////////////////
714// Stub implementation
715//////////////////////////////////////////////////////////////////////////////
716
717// llvm name mangling ref
718//  <builtin-type> ::= v  # void
719//                 ::= b  # bool
720//                 ::= c  # char
721//                 ::= a  # signed char
722//                 ::= h  # unsigned char
723//                 ::= s  # short
724//                 ::= t  # unsigned short
725//                 ::= i  # int
726//                 ::= j  # unsigned int
727//                 ::= l  # long
728//                 ::= m  # unsigned long
729//                 ::= x  # long long, __int64
730//                 ::= y  # unsigned long long, __int64
731//                 ::= f  # float
732//                 ::= d  # double
733
734static RsdCpuReference::CpuSymbol gSyms[] = {
735    // Debug runtime
736    { "_Z20rsGetElementAt_uchar13rs_allocationcj", (void *)&SC_GetElementAt1_uchar, true },
737    { "_Z21rsGetElementAt_uchar213rs_allocationj", (void *)&SC_GetElementAt1_uchar2, true },
738    { "_Z21rsGetElementAt_uchar313rs_allocationj", (void *)&SC_GetElementAt1_uchar3, true },
739    { "_Z21rsGetElementAt_uchar413rs_allocationj", (void *)&SC_GetElementAt1_uchar4, true },
740    { "_Z20rsGetElementAt_uchar13rs_allocationjj", (void *)&SC_GetElementAt2_uchar, true },
741    { "_Z21rsGetElementAt_uchar213rs_allocationjj", (void *)&SC_GetElementAt2_uchar2, true },
742    { "_Z21rsGetElementAt_uchar313rs_allocationjj", (void *)&SC_GetElementAt2_uchar3, true },
743    { "_Z21rsGetElementAt_uchar413rs_allocationjj", (void *)&SC_GetElementAt2_uchar4, true },
744    { "_Z20rsGetElementAt_uchar13rs_allocationjjj", (void *)&SC_GetElementAt3_uchar, true },
745    { "_Z21rsGetElementAt_uchar213rs_allocationjjj", (void *)&SC_GetElementAt3_uchar2, true },
746    { "_Z21rsGetElementAt_uchar313rs_allocationjjj", (void *)&SC_GetElementAt3_uchar3, true },
747    { "_Z21rsGetElementAt_uchar413rs_allocationjjj", (void *)&SC_GetElementAt3_uchar4, true },
748
749    { "_Z19rsGetElementAt_char13rs_allocationj", (void *)&SC_GetElementAt1_char, true },
750    { "_Z20rsGetElementAt_char213rs_allocationj", (void *)&SC_GetElementAt1_char2, true },
751    { "_Z20rsGetElementAt_char313rs_allocationj", (void *)&SC_GetElementAt1_char3, true },
752    { "_Z20rsGetElementAt_char413rs_allocationj", (void *)&SC_GetElementAt1_char4, true },
753    { "_Z19rsGetElementAt_char13rs_allocationjj", (void *)&SC_GetElementAt2_char, true },
754    { "_Z20rsGetElementAt_char213rs_allocationjj", (void *)&SC_GetElementAt2_char2, true },
755    { "_Z20rsGetElementAt_char313rs_allocationjj", (void *)&SC_GetElementAt2_char3, true },
756    { "_Z20rsGetElementAt_char413rs_allocationjj", (void *)&SC_GetElementAt2_char4, true },
757    { "_Z19rsGetElementAt_char13rs_allocationjjj", (void *)&SC_GetElementAt3_char, true },
758    { "_Z20rsGetElementAt_char213rs_allocationjjj", (void *)&SC_GetElementAt3_char2, true },
759    { "_Z20rsGetElementAt_char313rs_allocationjjj", (void *)&SC_GetElementAt3_char3, true },
760    { "_Z20rsGetElementAt_char413rs_allocationjjj", (void *)&SC_GetElementAt3_char4, true },
761
762    { "_Z21rsGetElementAt_ushort13rs_allocationcj", (void *)&SC_GetElementAt1_ushort, true },
763    { "_Z22rsGetElementAt_ushort213rs_allocationj", (void *)&SC_GetElementAt1_ushort2, true },
764    { "_Z22rsGetElementAt_ushort313rs_allocationj", (void *)&SC_GetElementAt1_ushort3, true },
765    { "_Z22rsGetElementAt_ushort413rs_allocationj", (void *)&SC_GetElementAt1_ushort4, true },
766    { "_Z21rsGetElementAt_ushort13rs_allocationjj", (void *)&SC_GetElementAt2_ushort, true },
767    { "_Z22rsGetElementAt_ushort213rs_allocationjj", (void *)&SC_GetElementAt2_ushort2, true },
768    { "_Z22rsGetElementAt_ushort313rs_allocationjj", (void *)&SC_GetElementAt2_ushort3, true },
769    { "_Z22rsGetElementAt_ushort413rs_allocationjj", (void *)&SC_GetElementAt2_ushort4, true },
770    { "_Z21rsGetElementAt_ushort13rs_allocationjjj", (void *)&SC_GetElementAt3_ushort, true },
771    { "_Z22rsGetElementAt_ushort213rs_allocationjjj", (void *)&SC_GetElementAt3_ushort2, true },
772    { "_Z22rsGetElementAt_ushort313rs_allocationjjj", (void *)&SC_GetElementAt3_ushort3, true },
773    { "_Z22rsGetElementAt_ushort413rs_allocationjjj", (void *)&SC_GetElementAt3_ushort4, true },
774
775    { "_Z20rsGetElementAt_short13rs_allocationj", (void *)&SC_GetElementAt1_short, true },
776    { "_Z21rsGetElementAt_short213rs_allocationj", (void *)&SC_GetElementAt1_short2, true },
777    { "_Z21rsGetElementAt_short313rs_allocationj", (void *)&SC_GetElementAt1_short3, true },
778    { "_Z21rsGetElementAt_short413rs_allocationj", (void *)&SC_GetElementAt1_short4, true },
779    { "_Z20rsGetElementAt_short13rs_allocationjj", (void *)&SC_GetElementAt2_short, true },
780    { "_Z21rsGetElementAt_short213rs_allocationjj", (void *)&SC_GetElementAt2_short2, true },
781    { "_Z21rsGetElementAt_short313rs_allocationjj", (void *)&SC_GetElementAt2_short3, true },
782    { "_Z21rsGetElementAt_short413rs_allocationjj", (void *)&SC_GetElementAt2_short4, true },
783    { "_Z20rsGetElementAt_short13rs_allocationjjj", (void *)&SC_GetElementAt3_short, true },
784    { "_Z21rsGetElementAt_short213rs_allocationjjj", (void *)&SC_GetElementAt3_short2, true },
785    { "_Z21rsGetElementAt_short313rs_allocationjjj", (void *)&SC_GetElementAt3_short3, true },
786    { "_Z21rsGetElementAt_short413rs_allocationjjj", (void *)&SC_GetElementAt3_short4, true },
787
788    { "_Z19rsGetElementAt_uint13rs_allocationcj", (void *)&SC_GetElementAt1_uint, true },
789    { "_Z20rsGetElementAt_uint213rs_allocationj", (void *)&SC_GetElementAt1_uint2, true },
790    { "_Z20rsGetElementAt_uint313rs_allocationj", (void *)&SC_GetElementAt1_uint3, true },
791    { "_Z20rsGetElementAt_uint413rs_allocationj", (void *)&SC_GetElementAt1_uint4, true },
792    { "_Z19rsGetElementAt_uint13rs_allocationjj", (void *)&SC_GetElementAt2_uint, true },
793    { "_Z20rsGetElementAt_uint213rs_allocationjj", (void *)&SC_GetElementAt2_uint2, true },
794    { "_Z20rsGetElementAt_uint313rs_allocationjj", (void *)&SC_GetElementAt2_uint3, true },
795    { "_Z20rsGetElementAt_uint413rs_allocationjj", (void *)&SC_GetElementAt2_uint4, true },
796    { "_Z19rsGetElementAt_uint13rs_allocationjjj", (void *)&SC_GetElementAt3_uint, true },
797    { "_Z20rsGetElementAt_uint213rs_allocationjjj", (void *)&SC_GetElementAt3_uint2, true },
798    { "_Z20rsGetElementAt_uint313rs_allocationjjj", (void *)&SC_GetElementAt3_uint3, true },
799    { "_Z20rsGetElementAt_uint413rs_allocationjjj", (void *)&SC_GetElementAt3_uint4, true },
800
801    { "_Z18rsGetElementAt_int13rs_allocationj", (void *)&SC_GetElementAt1_int, true },
802    { "_Z19rsGetElementAt_int213rs_allocationj", (void *)&SC_GetElementAt1_int2, true },
803    { "_Z19rsGetElementAt_int313rs_allocationj", (void *)&SC_GetElementAt1_int3, true },
804    { "_Z19rsGetElementAt_int413rs_allocationj", (void *)&SC_GetElementAt1_int4, true },
805    { "_Z18rsGetElementAt_int13rs_allocationjj", (void *)&SC_GetElementAt2_int, true },
806    { "_Z19rsGetElementAt_int213rs_allocationjj", (void *)&SC_GetElementAt2_int2, true },
807    { "_Z19rsGetElementAt_int313rs_allocationjj", (void *)&SC_GetElementAt2_int3, true },
808    { "_Z19rsGetElementAt_int413rs_allocationjj", (void *)&SC_GetElementAt2_int4, true },
809    { "_Z18rsGetElementAt_int13rs_allocationjjj", (void *)&SC_GetElementAt3_int, true },
810    { "_Z19rsGetElementAt_int213rs_allocationjjj", (void *)&SC_GetElementAt3_int2, true },
811    { "_Z19rsGetElementAt_int313rs_allocationjjj", (void *)&SC_GetElementAt3_int3, true },
812    { "_Z19rsGetElementAt_int413rs_allocationjjj", (void *)&SC_GetElementAt3_int4, true },
813
814    { "_Z20rsGetElementAt_ulong13rs_allocationcj", (void *)&SC_GetElementAt1_ulong, true },
815    { "_Z21rsGetElementAt_ulong213rs_allocationj", (void *)&SC_GetElementAt1_ulong2, true },
816    { "_Z21rsGetElementAt_ulong313rs_allocationj", (void *)&SC_GetElementAt1_ulong3, true },
817    { "_Z21rsGetElementAt_ulong413rs_allocationj", (void *)&SC_GetElementAt1_ulong4, true },
818    { "_Z20rsGetElementAt_ulong13rs_allocationjj", (void *)&SC_GetElementAt2_ulong, true },
819    { "_Z21rsGetElementAt_ulong213rs_allocationjj", (void *)&SC_GetElementAt2_ulong2, true },
820    { "_Z21rsGetElementAt_ulong313rs_allocationjj", (void *)&SC_GetElementAt2_ulong3, true },
821    { "_Z21rsGetElementAt_ulong413rs_allocationjj", (void *)&SC_GetElementAt2_ulong4, true },
822    { "_Z20rsGetElementAt_ulong13rs_allocationjjj", (void *)&SC_GetElementAt3_ulong, true },
823    { "_Z21rsGetElementAt_ulong213rs_allocationjjj", (void *)&SC_GetElementAt3_ulong2, true },
824    { "_Z21rsGetElementAt_ulong313rs_allocationjjj", (void *)&SC_GetElementAt3_ulong3, true },
825    { "_Z21rsGetElementAt_ulong413rs_allocationjjj", (void *)&SC_GetElementAt3_ulong4, true },
826
827    { "_Z19rsGetElementAt_long13rs_allocationj", (void *)&SC_GetElementAt1_long, true },
828    { "_Z20rsGetElementAt_long213rs_allocationj", (void *)&SC_GetElementAt1_long2, true },
829    { "_Z20rsGetElementAt_long313rs_allocationj", (void *)&SC_GetElementAt1_long3, true },
830    { "_Z20rsGetElementAt_long413rs_allocationj", (void *)&SC_GetElementAt1_long4, true },
831    { "_Z19rsGetElementAt_long13rs_allocationjj", (void *)&SC_GetElementAt2_long, true },
832    { "_Z20rsGetElementAt_long213rs_allocationjj", (void *)&SC_GetElementAt2_long2, true },
833    { "_Z20rsGetElementAt_long313rs_allocationjj", (void *)&SC_GetElementAt2_long3, true },
834    { "_Z20rsGetElementAt_long413rs_allocationjj", (void *)&SC_GetElementAt2_long4, true },
835    { "_Z19rsGetElementAt_long13rs_allocationjjj", (void *)&SC_GetElementAt3_long, true },
836    { "_Z20rsGetElementAt_long213rs_allocationjjj", (void *)&SC_GetElementAt3_long2, true },
837    { "_Z20rsGetElementAt_long313rs_allocationjjj", (void *)&SC_GetElementAt3_long3, true },
838    { "_Z20rsGetElementAt_long413rs_allocationjjj", (void *)&SC_GetElementAt3_long4, true },
839
840    { "_Z20rsGetElementAt_float13rs_allocationcj", (void *)&SC_GetElementAt1_float, true },
841    { "_Z21rsGetElementAt_float213rs_allocationj", (void *)&SC_GetElementAt1_float2, true },
842    { "_Z21rsGetElementAt_float313rs_allocationj", (void *)&SC_GetElementAt1_float3, true },
843    { "_Z21rsGetElementAt_float413rs_allocationj", (void *)&SC_GetElementAt1_float4, true },
844    { "_Z20rsGetElementAt_float13rs_allocationjj", (void *)&SC_GetElementAt2_float, true },
845    { "_Z21rsGetElementAt_float213rs_allocationjj", (void *)&SC_GetElementAt2_float2, true },
846    { "_Z21rsGetElementAt_float313rs_allocationjj", (void *)&SC_GetElementAt2_float3, true },
847    { "_Z21rsGetElementAt_float413rs_allocationjj", (void *)&SC_GetElementAt2_float4, true },
848    { "_Z20rsGetElementAt_float13rs_allocationjjj", (void *)&SC_GetElementAt3_float, true },
849    { "_Z21rsGetElementAt_float213rs_allocationjjj", (void *)&SC_GetElementAt3_float2, true },
850    { "_Z21rsGetElementAt_float313rs_allocationjjj", (void *)&SC_GetElementAt3_float3, true },
851    { "_Z21rsGetElementAt_float413rs_allocationjjj", (void *)&SC_GetElementAt3_float4, true },
852
853    { "_Z21rsGetElementAt_double13rs_allocationcj", (void *)&SC_GetElementAt1_double, true },
854    { "_Z22rsGetElementAt_double213rs_allocationj", (void *)&SC_GetElementAt1_double2, true },
855    { "_Z22rsGetElementAt_double313rs_allocationj", (void *)&SC_GetElementAt1_double3, true },
856    { "_Z22rsGetElementAt_double413rs_allocationj", (void *)&SC_GetElementAt1_double4, true },
857    { "_Z21rsGetElementAt_double13rs_allocationjj", (void *)&SC_GetElementAt2_double, true },
858    { "_Z22rsGetElementAt_double213rs_allocationjj", (void *)&SC_GetElementAt2_double2, true },
859    { "_Z22rsGetElementAt_double313rs_allocationjj", (void *)&SC_GetElementAt2_double3, true },
860    { "_Z22rsGetElementAt_double413rs_allocationjj", (void *)&SC_GetElementAt2_double4, true },
861    { "_Z21rsGetElementAt_double13rs_allocationjjj", (void *)&SC_GetElementAt3_double, true },
862    { "_Z22rsGetElementAt_double213rs_allocationjjj", (void *)&SC_GetElementAt3_double2, true },
863    { "_Z22rsGetElementAt_double313rs_allocationjjj", (void *)&SC_GetElementAt3_double3, true },
864    { "_Z22rsGetElementAt_double413rs_allocationjjj", (void *)&SC_GetElementAt3_double4, true },
865
866
867
868    { "_Z20rsSetElementAt_uchar13rs_allocationhj", (void *)&SC_SetElementAt1_uchar, true },
869    { "_Z21rsSetElementAt_uchar213rs_allocationDv2_hj", (void *)&SC_SetElementAt1_uchar2, true },
870    { "_Z21rsSetElementAt_uchar313rs_allocationDv3_hj", (void *)&SC_SetElementAt1_uchar3, true },
871    { "_Z21rsSetElementAt_uchar413rs_allocationDv4_hj", (void *)&SC_SetElementAt1_uchar4, true },
872    { "_Z20rsSetElementAt_uchar13rs_allocationhjj", (void *)&SC_SetElementAt2_uchar, true },
873    { "_Z21rsSetElementAt_uchar213rs_allocationDv2_hjj", (void *)&SC_SetElementAt2_uchar2, true },
874    { "_Z21rsSetElementAt_uchar313rs_allocationDv3_hjj", (void *)&SC_SetElementAt2_uchar3, true },
875    { "_Z21rsSetElementAt_uchar413rs_allocationDv4_hjj", (void *)&SC_SetElementAt2_uchar4, true },
876    { "_Z20rsSetElementAt_uchar13rs_allocationhjjj", (void *)&SC_SetElementAt3_uchar, true },
877    { "_Z21rsSetElementAt_uchar213rs_allocationDv2_hjjj", (void *)&SC_SetElementAt3_uchar2, true },
878    { "_Z21rsSetElementAt_uchar313rs_allocationDv3_hjjj", (void *)&SC_SetElementAt3_uchar3, true },
879    { "_Z21rsSetElementAt_uchar413rs_allocationDv4_hjjj", (void *)&SC_SetElementAt3_uchar4, true },
880
881    { "_Z19rsSetElementAt_char13rs_allocationcj", (void *)&SC_SetElementAt1_char, true },
882    { "_Z20rsSetElementAt_char213rs_allocationDv2_cj", (void *)&SC_SetElementAt1_char2, true },
883    { "_Z20rsSetElementAt_char313rs_allocationDv3_cj", (void *)&SC_SetElementAt1_char3, true },
884    { "_Z20rsSetElementAt_char413rs_allocationDv4_cj", (void *)&SC_SetElementAt1_char4, true },
885    { "_Z19rsSetElementAt_char13rs_allocationcjj", (void *)&SC_SetElementAt2_char, true },
886    { "_Z20rsSetElementAt_char213rs_allocationDv2_cjj", (void *)&SC_SetElementAt2_char2, true },
887    { "_Z20rsSetElementAt_char313rs_allocationDv3_cjj", (void *)&SC_SetElementAt2_char3, true },
888    { "_Z20rsSetElementAt_char413rs_allocationDv4_cjj", (void *)&SC_SetElementAt2_char4, true },
889    { "_Z19rsSetElementAt_char13rs_allocationcjjj", (void *)&SC_SetElementAt3_char, true },
890    { "_Z20rsSetElementAt_char213rs_allocationDv2_cjjj", (void *)&SC_SetElementAt3_char2, true },
891    { "_Z20rsSetElementAt_char313rs_allocationDv3_cjjj", (void *)&SC_SetElementAt3_char3, true },
892    { "_Z20rsSetElementAt_char413rs_allocationDv4_cjjj", (void *)&SC_SetElementAt3_char4, true },
893
894    { "_Z21rsSetElementAt_ushort13rs_allocationht", (void *)&SC_SetElementAt1_ushort, true },
895    { "_Z22rsSetElementAt_ushort213rs_allocationDv2_tj", (void *)&SC_SetElementAt1_ushort2, true },
896    { "_Z22rsSetElementAt_ushort313rs_allocationDv3_tj", (void *)&SC_SetElementAt1_ushort3, true },
897    { "_Z22rsSetElementAt_ushort413rs_allocationDv4_tj", (void *)&SC_SetElementAt1_ushort4, true },
898    { "_Z21rsSetElementAt_ushort13rs_allocationtjj", (void *)&SC_SetElementAt2_ushort, true },
899    { "_Z22rsSetElementAt_ushort213rs_allocationDv2_tjj", (void *)&SC_SetElementAt2_ushort2, true },
900    { "_Z22rsSetElementAt_ushort313rs_allocationDv3_tjj", (void *)&SC_SetElementAt2_ushort3, true },
901    { "_Z22rsSetElementAt_ushort413rs_allocationDv4_tjj", (void *)&SC_SetElementAt2_ushort4, true },
902    { "_Z21rsSetElementAt_ushort13rs_allocationtjjj", (void *)&SC_SetElementAt3_ushort, true },
903    { "_Z22rsSetElementAt_ushort213rs_allocationDv2_tjjj", (void *)&SC_SetElementAt3_ushort2, true },
904    { "_Z22rsSetElementAt_ushort313rs_allocationDv3_tjjj", (void *)&SC_SetElementAt3_ushort3, true },
905    { "_Z22rsSetElementAt_ushort413rs_allocationDv4_tjjj", (void *)&SC_SetElementAt3_ushort4, true },
906
907    { "_Z20rsSetElementAt_short13rs_allocationsj", (void *)&SC_SetElementAt1_short, true },
908    { "_Z21rsSetElementAt_short213rs_allocationDv2_sj", (void *)&SC_SetElementAt1_short2, true },
909    { "_Z21rsSetElementAt_short313rs_allocationDv3_sj", (void *)&SC_SetElementAt1_short3, true },
910    { "_Z21rsSetElementAt_short413rs_allocationDv4_sj", (void *)&SC_SetElementAt1_short4, true },
911    { "_Z20rsSetElementAt_short13rs_allocationsjj", (void *)&SC_SetElementAt2_short, true },
912    { "_Z21rsSetElementAt_short213rs_allocationDv2_sjj", (void *)&SC_SetElementAt2_short2, true },
913    { "_Z21rsSetElementAt_short313rs_allocationDv3_sjj", (void *)&SC_SetElementAt2_short3, true },
914    { "_Z21rsSetElementAt_short413rs_allocationDv4_sjj", (void *)&SC_SetElementAt2_short4, true },
915    { "_Z20rsSetElementAt_short13rs_allocationsjjj", (void *)&SC_SetElementAt3_short, true },
916    { "_Z21rsSetElementAt_short213rs_allocationDv2_sjjj", (void *)&SC_SetElementAt3_short2, true },
917    { "_Z21rsSetElementAt_short313rs_allocationDv3_sjjj", (void *)&SC_SetElementAt3_short3, true },
918    { "_Z21rsSetElementAt_short413rs_allocationDv4_sjjj", (void *)&SC_SetElementAt3_short4, true },
919
920    { "_Z19rsSetElementAt_uint13rs_allocationjj", (void *)&SC_SetElementAt1_uint, true },
921    { "_Z20rsSetElementAt_uint213rs_allocationDv2_jj", (void *)&SC_SetElementAt1_uint2, true },
922    { "_Z20rsSetElementAt_uint313rs_allocationDv3_jj", (void *)&SC_SetElementAt1_uint3, true },
923    { "_Z20rsSetElementAt_uint413rs_allocationDv4_jj", (void *)&SC_SetElementAt1_uint4, true },
924    { "_Z19rsSetElementAt_uint13rs_allocationjjj", (void *)&SC_SetElementAt2_uint, true },
925    { "_Z20rsSetElementAt_uint213rs_allocationDv2_jjj", (void *)&SC_SetElementAt2_uint2, true },
926    { "_Z20rsSetElementAt_uint313rs_allocationDv3_jjj", (void *)&SC_SetElementAt2_uint3, true },
927    { "_Z20rsSetElementAt_uint413rs_allocationDv4_jjj", (void *)&SC_SetElementAt2_uint4, true },
928    { "_Z19rsSetElementAt_uint13rs_allocationjjjj", (void *)&SC_SetElementAt3_uint, true },
929    { "_Z20rsSetElementAt_uint213rs_allocationDv2_jjjj", (void *)&SC_SetElementAt3_uint2, true },
930    { "_Z20rsSetElementAt_uint313rs_allocationDv3_jjjj", (void *)&SC_SetElementAt3_uint3, true },
931    { "_Z20rsSetElementAt_uint413rs_allocationDv4_jjjj", (void *)&SC_SetElementAt3_uint4, true },
932
933    { "_Z19rsSetElementAt_int13rs_allocationij", (void *)&SC_SetElementAt1_int, true },
934    { "_Z19rsSetElementAt_int213rs_allocationDv2_ij", (void *)&SC_SetElementAt1_int2, true },
935    { "_Z19rsSetElementAt_int313rs_allocationDv3_ij", (void *)&SC_SetElementAt1_int3, true },
936    { "_Z19rsSetElementAt_int413rs_allocationDv4_ij", (void *)&SC_SetElementAt1_int4, true },
937    { "_Z18rsSetElementAt_int13rs_allocationijj", (void *)&SC_SetElementAt2_int, true },
938    { "_Z19rsSetElementAt_int213rs_allocationDv2_ijj", (void *)&SC_SetElementAt2_int2, true },
939    { "_Z19rsSetElementAt_int313rs_allocationDv3_ijj", (void *)&SC_SetElementAt2_int3, true },
940    { "_Z19rsSetElementAt_int413rs_allocationDv4_ijj", (void *)&SC_SetElementAt2_int4, true },
941    { "_Z18rsSetElementAt_int13rs_allocationijjj", (void *)&SC_SetElementAt3_int, true },
942    { "_Z19rsSetElementAt_int213rs_allocationDv2_ijjj", (void *)&SC_SetElementAt3_int2, true },
943    { "_Z19rsSetElementAt_int313rs_allocationDv3_ijjj", (void *)&SC_SetElementAt3_int3, true },
944    { "_Z19rsSetElementAt_int413rs_allocationDv4_ijjj", (void *)&SC_SetElementAt3_int4, true },
945
946    { "_Z20rsSetElementAt_ulong13rs_allocationmt", (void *)&SC_SetElementAt1_ulong, true },
947    { "_Z21rsSetElementAt_ulong213rs_allocationDv2_mj", (void *)&SC_SetElementAt1_ulong2, true },
948    { "_Z21rsSetElementAt_ulong313rs_allocationDv3_mj", (void *)&SC_SetElementAt1_ulong3, true },
949    { "_Z21rsSetElementAt_ulong413rs_allocationDv4_mj", (void *)&SC_SetElementAt1_ulong4, true },
950    { "_Z20rsSetElementAt_ulong13rs_allocationmjj", (void *)&SC_SetElementAt2_ulong, true },
951    { "_Z21rsSetElementAt_ulong213rs_allocationDv2_mjj", (void *)&SC_SetElementAt2_ulong2, true },
952    { "_Z21rsSetElementAt_ulong313rs_allocationDv3_mjj", (void *)&SC_SetElementAt2_ulong3, true },
953    { "_Z21rsSetElementAt_ulong413rs_allocationDv4_mjj", (void *)&SC_SetElementAt2_ulong4, true },
954    { "_Z20rsSetElementAt_ulong13rs_allocationmjjj", (void *)&SC_SetElementAt3_ulong, true },
955    { "_Z21rsSetElementAt_ulong213rs_allocationDv2_mjjj", (void *)&SC_SetElementAt3_ulong2, true },
956    { "_Z21rsSetElementAt_ulong313rs_allocationDv3_mjjj", (void *)&SC_SetElementAt3_ulong3, true },
957    { "_Z21rsSetElementAt_ulong413rs_allocationDv4_mjjj", (void *)&SC_SetElementAt3_ulong4, true },
958
959    { "_Z19rsSetElementAt_long13rs_allocationlj", (void *)&SC_SetElementAt1_long, true },
960    { "_Z20rsSetElementAt_long213rs_allocationDv2_lj", (void *)&SC_SetElementAt1_long2, true },
961    { "_Z20rsSetElementAt_long313rs_allocationDv3_lj", (void *)&SC_SetElementAt1_long3, true },
962    { "_Z20rsSetElementAt_long413rs_allocationDv4_lj", (void *)&SC_SetElementAt1_long4, true },
963    { "_Z19rsSetElementAt_long13rs_allocationljj", (void *)&SC_SetElementAt2_long, true },
964    { "_Z20rsSetElementAt_long213rs_allocationDv2_ljj", (void *)&SC_SetElementAt2_long2, true },
965    { "_Z20rsSetElementAt_long313rs_allocationDv3_ljj", (void *)&SC_SetElementAt2_long3, true },
966    { "_Z20rsSetElementAt_long413rs_allocationDv4_ljj", (void *)&SC_SetElementAt2_long4, true },
967    { "_Z19rsSetElementAt_long13rs_allocationljjj", (void *)&SC_SetElementAt3_long, true },
968    { "_Z20rsSetElementAt_long213rs_allocationDv2_ljjj", (void *)&SC_SetElementAt3_long2, true },
969    { "_Z20rsSetElementAt_long313rs_allocationDv3_ljjj", (void *)&SC_SetElementAt3_long3, true },
970    { "_Z20rsSetElementAt_long413rs_allocationDv4_ljjj", (void *)&SC_SetElementAt3_long4, true },
971
972    { "_Z20rsSetElementAt_float13rs_allocationft", (void *)&SC_SetElementAt1_float, true },
973    { "_Z21rsSetElementAt_float213rs_allocationDv2_fj", (void *)&SC_SetElementAt1_float2, true },
974    { "_Z21rsSetElementAt_float313rs_allocationDv3_fj", (void *)&SC_SetElementAt1_float3, true },
975    { "_Z21rsSetElementAt_float413rs_allocationDv4_fj", (void *)&SC_SetElementAt1_float4, true },
976    { "_Z20rsSetElementAt_float13rs_allocationfjj", (void *)&SC_SetElementAt2_float, true },
977    { "_Z21rsSetElementAt_float213rs_allocationDv2_fjj", (void *)&SC_SetElementAt2_float2, true },
978    { "_Z21rsSetElementAt_float313rs_allocationDv3_fjj", (void *)&SC_SetElementAt2_float3, true },
979    { "_Z21rsSetElementAt_float413rs_allocationDv4_fjj", (void *)&SC_SetElementAt2_float4, true },
980    { "_Z20rsSetElementAt_float13rs_allocationfjjj", (void *)&SC_SetElementAt3_float, true },
981    { "_Z21rsSetElementAt_float213rs_allocationDv2_fjjj", (void *)&SC_SetElementAt3_float2, true },
982    { "_Z21rsSetElementAt_float313rs_allocationDv3_fjjj", (void *)&SC_SetElementAt3_float3, true },
983    { "_Z21rsSetElementAt_float413rs_allocationDv4_fjjj", (void *)&SC_SetElementAt3_float4, true },
984
985    { "_Z21rsSetElementAt_double13rs_allocationdt", (void *)&SC_SetElementAt1_double, true },
986    { "_Z22rsSetElementAt_double213rs_allocationDv2_dj", (void *)&SC_SetElementAt1_double2, true },
987    { "_Z22rsSetElementAt_double313rs_allocationDv3_dj", (void *)&SC_SetElementAt1_double3, true },
988    { "_Z22rsSetElementAt_double413rs_allocationDv4_dj", (void *)&SC_SetElementAt1_double4, true },
989    { "_Z21rsSetElementAt_double13rs_allocationdjj", (void *)&SC_SetElementAt2_double, true },
990    { "_Z22rsSetElementAt_double213rs_allocationDv2_djj", (void *)&SC_SetElementAt2_double2, true },
991    { "_Z22rsSetElementAt_double313rs_allocationDv3_djj", (void *)&SC_SetElementAt2_double3, true },
992    { "_Z22rsSetElementAt_double413rs_allocationDv4_djj", (void *)&SC_SetElementAt2_double4, true },
993    { "_Z21rsSetElementAt_double13rs_allocationdjjj", (void *)&SC_SetElementAt3_double, true },
994    { "_Z22rsSetElementAt_double213rs_allocationDv2_djjj", (void *)&SC_SetElementAt3_double2, true },
995    { "_Z22rsSetElementAt_double313rs_allocationDv3_djjj", (void *)&SC_SetElementAt3_double3, true },
996    { "_Z22rsSetElementAt_double413rs_allocationDv4_djjj", (void *)&SC_SetElementAt3_double4, true },
997
998
999    // Refcounting
1000    { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_SetObject, true },
1001    { "_Z13rsClearObjectP10rs_element", (void *)&SC_ClearObject, true },
1002    { "_Z10rsIsObject10rs_element", (void *)&SC_IsObject, true },
1003
1004    { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_SetObject, true },
1005    { "_Z13rsClearObjectP7rs_type", (void *)&SC_ClearObject, true },
1006    { "_Z10rsIsObject7rs_type", (void *)&SC_IsObject, true },
1007
1008    { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_SetObject, true },
1009    { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_ClearObject, true },
1010    { "_Z10rsIsObject13rs_allocation", (void *)&SC_IsObject, true },
1011
1012    { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_SetObject, true },
1013    { "_Z13rsClearObjectP10rs_sampler", (void *)&SC_ClearObject, true },
1014    { "_Z10rsIsObject10rs_sampler", (void *)&SC_IsObject, true },
1015
1016    { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_SetObject, true },
1017    { "_Z13rsClearObjectP9rs_script", (void *)&SC_ClearObject, true },
1018    { "_Z10rsIsObject9rs_script", (void *)&SC_IsObject, true },
1019
1020    { "_Z11rsSetObjectP7rs_pathS_", (void *)&SC_SetObject, true },
1021    { "_Z13rsClearObjectP7rs_path", (void *)&SC_ClearObject, true },
1022    { "_Z10rsIsObject7rs_path", (void *)&SC_IsObject, true },
1023
1024    { "_Z11rsSetObjectP7rs_meshS_", (void *)&SC_SetObject, true },
1025    { "_Z13rsClearObjectP7rs_mesh", (void *)&SC_ClearObject, true },
1026    { "_Z10rsIsObject7rs_mesh", (void *)&SC_IsObject, true },
1027
1028    { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&SC_SetObject, true },
1029    { "_Z13rsClearObjectP19rs_program_fragment", (void *)&SC_ClearObject, true },
1030    { "_Z10rsIsObject19rs_program_fragment", (void *)&SC_IsObject, true },
1031
1032    { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&SC_SetObject, true },
1033    { "_Z13rsClearObjectP17rs_program_vertex", (void *)&SC_ClearObject, true },
1034    { "_Z10rsIsObject17rs_program_vertex", (void *)&SC_IsObject, true },
1035
1036    { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&SC_SetObject, true },
1037    { "_Z13rsClearObjectP17rs_program_raster", (void *)&SC_ClearObject, true },
1038    { "_Z10rsIsObject17rs_program_raster", (void *)&SC_IsObject, true },
1039
1040    { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&SC_SetObject, true },
1041    { "_Z13rsClearObjectP16rs_program_store", (void *)&SC_ClearObject, true },
1042    { "_Z10rsIsObject16rs_program_store", (void *)&SC_IsObject, true },
1043
1044    { "_Z11rsSetObjectP7rs_fontS_", (void *)&SC_SetObject, true },
1045    { "_Z13rsClearObjectP7rs_font", (void *)&SC_ClearObject, true },
1046    { "_Z10rsIsObject7rs_font", (void *)&SC_IsObject, true },
1047
1048    // Allocation ops
1049    { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_AllocationSyncAll, true },
1050    { "_Z20rsgAllocationSyncAll13rs_allocation", (void *)&SC_AllocationSyncAll, false },
1051    { "_Z20rsgAllocationSyncAll13rs_allocationj", (void *)&SC_AllocationSyncAll2, false },
1052    { "_Z20rsgAllocationSyncAll13rs_allocation24rs_allocation_usage_type", (void *)&SC_AllocationSyncAll2, false },
1053    { "_Z15rsGetAllocationPKv", (void *)&SC_GetAllocation, true },
1054#ifndef RS_COMPATIBILITY_LIB
1055    { "_Z18rsAllocationIoSend13rs_allocation", (void *)&SC_AllocationIoSend, false },
1056    { "_Z21rsAllocationIoReceive13rs_allocation", (void *)&SC_AllocationIoReceive, false },
1057#endif
1058    { "_Z23rsAllocationCopy1DRange13rs_allocationjjjS_jj", (void *)&SC_AllocationCopy1DRange, false },
1059    { "_Z23rsAllocationCopy2DRange13rs_allocationjjj26rs_allocation_cubemap_facejjS_jjjS0_", (void *)&SC_AllocationCopy2DRange, false },
1060
1061    // Messaging
1062
1063    { "_Z14rsSendToClienti", (void *)&SC_ToClient, false },
1064    { "_Z14rsSendToClientiPKvj", (void *)&SC_ToClient2, false },
1065    { "_Z22rsSendToClientBlockingi", (void *)&SC_ToClientBlocking, false },
1066    { "_Z22rsSendToClientBlockingiPKvj", (void *)&SC_ToClientBlocking2, false },
1067#ifndef RS_COMPATIBILITY_LIB
1068    { "_Z22rsgBindProgramFragment19rs_program_fragment", (void *)&SC_BindProgramFragment, false },
1069    { "_Z19rsgBindProgramStore16rs_program_store", (void *)&SC_BindProgramStore, false },
1070    { "_Z20rsgBindProgramVertex17rs_program_vertex", (void *)&SC_BindProgramVertex, false },
1071    { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_BindProgramRaster, false },
1072    { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_BindSampler, false },
1073    { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_BindTexture, false },
1074    { "_Z15rsgBindConstant19rs_program_fragmentj13rs_allocation", (void *)&SC_BindFragmentConstant, false },
1075    { "_Z15rsgBindConstant17rs_program_vertexj13rs_allocation", (void *)&SC_BindVertexConstant, false },
1076
1077    { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadProjectionMatrix, false },
1078    { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadModelMatrix, false },
1079    { "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadTextureMatrix, false },
1080
1081    { "_Z35rsgProgramVertexGetProjectionMatrixP12rs_matrix4x4", (void *)&SC_VpGetProjectionMatrix, false },
1082
1083    { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_PfConstantColor, false },
1084
1085    { "_Z11rsgGetWidthv", (void *)&SC_GetWidth, false },
1086    { "_Z12rsgGetHeightv", (void *)&SC_GetHeight, false },
1087
1088
1089    { "_Z11rsgDrawRectfffff", (void *)&SC_DrawRect, false },
1090    { "_Z11rsgDrawQuadffffffffffff", (void *)&SC_DrawQuad, false },
1091    { "_Z20rsgDrawQuadTexCoordsffffffffffffffffffff", (void *)&SC_DrawQuadTexCoords, false },
1092    { "_Z24rsgDrawSpriteScreenspacefffff", (void *)&SC_DrawSpriteScreenspace, false },
1093
1094    { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_DrawMesh, false },
1095    { "_Z11rsgDrawMesh7rs_meshj", (void *)&SC_DrawMeshPrimitive, false },
1096    { "_Z11rsgDrawMesh7rs_meshjjj", (void *)&SC_DrawMeshPrimitiveRange, false },
1097    { "_Z25rsgMeshComputeBoundingBox7rs_meshPfS0_S0_S0_S0_S0_", (void *)&SC_MeshComputeBoundingBox, false },
1098
1099    { "_Z11rsgDrawPath7rs_path", (void *)&SC_DrawPath, false },
1100
1101    { "_Z13rsgClearColorffff", (void *)&SC_ClearColor, false },
1102    { "_Z13rsgClearDepthf", (void *)&SC_ClearDepth, false },
1103
1104    { "_Z11rsgDrawTextPKcii", (void *)&SC_DrawText, false },
1105    { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc, false },
1106    { "_Z14rsgMeasureTextPKcPiS1_S1_S1_", (void *)&SC_MeasureText, false },
1107    { "_Z14rsgMeasureText13rs_allocationPiS0_S0_S0_", (void *)&SC_MeasureTextAlloc, false },
1108
1109    { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont, false },
1110    { "_Z12rsgFontColorffff", (void *)&SC_FontColor, false },
1111
1112    { "_Z18rsgBindColorTarget13rs_allocationj", (void *)&SC_BindFrameBufferObjectColorTarget, false },
1113    { "_Z18rsgBindDepthTarget13rs_allocation", (void *)&SC_BindFrameBufferObjectDepthTarget, false },
1114    { "_Z19rsgClearColorTargetj", (void *)&SC_ClearFrameBufferObjectColorTarget, false },
1115    { "_Z19rsgClearDepthTargetv", (void *)&SC_ClearFrameBufferObjectDepthTarget, false },
1116    { "_Z24rsgClearAllRenderTargetsv", (void *)&SC_ClearFrameBufferObjectTargets, false },
1117#endif // RS_COMPATIBILITY_LIB
1118
1119    { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, true },
1120    { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, true },
1121    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK14rs_script_call", (void *)&SC_ForEach_SAAUS, true },
1122    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, true },
1123    { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK14rs_script_call", (void *)&SC_ForEach_SAAULS, true },
1124
1125    // time
1126    { "_Z6rsTimePi", (void *)&SC_Time, true },
1127    { "_Z11rsLocaltimeP5rs_tmPKi", (void *)&SC_LocalTime, true },
1128    { "_Z14rsUptimeMillisv", (void*)&SC_UptimeMillis, true },
1129    { "_Z13rsUptimeNanosv", (void*)&SC_UptimeNanos, true },
1130    { "_Z7rsGetDtv", (void*)&SC_GetDt, false },
1131
1132    // misc
1133#ifndef RS_COMPATIBILITY_LIB
1134    { "_Z5colorffff", (void *)&SC_Color, false },
1135    { "_Z9rsgFinishv", (void *)&SC_Finish, false },
1136#endif
1137
1138    { NULL, NULL, false }
1139};
1140
1141#ifdef RS_COMPATIBILITY_LIB
1142
1143uint32_t rsSendToClientBlocking(int cmdID) {
1144    Context *rsc = RsdCpuReference::getTlsContext();
1145    return rsrToClientBlocking(rsc, cmdID, NULL, 0);
1146}
1147
1148static void SC_debugF(const char *s, float f) {
1149    ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
1150}
1151static void SC_debugFv2(const char *s, float f1, float f2) {
1152    ALOGD("%s {%f, %f}", s, f1, f2);
1153}
1154static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
1155    ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
1156}
1157static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
1158    ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
1159}
1160static void SC_debugF2(const char *s, float2 f) {
1161    ALOGD("%s {%f, %f}", s, f.x, f.y);
1162}
1163static void SC_debugF3(const char *s, float3 f) {
1164    ALOGD("%s {%f, %f, %f}", s, f.x, f.y, f.z);
1165}
1166static void SC_debugF4(const char *s, float4 f) {
1167    ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w);
1168}
1169static void SC_debugD(const char *s, double d) {
1170    ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
1171}
1172static void SC_debugFM4v4(const char *s, const float *f) {
1173    ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
1174    ALOGD("%s  %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
1175    ALOGD("%s  %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
1176    ALOGD("%s  %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
1177}
1178static void SC_debugFM3v3(const char *s, const float *f) {
1179    ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
1180    ALOGD("%s  %f, %f, %f", s, f[1], f[4], f[7]);
1181    ALOGD("%s  %f, %f, %f}",s, f[2], f[5], f[8]);
1182}
1183static void SC_debugFM2v2(const char *s, const float *f) {
1184    ALOGD("%s {%f, %f", s, f[0], f[2]);
1185    ALOGD("%s  %f, %f}",s, f[1], f[3]);
1186}
1187static void SC_debugI8(const char *s, char c) {
1188    ALOGD("%s %hhd  0x%hhx", s, c, (unsigned char)c);
1189}
1190static void SC_debugC2(const char *s, char2 c) {
1191    ALOGD("%s {%hhd, %hhd}  0x%hhx 0x%hhx", s, c.x, c.y, (unsigned char)c.x, (unsigned char)c.y);
1192}
1193static void SC_debugC3(const char *s, char3 c) {
1194    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);
1195}
1196static void SC_debugC4(const char *s, char4 c) {
1197    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);
1198}
1199static void SC_debugU8(const char *s, unsigned char c) {
1200    ALOGD("%s %hhu  0x%hhx", s, c, c);
1201}
1202static void SC_debugUC2(const char *s, uchar2 c) {
1203    ALOGD("%s {%hhu, %hhu}  0x%hhx 0x%hhx", s, c.x, c.y, c.x, c.y);
1204}
1205static void SC_debugUC3(const char *s, uchar3 c) {
1206    ALOGD("%s {%hhu, %hhu, %hhu}  0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1207}
1208static void SC_debugUC4(const char *s, uchar4 c) {
1209    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);
1210}
1211static void SC_debugI16(const char *s, short c) {
1212    ALOGD("%s %hd  0x%hx", s, c, c);
1213}
1214static void SC_debugS2(const char *s, short2 c) {
1215    ALOGD("%s {%hd, %hd}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1216}
1217static void SC_debugS3(const char *s, short3 c) {
1218    ALOGD("%s {%hd, %hd, %hd}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1219}
1220static void SC_debugS4(const char *s, short4 c) {
1221    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);
1222}
1223static void SC_debugU16(const char *s, unsigned short c) {
1224    ALOGD("%s %hu  0x%hx", s, c, c);
1225}
1226static void SC_debugUS2(const char *s, ushort2 c) {
1227    ALOGD("%s {%hu, %hu}  0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1228}
1229static void SC_debugUS3(const char *s, ushort3 c) {
1230    ALOGD("%s {%hu, %hu, %hu}  0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1231}
1232static void SC_debugUS4(const char *s, ushort4 c) {
1233    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);
1234}
1235static void SC_debugI32(const char *s, int32_t i) {
1236    ALOGD("%s %d  0x%x", s, i, i);
1237}
1238static void SC_debugI2(const char *s, int2 i) {
1239    ALOGD("%s {%d, %d}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1240}
1241static void SC_debugI3(const char *s, int3 i) {
1242    ALOGD("%s {%d, %d, %d}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1243}
1244static void SC_debugI4(const char *s, int4 i) {
1245    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);
1246}
1247static void SC_debugU32(const char *s, uint32_t i) {
1248    ALOGD("%s %u  0x%x", s, i, i);
1249}
1250static void SC_debugUI2(const char *s, uint2 i) {
1251    ALOGD("%s {%u, %u}  0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1252}
1253static void SC_debugUI3(const char *s, uint3 i) {
1254    ALOGD("%s {%u, %u, %u}  0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1255}
1256static void SC_debugUI4(const char *s, uint4 i) {
1257    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);
1258}
1259static void SC_debugLL64(const char *s, long long ll) {
1260    ALOGD("%s %lld  0x%llx", s, ll, ll);
1261}
1262static void SC_debugL2(const char *s, long2 ll) {
1263    ALOGD("%s {%lld, %lld}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1264}
1265static void SC_debugL3(const char *s, long3 ll) {
1266    ALOGD("%s {%lld, %lld, %lld}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1267}
1268static void SC_debugL4(const char *s, long4 ll) {
1269    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);
1270}
1271static void SC_debugULL64(const char *s, unsigned long long ll) {
1272    ALOGD("%s %llu  0x%llx", s, ll, ll);
1273}
1274static void SC_debugUL2(const char *s, ulong2 ll) {
1275    ALOGD("%s {%llu, %llu}  0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1276}
1277static void SC_debugUL3(const char *s, ulong3 ll) {
1278    ALOGD("%s {%llu, %llu, %llu}  0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1279}
1280static void SC_debugUL4(const char *s, ulong4 ll) {
1281    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);
1282}
1283static void SC_debugP(const char *s, const void *p) {
1284    ALOGD("%s %p", s, p);
1285}
1286
1287// TODO: allocation ops, messaging, time
1288
1289void rsDebug(const char *s, float f) {
1290    SC_debugF(s, f);
1291}
1292
1293void rsDebug(const char *s, float f1, float f2) {
1294    SC_debugFv2(s, f1, f2);
1295}
1296
1297void rsDebug(const char *s, float f1, float f2, float f3) {
1298    SC_debugFv3(s, f1, f2, f3);
1299}
1300
1301void rsDebug(const char *s, float f1, float f2, float f3, float f4) {
1302    SC_debugFv4(s, f1, f2, f3, f4);
1303}
1304
1305void rsDebug(const char *s, float2 f) {
1306    SC_debugF2(s, f);
1307}
1308
1309void rsDebug(const char *s, float3 f) {
1310    SC_debugF3(s, f);
1311}
1312
1313void rsDebug(const char *s, float4 f) {
1314    SC_debugF4(s, f);
1315}
1316
1317void rsDebug(const char *s, double d) {
1318    SC_debugD(s, d);
1319}
1320
1321void rsDebug(const char *s, rs_matrix4x4 *m) {
1322    SC_debugFM4v4(s, (float *) m);
1323}
1324
1325void rsDebug(const char *s, rs_matrix3x3 *m) {
1326    SC_debugFM4v4(s, (float *) m);
1327}
1328
1329void rsDebug(const char *s, rs_matrix2x2 *m) {
1330    SC_debugFM4v4(s, (float *) m);
1331}
1332
1333void rsDebug(const char *s, char c) {
1334    SC_debugI8(s, c);
1335}
1336
1337void rsDebug(const char *s, char2 c) {
1338    SC_debugC2(s, c);
1339}
1340
1341void rsDebug(const char *s, char3 c) {
1342    SC_debugC3(s, c);
1343}
1344
1345void rsDebug(const char *s, char4 c) {
1346    SC_debugC4(s, c);
1347}
1348
1349void rsDebug(const char *s, unsigned char c) {
1350    SC_debugU8(s, c);
1351}
1352
1353void rsDebug(const char *s, uchar2 c) {
1354    SC_debugUC2(s, c);
1355}
1356
1357void rsDebug(const char *s, uchar3 c) {
1358    SC_debugUC3(s, c);
1359}
1360
1361void rsDebug(const char *s, uchar4 c) {
1362    SC_debugUC4(s, c);
1363}
1364
1365void rsDebug(const char *s, short c) {
1366    SC_debugI16(s, c);
1367}
1368
1369void rsDebug(const char *s, short2 c) {
1370    SC_debugS2(s, c);
1371}
1372
1373void rsDebug(const char *s, short3 c) {
1374    SC_debugS3(s, c);
1375}
1376
1377void rsDebug(const char *s, short4 c) {
1378    SC_debugS4(s, c);
1379}
1380
1381void rsDebug(const char *s, unsigned short c) {
1382    SC_debugU16(s, c);
1383}
1384
1385void rsDebug(const char *s, ushort2 c) {
1386    SC_debugUS2(s, c);
1387}
1388
1389void rsDebug(const char *s, ushort3 c) {
1390    SC_debugUS3(s, c);
1391}
1392
1393void rsDebug(const char *s, ushort4 c) {
1394    SC_debugUS4(s, c);
1395}
1396
1397void rsDebug(const char *s, int c) {
1398    SC_debugI32(s, c);
1399}
1400
1401void rsDebug(const char *s, int2 c) {
1402    SC_debugI2(s, c);
1403}
1404
1405void rsDebug(const char *s, int3 c) {
1406    SC_debugI3(s, c);
1407}
1408
1409void rsDebug(const char *s, int4 c) {
1410    SC_debugI4(s, c);
1411}
1412
1413void rsDebug(const char *s, unsigned int c) {
1414    SC_debugU32(s, c);
1415}
1416
1417void rsDebug(const char *s, uint2 c) {
1418    SC_debugUI2(s, c);
1419}
1420
1421void rsDebug(const char *s, uint3 c) {
1422    SC_debugUI3(s, c);
1423}
1424
1425void rsDebug(const char *s, uint4 c) {
1426    SC_debugUI4(s, c);
1427}
1428
1429void rsDebug(const char *s, long c) {
1430    SC_debugLL64(s, c);
1431}
1432
1433void rsDebug(const char *s, long long c) {
1434    SC_debugLL64(s, c);
1435}
1436
1437void rsDebug(const char *s, long2 c) {
1438    SC_debugL2(s, c);
1439}
1440
1441void rsDebug(const char *s, long3 c) {
1442    SC_debugL3(s, c);
1443}
1444
1445void rsDebug(const char *s, long4 c) {
1446    SC_debugL4(s, c);
1447}
1448
1449void rsDebug(const char *s, unsigned long c) {
1450    SC_debugULL64(s, c);
1451}
1452
1453void rsDebug(const char *s, unsigned long long c) {
1454    SC_debugULL64(s, c);
1455}
1456
1457void rsDebug(const char *s, ulong2 c) {
1458    SC_debugUL2(s, c);
1459}
1460
1461void rsDebug(const char *s, ulong3 c) {
1462    SC_debugUL3(s, c);
1463}
1464
1465void rsDebug(const char *s, ulong4 c) {
1466    SC_debugUL4(s, c);
1467}
1468
1469void rsDebug(const char *s, const void *p) {
1470    SC_debugP(s, p);
1471}
1472#endif // RS_COMPATIBILITY_LIB
1473
1474extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) {
1475    ScriptC *s = (ScriptC *)pContext;
1476    const RsdCpuReference::CpuSymbol *syms = gSyms;
1477    const RsdCpuReference::CpuSymbol *sym = NULL;
1478
1479    if (!sym) {
1480        while (syms->fnPtr) {
1481            if (!strcmp(syms->name, name)) {
1482                return syms;
1483            }
1484            syms++;
1485        }
1486    }
1487
1488    return NULL;
1489}
1490
1491
1492