blob: cb3a5b4d84ed074fd974cd60710f9b0ab6e5768c [file] [log] [blame]
Jason Sams87fe59a2011-04-20 15:09:01 -07001/*
Jason Sams709a0972012-11-15 18:18:04 -08002 * Copyright (C) 2011-2012 The Android Open Source Project
Jason Sams87fe59a2011-04-20 15:09:01 -07003 *
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
Jason Sams87fe59a2011-04-20 15:09:01 -070024#include "rsdCore.h"
Jason Sams807fdc42012-07-25 17:55:39 -070025#include "rsdBcc.h"
Jason Sams87fe59a2011-04-20 15:09:01 -070026
Jason Sams9e0afb52011-10-31 13:23:43 -070027#include "rsdPath.h"
Jason Samsb3220332012-04-02 14:41:54 -070028#include "rsdAllocation.h"
Stephen Hines414a4612012-09-05 18:05:08 -070029#include "rsdShaderCache.h"
30#include "rsdVertexArray.h"
Jason Sams87fe59a2011-04-20 15:09:01 -070031
32#include <time.h>
33
34using namespace android;
35using namespace android::renderscript;
36
Rajeev Sharmaa1dd74c2012-07-09 03:14:47 -070037typedef float float2 __attribute__((ext_vector_type(2)));
38typedef float float3 __attribute__((ext_vector_type(3)));
39typedef float float4 __attribute__((ext_vector_type(4)));
Jason Sams5261a5e2013-02-27 15:46:24 -080040typedef double double2 __attribute__((ext_vector_type(2)));
41typedef double double3 __attribute__((ext_vector_type(3)));
42typedef double double4 __attribute__((ext_vector_type(4)));
Rajeev Sharmaa1dd74c2012-07-09 03:14:47 -070043typedef char char2 __attribute__((ext_vector_type(2)));
44typedef char char3 __attribute__((ext_vector_type(3)));
45typedef char char4 __attribute__((ext_vector_type(4)));
46typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
47typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
48typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
49typedef short short2 __attribute__((ext_vector_type(2)));
50typedef short short3 __attribute__((ext_vector_type(3)));
51typedef short short4 __attribute__((ext_vector_type(4)));
52typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
53typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
54typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
55typedef int32_t int2 __attribute__((ext_vector_type(2)));
56typedef int32_t int3 __attribute__((ext_vector_type(3)));
57typedef int32_t int4 __attribute__((ext_vector_type(4)));
58typedef uint32_t uint2 __attribute__((ext_vector_type(2)));
59typedef uint32_t uint3 __attribute__((ext_vector_type(3)));
60typedef uint32_t uint4 __attribute__((ext_vector_type(4)));
61typedef long long long2 __attribute__((ext_vector_type(2)));
62typedef long long long3 __attribute__((ext_vector_type(3)));
63typedef long long long4 __attribute__((ext_vector_type(4)));
64typedef unsigned long long ulong2 __attribute__((ext_vector_type(2)));
65typedef unsigned long long ulong3 __attribute__((ext_vector_type(3)));
66typedef unsigned long long ulong4 __attribute__((ext_vector_type(4)));
Jason Sams87fe59a2011-04-20 15:09:01 -070067
Jason Sams5261a5e2013-02-27 15:46:24 -080068typedef uint8_t uchar;
69typedef uint16_t ushort;
70typedef uint32_t uint;
Tim Murray0b575de2013-03-15 15:56:43 -070071#ifndef RS_SERVER
Jason Sams5261a5e2013-02-27 15:46:24 -080072typedef uint64_t ulong;
Tim Murray0b575de2013-03-15 15:56:43 -070073#endif
Jason Sams87fe59a2011-04-20 15:09:01 -070074
Tim Murrayd6f1f462013-03-25 16:36:59 -070075#ifdef RS_COMPATIBILITY_LIB
76#define OPAQUETYPE(t) \
77 typedef struct { const int* const p; } __attribute__((packed, aligned(4))) t;
78
79OPAQUETYPE(rs_element)
80OPAQUETYPE(rs_type)
81OPAQUETYPE(rs_allocation)
82OPAQUETYPE(rs_sampler)
83OPAQUETYPE(rs_script)
84OPAQUETYPE(rs_script_call)
85#undef OPAQUETYPE
86
87typedef struct {
88 int tm_sec; ///< seconds
89 int tm_min; ///< minutes
90 int tm_hour; ///< hours
91 int tm_mday; ///< day of the month
92 int tm_mon; ///< month
93 int tm_year; ///< year
94 int tm_wday; ///< day of the week
95 int tm_yday; ///< day of the year
96 int tm_isdst; ///< daylight savings time
97} rs_tm;
98#endif
99
Jason Sams87fe59a2011-04-20 15:09:01 -0700100//////////////////////////////////////////////////////////////////////////////
101// Allocation
102//////////////////////////////////////////////////////////////////////////////
103
Jason Sams87fe59a2011-04-20 15:09:01 -0700104
105static void SC_AllocationSyncAll2(Allocation *a, RsAllocationUsageType source) {
Jason Sams709a0972012-11-15 18:18:04 -0800106 Context *rsc = RsdCpuReference::getTlsContext();
107 rsrAllocationSyncAll(rsc, a, source);
Jason Sams87fe59a2011-04-20 15:09:01 -0700108}
109
110static void SC_AllocationSyncAll(Allocation *a) {
Jason Sams709a0972012-11-15 18:18:04 -0800111 Context *rsc = RsdCpuReference::getTlsContext();
112 rsrAllocationSyncAll(rsc, a, RS_ALLOCATION_USAGE_SCRIPT);
Jason Sams87fe59a2011-04-20 15:09:01 -0700113}
114
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700115static void SC_AllocationCopy1DRange(Allocation *dstAlloc,
116 uint32_t dstOff,
117 uint32_t dstMip,
118 uint32_t count,
119 Allocation *srcAlloc,
120 uint32_t srcOff, uint32_t srcMip) {
Jason Sams709a0972012-11-15 18:18:04 -0800121 Context *rsc = RsdCpuReference::getTlsContext();
Alex Sakhartchouka9495242011-06-16 11:05:13 -0700122 rsrAllocationCopy1DRange(rsc, dstAlloc, dstOff, dstMip, count,
123 srcAlloc, srcOff, srcMip);
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700124}
125
126static void SC_AllocationCopy2DRange(Allocation *dstAlloc,
127 uint32_t dstXoff, uint32_t dstYoff,
128 uint32_t dstMip, uint32_t dstFace,
129 uint32_t width, uint32_t height,
130 Allocation *srcAlloc,
131 uint32_t srcXoff, uint32_t srcYoff,
132 uint32_t srcMip, uint32_t srcFace) {
Jason Sams709a0972012-11-15 18:18:04 -0800133 Context *rsc = RsdCpuReference::getTlsContext();
Alex Sakhartchouka9495242011-06-16 11:05:13 -0700134 rsrAllocationCopy2DRange(rsc, dstAlloc,
135 dstXoff, dstYoff, dstMip, dstFace,
136 width, height,
137 srcAlloc,
138 srcXoff, srcYoff, srcMip, srcFace);
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700139}
140
Jason Sams110f1812013-03-14 16:02:18 -0700141#ifndef RS_COMPATIBILITY_LIB
Jason Samsb3220332012-04-02 14:41:54 -0700142static void SC_AllocationIoSend(Allocation *alloc) {
Jason Sams709a0972012-11-15 18:18:04 -0800143 Context *rsc = RsdCpuReference::getTlsContext();
Jason Samsb3220332012-04-02 14:41:54 -0700144 rsdAllocationIoSend(rsc, alloc);
145}
146
147
148static void SC_AllocationIoReceive(Allocation *alloc) {
Jason Sams709a0972012-11-15 18:18:04 -0800149 Context *rsc = RsdCpuReference::getTlsContext();
Jason Samsb3220332012-04-02 14:41:54 -0700150 rsdAllocationIoReceive(rsc, alloc);
151}
152
153
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700154
Jason Sams87fe59a2011-04-20 15:09:01 -0700155//////////////////////////////////////////////////////////////////////////////
156// Context
157//////////////////////////////////////////////////////////////////////////////
158
159static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) {
Jason Sams709a0972012-11-15 18:18:04 -0800160 Context *rsc = RsdCpuReference::getTlsContext();
161 rsrBindTexture(rsc, pf, slot, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700162}
163
Alex Sakhartchouka720a142012-01-10 10:16:52 -0800164static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) {
Jason Sams709a0972012-11-15 18:18:04 -0800165 Context *rsc = RsdCpuReference::getTlsContext();
166 rsrBindConstant(rsc, pv, slot, a);
Alex Sakhartchouka720a142012-01-10 10:16:52 -0800167}
168
169static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) {
Jason Sams709a0972012-11-15 18:18:04 -0800170 Context *rsc = RsdCpuReference::getTlsContext();
171 rsrBindConstant(rsc, pf, slot, a);
Alex Sakhartchouka720a142012-01-10 10:16:52 -0800172}
173
Jason Sams87fe59a2011-04-20 15:09:01 -0700174static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) {
Jason Sams709a0972012-11-15 18:18:04 -0800175 Context *rsc = RsdCpuReference::getTlsContext();
176 rsrBindSampler(rsc, pf, slot, s);
Jason Sams87fe59a2011-04-20 15:09:01 -0700177}
178
179static void SC_BindProgramStore(ProgramStore *ps) {
Jason Sams709a0972012-11-15 18:18:04 -0800180 Context *rsc = RsdCpuReference::getTlsContext();
181 rsrBindProgramStore(rsc, ps);
Jason Sams87fe59a2011-04-20 15:09:01 -0700182}
183
184static void SC_BindProgramFragment(ProgramFragment *pf) {
Jason Sams709a0972012-11-15 18:18:04 -0800185 Context *rsc = RsdCpuReference::getTlsContext();
186 rsrBindProgramFragment(rsc, pf);
Jason Sams87fe59a2011-04-20 15:09:01 -0700187}
188
189static void SC_BindProgramVertex(ProgramVertex *pv) {
Jason Sams709a0972012-11-15 18:18:04 -0800190 Context *rsc = RsdCpuReference::getTlsContext();
191 rsrBindProgramVertex(rsc, pv);
Jason Sams87fe59a2011-04-20 15:09:01 -0700192}
193
194static void SC_BindProgramRaster(ProgramRaster *pr) {
Jason Sams709a0972012-11-15 18:18:04 -0800195 Context *rsc = RsdCpuReference::getTlsContext();
196 rsrBindProgramRaster(rsc, pr);
Jason Sams87fe59a2011-04-20 15:09:01 -0700197}
198
199static void SC_BindFrameBufferObjectColorTarget(Allocation *a, uint32_t slot) {
Jason Sams709a0972012-11-15 18:18:04 -0800200 Context *rsc = RsdCpuReference::getTlsContext();
201 rsrBindFrameBufferObjectColorTarget(rsc, a, slot);
Jason Sams87fe59a2011-04-20 15:09:01 -0700202}
203
204static void SC_BindFrameBufferObjectDepthTarget(Allocation *a) {
Jason Sams709a0972012-11-15 18:18:04 -0800205 Context *rsc = RsdCpuReference::getTlsContext();
206 rsrBindFrameBufferObjectDepthTarget(rsc, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700207}
208
209static void SC_ClearFrameBufferObjectColorTarget(uint32_t slot) {
Jason Sams709a0972012-11-15 18:18:04 -0800210 Context *rsc = RsdCpuReference::getTlsContext();
211 rsrClearFrameBufferObjectColorTarget(rsc, slot);
Jason Sams87fe59a2011-04-20 15:09:01 -0700212}
213
214static void SC_ClearFrameBufferObjectDepthTarget(Context *, Script *) {
Jason Sams709a0972012-11-15 18:18:04 -0800215 Context *rsc = RsdCpuReference::getTlsContext();
216 rsrClearFrameBufferObjectDepthTarget(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700217}
218
219static void SC_ClearFrameBufferObjectTargets(Context *, Script *) {
Jason Sams709a0972012-11-15 18:18:04 -0800220 Context *rsc = RsdCpuReference::getTlsContext();
221 rsrClearFrameBufferObjectTargets(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700222}
223
224
225//////////////////////////////////////////////////////////////////////////////
226// VP
227//////////////////////////////////////////////////////////////////////////////
228
229static void SC_VpLoadProjectionMatrix(const rsc_Matrix *m) {
Jason Sams709a0972012-11-15 18:18:04 -0800230 Context *rsc = RsdCpuReference::getTlsContext();
231 rsrVpLoadProjectionMatrix(rsc, m);
Jason Sams87fe59a2011-04-20 15:09:01 -0700232}
233
234static void SC_VpLoadModelMatrix(const rsc_Matrix *m) {
Jason Sams709a0972012-11-15 18:18:04 -0800235 Context *rsc = RsdCpuReference::getTlsContext();
236 rsrVpLoadModelMatrix(rsc, m);
Jason Sams87fe59a2011-04-20 15:09:01 -0700237}
238
239static void SC_VpLoadTextureMatrix(const rsc_Matrix *m) {
Jason Sams709a0972012-11-15 18:18:04 -0800240 Context *rsc = RsdCpuReference::getTlsContext();
241 rsrVpLoadTextureMatrix(rsc, m);
Jason Sams87fe59a2011-04-20 15:09:01 -0700242}
243
244static void SC_PfConstantColor(ProgramFragment *pf, float r, float g, float b, float a) {
Jason Sams709a0972012-11-15 18:18:04 -0800245 Context *rsc = RsdCpuReference::getTlsContext();
246 rsrPfConstantColor(rsc, pf, r, g, b, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700247}
248
249static void SC_VpGetProjectionMatrix(rsc_Matrix *m) {
Jason Sams709a0972012-11-15 18:18:04 -0800250 Context *rsc = RsdCpuReference::getTlsContext();
251 rsrVpGetProjectionMatrix(rsc, m);
Jason Sams87fe59a2011-04-20 15:09:01 -0700252}
253
254
255//////////////////////////////////////////////////////////////////////////////
256// Drawing
257//////////////////////////////////////////////////////////////////////////////
258
259static void SC_DrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
260 float x2, float y2, float z2, float u2, float v2,
261 float x3, float y3, float z3, float u3, float v3,
262 float x4, float y4, float z4, float u4, float v4) {
Jason Sams709a0972012-11-15 18:18:04 -0800263 Context *rsc = RsdCpuReference::getTlsContext();
Stephen Hines414a4612012-09-05 18:05:08 -0700264
265 if (!rsc->setupCheck()) {
266 return;
267 }
268
269 RsdHal *dc = (RsdHal *)rsc->mHal.drv;
270 if (!dc->gl.shaderCache->setup(rsc)) {
271 return;
272 }
273
274 //ALOGE("Quad");
275 //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
276 //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
277 //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
278 //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
279
280 float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
281 const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
282
283 RsdVertexArray::Attrib attribs[2];
284 attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position");
285 attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0");
286
287 RsdVertexArray va(attribs, 2);
288 va.setup(rsc);
289
290 RSD_CALL_GL(glDrawArrays, GL_TRIANGLE_FAN, 0, 4);
Jason Sams87fe59a2011-04-20 15:09:01 -0700291}
292
293static void SC_DrawQuad(float x1, float y1, float z1,
294 float x2, float y2, float z2,
295 float x3, float y3, float z3,
296 float x4, float y4, float z4) {
Stephen Hines414a4612012-09-05 18:05:08 -0700297 SC_DrawQuadTexCoords(x1, y1, z1, 0, 1,
298 x2, y2, z2, 1, 1,
299 x3, y3, z3, 1, 0,
300 x4, y4, z4, 0, 0);
Jason Sams87fe59a2011-04-20 15:09:01 -0700301}
302
303static void SC_DrawSpriteScreenspace(float x, float y, float z, float w, float h) {
Jason Sams709a0972012-11-15 18:18:04 -0800304 Context *rsc = RsdCpuReference::getTlsContext();
Stephen Hines414a4612012-09-05 18:05:08 -0700305
306 ObjectBaseRef<const ProgramVertex> tmp(rsc->getProgramVertex());
307 rsc->setProgramVertex(rsc->getDefaultProgramVertex());
308 //rsc->setupCheck();
309
310 //GLint crop[4] = {0, h, w, -h};
311
312 float sh = rsc->getHeight();
313
314 SC_DrawQuad(x, sh - y, z,
315 x+w, sh - y, z,
316 x+w, sh - (y+h), z,
317 x, sh - (y+h), z);
318 rsc->setProgramVertex((ProgramVertex *)tmp.get());
Jason Sams87fe59a2011-04-20 15:09:01 -0700319}
320
321static void SC_DrawRect(float x1, float y1, float x2, float y2, float z) {
Stephen Hines414a4612012-09-05 18:05:08 -0700322 SC_DrawQuad(x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z);
Jason Sams87fe59a2011-04-20 15:09:01 -0700323}
324
Jason Sams9e0afb52011-10-31 13:23:43 -0700325static void SC_DrawPath(Path *p) {
Jason Sams709a0972012-11-15 18:18:04 -0800326 Context *rsc = RsdCpuReference::getTlsContext();
Jason Sams9e0afb52011-10-31 13:23:43 -0700327 rsdPathDraw(rsc, p);
328}
329
Jason Sams87fe59a2011-04-20 15:09:01 -0700330static void SC_DrawMesh(Mesh *m) {
Jason Sams709a0972012-11-15 18:18:04 -0800331 Context *rsc = RsdCpuReference::getTlsContext();
332 rsrDrawMesh(rsc, m);
Jason Sams87fe59a2011-04-20 15:09:01 -0700333}
334
335static void SC_DrawMeshPrimitive(Mesh *m, uint32_t primIndex) {
Jason Sams709a0972012-11-15 18:18:04 -0800336 Context *rsc = RsdCpuReference::getTlsContext();
337 rsrDrawMeshPrimitive(rsc, m, primIndex);
Jason Sams87fe59a2011-04-20 15:09:01 -0700338}
339
340static void SC_DrawMeshPrimitiveRange(Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len) {
Jason Sams709a0972012-11-15 18:18:04 -0800341 Context *rsc = RsdCpuReference::getTlsContext();
342 rsrDrawMeshPrimitiveRange(rsc, m, primIndex, start, len);
Jason Sams87fe59a2011-04-20 15:09:01 -0700343}
344
345static void SC_MeshComputeBoundingBox(Mesh *m,
346 float *minX, float *minY, float *minZ,
347 float *maxX, float *maxY, float *maxZ) {
Jason Sams709a0972012-11-15 18:18:04 -0800348 Context *rsc = RsdCpuReference::getTlsContext();
349 rsrMeshComputeBoundingBox(rsc, m, minX, minY, minZ, maxX, maxY, maxZ);
Jason Sams87fe59a2011-04-20 15:09:01 -0700350}
351
352
353
354//////////////////////////////////////////////////////////////////////////////
355//
356//////////////////////////////////////////////////////////////////////////////
357
358
359static void SC_Color(float r, float g, float b, float a) {
Jason Sams709a0972012-11-15 18:18:04 -0800360 Context *rsc = RsdCpuReference::getTlsContext();
361 rsrColor(rsc, r, g, b, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700362}
363
364static void SC_Finish() {
Jason Sams709a0972012-11-15 18:18:04 -0800365 Context *rsc = RsdCpuReference::getTlsContext();
Alex Sakhartchouk653b53e2012-02-24 14:22:34 -0800366 rsdGLFinish(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700367}
368
369static void SC_ClearColor(float r, float g, float b, float a) {
Jason Sams709a0972012-11-15 18:18:04 -0800370 Context *rsc = RsdCpuReference::getTlsContext();
371 rsrPrepareClear(rsc);
Alex Sakhartchouk653b53e2012-02-24 14:22:34 -0800372 rsdGLClearColor(rsc, r, g, b, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700373}
374
375static void SC_ClearDepth(float v) {
Jason Sams709a0972012-11-15 18:18:04 -0800376 Context *rsc = RsdCpuReference::getTlsContext();
377 rsrPrepareClear(rsc);
Alex Sakhartchouk653b53e2012-02-24 14:22:34 -0800378 rsdGLClearDepth(rsc, v);
Jason Sams87fe59a2011-04-20 15:09:01 -0700379}
380
381static uint32_t SC_GetWidth() {
Jason Sams709a0972012-11-15 18:18:04 -0800382 Context *rsc = RsdCpuReference::getTlsContext();
383 return rsrGetWidth(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700384}
385
386static uint32_t SC_GetHeight() {
Jason Sams709a0972012-11-15 18:18:04 -0800387 Context *rsc = RsdCpuReference::getTlsContext();
388 return rsrGetHeight(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700389}
390
391static void SC_DrawTextAlloc(Allocation *a, int x, int y) {
Jason Sams709a0972012-11-15 18:18:04 -0800392 Context *rsc = RsdCpuReference::getTlsContext();
393 rsrDrawTextAlloc(rsc, a, x, y);
Jason Sams87fe59a2011-04-20 15:09:01 -0700394}
395
396static void SC_DrawText(const char *text, int x, int y) {
Jason Sams709a0972012-11-15 18:18:04 -0800397 Context *rsc = RsdCpuReference::getTlsContext();
398 rsrDrawText(rsc, text, x, y);
Jason Sams87fe59a2011-04-20 15:09:01 -0700399}
400
401static void SC_MeasureTextAlloc(Allocation *a,
402 int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
Jason Sams709a0972012-11-15 18:18:04 -0800403 Context *rsc = RsdCpuReference::getTlsContext();
404 rsrMeasureTextAlloc(rsc, a, left, right, top, bottom);
Jason Sams87fe59a2011-04-20 15:09:01 -0700405}
406
407static void SC_MeasureText(const char *text,
408 int32_t *left, int32_t *right, int32_t *top, int32_t *bottom) {
Jason Sams709a0972012-11-15 18:18:04 -0800409 Context *rsc = RsdCpuReference::getTlsContext();
410 rsrMeasureText(rsc, text, left, right, top, bottom);
Jason Sams87fe59a2011-04-20 15:09:01 -0700411}
412
413static void SC_BindFont(Font *f) {
Jason Sams709a0972012-11-15 18:18:04 -0800414 Context *rsc = RsdCpuReference::getTlsContext();
415 rsrBindFont(rsc, f);
Jason Sams87fe59a2011-04-20 15:09:01 -0700416}
417
418static void SC_FontColor(float r, float g, float b, float a) {
Jason Sams709a0972012-11-15 18:18:04 -0800419 Context *rsc = RsdCpuReference::getTlsContext();
420 rsrFontColor(rsc, r, g, b, a);
Jason Sams87fe59a2011-04-20 15:09:01 -0700421}
Jason Sams110f1812013-03-14 16:02:18 -0700422#endif
Jason Sams87fe59a2011-04-20 15:09:01 -0700423
424
425//////////////////////////////////////////////////////////////////////////////
426//
427//////////////////////////////////////////////////////////////////////////////
428
429static void SC_SetObject(ObjectBase **dst, ObjectBase * src) {
Jason Sams709a0972012-11-15 18:18:04 -0800430 Context *rsc = RsdCpuReference::getTlsContext();
431 rsrSetObject(rsc, dst, src);
Jason Sams87fe59a2011-04-20 15:09:01 -0700432}
433
434static void SC_ClearObject(ObjectBase **dst) {
Jason Sams709a0972012-11-15 18:18:04 -0800435 Context *rsc = RsdCpuReference::getTlsContext();
436 rsrClearObject(rsc, dst);
Jason Sams87fe59a2011-04-20 15:09:01 -0700437}
438
439static bool SC_IsObject(const ObjectBase *src) {
Jason Sams709a0972012-11-15 18:18:04 -0800440 Context *rsc = RsdCpuReference::getTlsContext();
441 return rsrIsObject(rsc, src);
Jason Sams87fe59a2011-04-20 15:09:01 -0700442}
443
444
445
446
447static const Allocation * SC_GetAllocation(const void *ptr) {
Jason Sams709a0972012-11-15 18:18:04 -0800448 Context *rsc = RsdCpuReference::getTlsContext();
449 const Script *sc = RsdCpuReference::getTlsScript();
Jason Sams807fdc42012-07-25 17:55:39 -0700450 return rsdScriptGetAllocationForPointer(rsc, sc, ptr);
Jason Sams87fe59a2011-04-20 15:09:01 -0700451}
452
Jason Samsc500e742011-07-25 12:58:37 -0700453static void SC_ForEach_SAA(Script *target,
454 Allocation *in,
455 Allocation *out) {
Jason Sams709a0972012-11-15 18:18:04 -0800456 Context *rsc = RsdCpuReference::getTlsContext();
457 rsrForEach(rsc, target, in, out, NULL, 0, NULL);
Jason Samsc500e742011-07-25 12:58:37 -0700458}
459
460static void SC_ForEach_SAAU(Script *target,
461 Allocation *in,
462 Allocation *out,
463 const void *usr) {
Jason Sams709a0972012-11-15 18:18:04 -0800464 Context *rsc = RsdCpuReference::getTlsContext();
465 rsrForEach(rsc, target, in, out, usr, 0, NULL);
Jason Sams87fe59a2011-04-20 15:09:01 -0700466}
467
Jason Samsc500e742011-07-25 12:58:37 -0700468static void SC_ForEach_SAAUS(Script *target,
469 Allocation *in,
470 Allocation *out,
471 const void *usr,
472 const RsScriptCall *call) {
Jason Sams709a0972012-11-15 18:18:04 -0800473 Context *rsc = RsdCpuReference::getTlsContext();
474 rsrForEach(rsc, target, in, out, usr, 0, call);
Jason Sams87fe59a2011-04-20 15:09:01 -0700475}
476
Jason Samsc500e742011-07-25 12:58:37 -0700477static void SC_ForEach_SAAUL(Script *target,
478 Allocation *in,
479 Allocation *out,
480 const void *usr,
481 uint32_t usrLen) {
Jason Sams709a0972012-11-15 18:18:04 -0800482 Context *rsc = RsdCpuReference::getTlsContext();
483 rsrForEach(rsc, target, in, out, usr, usrLen, NULL);
Jason Samsc500e742011-07-25 12:58:37 -0700484}
485
486static void SC_ForEach_SAAULS(Script *target,
487 Allocation *in,
488 Allocation *out,
489 const void *usr,
490 uint32_t usrLen,
491 const RsScriptCall *call) {
Jason Sams709a0972012-11-15 18:18:04 -0800492 Context *rsc = RsdCpuReference::getTlsContext();
493 rsrForEach(rsc, target, in, out, usr, usrLen, call);
Jason Samsc500e742011-07-25 12:58:37 -0700494}
495
Jason Sams87fe59a2011-04-20 15:09:01 -0700496
497
498//////////////////////////////////////////////////////////////////////////////
499// Time routines
500//////////////////////////////////////////////////////////////////////////////
501
502static float SC_GetDt() {
Jason Sams709a0972012-11-15 18:18:04 -0800503 Context *rsc = RsdCpuReference::getTlsContext();
504 const Script *sc = RsdCpuReference::getTlsScript();
Jason Sams87fe59a2011-04-20 15:09:01 -0700505 return rsrGetDt(rsc, sc);
506}
507
Tim Murrayd6f1f462013-03-25 16:36:59 -0700508#ifndef RS_COMPATIBILITY_LIB
Jason Sams87fe59a2011-04-20 15:09:01 -0700509time_t SC_Time(time_t *timer) {
Jason Sams709a0972012-11-15 18:18:04 -0800510 Context *rsc = RsdCpuReference::getTlsContext();
511 return rsrTime(rsc, timer);
Jason Sams87fe59a2011-04-20 15:09:01 -0700512}
Tim Murrayd6f1f462013-03-25 16:36:59 -0700513#else
514static int SC_Time(int *timer) {
515 Context *rsc = RsdCpuReference::getTlsContext();
516 return rsrTime(rsc, (long*)timer);
517}
518#endif
Jason Sams87fe59a2011-04-20 15:09:01 -0700519
520tm* SC_LocalTime(tm *local, time_t *timer) {
Jason Sams709a0972012-11-15 18:18:04 -0800521 Context *rsc = RsdCpuReference::getTlsContext();
522 return rsrLocalTime(rsc, local, timer);
Jason Sams87fe59a2011-04-20 15:09:01 -0700523}
524
525int64_t SC_UptimeMillis() {
Jason Sams709a0972012-11-15 18:18:04 -0800526 Context *rsc = RsdCpuReference::getTlsContext();
527 return rsrUptimeMillis(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700528}
529
530int64_t SC_UptimeNanos() {
Jason Sams709a0972012-11-15 18:18:04 -0800531 Context *rsc = RsdCpuReference::getTlsContext();
532 return rsrUptimeNanos(rsc);
Jason Sams87fe59a2011-04-20 15:09:01 -0700533}
534
535//////////////////////////////////////////////////////////////////////////////
536// Message routines
537//////////////////////////////////////////////////////////////////////////////
538
539static uint32_t SC_ToClient2(int cmdID, void *data, int len) {
Jason Sams709a0972012-11-15 18:18:04 -0800540 Context *rsc = RsdCpuReference::getTlsContext();
541 return rsrToClient(rsc, cmdID, data, len);
Jason Sams87fe59a2011-04-20 15:09:01 -0700542}
543
544static uint32_t SC_ToClient(int cmdID) {
Jason Sams709a0972012-11-15 18:18:04 -0800545 Context *rsc = RsdCpuReference::getTlsContext();
546 return rsrToClient(rsc, cmdID, NULL, 0);
Jason Sams87fe59a2011-04-20 15:09:01 -0700547}
548
549static uint32_t SC_ToClientBlocking2(int cmdID, void *data, int len) {
Jason Sams709a0972012-11-15 18:18:04 -0800550 Context *rsc = RsdCpuReference::getTlsContext();
551 return rsrToClientBlocking(rsc, cmdID, data, len);
Jason Sams87fe59a2011-04-20 15:09:01 -0700552}
553
554static uint32_t SC_ToClientBlocking(int cmdID) {
Jason Sams709a0972012-11-15 18:18:04 -0800555 Context *rsc = RsdCpuReference::getTlsContext();
556 return rsrToClientBlocking(rsc, cmdID, NULL, 0);
Jason Sams87fe59a2011-04-20 15:09:01 -0700557}
558
Jason Sams87fe59a2011-04-20 15:09:01 -0700559
Jason Sams5261a5e2013-02-27 15:46:24 -0800560static void * ElementAt1D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x) {
561 Context *rsc = RsdCpuReference::getTlsContext();
562 const Type *t = a->getType();
563 const Element *e = t->getElement();
564
565 char buf[256];
566 if (x >= t->getLODDimX(0)) {
567 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700568 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800569 return NULL;
570 }
571
Jason Samsd09b9d62013-04-02 20:07:04 -0700572 if (vecSize > 0) {
573 if (vecSize != e->getVectorSize()) {
574 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700575 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700576 return NULL;
577 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800578
Jason Samsd09b9d62013-04-02 20:07:04 -0700579 if (dt != e->getType()) {
580 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700581 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700582 return NULL;
583 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800584 }
585
586 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
587 const uint32_t eSize = e->getSizeBytes();
588 return &p[(eSize * x)];
589}
590
591static void * ElementAt2D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y) {
592 Context *rsc = RsdCpuReference::getTlsContext();
593 const Type *t = a->getType();
594 const Element *e = t->getElement();
595
596 char buf[256];
597 if (x >= t->getLODDimX(0)) {
598 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700599 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800600 return NULL;
601 }
602
603 if (y >= t->getLODDimY(0)) {
604 sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700605 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800606 return NULL;
607 }
608
Jason Samsd09b9d62013-04-02 20:07:04 -0700609 if (vecSize > 0) {
610 if (vecSize != e->getVectorSize()) {
611 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700612 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700613 return NULL;
614 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800615
Jason Samsd09b9d62013-04-02 20:07:04 -0700616 if (dt != e->getType()) {
617 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700618 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700619 return NULL;
620 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800621 }
622
623 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
624 const uint32_t eSize = e->getSizeBytes();
625 const uint32_t stride = a->mHal.drvState.lod[0].stride;
626 return &p[(eSize * x) + (y * stride)];
627}
628
629static void * ElementAt3D(Allocation *a, RsDataType dt, uint32_t vecSize, uint32_t x, uint32_t y, uint32_t z) {
630 Context *rsc = RsdCpuReference::getTlsContext();
631 const Type *t = a->getType();
632 const Element *e = t->getElement();
633
634 char buf[256];
635 if (x >= t->getLODDimX(0)) {
636 sprintf(buf, "Out range ElementAt X %i of %i", x, t->getLODDimX(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700637 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800638 return NULL;
639 }
640
641 if (y >= t->getLODDimY(0)) {
642 sprintf(buf, "Out range ElementAt Y %i of %i", y, t->getLODDimY(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700643 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800644 return NULL;
645 }
646
647 if (z >= t->getLODDimZ(0)) {
648 sprintf(buf, "Out range ElementAt Z %i of %i", z, t->getLODDimZ(0));
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700649 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Sams5261a5e2013-02-27 15:46:24 -0800650 return NULL;
651 }
652
Jason Samsd09b9d62013-04-02 20:07:04 -0700653 if (vecSize > 0) {
654 if (vecSize != e->getVectorSize()) {
655 sprintf(buf, "Vector size mismatch for ElementAt %i of %i", vecSize, e->getVectorSize());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700656 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700657 return NULL;
658 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800659
Jason Samsd09b9d62013-04-02 20:07:04 -0700660 if (dt != e->getType()) {
661 sprintf(buf, "Data type mismatch for ElementAt %i of %i", dt, e->getType());
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700662 rsc->setError(RS_ERROR_FATAL_DEBUG, buf);
Jason Samsd09b9d62013-04-02 20:07:04 -0700663 return NULL;
664 }
Jason Sams5261a5e2013-02-27 15:46:24 -0800665 }
666
667 uint8_t *p = (uint8_t *)a->mHal.drvState.lod[0].mallocPtr;
668 const uint32_t eSize = e->getSizeBytes();
669 const uint32_t stride = a->mHal.drvState.lod[0].stride;
670 return &p[(eSize * x) + (y * stride)];
671}
672
Jason Samsd09b9d62013-04-02 20:07:04 -0700673static const void * SC_GetElementAt1D(Allocation *a, uint32_t x) {
674 return ElementAt1D(a, RS_TYPE_UNSIGNED_8, 0, x);
675}
676static const void * SC_GetElementAt2D(Allocation *a, uint32_t x, uint32_t y) {
677 return ElementAt2D(a, RS_TYPE_UNSIGNED_8, 0, x, y);
678}
679static const void * SC_GetElementAt3D(Allocation *a, uint32_t x, uint32_t y, uint32_t z) {
680 return ElementAt3D(a, RS_TYPE_UNSIGNED_8, 0, x, y, z);
681}
682
683static void SC_SetElementAt1D(Allocation *a, const void *ptr, uint32_t x) {
684 const Type *t = a->getType();
685 const Element *e = t->getElement();
686 void *tmp = ElementAt1D(a, RS_TYPE_UNSIGNED_8, 0, x);
687 if (tmp != NULL) {
688 memcpy(tmp, ptr, e->getSizeBytes());
689 }
690}
691static void SC_SetElementAt2D(Allocation *a, const void *ptr, uint32_t x, uint32_t y) {
692 const Type *t = a->getType();
693 const Element *e = t->getElement();
694 void *tmp = ElementAt2D(a, RS_TYPE_UNSIGNED_8, 0, x, y);
695 if (tmp != NULL) {
696 memcpy(tmp, ptr, e->getSizeBytes());
697 }
698}
699static void SC_SetElementAt3D(Allocation *a, const void *ptr, uint32_t x, uint32_t y, uint32_t z) {
700 const Type *t = a->getType();
701 const Element *e = t->getElement();
702 void *tmp = ElementAt3D(a, RS_TYPE_UNSIGNED_8, 0, x, y, z);
703 if (tmp != NULL) {
704 memcpy(tmp, ptr, e->getSizeBytes());
705 }
706}
707
Jason Sams5261a5e2013-02-27 15:46:24 -0800708#define ELEMENT_AT(T, DT, VS) \
Jason Samsd09b9d62013-04-02 20:07:04 -0700709 static void SC_SetElementAt1_##T(Allocation *a, const T *val, uint32_t x) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800710 void *r = ElementAt1D(a, DT, VS, x); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700711 if (r != NULL) ((T *)r)[0] = *val; \
Jason Sams5261a5e2013-02-27 15:46:24 -0800712 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
713 } \
Jason Samsd09b9d62013-04-02 20:07:04 -0700714 static void SC_SetElementAt2_##T(Allocation * a, const T * val, uint32_t x, uint32_t y) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800715 void *r = ElementAt2D(a, DT, VS, x, y); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700716 if (r != NULL) ((T *)r)[0] = *val; \
Jason Sams5261a5e2013-02-27 15:46:24 -0800717 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
718 } \
Jason Samsd09b9d62013-04-02 20:07:04 -0700719 static void SC_SetElementAt3_##T(Allocation * a, const T * val, uint32_t x, uint32_t y, uint32_t z) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800720 void *r = ElementAt3D(a, DT, VS, x, y, z); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700721 if (r != NULL) ((T *)r)[0] = *val; \
Jason Sams5261a5e2013-02-27 15:46:24 -0800722 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
723 } \
Jason Samsd09b9d62013-04-02 20:07:04 -0700724 static void SC_GetElementAt1_##T(Allocation * a, T *val, uint32_t x) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800725 void *r = ElementAt1D(a, DT, VS, x); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700726 if (r != NULL) *val = ((T *)r)[0]; \
727 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
Jason Sams5261a5e2013-02-27 15:46:24 -0800728 } \
Jason Samsd09b9d62013-04-02 20:07:04 -0700729 static void SC_GetElementAt2_##T(Allocation * a, T *val, uint32_t x, uint32_t y) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800730 void *r = ElementAt2D(a, DT, VS, x, y); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700731 if (r != NULL) *val = ((T *)r)[0]; \
732 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
Jason Sams5261a5e2013-02-27 15:46:24 -0800733 } \
Jason Samsd09b9d62013-04-02 20:07:04 -0700734 static void SC_GetElementAt3_##T(Allocation * a, T *val, uint32_t x, uint32_t y, uint32_t z) { \
Jason Sams5261a5e2013-02-27 15:46:24 -0800735 void *r = ElementAt3D(a, DT, VS, x, y, z); \
Jason Samsd09b9d62013-04-02 20:07:04 -0700736 if (r != NULL) *val = ((T *)r)[0]; \
737 else ALOGE("Error from %s", __PRETTY_FUNCTION__); \
Jason Sams5261a5e2013-02-27 15:46:24 -0800738 }
739
740ELEMENT_AT(char, RS_TYPE_SIGNED_8, 1)
741ELEMENT_AT(char2, RS_TYPE_SIGNED_8, 2)
742ELEMENT_AT(char3, RS_TYPE_SIGNED_8, 3)
743ELEMENT_AT(char4, RS_TYPE_SIGNED_8, 4)
744ELEMENT_AT(uchar, RS_TYPE_UNSIGNED_8, 1)
745ELEMENT_AT(uchar2, RS_TYPE_UNSIGNED_8, 2)
746ELEMENT_AT(uchar3, RS_TYPE_UNSIGNED_8, 3)
747ELEMENT_AT(uchar4, RS_TYPE_UNSIGNED_8, 4)
748ELEMENT_AT(short, RS_TYPE_SIGNED_16, 1)
749ELEMENT_AT(short2, RS_TYPE_SIGNED_16, 2)
750ELEMENT_AT(short3, RS_TYPE_SIGNED_16, 3)
751ELEMENT_AT(short4, RS_TYPE_SIGNED_16, 4)
752ELEMENT_AT(ushort, RS_TYPE_UNSIGNED_16, 1)
753ELEMENT_AT(ushort2, RS_TYPE_UNSIGNED_16, 2)
754ELEMENT_AT(ushort3, RS_TYPE_UNSIGNED_16, 3)
755ELEMENT_AT(ushort4, RS_TYPE_UNSIGNED_16, 4)
756ELEMENT_AT(int, RS_TYPE_SIGNED_32, 1)
757ELEMENT_AT(int2, RS_TYPE_SIGNED_32, 2)
758ELEMENT_AT(int3, RS_TYPE_SIGNED_32, 3)
759ELEMENT_AT(int4, RS_TYPE_SIGNED_32, 4)
760ELEMENT_AT(uint, RS_TYPE_UNSIGNED_32, 1)
761ELEMENT_AT(uint2, RS_TYPE_UNSIGNED_32, 2)
762ELEMENT_AT(uint3, RS_TYPE_UNSIGNED_32, 3)
763ELEMENT_AT(uint4, RS_TYPE_UNSIGNED_32, 4)
764ELEMENT_AT(long, RS_TYPE_SIGNED_64, 1)
765ELEMENT_AT(long2, RS_TYPE_SIGNED_64, 2)
766ELEMENT_AT(long3, RS_TYPE_SIGNED_64, 3)
767ELEMENT_AT(long4, RS_TYPE_SIGNED_64, 4)
768ELEMENT_AT(ulong, RS_TYPE_UNSIGNED_64, 1)
769ELEMENT_AT(ulong2, RS_TYPE_UNSIGNED_64, 2)
770ELEMENT_AT(ulong3, RS_TYPE_UNSIGNED_64, 3)
771ELEMENT_AT(ulong4, RS_TYPE_UNSIGNED_64, 4)
772ELEMENT_AT(float, RS_TYPE_FLOAT_32, 1)
773ELEMENT_AT(float2, RS_TYPE_FLOAT_32, 2)
774ELEMENT_AT(float3, RS_TYPE_FLOAT_32, 3)
775ELEMENT_AT(float4, RS_TYPE_FLOAT_32, 4)
776ELEMENT_AT(double, RS_TYPE_FLOAT_64, 1)
777ELEMENT_AT(double2, RS_TYPE_FLOAT_64, 2)
778ELEMENT_AT(double3, RS_TYPE_FLOAT_64, 3)
779ELEMENT_AT(double4, RS_TYPE_FLOAT_64, 4)
780
781#undef ELEMENT_AT
Jason Sams87fe59a2011-04-20 15:09:01 -0700782
783//////////////////////////////////////////////////////////////////////////////
784// Stub implementation
785//////////////////////////////////////////////////////////////////////////////
786
787// llvm name mangling ref
788// <builtin-type> ::= v # void
789// ::= b # bool
790// ::= c # char
791// ::= a # signed char
792// ::= h # unsigned char
793// ::= s # short
794// ::= t # unsigned short
795// ::= i # int
796// ::= j # unsigned int
797// ::= l # long
798// ::= m # unsigned long
799// ::= x # long long, __int64
800// ::= y # unsigned long long, __int64
801// ::= f # float
802// ::= d # double
803
Jason Sams709a0972012-11-15 18:18:04 -0800804static RsdCpuReference::CpuSymbol gSyms[] = {
Jason Sams5261a5e2013-02-27 15:46:24 -0800805 // Debug runtime
Jason Samsd09b9d62013-04-02 20:07:04 -0700806 { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_GetElementAt1D, true },
807 { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_GetElementAt2D, true },
808 { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_GetElementAt3D, true },
809 { "_Z14rsSetElementAt13rs_allocationPKvj", (void *)&SC_SetElementAt1D, true },
810 { "_Z14rsSetElementAt13rs_allocationPKvjj", (void *)&SC_SetElementAt2D, true },
811 { "_Z14rsSetElementAt13rs_allocationPKvjjj", (void *)&SC_SetElementAt3D, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800812
Jason Sams5261a5e2013-02-27 15:46:24 -0800813
Jason Samsd09b9d62013-04-02 20:07:04 -0700814 { "_Z20rsGetElementAt_uchar13rs_allocationPhj", (void *)&SC_GetElementAt1_uchar, true },
815 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hj", (void *)&SC_GetElementAt1_uchar2, true },
816 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hj", (void *)&SC_GetElementAt1_uchar3, true },
817 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hj", (void *)&SC_GetElementAt1_uchar4, true },
818 { "_Z20rsGetElementAt_uchar13rs_allocationPhjj", (void *)&SC_GetElementAt2_uchar, true },
819 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjj", (void *)&SC_GetElementAt2_uchar2, true },
820 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjj", (void *)&SC_GetElementAt2_uchar3, true },
821 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjj", (void *)&SC_GetElementAt2_uchar4, true },
822 { "_Z20rsGetElementAt_uchar13rs_allocationPhjjj", (void *)&SC_GetElementAt3_uchar, true },
823 { "_Z21rsGetElementAt_uchar213rs_allocationPDv2_hjjj", (void *)&SC_GetElementAt3_uchar2, true },
824 { "_Z21rsGetElementAt_uchar313rs_allocationPDv3_hjjj", (void *)&SC_GetElementAt3_uchar3, true },
825 { "_Z21rsGetElementAt_uchar413rs_allocationPDv4_hjjj", (void *)&SC_GetElementAt3_uchar4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800826
Jason Samsd09b9d62013-04-02 20:07:04 -0700827 { "_Z19rsGetElementAt_char13rs_allocationPcj", (void *)&SC_GetElementAt1_char, true },
828 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cj", (void *)&SC_GetElementAt1_char2, true },
829 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cj", (void *)&SC_GetElementAt1_char3, true },
830 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cj", (void *)&SC_GetElementAt1_char4, true },
831 { "_Z19rsGetElementAt_char13rs_allocationPcjj", (void *)&SC_GetElementAt2_char, true },
832 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjj", (void *)&SC_GetElementAt2_char2, true },
833 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjj", (void *)&SC_GetElementAt2_char3, true },
834 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjj", (void *)&SC_GetElementAt2_char4, true },
835 { "_Z19rsGetElementAt_char13rs_allocationPcjjj", (void *)&SC_GetElementAt3_char, true },
836 { "_Z20rsGetElementAt_char213rs_allocationPDv2_cjjj", (void *)&SC_GetElementAt3_char2, true },
837 { "_Z20rsGetElementAt_char313rs_allocationPDv3_cjjj", (void *)&SC_GetElementAt3_char3, true },
838 { "_Z20rsGetElementAt_char413rs_allocationPDv4_cjjj", (void *)&SC_GetElementAt3_char4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800839
Jason Samsd09b9d62013-04-02 20:07:04 -0700840 { "_Z21rsGetElementAt_ushort13rs_allocationPtj", (void *)&SC_GetElementAt1_ushort, true },
841 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tj", (void *)&SC_GetElementAt1_ushort2, true },
842 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tj", (void *)&SC_GetElementAt1_ushort3, true },
843 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tj", (void *)&SC_GetElementAt1_ushort4, true },
844 { "_Z21rsGetElementAt_ushort13rs_allocationPtjj", (void *)&SC_GetElementAt2_ushort, true },
845 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjj", (void *)&SC_GetElementAt2_ushort2, true },
846 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjj", (void *)&SC_GetElementAt2_ushort3, true },
847 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjj", (void *)&SC_GetElementAt2_ushort4, true },
848 { "_Z21rsGetElementAt_ushort13rs_allocationPtjjj", (void *)&SC_GetElementAt3_ushort, true },
849 { "_Z22rsGetElementAt_ushort213rs_allocationPDv2_tjjj", (void *)&SC_GetElementAt3_ushort2, true },
850 { "_Z22rsGetElementAt_ushort313rs_allocationPDv3_tjjj", (void *)&SC_GetElementAt3_ushort3, true },
851 { "_Z22rsGetElementAt_ushort413rs_allocationPDv4_tjjj", (void *)&SC_GetElementAt3_ushort4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800852
Jason Samsd09b9d62013-04-02 20:07:04 -0700853 { "_Z20rsGetElementAt_short13rs_allocationPsj", (void *)&SC_GetElementAt1_short, true },
854 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sj", (void *)&SC_GetElementAt1_short2, true },
855 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sj", (void *)&SC_GetElementAt1_short3, true },
856 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sj", (void *)&SC_GetElementAt1_short4, true },
857 { "_Z20rsGetElementAt_short13rs_allocationPsjj", (void *)&SC_GetElementAt2_short, true },
858 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjj", (void *)&SC_GetElementAt2_short2, true },
859 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjj", (void *)&SC_GetElementAt2_short3, true },
860 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjj", (void *)&SC_GetElementAt2_short4, true },
861 { "_Z20rsGetElementAt_short13rs_allocationPsjjj", (void *)&SC_GetElementAt3_short, true },
862 { "_Z21rsGetElementAt_short213rs_allocationPDv2_sjjj", (void *)&SC_GetElementAt3_short2, true },
863 { "_Z21rsGetElementAt_short313rs_allocationPDv3_sjjj", (void *)&SC_GetElementAt3_short3, true },
864 { "_Z21rsGetElementAt_short413rs_allocationPDv4_sjjj", (void *)&SC_GetElementAt3_short4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800865
Jason Samsd09b9d62013-04-02 20:07:04 -0700866 { "_Z19rsGetElementAt_uint13rs_allocationPjj", (void *)&SC_GetElementAt1_uint, true },
867 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jj", (void *)&SC_GetElementAt1_uint2, true },
868 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jj", (void *)&SC_GetElementAt1_uint3, true },
869 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jj", (void *)&SC_GetElementAt1_uint4, true },
870 { "_Z19rsGetElementAt_uint13rs_allocationPjjj", (void *)&SC_GetElementAt2_uint, true },
871 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjj", (void *)&SC_GetElementAt2_uint2, true },
872 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjj", (void *)&SC_GetElementAt2_uint3, true },
873 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjj", (void *)&SC_GetElementAt2_uint4, true },
874 { "_Z19rsGetElementAt_uint13rs_allocationPjjjj", (void *)&SC_GetElementAt3_uint, true },
875 { "_Z20rsGetElementAt_uint213rs_allocationPDv2_jjjj", (void *)&SC_GetElementAt3_uint2, true },
876 { "_Z20rsGetElementAt_uint313rs_allocationPDv3_jjjj", (void *)&SC_GetElementAt3_uint3, true },
877 { "_Z20rsGetElementAt_uint413rs_allocationPDv4_jjjj", (void *)&SC_GetElementAt3_uint4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800878
Jason Samsd09b9d62013-04-02 20:07:04 -0700879 { "_Z18rsGetElementAt_int13rs_allocationPij", (void *)&SC_GetElementAt1_int, true },
880 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ij", (void *)&SC_GetElementAt1_int2, true },
881 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ij", (void *)&SC_GetElementAt1_int3, true },
882 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ij", (void *)&SC_GetElementAt1_int4, true },
883 { "_Z18rsGetElementAt_int13rs_allocationPijj", (void *)&SC_GetElementAt2_int, true },
884 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijj", (void *)&SC_GetElementAt2_int2, true },
885 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijj", (void *)&SC_GetElementAt2_int3, true },
886 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijj", (void *)&SC_GetElementAt2_int4, true },
887 { "_Z18rsGetElementAt_int13rs_allocationPijjj", (void *)&SC_GetElementAt3_int, true },
888 { "_Z19rsGetElementAt_int213rs_allocationPDv2_ijjj", (void *)&SC_GetElementAt3_int2, true },
889 { "_Z19rsGetElementAt_int313rs_allocationPDv3_ijjj", (void *)&SC_GetElementAt3_int3, true },
890 { "_Z19rsGetElementAt_int413rs_allocationPDv4_ijjj", (void *)&SC_GetElementAt3_int4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800891
Jason Samsd09b9d62013-04-02 20:07:04 -0700892 { "_Z20rsGetElementAt_ulong13rs_allocationPmj", (void *)&SC_GetElementAt1_ulong, true },
893 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mj", (void *)&SC_GetElementAt1_ulong2, true },
894 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mj", (void *)&SC_GetElementAt1_ulong3, true },
895 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mj", (void *)&SC_GetElementAt1_ulong4, true },
896 { "_Z20rsGetElementAt_ulong13rs_allocationPmjj", (void *)&SC_GetElementAt2_ulong, true },
897 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjj", (void *)&SC_GetElementAt2_ulong2, true },
898 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjj", (void *)&SC_GetElementAt2_ulong3, true },
899 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjj", (void *)&SC_GetElementAt2_ulong4, true },
900 { "_Z20rsGetElementAt_ulong13rs_allocationPmjjj", (void *)&SC_GetElementAt3_ulong, true },
901 { "_Z21rsGetElementAt_ulong213rs_allocationPDv2_mjjj", (void *)&SC_GetElementAt3_ulong2, true },
902 { "_Z21rsGetElementAt_ulong313rs_allocationPDv3_mjjj", (void *)&SC_GetElementAt3_ulong3, true },
903 { "_Z21rsGetElementAt_ulong413rs_allocationPDv4_mjjj", (void *)&SC_GetElementAt3_ulong4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800904
Jason Samsd09b9d62013-04-02 20:07:04 -0700905 { "_Z19rsGetElementAt_long13rs_allocationPlj", (void *)&SC_GetElementAt1_long, true },
906 { "_Z20rsGetElementAt_long213rs_allocationPDv2_lj", (void *)&SC_GetElementAt1_long2, true },
907 { "_Z20rsGetElementAt_long313rs_allocationPDv3_lj", (void *)&SC_GetElementAt1_long3, true },
908 { "_Z20rsGetElementAt_long413rs_allocationPDv4_lj", (void *)&SC_GetElementAt1_long4, true },
909 { "_Z19rsGetElementAt_long13rs_allocationPljj", (void *)&SC_GetElementAt2_long, true },
910 { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljj", (void *)&SC_GetElementAt2_long2, true },
911 { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljj", (void *)&SC_GetElementAt2_long3, true },
912 { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljj", (void *)&SC_GetElementAt2_long4, true },
913 { "_Z19rsGetElementAt_long13rs_allocationPljjj", (void *)&SC_GetElementAt3_long, true },
914 { "_Z20rsGetElementAt_long213rs_allocationPDv2_ljjj", (void *)&SC_GetElementAt3_long2, true },
915 { "_Z20rsGetElementAt_long313rs_allocationPDv3_ljjj", (void *)&SC_GetElementAt3_long3, true },
916 { "_Z20rsGetElementAt_long413rs_allocationPDv4_ljjj", (void *)&SC_GetElementAt3_long4, true },
917
918 { "_Z20rsGetElementAt_float13rs_allocationPfj", (void *)&SC_GetElementAt1_float, true },
919 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fj", (void *)&SC_GetElementAt1_float2, true },
920 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fj", (void *)&SC_GetElementAt1_float3, true },
921 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fj", (void *)&SC_GetElementAt1_float4, true },
922 { "_Z20rsGetElementAt_float13rs_allocationPfjj", (void *)&SC_GetElementAt2_float, true },
923 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjj", (void *)&SC_GetElementAt2_float2, true },
924 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjj", (void *)&SC_GetElementAt2_float3, true },
925 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjj", (void *)&SC_GetElementAt2_float4, true },
926 { "_Z20rsGetElementAt_float13rs_allocationPfjjj", (void *)&SC_GetElementAt3_float, true },
927 { "_Z21rsGetElementAt_float213rs_allocationPDv2_fjjj", (void *)&SC_GetElementAt3_float2, true },
928 { "_Z21rsGetElementAt_float313rs_allocationPDv3_fjjj", (void *)&SC_GetElementAt3_float3, true },
929 { "_Z21rsGetElementAt_float413rs_allocationPDv4_fjjj", (void *)&SC_GetElementAt3_float4, true },
930
931 { "_Z21rsGetElementAt_double13rs_allocationPdj", (void *)&SC_GetElementAt1_double, true },
932 { "_Z22rsGetElementAt_double213rs_allocationPDv2_dj", (void *)&SC_GetElementAt1_double2, true },
933 { "_Z22rsGetElementAt_double313rs_allocationPDv3_dj", (void *)&SC_GetElementAt1_double3, true },
934 { "_Z22rsGetElementAt_double413rs_allocationPDv4_dj", (void *)&SC_GetElementAt1_double4, true },
935 { "_Z21rsGetElementAt_double13rs_allocationPdjj", (void *)&SC_GetElementAt2_double, true },
936 { "_Z22rsGetElementAt_double213rs_allocationPDv2_djj", (void *)&SC_GetElementAt2_double2, true },
937 { "_Z22rsGetElementAt_double313rs_allocationPDv3_djj", (void *)&SC_GetElementAt2_double3, true },
938 { "_Z22rsGetElementAt_double413rs_allocationPDv4_djj", (void *)&SC_GetElementAt2_double4, true },
939 { "_Z21rsGetElementAt_double13rs_allocationPdjjj", (void *)&SC_GetElementAt3_double, true },
940 { "_Z22rsGetElementAt_double213rs_allocationPDv2_djjj", (void *)&SC_GetElementAt3_double2, true },
941 { "_Z22rsGetElementAt_double313rs_allocationPDv3_djjj", (void *)&SC_GetElementAt3_double3, true },
942 { "_Z22rsGetElementAt_double413rs_allocationPDv4_djjj", (void *)&SC_GetElementAt3_double4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800943
944
945
Jason Samsd09b9d62013-04-02 20:07:04 -0700946 { "_Z20rsSetElementAt_uchar13rs_allocationPKhj", (void *)&SC_SetElementAt1_uchar, true },
947 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hj", (void *)&SC_SetElementAt1_uchar2, true },
948 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hj", (void *)&SC_SetElementAt1_uchar3, true },
949 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hj", (void *)&SC_SetElementAt1_uchar4, true },
950 { "_Z20rsSetElementAt_uchar13rs_allocationPKhjj", (void *)&SC_SetElementAt2_uchar, true },
951 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjj", (void *)&SC_SetElementAt2_uchar2, true },
952 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjj", (void *)&SC_SetElementAt2_uchar3, true },
953 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjj", (void *)&SC_SetElementAt2_uchar4, true },
954 { "_Z20rsSetElementAt_uchar13rs_allocationPKhjjj", (void *)&SC_SetElementAt3_uchar, true },
955 { "_Z21rsSetElementAt_uchar213rs_allocationPKDv2_hjjj", (void *)&SC_SetElementAt3_uchar2, true },
956 { "_Z21rsSetElementAt_uchar313rs_allocationPKDv3_hjjj", (void *)&SC_SetElementAt3_uchar3, true },
957 { "_Z21rsSetElementAt_uchar413rs_allocationPKDv4_hjjj", (void *)&SC_SetElementAt3_uchar4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800958
Jason Samsd09b9d62013-04-02 20:07:04 -0700959 { "_Z19rsSetElementAt_char13rs_allocationPKcj", (void *)&SC_SetElementAt1_char, true },
960 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cj", (void *)&SC_SetElementAt1_char2, true },
961 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cj", (void *)&SC_SetElementAt1_char3, true },
962 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cj", (void *)&SC_SetElementAt1_char4, true },
963 { "_Z19rsSetElementAt_char13rs_allocationPKcjj", (void *)&SC_SetElementAt2_char, true },
964 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjj", (void *)&SC_SetElementAt2_char2, true },
965 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjj", (void *)&SC_SetElementAt2_char3, true },
966 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjj", (void *)&SC_SetElementAt2_char4, true },
967 { "_Z19rsSetElementAt_char13rs_allocationPKcjjj", (void *)&SC_SetElementAt3_char, true },
968 { "_Z20rsSetElementAt_char213rs_allocationPKDv2_cjjj", (void *)&SC_SetElementAt3_char2, true },
969 { "_Z20rsSetElementAt_char313rs_allocationPKDv3_cjjj", (void *)&SC_SetElementAt3_char3, true },
970 { "_Z20rsSetElementAt_char413rs_allocationPKDv4_cjjj", (void *)&SC_SetElementAt3_char4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800971
Jason Samsd09b9d62013-04-02 20:07:04 -0700972 { "_Z21rsSetElementAt_ushort13rs_allocationPKht", (void *)&SC_SetElementAt1_ushort, true },
973 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tj", (void *)&SC_SetElementAt1_ushort2, true },
974 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tj", (void *)&SC_SetElementAt1_ushort3, true },
975 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tj", (void *)&SC_SetElementAt1_ushort4, true },
976 { "_Z21rsSetElementAt_ushort13rs_allocationPKtjj", (void *)&SC_SetElementAt2_ushort, true },
977 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjj", (void *)&SC_SetElementAt2_ushort2, true },
978 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjj", (void *)&SC_SetElementAt2_ushort3, true },
979 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjj", (void *)&SC_SetElementAt2_ushort4, true },
980 { "_Z21rsSetElementAt_ushort13rs_allocationPKtjjj", (void *)&SC_SetElementAt3_ushort, true },
981 { "_Z22rsSetElementAt_ushort213rs_allocationPKDv2_tjjj", (void *)&SC_SetElementAt3_ushort2, true },
982 { "_Z22rsSetElementAt_ushort313rs_allocationPKDv3_tjjj", (void *)&SC_SetElementAt3_ushort3, true },
983 { "_Z22rsSetElementAt_ushort413rs_allocationPKDv4_tjjj", (void *)&SC_SetElementAt3_ushort4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800984
Jason Samsd09b9d62013-04-02 20:07:04 -0700985 { "_Z20rsSetElementAt_short13rs_allocationPKsj", (void *)&SC_SetElementAt1_short, true },
986 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sj", (void *)&SC_SetElementAt1_short2, true },
987 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sj", (void *)&SC_SetElementAt1_short3, true },
988 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sj", (void *)&SC_SetElementAt1_short4, true },
989 { "_Z20rsSetElementAt_short13rs_allocationPKsjj", (void *)&SC_SetElementAt2_short, true },
990 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjj", (void *)&SC_SetElementAt2_short2, true },
991 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjj", (void *)&SC_SetElementAt2_short3, true },
992 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjj", (void *)&SC_SetElementAt2_short4, true },
993 { "_Z20rsSetElementAt_short13rs_allocationPKsjjj", (void *)&SC_SetElementAt3_short, true },
994 { "_Z21rsSetElementAt_short213rs_allocationPKDv2_sjjj", (void *)&SC_SetElementAt3_short2, true },
995 { "_Z21rsSetElementAt_short313rs_allocationPKDv3_sjjj", (void *)&SC_SetElementAt3_short3, true },
996 { "_Z21rsSetElementAt_short413rs_allocationPKDv4_sjjj", (void *)&SC_SetElementAt3_short4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -0800997
Jason Samsd09b9d62013-04-02 20:07:04 -0700998 { "_Z19rsSetElementAt_uint13rs_allocationPKjj", (void *)&SC_SetElementAt1_uint, true },
999 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jj", (void *)&SC_SetElementAt1_uint2, true },
1000 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jj", (void *)&SC_SetElementAt1_uint3, true },
1001 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jj", (void *)&SC_SetElementAt1_uint4, true },
1002 { "_Z19rsSetElementAt_uint13rs_allocationPKjjj", (void *)&SC_SetElementAt2_uint, true },
1003 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjj", (void *)&SC_SetElementAt2_uint2, true },
1004 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjj", (void *)&SC_SetElementAt2_uint3, true },
1005 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjj", (void *)&SC_SetElementAt2_uint4, true },
1006 { "_Z19rsSetElementAt_uint13rs_allocationPKjjjj", (void *)&SC_SetElementAt3_uint, true },
1007 { "_Z20rsSetElementAt_uint213rs_allocationPKDv2_jjjj", (void *)&SC_SetElementAt3_uint2, true },
1008 { "_Z20rsSetElementAt_uint313rs_allocationPKDv3_jjjj", (void *)&SC_SetElementAt3_uint3, true },
1009 { "_Z20rsSetElementAt_uint413rs_allocationPKDv4_jjjj", (void *)&SC_SetElementAt3_uint4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001010
Stephen Hinescca3d6c2013-04-15 01:06:39 -07001011 { "_Z18rsSetElementAt_int13rs_allocationPKij", (void *)&SC_SetElementAt1_int, true },
Jason Samsd09b9d62013-04-02 20:07:04 -07001012 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ij", (void *)&SC_SetElementAt1_int2, true },
1013 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ij", (void *)&SC_SetElementAt1_int3, true },
1014 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ij", (void *)&SC_SetElementAt1_int4, true },
1015 { "_Z18rsSetElementAt_int13rs_allocationPKijj", (void *)&SC_SetElementAt2_int, true },
1016 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijj", (void *)&SC_SetElementAt2_int2, true },
1017 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijj", (void *)&SC_SetElementAt2_int3, true },
1018 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijj", (void *)&SC_SetElementAt2_int4, true },
1019 { "_Z18rsSetElementAt_int13rs_allocationPKijjj", (void *)&SC_SetElementAt3_int, true },
1020 { "_Z19rsSetElementAt_int213rs_allocationPKDv2_ijjj", (void *)&SC_SetElementAt3_int2, true },
1021 { "_Z19rsSetElementAt_int313rs_allocationPKDv3_ijjj", (void *)&SC_SetElementAt3_int3, true },
1022 { "_Z19rsSetElementAt_int413rs_allocationPKDv4_ijjj", (void *)&SC_SetElementAt3_int4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001023
Jason Samsd09b9d62013-04-02 20:07:04 -07001024 { "_Z20rsSetElementAt_ulong13rs_allocationPKmt", (void *)&SC_SetElementAt1_ulong, true },
1025 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mj", (void *)&SC_SetElementAt1_ulong2, true },
1026 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mj", (void *)&SC_SetElementAt1_ulong3, true },
1027 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mj", (void *)&SC_SetElementAt1_ulong4, true },
1028 { "_Z20rsSetElementAt_ulong13rs_allocationPKmjj", (void *)&SC_SetElementAt2_ulong, true },
1029 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjj", (void *)&SC_SetElementAt2_ulong2, true },
1030 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjj", (void *)&SC_SetElementAt2_ulong3, true },
1031 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjj", (void *)&SC_SetElementAt2_ulong4, true },
1032 { "_Z20rsSetElementAt_ulong13rs_allocationPKmjjj", (void *)&SC_SetElementAt3_ulong, true },
1033 { "_Z21rsSetElementAt_ulong213rs_allocationPKDv2_mjjj", (void *)&SC_SetElementAt3_ulong2, true },
1034 { "_Z21rsSetElementAt_ulong313rs_allocationPKDv3_mjjj", (void *)&SC_SetElementAt3_ulong3, true },
1035 { "_Z21rsSetElementAt_ulong413rs_allocationPKDv4_mjjj", (void *)&SC_SetElementAt3_ulong4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001036
Jason Samsd09b9d62013-04-02 20:07:04 -07001037 { "_Z19rsSetElementAt_long13rs_allocationPKlj", (void *)&SC_SetElementAt1_long, true },
1038 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_lj", (void *)&SC_SetElementAt1_long2, true },
1039 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_lj", (void *)&SC_SetElementAt1_long3, true },
1040 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_lj", (void *)&SC_SetElementAt1_long4, true },
1041 { "_Z19rsSetElementAt_long13rs_allocationPKljj", (void *)&SC_SetElementAt2_long, true },
1042 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljj", (void *)&SC_SetElementAt2_long2, true },
1043 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljj", (void *)&SC_SetElementAt2_long3, true },
1044 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljj", (void *)&SC_SetElementAt2_long4, true },
1045 { "_Z19rsSetElementAt_long13rs_allocationPKljjj", (void *)&SC_SetElementAt3_long, true },
1046 { "_Z20rsSetElementAt_long213rs_allocationPKDv2_ljjj", (void *)&SC_SetElementAt3_long2, true },
1047 { "_Z20rsSetElementAt_long313rs_allocationPKDv3_ljjj", (void *)&SC_SetElementAt3_long3, true },
1048 { "_Z20rsSetElementAt_long413rs_allocationPKDv4_ljjj", (void *)&SC_SetElementAt3_long4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001049
Jason Samsd09b9d62013-04-02 20:07:04 -07001050 { "_Z20rsSetElementAt_float13rs_allocationPKft", (void *)&SC_SetElementAt1_float, true },
1051 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fj", (void *)&SC_SetElementAt1_float2, true },
1052 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fj", (void *)&SC_SetElementAt1_float3, true },
1053 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fj", (void *)&SC_SetElementAt1_float4, true },
1054 { "_Z20rsSetElementAt_float13rs_allocationPKfjj", (void *)&SC_SetElementAt2_float, true },
1055 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjj", (void *)&SC_SetElementAt2_float2, true },
1056 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjj", (void *)&SC_SetElementAt2_float3, true },
1057 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjj", (void *)&SC_SetElementAt2_float4, true },
1058 { "_Z20rsSetElementAt_float13rs_allocationPKfjjj", (void *)&SC_SetElementAt3_float, true },
1059 { "_Z21rsSetElementAt_float213rs_allocationPKDv2_fjjj", (void *)&SC_SetElementAt3_float2, true },
1060 { "_Z21rsSetElementAt_float313rs_allocationPKDv3_fjjj", (void *)&SC_SetElementAt3_float3, true },
1061 { "_Z21rsSetElementAt_float413rs_allocationPKDv4_fjjj", (void *)&SC_SetElementAt3_float4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001062
Jason Samsd09b9d62013-04-02 20:07:04 -07001063 { "_Z21rsSetElementAt_double13rs_allocationPKdt", (void *)&SC_SetElementAt1_double, true },
1064 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_dj", (void *)&SC_SetElementAt1_double2, true },
1065 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_dj", (void *)&SC_SetElementAt1_double3, true },
1066 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_dj", (void *)&SC_SetElementAt1_double4, true },
1067 { "_Z21rsSetElementAt_double13rs_allocationPKdjj", (void *)&SC_SetElementAt2_double, true },
1068 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djj", (void *)&SC_SetElementAt2_double2, true },
1069 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djj", (void *)&SC_SetElementAt2_double3, true },
1070 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djj", (void *)&SC_SetElementAt2_double4, true },
1071 { "_Z21rsSetElementAt_double13rs_allocationPKdjjj", (void *)&SC_SetElementAt3_double, true },
1072 { "_Z22rsSetElementAt_double213rs_allocationPKDv2_djjj", (void *)&SC_SetElementAt3_double2, true },
1073 { "_Z22rsSetElementAt_double313rs_allocationPKDv3_djjj", (void *)&SC_SetElementAt3_double3, true },
1074 { "_Z22rsSetElementAt_double413rs_allocationPKDv4_djjj", (void *)&SC_SetElementAt3_double4, true },
Jason Sams5261a5e2013-02-27 15:46:24 -08001075
1076
Jason Sams87fe59a2011-04-20 15:09:01 -07001077 // Refcounting
1078 { "_Z11rsSetObjectP10rs_elementS_", (void *)&SC_SetObject, true },
1079 { "_Z13rsClearObjectP10rs_element", (void *)&SC_ClearObject, true },
1080 { "_Z10rsIsObject10rs_element", (void *)&SC_IsObject, true },
1081
1082 { "_Z11rsSetObjectP7rs_typeS_", (void *)&SC_SetObject, true },
1083 { "_Z13rsClearObjectP7rs_type", (void *)&SC_ClearObject, true },
1084 { "_Z10rsIsObject7rs_type", (void *)&SC_IsObject, true },
1085
1086 { "_Z11rsSetObjectP13rs_allocationS_", (void *)&SC_SetObject, true },
1087 { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_ClearObject, true },
1088 { "_Z10rsIsObject13rs_allocation", (void *)&SC_IsObject, true },
1089
1090 { "_Z11rsSetObjectP10rs_samplerS_", (void *)&SC_SetObject, true },
1091 { "_Z13rsClearObjectP10rs_sampler", (void *)&SC_ClearObject, true },
1092 { "_Z10rsIsObject10rs_sampler", (void *)&SC_IsObject, true },
1093
1094 { "_Z11rsSetObjectP9rs_scriptS_", (void *)&SC_SetObject, true },
1095 { "_Z13rsClearObjectP9rs_script", (void *)&SC_ClearObject, true },
1096 { "_Z10rsIsObject9rs_script", (void *)&SC_IsObject, true },
1097
Jason Sams9e0afb52011-10-31 13:23:43 -07001098 { "_Z11rsSetObjectP7rs_pathS_", (void *)&SC_SetObject, true },
1099 { "_Z13rsClearObjectP7rs_path", (void *)&SC_ClearObject, true },
1100 { "_Z10rsIsObject7rs_path", (void *)&SC_IsObject, true },
1101
Jason Sams87fe59a2011-04-20 15:09:01 -07001102 { "_Z11rsSetObjectP7rs_meshS_", (void *)&SC_SetObject, true },
1103 { "_Z13rsClearObjectP7rs_mesh", (void *)&SC_ClearObject, true },
1104 { "_Z10rsIsObject7rs_mesh", (void *)&SC_IsObject, true },
1105
1106 { "_Z11rsSetObjectP19rs_program_fragmentS_", (void *)&SC_SetObject, true },
1107 { "_Z13rsClearObjectP19rs_program_fragment", (void *)&SC_ClearObject, true },
1108 { "_Z10rsIsObject19rs_program_fragment", (void *)&SC_IsObject, true },
1109
1110 { "_Z11rsSetObjectP17rs_program_vertexS_", (void *)&SC_SetObject, true },
1111 { "_Z13rsClearObjectP17rs_program_vertex", (void *)&SC_ClearObject, true },
1112 { "_Z10rsIsObject17rs_program_vertex", (void *)&SC_IsObject, true },
1113
1114 { "_Z11rsSetObjectP17rs_program_rasterS_", (void *)&SC_SetObject, true },
1115 { "_Z13rsClearObjectP17rs_program_raster", (void *)&SC_ClearObject, true },
1116 { "_Z10rsIsObject17rs_program_raster", (void *)&SC_IsObject, true },
1117
1118 { "_Z11rsSetObjectP16rs_program_storeS_", (void *)&SC_SetObject, true },
1119 { "_Z13rsClearObjectP16rs_program_store", (void *)&SC_ClearObject, true },
1120 { "_Z10rsIsObject16rs_program_store", (void *)&SC_IsObject, true },
1121
1122 { "_Z11rsSetObjectP7rs_fontS_", (void *)&SC_SetObject, true },
1123 { "_Z13rsClearObjectP7rs_font", (void *)&SC_ClearObject, true },
1124 { "_Z10rsIsObject7rs_font", (void *)&SC_IsObject, true },
1125
1126 // Allocation ops
Jason Sams87fe59a2011-04-20 15:09:01 -07001127 { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_AllocationSyncAll, true },
1128 { "_Z20rsgAllocationSyncAll13rs_allocation", (void *)&SC_AllocationSyncAll, false },
1129 { "_Z20rsgAllocationSyncAll13rs_allocationj", (void *)&SC_AllocationSyncAll2, false },
Alex Sakhartchouk74a82792011-06-14 11:13:19 -07001130 { "_Z20rsgAllocationSyncAll13rs_allocation24rs_allocation_usage_type", (void *)&SC_AllocationSyncAll2, false },
Jason Sams87fe59a2011-04-20 15:09:01 -07001131 { "_Z15rsGetAllocationPKv", (void *)&SC_GetAllocation, true },
Tim Murray0b575de2013-03-15 15:56:43 -07001132#ifndef RS_COMPATIBILITY_LIB
Jason Samsb3220332012-04-02 14:41:54 -07001133 { "_Z18rsAllocationIoSend13rs_allocation", (void *)&SC_AllocationIoSend, false },
1134 { "_Z21rsAllocationIoReceive13rs_allocation", (void *)&SC_AllocationIoReceive, false },
Tim Murray0b575de2013-03-15 15:56:43 -07001135#endif
Alex Sakhartchouk74a82792011-06-14 11:13:19 -07001136 { "_Z23rsAllocationCopy1DRange13rs_allocationjjjS_jj", (void *)&SC_AllocationCopy1DRange, false },
1137 { "_Z23rsAllocationCopy2DRange13rs_allocationjjj26rs_allocation_cubemap_facejjS_jjjS0_", (void *)&SC_AllocationCopy2DRange, false },
Jason Sams87fe59a2011-04-20 15:09:01 -07001138
1139 // Messaging
1140
1141 { "_Z14rsSendToClienti", (void *)&SC_ToClient, false },
1142 { "_Z14rsSendToClientiPKvj", (void *)&SC_ToClient2, false },
1143 { "_Z22rsSendToClientBlockingi", (void *)&SC_ToClientBlocking, false },
1144 { "_Z22rsSendToClientBlockingiPKvj", (void *)&SC_ToClientBlocking2, false },
Tim Murray0b575de2013-03-15 15:56:43 -07001145#ifndef RS_COMPATIBILITY_LIB
Jason Sams87fe59a2011-04-20 15:09:01 -07001146 { "_Z22rsgBindProgramFragment19rs_program_fragment", (void *)&SC_BindProgramFragment, false },
1147 { "_Z19rsgBindProgramStore16rs_program_store", (void *)&SC_BindProgramStore, false },
1148 { "_Z20rsgBindProgramVertex17rs_program_vertex", (void *)&SC_BindProgramVertex, false },
1149 { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_BindProgramRaster, false },
1150 { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_BindSampler, false },
1151 { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_BindTexture, false },
Alex Sakhartchouka720a142012-01-10 10:16:52 -08001152 { "_Z15rsgBindConstant19rs_program_fragmentj13rs_allocation", (void *)&SC_BindFragmentConstant, false },
1153 { "_Z15rsgBindConstant17rs_program_vertexj13rs_allocation", (void *)&SC_BindVertexConstant, false },
Jason Sams87fe59a2011-04-20 15:09:01 -07001154
1155 { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadProjectionMatrix, false },
1156 { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadModelMatrix, false },
1157 { "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadTextureMatrix, false },
1158
1159 { "_Z35rsgProgramVertexGetProjectionMatrixP12rs_matrix4x4", (void *)&SC_VpGetProjectionMatrix, false },
1160
1161 { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_PfConstantColor, false },
1162
1163 { "_Z11rsgGetWidthv", (void *)&SC_GetWidth, false },
1164 { "_Z12rsgGetHeightv", (void *)&SC_GetHeight, false },
1165
1166
1167 { "_Z11rsgDrawRectfffff", (void *)&SC_DrawRect, false },
1168 { "_Z11rsgDrawQuadffffffffffff", (void *)&SC_DrawQuad, false },
1169 { "_Z20rsgDrawQuadTexCoordsffffffffffffffffffff", (void *)&SC_DrawQuadTexCoords, false },
1170 { "_Z24rsgDrawSpriteScreenspacefffff", (void *)&SC_DrawSpriteScreenspace, false },
1171
1172 { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_DrawMesh, false },
1173 { "_Z11rsgDrawMesh7rs_meshj", (void *)&SC_DrawMeshPrimitive, false },
1174 { "_Z11rsgDrawMesh7rs_meshjjj", (void *)&SC_DrawMeshPrimitiveRange, false },
1175 { "_Z25rsgMeshComputeBoundingBox7rs_meshPfS0_S0_S0_S0_S0_", (void *)&SC_MeshComputeBoundingBox, false },
1176
Jason Sams9e0afb52011-10-31 13:23:43 -07001177 { "_Z11rsgDrawPath7rs_path", (void *)&SC_DrawPath, false },
1178
Jason Sams87fe59a2011-04-20 15:09:01 -07001179 { "_Z13rsgClearColorffff", (void *)&SC_ClearColor, false },
1180 { "_Z13rsgClearDepthf", (void *)&SC_ClearDepth, false },
1181
1182 { "_Z11rsgDrawTextPKcii", (void *)&SC_DrawText, false },
1183 { "_Z11rsgDrawText13rs_allocationii", (void *)&SC_DrawTextAlloc, false },
1184 { "_Z14rsgMeasureTextPKcPiS1_S1_S1_", (void *)&SC_MeasureText, false },
1185 { "_Z14rsgMeasureText13rs_allocationPiS0_S0_S0_", (void *)&SC_MeasureTextAlloc, false },
1186
1187 { "_Z11rsgBindFont7rs_font", (void *)&SC_BindFont, false },
1188 { "_Z12rsgFontColorffff", (void *)&SC_FontColor, false },
1189
1190 { "_Z18rsgBindColorTarget13rs_allocationj", (void *)&SC_BindFrameBufferObjectColorTarget, false },
1191 { "_Z18rsgBindDepthTarget13rs_allocation", (void *)&SC_BindFrameBufferObjectDepthTarget, false },
1192 { "_Z19rsgClearColorTargetj", (void *)&SC_ClearFrameBufferObjectColorTarget, false },
1193 { "_Z19rsgClearDepthTargetv", (void *)&SC_ClearFrameBufferObjectDepthTarget, false },
1194 { "_Z24rsgClearAllRenderTargetsv", (void *)&SC_ClearFrameBufferObjectTargets, false },
Tim Murray0b575de2013-03-15 15:56:43 -07001195#endif // RS_COMPATIBILITY_LIB
Jason Sams87fe59a2011-04-20 15:09:01 -07001196
Jason Samsaa152102012-06-13 15:16:44 -07001197 { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, true },
1198 { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, true },
Stephen Hinesf5988112012-10-16 00:05:46 -07001199 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK14rs_script_call", (void *)&SC_ForEach_SAAUS, true },
Jason Samsaa152102012-06-13 15:16:44 -07001200 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, true },
Stephen Hinesf5988112012-10-16 00:05:46 -07001201 { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK14rs_script_call", (void *)&SC_ForEach_SAAULS, true },
Jason Sams87fe59a2011-04-20 15:09:01 -07001202
1203 // time
1204 { "_Z6rsTimePi", (void *)&SC_Time, true },
1205 { "_Z11rsLocaltimeP5rs_tmPKi", (void *)&SC_LocalTime, true },
1206 { "_Z14rsUptimeMillisv", (void*)&SC_UptimeMillis, true },
1207 { "_Z13rsUptimeNanosv", (void*)&SC_UptimeNanos, true },
1208 { "_Z7rsGetDtv", (void*)&SC_GetDt, false },
1209
1210 // misc
Tim Murray0b575de2013-03-15 15:56:43 -07001211#ifndef RS_COMPATIBILITY_LIB
Jason Sams87fe59a2011-04-20 15:09:01 -07001212 { "_Z5colorffff", (void *)&SC_Color, false },
1213 { "_Z9rsgFinishv", (void *)&SC_Finish, false },
Tim Murray0b575de2013-03-15 15:56:43 -07001214#endif
Jason Sams87fe59a2011-04-20 15:09:01 -07001215
Jason Sams87fe59a2011-04-20 15:09:01 -07001216 { NULL, NULL, false }
1217};
1218
Tim Murray0b575de2013-03-15 15:56:43 -07001219#ifdef RS_COMPATIBILITY_LIB
1220
Tim Murrayd6f1f462013-03-25 16:36:59 -07001221//////////////////////////////////////////////////////////////////////////////
1222// Compatibility Library entry points
1223//////////////////////////////////////////////////////////////////////////////
1224
1225bool rsIsObject(rs_element src) {
1226 return SC_IsObject((ObjectBase*)src.p);
1227}
1228
1229#define CLEAR_SET_OBJ(t) \
1230 void __attribute__((overloadable)) rsClearObject(t *dst) { \
1231 return SC_ClearObject((ObjectBase**) dst); \
1232 } \
1233 void __attribute__((overloadable)) rsSetObject(t *dst, t src) { \
1234 return SC_SetObject((ObjectBase**) dst, (ObjectBase*) src.p); \
1235 }
1236
1237CLEAR_SET_OBJ(rs_element)
1238CLEAR_SET_OBJ(rs_type)
1239CLEAR_SET_OBJ(rs_allocation)
1240CLEAR_SET_OBJ(rs_sampler)
1241CLEAR_SET_OBJ(rs_script)
1242#undef CLEAR_SET_OBJ
1243
1244const Allocation * rsGetAllocation(const void *ptr) {
1245 return SC_GetAllocation(ptr);
1246}
1247
1248void __attribute__((overloadable)) rsForEach(rs_script script,
1249 rs_allocation in,
1250 rs_allocation out,
1251 const void *usr,
1252 const rs_script_call *call) {
1253 return SC_ForEach_SAAUS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, (RsScriptCall*)call);
1254}
1255
1256void __attribute__((overloadable)) rsForEach(rs_script script,
1257 rs_allocation in,
1258 rs_allocation out,
1259 const void *usr,
1260 uint32_t usrLen,
1261 const rs_script_call *call) {
1262 return SC_ForEach_SAAULS((Script *)script.p, (Allocation*)in.p, (Allocation*)out.p, usr, usrLen, (RsScriptCall*)call);
1263}
1264
1265int rsTime(int *timer) {
1266 return SC_Time(timer);
1267}
1268
1269rs_tm* rsLocaltime(rs_tm* local, const int *timer) {
1270 return (rs_tm*)(SC_LocalTime((tm*)local, (long*)timer));
1271}
1272
1273int64_t rsUptimeMillis() {
1274 Context *rsc = RsdCpuReference::getTlsContext();
1275 return rsrUptimeMillis(rsc);
1276}
1277
1278uint32_t rsSendToClientBlocking2(int cmdID, void *data, int len) {
1279 Context *rsc = RsdCpuReference::getTlsContext();
1280 return rsrToClientBlocking(rsc, cmdID, data, len);
1281}
1282
Tim Murray0b575de2013-03-15 15:56:43 -07001283uint32_t rsSendToClientBlocking(int cmdID) {
1284 Context *rsc = RsdCpuReference::getTlsContext();
1285 return rsrToClientBlocking(rsc, cmdID, NULL, 0);
1286}
1287
1288static void SC_debugF(const char *s, float f) {
1289 ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
1290}
1291static void SC_debugFv2(const char *s, float f1, float f2) {
1292 ALOGD("%s {%f, %f}", s, f1, f2);
1293}
1294static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
1295 ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
1296}
1297static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
1298 ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
1299}
1300static void SC_debugF2(const char *s, float2 f) {
1301 ALOGD("%s {%f, %f}", s, f.x, f.y);
1302}
1303static void SC_debugF3(const char *s, float3 f) {
1304 ALOGD("%s {%f, %f, %f}", s, f.x, f.y, f.z);
1305}
1306static void SC_debugF4(const char *s, float4 f) {
1307 ALOGD("%s {%f, %f, %f, %f}", s, f.x, f.y, f.z, f.w);
1308}
1309static void SC_debugD(const char *s, double d) {
1310 ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
1311}
1312static void SC_debugFM4v4(const char *s, const float *f) {
1313 ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
1314 ALOGD("%s %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
1315 ALOGD("%s %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
1316 ALOGD("%s %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
1317}
1318static void SC_debugFM3v3(const char *s, const float *f) {
1319 ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
1320 ALOGD("%s %f, %f, %f", s, f[1], f[4], f[7]);
1321 ALOGD("%s %f, %f, %f}",s, f[2], f[5], f[8]);
1322}
1323static void SC_debugFM2v2(const char *s, const float *f) {
1324 ALOGD("%s {%f, %f", s, f[0], f[2]);
1325 ALOGD("%s %f, %f}",s, f[1], f[3]);
1326}
1327static void SC_debugI8(const char *s, char c) {
1328 ALOGD("%s %hhd 0x%hhx", s, c, (unsigned char)c);
1329}
1330static void SC_debugC2(const char *s, char2 c) {
1331 ALOGD("%s {%hhd, %hhd} 0x%hhx 0x%hhx", s, c.x, c.y, (unsigned char)c.x, (unsigned char)c.y);
1332}
1333static void SC_debugC3(const char *s, char3 c) {
1334 ALOGD("%s {%hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, (unsigned char)c.x, (unsigned char)c.y, (unsigned char)c.z);
1335}
1336static void SC_debugC4(const char *s, char4 c) {
1337 ALOGD("%s {%hhd, %hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.w, (unsigned char)c.x, (unsigned char)c.y, (unsigned char)c.z, (unsigned char)c.w);
1338}
1339static void SC_debugU8(const char *s, unsigned char c) {
1340 ALOGD("%s %hhu 0x%hhx", s, c, c);
1341}
1342static void SC_debugUC2(const char *s, uchar2 c) {
1343 ALOGD("%s {%hhu, %hhu} 0x%hhx 0x%hhx", s, c.x, c.y, c.x, c.y);
1344}
1345static void SC_debugUC3(const char *s, uchar3 c) {
1346 ALOGD("%s {%hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1347}
1348static void SC_debugUC4(const char *s, uchar4 c) {
1349 ALOGD("%s {%hhu, %hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w);
1350}
1351static void SC_debugI16(const char *s, short c) {
1352 ALOGD("%s %hd 0x%hx", s, c, c);
1353}
1354static void SC_debugS2(const char *s, short2 c) {
1355 ALOGD("%s {%hd, %hd} 0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1356}
1357static void SC_debugS3(const char *s, short3 c) {
1358 ALOGD("%s {%hd, %hd, %hd} 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1359}
1360static void SC_debugS4(const char *s, short4 c) {
1361 ALOGD("%s {%hd, %hd, %hd, %hd} 0x%hx 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w);
1362}
1363static void SC_debugU16(const char *s, unsigned short c) {
1364 ALOGD("%s %hu 0x%hx", s, c, c);
1365}
1366static void SC_debugUS2(const char *s, ushort2 c) {
1367 ALOGD("%s {%hu, %hu} 0x%hx 0x%hx", s, c.x, c.y, c.x, c.y);
1368}
1369static void SC_debugUS3(const char *s, ushort3 c) {
1370 ALOGD("%s {%hu, %hu, %hu} 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.x, c.y, c.z);
1371}
1372static void SC_debugUS4(const char *s, ushort4 c) {
1373 ALOGD("%s {%hu, %hu, %hu, %hu} 0x%hx 0x%hx 0x%hx 0x%hx", s, c.x, c.y, c.z, c.w, c.x, c.y, c.z, c.w);
1374}
1375static void SC_debugI32(const char *s, int32_t i) {
1376 ALOGD("%s %d 0x%x", s, i, i);
1377}
1378static void SC_debugI2(const char *s, int2 i) {
1379 ALOGD("%s {%d, %d} 0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1380}
1381static void SC_debugI3(const char *s, int3 i) {
1382 ALOGD("%s {%d, %d, %d} 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1383}
1384static void SC_debugI4(const char *s, int4 i) {
1385 ALOGD("%s {%d, %d, %d, %d} 0x%x 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.w, i.x, i.y, i.z, i.w);
1386}
1387static void SC_debugU32(const char *s, uint32_t i) {
1388 ALOGD("%s %u 0x%x", s, i, i);
1389}
1390static void SC_debugUI2(const char *s, uint2 i) {
1391 ALOGD("%s {%u, %u} 0x%x 0x%x", s, i.x, i.y, i.x, i.y);
1392}
1393static void SC_debugUI3(const char *s, uint3 i) {
1394 ALOGD("%s {%u, %u, %u} 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.x, i.y, i.z);
1395}
1396static void SC_debugUI4(const char *s, uint4 i) {
1397 ALOGD("%s {%u, %u, %u, %u} 0x%x 0x%x 0x%x 0x%x", s, i.x, i.y, i.z, i.w, i.x, i.y, i.z, i.w);
1398}
1399static void SC_debugLL64(const char *s, long long ll) {
1400 ALOGD("%s %lld 0x%llx", s, ll, ll);
1401}
1402static void SC_debugL2(const char *s, long2 ll) {
1403 ALOGD("%s {%lld, %lld} 0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1404}
1405static void SC_debugL3(const char *s, long3 ll) {
1406 ALOGD("%s {%lld, %lld, %lld} 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1407}
1408static void SC_debugL4(const char *s, long4 ll) {
1409 ALOGD("%s {%lld, %lld, %lld, %lld} 0x%llx 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.w, ll.x, ll.y, ll.z, ll.w);
1410}
1411static void SC_debugULL64(const char *s, unsigned long long ll) {
1412 ALOGD("%s %llu 0x%llx", s, ll, ll);
1413}
1414static void SC_debugUL2(const char *s, ulong2 ll) {
1415 ALOGD("%s {%llu, %llu} 0x%llx 0x%llx", s, ll.x, ll.y, ll.x, ll.y);
1416}
1417static void SC_debugUL3(const char *s, ulong3 ll) {
1418 ALOGD("%s {%llu, %llu, %llu} 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.x, ll.y, ll.z);
1419}
1420static void SC_debugUL4(const char *s, ulong4 ll) {
1421 ALOGD("%s {%llu, %llu, %llu, %llu} 0x%llx 0x%llx 0x%llx 0x%llx", s, ll.x, ll.y, ll.z, ll.w, ll.x, ll.y, ll.z, ll.w);
1422}
1423static void SC_debugP(const char *s, const void *p) {
1424 ALOGD("%s %p", s, p);
1425}
1426
1427// TODO: allocation ops, messaging, time
1428
1429void rsDebug(const char *s, float f) {
1430 SC_debugF(s, f);
1431}
1432
1433void rsDebug(const char *s, float f1, float f2) {
1434 SC_debugFv2(s, f1, f2);
1435}
1436
1437void rsDebug(const char *s, float f1, float f2, float f3) {
1438 SC_debugFv3(s, f1, f2, f3);
1439}
1440
1441void rsDebug(const char *s, float f1, float f2, float f3, float f4) {
1442 SC_debugFv4(s, f1, f2, f3, f4);
1443}
1444
Stephen Hinesb0934b62013-07-03 17:27:38 -07001445void rsDebug(const char *s, const float2 *f) {
1446 SC_debugF2(s, *f);
Tim Murray0b575de2013-03-15 15:56:43 -07001447}
1448
Stephen Hinesb0934b62013-07-03 17:27:38 -07001449void rsDebug(const char *s, const float3 *f) {
1450 SC_debugF3(s, *f);
Tim Murray0b575de2013-03-15 15:56:43 -07001451}
1452
Stephen Hinesb0934b62013-07-03 17:27:38 -07001453void rsDebug(const char *s, const float4 *f) {
1454 SC_debugF4(s, *f);
Tim Murray0b575de2013-03-15 15:56:43 -07001455}
1456
1457void rsDebug(const char *s, double d) {
1458 SC_debugD(s, d);
1459}
1460
Stephen Hinesb0934b62013-07-03 17:27:38 -07001461void rsDebug(const char *s, const rs_matrix4x4 *m) {
Tim Murray0b575de2013-03-15 15:56:43 -07001462 SC_debugFM4v4(s, (float *) m);
1463}
1464
Stephen Hinesb0934b62013-07-03 17:27:38 -07001465void rsDebug(const char *s, const rs_matrix3x3 *m) {
Tim Murrayd6f1f462013-03-25 16:36:59 -07001466 SC_debugFM3v3(s, (float *) m);
Tim Murray0b575de2013-03-15 15:56:43 -07001467}
1468
Stephen Hinesb0934b62013-07-03 17:27:38 -07001469void rsDebug(const char *s, const rs_matrix2x2 *m) {
Tim Murrayd6f1f462013-03-25 16:36:59 -07001470 SC_debugFM2v2(s, (float *) m);
Tim Murray0b575de2013-03-15 15:56:43 -07001471}
1472
1473void rsDebug(const char *s, char c) {
1474 SC_debugI8(s, c);
1475}
1476
Stephen Hinesb0934b62013-07-03 17:27:38 -07001477void rsDebug(const char *s, const char2 *c) {
1478 SC_debugC2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001479}
1480
Stephen Hinesb0934b62013-07-03 17:27:38 -07001481void rsDebug(const char *s, const char3 *c) {
1482 SC_debugC3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001483}
1484
Stephen Hinesb0934b62013-07-03 17:27:38 -07001485void rsDebug(const char *s, const char4 *c) {
1486 SC_debugC4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001487}
1488
1489void rsDebug(const char *s, unsigned char c) {
1490 SC_debugU8(s, c);
1491}
1492
Stephen Hinesb0934b62013-07-03 17:27:38 -07001493void rsDebug(const char *s, const uchar2 *c) {
1494 SC_debugUC2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001495}
1496
Stephen Hinesb0934b62013-07-03 17:27:38 -07001497void rsDebug(const char *s, const uchar3 *c) {
1498 SC_debugUC3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001499}
1500
Stephen Hinesb0934b62013-07-03 17:27:38 -07001501void rsDebug(const char *s, const uchar4 *c) {
1502 SC_debugUC4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001503}
1504
1505void rsDebug(const char *s, short c) {
1506 SC_debugI16(s, c);
1507}
1508
Stephen Hinesb0934b62013-07-03 17:27:38 -07001509void rsDebug(const char *s, const short2 *c) {
1510 SC_debugS2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001511}
1512
Stephen Hinesb0934b62013-07-03 17:27:38 -07001513void rsDebug(const char *s, const short3 *c) {
1514 SC_debugS3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001515}
1516
Stephen Hinesb0934b62013-07-03 17:27:38 -07001517void rsDebug(const char *s, const short4 *c) {
1518 SC_debugS4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001519}
1520
1521void rsDebug(const char *s, unsigned short c) {
1522 SC_debugU16(s, c);
1523}
1524
Stephen Hinesb0934b62013-07-03 17:27:38 -07001525void rsDebug(const char *s, const ushort2 *c) {
1526 SC_debugUS2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001527}
1528
Stephen Hinesb0934b62013-07-03 17:27:38 -07001529void rsDebug(const char *s, const ushort3 *c) {
1530 SC_debugUS3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001531}
1532
Stephen Hinesb0934b62013-07-03 17:27:38 -07001533void rsDebug(const char *s, const ushort4 *c) {
1534 SC_debugUS4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001535}
1536
1537void rsDebug(const char *s, int c) {
1538 SC_debugI32(s, c);
1539}
1540
Stephen Hinesb0934b62013-07-03 17:27:38 -07001541void rsDebug(const char *s, const int2 *c) {
1542 SC_debugI2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001543}
1544
Stephen Hinesb0934b62013-07-03 17:27:38 -07001545void rsDebug(const char *s, const int3 *c) {
1546 SC_debugI3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001547}
1548
Stephen Hinesb0934b62013-07-03 17:27:38 -07001549void rsDebug(const char *s, const int4 *c) {
1550 SC_debugI4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001551}
1552
1553void rsDebug(const char *s, unsigned int c) {
1554 SC_debugU32(s, c);
1555}
1556
Stephen Hinesb0934b62013-07-03 17:27:38 -07001557void rsDebug(const char *s, const uint2 *c) {
1558 SC_debugUI2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001559}
1560
Stephen Hinesb0934b62013-07-03 17:27:38 -07001561void rsDebug(const char *s, const uint3 *c) {
1562 SC_debugUI3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001563}
1564
Stephen Hinesb0934b62013-07-03 17:27:38 -07001565void rsDebug(const char *s, const uint4 *c) {
1566 SC_debugUI4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001567}
1568
1569void rsDebug(const char *s, long c) {
1570 SC_debugLL64(s, c);
1571}
1572
1573void rsDebug(const char *s, long long c) {
1574 SC_debugLL64(s, c);
1575}
1576
Stephen Hinesb0934b62013-07-03 17:27:38 -07001577void rsDebug(const char *s, const long2 *c) {
1578 SC_debugL2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001579}
1580
Stephen Hinesb0934b62013-07-03 17:27:38 -07001581void rsDebug(const char *s, const long3 *c) {
1582 SC_debugL3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001583}
1584
Stephen Hinesb0934b62013-07-03 17:27:38 -07001585void rsDebug(const char *s, const long4 *c) {
1586 SC_debugL4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001587}
1588
1589void rsDebug(const char *s, unsigned long c) {
1590 SC_debugULL64(s, c);
1591}
1592
1593void rsDebug(const char *s, unsigned long long c) {
1594 SC_debugULL64(s, c);
1595}
1596
Stephen Hinesb0934b62013-07-03 17:27:38 -07001597void rsDebug(const char *s, const ulong2 *c) {
1598 SC_debugUL2(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001599}
1600
Stephen Hinesb0934b62013-07-03 17:27:38 -07001601void rsDebug(const char *s, const ulong3 *c) {
1602 SC_debugUL3(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001603}
1604
Stephen Hinesb0934b62013-07-03 17:27:38 -07001605void rsDebug(const char *s, const ulong4 *c) {
1606 SC_debugUL4(s, *c);
Tim Murray0b575de2013-03-15 15:56:43 -07001607}
1608
1609void rsDebug(const char *s, const void *p) {
1610 SC_debugP(s, p);
1611}
1612#endif // RS_COMPATIBILITY_LIB
Jason Sams87fe59a2011-04-20 15:09:01 -07001613
Jason Sams709a0972012-11-15 18:18:04 -08001614extern const RsdCpuReference::CpuSymbol * rsdLookupRuntimeStub(Context * pContext, char const* name) {
Jason Sams87fe59a2011-04-20 15:09:01 -07001615 ScriptC *s = (ScriptC *)pContext;
Jason Sams709a0972012-11-15 18:18:04 -08001616 const RsdCpuReference::CpuSymbol *syms = gSyms;
1617 const RsdCpuReference::CpuSymbol *sym = NULL;
Jason Sams87fe59a2011-04-20 15:09:01 -07001618
1619 if (!sym) {
Jason Sams709a0972012-11-15 18:18:04 -08001620 while (syms->fnPtr) {
1621 if (!strcmp(syms->name, name)) {
1622 return syms;
Jason Sams87fe59a2011-04-20 15:09:01 -07001623 }
1624 syms++;
1625 }
1626 }
1627
Jason Sams87fe59a2011-04-20 15:09:01 -07001628 return NULL;
1629}
1630
1631