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