blob: 98b0b1d7f2b3f74daee87be44b60b31161b880a2 [file] [log] [blame]
Jason Sams044e2ee2011-08-08 16:52:30 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/** @file rs_cl.rsh
Jason Samsef823642011-08-31 14:52:08 -070018 * \brief Basic math functions
Jason Sams044e2ee2011-08-08 16:52:30 -070019 *
20 *
21 */
22
Jason Sams1b937f52010-06-09 14:26:16 -070023#ifndef __RS_CL_RSH__
24#define __RS_CL_RSH__
25
Jason Sams1b937f52010-06-09 14:26:16 -070026// Conversions
Stephen Hines47b15302011-01-19 18:06:34 -080027#define CVT_FUNC_2(typeout, typein) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080028_RS_RUNTIME typeout##2 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080029 convert_##typeout##2(typein##2 v); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080030_RS_RUNTIME typeout##3 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080031 convert_##typeout##3(typein##3 v); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080032_RS_RUNTIME typeout##4 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080033 convert_##typeout##4(typein##4 v);
34
Jason Sams1b937f52010-06-09 14:26:16 -070035
Stephen Hines47b15302011-01-19 18:06:34 -080036#define CVT_FUNC(type) CVT_FUNC_2(type, uchar) \
37 CVT_FUNC_2(type, char) \
38 CVT_FUNC_2(type, ushort) \
39 CVT_FUNC_2(type, short) \
40 CVT_FUNC_2(type, uint) \
41 CVT_FUNC_2(type, int) \
42 CVT_FUNC_2(type, float)
Jason Sams1b937f52010-06-09 14:26:16 -070043
44CVT_FUNC(char)
45CVT_FUNC(uchar)
46CVT_FUNC(short)
47CVT_FUNC(ushort)
48CVT_FUNC(int)
49CVT_FUNC(uint)
50CVT_FUNC(float)
51
Jason Sams22fa3712010-05-19 17:22:57 -070052// Float ops, 6.11.2
53
Stephen Hines47b15302011-01-19 18:06:34 -080054#define FN_FUNC_FN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080055_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v); \
56_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v); \
57_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v);
Jason Sams1b937f52010-06-09 14:26:16 -070058
Stephen Hines47b15302011-01-19 18:06:34 -080059#define IN_FUNC_FN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080060_RS_RUNTIME int2 __attribute__((overloadable)) fnc(float2 v); \
61_RS_RUNTIME int3 __attribute__((overloadable)) fnc(float3 v); \
62_RS_RUNTIME int4 __attribute__((overloadable)) fnc(float4 v);
Stephen Hines47416532011-01-11 14:38:18 -080063
Stephen Hines47b15302011-01-19 18:06:34 -080064#define FN_FUNC_FN_FN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080065_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2); \
66_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float3 v2); \
67_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2);
Jason Sams1b937f52010-06-09 14:26:16 -070068
Stephen Hines47b15302011-01-19 18:06:34 -080069#define FN_FUNC_FN_F(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080070_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, float v2); \
71_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, float v2); \
72_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, float v2);
Jason Sams1b937f52010-06-09 14:26:16 -070073
Stephen Hines47b15302011-01-19 18:06:34 -080074#define FN_FUNC_FN_IN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080075_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 v2); \
76_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 v2); \
77_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 v2); \
Stephen Hines3e6482f2011-01-19 12:51:33 -080078
Stephen Hines47b15302011-01-19 18:06:34 -080079#define FN_FUNC_FN_I(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080080_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int v2); \
81_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int v2); \
82_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int v2);
Stephen Hines3e6482f2011-01-19 12:51:33 -080083
Stephen Hines47b15302011-01-19 18:06:34 -080084#define FN_FUNC_FN_PFN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080085_RS_RUNTIME float2 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080086 fnc(float2 v1, float2 *v2); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080087_RS_RUNTIME float3 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080088 fnc(float3 v1, float3 *v2); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080089_RS_RUNTIME float4 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080090 fnc(float4 v1, float4 *v2);
Jason Sams1b937f52010-06-09 14:26:16 -070091
Stephen Hines47b15302011-01-19 18:06:34 -080092#define FN_FUNC_FN_PIN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080093_RS_RUNTIME float2 __attribute__((overloadable)) fnc(float2 v1, int2 *v2); \
94_RS_RUNTIME float3 __attribute__((overloadable)) fnc(float3 v1, int3 *v2); \
95_RS_RUNTIME float4 __attribute__((overloadable)) fnc(float4 v1, int4 *v2);
Stephen Hines3e6482f2011-01-19 12:51:33 -080096
Stephen Hines47b15302011-01-19 18:06:34 -080097#define FN_FUNC_FN_FN_FN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -080098_RS_RUNTIME float2 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -080099 fnc(float2 v1, float2 v2, float2 v3); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800100_RS_RUNTIME float3 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800101 fnc(float3 v1, float3 v2, float3 v3); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800102_RS_RUNTIME float4 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800103 fnc(float4 v1, float4 v2, float4 v3);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800104
Stephen Hines47b15302011-01-19 18:06:34 -0800105#define FN_FUNC_FN_FN_PIN(fnc) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800106_RS_RUNTIME float2 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800107 fnc(float2 v1, float2 v2, int2 *v3); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800108_RS_RUNTIME float3 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800109 fnc(float3 v1, float3 v2, int3 *v3); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800110_RS_RUNTIME float4 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800111 fnc(float4 v1, float4 v2, int4 *v3);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800112
113
Jason Samsef823642011-08-31 14:52:08 -0700114/**
115 * Return the inverse cosine.
116 *
117 * Supports float, float2, float3, float4
118 */
Jason Sams22fa3712010-05-19 17:22:57 -0700119extern float __attribute__((overloadable)) acos(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800120FN_FUNC_FN(acos)
Jason Sams22fa3712010-05-19 17:22:57 -0700121
Jason Samsef823642011-08-31 14:52:08 -0700122/**
123 * Return the inverse hyperbolic cosine.
124 *
125 * Supports float, float2, float3, float4
126 */
Jason Sams22fa3712010-05-19 17:22:57 -0700127extern float __attribute__((overloadable)) acosh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800128FN_FUNC_FN(acosh)
Jason Sams22fa3712010-05-19 17:22:57 -0700129
Jason Samsef823642011-08-31 14:52:08 -0700130/**
131 * Return the inverse cosine divided by PI.
132 *
133 * Supports float, float2, float3, float4
134 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800135_RS_RUNTIME float __attribute__((overloadable)) acospi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800136FN_FUNC_FN(acospi)
Jason Sams22fa3712010-05-19 17:22:57 -0700137
Jason Samsef823642011-08-31 14:52:08 -0700138/**
139 * Return the inverse sine.
140 *
141 * Supports float, float2, float3, float4
142 */
Jason Sams22fa3712010-05-19 17:22:57 -0700143extern float __attribute__((overloadable)) asin(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800144FN_FUNC_FN(asin)
Jason Sams22fa3712010-05-19 17:22:57 -0700145
Jason Samsef823642011-08-31 14:52:08 -0700146/**
147 * Return the inverse hyperbolic sine.
148 *
149 * Supports float, float2, float3, float4
150 */
Jason Sams22fa3712010-05-19 17:22:57 -0700151extern float __attribute__((overloadable)) asinh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800152FN_FUNC_FN(asinh)
Jason Sams22fa3712010-05-19 17:22:57 -0700153
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800154
Jason Samsef823642011-08-31 14:52:08 -0700155/**
156 * Return the inverse sine divided by PI.
157 *
158 * Supports float, float2, float3, float4
159 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800160_RS_RUNTIME float __attribute__((overloadable)) asinpi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800161FN_FUNC_FN(asinpi)
Jason Sams22fa3712010-05-19 17:22:57 -0700162
Jason Samsef823642011-08-31 14:52:08 -0700163/**
164 * Return the inverse tangent.
165 *
166 * Supports float, float2, float3, float4
167 */
Jason Sams22fa3712010-05-19 17:22:57 -0700168extern float __attribute__((overloadable)) atan(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800169FN_FUNC_FN(atan)
Jason Sams22fa3712010-05-19 17:22:57 -0700170
Jason Samsef823642011-08-31 14:52:08 -0700171/**
172 * Return the inverse tangent of y / x.
173 *
174 * Supports float, float2, float3, float4. Both arguments must be of the same
175 * type.
176 *
177 * @param y
178 * @param x
179 */
180extern float __attribute__((overloadable)) atan2(float y, float x);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800181FN_FUNC_FN_FN(atan2)
Jason Sams22fa3712010-05-19 17:22:57 -0700182
Jason Samsef823642011-08-31 14:52:08 -0700183/**
184 * Return the inverse hyperbolic tangent.
185 *
186 * Supports float, float2, float3, float4
187 */
Jason Sams22fa3712010-05-19 17:22:57 -0700188extern float __attribute__((overloadable)) atanh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800189FN_FUNC_FN(atanh)
Jason Sams22fa3712010-05-19 17:22:57 -0700190
Jason Samsef823642011-08-31 14:52:08 -0700191/**
192 * Return the inverse tangent divided by PI.
193 *
194 * Supports float, float2, float3, float4
195 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800196_RS_RUNTIME float __attribute__((overloadable)) atanpi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800197FN_FUNC_FN(atanpi)
Jason Sams22fa3712010-05-19 17:22:57 -0700198
Jason Samsef823642011-08-31 14:52:08 -0700199/**
200 * Return the inverse tangent of y / x, divided by PI.
201 *
202 * Supports float, float2, float3, float4. Both arguments must be of the same
203 * type.
204 *
205 * @param y
206 * @param x
207 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800208_RS_RUNTIME float __attribute__((overloadable)) atan2pi(float y, float x);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800209FN_FUNC_FN_FN(atan2pi)
Jason Sams22fa3712010-05-19 17:22:57 -0700210
Jason Samsef823642011-08-31 14:52:08 -0700211
212/**
213 * Return the cube root.
214 *
215 * Supports float, float2, float3, float4.
216 */
Jason Sams22fa3712010-05-19 17:22:57 -0700217extern float __attribute__((overloadable)) cbrt(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800218FN_FUNC_FN(cbrt)
Jason Sams22fa3712010-05-19 17:22:57 -0700219
Jason Samsef823642011-08-31 14:52:08 -0700220/**
221 * Return the smallest integer not less than a value.
222 *
223 * Supports float, float2, float3, float4.
224 */
Jason Sams22fa3712010-05-19 17:22:57 -0700225extern float __attribute__((overloadable)) ceil(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800226FN_FUNC_FN(ceil)
Jason Sams22fa3712010-05-19 17:22:57 -0700227
Jason Samsef823642011-08-31 14:52:08 -0700228/**
229 * Copy the sign bit from y to x.
230 *
231 * Supports float, float2, float3, float4. Both arguments must be of the same
232 * type.
233 *
234 * @param x
235 * @param y
236 */
237extern float __attribute__((overloadable)) copysign(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800238FN_FUNC_FN_FN(copysign)
Jason Sams22fa3712010-05-19 17:22:57 -0700239
Jason Samsef823642011-08-31 14:52:08 -0700240/**
241 * Return the cosine.
242 *
243 * Supports float, float2, float3, float4.
244 */
Jason Sams22fa3712010-05-19 17:22:57 -0700245extern float __attribute__((overloadable)) cos(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800246FN_FUNC_FN(cos)
Jason Sams22fa3712010-05-19 17:22:57 -0700247
Jason Samsef823642011-08-31 14:52:08 -0700248/**
249 * Return the hypebolic cosine.
250 *
251 * Supports float, float2, float3, float4.
252 */
Jason Sams22fa3712010-05-19 17:22:57 -0700253extern float __attribute__((overloadable)) cosh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800254FN_FUNC_FN(cosh)
Jason Sams22fa3712010-05-19 17:22:57 -0700255
Jason Samsef823642011-08-31 14:52:08 -0700256/**
257 * Return the cosine of the value * PI.
258 *
259 * Supports float, float2, float3, float4.
260 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800261_RS_RUNTIME float __attribute__((overloadable)) cospi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800262FN_FUNC_FN(cospi)
Jason Sams22fa3712010-05-19 17:22:57 -0700263
Jason Samsef823642011-08-31 14:52:08 -0700264/**
265 * Return the complementary error function.
266 *
267 * Supports float, float2, float3, float4.
268 */
Jason Sams22fa3712010-05-19 17:22:57 -0700269extern float __attribute__((overloadable)) erfc(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800270FN_FUNC_FN(erfc)
Jason Sams22fa3712010-05-19 17:22:57 -0700271
Jason Samsef823642011-08-31 14:52:08 -0700272/**
273 * Return the error function.
274 *
275 * Supports float, float2, float3, float4.
276 */
Jason Sams22fa3712010-05-19 17:22:57 -0700277extern float __attribute__((overloadable)) erf(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800278FN_FUNC_FN(erf)
Jason Sams22fa3712010-05-19 17:22:57 -0700279
Jason Samsef823642011-08-31 14:52:08 -0700280/**
281 * Return e ^ value.
282 *
283 * Supports float, float2, float3, float4.
284 */
Jason Sams22fa3712010-05-19 17:22:57 -0700285extern float __attribute__((overloadable)) exp(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800286FN_FUNC_FN(exp)
Jason Sams22fa3712010-05-19 17:22:57 -0700287
Jason Samsef823642011-08-31 14:52:08 -0700288/**
289 * Return 2 ^ value.
290 *
291 * Supports float, float2, float3, float4.
292 */
Jason Sams22fa3712010-05-19 17:22:57 -0700293extern float __attribute__((overloadable)) exp2(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800294FN_FUNC_FN(exp2)
Jason Sams22fa3712010-05-19 17:22:57 -0700295
Jason Samsef823642011-08-31 14:52:08 -0700296/**
297 * Return x ^ y.
298 *
299 * Supports float, float2, float3, float4. Both arguments must be of the same
300 * type.
301 */
302extern float __attribute__((overloadable)) pow(float x, float y);
303FN_FUNC_FN_FN(pow)
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800304
Jason Samsef823642011-08-31 14:52:08 -0700305/**
306 * Return 10 ^ value.
307 *
308 * Supports float, float2, float3, float4.
309 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800310_RS_RUNTIME float __attribute__((overloadable)) exp10(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800311FN_FUNC_FN(exp10)
Jason Sams22fa3712010-05-19 17:22:57 -0700312
Jason Samsef823642011-08-31 14:52:08 -0700313/**
314 * Return (e ^ value) - 1.
315 *
316 * Supports float, float2, float3, float4.
317 */
Jason Sams22fa3712010-05-19 17:22:57 -0700318extern float __attribute__((overloadable)) expm1(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800319FN_FUNC_FN(expm1)
Jason Sams22fa3712010-05-19 17:22:57 -0700320
Jason Samsef823642011-08-31 14:52:08 -0700321/**
322 * Return the absolute value of a value.
323 *
324 * Supports float, float2, float3, float4.
325 */
Jason Sams22fa3712010-05-19 17:22:57 -0700326extern float __attribute__((overloadable)) fabs(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800327FN_FUNC_FN(fabs)
Jason Sams22fa3712010-05-19 17:22:57 -0700328
Jason Samsef823642011-08-31 14:52:08 -0700329/**
330 * Return the positive difference between two values.
331 *
332 * Supports float, float2, float3, float4. Both arguments must be of the same
333 * type.
334 */
Jason Sams22fa3712010-05-19 17:22:57 -0700335extern float __attribute__((overloadable)) fdim(float, float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800336FN_FUNC_FN_FN(fdim)
Jason Sams22fa3712010-05-19 17:22:57 -0700337
Jason Samsef823642011-08-31 14:52:08 -0700338/**
339 * Return the smallest integer not greater than a value.
340 *
341 * Supports float, float2, float3, float4.
342 */
Jason Sams22fa3712010-05-19 17:22:57 -0700343extern float __attribute__((overloadable)) floor(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800344FN_FUNC_FN(floor)
Jason Sams22fa3712010-05-19 17:22:57 -0700345
Jason Samsef823642011-08-31 14:52:08 -0700346/**
347 * Return a*b + c.
348 *
349 * Supports float, float2, float3, float4.
350 */
351extern float __attribute__((overloadable)) fma(float a, float b, float c);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800352FN_FUNC_FN_FN_FN(fma)
Jason Sams22fa3712010-05-19 17:22:57 -0700353
Jason Samsef823642011-08-31 14:52:08 -0700354/**
355 * Return (x < y ? y : x)
356 *
357 * Supports float, float2, float3, float4.
358 * @param x: may be float, float2, float3, float4
359 * @param y: may be float or vector. If vector must match type of x.
360 */
361extern float __attribute__((overloadable)) fmax(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800362FN_FUNC_FN_FN(fmax);
363FN_FUNC_FN_F(fmax);
Jason Sams22fa3712010-05-19 17:22:57 -0700364
Jason Samsef823642011-08-31 14:52:08 -0700365/**
366 * Return (x > y ? y : x)
367 *
368 * @param x: may be float, float2, float3, float4
369 * @param y: may be float or vector. If vector must match type of x.
370 */
371extern float __attribute__((overloadable)) fmin(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800372FN_FUNC_FN_FN(fmin);
373FN_FUNC_FN_F(fmin);
Jason Sams22fa3712010-05-19 17:22:57 -0700374
Jason Samsef823642011-08-31 14:52:08 -0700375/**
376 * Return the remainder from x / y
377 *
378 * Supports float, float2, float3, float4.
379 */
380extern float __attribute__((overloadable)) fmod(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800381FN_FUNC_FN_FN(fmod)
Jason Sams22fa3712010-05-19 17:22:57 -0700382
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800383
Jason Samsef823642011-08-31 14:52:08 -0700384/**
385 * Return fractional part of v
386 *
387 * @param iptr iptr[0] will be set to the floor of the input value.
388 * Supports float, float2, float3, float4.
389 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800390_RS_RUNTIME float __attribute__((overloadable)) fract(float v, float *iptr);
Stephen Hines47b15302011-01-19 18:06:34 -0800391FN_FUNC_FN_PFN(fract)
Jason Sams22fa3712010-05-19 17:22:57 -0700392
Jason Samsef823642011-08-31 14:52:08 -0700393/**
394 * Return the mantissa and place the exponent into iptr[0]
395 *
396 * @param v Supports float, float2, float3, float4.
397 * @param iptr Must have the same vector size as v.
398 */
399extern float __attribute__((overloadable)) frexp(float v, int *iptr);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800400FN_FUNC_FN_PIN(frexp)
Jason Sams22fa3712010-05-19 17:22:57 -0700401
Jason Samsef823642011-08-31 14:52:08 -0700402/**
403 * Return sqrt(x*x + y*y)
404 *
405 * Supports float, float2, float3, float4.
406 */
407extern float __attribute__((overloadable)) hypot(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800408FN_FUNC_FN_FN(hypot)
Jason Sams22fa3712010-05-19 17:22:57 -0700409
Jason Samsef823642011-08-31 14:52:08 -0700410/**
411 * Return the integer exponent of a value
412 *
413 * Supports 1,2,3,4 components
414 */
Jason Sams22fa3712010-05-19 17:22:57 -0700415extern int __attribute__((overloadable)) ilogb(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800416IN_FUNC_FN(ilogb)
Jason Sams22fa3712010-05-19 17:22:57 -0700417
Jason Samsef823642011-08-31 14:52:08 -0700418/**
419 * Return (x * 2^y)
420 *
421 * @param x Supports 1,2,3,4 components
422 * @param y Supports single component or matching vector.
423 */
424extern float __attribute__((overloadable)) ldexp(float x, int y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800425FN_FUNC_FN_IN(ldexp)
426FN_FUNC_FN_I(ldexp)
Jason Sams22fa3712010-05-19 17:22:57 -0700427
Jason Samsef823642011-08-31 14:52:08 -0700428/**
429 * Return the log gamma
430 *
431 * Supports 1,2,3,4 components
432 */
Jason Sams22fa3712010-05-19 17:22:57 -0700433extern float __attribute__((overloadable)) lgamma(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800434FN_FUNC_FN(lgamma)
Jason Samsef823642011-08-31 14:52:08 -0700435
436/**
437 * Return the log gamma and sign
438 *
439 * @param x Supports 1,2,3,4 components
440 * @param y Supports matching vector.
441 */
442extern float __attribute__((overloadable)) lgamma(float x, int* y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800443FN_FUNC_FN_PIN(lgamma)
Jason Sams22fa3712010-05-19 17:22:57 -0700444
Jason Samsef823642011-08-31 14:52:08 -0700445/**
446 * Return the natural logarithm
447 *
448 * Supports 1,2,3,4 components
449 */
Jason Sams22fa3712010-05-19 17:22:57 -0700450extern float __attribute__((overloadable)) log(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800451FN_FUNC_FN(log)
Jason Sams22fa3712010-05-19 17:22:57 -0700452
Jason Samsef823642011-08-31 14:52:08 -0700453/**
454 * Return the base 10 logarithm
455 *
456 * Supports 1,2,3,4 components
457 */
Jason Sams22fa3712010-05-19 17:22:57 -0700458extern float __attribute__((overloadable)) log10(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800459FN_FUNC_FN(log10)
Jason Sams1b937f52010-06-09 14:26:16 -0700460
Jason Samsef823642011-08-31 14:52:08 -0700461/**
462 * Return the base 2 logarithm
463 *
464 * Supports 1,2,3,4 components
465 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800466_RS_RUNTIME float __attribute__((overloadable)) log2(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800467FN_FUNC_FN(log2)
Jason Sams22fa3712010-05-19 17:22:57 -0700468
Jason Samsef823642011-08-31 14:52:08 -0700469/**
470 * Return the natural logarithm of (v + 1.0f)
471 *
472 * Supports 1,2,3,4 components
473 */
474extern float __attribute__((overloadable)) log1p(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800475FN_FUNC_FN(log1p)
Jason Sams22fa3712010-05-19 17:22:57 -0700476
Jason Samsef823642011-08-31 14:52:08 -0700477/**
478 * Compute the exponent of the value.
479 *
480 * Supports 1,2,3,4 components
481 */
Jason Sams22fa3712010-05-19 17:22:57 -0700482extern float __attribute__((overloadable)) logb(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800483FN_FUNC_FN(logb)
Jason Sams22fa3712010-05-19 17:22:57 -0700484
Jason Samsef823642011-08-31 14:52:08 -0700485/**
486 * Compute (a * b) + c
487 *
488 * Supports 1,2,3,4 components
489 */
490extern float __attribute__((overloadable)) mad(float a, float b, float c);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800491FN_FUNC_FN_FN_FN(mad)
Jason Sams22fa3712010-05-19 17:22:57 -0700492
Jason Samsef823642011-08-31 14:52:08 -0700493/**
494 * Return the integral and fractional components of a number
495 * Supports 1,2,3,4 components
496 *
497 * @param x Source value
498 * @param iret iret[0] will be set to the integral portion of the number.
499 * @return The floating point portion of the value.
500 */
501extern float __attribute__((overloadable)) modf(float x, float *iret);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800502FN_FUNC_FN_PFN(modf);
Jason Sams22fa3712010-05-19 17:22:57 -0700503
Jason Sams1b937f52010-06-09 14:26:16 -0700504//extern float __attribute__((overloadable)) nan(uint);
Jason Sams22fa3712010-05-19 17:22:57 -0700505
Jason Samsef823642011-08-31 14:52:08 -0700506/**
507 * Return the next floating point number from x towards y.
508 *
509 * Supports 1,2,3,4 components
510 */
511extern float __attribute__((overloadable)) nextafter(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800512FN_FUNC_FN_FN(nextafter)
Jason Sams22fa3712010-05-19 17:22:57 -0700513
Jason Samsef823642011-08-31 14:52:08 -0700514/**
515 * Return (v ^ p).
516 *
517 * Supports 1,2,3,4 components
518 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800519_RS_RUNTIME float __attribute__((overloadable)) pown(float v, int p);
Jason Samsef823642011-08-31 14:52:08 -0700520FN_FUNC_FN_IN(pown)
Jason Sams22fa3712010-05-19 17:22:57 -0700521
Jason Samsef823642011-08-31 14:52:08 -0700522/**
523 * Return (v ^ p).
524 * @param v must be greater than 0.
525 *
526 * Supports 1,2,3,4 components
527 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800528_RS_RUNTIME float __attribute__((overloadable)) powr(float v, float p);
Jason Samsef823642011-08-31 14:52:08 -0700529FN_FUNC_FN_FN(powr)
Jason Sams22fa3712010-05-19 17:22:57 -0700530
Jason Samsef823642011-08-31 14:52:08 -0700531/**
532 * Return round x/y to the nearest integer then compute the remander.
533 *
534 * Supports 1,2,3,4 components
535 */
536extern float __attribute__((overloadable)) remainder(float x, float y);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800537FN_FUNC_FN_FN(remainder)
Jason Sams22fa3712010-05-19 17:22:57 -0700538
Jason Samsef823642011-08-31 14:52:08 -0700539// document once we know the precision of bionic
Stephen Hines47416532011-01-11 14:38:18 -0800540extern float __attribute__((overloadable)) remquo(float, float, int *);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800541FN_FUNC_FN_FN_PIN(remquo)
Jason Sams22fa3712010-05-19 17:22:57 -0700542
Jason Samsef823642011-08-31 14:52:08 -0700543/**
544 * Round to the nearest integral value.
545 *
546 * Supports 1,2,3,4 components
547 */
Jason Sams22fa3712010-05-19 17:22:57 -0700548extern float __attribute__((overloadable)) rint(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800549FN_FUNC_FN(rint)
Jason Sams22fa3712010-05-19 17:22:57 -0700550
Jason Samsef823642011-08-31 14:52:08 -0700551/**
552 * Compute the Nth root of a value.
553 *
554 * Supports 1,2,3,4 components
555 */
556_RS_RUNTIME float __attribute__((overloadable)) rootn(float v, int n);
557FN_FUNC_FN_IN(rootn)
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800558
Jason Samsef823642011-08-31 14:52:08 -0700559/**
560 * Round to the nearest integral value. Half values are rounded away from zero.
561 *
562 * Supports 1,2,3,4 components
563 */
Jason Sams22fa3712010-05-19 17:22:57 -0700564extern float __attribute__((overloadable)) round(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800565FN_FUNC_FN(round)
Jason Sams22fa3712010-05-19 17:22:57 -0700566
Jason Samsef823642011-08-31 14:52:08 -0700567/**
568 * Return the square root of a value.
569 *
570 * Supports 1,2,3,4 components
571 */
Jason Sams22fa3712010-05-19 17:22:57 -0700572extern float __attribute__((overloadable)) sqrt(float);
Jason Samsef823642011-08-31 14:52:08 -0700573FN_FUNC_FN(sqrt)
574
575/**
576 * Return (1 / sqrt(value)).
577 *
578 * @param v The incoming value in radians
579 * Supports 1,2,3,4 components
580 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800581_RS_RUNTIME float __attribute__((overloadable)) rsqrt(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800582FN_FUNC_FN(rsqrt)
Jason Sams1b937f52010-06-09 14:26:16 -0700583
Jason Samsef823642011-08-31 14:52:08 -0700584/**
585 * Return the sine of a value specified in radians.
586 *
587 * @param v The incoming value in radians
588 * Supports 1,2,3,4 components
589 */
590extern float __attribute__((overloadable)) sin(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800591FN_FUNC_FN(sin)
Jason Sams1b937f52010-06-09 14:26:16 -0700592
Jason Samsef823642011-08-31 14:52:08 -0700593/**
594 * Return the sine and cosine of a value.
595 *
596 * @return sine
597 * @param v The incoming value in radians
598 * @param *cosptr cosptr[0] will be set to the cosine value.
599 *
600 * Supports 1,2,3,4 components
601 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800602_RS_RUNTIME float __attribute__((overloadable)) sincos(float v, float *cosptr);
Jason Samsef823642011-08-31 14:52:08 -0700603FN_FUNC_FN_PFN(sincos);
Jason Sams1b937f52010-06-09 14:26:16 -0700604
Jason Samsef823642011-08-31 14:52:08 -0700605/**
606 * Return the hyperbolic sine of a value specified in radians.
607 *
608 * Supports 1,2,3,4 components
609 */
Jason Sams1b937f52010-06-09 14:26:16 -0700610extern float __attribute__((overloadable)) sinh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800611FN_FUNC_FN(sinh)
Jason Sams1b937f52010-06-09 14:26:16 -0700612
Jason Samsef823642011-08-31 14:52:08 -0700613/**
614 * Return the sin(v * PI).
615 *
616 * Supports 1,2,3,4 components
617 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800618_RS_RUNTIME float __attribute__((overloadable)) sinpi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800619FN_FUNC_FN(sinpi)
Jason Sams1b937f52010-06-09 14:26:16 -0700620
Jason Samsef823642011-08-31 14:52:08 -0700621/**
622 * Return the tangent of a value.
623 *
624 * Supports 1,2,3,4 components
625 * @param v The incoming value in radians
626 */
627extern float __attribute__((overloadable)) tan(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800628FN_FUNC_FN(tan)
Jason Sams22fa3712010-05-19 17:22:57 -0700629
Jason Samsef823642011-08-31 14:52:08 -0700630/**
631 * Return the hyperbolic tangent of a value.
632 *
633 * Supports 1,2,3,4 components
634 * @param v The incoming value in radians
635 */
Jason Sams22fa3712010-05-19 17:22:57 -0700636extern float __attribute__((overloadable)) tanh(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800637FN_FUNC_FN(tanh)
Jason Sams22fa3712010-05-19 17:22:57 -0700638
Jason Samsef823642011-08-31 14:52:08 -0700639/**
640 * Return tan(v * PI)
641 *
642 * Supports 1,2,3,4 components
643 */
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800644_RS_RUNTIME float __attribute__((overloadable)) tanpi(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800645FN_FUNC_FN(tanpi)
Jason Sams22fa3712010-05-19 17:22:57 -0700646
Jason Samsef823642011-08-31 14:52:08 -0700647/**
648 * Compute the gamma function of a value.
649 *
650 * Supports 1,2,3,4 components
651 */
Jason Sams22fa3712010-05-19 17:22:57 -0700652extern float __attribute__((overloadable)) tgamma(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800653FN_FUNC_FN(tgamma)
Jason Sams22fa3712010-05-19 17:22:57 -0700654
Jason Samsef823642011-08-31 14:52:08 -0700655/**
656 * Round to integral using truncation.
657 *
658 * Supports 1,2,3,4 components
659 */
Jason Sams22fa3712010-05-19 17:22:57 -0700660extern float __attribute__((overloadable)) trunc(float);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800661FN_FUNC_FN(trunc)
Jason Sams22fa3712010-05-19 17:22:57 -0700662
663// Int ops (partial), 6.11.3
Jason Sams22fa3712010-05-19 17:22:57 -0700664
Stephen Hines47b15302011-01-19 18:06:34 -0800665#define XN_FUNC_YN(typeout, fnc, typein) \
666extern typeout __attribute__((overloadable)) fnc(typein); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800667_RS_RUNTIME typeout##2 __attribute__((overloadable)) fnc(typein##2 v); \
668_RS_RUNTIME typeout##3 __attribute__((overloadable)) fnc(typein##3 v); \
669_RS_RUNTIME typeout##4 __attribute__((overloadable)) fnc(typein##4 v);
Jason Sams22fa3712010-05-19 17:22:57 -0700670
Stephen Hines47b15302011-01-19 18:06:34 -0800671#define UIN_FUNC_IN(fnc) \
Stephen Hines3e6482f2011-01-19 12:51:33 -0800672XN_FUNC_YN(uchar, fnc, char) \
673XN_FUNC_YN(ushort, fnc, short) \
674XN_FUNC_YN(uint, fnc, int)
Jason Sams22fa3712010-05-19 17:22:57 -0700675
Stephen Hines47b15302011-01-19 18:06:34 -0800676#define IN_FUNC_IN(fnc) \
Stephen Hines3e6482f2011-01-19 12:51:33 -0800677XN_FUNC_YN(uchar, fnc, uchar) \
678XN_FUNC_YN(char, fnc, char) \
679XN_FUNC_YN(ushort, fnc, ushort) \
680XN_FUNC_YN(short, fnc, short) \
681XN_FUNC_YN(uint, fnc, uint) \
682XN_FUNC_YN(int, fnc, int)
Jason Sams22fa3712010-05-19 17:22:57 -0700683
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800684
Stephen Hines47b15302011-01-19 18:06:34 -0800685#define XN_FUNC_XN_XN_BODY(type, fnc, body) \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800686_RS_RUNTIME type __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800687 fnc(type v1, type v2); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800688_RS_RUNTIME type##2 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800689 fnc(type##2 v1, type##2 v2); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800690_RS_RUNTIME type##3 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800691 fnc(type##3 v1, type##3 v2); \
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800692_RS_RUNTIME type##4 __attribute__((overloadable)) \
Shih-wei Liaoedf22402011-01-26 04:03:30 -0800693 fnc(type##4 v1, type##4 v2);
Jason Sams22fa3712010-05-19 17:22:57 -0700694
Stephen Hines47b15302011-01-19 18:06:34 -0800695#define IN_FUNC_IN_IN_BODY(fnc, body) \
Stephen Hines3e6482f2011-01-19 12:51:33 -0800696XN_FUNC_XN_XN_BODY(uchar, fnc, body) \
697XN_FUNC_XN_XN_BODY(char, fnc, body) \
698XN_FUNC_XN_XN_BODY(ushort, fnc, body) \
699XN_FUNC_XN_XN_BODY(short, fnc, body) \
700XN_FUNC_XN_XN_BODY(uint, fnc, body) \
701XN_FUNC_XN_XN_BODY(int, fnc, body) \
702XN_FUNC_XN_XN_BODY(float, fnc, body)
Stephen Hinesb902e4c2011-01-14 18:49:01 -0800703
Stephen Hines3e6482f2011-01-19 12:51:33 -0800704UIN_FUNC_IN(abs)
705IN_FUNC_IN(clz)
Stephen Hinesb902e4c2011-01-14 18:49:01 -0800706
Stephen Hines3e6482f2011-01-19 12:51:33 -0800707IN_FUNC_IN_IN_BODY(min, (v1 < v2 ? v1 : v2))
708FN_FUNC_FN_F(min)
Stephen Hinesb902e4c2011-01-14 18:49:01 -0800709
Stephen Hines3e6482f2011-01-19 12:51:33 -0800710IN_FUNC_IN_IN_BODY(max, (v1 > v2 ? v1 : v2))
711FN_FUNC_FN_F(max)
Jason Sams22fa3712010-05-19 17:22:57 -0700712
713// 6.11.4
714
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800715_RS_RUNTIME float __attribute__((overloadable)) clamp(float amount, float low, float high);
716_RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float2 low, float2 high);
717_RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float3 low, float3 high);
718_RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float4 low, float4 high);
719_RS_RUNTIME float2 __attribute__((overloadable)) clamp(float2 amount, float low, float high);
720_RS_RUNTIME float3 __attribute__((overloadable)) clamp(float3 amount, float low, float high);
721_RS_RUNTIME float4 __attribute__((overloadable)) clamp(float4 amount, float low, float high);
Jason Sams22fa3712010-05-19 17:22:57 -0700722
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800723_RS_RUNTIME float __attribute__((overloadable)) degrees(float radians);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800724FN_FUNC_FN(degrees)
Jason Sams22fa3712010-05-19 17:22:57 -0700725
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800726_RS_RUNTIME float __attribute__((overloadable)) mix(float start, float stop, float amount);
727_RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float2 amount);
728_RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float3 amount);
729_RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float4 amount);
730_RS_RUNTIME float2 __attribute__((overloadable)) mix(float2 start, float2 stop, float amount);
731_RS_RUNTIME float3 __attribute__((overloadable)) mix(float3 start, float3 stop, float amount);
732_RS_RUNTIME float4 __attribute__((overloadable)) mix(float4 start, float4 stop, float amount);
Jason Sams22fa3712010-05-19 17:22:57 -0700733
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800734_RS_RUNTIME float __attribute__((overloadable)) radians(float degrees);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800735FN_FUNC_FN(radians)
Jason Sams22fa3712010-05-19 17:22:57 -0700736
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800737_RS_RUNTIME float __attribute__((overloadable)) step(float edge, float v);
738_RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float2 v);
739_RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float3 v);
740_RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float4 v);
741_RS_RUNTIME float2 __attribute__((overloadable)) step(float2 edge, float v);
742_RS_RUNTIME float3 __attribute__((overloadable)) step(float3 edge, float v);
743_RS_RUNTIME float4 __attribute__((overloadable)) step(float4 edge, float v);
Jason Sams22fa3712010-05-19 17:22:57 -0700744
745extern float __attribute__((overloadable)) smoothstep(float, float, float);
746extern float2 __attribute__((overloadable)) smoothstep(float2, float2, float2);
747extern float3 __attribute__((overloadable)) smoothstep(float3, float3, float3);
748extern float4 __attribute__((overloadable)) smoothstep(float4, float4, float4);
Jason Sams22fa3712010-05-19 17:22:57 -0700749extern float2 __attribute__((overloadable)) smoothstep(float, float, float2);
750extern float3 __attribute__((overloadable)) smoothstep(float, float, float3);
751extern float4 __attribute__((overloadable)) smoothstep(float, float, float4);
Jason Sams22fa3712010-05-19 17:22:57 -0700752
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800753_RS_RUNTIME float __attribute__((overloadable)) sign(float v);
Stephen Hines3e6482f2011-01-19 12:51:33 -0800754FN_FUNC_FN(sign)
Jason Sams22fa3712010-05-19 17:22:57 -0700755
756// 6.11.5
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800757_RS_RUNTIME float3 __attribute__((overloadable)) cross(float3 lhs, float3 rhs);
Jason Sams22fa3712010-05-19 17:22:57 -0700758
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800759_RS_RUNTIME float4 __attribute__((overloadable)) cross(float4 lhs, float4 rhs);
Jason Sams22fa3712010-05-19 17:22:57 -0700760
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800761_RS_RUNTIME float __attribute__((overloadable)) dot(float lhs, float rhs);
762_RS_RUNTIME float __attribute__((overloadable)) dot(float2 lhs, float2 rhs);
763_RS_RUNTIME float __attribute__((overloadable)) dot(float3 lhs, float3 rhs);
764_RS_RUNTIME float __attribute__((overloadable)) dot(float4 lhs, float4 rhs);
Jason Sams22fa3712010-05-19 17:22:57 -0700765
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800766_RS_RUNTIME float __attribute__((overloadable)) length(float v);
767_RS_RUNTIME float __attribute__((overloadable)) length(float2 v);
768_RS_RUNTIME float __attribute__((overloadable)) length(float3 v);
769_RS_RUNTIME float __attribute__((overloadable)) length(float4 v);
Jason Sams22fa3712010-05-19 17:22:57 -0700770
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800771_RS_RUNTIME float __attribute__((overloadable)) distance(float lhs, float rhs);
772_RS_RUNTIME float __attribute__((overloadable)) distance(float2 lhs, float2 rhs);
773_RS_RUNTIME float __attribute__((overloadable)) distance(float3 lhs, float3 rhs);
774_RS_RUNTIME float __attribute__((overloadable)) distance(float4 lhs, float4 rhs);
Jason Sams22fa3712010-05-19 17:22:57 -0700775
Shih-wei Liaoe31775b2011-01-26 17:04:31 -0800776_RS_RUNTIME float __attribute__((overloadable)) normalize(float v);
777_RS_RUNTIME float2 __attribute__((overloadable)) normalize(float2 v);
778_RS_RUNTIME float3 __attribute__((overloadable)) normalize(float3 v);
779_RS_RUNTIME float4 __attribute__((overloadable)) normalize(float4 v);
Jason Sams1b937f52010-06-09 14:26:16 -0700780
Stephen Hines47416532011-01-11 14:38:18 -0800781#undef CVT_FUNC
782#undef CVT_FUNC_2
Stephen Hines3e6482f2011-01-19 12:51:33 -0800783#undef FN_FUNC_FN
784#undef IN_FUNC_FN
785#undef FN_FUNC_FN_FN
786#undef FN_FUNC_FN_F
787#undef FN_FUNC_FN_IN
788#undef FN_FUNC_FN_I
789#undef FN_FUNC_FN_PFN
790#undef FN_FUNC_FN_PIN
791#undef FN_FUNC_FN_FN_FN
792#undef FN_FUNC_FN_FN_PIN
793#undef XN_FUNC_YN
794#undef UIN_FUNC_IN
795#undef IN_FUNC_IN
796#undef XN_FUNC_XN_XN_BODY
797#undef IN_FUNC_IN_IN_BODY
Jason Sams1b937f52010-06-09 14:26:16 -0700798
799#endif