diff options
Diffstat (limited to '13/renderscript/include')
-rw-r--r-- | 13/renderscript/include/rs_cl.rsh | 449 | ||||
-rw-r--r-- | 13/renderscript/include/rs_core.rsh | 560 | ||||
-rw-r--r-- | 13/renderscript/include/rs_graphics.rsh | 252 | ||||
-rw-r--r-- | 13/renderscript/include/rs_math.rsh | 209 | ||||
-rw-r--r-- | 13/renderscript/include/rs_time.rsh | 36 | ||||
-rw-r--r-- | 13/renderscript/include/rs_types.rsh | 80 |
6 files changed, 0 insertions, 1586 deletions
diff --git a/13/renderscript/include/rs_cl.rsh b/13/renderscript/include/rs_cl.rsh deleted file mode 100644 index d78e62e..0000000 --- a/13/renderscript/include/rs_cl.rsh +++ /dev/null @@ -1,449 +0,0 @@ -#ifndef __RS_CL_RSH__ -#define __RS_CL_RSH__ - -#define _RS_RUNTIME extern - -// 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); - - -extern float __attribute__((overloadable)) acos(float); -FN_FUNC_FN(acos) - -extern float __attribute__((overloadable)) acosh(float); -FN_FUNC_FN(acosh) - -_RS_RUNTIME float __attribute__((overloadable)) acospi(float v); - - -FN_FUNC_FN(acospi) - -extern float __attribute__((overloadable)) asin(float); -FN_FUNC_FN(asin) - -extern float __attribute__((overloadable)) asinh(float); -FN_FUNC_FN(asinh) - - -_RS_RUNTIME float __attribute__((overloadable)) asinpi(float v); -FN_FUNC_FN(asinpi) - -extern float __attribute__((overloadable)) atan(float); -FN_FUNC_FN(atan) - -extern float __attribute__((overloadable)) atan2(float, float); -FN_FUNC_FN_FN(atan2) - -extern float __attribute__((overloadable)) atanh(float); -FN_FUNC_FN(atanh) - - -_RS_RUNTIME float __attribute__((overloadable)) atanpi(float v); -FN_FUNC_FN(atanpi) - - -_RS_RUNTIME float __attribute__((overloadable)) atan2pi(float y, float x); -FN_FUNC_FN_FN(atan2pi) - -extern float __attribute__((overloadable)) cbrt(float); -FN_FUNC_FN(cbrt) - -extern float __attribute__((overloadable)) ceil(float); -FN_FUNC_FN(ceil) - -extern float __attribute__((overloadable)) copysign(float, float); -FN_FUNC_FN_FN(copysign) - -extern float __attribute__((overloadable)) cos(float); -FN_FUNC_FN(cos) - -extern float __attribute__((overloadable)) cosh(float); -FN_FUNC_FN(cosh) - - -_RS_RUNTIME float __attribute__((overloadable)) cospi(float v); -FN_FUNC_FN(cospi) - -extern float __attribute__((overloadable)) erfc(float); -FN_FUNC_FN(erfc) - -extern float __attribute__((overloadable)) erf(float); -FN_FUNC_FN(erf) - -extern float __attribute__((overloadable)) exp(float); -FN_FUNC_FN(exp) - -extern float __attribute__((overloadable)) exp2(float); -FN_FUNC_FN(exp2) - -extern float __attribute__((overloadable)) pow(float, float); - -_RS_RUNTIME float __attribute__((overloadable)) exp10(float v); -FN_FUNC_FN(exp10) - -extern float __attribute__((overloadable)) expm1(float); -FN_FUNC_FN(expm1) - -extern float __attribute__((overloadable)) fabs(float); -FN_FUNC_FN(fabs) - -extern float __attribute__((overloadable)) fdim(float, float); -FN_FUNC_FN_FN(fdim) - -extern float __attribute__((overloadable)) floor(float); -FN_FUNC_FN(floor) - -extern float __attribute__((overloadable)) fma(float, float, float); -FN_FUNC_FN_FN_FN(fma) - -extern float __attribute__((overloadable)) fmax(float, float); -FN_FUNC_FN_FN(fmax); -FN_FUNC_FN_F(fmax); - -extern float __attribute__((overloadable)) fmin(float, float); -FN_FUNC_FN_FN(fmin); -FN_FUNC_FN_F(fmin); - -extern float __attribute__((overloadable)) fmod(float, float); -FN_FUNC_FN_FN(fmod) - - -_RS_RUNTIME float __attribute__((overloadable)) fract(float v, float *iptr); -FN_FUNC_FN_PFN(fract) - -extern float __attribute__((overloadable)) frexp(float, int *); -FN_FUNC_FN_PIN(frexp) - -extern float __attribute__((overloadable)) hypot(float, float); -FN_FUNC_FN_FN(hypot) - -extern int __attribute__((overloadable)) ilogb(float); -IN_FUNC_FN(ilogb) - -extern float __attribute__((overloadable)) ldexp(float, int); -FN_FUNC_FN_IN(ldexp) -FN_FUNC_FN_I(ldexp) - -extern float __attribute__((overloadable)) lgamma(float); -FN_FUNC_FN(lgamma) -extern float __attribute__((overloadable)) lgamma(float, int*); -FN_FUNC_FN_PIN(lgamma) - -extern float __attribute__((overloadable)) log(float); -FN_FUNC_FN(log) - - -extern float __attribute__((overloadable)) log10(float); -FN_FUNC_FN(log10) - - -_RS_RUNTIME float __attribute__((overloadable)) log2(float v); -FN_FUNC_FN(log2) - -extern float __attribute__((overloadable)) log1p(float); -FN_FUNC_FN(log1p) - -extern float __attribute__((overloadable)) logb(float); -FN_FUNC_FN(logb) - -extern float __attribute__((overloadable)) mad(float, float, float); -FN_FUNC_FN_FN_FN(mad) - -extern float __attribute__((overloadable)) modf(float, float *); -FN_FUNC_FN_PFN(modf); - -//extern float __attribute__((overloadable)) nan(uint); - -extern float __attribute__((overloadable)) nextafter(float, float); -FN_FUNC_FN_FN(nextafter) - -FN_FUNC_FN_FN(pow) - -_RS_RUNTIME float __attribute__((overloadable)) pown(float v, int p); -_RS_RUNTIME float2 __attribute__((overloadable)) pown(float2 v, int2 p); -_RS_RUNTIME float3 __attribute__((overloadable)) pown(float3 v, int3 p); -_RS_RUNTIME float4 __attribute__((overloadable)) pown(float4 v, int4 p); - -_RS_RUNTIME float __attribute__((overloadable)) powr(float v, float p); -_RS_RUNTIME float2 __attribute__((overloadable)) powr(float2 v, float2 p); -_RS_RUNTIME float3 __attribute__((overloadable)) powr(float3 v, float3 p); -_RS_RUNTIME float4 __attribute__((overloadable)) powr(float4 v, float4 p); - -extern float __attribute__((overloadable)) remainder(float, float); -FN_FUNC_FN_FN(remainder) - -extern float __attribute__((overloadable)) remquo(float, float, int *); -FN_FUNC_FN_FN_PIN(remquo) - -extern float __attribute__((overloadable)) rint(float); -FN_FUNC_FN(rint) - - -_RS_RUNTIME float __attribute__((overloadable)) rootn(float v, int r); -_RS_RUNTIME float2 __attribute__((overloadable)) rootn(float2 v, int2 r); -_RS_RUNTIME float3 __attribute__((overloadable)) rootn(float3 v, int3 r); -_RS_RUNTIME float4 __attribute__((overloadable)) rootn(float4 v, int4 r); - - -extern float __attribute__((overloadable)) round(float); -FN_FUNC_FN(round) - - -extern float __attribute__((overloadable)) sqrt(float); -_RS_RUNTIME float __attribute__((overloadable)) rsqrt(float v); -FN_FUNC_FN(rsqrt) - -extern float __attribute__((overloadable)) sin(float); -FN_FUNC_FN(sin) - -_RS_RUNTIME float __attribute__((overloadable)) sincos(float v, float *cosptr); -_RS_RUNTIME float2 __attribute__((overloadable)) sincos(float2 v, float2 *cosptr); -_RS_RUNTIME float3 __attribute__((overloadable)) sincos(float3 v, float3 *cosptr); -_RS_RUNTIME float4 __attribute__((overloadable)) sincos(float4 v, float4 *cosptr); - -extern float __attribute__((overloadable)) sinh(float); -FN_FUNC_FN(sinh) - -_RS_RUNTIME float __attribute__((overloadable)) sinpi(float v); -FN_FUNC_FN(sinpi) - -FN_FUNC_FN(sqrt) - -extern float __attribute__((overloadable)) tan(float); -FN_FUNC_FN(tan) - -extern float __attribute__((overloadable)) tanh(float); -FN_FUNC_FN(tanh) - -_RS_RUNTIME float __attribute__((overloadable)) tanpi(float v); -FN_FUNC_FN(tanpi) - - -extern float __attribute__((overloadable)) tgamma(float); -FN_FUNC_FN(tgamma) - -extern float __attribute__((overloadable)) trunc(float); -FN_FUNC_FN(trunc) - -// Int ops (partial), 6.11.3 - -#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) - -IN_FUNC_IN_IN_BODY(min, (v1 < v2 ? v1 : v2)) -FN_FUNC_FN_F(min) - -IN_FUNC_IN_IN_BODY(max, (v1 > v2 ? v1 : v2)) -FN_FUNC_FN_F(max) - -// 6.11.4 - -_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); - -_RS_RUNTIME float __attribute__((overloadable)) degrees(float radians); -FN_FUNC_FN(degrees) - -_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); - -_RS_RUNTIME float __attribute__((overloadable)) radians(float degrees); -FN_FUNC_FN(radians) - -_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); - -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); - -_RS_RUNTIME float __attribute__((overloadable)) sign(float v); -FN_FUNC_FN(sign) - -// 6.11.5 -_RS_RUNTIME float3 __attribute__((overloadable)) cross(float3 lhs, float3 rhs); - -_RS_RUNTIME float4 __attribute__((overloadable)) cross(float4 lhs, float4 rhs); - -_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); - -_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); - -_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); - -_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 -#undef _RS_RUNTIME - -#endif diff --git a/13/renderscript/include/rs_core.rsh b/13/renderscript/include/rs_core.rsh deleted file mode 100644 index 4768bbe..0000000 --- a/13/renderscript/include/rs_core.rsh +++ /dev/null @@ -1,560 +0,0 @@ -#ifndef __RS_CORE_RSH__ -#define __RS_CORE_RSH__ - -#define _RS_RUNTIME extern - -/** - * 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); - - -/** - * 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); - - -///////////////////////////////////////////////////// -// Matrix ops -///////////////////////////////////////////////////// - -/** - * 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); -_RS_RUNTIME void __attribute__((overloadable)) -rsMatrixSet(rs_matrix3x3 *m, uint32_t row, uint32_t col, float v); -_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); -_RS_RUNTIME float __attribute__((overloadable)) -rsMatrixGet(const rs_matrix3x3 *m, uint32_t row, uint32_t col); -_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); -extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix3x3 *m); -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); -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const float *v); -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const float *v); - -/** - * Set the elements of a matrix from another matrix. - * - * @param m - */ -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix4x4 *v); -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix3x3 *v); -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix2x2 *v); -extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const rs_matrix3x3 *v); -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); - -extern void __attribute__((overloadable)) -rsMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z); - -extern void __attribute__((overloadable)) -rsMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z); - -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixLoadMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *rhs); - -extern void __attribute__((overloadable)) -rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z); - -extern void __attribute__((overloadable)) -rsMatrixScale(rs_matrix4x4 *m, float x, float y, float z); - -extern void __attribute__((overloadable)) -rsMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z); - -extern void __attribute__((overloadable)) -rsMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far); - -extern void __attribute__((overloadable)) -rsMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far); - -extern void __attribute__((overloadable)) -rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far); - -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float4 in); - -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float3 in); - -_RS_RUNTIME float4 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix4x4 *m, float2 in); - -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, float3 in); - -_RS_RUNTIME float3 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix3x3 *m, float2 in); - -_RS_RUNTIME float2 __attribute__((overloadable)) -rsMatrixMultiply(rs_matrix2x2 *m, float2 in); - -// Returns true if the matrix was successfully inversed -extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m); -extern bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m); -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m); -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix3x3 *m); -extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix2x2 *m); - -///////////////////////////////////////////////////// -// quaternion ops -///////////////////////////////////////////////////// - -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; -} - -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; -} - -static void __attribute__((overloadable)) -rsQuaternionMultiply(rs_quaternion *q, float s) { - q->w *= s; - q->x *= s; - q->y *= s; - q->z *= s; -} - -static void __attribute__((overloadable)) -rsQuaternionMultiply(rs_quaternion *q, const rs_quaternion *rhs) { - q->w = -q->x*rhs->x - q->y*rhs->y - q->z*rhs->z + q->w*rhs->w; - q->x = q->x*rhs->w + q->y*rhs->z - q->z*rhs->y + q->w*rhs->x; - q->y = -q->x*rhs->z + q->y*rhs->w + q->z*rhs->x + q->w*rhs->y; - q->z = q->x*rhs->y - q->y*rhs->x + q->z*rhs->w + q->w*rhs->z; -} - -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; -} - -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; -} - -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); -} - -static void -rsQuaternionConjugate(rs_quaternion *q) { - q->x = -q->x; - q->y = -q->y; - q->z = -q->z; -} - -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; -} - -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); - } -} - -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); -} - -static void rsQuaternionGetMatrixUnit(rs_matrix4x4 *m, const rs_quaternion *q) { - float x2 = 2.0f * q->x * q->x; - float y2 = 2.0f * q->y * q->y; - float z2 = 2.0f * q->z * q->z; - float xy = 2.0f * q->x * q->y; - float wz = 2.0f * q->w * q->z; - float xz = 2.0f * q->x * q->z; - float wy = 2.0f * q->w * q->y; - float wx = 2.0f * q->w * q->x; - float yz = 2.0f * q->y * q->z; - - m->m[0] = 1.0f - y2 - z2; - m->m[1] = xy - wz; - m->m[2] = xz + wy; - m->m[3] = 0.0f; - - m->m[4] = xy + wz; - m->m[5] = 1.0f - x2 - z2; - m->m[6] = yz - wx; - m->m[7] = 0.0f; - - m->m[8] = xz - wy; - m->m[9] = yz - wx; - m->m[10] = 1.0f - x2 - y2; - m->m[11] = 0.0f; - - m->m[12] = 0.0f; - m->m[13] = 0.0f; - m->m[14] = 0.0f; - m->m[15] = 1.0f; -} - -///////////////////////////////////////////////////// -// utility funcs -///////////////////////////////////////////////////// -__inline__ static void __attribute__((overloadable, always_inline)) -rsExtractFrustumPlanes(const rs_matrix4x4 *modelViewProj, - 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 = modelViewProj->m[3] + modelViewProj->m[0]; - left->y = modelViewProj->m[7] + modelViewProj->m[4]; - left->z = modelViewProj->m[11] + modelViewProj->m[8]; - left->w = modelViewProj->m[15] + modelViewProj->m[12]; - - right->x = modelViewProj->m[3] - modelViewProj->m[0]; - right->y = modelViewProj->m[7] - modelViewProj->m[4]; - right->z = modelViewProj->m[11] - modelViewProj->m[8]; - right->w = modelViewProj->m[15] - modelViewProj->m[12]; - - top->x = modelViewProj->m[3] - modelViewProj->m[1]; - top->y = modelViewProj->m[7] - modelViewProj->m[5]; - top->z = modelViewProj->m[11] - modelViewProj->m[9]; - top->w = modelViewProj->m[15] - modelViewProj->m[13]; - - bottom->x = modelViewProj->m[3] + modelViewProj->m[1]; - bottom->y = modelViewProj->m[7] + modelViewProj->m[5]; - bottom->z = modelViewProj->m[11] + modelViewProj->m[9]; - bottom->w = modelViewProj->m[15] + modelViewProj->m[13]; - - near->x = modelViewProj->m[3] + modelViewProj->m[2]; - near->y = modelViewProj->m[7] + modelViewProj->m[6]; - near->z = modelViewProj->m[11] + modelViewProj->m[10]; - near->w = modelViewProj->m[15] + modelViewProj->m[14]; - - far->x = modelViewProj->m[3] - modelViewProj->m[2]; - far->y = modelViewProj->m[7] - modelViewProj->m[6]; - far->z = modelViewProj->m[11] - modelViewProj->m[10]; - far->w = modelViewProj->m[15] - modelViewProj->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; -} - -__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; -} - - -///////////////////////////////////////////////////// -// int ops -///////////////////////////////////////////////////// - -_RS_RUNTIME uint __attribute__((overloadable, always_inline)) rsClamp(uint amount, uint low, uint high); -_RS_RUNTIME int __attribute__((overloadable, always_inline)) rsClamp(int amount, int low, int high); -_RS_RUNTIME ushort __attribute__((overloadable, always_inline)) rsClamp(ushort amount, ushort low, ushort high); -_RS_RUNTIME short __attribute__((overloadable, always_inline)) rsClamp(short amount, short low, short high); -_RS_RUNTIME uchar __attribute__((overloadable, always_inline)) rsClamp(uchar amount, uchar low, uchar high); -_RS_RUNTIME char __attribute__((overloadable, always_inline)) rsClamp(char amount, char low, char high); - -#undef _RS_RUNTIME - -#endif diff --git a/13/renderscript/include/rs_graphics.rsh b/13/renderscript/include/rs_graphics.rsh deleted file mode 100644 index 67ffc3d..0000000 --- a/13/renderscript/include/rs_graphics.rsh +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef __RS_GRAPHICS_RSH__ -#define __RS_GRAPHICS_RSH__ - - -/** - * 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); - - -extern void __attribute__((overloadable)) - rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *); -extern void __attribute__((overloadable)) - rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *); -extern void __attribute__((overloadable)) - rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *); - -extern void __attribute__((overloadable)) - rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *); - -/** - * 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); - -/** - * 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); - -/** - * 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); - -/** - * Draw a mesh of geometry using the current context state. The whole mesh is - * rendered. - * - * @param ism - */ -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism); -extern void __attribute__((overloadable)) - rsgDrawMesh(rs_mesh ism, uint primitiveIndex); -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); - -extern void __attribute__((overloadable)) - rsgDrawText(const char *, int x, int y); -extern void __attribute__((overloadable)) - rsgDrawText(rs_allocation, int x, int y); -extern void __attribute__((overloadable)) - rsgBindFont(rs_font); -extern void __attribute__((overloadable)) - rsgFontColor(float, float, float, float); -// 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); -extern void __attribute__((overloadable)) - rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom); - -extern void __attribute__((overloadable)) - rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ, - float *maxX, float *maxY, float *maxZ); -__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/13/renderscript/include/rs_math.rsh b/13/renderscript/include/rs_math.rsh deleted file mode 100644 index 6e3cfdb..0000000 --- a/13/renderscript/include/rs_math.rsh +++ /dev/null @@ -1,209 +0,0 @@ -#ifndef __RS_MATH_RSH__ -#define __RS_MATH_RSH__ - -/** - * Copy reference to the specified object. - * - * @param dst - * @param src - */ -extern void __attribute__((overloadable)) - rsSetObject(rs_element *dst, rs_element src); -extern void __attribute__((overloadable)) - rsSetObject(rs_type *dst, rs_type src); -extern void __attribute__((overloadable)) - rsSetObject(rs_allocation *dst, rs_allocation src); -extern void __attribute__((overloadable)) - rsSetObject(rs_sampler *dst, rs_sampler src); -extern void __attribute__((overloadable)) - rsSetObject(rs_script *dst, rs_script src); -extern void __attribute__((overloadable)) - rsSetObject(rs_mesh *dst, rs_mesh src); -extern void __attribute__((overloadable)) - rsSetObject(rs_program_fragment *dst, rs_program_fragment src); -extern void __attribute__((overloadable)) - rsSetObject(rs_program_vertex *dst, rs_program_vertex src); -extern void __attribute__((overloadable)) - rsSetObject(rs_program_raster *dst, rs_program_raster src); -extern void __attribute__((overloadable)) - rsSetObject(rs_program_store *dst, rs_program_store src); -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); -extern void __attribute__((overloadable)) - rsClearObject(rs_type *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_allocation *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_sampler *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_script *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_mesh *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_program_fragment *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_program_vertex *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_program_raster *dst); -extern void __attribute__((overloadable)) - rsClearObject(rs_program_store *dst); -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); -extern bool __attribute__((overloadable)) - rsIsObject(rs_type); -extern bool __attribute__((overloadable)) - rsIsObject(rs_allocation); -extern bool __attribute__((overloadable)) - rsIsObject(rs_sampler); -extern bool __attribute__((overloadable)) - rsIsObject(rs_script); -extern bool __attribute__((overloadable)) - rsIsObject(rs_mesh); -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_fragment); -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_vertex); -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_raster); -extern bool __attribute__((overloadable)) - rsIsObject(rs_program_store); -extern bool __attribute__((overloadable)) - rsIsObject(rs_font); - - -/** - * 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); - -// Extract a single element from an allocation. -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x); -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x, uint32_t y); -extern const void * __attribute__((overloadable)) - rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z); - -// Return a random value between 0 (or min_value) and max_malue. -extern int __attribute__((overloadable)) - rsRand(int max_value); -extern int __attribute__((overloadable)) - rsRand(int min_value, int max_value); -extern float __attribute__((overloadable)) - rsRand(float max_value); -extern float __attribute__((overloadable)) - rsRand(float min_value, float max_value); - -// return the fractional part of a float -// min(v - ((int)floor(v)), 0x1.fffffep-1f); -extern float __attribute__((overloadable)) - rsFrac(float); - -// 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); -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); -extern void __attribute__((overloadable)) - rsSendToClientBlocking(int cmdID, const void *data, uint len); - - -// Script to Script -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 -}; - -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; - -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, - rs_allocation output, const void * usrData); - -extern void __attribute__((overloadable)) - rsForEach(rs_script script, rs_allocation input, - rs_allocation output, const void * usrData, - const rs_script_call_t *); - -#endif diff --git a/13/renderscript/include/rs_time.rsh b/13/renderscript/include/rs_time.rsh deleted file mode 100644 index f1abed6..0000000 --- a/13/renderscript/include/rs_time.rsh +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __RS_TIME_RSH__ -#define __RS_TIME_RSH__ - -typedef int rs_time_t; - -typedef struct { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; -} rs_tm; - -extern rs_time_t __attribute__((overloadable)) - rsTime(rs_time_t *timer); - -extern rs_tm * __attribute__((overloadable)) - rsLocaltime(rs_tm *local, const rs_time_t *timer); - -// Return the current system clock in milliseconds -extern int64_t __attribute__((overloadable)) - rsUptimeMillis(void); - -// Return the current system clock in nanoseconds -extern int64_t __attribute__((overloadable)) - rsUptimeNanos(void); - -// Return the time in seconds since function was last called in this script. -extern float __attribute__((overloadable)) - rsGetDt(void); - -#endif diff --git a/13/renderscript/include/rs_types.rsh b/13/renderscript/include/rs_types.rsh deleted file mode 100644 index a010096..0000000 --- a/13/renderscript/include/rs_types.rsh +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __RS_TYPES_RSH__ -#define __RS_TYPES_RSH__ - -#define M_PI 3.14159265358979323846264338327950288f /* pi */ - -#include "stdbool.h" -typedef char int8_t; -typedef short int16_t; -typedef int int32_t; -typedef long long int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; - -typedef uint8_t uchar; -typedef uint16_t ushort; -typedef uint32_t uint; -typedef uint64_t ulong; - -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store; -typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font; - - -typedef float float2 __attribute__((ext_vector_type(2))); -typedef float float3 __attribute__((ext_vector_type(3))); -typedef float float4 __attribute__((ext_vector_type(4))); - -typedef uchar uchar2 __attribute__((ext_vector_type(2))); -typedef uchar uchar3 __attribute__((ext_vector_type(3))); -typedef uchar uchar4 __attribute__((ext_vector_type(4))); - -typedef ushort ushort2 __attribute__((ext_vector_type(2))); -typedef ushort ushort3 __attribute__((ext_vector_type(3))); -typedef ushort ushort4 __attribute__((ext_vector_type(4))); - -typedef uint uint2 __attribute__((ext_vector_type(2))); -typedef uint uint3 __attribute__((ext_vector_type(3))); -typedef uint uint4 __attribute__((ext_vector_type(4))); - -typedef char char2 __attribute__((ext_vector_type(2))); -typedef char char3 __attribute__((ext_vector_type(3))); -typedef char char4 __attribute__((ext_vector_type(4))); - -typedef short short2 __attribute__((ext_vector_type(2))); -typedef short short3 __attribute__((ext_vector_type(3))); -typedef short short4 __attribute__((ext_vector_type(4))); - -typedef int int2 __attribute__((ext_vector_type(2))); -typedef int int3 __attribute__((ext_vector_type(3))); -typedef int int4 __attribute__((ext_vector_type(4))); - - -typedef struct { - float m[16]; -} rs_matrix4x4; - -typedef struct { - float m[9]; -} rs_matrix3x3; - -typedef struct { - float m[4]; -} rs_matrix2x2; - -typedef float4 rs_quaternion; - -#define RS_PACKED __attribute__((packed, aligned(4))) - -#endif |