Home | History | Annotate | Download | only in include
      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  */
     16 
     17 // Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
     18 
     19 /*
     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  */
     37 
     38 #ifndef RENDERSCRIPT_RS_VECTOR_MATH_RSH
     39 #define RENDERSCRIPT_RS_VECTOR_MATH_RSH
     40 
     41 /*
     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);
     48 
     49 extern float4 __attribute__((const, overloadable))
     50     cross(float4 left_vector, float4 right_vector);
     51 
     52 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     53 extern half3 __attribute__((const, overloadable))
     54     cross(half3 left_vector, half3 right_vector);
     55 #endif
     56 
     57 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     58 extern half4 __attribute__((const, overloadable))
     59     cross(half4 left_vector, half4 right_vector);
     60 #endif
     61 
     62 /*
     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);
     71 
     72 extern float __attribute__((const, overloadable))
     73     distance(float2 left_vector, float2 right_vector);
     74 
     75 extern float __attribute__((const, overloadable))
     76     distance(float3 left_vector, float3 right_vector);
     77 
     78 extern float __attribute__((const, overloadable))
     79     distance(float4 left_vector, float4 right_vector);
     80 
     81 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     82 extern half __attribute__((const, overloadable))
     83     distance(half left_vector, half right_vector);
     84 #endif
     85 
     86 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     87 extern half __attribute__((const, overloadable))
     88     distance(half2 left_vector, half2 right_vector);
     89 #endif
     90 
     91 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     92 extern half __attribute__((const, overloadable))
     93     distance(half3 left_vector, half3 right_vector);
     94 #endif
     95 
     96 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
     97 extern half __attribute__((const, overloadable))
     98     distance(half4 left_vector, half4 right_vector);
     99 #endif
    100 
    101 /*
    102  * dot: Dot product of two vectors
    103  *
    104  * Computes the dot product of two vectors.
    105  */
    106 extern float __attribute__((const, overloadable))
    107     dot(float left_vector, float right_vector);
    108 
    109 extern float __attribute__((const, overloadable))
    110     dot(float2 left_vector, float2 right_vector);
    111 
    112 extern float __attribute__((const, overloadable))
    113     dot(float3 left_vector, float3 right_vector);
    114 
    115 extern float __attribute__((const, overloadable))
    116     dot(float4 left_vector, float4 right_vector);
    117 
    118 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    119 extern half __attribute__((const, overloadable))
    120     dot(half left_vector, half right_vector);
    121 #endif
    122 
    123 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    124 extern half __attribute__((const, overloadable))
    125     dot(half2 left_vector, half2 right_vector);
    126 #endif
    127 
    128 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    129 extern half __attribute__((const, overloadable))
    130     dot(half3 left_vector, half3 right_vector);
    131 #endif
    132 
    133 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    134 extern half __attribute__((const, overloadable))
    135     dot(half4 left_vector, half4 right_vector);
    136 #endif
    137 
    138 /*
    139  * fast_distance: Approximate distance between two points
    140  *
    141  * Computes the approximate distance between two points.
    142  *
    143  * The precision is what would be expected from doing the computation using 16 bit floating
    144  * point values.
    145  *
    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
    152 
    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
    157 
    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
    162 
    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
    167 
    168 /*
    169  * fast_length: Approximate length of a vector
    170  *
    171  * Computes the approximate length of a vector.
    172  *
    173  * The precision is what would be expected from doing the computation using 16 bit floating
    174  * point values.
    175  *
    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
    182 
    183 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    184 extern float __attribute__((const, overloadable))
    185     fast_length(float2 v);
    186 #endif
    187 
    188 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    189 extern float __attribute__((const, overloadable))
    190     fast_length(float3 v);
    191 #endif
    192 
    193 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    194 extern float __attribute__((const, overloadable))
    195     fast_length(float4 v);
    196 #endif
    197 
    198 /*
    199  * fast_normalize: Approximate normalized vector
    200  *
    201  * Approximately normalizes a vector.
    202  *
    203  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
    204  * positive values.
    205  *
    206  * The precision is what would be expected from doing the computation using 16 bit floating
    207  * point values.
    208  *
    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
    215 
    216 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    217 extern float2 __attribute__((const, overloadable))
    218     fast_normalize(float2 v);
    219 #endif
    220 
    221 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    222 extern float3 __attribute__((const, overloadable))
    223     fast_normalize(float3 v);
    224 #endif
    225 
    226 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
    227 extern float4 __attribute__((const, overloadable))
    228     fast_normalize(float4 v);
    229 #endif
    230 
    231 /*
    232  * length: Length of a vector
    233  *
    234  * Computes the length of a vector.
    235  *
    236  * See also fast_length(), native_length().
    237  */
    238 extern float __attribute__((const, overloadable))
    239     length(float v);
    240 
    241 extern float __attribute__((const, overloadable))
    242     length(float2 v);
    243 
    244 extern float __attribute__((const, overloadable))
    245     length(float3 v);
    246 
    247 extern float __attribute__((const, overloadable))
    248     length(float4 v);
    249 
    250 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    251 extern half __attribute__((const, overloadable))
    252     length(half v);
    253 #endif
    254 
    255 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    256 extern half __attribute__((const, overloadable))
    257     length(half2 v);
    258 #endif
    259 
    260 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    261 extern half __attribute__((const, overloadable))
    262     length(half3 v);
    263 #endif
    264 
    265 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    266 extern half __attribute__((const, overloadable))
    267     length(half4 v);
    268 #endif
    269 
    270 /*
    271  * native_distance: Approximate distance between two points
    272  *
    273  * Computes the approximate distance between two points.
    274  *
    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
    281 
    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
    286 
    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
    291 
    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
    296 
    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
    301 
    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
    306 
    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
    311 
    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
    316 
    317 /*
    318  * native_length: Approximate length of a vector
    319  *
    320  * Compute the approximate length of a vector.
    321  *
    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
    328 
    329 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    330 extern float __attribute__((const, overloadable))
    331     native_length(float2 v);
    332 #endif
    333 
    334 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    335 extern float __attribute__((const, overloadable))
    336     native_length(float3 v);
    337 #endif
    338 
    339 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    340 extern float __attribute__((const, overloadable))
    341     native_length(float4 v);
    342 #endif
    343 
    344 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    345 extern half __attribute__((const, overloadable))
    346     native_length(half v);
    347 #endif
    348 
    349 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    350 extern half __attribute__((const, overloadable))
    351     native_length(half2 v);
    352 #endif
    353 
    354 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    355 extern half __attribute__((const, overloadable))
    356     native_length(half3 v);
    357 #endif
    358 
    359 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    360 extern half __attribute__((const, overloadable))
    361     native_length(half4 v);
    362 #endif
    363 
    364 /*
    365  * native_normalize: Approximately normalize a vector
    366  *
    367  * Approximately normalizes a vector.
    368  *
    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
    375 
    376 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    377 extern float2 __attribute__((const, overloadable))
    378     native_normalize(float2 v);
    379 #endif
    380 
    381 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    382 extern float3 __attribute__((const, overloadable))
    383     native_normalize(float3 v);
    384 #endif
    385 
    386 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
    387 extern float4 __attribute__((const, overloadable))
    388     native_normalize(float4 v);
    389 #endif
    390 
    391 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    392 extern half __attribute__((const, overloadable))
    393     native_normalize(half v);
    394 #endif
    395 
    396 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    397 extern half2 __attribute__((const, overloadable))
    398     native_normalize(half2 v);
    399 #endif
    400 
    401 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    402 extern half3 __attribute__((const, overloadable))
    403     native_normalize(half3 v);
    404 #endif
    405 
    406 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    407 extern half4 __attribute__((const, overloadable))
    408     native_normalize(half4 v);
    409 #endif
    410 
    411 /*
    412  * normalize: Normalize a vector
    413  *
    414  * Normalize a vector.
    415  *
    416  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
    417  * positive values.
    418  *
    419  * See also fast_normalize(), native_normalize().
    420  */
    421 extern float __attribute__((const, overloadable))
    422     normalize(float v);
    423 
    424 extern float2 __attribute__((const, overloadable))
    425     normalize(float2 v);
    426 
    427 extern float3 __attribute__((const, overloadable))
    428     normalize(float3 v);
    429 
    430 extern float4 __attribute__((const, overloadable))
    431     normalize(float4 v);
    432 
    433 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    434 extern half __attribute__((const, overloadable))
    435     normalize(half v);
    436 #endif
    437 
    438 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    439 extern half2 __attribute__((const, overloadable))
    440     normalize(half2 v);
    441 #endif
    442 
    443 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    444 extern half3 __attribute__((const, overloadable))
    445     normalize(half3 v);
    446 #endif
    447 
    448 #if (defined(RS_VERSION) && (RS_VERSION >= 24))
    449 extern half4 __attribute__((const, overloadable))
    450     normalize(half4 v);
    451 #endif
    452 
    453 #endif // RENDERSCRIPT_RS_VECTOR_MATH_RSH
    454