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