diff options
Diffstat (limited to 'libs/rs/scriptc')
-rw-r--r-- | libs/rs/scriptc/rs_allocation.rsh | 199 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_atomic.rsh | 250 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_cl.rsh | 867 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_core.rsh | 192 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_debug.rsh | 123 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_element.rsh | 113 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_graphics.rsh | 421 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_math.rsh | 248 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_matrix.rsh | 378 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_mesh.rsh | 72 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_object.rsh | 220 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_program.rsh | 129 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_quaternion.rsh | 253 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_sampler.rsh | 76 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_time.rsh | 111 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_types.rsh | 559 |
16 files changed, 0 insertions, 4211 deletions
diff --git a/libs/rs/scriptc/rs_allocation.rsh b/libs/rs/scriptc/rs_allocation.rsh deleted file mode 100644 index b0840a0..0000000 --- a/libs/rs/scriptc/rs_allocation.rsh +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_allocation.rsh - * \brief Allocation routines - * - * - */ - -#ifndef __RS_ALLOCATION_RSH__ -#define __RS_ALLOCATION_RSH__ - -/** - * Returns the Allocation for a given pointer. The pointer should point within - * a valid allocation. The results are undefined if the pointer is not from a - * valid allocation. - */ -extern rs_allocation __attribute__((overloadable)) - rsGetAllocation(const void *); - -/** - * Query the dimension of an allocation. - * - * @return uint32_t The X dimension of the allocation. - */ -extern uint32_t __attribute__((overloadable)) - rsAllocationGetDimX(rs_allocation); - -/** - * Query the dimension of an allocation. - * - * @return uint32_t The Y dimension of the allocation. - */ -extern uint32_t __attribute__((overloadable)) - rsAllocationGetDimY(rs_allocation); - -/** - * Query the dimension of an allocation. - * - * @return uint32_t The Z dimension of the allocation. - */ -extern uint32_t __attribute__((overloadable)) - rsAllocationGetDimZ(rs_allocation); - -/** - * Query an allocation for the presence of more than one LOD. - * - * @return uint32_t Returns 1 if more than one LOD is present, 0 otherwise. - */ -extern uint32_t __attribute__((overloadable)) - rsAllocationGetDimLOD(rs_allocation); - -/** - * Query an allocation for the presence of more than one face. - * - * @return uint32_t Returns 1 if more than one face is present, 0 otherwise. - */ -extern uint32_t __attribute__((overloadable)) - rsAllocationGetDimFaces(rs_allocation); - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) - -/** - * Copy part of an allocation from another allocation. - * - * @param dstAlloc Allocation to copy data into. - * @param dstOff The offset of the first element to be copied in - * the destination allocation. - * @param dstMip Mip level in the destination allocation. - * @param count The number of elements to be copied. - * @param srcAlloc The source data allocation. - * @param srcOff The offset of the first element in data to be - * copied in the source allocation. - * @param srcMip Mip level in the source allocation. - */ -extern void __attribute__((overloadable)) - rsAllocationCopy1DRange(rs_allocation dstAlloc, - uint32_t dstOff, uint32_t dstMip, - uint32_t count, - rs_allocation srcAlloc, - uint32_t srcOff, uint32_t srcMip); - -/** - * Copy a rectangular region into the allocation from another - * allocation. - * - * @param dstAlloc allocation to copy data into. - * @param dstXoff X offset of the region to update in the - * destination allocation. - * @param dstYoff Y offset of the region to update in the - * destination allocation. - * @param dstMip Mip level in the destination allocation. - * @param dstFace Cubemap face of the destination allocation, - * ignored for allocations that aren't cubemaps. - * @param width Width of the incoming region to update. - * @param height Height of the incoming region to update. - * @param srcAlloc The source data allocation. - * @param srcXoff X offset in data of the source allocation. - * @param srcYoff Y offset in data of the source allocation. - * @param srcMip Mip level in the source allocation. - * @param srcFace Cubemap face of the source allocation, - * ignored for allocations that aren't cubemaps. - */ -extern void __attribute__((overloadable)) - rsAllocationCopy2DRange(rs_allocation dstAlloc, - uint32_t dstXoff, uint32_t dstYoff, - uint32_t dstMip, - rs_allocation_cubemap_face dstFace, - uint32_t width, uint32_t height, - rs_allocation srcAlloc, - uint32_t srcXoff, uint32_t srcYoff, - uint32_t srcMip, - rs_allocation_cubemap_face srcFace); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -/** - * Extract a single element from an allocation. - */ -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x); -/** - * \overload - */ -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x, uint32_t y); -/** - * \overload - */ -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z); - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * @param a allocation to get data from - * @return element describing allocation layout - */ -extern rs_element __attribute__((overloadable)) - rsAllocationGetElement(rs_allocation a); - -/** - * Fetch allocation in a way described by the sampler - * @param a 1D allocation to sample from - * @param s sampler state - * @param location to sample from - */ -extern const float4 __attribute__((overloadable)) - rsSample(rs_allocation a, rs_sampler s, float location); -/** - * Fetch allocation in a way described by the sampler - * @param a 1D allocation to sample from - * @param s sampler state - * @param location to sample from - * @param lod mip level to sample from, for fractional values - * mip levels will be interpolated if - * RS_SAMPLER_LINEAR_MIP_LINEAR is used - */ -extern const float4 __attribute__((overloadable)) - rsSample(rs_allocation a, rs_sampler s, float location, float lod); - -/** - * Fetch allocation in a way described by the sampler - * @param a 2D allocation to sample from - * @param s sampler state - * @param location to sample from - */ -extern const float4 __attribute__((overloadable)) - rsSample(rs_allocation a, rs_sampler s, float2 location); - -/** - * Fetch allocation in a way described by the sampler - * @param a 2D allocation to sample from - * @param s sampler state - * @param location to sample from - * @param lod mip level to sample from, for fractional values - * mip levels will be interpolated if - * RS_SAMPLER_LINEAR_MIP_LINEAR is used - */ -extern const float4 __attribute__((overloadable)) - rsSample(rs_allocation a, rs_sampler s, float2 location, float lod); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif - diff --git a/libs/rs/scriptc/rs_atomic.rsh b/libs/rs/scriptc/rs_atomic.rsh deleted file mode 100644 index a455edd..0000000 --- a/libs/rs/scriptc/rs_atomic.rsh +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_atomic.rsh - * \brief Atomic routines - * - * - */ - -#ifndef __RS_ATOMIC_RSH__ -#define __RS_ATOMIC_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) - -/** - * Atomic add one to the value at addr. - * Equal to rsAtomicAdd(addr, 1) - * - * @param addr Address of value to increment - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicInc(volatile int32_t* addr); -/** - * Atomic add one to the value at addr. - * Equal to rsAtomicAdd(addr, 1) - * - * @param addr Address of value to increment - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicInc(volatile uint32_t* addr); - -/** - * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) - * - * @param addr Address of value to decrement - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicDec(volatile int32_t* addr); -/** - * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1) - * - * @param addr Address of value to decrement - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicDec(volatile uint32_t* addr); - -/** - * Atomic add a value to the value at addr. addr[0] += value - * - * @param addr Address of value to modify - * @param value Amount to add to the value at addr - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicAdd(volatile int32_t* addr, int32_t value); -/** - * Atomic add a value to the value at addr. addr[0] += value - * - * @param addr Address of value to modify - * @param value Amount to add to the value at addr - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicAdd(volatile uint32_t* addr, uint32_t value); - -/** - * Atomic Subtract a value from the value at addr. addr[0] -= value - * - * @param addr Address of value to modify - * @param value Amount to subtract from the value at addr - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicSub(volatile int32_t* addr, int32_t value); -/** - * Atomic Subtract a value from the value at addr. addr[0] -= value - * - * @param addr Address of value to modify - * @param value Amount to subtract from the value at addr - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicSub(volatile uint32_t* addr, uint32_t value); - -/** - * Atomic Bitwise and a value from the value at addr. addr[0] &= value - * - * @param addr Address of value to modify - * @param value Amount to and with the value at addr - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicAnd(volatile int32_t* addr, int32_t value); -/** - * Atomic Bitwise and a value from the value at addr. addr[0] &= value - * - * @param addr Address of value to modify - * @param value Amount to and with the value at addr - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicAnd(volatile uint32_t* addr, uint32_t value); - -/** - * Atomic Bitwise or a value from the value at addr. addr[0] |= value - * - * @param addr Address of value to modify - * @param value Amount to or with the value at addr - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicOr(volatile int32_t* addr, int32_t value); -/** - * Atomic Bitwise or a value from the value at addr. addr[0] |= value - * - * @param addr Address of value to modify - * @param value Amount to or with the value at addr - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicOr(volatile uint32_t* addr, uint32_t value); - -/** - * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value - * - * @param addr Address of value to modify - * @param value Amount to xor with the value at addr - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicXor(volatile uint32_t* addr, uint32_t value); -/** - * Atomic Bitwise xor a value from the value at addr. addr[0] ^= value - * - * @param addr Address of value to modify - * @param value Amount to xor with the value at addr - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicXor(volatile int32_t* addr, int32_t value); - -/** - * Atomic Set the value at addr to the min of addr and value - * addr[0] = rsMin(addr[0], value) - * - * @param addr Address of value to modify - * @param value comparison value - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicMin(volatile uint32_t* addr, uint32_t value); -/** - * Atomic Set the value at addr to the min of addr and value - * addr[0] = rsMin(addr[0], value) - * - * @param addr Address of value to modify - * @param value comparison value - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicMin(volatile int32_t* addr, int32_t value); - -/** - * Atomic Set the value at addr to the max of addr and value - * addr[0] = rsMax(addr[0], value) - * - * @param addr Address of value to modify - * @param value comparison value - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicMax(volatile uint32_t* addr, uint32_t value); -/** - * Atomic Set the value at addr to the max of addr and value - * addr[0] = rsMin(addr[0], value) - * - * @param addr Address of value to modify - * @param value comparison value - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicMax(volatile int32_t* addr, int32_t value); - -/** - * Compare-and-set operation with a full memory barrier. - * - * If the value at addr matches compareValue then newValue is written. - * - * @param addr The address to compare and replace if the compare passes. - * @param compareValue The value to test addr[0] against. - * @param newValue The value to write if the test passes. - * - * @return old value - */ -extern int32_t __attribute__((overloadable)) - rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue); - -/** - * Compare-and-set operation with a full memory barrier. - * - * If the value at addr matches compareValue then newValue is written. - * - * @param addr The address to compare and replace if the compare passes. - * @param compareValue The value to test addr[0] against. - * @param newValue The value to write if the test passes. - * - * @return old value - */ -extern uint32_t __attribute__((overloadable)) - rsAtomicCas(volatile uint32_t* addr, uint32_t compareValue, uint32_t newValue); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -#endif - diff --git a/libs/rs/scriptc/rs_cl.rsh b/libs/rs/scriptc/rs_cl.rsh deleted file mode 100644 index bbc8fc5..0000000 --- a/libs/rs/scriptc/rs_cl.rsh +++ /dev/null @@ -1,867 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_cl.rsh - * \brief Basic math functions - * - * - */ - -#ifndef __RS_CL_RSH__ -#define __RS_CL_RSH__ - -// Conversions -#define CVT_FUNC_2(typeout, typein) \ -_RS_RUNTIME typeout##2 __attribute__((overloadable)) \ - convert_##typeout##2(typein##2 v); \ -_RS_RUNTIME typeout##3 __attribute__((overloadable)) \ - convert_##typeout##3(typein##3 v); \ -_RS_RUNTIME typeout##4 __attribute__((overloadable)) \ - convert_##typeout##4(typein##4 v); - - -#define CVT_FUNC(type) CVT_FUNC_2(type, uchar) \ - CVT_FUNC_2(type, char) \ - CVT_FUNC_2(type, ushort) \ - CVT_FUNC_2(type, short) \ - CVT_FUNC_2(type, uint) \ - CVT_FUNC_2(type, int) \ - CVT_FUNC_2(type, float) - -CVT_FUNC(char) -CVT_FUNC(uchar) -CVT_FUNC(short) -CVT_FUNC(ushort) -CVT_FUNC(int) -CVT_FUNC(uint) -CVT_FUNC(float) - -// Float ops, 6.11.2 - -#define FN_FUNC_FN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v); - -#define IN_FUNC_FN(fnc) \ -_RS_RUNTIME int2 __attribute__((overloadable)) fnc(float2 v); \ -_RS_RUNTIME int3 __attribute__((overloadable)) fnc(float3 v); \ -_RS_RUNTIME int4 __attribute__((overloadable)) fnc(float4 v); - -#define FN_FUNC_FN_FN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float3 v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2); - -#define FN_FUNC_FN_F(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float v2); - -#define FN_FUNC_FN_IN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 v2); \ - -#define FN_FUNC_FN_I(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int v2); - -#define FN_FUNC_FN_PFN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) \ - fnc(float2 v1, float2 *v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) \ - fnc(float3 v1, float3 *v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) \ - fnc(float4 v1, float4 *v2); - -#define FN_FUNC_FN_PIN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 *v2); \ -_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 *v2); \ -_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 *v2); - -#define FN_FUNC_FN_FN_FN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) \ - fnc(float2 v1, float2 v2, float2 v3); \ -_RS_RUNTIME float3 __attribute__((overloadable)) \ - fnc(float3 v1, float3 v2, float3 v3); \ -_RS_RUNTIME float4 __attribute__((overloadable)) \ - fnc(float4 v1, float4 v2, float4 v3); - -#define FN_FUNC_FN_FN_PIN(fnc) \ -_RS_RUNTIME float2 __attribute__((overloadable)) \ - fnc(float2 v1, float2 v2, int2 *v3); \ -_RS_RUNTIME float3 __attribute__((overloadable)) \ - fnc(float3 v1, float3 v2, int3 *v3); \ -_RS_RUNTIME float4 __attribute__((overloadable)) \ - fnc(float4 v1, float4 v2, int4 *v3); - - -/** - * Return the inverse cosine. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) acos(float); -FN_FUNC_FN(acos) - -/** - * Return the inverse hyperbolic cosine. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) acosh(float); -FN_FUNC_FN(acosh) - -/** - * Return the inverse cosine divided by PI. - * - * Supports float, float2, float3, float4 - */ -_RS_RUNTIME float __attribute__((overloadable)) acospi(float v); -FN_FUNC_FN(acospi) - -/** - * Return the inverse sine. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) asin(float); -FN_FUNC_FN(asin) - -/** - * Return the inverse hyperbolic sine. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) asinh(float); -FN_FUNC_FN(asinh) - - -/** - * Return the inverse sine divided by PI. - * - * Supports float, float2, float3, float4 - */ -_RS_RUNTIME float __attribute__((overloadable)) asinpi(float v); -FN_FUNC_FN(asinpi) - -/** - * Return the inverse tangent. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) atan(float); -FN_FUNC_FN(atan) - -/** - * Return the inverse tangent of y / x. - * - * Supports float, float2, float3, float4. Both arguments must be of the same - * type. - * - * @param y - * @param x - */ -extern float __attribute__((overloadable)) atan2(float y, float x); -FN_FUNC_FN_FN(atan2) - -/** - * Return the inverse hyperbolic tangent. - * - * Supports float, float2, float3, float4 - */ -extern float __attribute__((overloadable)) atanh(float); -FN_FUNC_FN(atanh) - -/** - * Return the inverse tangent divided by PI. - * - * Supports float, float2, float3, float4 - */ -_RS_RUNTIME float __attribute__((overloadable)) atanpi(float v); -FN_FUNC_FN(atanpi) - -/** - * Return the inverse tangent of y / x, divided by PI. - * - * Supports float, float2, float3, float4. Both arguments must be of the same - * type. - * - * @param y - * @param x - */ -_RS_RUNTIME float __attribute__((overloadable)) atan2pi(float y, float x); -FN_FUNC_FN_FN(atan2pi) - - -/** - * Return the cube root. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) cbrt(float); -FN_FUNC_FN(cbrt) - -/** - * Return the smallest integer not less than a value. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) ceil(float); -FN_FUNC_FN(ceil) - -/** - * Copy the sign bit from y to x. - * - * Supports float, float2, float3, float4. Both arguments must be of the same - * type. - * - * @param x - * @param y - */ -extern float __attribute__((overloadable)) copysign(float x, float y); -FN_FUNC_FN_FN(copysign) - -/** - * Return the cosine. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) cos(float); -FN_FUNC_FN(cos) - -/** - * Return the hypebolic cosine. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) cosh(float); -FN_FUNC_FN(cosh) - -/** - * Return the cosine of the value * PI. - * - * Supports float, float2, float3, float4. - */ -_RS_RUNTIME float __attribute__((overloadable)) cospi(float v); -FN_FUNC_FN(cospi) - -/** - * Return the complementary error function. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) erfc(float); -FN_FUNC_FN(erfc) - -/** - * Return the error function. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) erf(float); -FN_FUNC_FN(erf) - -/** - * Return e ^ value. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) exp(float); -FN_FUNC_FN(exp) - -/** - * Return 2 ^ value. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) exp2(float); -FN_FUNC_FN(exp2) - -/** - * Return x ^ y. - * - * Supports float, float2, float3, float4. Both arguments must be of the same - * type. - */ -extern float __attribute__((overloadable)) pow(float x, float y); -FN_FUNC_FN_FN(pow) - -/** - * Return 10 ^ value. - * - * Supports float, float2, float3, float4. - */ -_RS_RUNTIME float __attribute__((overloadable)) exp10(float v); -FN_FUNC_FN(exp10) - -/** - * Return (e ^ value) - 1. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) expm1(float); -FN_FUNC_FN(expm1) - -/** - * Return the absolute value of a value. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) fabs(float); -FN_FUNC_FN(fabs) - -/** - * Return the positive difference between two values. - * - * Supports float, float2, float3, float4. Both arguments must be of the same - * type. - */ -extern float __attribute__((overloadable)) fdim(float, float); -FN_FUNC_FN_FN(fdim) - -/** - * Return the smallest integer not greater than a value. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) floor(float); -FN_FUNC_FN(floor) - -/** - * Return a*b + c. - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) fma(float a, float b, float c); -FN_FUNC_FN_FN_FN(fma) - -/** - * Return (x < y ? y : x) - * - * Supports float, float2, float3, float4. - * @param x: may be float, float2, float3, float4 - * @param y: may be float or vector. If vector must match type of x. - */ -extern float __attribute__((overloadable)) fmax(float x, float y); -FN_FUNC_FN_FN(fmax); -FN_FUNC_FN_F(fmax); - -/** - * Return (x > y ? y : x) - * - * @param x: may be float, float2, float3, float4 - * @param y: may be float or vector. If vector must match type of x. - */ -extern float __attribute__((overloadable)) fmin(float x, float y); -FN_FUNC_FN_FN(fmin); -FN_FUNC_FN_F(fmin); - -/** - * Return the remainder from x / y - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) fmod(float x, float y); -FN_FUNC_FN_FN(fmod) - - -/** - * Return fractional part of v - * - * @param iptr iptr[0] will be set to the floor of the input value. - * Supports float, float2, float3, float4. - */ -_RS_RUNTIME float __attribute__((overloadable)) fract(float v, float *iptr); -FN_FUNC_FN_PFN(fract) - -/** - * Return the mantissa and place the exponent into iptr[0] - * - * @param v Supports float, float2, float3, float4. - * @param iptr Must have the same vector size as v. - */ -extern float __attribute__((overloadable)) frexp(float v, int *iptr); -FN_FUNC_FN_PIN(frexp) - -/** - * Return sqrt(x*x + y*y) - * - * Supports float, float2, float3, float4. - */ -extern float __attribute__((overloadable)) hypot(float x, float y); -FN_FUNC_FN_FN(hypot) - -/** - * Return the integer exponent of a value - * - * Supports 1,2,3,4 components - */ -extern int __attribute__((overloadable)) ilogb(float); -IN_FUNC_FN(ilogb) - -/** - * Return (x * 2^y) - * - * @param x Supports 1,2,3,4 components - * @param y Supports single component or matching vector. - */ -extern float __attribute__((overloadable)) ldexp(float x, int y); -FN_FUNC_FN_IN(ldexp) -FN_FUNC_FN_I(ldexp) - -/** - * Return the log gamma - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) lgamma(float); -FN_FUNC_FN(lgamma) - -/** - * Return the log gamma and sign - * - * @param x Supports 1,2,3,4 components - * @param y Supports matching vector. - */ -extern float __attribute__((overloadable)) lgamma(float x, int* y); -FN_FUNC_FN_PIN(lgamma) - -/** - * Return the natural logarithm - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) log(float); -FN_FUNC_FN(log) - -/** - * Return the base 10 logarithm - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) log10(float); -FN_FUNC_FN(log10) - -/** - * Return the base 2 logarithm - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) log2(float v); -FN_FUNC_FN(log2) - -/** - * Return the natural logarithm of (v + 1.0f) - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) log1p(float v); -FN_FUNC_FN(log1p) - -/** - * Compute the exponent of the value. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) logb(float); -FN_FUNC_FN(logb) - -/** - * Compute (a * b) + c - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) mad(float a, float b, float c); -FN_FUNC_FN_FN_FN(mad) - -/** - * Return the integral and fractional components of a number - * Supports 1,2,3,4 components - * - * @param x Source value - * @param iret iret[0] will be set to the integral portion of the number. - * @return The floating point portion of the value. - */ -extern float __attribute__((overloadable)) modf(float x, float *iret); -FN_FUNC_FN_PFN(modf); - -//extern float __attribute__((overloadable)) nan(uint); - -/** - * Return the next floating point number from x towards y. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) nextafter(float x, float y); -FN_FUNC_FN_FN(nextafter) - -/** - * Return (v ^ p). - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) pown(float v, int p); -FN_FUNC_FN_IN(pown) - -/** - * Return (v ^ p). - * @param v must be greater than 0. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) powr(float v, float p); -FN_FUNC_FN_FN(powr) - -/** - * Return round x/y to the nearest integer then compute the remander. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) remainder(float x, float y); -FN_FUNC_FN_FN(remainder) - -// document once we know the precision of bionic -extern float __attribute__((overloadable)) remquo(float, float, int *); -FN_FUNC_FN_FN_PIN(remquo) - -/** - * Round to the nearest integral value. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) rint(float); -FN_FUNC_FN(rint) - -/** - * Compute the Nth root of a value. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) rootn(float v, int n); -FN_FUNC_FN_IN(rootn) - -/** - * Round to the nearest integral value. Half values are rounded away from zero. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) round(float); -FN_FUNC_FN(round) - -/** - * Return the square root of a value. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) sqrt(float); -FN_FUNC_FN(sqrt) - -/** - * Return (1 / sqrt(value)). - * - * @param v The incoming value in radians - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) rsqrt(float v); -FN_FUNC_FN(rsqrt) - -/** - * Return the sine of a value specified in radians. - * - * @param v The incoming value in radians - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) sin(float v); -FN_FUNC_FN(sin) - -/** - * Return the sine and cosine of a value. - * - * @return sine - * @param v The incoming value in radians - * @param *cosptr cosptr[0] will be set to the cosine value. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) sincos(float v, float *cosptr); -FN_FUNC_FN_PFN(sincos); - -/** - * Return the hyperbolic sine of a value specified in radians. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) sinh(float); -FN_FUNC_FN(sinh) - -/** - * Return the sin(v * PI). - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) sinpi(float v); -FN_FUNC_FN(sinpi) - -/** - * Return the tangent of a value. - * - * Supports 1,2,3,4 components - * @param v The incoming value in radians - */ -extern float __attribute__((overloadable)) tan(float v); -FN_FUNC_FN(tan) - -/** - * Return the hyperbolic tangent of a value. - * - * Supports 1,2,3,4 components - * @param v The incoming value in radians - */ -extern float __attribute__((overloadable)) tanh(float); -FN_FUNC_FN(tanh) - -/** - * Return tan(v * PI) - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) tanpi(float v); -FN_FUNC_FN(tanpi) - -/** - * Compute the gamma function of a value. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) tgamma(float); -FN_FUNC_FN(tgamma) - -/** - * Round to integral using truncation. - * - * Supports 1,2,3,4 components - */ -extern float __attribute__((overloadable)) trunc(float); -FN_FUNC_FN(trunc) - - -#define XN_FUNC_YN(typeout, fnc, typein) \ -extern typeout __attribute__((overloadable)) fnc(typein); \ -_RS_RUNTIME typeout##2 __attribute__((overloadable)) fnc(typein##2 v); \ -_RS_RUNTIME typeout##3 __attribute__((overloadable)) fnc(typein##3 v); \ -_RS_RUNTIME typeout##4 __attribute__((overloadable)) fnc(typein##4 v); - -#define UIN_FUNC_IN(fnc) \ -XN_FUNC_YN(uchar, fnc, char) \ -XN_FUNC_YN(ushort, fnc, short) \ -XN_FUNC_YN(uint, fnc, int) - -#define IN_FUNC_IN(fnc) \ -XN_FUNC_YN(uchar, fnc, uchar) \ -XN_FUNC_YN(char, fnc, char) \ -XN_FUNC_YN(ushort, fnc, ushort) \ -XN_FUNC_YN(short, fnc, short) \ -XN_FUNC_YN(uint, fnc, uint) \ -XN_FUNC_YN(int, fnc, int) - - -#define XN_FUNC_XN_XN_BODY(type, fnc, body) \ -_RS_RUNTIME type __attribute__((overloadable)) \ - fnc(type v1, type v2); \ -_RS_RUNTIME type##2 __attribute__((overloadable)) \ - fnc(type##2 v1, type##2 v2); \ -_RS_RUNTIME type##3 __attribute__((overloadable)) \ - fnc(type##3 v1, type##3 v2); \ -_RS_RUNTIME type##4 __attribute__((overloadable)) \ - fnc(type##4 v1, type##4 v2); - -#define IN_FUNC_IN_IN_BODY(fnc, body) \ -XN_FUNC_XN_XN_BODY(uchar, fnc, body) \ -XN_FUNC_XN_XN_BODY(char, fnc, body) \ -XN_FUNC_XN_XN_BODY(ushort, fnc, body) \ -XN_FUNC_XN_XN_BODY(short, fnc, body) \ -XN_FUNC_XN_XN_BODY(uint, fnc, body) \ -XN_FUNC_XN_XN_BODY(int, fnc, body) \ -XN_FUNC_XN_XN_BODY(float, fnc, body) - -UIN_FUNC_IN(abs) -IN_FUNC_IN(clz) - -/** - * Return the minimum of two values. - * - * Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float. - */ -IN_FUNC_IN_IN_BODY(min, (v1 < v2 ? v1 : v2)) -FN_FUNC_FN_F(min) - -/** - * Return the maximum of two values. - * - * Supports 1,2,3,4 components of uchar, char, ushort, short, uint, int, float. - */ -IN_FUNC_IN_IN_BODY(max, (v1 > v2 ? v1 : v2)) -FN_FUNC_FN_F(max) - -/** - * Clamp a value to a specified high and low bound. - * - * @param amount value to be clamped. Supports 1,2,3,4 components - * @param low Lower bound, must be scalar or matching vector. - * @param high High bound, must match type of low - */ -_RS_RUNTIME float __attribute__((overloadable)) clamp(float amount, float low, float high); -_RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float2 low, float2 high); -_RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float3 low, float3 high); -_RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float4 low, float4 high); -_RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float low, float high); -_RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float low, float high); -_RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float low, float high); - -/** - * Convert from radians to degrees. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) degrees(float radians); -FN_FUNC_FN(degrees) - -/** - * return start + ((stop - start) * amount); - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) mix(float start, float stop, float amount); -_RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float2 amount); -_RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float3 amount); -_RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float4 amount); -_RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float amount); -_RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float amount); -_RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float amount); - -/** - * Convert from degrees to radians. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) radians(float degrees); -FN_FUNC_FN(radians) - -/** - * if (v < edge) - * return 0.f; - * else - * return 1.f; - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) step(float edge, float v); -_RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float2 v); -_RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float3 v); -_RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float4 v); -_RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float v); -_RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float v); -_RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float v); - -// not implemented -extern float __attribute__((overloadable)) smoothstep(float, float, float); -extern float2 __attribute__((overloadable)) smoothstep(float2, float2, float2); -extern float3 __attribute__((overloadable)) smoothstep(float3, float3, float3); -extern float4 __attribute__((overloadable)) smoothstep(float4, float4, float4); -extern float2 __attribute__((overloadable)) smoothstep(float, float, float2); -extern float3 __attribute__((overloadable)) smoothstep(float, float, float3); -extern float4 __attribute__((overloadable)) smoothstep(float, float, float4); - -/** - * if (v < 0) return -1.f; - * else if (v > 0) return 1.f; - * else return 0.f; - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) sign(float v); -FN_FUNC_FN(sign) - -/** - * Compute the cross product of two vectors. - * - * Supports 3,4 components - */ -_RS_RUNTIME float3 __attribute__((overloadable)) cross(float3 lhs, float3 rhs); -_RS_RUNTIME float4 __attribute__((overloadable)) cross(float4 lhs, float4 rhs); - -/** - * Compute the dot product of two vectors. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) dot(float lhs, float rhs); -_RS_RUNTIME float __attribute__((overloadable)) dot(float2 lhs, float2 rhs); -_RS_RUNTIME float __attribute__((overloadable)) dot(float3 lhs, float3 rhs); -_RS_RUNTIME float __attribute__((overloadable)) dot(float4 lhs, float4 rhs); - -/** - * Compute the length of a vector. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) length(float v); -_RS_RUNTIME float __attribute__((overloadable)) length(float2 v); -_RS_RUNTIME float __attribute__((overloadable)) length(float3 v); -_RS_RUNTIME float __attribute__((overloadable)) length(float4 v); - -/** - * Compute the distance between two points. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) distance(float lhs, float rhs); -_RS_RUNTIME float __attribute__((overloadable)) distance(float2 lhs, float2 rhs); -_RS_RUNTIME float __attribute__((overloadable)) distance(float3 lhs, float3 rhs); -_RS_RUNTIME float __attribute__((overloadable)) distance(float4 lhs, float4 rhs); - -/** - * Normalize a vector. - * - * Supports 1,2,3,4 components - */ -_RS_RUNTIME float __attribute__((overloadable)) normalize(float v); -_RS_RUNTIME float2 __attribute__((overloadable)) normalize(float2 v); -_RS_RUNTIME float3 __attribute__((overloadable)) normalize(float3 v); -_RS_RUNTIME float4 __attribute__((overloadable)) normalize(float4 v); - -#undef CVT_FUNC -#undef CVT_FUNC_2 -#undef FN_FUNC_FN -#undef IN_FUNC_FN -#undef FN_FUNC_FN_FN -#undef FN_FUNC_FN_F -#undef FN_FUNC_FN_IN -#undef FN_FUNC_FN_I -#undef FN_FUNC_FN_PFN -#undef FN_FUNC_FN_PIN -#undef FN_FUNC_FN_FN_FN -#undef FN_FUNC_FN_FN_PIN -#undef XN_FUNC_YN -#undef UIN_FUNC_IN -#undef IN_FUNC_IN -#undef XN_FUNC_XN_XN_BODY -#undef IN_FUNC_IN_IN_BODY - -#endif diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh deleted file mode 100644 index 1b0f9db..0000000 --- a/libs/rs/scriptc/rs_core.rsh +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /*! \mainpage notitle - * - * Renderscript is a high-performance runtime that provides graphics rendering and - * compute operations at the native level. Renderscript code is compiled on devices - * at runtime to allow platform-independence as well. - * This reference documentation describes the Renderscript runtime APIs, which you - * can utilize to write Renderscript code in C99. The Renderscript header - * files are automatically included for you, except for the rs_graphics.rsh header. If - * you are doing graphics rendering, include the graphics header file like this: - * - * <code>#include "rs_graphics.rsh"</code> - * - * To use Renderscript, you need to utilize the Renderscript runtime APIs documented here - * as well as the Android framework APIs for Renderscript. - * For documentation on the Android framework APIs, see the <a target="_parent" href= - * "http://developer.android.com/reference/android/renderscript/package-summary.html"> - * android.renderscript</a> package reference. - * For more information on how to develop with Renderscript and how the runtime and - * Android framework APIs interact, see the <a target="_parent" href= - * "http://developer.android.com/guide/topics/renderscript/index.html">Renderscript - * developer guide</a> and the <a target="_parent" href= - * "http://developer.android.com/resources/samples/RenderScript/index.html"> - * Renderscript samples</a>. - */ - -/** @file rs_core.rsh - * \brief todo-jsams - * - * todo-jsams - * - */ - -#ifndef __RS_CORE_RSH__ -#define __RS_CORE_RSH__ - -#define _RS_RUNTIME extern - -#include "rs_types.rsh" -#include "rs_allocation.rsh" -#include "rs_atomic.rsh" -#include "rs_cl.rsh" -#include "rs_debug.rsh" -#include "rs_element.rsh" -#include "rs_math.rsh" -#include "rs_matrix.rsh" -#include "rs_object.rsh" -#include "rs_quaternion.rsh" -#include "rs_sampler.rsh" -#include "rs_time.rsh" - -/** - * Send a message back to the client. Will not block and returns true - * if the message was sendable and false if the fifo was full. - * A message ID is required. Data payload is optional. - */ -extern bool __attribute__((overloadable)) - rsSendToClient(int cmdID); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsSendToClient(int cmdID, const void *data, uint len); -/** - * Send a message back to the client, blocking until the message is queued. - * A message ID is required. Data payload is optional. - */ -extern void __attribute__((overloadable)) - rsSendToClientBlocking(int cmdID); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSendToClientBlocking(int cmdID, const void *data, uint len); - - -/** - * Launch order hint for rsForEach calls. This provides a hint to the system to - * determine in which order the root function of the target is called with each - * cell of the allocation. - * - * This is a hint and implementations may not obey the order. - */ -enum rs_for_each_strategy { - RS_FOR_EACH_STRATEGY_SERIAL, - RS_FOR_EACH_STRATEGY_DONT_CARE, - RS_FOR_EACH_STRATEGY_DST_LINEAR, - RS_FOR_EACH_STRATEGY_TILE_SMALL, - RS_FOR_EACH_STRATEGY_TILE_MEDIUM, - RS_FOR_EACH_STRATEGY_TILE_LARGE -}; - - -/** - * Structure to provide extra information to a rsForEach call. Primarly used to - * restrict the call to a subset of cells in the allocation. - */ -typedef struct rs_script_call { - enum rs_for_each_strategy strategy; - uint32_t xStart; - uint32_t xEnd; - uint32_t yStart; - uint32_t yEnd; - uint32_t zStart; - uint32_t zEnd; - uint32_t arrayStart; - uint32_t arrayEnd; -} rs_script_call_t; - -/** - * Make a script to script call to launch work. One of the input or output is - * required to be a valid object. The input and output must be of the same - * dimensions. - * API 10-13 - * - * @param script The target script to call - * @param input The allocation to source data from - * @param output the allocation to write date into - * @param usrData The user definied params to pass to the root script. May be - * NULL. - * @param sc Extra control infomation used to select a sub-region of the - * allocation to be processed or suggest a walking strategy. May be - * NULL. - * - * */ -#if !defined(RS_VERSION) || (RS_VERSION < 14) -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, - rs_allocation output, const void * usrData, - const rs_script_call_t *sc); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, - rs_allocation output, const void * usrData); -#else - -/** - * Make a script to script call to launch work. One of the input or output is - * required to be a valid object. The input and output must be of the same - * dimensions. - * API 14+ - * - * @param script The target script to call - * @param input The allocation to source data from - * @param output the allocation to write date into - * @param usrData The user definied params to pass to the root script. May be - * NULL. - * @param usrDataLen The size of the userData structure. This will be used to - * perform a shallow copy of the data if necessary. - * @param sc Extra control infomation used to select a sub-region of the - * allocation to be processed or suggest a walking strategy. May be - * NULL. - * - */ -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, rs_allocation output, - const void * usrData, size_t usrDataLen, const rs_script_call_t *); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, rs_allocation output, - const void * usrData, size_t usrDataLen); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, rs_allocation output); -#endif - - - -#undef _RS_RUNTIME - -#endif diff --git a/libs/rs/scriptc/rs_debug.rsh b/libs/rs/scriptc/rs_debug.rsh deleted file mode 100644 index 074c28f..0000000 --- a/libs/rs/scriptc/rs_debug.rsh +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_debug.rsh - * \brief Utility debugging routines - * - * Routines intended to be used during application developement. These should - * not be used in shipping applications. All print a string and value pair to - * the standard log. - * - */ - -#ifndef __RS_DEBUG_RSH__ -#define __RS_DEBUG_RSH__ - - - -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, float); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, float, float); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, float, float, float); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, float, float, float, float); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, double); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, const rs_matrix4x4 *); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, const rs_matrix3x3 *); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, const rs_matrix2x2 *); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, int); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, uint); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, long); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, unsigned long); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, long long); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, unsigned long long); -/** - * Debug function. Prints a string and value to the log. - */ -extern void __attribute__((overloadable)) - rsDebug(const char *, const void *); -#define RS_DEBUG(a) rsDebug(#a, a) -#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__) - - -/** - * Debug function. Prints a string and value to the log. - */ -_RS_RUNTIME void __attribute__((overloadable)) rsDebug(const char *s, float2 v); -/** - * Debug function. Prints a string and value to the log. - */ -_RS_RUNTIME void __attribute__((overloadable)) rsDebug(const char *s, float3 v); -/** - * Debug function. Prints a string and value to the log. - */ -_RS_RUNTIME void __attribute__((overloadable)) rsDebug(const char *s, float4 v); - -#endif diff --git a/libs/rs/scriptc/rs_element.rsh b/libs/rs/scriptc/rs_element.rsh deleted file mode 100644 index 1a4cdb75..0000000 --- a/libs/rs/scriptc/rs_element.rsh +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_element.rsh - * \brief Element routines - * - * - */ - -#ifndef __RS_ELEMENT_RSH__ -#define __RS_ELEMENT_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * @param e element to get data from - * @return number of sub-elements in this element - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSubElementCount(rs_element e); - -/** - * @param e element to get data from - * @param index index of the sub-element to return - * @return sub-element in this element at given index - */ -extern rs_element __attribute__((overloadable)) - rsElementGetSubElement(rs_element, uint32_t index); - -/** - * @param e element to get data from - * @param index index of the sub-element to return - * @return length of the sub-element name including the null - * terminator (size of buffer needed to write the name) - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSubElementNameLength(rs_element e, uint32_t index); - -/** - * @param e element to get data from - * @param index index of the sub-element - * @param name array to store the name into - * @param nameLength length of the provided name array - * @return number of characters actually written, excluding the - * null terminator - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSubElementName(rs_element e, uint32_t index, char *name, uint32_t nameLength); - -/** - * @param e element to get data from - * @param index index of the sub-element - * @return array size of sub-element in this element at given - * index - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSubElementArraySize(rs_element e, uint32_t index); - -/** - * @param e element to get data from - * @param index index of the sub-element - * @return offset in bytes of sub-element in this element at - * given index - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index); - -/** - * @param e element to get data from - * @return total size of the element in bytes - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetSizeBytes(rs_element e); - -/** - * @param e element to get data from - * @return element's data type - */ -extern rs_data_type __attribute__((overloadable)) - rsElementGetDataType(rs_element e); - -/** - * @param e element to get data from - * @return element's data size - */ -extern rs_data_kind __attribute__((overloadable)) - rsElementGetDataKind(rs_element e); - -/** - * @param e element to get data from - * @return length of the element vector (for float2, float3, - * etc.) - */ -extern uint32_t __attribute__((overloadable)) - rsElementGetVectorSize(rs_element e); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_ELEMENT_RSH__ - diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh deleted file mode 100644 index 44ee99f..0000000 --- a/libs/rs/scriptc/rs_graphics.rsh +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_graphics.rsh - * \brief Renderscript graphics API - * - * A set of graphics functions used by Renderscript. - * - */ -#ifndef __RS_GRAPHICS_RSH__ -#define __RS_GRAPHICS_RSH__ - -#include "rs_mesh.rsh" -#include "rs_program.rsh" - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) -/** - * Set the color target used for all subsequent rendering calls - * @param colorTarget - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindColorTarget(rs_allocation colorTarget, uint slot); - -/** - * Clear the previously set color target - * @param slot - */ -extern void __attribute__((overloadable)) - rsgClearColorTarget(uint slot); - -/** - * Set the depth target used for all subsequent rendering calls - * @param depthTarget - */ -extern void __attribute__((overloadable)) - rsgBindDepthTarget(rs_allocation depthTarget); - -/** - * Clear the previously set depth target - */ -extern void __attribute__((overloadable)) - rsgClearDepthTarget(void); - -/** - * Clear all color and depth targets and resume rendering into - * the framebuffer - */ -extern void __attribute__((overloadable)) - rsgClearAllRenderTargets(void); - -/** - * Force Renderscript to finish all rendering commands - */ -extern uint __attribute__((overloadable)) - rsgFinish(void); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -/** - * Bind a new ProgramFragment to the rendering context. - * - * @param pf - */ -extern void __attribute__((overloadable)) - rsgBindProgramFragment(rs_program_fragment pf); - -/** - * Bind a new ProgramStore to the rendering context. - * - * @param ps - */ -extern void __attribute__((overloadable)) - rsgBindProgramStore(rs_program_store ps); - -/** - * Bind a new ProgramVertex to the rendering context. - * - * @param pv - */ -extern void __attribute__((overloadable)) - rsgBindProgramVertex(rs_program_vertex pv); - -/** - * Bind a new ProgramRaster to the rendering context. - * - * @param pr - */ -extern void __attribute__((overloadable)) - rsgBindProgramRaster(rs_program_raster pr); - -/** - * Bind a new Sampler object to a ProgramFragment. The sampler will - * operate on the texture bound at the matching slot. - * - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindSampler(rs_program_fragment, uint slot, rs_sampler); - -/** - * Bind a new Allocation object to a ProgramFragment. The - * Allocation must be a valid texture for the Program. The sampling - * of the texture will be controled by the Sampler bound at the - * matching slot. - * - * @param slot - */ -extern void __attribute__((overloadable)) - rsgBindTexture(rs_program_fragment, uint slot, rs_allocation); - -/** - * Load the projection matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param proj projection matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj); -/** - * Load the model matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param model model matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model); -/** - * Load the texture matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param tex texture matrix - */ -extern void __attribute__((overloadable)) - rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex); -/** - * Get the projection matrix for a currently bound fixed function - * vertex program. Calling this function with a custom vertex shader - * would result in an error. - * @param proj matrix to store the current projection matrix into - */ -extern void __attribute__((overloadable)) - rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj); - -/** - * Set the constant color for a fixed function emulation program. - * - * @param pf - * @param r - * @param g - * @param b - * @param a - */ -extern void __attribute__((overloadable)) - rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a); - -/** - * Bind a new Allocation object to a ProgramFragment. The - * Allocation must be a valid constant input for the Program. - * - * @param ps program object - * @param slot index of the constant buffer on the program - * @param c constants to bind - */ -extern void __attribute__((overloadable)) - rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c); - -/** - * Bind a new Allocation object to a ProgramVertex. The - * Allocation must be a valid constant input for the Program. - * - * @param pv program object - * @param slot index of the constant buffer on the program - * @param c constants to bind - */ -extern void __attribute__((overloadable)) - rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c); - -/** - * Get the width of the current rendering surface. - * - * @return uint - */ -extern uint __attribute__((overloadable)) - rsgGetWidth(void); - -/** - * Get the height of the current rendering surface. - * - * @return uint - */ -extern uint __attribute__((overloadable)) - rsgGetHeight(void); - - -/** - * Sync the contents of an allocation from its SCRIPT memory space to its HW - * memory spaces. - * - * @param alloc - */ -extern void __attribute__((overloadable)) - rsgAllocationSyncAll(rs_allocation alloc); - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) - -/** - * Sync the contents of an allocation from memory space - * specified by source. - * - * @param alloc - * @param source - */ -extern void __attribute__((overloadable)) - rsgAllocationSyncAll(rs_allocation alloc, - rs_allocation_usage_type source); - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -/** - * Low performance utility function for drawing a simple rectangle. Not - * intended for drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param x2 - * @param y2 - * @param z - */ -extern void __attribute__((overloadable)) - rsgDrawRect(float x1, float y1, float x2, float y2, float z); - -/** - * Low performance utility function for drawing a simple quad. Not intended for - * drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param z1 - * @param x2 - * @param y2 - * @param z2 - * @param x3 - * @param y3 - * @param z3 - * @param x4 - * @param y4 - * @param z4 - */ -extern void __attribute__((overloadable)) - rsgDrawQuad(float x1, float y1, float z1, - float x2, float y2, float z2, - float x3, float y3, float z3, - float x4, float y4, float z4); - - -/** - * Low performance utility function for drawing a textured quad. Not intended - * for drawing large quantities of geometry. - * - * @param x1 - * @param y1 - * @param z1 - * @param u1 - * @param v1 - * @param x2 - * @param y2 - * @param z2 - * @param u2 - * @param v2 - * @param x3 - * @param y3 - * @param z3 - * @param u3 - * @param v3 - * @param x4 - * @param y4 - * @param z4 - * @param u4 - * @param v4 - */ -extern void __attribute__((overloadable)) - rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, - float x2, float y2, float z2, float u2, float v2, - float x3, float y3, float z3, float u3, float v3, - float x4, float y4, float z4, float u4, float v4); - - -/** - * Low performance function for drawing rectangles in screenspace. This - * function uses the default passthough ProgramVertex. Any bound ProgramVertex - * is ignored. This function has considerable overhead and should not be used - * for drawing in shipping applications. - * - * @param x - * @param y - * @param z - * @param w - * @param h - */ -extern void __attribute__((overloadable)) - rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h); - -extern void __attribute__((overloadable)) - rsgDrawPath(rs_path p); - -/** - * Draw a mesh using the current context state. The whole mesh is - * rendered. - * - * @param ism - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism); -/** - * Draw part of a mesh using the current context state. - * @param ism mesh object to render - * @param primitiveIndex for meshes that contain multiple primitive groups - * this parameter specifies the index of the group to draw. - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism, uint primitiveIndex); -/** - * Draw specified index range of part of a mesh using the current context state. - * @param ism mesh object to render - * @param primitiveIndex for meshes that contain multiple primitive groups - * this parameter specifies the index of the group to draw. - * @param start starting index in the range - * @param len number of indices to draw - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len); - -/** - * Clears the rendering surface to the specified color. - * - * @param r - * @param g - * @param b - * @param a - */ -extern void __attribute__((overloadable)) - rsgClearColor(float r, float g, float b, float a); - -/** - * Clears the depth suface to the specified value. - */ -extern void __attribute__((overloadable)) - rsgClearDepth(float value); -/** - * Draws text given a string and location - */ -extern void __attribute__((overloadable)) - rsgDrawText(const char *, int x, int y); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsgDrawText(rs_allocation, int x, int y); -/** - * Binds the font object to be used for all subsequent font rendering calls - * @param font object to bind - */ -extern void __attribute__((overloadable)) - rsgBindFont(rs_font font); -/** - * Sets the font color for all subsequent rendering calls - * @param r red component - * @param g green component - * @param b blue component - * @param a alpha component - */ -extern void __attribute__((overloadable)) - rsgFontColor(float r, float g, float b, float a); -/** - * Returns the bounding box of the text relative to (0, 0) - * Any of left, right, top, bottom could be NULL - */ -extern void __attribute__((overloadable)) - rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom); -/** - * Computes an axis aligned bounding box of a mesh object - */ -extern void __attribute__((overloadable)) - rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ, - float *maxX, float *maxY, float *maxZ); -/** - * \overload - */ -__inline__ static void __attribute__((overloadable, always_inline)) -rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) { - float x1, y1, z1, x2, y2, z2; - rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2); - bBoxMin->x = x1; - bBoxMin->y = y1; - bBoxMin->z = z1; - bBoxMax->x = x2; - bBoxMax->y = y2; - bBoxMax->z = z2; -} - -#endif - diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh deleted file mode 100644 index 8117ca8..0000000 --- a/libs/rs/scriptc/rs_math.rsh +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_math.rsh - * \brief todo-jsams - * - * todo-jsams - * - */ - -#ifndef __RS_MATH_RSH__ -#define __RS_MATH_RSH__ - - -/** - * Return a random value between 0 (or min_value) and max_malue. - */ -extern int __attribute__((overloadable)) - rsRand(int max_value); -/** - * \overload - */ -extern int __attribute__((overloadable)) - rsRand(int min_value, int max_value); -/** - * \overload - */ -extern float __attribute__((overloadable)) - rsRand(float max_value); -/** - * \overload - */ -extern float __attribute__((overloadable)) - rsRand(float min_value, float max_value); - -/** - * Returns the fractional part of a float - */ -extern float __attribute__((overloadable)) - rsFrac(float); - - -///////////////////////////////////////////////////// -// int ops -///////////////////////////////////////////////////// - -/** - * Clamp the value amount between low and high. - * - * @param amount The value to clamp - * @param low - * @param high - */ -_RS_RUNTIME uint __attribute__((overloadable, always_inline)) rsClamp(uint amount, uint low, uint high); - -/** - * \overload - */ -_RS_RUNTIME int __attribute__((overloadable, always_inline)) rsClamp(int amount, int low, int high); -/** - * \overload - */ -_RS_RUNTIME ushort __attribute__((overloadable, always_inline)) rsClamp(ushort amount, ushort low, ushort high); -/** - * \overload - */ -_RS_RUNTIME short __attribute__((overloadable, always_inline)) rsClamp(short amount, short low, short high); -/** - * \overload - */ -_RS_RUNTIME uchar __attribute__((overloadable, always_inline)) rsClamp(uchar amount, uchar low, uchar high); -/** - * \overload - */ -_RS_RUNTIME char __attribute__((overloadable, always_inline)) rsClamp(char amount, char low, char high); - - -/** - * Computes 6 frustum planes from the view projection matrix - * @param viewProj matrix to extract planes from - * @param left plane - * @param right plane - * @param top plane - * @param bottom plane - * @param near plane - * @param far plane - */ -__inline__ static void __attribute__((overloadable, always_inline)) -rsExtractFrustumPlanes(const rs_matrix4x4 *viewProj, - float4 *left, float4 *right, - float4 *top, float4 *bottom, - float4 *near, float4 *far) { - // x y z w = a b c d in the plane equation - left->x = viewProj->m[3] + viewProj->m[0]; - left->y = viewProj->m[7] + viewProj->m[4]; - left->z = viewProj->m[11] + viewProj->m[8]; - left->w = viewProj->m[15] + viewProj->m[12]; - - right->x = viewProj->m[3] - viewProj->m[0]; - right->y = viewProj->m[7] - viewProj->m[4]; - right->z = viewProj->m[11] - viewProj->m[8]; - right->w = viewProj->m[15] - viewProj->m[12]; - - top->x = viewProj->m[3] - viewProj->m[1]; - top->y = viewProj->m[7] - viewProj->m[5]; - top->z = viewProj->m[11] - viewProj->m[9]; - top->w = viewProj->m[15] - viewProj->m[13]; - - bottom->x = viewProj->m[3] + viewProj->m[1]; - bottom->y = viewProj->m[7] + viewProj->m[5]; - bottom->z = viewProj->m[11] + viewProj->m[9]; - bottom->w = viewProj->m[15] + viewProj->m[13]; - - near->x = viewProj->m[3] + viewProj->m[2]; - near->y = viewProj->m[7] + viewProj->m[6]; - near->z = viewProj->m[11] + viewProj->m[10]; - near->w = viewProj->m[15] + viewProj->m[14]; - - far->x = viewProj->m[3] - viewProj->m[2]; - far->y = viewProj->m[7] - viewProj->m[6]; - far->z = viewProj->m[11] - viewProj->m[10]; - far->w = viewProj->m[15] - viewProj->m[14]; - - float len = length(left->xyz); - *left /= len; - len = length(right->xyz); - *right /= len; - len = length(top->xyz); - *top /= len; - len = length(bottom->xyz); - *bottom /= len; - len = length(near->xyz); - *near /= len; - len = length(far->xyz); - *far /= len; -} - -/** - * Checks if a sphere is withing the 6 frustum planes - * @param sphere float4 representing the sphere - * @param left plane - * @param right plane - * @param top plane - * @param bottom plane - * @param near plane - * @param far plane - */ -__inline__ static bool __attribute__((overloadable, always_inline)) -rsIsSphereInFrustum(float4 *sphere, - float4 *left, float4 *right, - float4 *top, float4 *bottom, - float4 *near, float4 *far) { - - float distToCenter = dot(left->xyz, sphere->xyz) + left->w; - if (distToCenter < -sphere->w) { - return false; - } - distToCenter = dot(right->xyz, sphere->xyz) + right->w; - if (distToCenter < -sphere->w) { - return false; - } - distToCenter = dot(top->xyz, sphere->xyz) + top->w; - if (distToCenter < -sphere->w) { - return false; - } - distToCenter = dot(bottom->xyz, sphere->xyz) + bottom->w; - if (distToCenter < -sphere->w) { - return false; - } - distToCenter = dot(near->xyz, sphere->xyz) + near->w; - if (distToCenter < -sphere->w) { - return false; - } - distToCenter = dot(far->xyz, sphere->xyz) + far->w; - if (distToCenter < -sphere->w) { - return false; - } - return true; -} - - -/** - * Pack floating point (0-1) RGB values into a uchar4. The alpha component is - * set to 255 (1.0). - * - * @param r - * @param g - * @param b - * - * @return uchar4 - */ -_RS_RUNTIME uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b); - -/** - * Pack floating point (0-1) RGBA values into a uchar4. - * - * @param r - * @param g - * @param b - * @param a - * - * @return uchar4 - */ -_RS_RUNTIME uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a); - -/** - * Pack floating point (0-1) RGB values into a uchar4. The alpha component is - * set to 255 (1.0). - * - * @param color - * - * @return uchar4 - */ -_RS_RUNTIME uchar4 __attribute__((overloadable)) rsPackColorTo8888(float3 color); - -/** - * Pack floating point (0-1) RGBA values into a uchar4. - * - * @param color - * - * @return uchar4 - */ -_RS_RUNTIME uchar4 __attribute__((overloadable)) rsPackColorTo8888(float4 color); - -/** - * Unpack a uchar4 color to float4. The resulting float range will be (0-1). - * - * @param c - * - * @return float4 - */ -_RS_RUNTIME float4 rsUnpackColor8888(uchar4 c); - - -#endif diff --git a/libs/rs/scriptc/rs_matrix.rsh b/libs/rs/scriptc/rs_matrix.rsh deleted file mode 100644 index ebff7f4..0000000 --- a/libs/rs/scriptc/rs_matrix.rsh +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_matrix.rsh - * \brief Matrix routines - * - * - */ - -#ifndef __RS_MATRIX_RSH__ -#define __RS_MATRIX_RSH__ - -/** - * Set one element of a matrix. - * - * @param m The matrix to be set - * @param row - * @param col - * @param v - * - * @return void - */ -_RS_RUNTIME void __attribute__((overloadable)) -rsMatrixSet(rs_matrix4x4 *m, uint32_t row, uint32_t col, float v); -/** - * \overload - */ -_RS_RUNTIME void __attribute__((overloadable)) -rsMatrixSet(rs_matrix3x3 *m, uint32_t row, uint32_t col, float v); -/** - * \overload - */ -_RS_RUNTIME void __attribute__((overloadable)) -rsMatrixSet(rs_matrix2x2 *m, uint32_t row, uint32_t col, float v); - -/** - * Get one element of a matrix. - * - * @param m The matrix to read from - * @param row - * @param col - * - * @return float - */ -_RS_RUNTIME float __attribute__((overloadable)) -rsMatrixGet(const rs_matrix4x4 *m, uint32_t row, uint32_t col); -/** - * \overload - */ -_RS_RUNTIME float __attribute__((overloadable)) -rsMatrixGet(const rs_matrix3x3 *m, uint32_t row, uint32_t col); -/** - * \overload - */ -_RS_RUNTIME float __attribute__((overloadable)) -rsMatrixGet(const rs_matrix2x2 *m, uint32_t row, uint32_t col); - -/** - * Set the elements of a matrix to the identity matrix. - * - * @param m - */ -extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix4x4 *m); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix3x3 *m); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix2x2 *m); - -/** - * Set the elements of a matrix from an array of floats. - * - * @param m - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const float *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const float *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const float *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix4x4 *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix3x3 *v); - -/** - * Set the elements of a matrix from another matrix. - * - * @param m - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix2x2 *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const rs_matrix3x3 *v); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const rs_matrix2x2 *v); - -/** - * Load a rotation matrix. - * - * @param m - * @param rot - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixLoadRotate(rs_matrix4x4 *m, float rot, float x, float y, float z); - -/** - * Load a scale matrix. - * - * @param m - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z); - -/** - * Load a translation matrix. - * - * @param m - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z); - -/** - * Multiply two matrix (lhs, rhs) and place the result in m. - * - * @param m - * @param lhs - * @param rhs - */ -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs); -/** - * \overload - */ -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs); -/** - * \overload - */ -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs); - -/** - * Multiply the matrix m by rhs and place the result back into m. - * - * @param m (lhs) - * @param rhs - */ -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *rhs); -/** - * \overload - */ -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *rhs); -/** - * \overload - */ -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *rhs); - -/** - * Multiple matrix m with a rotation matrix - * - * @param m - * @param rot - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z); - -/** - * Multiple matrix m with a scale matrix - * - * @param m - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixScale(rs_matrix4x4 *m, float x, float y, float z); - -/** - * Multiple matrix m with a translation matrix - * - * @param m - * @param x - * @param y - * @param z - */ -extern void __attribute__((overloadable)) -rsMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z); - -/** - * Load an Ortho projection matrix constructed from the 6 planes - * - * @param m - * @param left - * @param right - * @param bottom - * @param top - * @param near - * @param far - */ -extern void __attribute__((overloadable)) -rsMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far); - -/** - * Load an Frustum projection matrix constructed from the 6 planes - * - * @param m - * @param left - * @param right - * @param bottom - * @param top - * @param near - * @param far - */ -extern void __attribute__((overloadable)) -rsMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far); - -/** - * Load an perspective projection matrix constructed from the 6 planes - * - * @param m - * @param fovy Field of view, in degrees along the Y axis. - * @param aspect Ratio of x / y. - * @param near - * @param far - */ -extern void __attribute__((overloadable)) -rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far); - -#if !defined(RS_VERSION) || (RS_VERSION < 14) -/** - * Multiply a vector by a matrix and return the result vector. - * API version 10-13 - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float4 in); - -/** - * \overload - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float3 in); - -/** - * \overload - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float2 in); - -/** - * \overload - */ -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, float3 in); - -/** - * \overload - */ -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, float2 in); - -/** - * \overload - */ -_RS_RUNTIME float2 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix2x2 *m, float2 in); -#else -/** - * Multiply a vector by a matrix and return the result vector. - * API version 14+ - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix4x4 *m, float4 in); - -/** - * \overload - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix4x4 *m, float3 in); - -/** - * \overload - */ -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix4x4 *m, float2 in); - -/** - * \overload - */ -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix3x3 *m, float3 in); - -/** - * \overload - */ -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix3x3 *m, float2 in); - -/** - * \overload - */ -_RS_RUNTIME float2 __attribute__((overloadable)) -rsMatrixMultiply(const rs_matrix2x2 *m, float2 in); -#endif - - -/** - * Returns true if the matrix was successfully inversed - * - * @param m - */ -extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m); - -/** - * Returns true if the matrix was successfully inversed and transposed. - * - * @param m - */ -extern bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m); - -/** - * Transpose the matrix m. - * - * @param m - */ -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix3x3 *m); -/** - * \overload - */ -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix2x2 *m); - - -#endif diff --git a/libs/rs/scriptc/rs_mesh.rsh b/libs/rs/scriptc/rs_mesh.rsh deleted file mode 100644 index 87ffd33..0000000 --- a/libs/rs/scriptc/rs_mesh.rsh +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_mesh.rsh - * \brief Mesh routines - * - * - */ - -#ifndef __RS_MESH_RSH__ -#define __RS_MESH_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * @param m mesh to get data from - * @return number of allocations in the mesh that contain vertex - * data - */ -extern uint32_t __attribute__((overloadable)) - rsgMeshGetVertexAllocationCount(rs_mesh m); - -/** - * @param m mesh to get data from - * @return number of primitive groups in the mesh. This would - * include simple primitives as well as allocations - * containing index data - */ -extern uint32_t __attribute__((overloadable)) - rsgMeshGetPrimitiveCount(rs_mesh m); - -/** - * @param m mesh to get data from - * @param index index of the vertex allocation - * @return allocation containing vertex data - */ -extern rs_allocation __attribute__((overloadable)) - rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index); - -/** - * @param m mesh to get data from - * @param index index of the index allocation - * @return allocation containing index data - */ -extern rs_allocation __attribute__((overloadable)) - rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index); - -/** - * @param m mesh to get data from - * @param index index of the primitive - * @return primitive describing how the mesh is rendered - */ -extern rs_primitive __attribute__((overloadable)) - rsgMeshGetPrimitive(rs_mesh m, uint32_t index); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_MESH_RSH__ - diff --git a/libs/rs/scriptc/rs_object.rsh b/libs/rs/scriptc/rs_object.rsh deleted file mode 100644 index 1fc3f83..0000000 --- a/libs/rs/scriptc/rs_object.rsh +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_object.rsh - * \brief Object routines - * - * - */ - -#ifndef __RS_OBJECT_RSH__ -#define __RS_OBJECT_RSH__ - - -/** - * Copy reference to the specified object. - * - * @param dst - * @param src - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_element *dst, rs_element src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_type *dst, rs_type src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_allocation *dst, rs_allocation src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_sampler *dst, rs_sampler src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_script *dst, rs_script src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_path *dst, rs_path src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_mesh *dst, rs_mesh src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_program_fragment *dst, rs_program_fragment src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_program_vertex *dst, rs_program_vertex src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_program_raster *dst, rs_program_raster src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_program_store *dst, rs_program_store src); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_font *dst, rs_font src); - -/** - * Sets the object to NULL. - * - * @return bool - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_element *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_type *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_allocation *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_sampler *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_script *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_path *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_mesh *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_program_fragment *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_program_vertex *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_program_raster *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_program_store *dst); -/** - * \overload - */ -extern void __attribute__((overloadable)) - rsClearObject(rs_font *dst); - - - -/** - * Tests if the object is valid. Returns true if the object is valid, false if - * it is NULL. - * - * @return bool - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_element); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_type); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_allocation); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_sampler); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_script); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_path); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_mesh); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_fragment); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_vertex); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_raster); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_store); -/** - * \overload - */ -extern bool __attribute__((overloadable)) - rsIsObject(rs_font); - -#endif diff --git a/libs/rs/scriptc/rs_program.rsh b/libs/rs/scriptc/rs_program.rsh deleted file mode 100644 index 6a9929e..0000000 --- a/libs/rs/scriptc/rs_program.rsh +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_program.rsh - * \brief Program object routines - * - * - */ - -#ifndef __RS_PROGRAM_RSH__ -#define __RS_PROGRAM_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * @hide - * Get program store depth function - * - * @param ps - */ -extern rs_depth_func __attribute__((overloadable)) - rsgProgramStoreGetDepthFunc(rs_program_store ps); - -/** - * @hide - * Get program store depth mask - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetDepthMask(rs_program_store ps); -/** - * @hide - * Get program store red component color mask - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetColorMaskR(rs_program_store ps); - -/** - * @hide - * Get program store green component color mask - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetColorMaskG(rs_program_store ps); - -/** - * @hide - * Get program store blur component color mask - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetColorMaskB(rs_program_store ps); - -/** - * @hide - * Get program store alpha component color mask - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetColorMaskA(rs_program_store ps); - -/** - * @hide - * Get program store blend source function - * - * @param ps - */ -extern rs_blend_src_func __attribute__((overloadable)) - rsgProgramStoreGetBlendSrcFunc(rs_program_store ps); - -/** - * @hide - * Get program store blend destination function - * - * @param ps - */ -extern rs_blend_dst_func __attribute__((overloadable)) - rsgProgramStoreGetBlendDstFunc(rs_program_store ps); - -/** - * @hide - * Get program store dither state - * - * @param ps - */ -extern bool __attribute__((overloadable)) - rsgProgramStoreGetDitherEnabled(rs_program_store ps); - -/** - * @hide - * Get program raster point sprite state - * - * @param pr - */ -extern bool __attribute__((overloadable)) - rsgProgramRasterGetPointSpriteEnabled(rs_program_raster pr); - -/** - * @hide - * Get program raster cull mode - * - * @param pr - */ -extern rs_cull_mode __attribute__((overloadable)) - rsgProgramRasterGetCullMode(rs_program_raster pr); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_PROGRAM_RSH__ - diff --git a/libs/rs/scriptc/rs_quaternion.rsh b/libs/rs/scriptc/rs_quaternion.rsh deleted file mode 100644 index 4e08d2f..0000000 --- a/libs/rs/scriptc/rs_quaternion.rsh +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_quaternion.rsh - * \brief Quaternion routines - * - * - */ - -#ifndef __RS_QUATERNION_RSH__ -#define __RS_QUATERNION_RSH__ - - -/** - * Set the quaternion components - * @param w component - * @param x component - * @param y component - * @param z component - */ -static void __attribute__((overloadable)) -rsQuaternionSet(rs_quaternion *q, float w, float x, float y, float z) { - q->w = w; - q->x = x; - q->y = y; - q->z = z; -} - -/** - * Set the quaternion from another quaternion - * @param q destination quaternion - * @param rhs source quaternion - */ -static void __attribute__((overloadable)) -rsQuaternionSet(rs_quaternion *q, const rs_quaternion *rhs) { - q->w = rhs->w; - q->x = rhs->x; - q->y = rhs->y; - q->z = rhs->z; -} - -/** - * Multiply quaternion by a scalar - * @param q quaternion to multiply - * @param s scalar - */ -static void __attribute__((overloadable)) -rsQuaternionMultiply(rs_quaternion *q, float s) { - q->w *= s; - q->x *= s; - q->y *= s; - q->z *= s; -} - -/** - * Add two quaternions - * @param q destination quaternion to add to - * @param rsh right hand side quaternion to add - */ -static void -rsQuaternionAdd(rs_quaternion *q, const rs_quaternion *rhs) { - q->w *= rhs->w; - q->x *= rhs->x; - q->y *= rhs->y; - q->z *= rhs->z; -} - -/** - * Loads a quaternion that represents a rotation about an arbitrary unit vector - * @param q quaternion to set - * @param rot angle to rotate by - * @param x component of a vector - * @param y component of a vector - * @param x component of a vector - */ -static void -rsQuaternionLoadRotateUnit(rs_quaternion *q, float rot, float x, float y, float z) { - rot *= (float)(M_PI / 180.0f) * 0.5f; - float c = cos(rot); - float s = sin(rot); - - q->w = c; - q->x = x * s; - q->y = y * s; - q->z = z * s; -} - -/** - * Loads a quaternion that represents a rotation about an arbitrary vector - * (doesn't have to be unit) - * @param q quaternion to set - * @param rot angle to rotate by - * @param x component of a vector - * @param y component of a vector - * @param x component of a vector - */ -static void -rsQuaternionLoadRotate(rs_quaternion *q, float rot, float x, float y, float z) { - const float len = x*x + y*y + z*z; - if (len != 1) { - const float recipLen = 1.f / sqrt(len); - x *= recipLen; - y *= recipLen; - z *= recipLen; - } - rsQuaternionLoadRotateUnit(q, rot, x, y, z); -} - -/** - * Conjugates the quaternion - * @param q quaternion to conjugate - */ -static void -rsQuaternionConjugate(rs_quaternion *q) { - q->x = -q->x; - q->y = -q->y; - q->z = -q->z; -} - -/** - * Dot product of two quaternions - * @param q0 first quaternion - * @param q1 second quaternion - * @return dot product between q0 and q1 - */ -static float -rsQuaternionDot(const rs_quaternion *q0, const rs_quaternion *q1) { - return q0->w*q1->w + q0->x*q1->x + q0->y*q1->y + q0->z*q1->z; -} - -/** - * Normalizes the quaternion - * @param q quaternion to normalize - */ -static void -rsQuaternionNormalize(rs_quaternion *q) { - const float len = rsQuaternionDot(q, q); - if (len != 1) { - const float recipLen = 1.f / sqrt(len); - rsQuaternionMultiply(q, recipLen); - } -} - -/** - * Multiply quaternion by another quaternion - * @param q destination quaternion - * @param rhs right hand side quaternion to multiply by - */ -static void __attribute__((overloadable)) -rsQuaternionMultiply(rs_quaternion *q, const rs_quaternion *rhs) { - rs_quaternion qtmp; - rsQuaternionSet(&qtmp, q); - - q->w = qtmp.w*rhs->w - qtmp.x*rhs->x - qtmp.y*rhs->y - qtmp.z*rhs->z; - q->x = qtmp.w*rhs->x + qtmp.x*rhs->w + qtmp.y*rhs->z - qtmp.z*rhs->y; - q->y = qtmp.w*rhs->y + qtmp.y*rhs->w + qtmp.z*rhs->x - qtmp.x*rhs->z; - q->z = qtmp.w*rhs->z + qtmp.z*rhs->w + qtmp.x*rhs->y - qtmp.y*rhs->x; - rsQuaternionNormalize(q); -} - -/** - * Performs spherical linear interpolation between two quaternions - * @param q result quaternion from interpolation - * @param q0 first param - * @param q1 second param - * @param t how much to interpolate by - */ -static void -rsQuaternionSlerp(rs_quaternion *q, const rs_quaternion *q0, const rs_quaternion *q1, float t) { - if (t <= 0.0f) { - rsQuaternionSet(q, q0); - return; - } - if (t >= 1.0f) { - rsQuaternionSet(q, q1); - return; - } - - rs_quaternion tempq0, tempq1; - rsQuaternionSet(&tempq0, q0); - rsQuaternionSet(&tempq1, q1); - - float angle = rsQuaternionDot(q0, q1); - if (angle < 0) { - rsQuaternionMultiply(&tempq0, -1.0f); - angle *= -1.0f; - } - - float scale, invScale; - if (angle + 1.0f > 0.05f) { - if (1.0f - angle >= 0.05f) { - float theta = acos(angle); - float invSinTheta = 1.0f / sin(theta); - scale = sin(theta * (1.0f - t)) * invSinTheta; - invScale = sin(theta * t) * invSinTheta; - } else { - scale = 1.0f - t; - invScale = t; - } - } else { - rsQuaternionSet(&tempq1, tempq0.z, -tempq0.y, tempq0.x, -tempq0.w); - scale = sin(M_PI * (0.5f - t)); - invScale = sin(M_PI * t); - } - - rsQuaternionSet(q, tempq0.w*scale + tempq1.w*invScale, tempq0.x*scale + tempq1.x*invScale, - tempq0.y*scale + tempq1.y*invScale, tempq0.z*scale + tempq1.z*invScale); -} - -/** - * Computes rotation matrix from the normalized quaternion - * @param m resulting matrix - * @param p normalized quaternion - */ -static void rsQuaternionGetMatrixUnit(rs_matrix4x4 *m, const rs_quaternion *q) { - float xx = q->x * q->x; - float xy = q->x * q->y; - float xz = q->x * q->z; - float xw = q->x * q->w; - float yy = q->y * q->y; - float yz = q->y * q->z; - float yw = q->y * q->w; - float zz = q->z * q->z; - float zw = q->z * q->w; - - m->m[0] = 1.0f - 2.0f * ( yy + zz ); - m->m[4] = 2.0f * ( xy - zw ); - m->m[8] = 2.0f * ( xz + yw ); - m->m[1] = 2.0f * ( xy + zw ); - m->m[5] = 1.0f - 2.0f * ( xx + zz ); - m->m[9] = 2.0f * ( yz - xw ); - m->m[2] = 2.0f * ( xz - yw ); - m->m[6] = 2.0f * ( yz + xw ); - m->m[10] = 1.0f - 2.0f * ( xx + yy ); - m->m[3] = m->m[7] = m->m[11] = m->m[12] = m->m[13] = m->m[14] = 0.0f; - m->m[15] = 1.0f; -} - -#endif - diff --git a/libs/rs/scriptc/rs_sampler.rsh b/libs/rs/scriptc/rs_sampler.rsh deleted file mode 100644 index c8948c7..0000000 --- a/libs/rs/scriptc/rs_sampler.rsh +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_sampler.rsh - * \brief Sampler routines - * - * - */ - -#ifndef __RS_SAMPLER_RSH__ -#define __RS_SAMPLER_RSH__ - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * @hide - * Get sampler minification value - * - * @param pr - */ -extern rs_sampler_value __attribute__((overloadable)) - rsSamplerGetMinification(rs_sampler s); - -/** - * @hide - * Get sampler magnification value - * - * @param pr - */ -extern rs_sampler_value __attribute__((overloadable)) - rsSamplerGetMagnification(rs_sampler s); - -/** - * @hide - * Get sampler wrap S value - * - * @param pr - */ -extern rs_sampler_value __attribute__((overloadable)) - rsSamplerGetWrapS(rs_sampler s); - -/** - * @hide - * Get sampler wrap T value - * - * @param pr - */ -extern rs_sampler_value __attribute__((overloadable)) - rsSamplerGetWrapT(rs_sampler s); - -/** - * @hide - * Get sampler anisotropy - * - * @param pr - */ -extern float __attribute__((overloadable)) - rsSamplerGetAnisotropy(rs_sampler s); - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_SAMPLER_RSH__ - diff --git a/libs/rs/scriptc/rs_time.rsh b/libs/rs/scriptc/rs_time.rsh deleted file mode 100644 index 60e3dee..0000000 --- a/libs/rs/scriptc/rs_time.rsh +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_time.rsh - * \brief Renderscript time routines - * - * This file contains Renderscript functions relating to time and date - * manipulation. - */ - -#ifndef __RS_TIME_RSH__ -#define __RS_TIME_RSH__ - -/** - * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on - * January 1, 1970, Coordinated Universal Time (UTC)). - */ -typedef int rs_time_t; - -/** - * Data structure for broken-down time components. - * - * tm_sec - Seconds after the minute. This ranges from 0 to 59, but possibly - * up to 60 for leap seconds. - * tm_min - Minutes after the hour. This ranges from 0 to 59. - * tm_hour - Hours past midnight. This ranges from 0 to 23. - * tm_mday - Day of the month. This ranges from 1 to 31. - * tm_mon - Months since January. This ranges from 0 to 11. - * tm_year - Years since 1900. - * tm_wday - Days since Sunday. This ranges from 0 to 6. - * tm_yday - Days since January 1. This ranges from 0 to 365. - * tm_isdst - Flag to indicate whether daylight saving time is in effect. The - * value is positive if it is in effect, zero if it is not, and - * negative if the information is not available. - */ -typedef struct { - int tm_sec; ///< seconds - int tm_min; ///< minutes - int tm_hour; ///< hours - int tm_mday; ///< day of the month - int tm_mon; ///< month - int tm_year; ///< year - int tm_wday; ///< day of the week - int tm_yday; ///< day of the year - int tm_isdst; ///< daylight savings time -} rs_tm; - -/** - * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, - * 1970). If @p timer is non-NULL, the result is also stored in the memory - * pointed to by this variable. If an error occurs, a value of -1 is returned. - * - * @param timer Location to also store the returned calendar time. - * - * @return Seconds since the Epoch. - */ -extern rs_time_t __attribute__((overloadable)) - rsTime(rs_time_t *timer); - -/** - * Converts the time specified by @p timer into broken-down time and stores it - * in @p local. This function also returns a pointer to @p local. If @p local - * is NULL, this function does nothing and returns NULL. - * - * @param local Broken-down time. - * @param timer Input time as calendar time. - * - * @return Pointer to broken-down time (same as input @p local). - */ -extern rs_tm * __attribute__((overloadable)) - rsLocaltime(rs_tm *local, const rs_time_t *timer); - -/** - * Returns the current system clock (uptime) in milliseconds. - * - * @return Uptime in milliseconds. - */ -extern int64_t __attribute__((overloadable)) - rsUptimeMillis(void); - -/** - * Returns the current system clock (uptime) in nanoseconds. - * - * @return Uptime in nanoseconds. - */ -extern int64_t __attribute__((overloadable)) - rsUptimeNanos(void); - -/** - * Returns the time in seconds since this function was last called in this - * script. - * - * @return Time in seconds. - */ -extern float __attribute__((overloadable)) - rsGetDt(void); - -#endif diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh deleted file mode 100644 index 10617d8..0000000 --- a/libs/rs/scriptc/rs_types.rsh +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** @file rs_types.rsh - * - * Define the standard Renderscript types - * - * Integers - * 8 bit: char, int8_t - * 16 bit: short, int16_t - * 32 bit: int, in32_t - * 64 bit: long, long long, int64_t - * - * Unsigned Integers - * 8 bit: uchar, uint8_t - * 16 bit: ushort, uint16_t - * 32 bit: uint, uint32_t - * 64 bit: ulong, uint64_t - * - * Floating point - * 32 bit: float - * 64 bit: double - * - * Vectors of length 2, 3, and 4 are supported for all the types above. - * - */ - -#ifndef __RS_TYPES_RSH__ -#define __RS_TYPES_RSH__ - -#define M_PI 3.14159265358979323846264338327950288f /* pi */ - -#include "stdbool.h" -/** - * 8 bit integer type - */ -typedef char int8_t; -/** - * 16 bit integer type - */ -typedef short int16_t; -/** - * 32 bit integer type - */ -typedef int int32_t; -/** - * 64 bit integer type - */ -typedef long long int64_t; -/** - * 8 bit unsigned integer type - */ -typedef unsigned char uint8_t; -/** - * 16 bit unsigned integer type - */ -typedef unsigned short uint16_t; -/** - * 32 bit unsigned integer type - */ -typedef unsigned int uint32_t; -/** - * 64 bit unsigned integer type - */ -typedef unsigned long long uint64_t; -/** - * 8 bit unsigned integer type - */ -typedef uint8_t uchar; -/** - * 16 bit unsigned integer type - */ -typedef uint16_t ushort; -/** - * 32 bit unsigned integer type - */ -typedef uint32_t uint; -/** - * Typedef for unsigned long (use for 64-bit unsigned integers) - */ -typedef uint64_t ulong; -/** - * Typedef for unsigned int - */ -typedef uint32_t size_t; -/** - * Typedef for int (use for 32-bit integers) - */ -typedef int32_t ssize_t; - -/** - * \brief Opaque handle to a Renderscript element. - * - * See: android.renderscript.Element - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element; -/** - * \brief Opaque handle to a Renderscript type. - * - * See: android.renderscript.Type - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type; -/** - * \brief Opaque handle to a Renderscript allocation. - * - * See: android.renderscript.Allocation - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation; -/** - * \brief Opaque handle to a Renderscript sampler object. - * - * See: android.renderscript.Sampler - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler; -/** - * \brief Opaque handle to a Renderscript script object. - * - * See: android.renderscript.ScriptC - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script; -/** - * \brief Opaque handle to a Renderscript mesh object. - * - * See: android.renderscript.Mesh - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh; -/** - * \brief Opaque handle to a Renderscript Path object. - * - * See: android.renderscript.Path - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_path; -/** - * \brief Opaque handle to a Renderscript ProgramFragment object. - * - * See: android.renderscript.ProgramFragment - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment; -/** - * \brief Opaque handle to a Renderscript ProgramVertex object. - * - * See: android.renderscript.ProgramVertex - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex; -/** - * \brief Opaque handle to a Renderscript ProgramRaster object. - * - * See: android.renderscript.ProgramRaster - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster; -/** - * \brief Opaque handle to a Renderscript ProgramStore object. - * - * See: android.renderscript.ProgramStore - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store; -/** - * \brief Opaque handle to a Renderscript font object. - * - * See: android.renderscript.Font - */ -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font; - -/** - * Vector version of the basic float type. - * Provides two float fields packed into a single 64 bit field with 64 bit - * alignment. - */ -typedef float float2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic float type. Provides three float fields packed - * into a single 128 bit field with 128 bit alignment. - */ -typedef float float3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic float type. - * Provides four float fields packed into a single 128 bit field with 128 bit - * alignment. - */ -typedef float float4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic double type. Provides two double fields packed - * into a single 128 bit field with 128 bit alignment. - */ -typedef double double2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic double type. Provides three double fields packed - * into a single 256 bit field with 256 bit alignment. - */ -typedef double double3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic double type. Provides four double fields packed - * into a single 256 bit field with 256 bit alignment. - */ -typedef double double4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic uchar type. Provides two uchar fields packed - * into a single 16 bit field with 16 bit alignment. - */ -typedef uchar uchar2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic uchar type. Provides three uchar fields packed - * into a single 32 bit field with 32 bit alignment. - */ -typedef uchar uchar3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic uchar type. Provides four uchar fields packed - * into a single 32 bit field with 32 bit alignment. - */ -typedef uchar uchar4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic ushort type. Provides two ushort fields packed - * into a single 32 bit field with 32 bit alignment. - */ -typedef ushort ushort2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic ushort type. Provides three ushort fields packed - * into a single 64 bit field with 64 bit alignment. - */ -typedef ushort ushort3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic ushort type. Provides four ushort fields packed - * into a single 64 bit field with 64 bit alignment. - */ -typedef ushort ushort4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic uint type. Provides two uint fields packed into a - * single 64 bit field with 64 bit alignment. - */ -typedef uint uint2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic uint type. Provides three uint fields packed into - * a single 128 bit field with 128 bit alignment. - */ -typedef uint uint3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic uint type. Provides four uint fields packed into - * a single 128 bit field with 128 bit alignment. - */ -typedef uint uint4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic ulong type. Provides two ulong fields packed into - * a single 128 bit field with 128 bit alignment. - */ -typedef ulong ulong2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic ulong type. Provides three ulong fields packed - * into a single 256 bit field with 256 bit alignment. - */ -typedef ulong ulong3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic ulong type. Provides four ulong fields packed - * into a single 256 bit field with 256 bit alignment. - */ -typedef ulong ulong4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic char type. Provides two char fields packed into a - * single 16 bit field with 16 bit alignment. - */ -typedef char char2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic char type. Provides three char fields packed into - * a single 32 bit field with 32 bit alignment. - */ -typedef char char3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic char type. Provides four char fields packed into - * a single 32 bit field with 32 bit alignment. - */ -typedef char char4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic short type. Provides two short fields packed into - * a single 32 bit field with 32 bit alignment. - */ -typedef short short2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic short type. Provides three short fields packed - * into a single 64 bit field with 64 bit alignment. - */ -typedef short short3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic short type. Provides four short fields packed - * into a single 64 bit field with 64 bit alignment. - */ -typedef short short4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic int type. Provides two int fields packed into a - * single 64 bit field with 64 bit alignment. - */ -typedef int int2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic int type. Provides three int fields packed into a - * single 128 bit field with 128 bit alignment. - */ -typedef int int3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic int type. Provides two four fields packed into a - * single 128 bit field with 128 bit alignment. - */ -typedef int int4 __attribute__((ext_vector_type(4))); - -/** - * Vector version of the basic long type. Provides two long fields packed into a - * single 128 bit field with 128 bit alignment. - */ -typedef long long2 __attribute__((ext_vector_type(2))); -/** - * Vector version of the basic long type. Provides three long fields packed into - * a single 256 bit field with 256 bit alignment. - */ -typedef long long3 __attribute__((ext_vector_type(3))); -/** - * Vector version of the basic long type. Provides four long fields packed into - * a single 256 bit field with 256 bit alignment. - */ -typedef long long4 __attribute__((ext_vector_type(4))); - -/** - * \brief 4x4 float matrix - * - * Native holder for RS matrix. Elements are stored in the array at the - * location [row*4 + col] - */ -typedef struct { - float m[16]; -} rs_matrix4x4; -/** - * \brief 3x3 float matrix - * - * Native holder for RS matrix. Elements are stored in the array at the - * location [row*3 + col] - */ -typedef struct { - float m[9]; -} rs_matrix3x3; -/** - * \brief 2x2 float matrix - * - * Native holder for RS matrix. Elements are stored in the array at the - * location [row*2 + col] - */ -typedef struct { - float m[4]; -} rs_matrix2x2; - -/** - * quaternion type for use with the quaternion functions - */ -typedef float4 rs_quaternion; - -#define RS_PACKED __attribute__((packed, aligned(4))) -#define NULL ((void *)0) - -#if (defined(RS_VERSION) && (RS_VERSION >= 14)) - -/** - * \brief Enum for selecting cube map faces - */ -typedef enum { - RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0, - RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1, - RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2, - RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3, - RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4, - RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5 -} rs_allocation_cubemap_face; - -/** - * \brief Bitfield to specify the usage types for an allocation. - * - * These values are ORed together to specify which usages or memory spaces are - * relevant to an allocation or an operation on an allocation. - */ -typedef enum { - RS_ALLOCATION_USAGE_SCRIPT = 0x0001, - RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, - RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, - RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, - RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010 -} rs_allocation_usage_type; - -#endif //defined(RS_VERSION) && (RS_VERSION >= 14) - -#if (defined(RS_VERSION) && (RS_VERSION >= 16)) - -/** - * Describes the way mesh vertex data is interpreted when rendering - * - **/ -typedef enum { - RS_PRIMITIVE_POINT = 0, - RS_PRIMITIVE_LINE = 1, - RS_PRIMITIVE_LINE_STRIP = 2, - RS_PRIMITIVE_TRIANGLE = 3, - RS_PRIMITIVE_TRIANGLE_STRIP = 4, - RS_PRIMITIVE_TRIANGLE_FAN = 5, - - RS_PRIMITIVE_INVALID = 100, -} rs_primitive; - -/** - * \brief Enumeration for possible element data types - * - * DataType represents the basic type information for a basic element. The - * naming convention follows. For numeric types it is FLOAT, - * SIGNED, or UNSIGNED followed by the _BITS where BITS is the - * size of the data. BOOLEAN is a true / false (1,0) - * represented in an 8 bit container. The UNSIGNED variants - * with multiple bit definitions are for packed graphical data - * formats and represent vectors with per vector member sizes - * which are treated as a single unit for packing and alignment - * purposes. - * - * MATRIX the three matrix types contain FLOAT_32 elements and are treated - * as 32 bits for alignment purposes. - * - * RS_* objects. 32 bit opaque handles. - */ -typedef enum { - RS_TYPE_NONE = 0, - //RS_TYPE_FLOAT_16, - RS_TYPE_FLOAT_32 = 2, - RS_TYPE_FLOAT_64 = 3, - RS_TYPE_SIGNED_8 = 4, - RS_TYPE_SIGNED_16 = 5, - RS_TYPE_SIGNED_32 = 6, - RS_TYPE_SIGNED_64 = 7, - RS_TYPE_UNSIGNED_8 = 8, - RS_TYPE_UNSIGNED_16 = 9, - RS_TYPE_UNSIGNED_32 = 10, - RS_TYPE_UNSIGNED_64 = 11, - - RS_TYPE_BOOLEAN = 12, - - RS_TYPE_UNSIGNED_5_6_5 = 13, - RS_TYPE_UNSIGNED_5_5_5_1 = 14, - RS_TYPE_UNSIGNED_4_4_4_4 = 15, - - RS_TYPE_MATRIX_4X4 = 16, - RS_TYPE_MATRIX_3X3 = 17, - RS_TYPE_MATRIX_2X2 = 18, - - RS_TYPE_ELEMENT = 1000, - RS_TYPE_TYPE = 1001, - RS_TYPE_ALLOCATION = 1002, - RS_TYPE_SAMPLER = 1003, - RS_TYPE_SCRIPT = 1004, - RS_TYPE_MESH = 1005, - RS_TYPE_PROGRAM_FRAGMENT = 1006, - RS_TYPE_PROGRAM_VERTEX = 1007, - RS_TYPE_PROGRAM_RASTER = 1008, - RS_TYPE_PROGRAM_STORE = 1009, - - RS_TYPE_INVALID = 10000, -} rs_data_type; - -/** - * \brief Enumeration for possible element data kind - * - * The special interpretation of the data if required. This is primarly - * useful for graphical data. USER indicates no special interpretation is - * expected. PIXEL is used in conjunction with the standard data types for - * representing texture formats. - */ -typedef enum { - RS_KIND_USER = 0, - - RS_KIND_PIXEL_L = 7, - RS_KIND_PIXEL_A = 8, - RS_KIND_PIXEL_LA = 9, - RS_KIND_PIXEL_RGB = 10, - RS_KIND_PIXEL_RGBA = 11, - RS_KIND_PIXEL_DEPTH = 12, - - RS_KIND_INVALID = 100, -} rs_data_kind; - -typedef enum { - RS_DEPTH_FUNC_ALWAYS = 0, - RS_DEPTH_FUNC_LESS = 1, - RS_DEPTH_FUNC_LEQUAL = 2, - RS_DEPTH_FUNC_GREATER = 3, - RS_DEPTH_FUNC_GEQUAL = 4, - RS_DEPTH_FUNC_EQUAL = 5, - RS_DEPTH_FUNC_NOTEQUAL = 6, - - RS_DEPTH_FUNC_INVALID = 100, -} rs_depth_func; - -typedef enum { - RS_BLEND_SRC_ZERO = 0, - RS_BLEND_SRC_ONE = 1, - RS_BLEND_SRC_DST_COLOR = 2, - RS_BLEND_SRC_ONE_MINUS_DST_COLOR = 3, - RS_BLEND_SRC_SRC_ALPHA = 4, - RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 5, - RS_BLEND_SRC_DST_ALPHA = 6, - RS_BLEND_SRC_ONE_MINUS_DST_ALPHA = 7, - RS_BLEND_SRC_SRC_ALPHA_SATURATE = 8, - - RS_BLEND_SRC_INVALID = 100, -} rs_blend_src_func; - -typedef enum { - RS_BLEND_DST_ZERO = 0, - RS_BLEND_DST_ONE = 1, - RS_BLEND_DST_SRC_COLOR = 2, - RS_BLEND_DST_ONE_MINUS_SRC_COLOR = 3, - RS_BLEND_DST_SRC_ALPHA = 4, - RS_BLEND_DST_ONE_MINUS_SRC_ALPHA = 5, - RS_BLEND_DST_DST_ALPHA = 6, - RS_BLEND_DST_ONE_MINUS_DST_ALPHA = 7, - - RS_BLEND_DST_INVALID = 100, -} rs_blend_dst_func; - -typedef enum { - RS_CULL_BACK = 0, - RS_CULL_FRONT = 1, - RS_CULL_NONE = 2, - - RS_CULL_INVALID = 100, -} rs_cull_mode; - -typedef enum { - RS_SAMPLER_NEAREST = 0, - RS_SAMPLER_LINEAR = 1, - RS_SAMPLER_LINEAR_MIP_LINEAR = 2, - RS_SAMPLER_WRAP = 3, - RS_SAMPLER_CLAMP = 4, - RS_SAMPLER_LINEAR_MIP_NEAREST = 5, - - RS_SAMPLER_INVALID = 100, -} rs_sampler_value; - -#endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) - -#endif // __RS_TYPES_RSH__ |