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