rs_allocation.c revision 4c01362afa871fcde6c269bc0ba3defa9e76de49
1#include "rs_core.rsh" 2#include "rs_structs.h" 3 4// Opaque Allocation type operations 5extern uint32_t __attribute__((overloadable)) 6 rsAllocationGetDimX(rs_allocation a) { 7 Allocation_t *alloc = (Allocation_t *)a.p; 8 return alloc->mHal.drvState.lod[0].dimX; 9} 10 11extern uint32_t __attribute__((overloadable)) 12 rsAllocationGetDimY(rs_allocation a) { 13 Allocation_t *alloc = (Allocation_t *)a.p; 14 return alloc->mHal.drvState.lod[0].dimY; 15} 16 17extern uint32_t __attribute__((overloadable)) 18 rsAllocationGetDimZ(rs_allocation a) { 19 Allocation_t *alloc = (Allocation_t *)a.p; 20 return alloc->mHal.drvState.lod[0].dimZ; 21} 22 23extern uint32_t __attribute__((overloadable)) 24 rsAllocationGetDimLOD(rs_allocation a) { 25 Allocation_t *alloc = (Allocation_t *)a.p; 26 return alloc->mHal.state.hasMipmaps; 27} 28 29extern uint32_t __attribute__((overloadable)) 30 rsAllocationGetDimFaces(rs_allocation a) { 31 Allocation_t *alloc = (Allocation_t *)a.p; 32 return alloc->mHal.state.hasFaces; 33} 34 35 36extern rs_element __attribute__((overloadable)) 37 rsAllocationGetElement(rs_allocation a) { 38 Allocation_t *alloc = (Allocation_t *)a.p; 39 if (alloc == NULL) { 40 rs_element nullElem = {0}; 41 return nullElem; 42 } 43 Type_t *type = (Type_t *)alloc->mHal.state.type; 44 rs_element returnElem = {type->mHal.state.element}; 45 return returnElem; 46} 47 48// TODO: this needs to be optimized, obviously 49static void memcpy(void* dst, const void* src, size_t size) { 50 char* dst_c = (char*) dst; 51 const char* src_c = (const char*) src; 52 for (; size > 0; size--) { 53 *dst_c++ = *src_c++; 54 } 55} 56 57#ifdef RS_DEBUG_RUNTIME 58#define ELEMENT_AT(T) \ 59 extern void __attribute__((overloadable)) \ 60 rsSetElementAt_##T(rs_allocation a, const T *val, uint32_t x); \ 61 extern void __attribute__((overloadable)) \ 62 rsSetElementAt_##T(rs_allocation a, const T *val, uint32_t x, uint32_t y); \ 63 extern void __attribute__((overloadable)) \ 64 rsSetElementAt_##T(rs_allocation a, const T *val, uint32_t x, uint32_t y, uint32_t z); \ 65 extern void __attribute__((overloadable)) \ 66 rsGetElementAt_##T(rs_allocation a, T *val, uint32_t x); \ 67 extern void __attribute__((overloadable)) \ 68 rsGetElementAt_##T(rs_allocation a, T *val, uint32_t x, uint32_t y); \ 69 extern void __attribute__((overloadable)) \ 70 rsGetElementAt_##T(rs_allocation a, T *val, uint32_t x, uint32_t y, uint32_t z); \ 71 \ 72 extern void __attribute__((overloadable)) \ 73 rsSetElementAt_##T(rs_allocation a, T val, uint32_t x) { \ 74 rsSetElementAt_##T(a, &val, x); \ 75 } \ 76 extern void __attribute__((overloadable)) \ 77 rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y) { \ 78 rsSetElementAt_##T(a, &val, x, y); \ 79 } \ 80 extern void __attribute__((overloadable)) \ 81 rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z) { \ 82 rsSetElementAt_##T(a, &val, x, y, z); \ 83 } \ 84 extern T __attribute__((overloadable)) \ 85 rsGetElementAt_##T(rs_allocation a, uint32_t x) { \ 86 T tmp; \ 87 rsGetElementAt_##T(a, &tmp, x); \ 88 return tmp; \ 89 } \ 90 extern T __attribute__((overloadable)) \ 91 rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y) { \ 92 T tmp; \ 93 rsGetElementAt_##T(a, &tmp, x, y); \ 94 return tmp; \ 95 } \ 96 extern T __attribute__((overloadable)) \ 97 rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { \ 98 T tmp; \ 99 rsGetElementAt_##T(a, &tmp, x, y, z); \ 100 return tmp; \ 101 } 102#else 103 104uint8_t* 105rsOffset(rs_allocation a, uint32_t sizeOf, uint32_t x, uint32_t y, 106 uint32_t z) { 107 Allocation_t *alloc = (Allocation_t *)a.p; 108 //#ifdef __LP64__ 109 // uint8_t *p = (uint8_t *)a.r; 110 //#else 111 uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 112 //#endif 113 const uint32_t stride = (uint32_t)alloc->mHal.drvState.lod[0].stride; 114 const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; 115 uint8_t *dp = &p[(sizeOf * x) + (y * stride) + 116 (z * stride * dimY)]; 117 return dp; 118} 119 120uint8_t* 121rsOffsetNs(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { 122 Allocation_t *alloc = (Allocation_t *)a.p; 123 //#ifdef __LP64__ 124 // uint8_t *p = (uint8_t *)a.r; 125 //#else 126 uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 127 //#endif 128 const uint32_t stride = alloc->mHal.drvState.lod[0].stride; 129 const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; 130 const uint32_t sizeOf = alloc->mHal.state.elementSizeBytes;; 131 uint8_t *dp = &p[(sizeOf * x) + (y * stride) + 132 (z * stride * dimY)]; 133 return dp; 134} 135 136#define SET_ELEMENT_AT_TYPE(T, typename) \ 137 \ 138 void \ 139 rsSetElementAtImpl_##typename(rs_allocation a, typename val, uint32_t x, \ 140 uint32_t y, uint32_t z); \ 141 \ 142 extern void __attribute__((overloadable)) \ 143 rsSetElementAt_##typename(rs_allocation a, T val, uint32_t x) { \ 144 rsSetElementAtImpl_##typename(a, (typename)val, x, 0, 0); \ 145 } \ 146 \ 147 extern void __attribute__((overloadable)) \ 148 rsSetElementAt_##typename(rs_allocation a, T val, uint32_t x, \ 149 uint32_t y) { \ 150 rsSetElementAtImpl_##typename(a, (typename)val, x, y, 0); \ 151 } \ 152 \ 153 extern void __attribute__((overloadable)) \ 154 rsSetElementAt_##typename(rs_allocation a, T val, uint32_t x, uint32_t y, \ 155 uint32_t z) { \ 156 rsSetElementAtImpl_##typename(a, (typename)val, x, y, z); \ 157 } \ 158 159 160 161#define GET_ELEMENT_AT_TYPE(T, typename) \ 162 typename \ 163 rsGetElementAtImpl_##typename(rs_allocation a, uint32_t x, uint32_t y, \ 164 uint32_t z); \ 165 \ 166 extern typename __attribute__((overloadable)) \ 167 rsGetElementAt_##typename(rs_allocation a, uint32_t x) { \ 168 return (typename)rsGetElementAtImpl_##typename(a, x, 0, 0); \ 169 } \ 170 \ 171 extern typename __attribute__((overloadable)) \ 172 rsGetElementAt_##typename(rs_allocation a, uint32_t x, uint32_t y) { \ 173 return (typename)rsGetElementAtImpl_##typename(a, x, y, 0); \ 174 } \ 175 \ 176 extern typename __attribute__((overloadable)) \ 177 rsGetElementAt_##typename(rs_allocation a, uint32_t x, uint32_t y, \ 178 uint32_t z) { \ 179 return (typename)rsGetElementAtImpl_##typename(a, x, y, z); \ 180 } 181 182#define SET_ELEMENT_AT(T) SET_ELEMENT_AT_TYPE(T, T) 183#define GET_ELEMENT_AT(T) GET_ELEMENT_AT_TYPE(T, T) 184 185#define ELEMENT_AT(T) \ 186 SET_ELEMENT_AT(T) \ 187 GET_ELEMENT_AT(T) 188 189 190extern const void * __attribute__((overloadable)) 191 rsGetElementAt(rs_allocation a, uint32_t x) { 192 Allocation_t *alloc = (Allocation_t *)a.p; 193 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 194 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 195 return &p[eSize * x]; 196} 197 198extern const void * __attribute__((overloadable)) 199 rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y) { 200 Allocation_t *alloc = (Allocation_t *)a.p; 201 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 202 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 203 const uint32_t stride = alloc->mHal.drvState.lod[0].stride; 204 return &p[(eSize * x) + (y * stride)]; 205} 206 207extern const void * __attribute__((overloadable)) 208 rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { 209 Allocation_t *alloc = (Allocation_t *)a.p; 210 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 211 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 212 const uint32_t stride = alloc->mHal.drvState.lod[0].stride; 213 const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; 214 return &p[(eSize * x) + (y * stride) + (z * stride * dimY)]; 215} 216extern void __attribute__((overloadable)) 217 rsSetElementAt(rs_allocation a, void* ptr, uint32_t x) { 218 Allocation_t *alloc = (Allocation_t *)a.p; 219 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 220 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 221 memcpy((void*)&p[eSize * x], ptr, eSize); 222} 223 224extern void __attribute__((overloadable)) 225 rsSetElementAt(rs_allocation a, void* ptr, uint32_t x, uint32_t y) { 226 Allocation_t *alloc = (Allocation_t *)a.p; 227 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 228 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 229 const uint32_t stride = alloc->mHal.drvState.lod[0].stride; 230 memcpy((void*)&p[(eSize * x) + (y * stride)], ptr, eSize); 231} 232 233extern void __attribute__((overloadable)) 234 rsSetElementAt(rs_allocation a, void* ptr, uint32_t x, uint32_t y, uint32_t z) { 235 Allocation_t *alloc = (Allocation_t *)a.p; 236 const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; 237 const uint32_t eSize = alloc->mHal.state.elementSizeBytes; 238 const uint32_t stride = alloc->mHal.drvState.lod[0].stride; 239 const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; 240 memcpy((void*)&p[(eSize * x) + (y * stride) + (z * stride * dimY)], ptr, eSize); 241} 242#endif // RS_DEBUG_RUNTIME 243 244ELEMENT_AT(char) 245ELEMENT_AT(char2) 246ELEMENT_AT(char3) 247ELEMENT_AT(char4) 248ELEMENT_AT(uchar) 249ELEMENT_AT(uchar2) 250ELEMENT_AT(uchar3) 251ELEMENT_AT(uchar4) 252ELEMENT_AT(short) 253ELEMENT_AT(short2) 254ELEMENT_AT(short3) 255ELEMENT_AT(short4) 256ELEMENT_AT(ushort) 257ELEMENT_AT(ushort2) 258ELEMENT_AT(ushort3) 259ELEMENT_AT(ushort4) 260ELEMENT_AT(int) 261ELEMENT_AT(int2) 262ELEMENT_AT(int3) 263ELEMENT_AT(int4) 264ELEMENT_AT(uint) 265ELEMENT_AT(uint2) 266ELEMENT_AT(uint3) 267ELEMENT_AT(uint4) 268ELEMENT_AT(long) 269ELEMENT_AT(long2) 270ELEMENT_AT(long3) 271ELEMENT_AT(long4) 272ELEMENT_AT(ulong) 273ELEMENT_AT(ulong2) 274ELEMENT_AT(ulong3) 275ELEMENT_AT(ulong4) 276ELEMENT_AT(half) 277ELEMENT_AT(half2) 278ELEMENT_AT(half3) 279ELEMENT_AT(half4) 280ELEMENT_AT(float) 281ELEMENT_AT(float2) 282ELEMENT_AT(float3) 283ELEMENT_AT(float4) 284ELEMENT_AT(double) 285ELEMENT_AT(double2) 286ELEMENT_AT(double3) 287ELEMENT_AT(double4) 288 289typedef unsigned long long ull; 290typedef unsigned long long ull2 __attribute__((ext_vector_type(2))); 291typedef unsigned long long ull3 __attribute__((ext_vector_type(3))); 292typedef unsigned long long ull4 __attribute__((ext_vector_type(4))); 293 294#ifndef RS_DEBUG_RUNTIME 295SET_ELEMENT_AT_TYPE(ull, ulong) 296SET_ELEMENT_AT_TYPE(ull2, ulong2) 297SET_ELEMENT_AT_TYPE(ull3, ulong3) 298SET_ELEMENT_AT_TYPE(ull4, ulong4) 299 300#undef SET_ELEMENT_AT_TYPE 301#undef GET_ELEMENT_AT_TYPE 302#undef ELEMENT_AT_TYPE 303#endif 304 305#undef ELEMENT_AT 306 307 308extern uchar __attribute__((overloadable)) 309 rsGetElementAtYuv_uchar_Y(rs_allocation a, uint32_t x, uint32_t y) { 310 return rsGetElementAt_uchar(a, x, y); 311} 312 313extern uchar __attribute__((overloadable)) 314 rsGetElementAtYuv_uchar_U(rs_allocation a, uint32_t x, uint32_t y) { 315 316 Allocation_t *alloc = (Allocation_t *)a.p; 317 318 const size_t cstep = alloc->mHal.drvState.yuv.step; 319 const size_t shift = alloc->mHal.drvState.yuv.shift; 320 const size_t stride = alloc->mHal.drvState.lod[1].stride; 321 322 const uchar *pin = (const uchar *)alloc->mHal.drvState.lod[1].mallocPtr; 323 324 return pin[((x >> shift) * cstep) + ((y >> shift) * stride)]; 325} 326 327extern uchar __attribute__((overloadable)) 328 rsGetElementAtYuv_uchar_V(rs_allocation a, uint32_t x, uint32_t y) { 329 330 Allocation_t *alloc = (Allocation_t *)a.p; 331 332 const size_t cstep = alloc->mHal.drvState.yuv.step; 333 const size_t shift = alloc->mHal.drvState.yuv.shift; 334 const size_t stride = alloc->mHal.drvState.lod[2].stride; 335 336 const uchar *pin = (const uchar *)alloc->mHal.drvState.lod[2].mallocPtr; 337 338 return pin[((x >> shift) * cstep) + ((y >> shift) * stride)]; 339} 340 341 342#define VOP(T) \ 343 extern void __rsAllocationVStoreXImpl_##T(rs_allocation a, const T val, uint32_t x, uint32_t y, uint32_t z); \ 344 extern T __rsAllocationVLoadXImpl_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z); \ 345 \ 346 extern void __attribute__((overloadable)) \ 347 rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x) { \ 348 __rsAllocationVStoreXImpl_##T(a, val, x, 0, 0); \ 349 } \ 350 extern void __attribute__((overloadable)) \ 351 rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x, uint32_t y) { \ 352 __rsAllocationVStoreXImpl_##T(a, val, x, y, 0); \ 353 } \ 354 extern void __attribute__((overloadable)) \ 355 rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z) { \ 356 __rsAllocationVStoreXImpl_##T(a, val, x, y, z); \ 357 } \ 358 extern T __attribute__((overloadable)) \ 359 rsAllocationVLoadX_##T(rs_allocation a, uint32_t x) { \ 360 return __rsAllocationVLoadXImpl_##T(a, x, 0, 0); \ 361 } \ 362 extern T __attribute__((overloadable)) \ 363 rsAllocationVLoadX_##T(rs_allocation a, uint32_t x, uint32_t y) { \ 364 return __rsAllocationVLoadXImpl_##T(a, x, y, 0); \ 365 } \ 366 extern T __attribute__((overloadable)) \ 367 rsAllocationVLoadX_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { \ 368 return __rsAllocationVLoadXImpl_##T(a, x, y, z); \ 369 } 370 371VOP(char2) 372VOP(char3) 373VOP(char4) 374VOP(uchar2) 375VOP(uchar3) 376VOP(uchar4) 377VOP(short2) 378VOP(short3) 379VOP(short4) 380VOP(ushort2) 381VOP(ushort3) 382VOP(ushort4) 383VOP(int2) 384VOP(int3) 385VOP(int4) 386VOP(uint2) 387VOP(uint3) 388VOP(uint4) 389VOP(long2) 390VOP(long3) 391VOP(long4) 392VOP(ulong2) 393VOP(ulong3) 394VOP(ulong4) 395VOP(float2) 396VOP(float3) 397VOP(float4) 398VOP(double2) 399VOP(double3) 400VOP(double4) 401 402#undef VOP 403 404static const rs_element kInvalidElement = {0}; 405 406extern rs_element __attribute__((overloadable)) rsCreateElement( 407 int32_t dt, int32_t dk, bool isNormalized, uint32_t vecSize); 408 409extern rs_type __attribute__((overloadable)) rsCreateType( 410 rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ, 411 bool mipmaps, bool faces, rs_yuv_format yuv_format); 412 413extern rs_allocation __attribute__((overloadable)) rsCreateAllocation( 414 rs_type type, rs_allocation_mipmap_control mipmaps, uint32_t usages, 415 void *ptr); 416 417rs_element __attribute__((overloadable)) rsCreateElement( 418 rs_data_type data_type) { 419 420 switch (data_type) { 421 case RS_TYPE_BOOLEAN: 422 // Bug: 24862914: Add RS_TYPE_FLOAT_16 once the bug is fixed 423 // case RS_TYPE_FLOAT_16: 424 case RS_TYPE_FLOAT_32: 425 case RS_TYPE_FLOAT_64: 426 case RS_TYPE_SIGNED_8: 427 case RS_TYPE_SIGNED_16: 428 case RS_TYPE_SIGNED_32: 429 case RS_TYPE_SIGNED_64: 430 case RS_TYPE_UNSIGNED_8: 431 case RS_TYPE_UNSIGNED_16: 432 case RS_TYPE_UNSIGNED_32: 433 case RS_TYPE_UNSIGNED_64: 434 case RS_TYPE_MATRIX_4X4: 435 case RS_TYPE_MATRIX_3X3: 436 case RS_TYPE_MATRIX_2X2: 437 case RS_TYPE_ELEMENT: 438 case RS_TYPE_TYPE: 439 case RS_TYPE_ALLOCATION: 440 case RS_TYPE_SCRIPT: 441 return rsCreateElement(data_type, RS_KIND_USER, false, 1); 442 default: 443 rsDebug("Invalid data_type", data_type); 444 return kInvalidElement; 445 } 446} 447 448rs_element __attribute__((overloadable)) rsCreateVectorElement( 449 rs_data_type data_type, uint32_t vector_width) { 450 if (vector_width < 2 || vector_width > 4) { 451 rsDebug("Invalid vector_width", vector_width); 452 return kInvalidElement; 453 } 454 switch (data_type) { 455 case RS_TYPE_BOOLEAN: 456 // Bug: 24862914: Add RS_TYPE_FLOAT_16 once the bug is fixed 457 // case RS_TYPE_FLOAT_16: 458 case RS_TYPE_FLOAT_32: 459 case RS_TYPE_FLOAT_64: 460 case RS_TYPE_SIGNED_8: 461 case RS_TYPE_SIGNED_16: 462 case RS_TYPE_SIGNED_32: 463 case RS_TYPE_SIGNED_64: 464 case RS_TYPE_UNSIGNED_8: 465 case RS_TYPE_UNSIGNED_16: 466 case RS_TYPE_UNSIGNED_32: 467 case RS_TYPE_UNSIGNED_64: 468 return rsCreateElement(data_type, RS_KIND_USER, false, 469 vector_width); 470 default: 471 rsDebug("Invalid data_type for vector element", data_type); 472 return kInvalidElement; 473 } 474} 475 476rs_element __attribute__((overloadable)) rsCreatePixelElement( 477 rs_data_type data_type, rs_data_kind data_kind) { 478 if (data_type != RS_TYPE_UNSIGNED_8 && 479 data_type != RS_TYPE_UNSIGNED_16 && 480 data_type != RS_TYPE_UNSIGNED_5_6_5 && 481 data_type != RS_TYPE_UNSIGNED_4_4_4_4 && 482 data_type != RS_TYPE_UNSIGNED_5_5_5_1) { 483 484 rsDebug("Invalid data_type for pixel element", data_type); 485 return kInvalidElement; 486 } 487 if (data_kind != RS_KIND_PIXEL_L && 488 data_kind != RS_KIND_PIXEL_A && 489 data_kind != RS_KIND_PIXEL_LA && 490 data_kind != RS_KIND_PIXEL_RGB && 491 data_kind != RS_KIND_PIXEL_RGBA && 492 data_kind != RS_KIND_PIXEL_DEPTH && 493 data_kind != RS_KIND_PIXEL_YUV) { 494 495 rsDebug("Invalid data_kind for pixel element", data_type); 496 return kInvalidElement; 497 } 498 if (data_type == RS_TYPE_UNSIGNED_5_6_5 && data_kind != RS_KIND_PIXEL_RGB) { 499 rsDebug("Bad data_type and data_kind combo", data_type, data_kind); 500 return kInvalidElement; 501 } 502 if (data_type == RS_TYPE_UNSIGNED_5_5_5_1 && 503 data_kind != RS_KIND_PIXEL_RGBA) { 504 505 rsDebug("Bad data_type and data_kind combo", data_type, data_kind); 506 return kInvalidElement; 507 } 508 if (data_type == RS_TYPE_UNSIGNED_4_4_4_4 && 509 data_kind != RS_KIND_PIXEL_RGBA) { 510 511 rsDebug("Bad data_type and data_kind combo", data_type, data_kind); 512 return kInvalidElement; 513 } 514 if (data_type == RS_TYPE_UNSIGNED_16 && data_kind != RS_KIND_PIXEL_DEPTH) { 515 rsDebug("Bad data_type and data_kind combo", data_type, data_kind); 516 return kInvalidElement; 517 } 518 519 int vector_width = 1; 520 switch (data_kind) { 521 case RS_KIND_PIXEL_LA: 522 vector_width = 2; 523 break; 524 case RS_KIND_PIXEL_RGB: 525 vector_width = 3; 526 break; 527 case RS_KIND_PIXEL_RGBA: 528 vector_width = 4; 529 break; 530 case RS_KIND_PIXEL_DEPTH: 531 vector_width = 2; 532 break; 533 } 534 535 return rsCreateElement(data_type, data_kind, true, vector_width); 536} 537 538rs_type __attribute__((overloadable)) rsCreateType(rs_element element, 539 uint32_t dimX, uint32_t dimY, 540 uint32_t dimZ) { 541 return rsCreateType(element, dimX, dimY, dimZ, false, false, RS_YUV_NONE); 542} 543 544rs_type __attribute__((overloadable)) rsCreateType(rs_element element, 545 uint32_t dimX, 546 uint32_t dimY) { 547 return rsCreateType(element, dimX, dimY, 0, false, false, RS_YUV_NONE); 548} 549 550rs_type __attribute__((overloadable)) rsCreateType(rs_element element, 551 uint32_t dimX) { 552 return rsCreateType(element, dimX, 0, 0, false, false, RS_YUV_NONE); 553} 554 555rs_allocation __attribute__((overloadable)) rsCreateAllocation(rs_type type, 556 uint32_t usage) { 557 return rsCreateAllocation(type, RS_ALLOCATION_MIPMAP_NONE, usage, NULL); 558} 559 560rs_allocation __attribute__((overloadable)) rsCreateAllocation(rs_type type) { 561 return rsCreateAllocation(type, RS_ALLOCATION_MIPMAP_NONE, 562 RS_ALLOCATION_USAGE_SCRIPT, NULL); 563} 564