diff options
| author | 2011-01-11 19:09:47 -0800 | |
|---|---|---|
| committer | 2011-01-11 19:09:47 -0800 | |
| commit | 78dd1ef3f70ff80bf9697ba53601bda48451c044 (patch) | |
| tree | b9cf3caa4e1dcc49913ab03e3a9a25ab8b699a5c | |
| parent | 5220834c6ccdabf949dfe7160548ad378850d71b (diff) | |
| parent | 682c4a860b435a6888ea0ea753a7ba6194bb442a (diff) | |
Merge "Clean up RS math headers." into honeycomb
| -rw-r--r-- | libs/rs/scriptc/rs_cl.rsh | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/libs/rs/scriptc/rs_cl.rsh b/libs/rs/scriptc/rs_cl.rsh index 64844a488ead..a5092b36fff0 100644 --- a/libs/rs/scriptc/rs_cl.rsh +++ b/libs/rs/scriptc/rs_cl.rsh @@ -23,8 +23,8 @@ static typeout##4 __attribute__((overloadable)) convert_##typeout##4(typein##4 v CVT_FUNC_2(type, char) \ CVT_FUNC_2(type, ushort) \ CVT_FUNC_2(type, short) \ - CVT_FUNC_2(type, int) \ CVT_FUNC_2(type, uint) \ + CVT_FUNC_2(type, int) \ CVT_FUNC_2(type, float) CVT_FUNC(char) @@ -62,6 +62,29 @@ static float4 __attribute__((overloadable)) fnc(float4 v) { \ return r; \ } +#define DEF_FUNC_1_RI(fnc) \ +static int2 __attribute__((overloadable)) fnc(float2 v) { \ + int2 r; \ + r.x = fnc(v.x); \ + r.y = fnc(v.y); \ + return r; \ +} \ +static int3 __attribute__((overloadable)) fnc(float3 v) { \ + int3 r; \ + r.x = fnc(v.x); \ + r.y = fnc(v.y); \ + r.z = fnc(v.z); \ + return r; \ +} \ +static int4 __attribute__((overloadable)) fnc(float4 v) { \ + int4 r; \ + r.x = fnc(v.x); \ + r.y = fnc(v.y); \ + r.z = fnc(v.z); \ + r.w = fnc(v.w); \ + return r; \ +} + #define DEF_FUNC_2(fnc) \ static float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2) { \ float2 r; \ @@ -264,7 +287,7 @@ extern float __attribute__((overloadable)) hypot(float, float); DEF_FUNC_2(hypot) extern int __attribute__((overloadable)) ilogb(float); -DEF_FUNC_1(ilogb) +DEF_FUNC_1_RI(ilogb) extern float __attribute__((overloadable)) ldexp(float, int); extern float2 __attribute__((overloadable)) ldexp(float2, int2); @@ -345,10 +368,10 @@ static float4 __attribute__((overloadable)) powr(float4 v, float4 p) { extern float __attribute__((overloadable)) remainder(float, float); DEF_FUNC_2(remainder) -extern float __attribute__((overloadable)) remquo(float, float, float *); -extern float2 __attribute__((overloadable)) remquo(float2, float2, float2 *); -extern float3 __attribute__((overloadable)) remquo(float3, float3, float3 *); -extern float4 __attribute__((overloadable)) remquo(float4, float4, float4 *); +extern float __attribute__((overloadable)) remquo(float, float, int *); +extern float2 __attribute__((overloadable)) remquo(float2, float2, int2 *); +extern float3 __attribute__((overloadable)) remquo(float3, float3, int3 *); +extern float4 __attribute__((overloadable)) remquo(float4, float4, int4 *); extern float __attribute__((overloadable)) rint(float); DEF_FUNC_1(rint) @@ -373,10 +396,10 @@ extern float __attribute__((overloadable)) round(float); DEF_FUNC_1(round) extern float __attribute__((overloadable)) sqrt(float); -/*static float __attribute__((overloadable)) rsqrt(float v) { +static float __attribute__((overloadable)) rsqrt(float v) { return 1.f / sqrt(v); } -DEF_FUNC_1(rsqrt)*/ +DEF_FUNC_1(rsqrt) extern float __attribute__((overloadable)) sin(float); DEF_FUNC_1(sin) @@ -781,5 +804,11 @@ static float4 __attribute__((overloadable)) normalize(float4 v) { return v / length(v); } +#undef CVT_FUNC +#undef CVT_FUNC_2 +#undef DEF_FUNC_1 +#undef DEF_FUNC_1_RI +#undef DEF_FUNC_2 +#undef DEF_FUNC_2F #endif |