Roll NDK to pick std::deque patch.
[android_tools.git] / sdk / build-tools / 25.0.2 / renderscript / include / rs_vector_math.rsh
blob2f5e8e7dabc2f3819814460f56d05a61db6161df
1 /*
2  * Copyright (C) 2016 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  */
17 // Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
20  * rs_vector_math.rsh: Vector Math Functions
21  *
22  * These functions interpret the input arguments as representation of vectors in
23  * n-dimensional space.
24  *
25  * The precision of the mathematical operations on 32 bit floats is affected by the pragmas
26  * rs_fp_relaxed and rs_fp_full.  See Mathematical Constants and Functions for details.
27  *
28  * Different precision/speed tradeoffs can be achieved by using variants of the common math
29  * functions.  Functions with a name starting with
30  * - native_: May have custom hardware implementations with weaker precision.  Additionally,
31  *   subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
32  *   infinity input may not be handled correctly.
33  * - fast_: May perform internal computations using 16 bit floats.  Additionally, subnormal
34  *   values may be flushed to zero, and rounding towards zero may be used.
35  *
36  */
38 #ifndef RENDERSCRIPT_RS_VECTOR_MATH_RSH
39 #define RENDERSCRIPT_RS_VECTOR_MATH_RSH
42  * cross: Cross product of two vectors
43  *
44  * Computes the cross product of two vectors.
45  */
46 extern float3 __attribute__((const, overloadable))
47     cross(float3 left_vector, float3 right_vector);
49 extern float4 __attribute__((const, overloadable))
50     cross(float4 left_vector, float4 right_vector);
52 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
53 extern half3 __attribute__((const, overloadable))
54     cross(half3 left_vector, half3 right_vector);
55 #endif
57 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
58 extern half4 __attribute__((const, overloadable))
59     cross(half4 left_vector, half4 right_vector);
60 #endif
63  * distance: Distance between two points
64  *
65  * Compute the distance between two points.
66  *
67  * See also fast_distance(), native_distance().
68  */
69 extern float __attribute__((const, overloadable))
70     distance(float left_vector, float right_vector);
72 extern float __attribute__((const, overloadable))
73     distance(float2 left_vector, float2 right_vector);
75 extern float __attribute__((const, overloadable))
76     distance(float3 left_vector, float3 right_vector);
78 extern float __attribute__((const, overloadable))
79     distance(float4 left_vector, float4 right_vector);
81 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
82 extern half __attribute__((const, overloadable))
83     distance(half left_vector, half right_vector);
84 #endif
86 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
87 extern half __attribute__((const, overloadable))
88     distance(half2 left_vector, half2 right_vector);
89 #endif
91 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
92 extern half __attribute__((const, overloadable))
93     distance(half3 left_vector, half3 right_vector);
94 #endif
96 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
97 extern half __attribute__((const, overloadable))
98     distance(half4 left_vector, half4 right_vector);
99 #endif
102  * dot: Dot product of two vectors
104  * Computes the dot product of two vectors.
105  */
106 extern float __attribute__((const, overloadable))
107     dot(float left_vector, float right_vector);
109 extern float __attribute__((const, overloadable))
110     dot(float2 left_vector, float2 right_vector);
112 extern float __attribute__((const, overloadable))
113     dot(float3 left_vector, float3 right_vector);
115 extern float __attribute__((const, overloadable))
116     dot(float4 left_vector, float4 right_vector);
118 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
119 extern half __attribute__((const, overloadable))
120     dot(half left_vector, half right_vector);
121 #endif
123 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
124 extern half __attribute__((const, overloadable))
125     dot(half2 left_vector, half2 right_vector);
126 #endif
128 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
129 extern half __attribute__((const, overloadable))
130     dot(half3 left_vector, half3 right_vector);
131 #endif
133 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
134 extern half __attribute__((const, overloadable))
135     dot(half4 left_vector, half4 right_vector);
136 #endif
139  * fast_distance: Approximate distance between two points
141  * Computes the approximate distance between two points.
143  * The precision is what would be expected from doing the computation using 16 bit floating
144  * point values.
146  * See also distance(), native_distance().
147  */
148 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
149 extern float __attribute__((const, overloadable))
150     fast_distance(float left_vector, float right_vector);
151 #endif
153 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
154 extern float __attribute__((const, overloadable))
155     fast_distance(float2 left_vector, float2 right_vector);
156 #endif
158 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
159 extern float __attribute__((const, overloadable))
160     fast_distance(float3 left_vector, float3 right_vector);
161 #endif
163 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
164 extern float __attribute__((const, overloadable))
165     fast_distance(float4 left_vector, float4 right_vector);
166 #endif
169  * fast_length: Approximate length of a vector
171  * Computes the approximate length of a vector.
173  * The precision is what would be expected from doing the computation using 16 bit floating
174  * point values.
176  * See also length(), native_length().
177  */
178 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
179 extern float __attribute__((const, overloadable))
180     fast_length(float v);
181 #endif
183 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
184 extern float __attribute__((const, overloadable))
185     fast_length(float2 v);
186 #endif
188 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
189 extern float __attribute__((const, overloadable))
190     fast_length(float3 v);
191 #endif
193 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
194 extern float __attribute__((const, overloadable))
195     fast_length(float4 v);
196 #endif
199  * fast_normalize: Approximate normalized vector
201  * Approximately normalizes a vector.
203  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
204  * positive values.
206  * The precision is what would be expected from doing the computation using 16 bit floating
207  * point values.
209  * See also normalize(), native_normalize().
210  */
211 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
212 extern float __attribute__((const, overloadable))
213     fast_normalize(float v);
214 #endif
216 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
217 extern float2 __attribute__((const, overloadable))
218     fast_normalize(float2 v);
219 #endif
221 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
222 extern float3 __attribute__((const, overloadable))
223     fast_normalize(float3 v);
224 #endif
226 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
227 extern float4 __attribute__((const, overloadable))
228     fast_normalize(float4 v);
229 #endif
232  * length: Length of a vector
234  * Computes the length of a vector.
236  * See also fast_length(), native_length().
237  */
238 extern float __attribute__((const, overloadable))
239     length(float v);
241 extern float __attribute__((const, overloadable))
242     length(float2 v);
244 extern float __attribute__((const, overloadable))
245     length(float3 v);
247 extern float __attribute__((const, overloadable))
248     length(float4 v);
250 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
251 extern half __attribute__((const, overloadable))
252     length(half v);
253 #endif
255 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
256 extern half __attribute__((const, overloadable))
257     length(half2 v);
258 #endif
260 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
261 extern half __attribute__((const, overloadable))
262     length(half3 v);
263 #endif
265 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
266 extern half __attribute__((const, overloadable))
267     length(half4 v);
268 #endif
271  * native_distance: Approximate distance between two points
273  * Computes the approximate distance between two points.
275  * See also distance(), fast_distance().
276  */
277 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
278 extern float __attribute__((const, overloadable))
279     native_distance(float left_vector, float right_vector);
280 #endif
282 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
283 extern float __attribute__((const, overloadable))
284     native_distance(float2 left_vector, float2 right_vector);
285 #endif
287 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
288 extern float __attribute__((const, overloadable))
289     native_distance(float3 left_vector, float3 right_vector);
290 #endif
292 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
293 extern float __attribute__((const, overloadable))
294     native_distance(float4 left_vector, float4 right_vector);
295 #endif
297 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
298 extern half __attribute__((const, overloadable))
299     native_distance(half left_vector, half right_vector);
300 #endif
302 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
303 extern half __attribute__((const, overloadable))
304     native_distance(half2 left_vector, half2 right_vector);
305 #endif
307 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
308 extern half __attribute__((const, overloadable))
309     native_distance(half3 left_vector, half3 right_vector);
310 #endif
312 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
313 extern half __attribute__((const, overloadable))
314     native_distance(half4 left_vector, half4 right_vector);
315 #endif
318  * native_length: Approximate length of a vector
320  * Compute the approximate length of a vector.
322  * See also length(), fast_length().
323  */
324 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
325 extern float __attribute__((const, overloadable))
326     native_length(float v);
327 #endif
329 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
330 extern float __attribute__((const, overloadable))
331     native_length(float2 v);
332 #endif
334 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
335 extern float __attribute__((const, overloadable))
336     native_length(float3 v);
337 #endif
339 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
340 extern float __attribute__((const, overloadable))
341     native_length(float4 v);
342 #endif
344 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
345 extern half __attribute__((const, overloadable))
346     native_length(half v);
347 #endif
349 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
350 extern half __attribute__((const, overloadable))
351     native_length(half2 v);
352 #endif
354 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
355 extern half __attribute__((const, overloadable))
356     native_length(half3 v);
357 #endif
359 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
360 extern half __attribute__((const, overloadable))
361     native_length(half4 v);
362 #endif
365  * native_normalize: Approximately normalize a vector
367  * Approximately normalizes a vector.
369  * See also normalize(), fast_normalize().
370  */
371 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
372 extern float __attribute__((const, overloadable))
373     native_normalize(float v);
374 #endif
376 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
377 extern float2 __attribute__((const, overloadable))
378     native_normalize(float2 v);
379 #endif
381 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
382 extern float3 __attribute__((const, overloadable))
383     native_normalize(float3 v);
384 #endif
386 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
387 extern float4 __attribute__((const, overloadable))
388     native_normalize(float4 v);
389 #endif
391 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
392 extern half __attribute__((const, overloadable))
393     native_normalize(half v);
394 #endif
396 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
397 extern half2 __attribute__((const, overloadable))
398     native_normalize(half2 v);
399 #endif
401 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
402 extern half3 __attribute__((const, overloadable))
403     native_normalize(half3 v);
404 #endif
406 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
407 extern half4 __attribute__((const, overloadable))
408     native_normalize(half4 v);
409 #endif
412  * normalize: Normalize a vector
414  * Normalize a vector.
416  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
417  * positive values.
419  * See also fast_normalize(), native_normalize().
420  */
421 extern float __attribute__((const, overloadable))
422     normalize(float v);
424 extern float2 __attribute__((const, overloadable))
425     normalize(float2 v);
427 extern float3 __attribute__((const, overloadable))
428     normalize(float3 v);
430 extern float4 __attribute__((const, overloadable))
431     normalize(float4 v);
433 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
434 extern half __attribute__((const, overloadable))
435     normalize(half v);
436 #endif
438 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
439 extern half2 __attribute__((const, overloadable))
440     normalize(half2 v);
441 #endif
443 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
444 extern half3 __attribute__((const, overloadable))
445     normalize(half3 v);
446 #endif
448 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
449 extern half4 __attribute__((const, overloadable))
450     normalize(half4 v);
451 #endif
453 #endif // RENDERSCRIPT_RS_VECTOR_MATH_RSH