/usr/local/google/home/srhines/android_trees/jb-mr2-dev/frameworks/rs/scriptc/rs_allocation.rsh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 The Android Open Source Project
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00023 #ifndef __RS_ALLOCATION_RSH__
00024 #define __RS_ALLOCATION_RSH__
00025 
00034 extern rs_allocation __attribute__((overloadable))
00035     rsGetAllocation(const void *);
00036 
00042 extern uint32_t __attribute__((overloadable))
00043     rsAllocationGetDimX(rs_allocation);
00044 
00050 extern uint32_t __attribute__((overloadable))
00051     rsAllocationGetDimY(rs_allocation);
00052 
00058 extern uint32_t __attribute__((overloadable))
00059     rsAllocationGetDimZ(rs_allocation);
00060 
00066 extern uint32_t __attribute__((overloadable))
00067     rsAllocationGetDimLOD(rs_allocation);
00068 
00074 extern uint32_t __attribute__((overloadable))
00075     rsAllocationGetDimFaces(rs_allocation);
00076 
00077 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
00078 
00092 extern void __attribute__((overloadable))
00093     rsAllocationCopy1DRange(rs_allocation dstAlloc,
00094                             uint32_t dstOff, uint32_t dstMip,
00095                             uint32_t count,
00096                             rs_allocation srcAlloc,
00097                             uint32_t srcOff, uint32_t srcMip);
00098 
00120 extern void __attribute__((overloadable))
00121     rsAllocationCopy2DRange(rs_allocation dstAlloc,
00122                             uint32_t dstXoff, uint32_t dstYoff,
00123                             uint32_t dstMip,
00124                             rs_allocation_cubemap_face dstFace,
00125                             uint32_t width, uint32_t height,
00126                             rs_allocation srcAlloc,
00127                             uint32_t srcXoff, uint32_t srcYoff,
00128                             uint32_t srcMip,
00129                             rs_allocation_cubemap_face srcFace);
00130 
00131 #endif //defined(RS_VERSION) && (RS_VERSION >= 14)
00132 
00136 extern const void * __attribute__((overloadable))
00137     rsGetElementAt(rs_allocation a, uint32_t x);
00141 extern const void * __attribute__((overloadable))
00142     rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y);
00146 extern const void * __attribute__((overloadable))
00147     rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
00148 
00149 
00150 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
00151     #define GET_ELEMENT_AT(T) \
00152     extern T __attribute__((overloadable)) \
00153             rsGetElementAt_##T(rs_allocation a, uint32_t x); \
00154     extern T __attribute__((overloadable)) \
00155             rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y);  \
00156     extern T __attribute__((overloadable)) \
00157             rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
00158 #else
00159     #define GET_ELEMENT_AT(T) \
00160     static inline T __attribute__((overloadable)) \
00161             rsGetElementAt_##T(rs_allocation a, uint32_t x) {  \
00162         return ((T *)rsGetElementAt(a, x))[0]; \
00163     } \
00164     static inline T __attribute__((overloadable)) \
00165             rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y) {  \
00166         return ((T *)rsGetElementAt(a, x, y))[0]; \
00167     } \
00168     static inline T __attribute__((overloadable)) \
00169             rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {  \
00170         return ((T *)rsGetElementAt(a, x, y, z))[0]; \
00171     }
00172 #endif
00173 
00174 GET_ELEMENT_AT(char)
00175 GET_ELEMENT_AT(char2)
00176 GET_ELEMENT_AT(char3)
00177 GET_ELEMENT_AT(char4)
00178 GET_ELEMENT_AT(uchar)
00179 GET_ELEMENT_AT(uchar2)
00180 GET_ELEMENT_AT(uchar3)
00181 GET_ELEMENT_AT(uchar4)
00182 GET_ELEMENT_AT(short)
00183 GET_ELEMENT_AT(short2)
00184 GET_ELEMENT_AT(short3)
00185 GET_ELEMENT_AT(short4)
00186 GET_ELEMENT_AT(ushort)
00187 GET_ELEMENT_AT(ushort2)
00188 GET_ELEMENT_AT(ushort3)
00189 GET_ELEMENT_AT(ushort4)
00190 GET_ELEMENT_AT(int)
00191 GET_ELEMENT_AT(int2)
00192 GET_ELEMENT_AT(int3)
00193 GET_ELEMENT_AT(int4)
00194 GET_ELEMENT_AT(uint)
00195 GET_ELEMENT_AT(uint2)
00196 GET_ELEMENT_AT(uint3)
00197 GET_ELEMENT_AT(uint4)
00198 GET_ELEMENT_AT(long)
00199 GET_ELEMENT_AT(long2)
00200 GET_ELEMENT_AT(long3)
00201 GET_ELEMENT_AT(long4)
00202 GET_ELEMENT_AT(ulong)
00203 GET_ELEMENT_AT(ulong2)
00204 GET_ELEMENT_AT(ulong3)
00205 GET_ELEMENT_AT(ulong4)
00206 GET_ELEMENT_AT(float)
00207 GET_ELEMENT_AT(float2)
00208 GET_ELEMENT_AT(float3)
00209 GET_ELEMENT_AT(float4)
00210 GET_ELEMENT_AT(double)
00211 GET_ELEMENT_AT(double2)
00212 GET_ELEMENT_AT(double3)
00213 GET_ELEMENT_AT(double4)
00214 
00215 #undef GET_ELEMENT_AT
00216 
00217 // Jelly Bean
00218 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
00219 
00224 extern const void __attribute__((overloadable))
00225     rsAllocationIoSend(rs_allocation a);
00226 
00231 extern const void __attribute__((overloadable))
00232     rsAllocationIoReceive(rs_allocation a);
00233 
00234 
00240 extern rs_element __attribute__((overloadable))
00241     rsAllocationGetElement(rs_allocation a);
00242 
00249 extern const float4 __attribute__((overloadable))
00250     rsSample(rs_allocation a, rs_sampler s, float location);
00260 extern const float4 __attribute__((overloadable))
00261     rsSample(rs_allocation a, rs_sampler s, float location, float lod);
00262 
00269 extern const float4 __attribute__((overloadable))
00270     rsSample(rs_allocation a, rs_sampler s, float2 location);
00271 
00281 extern const float4 __attribute__((overloadable))
00282     rsSample(rs_allocation a, rs_sampler s, float2 location, float lod);
00283 
00284 #endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
00285 
00286 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
00287 
00291 extern void __attribute__((overloadable))
00292     rsSetElementAt(rs_allocation a, void* ptr, uint32_t x);
00293 
00297 extern void __attribute__((overloadable))
00298     rsSetElementAt(rs_allocation a, void* ptr, uint32_t x, uint32_t y);
00299 
00300 #define SET_ELEMENT_AT(T)                                               \
00301     extern void __attribute__((overloadable))                           \
00302     rsSetElementAt_##T(rs_allocation a, T val, uint32_t x);             \
00303     extern void __attribute__((overloadable))                           \
00304     rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y); \
00305     extern void __attribute__((overloadable))                           \
00306     rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z);
00307 
00308 
00309 SET_ELEMENT_AT(char)
00310 SET_ELEMENT_AT(char2)
00311 SET_ELEMENT_AT(char3)
00312 SET_ELEMENT_AT(char4)
00313 SET_ELEMENT_AT(uchar)
00314 SET_ELEMENT_AT(uchar2)
00315 SET_ELEMENT_AT(uchar3)
00316 SET_ELEMENT_AT(uchar4)
00317 SET_ELEMENT_AT(short)
00318 SET_ELEMENT_AT(short2)
00319 SET_ELEMENT_AT(short3)
00320 SET_ELEMENT_AT(short4)
00321 SET_ELEMENT_AT(ushort)
00322 SET_ELEMENT_AT(ushort2)
00323 SET_ELEMENT_AT(ushort3)
00324 SET_ELEMENT_AT(ushort4)
00325 SET_ELEMENT_AT(int)
00326 SET_ELEMENT_AT(int2)
00327 SET_ELEMENT_AT(int3)
00328 SET_ELEMENT_AT(int4)
00329 SET_ELEMENT_AT(uint)
00330 SET_ELEMENT_AT(uint2)
00331 SET_ELEMENT_AT(uint3)
00332 SET_ELEMENT_AT(uint4)
00333 SET_ELEMENT_AT(long)
00334 SET_ELEMENT_AT(long2)
00335 SET_ELEMENT_AT(long3)
00336 SET_ELEMENT_AT(long4)
00337 SET_ELEMENT_AT(ulong)
00338 SET_ELEMENT_AT(ulong2)
00339 SET_ELEMENT_AT(ulong3)
00340 SET_ELEMENT_AT(ulong4)
00341 SET_ELEMENT_AT(float)
00342 SET_ELEMENT_AT(float2)
00343 SET_ELEMENT_AT(float3)
00344 SET_ELEMENT_AT(float4)
00345 SET_ELEMENT_AT(double)
00346 SET_ELEMENT_AT(double2)
00347 SET_ELEMENT_AT(double3)
00348 SET_ELEMENT_AT(double4)
00349 
00350 #undef SET_ELEMENT_AT
00351 
00352 
00356 extern const uchar __attribute__((overloadable))
00357     rsGetElementAtYuv_uchar_Y(rs_allocation a, uint32_t x, uint32_t y);
00358 
00364 extern const uchar __attribute__((overloadable))
00365     rsGetElementAtYuv_uchar_U(rs_allocation a, uint32_t x, uint32_t y);
00366 
00372 extern const uchar __attribute__((overloadable))
00373     rsGetElementAtYuv_uchar_V(rs_allocation a, uint32_t x, uint32_t y);
00374 
00375 #endif // (defined(RS_VERSION) && (RS_VERSION >= 18))
00376 
00377 #endif
00378