rs_vector_math.spec 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. #
  2. # Copyright (C) 2015 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. header:
  17. summary: Vector Math Functions
  18. description:
  19. These functions interpret the input arguments as representation of vectors in
  20. n-dimensional space.
  21. The precision of the mathematical operations on 32 bit floats is affected by the pragmas
  22. # TODO Create an anchor for the section of http://developer.android.com/guide/topics/renderscript/compute.html that details rs_fp_* and link them here.
  23. rs_fp_relaxed and rs_fp_full. See <a href='rs_math.html'>Mathematical Constants and Functions</a> for details.
  24. Different precision/speed tradeoffs can be achieved by using variants of the common math
  25. functions. Functions with a name starting with<ul>
  26. <li>native_: May have custom hardware implementations with weaker precision. Additionally,
  27. subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
  28. infinity input may not be handled correctly.</li>
  29. <li>fast_: May perform internal computations using 16 bit floats. Additionally, subnormal
  30. values may be flushed to zero, and rounding towards zero may be used.</li>
  31. </ul>
  32. end:
  33. function: cross
  34. version: 9
  35. attrib: const
  36. w: 3, 4
  37. t: f32
  38. ret: #2#1
  39. arg: #2#1 left_vector
  40. arg: #2#1 right_vector
  41. summary: Cross product of two vectors
  42. description:
  43. Computes the cross product of two vectors.
  44. test: vector
  45. end:
  46. function: cross
  47. version: 24
  48. attrib: const
  49. w: 3, 4
  50. t: f16
  51. ret: #2#1
  52. arg: #2#1 left_vector
  53. arg: #2#1 right_vector
  54. test: vector
  55. end:
  56. function: distance
  57. version: 9
  58. attrib: const
  59. w: 1, 2, 3, 4
  60. t: f32
  61. ret: #2
  62. arg: #2#1 left_vector
  63. arg: #2#1 right_vector
  64. summary: Distance between two points
  65. description:
  66. Compute the distance between two points.
  67. See also @fast_distance(), @native_distance().
  68. test: vector
  69. end:
  70. function: distance
  71. version: 24
  72. attrib: const
  73. w: 1, 2, 3, 4
  74. t: f16
  75. ret: #2
  76. arg: #2#1 left_vector
  77. arg: #2#1 right_vector
  78. test: vector
  79. end:
  80. function: dot
  81. version: 9
  82. attrib: const
  83. w: 1, 2, 3, 4
  84. t: f32
  85. ret: #2
  86. arg: #2#1 left_vector
  87. arg: #2#1 right_vector
  88. summary: Dot product of two vectors
  89. description:
  90. Computes the dot product of two vectors.
  91. test: vector
  92. end:
  93. function: dot
  94. version: 24
  95. attrib: const
  96. w: 1, 2, 3, 4
  97. t: f16
  98. ret: #2
  99. arg: #2#1 left_vector
  100. arg: #2#1 right_vector
  101. test: vector
  102. end:
  103. function: fast_distance
  104. version: 17
  105. attrib: const
  106. w: 1, 2, 3, 4
  107. t: f32
  108. ret: #2
  109. arg: #2#1 left_vector
  110. arg: #2#1 right_vector
  111. summary: Approximate distance between two points
  112. description:
  113. Computes the approximate distance between two points.
  114. The precision is what would be expected from doing the computation using 16 bit floating
  115. point values.
  116. See also @distance(), @native_distance().
  117. test: vector
  118. end:
  119. function: fast_length
  120. version: 17
  121. attrib: const
  122. w: 1, 2, 3, 4
  123. t: f32
  124. ret: #2
  125. arg: #2#1 v
  126. summary: Approximate length of a vector
  127. description:
  128. Computes the approximate length of a vector.
  129. The precision is what would be expected from doing the computation using 16 bit floating
  130. point values.
  131. See also @length(), @native_length().
  132. test: vector
  133. end:
  134. function: fast_normalize
  135. version: 17
  136. attrib: const
  137. w: 1, 2, 3, 4
  138. t: f32
  139. ret: #2#1
  140. arg: #2#1 v
  141. summary: Approximate normalized vector
  142. description:
  143. Approximately normalizes a vector.
  144. For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
  145. positive values.
  146. The precision is what would be expected from doing the computation using 16 bit floating
  147. point values.
  148. See also @normalize(), @native_normalize().
  149. test: vector
  150. end:
  151. function: length
  152. version: 9
  153. attrib: const
  154. w: 1, 2, 3, 4
  155. t: f32
  156. ret: #2
  157. arg: #2#1 v
  158. summary: Length of a vector
  159. description:
  160. Computes the length of a vector.
  161. See also @fast_length(), @native_length().
  162. test: vector
  163. end:
  164. function: length
  165. version: 24
  166. attrib: const
  167. w: 1, 2, 3, 4
  168. t: f16
  169. ret: #2
  170. arg: #2#1 v
  171. test: vector
  172. end:
  173. function: native_distance
  174. version: 21
  175. attrib: const
  176. w: 1, 2, 3, 4
  177. t: f32
  178. ret: #2
  179. arg: #2#1 left_vector
  180. arg: #2#1 right_vector
  181. summary: Approximate distance between two points
  182. description:
  183. Computes the approximate distance between two points.
  184. See also @distance(), @fast_distance().
  185. test: vector
  186. end:
  187. function: native_distance
  188. version: 24
  189. attrib: const
  190. w: 1, 2, 3, 4
  191. t: f16
  192. ret: #2
  193. arg: #2#1 left_vector
  194. arg: #2#1 right_vector
  195. test: vector
  196. end:
  197. function: native_length
  198. version: 21
  199. attrib: const
  200. w: 1, 2, 3, 4
  201. t: f32
  202. ret: #2
  203. arg: #2#1 v
  204. summary: Approximate length of a vector
  205. description:
  206. Compute the approximate length of a vector.
  207. See also @length(), @fast_length().
  208. test: vector
  209. end:
  210. function: native_length
  211. version: 24
  212. attrib: const
  213. w: 1, 2, 3, 4
  214. t: f16
  215. ret: #2
  216. arg: #2#1 v
  217. test: vector
  218. end:
  219. function: native_normalize
  220. version: 21
  221. attrib: const
  222. w: 1, 2, 3, 4
  223. t: f32
  224. ret: #2#1
  225. arg: #2#1 v
  226. summary: Approximately normalize a vector
  227. description:
  228. Approximately normalizes a vector.
  229. See also @normalize(), @fast_normalize().
  230. test: vector
  231. end:
  232. function: native_normalize
  233. version: 24
  234. attrib: const
  235. w: 1, 2, 3, 4
  236. t: f16
  237. ret: #2#1
  238. arg: #2#1 v
  239. test: vector
  240. end:
  241. function: normalize
  242. version: 9
  243. attrib: const
  244. w: 1, 2, 3, 4
  245. t: f32
  246. ret: #2#1
  247. arg: #2#1 v
  248. summary: Normalize a vector
  249. description:
  250. Normalize a vector.
  251. For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for
  252. positive values.
  253. See also @fast_normalize(), @native_normalize().
  254. test: vector
  255. end:
  256. function: normalize
  257. version: 24
  258. attrib: const
  259. w: 1, 2, 3, 4
  260. t: f16
  261. ret: #2#1
  262. arg: #2#1 v
  263. test: vector
  264. end: