rs_allocation_data.spec 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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: Allocation Data Access Functions
  18. description:
  19. The functions below can be used to get and set the cells that comprise
  20. an allocation.
  21. <ul>
  22. <li>Individual cells are accessed using the rsGetElementAt* and
  23. @rsSetElementAt functions.</li>
  24. <li>Multiple cells can be copied using the rsAllocationCopy* and
  25. rsAllocationV* functions.</li>
  26. <li>For getting values through a sampler, use @rsSample.</li>
  27. </ul>
  28. The @rsGetElementAt and rsSetElement* functions are somewhat misnamed.
  29. They don't get or set elements, which are akin to data types; they get
  30. or set cells. Think of them as rsGetCellAt and and rsSetCellAt.
  31. end:
  32. function: rsAllocationCopy1DRange
  33. version: 14
  34. ret: void
  35. arg: rs_allocation dstAlloc, "Allocation to copy cells into."
  36. arg: uint32_t dstOff, "Offset in the destination of the first cell to be copied into."
  37. arg: uint32_t dstMip, "Mip level in the destination allocation. 0 if mip mapping is not used."
  38. arg: uint32_t count, "Number of cells to be copied."
  39. arg: rs_allocation srcAlloc, "Source allocation."
  40. arg: uint32_t srcOff, "Offset in the source of the first cell to be copied."
  41. arg: uint32_t srcMip, "Mip level in the source allocation. 0 if mip mapping is not used."
  42. summary: Copy consecutive cells between allocations
  43. description:
  44. Copies the specified number of cells from one allocation to another.
  45. The two allocations must be different. Using this function to copy whithin
  46. the same allocation yields undefined results.
  47. The function does not validate whether the offset plus count exceeds the size
  48. of either allocation. Be careful!
  49. This function should only be called between 1D allocations. Calling it
  50. on other allocations is undefined.
  51. This function should not be called from inside a kernel, or from any function
  52. that may be called directly or indirectly from a kernel. Doing so would cause a
  53. runtime error.
  54. test: none
  55. end:
  56. function: rsAllocationCopy2DRange
  57. version: 14
  58. ret: void
  59. arg: rs_allocation dstAlloc, "Allocation to copy cells into."
  60. arg: uint32_t dstXoff, "X offset in the destination of the region to be set."
  61. arg: uint32_t dstYoff, "Y offset in the destination of the region to be set."
  62. arg: uint32_t dstMip, "Mip level in the destination allocation. 0 if mip mapping is not used."
  63. arg: rs_allocation_cubemap_face dstFace, "Cubemap face of the destination allocation. Ignored for allocations that aren't cubemaps."
  64. arg: uint32_t width, "Width of the incoming region to update."
  65. arg: uint32_t height, "Height of the incoming region to update."
  66. arg: rs_allocation srcAlloc, "Source allocation."
  67. arg: uint32_t srcXoff, "X offset in the source."
  68. arg: uint32_t srcYoff, "Y offset in the source."
  69. arg: uint32_t srcMip, "Mip level in the source allocation. 0 if mip mapping is not used."
  70. arg: rs_allocation_cubemap_face srcFace, "Cubemap face of the source allocation. Ignored for allocations that aren't cubemaps."
  71. summary: Copy a rectangular region of cells between allocations
  72. description:
  73. Copies a rectangular region of cells from one allocation to another.
  74. (width * heigth) cells are copied.
  75. The two allocations must be different. Using this function to copy whithin
  76. the same allocation yields undefined results.
  77. The function does not validate whether the the source or destination region
  78. exceeds the size of its respective allocation. Be careful!
  79. This function should only be called between 2D allocations. Calling it
  80. on other allocations is undefined.
  81. This function should not be called from inside a kernel, or from any function
  82. that may be called directly or indirectly from a kernel. Doing so would cause a
  83. runtime error.
  84. test: none
  85. end:
  86. function: rsAllocationVLoadX_#2#1
  87. version: 22
  88. w: 2, 3, 4
  89. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  90. ret: #2#1
  91. arg: rs_allocation a, "Allocation to get the data from."
  92. arg: uint32_t x, "X offset in the allocation of the first cell to be copied from."
  93. summary: Get a vector from an allocation of scalars
  94. description:
  95. This function returns a vector composed of successive cells of the allocation.
  96. It assumes that the allocation contains scalars.
  97. The "X" in the name indicates that successive values are extracted by
  98. increasing the X index. There are currently no functions to get successive
  99. values incrementing other dimensions. Use multiple calls to rsGetElementAt()
  100. instead.
  101. For example, when calling rsAllocationVLoadX_int4(a, 20, 30), an int4 composed
  102. of a[20, 30], a[21, 30], a[22, 30], and a[23, 30] is returned.
  103. When retrieving from a three dimensional allocations, use the x, y, z variant.
  104. Similarly, use the x, y variant for two dimensional allocations and x for the
  105. mono dimensional allocations.
  106. For efficiency, this function does not validate the inputs. Trying to wrap
  107. the X index, exceeding the size of the allocation, or using indices incompatible
  108. with the dimensionality of the allocation yields undefined results.
  109. See also @rsAllocationVStoreX().
  110. test: none
  111. end:
  112. function: rsAllocationVLoadX_#2#1
  113. version: 22
  114. w: 2, 3, 4
  115. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  116. ret: #2#1
  117. arg: rs_allocation a
  118. arg: uint32_t x
  119. arg: uint32_t y, "Y offset in the allocation of the first cell to be copied from."
  120. test: none
  121. end:
  122. function: rsAllocationVLoadX_#2#1
  123. version: 22
  124. w: 2, 3, 4
  125. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  126. ret: #2#1
  127. arg: rs_allocation a
  128. arg: uint32_t x
  129. arg: uint32_t y
  130. arg: uint32_t z, "Z offset in the allocation of the first cell to be copied from."
  131. test: none
  132. end:
  133. function: rsAllocationVStoreX_#2#1
  134. version: 22
  135. w: 2, 3, 4
  136. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  137. ret: void
  138. arg: rs_allocation a, "Allocation to store the data into."
  139. arg: #2#1 val, "Value to be stored."
  140. arg: uint32_t x, "X offset in the allocation of the first cell to be copied into."
  141. summary: Store a vector into an allocation of scalars
  142. description:
  143. This function stores the entries of a vector into successive cells of an allocation.
  144. It assumes that the allocation contains scalars.
  145. The "X" in the name indicates that successive values are stored by increasing
  146. the X index. There are currently no functions to store successive values
  147. incrementing other dimensions. Use multiple calls to rsSetElementAt() instead.
  148. For example, when calling rsAllocationVStoreX_int3(a, v, 20, 30), v.x is stored
  149. at a[20, 30], v.y at a[21, 30], and v.z at a[22, 30].
  150. When storing into a three dimensional allocations, use the x, y, z variant.
  151. Similarly, use the x, y variant for two dimensional allocations and x for the
  152. mono dimensional allocations.
  153. For efficiency, this function does not validate the inputs. Trying to wrap the
  154. X index, exceeding the size of the allocation, or using indices incompatible
  155. with the dimensionality of the allocation yiels undefined results.
  156. See also @rsAllocationVLoadX().
  157. test: none
  158. end:
  159. function: rsAllocationVStoreX_#2#1
  160. version: 22
  161. w: 2, 3, 4
  162. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  163. ret: void
  164. arg: rs_allocation a
  165. arg: #2#1 val
  166. arg: uint32_t x
  167. arg: uint32_t y, "Y offset in the allocation of the first cell to be copied into."
  168. test: none
  169. end:
  170. function: rsAllocationVStoreX_#2#1
  171. version: 22
  172. w: 2, 3, 4
  173. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  174. ret: void
  175. arg: rs_allocation a
  176. arg: #2#1 val
  177. arg: uint32_t x
  178. arg: uint32_t y
  179. arg: uint32_t z, "Z offset in the allocation of the first cell to be copied into."
  180. test: none
  181. end:
  182. function: rsGetElementAt
  183. ret: const void*
  184. arg: rs_allocation a
  185. arg: uint32_t x
  186. summary: Return a cell from an allocation
  187. description:
  188. This function extracts a single cell from an allocation.
  189. When retrieving from a three dimensional allocations, use the x, y, z variant.
  190. Similarly, use the x, y variant for two dimensional allocations and x for the
  191. mono dimensional allocations.
  192. This function has two styles. One returns the address of the value using a void*,
  193. the other returns the actual value, e.g. rsGetElementAt() vs. rsGetElementAt_int4().
  194. For primitive types, always use the latter as it is more efficient.
  195. test: none
  196. end:
  197. function: rsGetElementAt
  198. ret: const void*
  199. arg: rs_allocation a
  200. arg: uint32_t x
  201. arg: uint32_t y
  202. test: none
  203. end:
  204. function: rsGetElementAt
  205. ret: const void*
  206. arg: rs_allocation a
  207. arg: uint32_t x
  208. arg: uint32_t y
  209. arg: uint32_t z
  210. test: none
  211. end:
  212. function: rsGetElementAt_#2#1
  213. version: 9 17
  214. w: 1, 2, 3, 4
  215. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  216. ret: #2#1
  217. arg: rs_allocation a
  218. arg: uint32_t x
  219. inline:
  220. return ((#2#1 *)rsGetElementAt(a, x))[0];
  221. test: none
  222. end:
  223. function: rsGetElementAt_#2#1
  224. version: 9 17
  225. w: 1, 2, 3, 4
  226. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  227. ret: #2#1
  228. arg: rs_allocation a
  229. arg: uint32_t x
  230. arg: uint32_t y
  231. inline:
  232. return ((#2#1 *)rsGetElementAt(a, x, y))[0];
  233. test: none
  234. end:
  235. function: rsGetElementAt_#2#1
  236. version: 9 17
  237. w: 1, 2, 3, 4
  238. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  239. ret: #2#1
  240. arg: rs_allocation a
  241. arg: uint32_t x
  242. arg: uint32_t y
  243. arg: uint32_t z
  244. inline:
  245. return ((#2#1 *)rsGetElementAt(a, x, y, z))[0];
  246. test: none
  247. end:
  248. function: rsGetElementAt_#2#1
  249. version: 18
  250. w: 1, 2, 3, 4
  251. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  252. ret: #2#1
  253. arg: rs_allocation a
  254. arg: uint32_t x
  255. test: none
  256. end:
  257. function: rsGetElementAt_#2#1
  258. version: 18
  259. w: 1, 2, 3, 4
  260. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  261. ret: #2#1
  262. arg: rs_allocation a
  263. arg: uint32_t x
  264. arg: uint32_t y
  265. test: none
  266. end:
  267. function: rsGetElementAt_#2#1
  268. version: 18
  269. w: 1, 2, 3, 4
  270. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  271. ret: #2#1
  272. arg: rs_allocation a
  273. arg: uint32_t x
  274. arg: uint32_t y
  275. arg: uint32_t z
  276. test: none
  277. end:
  278. function: rsGetElementAt_#2#1
  279. version: 23
  280. w: 1, 2, 3, 4
  281. t: f16
  282. ret: #2#1
  283. arg: rs_allocation a
  284. arg: uint32_t x
  285. test: none
  286. end:
  287. function: rsGetElementAt_#2#1
  288. version: 23
  289. w: 1, 2, 3, 4
  290. t: f16
  291. ret: #2#1
  292. arg: rs_allocation a
  293. arg: uint32_t x
  294. arg: uint32_t y
  295. test: none
  296. end:
  297. function: rsGetElementAt_#2#1
  298. version: 23
  299. w: 1, 2, 3, 4
  300. t: f16
  301. ret: #2#1
  302. arg: rs_allocation a
  303. arg: uint32_t x
  304. arg: uint32_t y
  305. arg: uint32_t z
  306. test: none
  307. end:
  308. function: rsGetElementAtYuv_uchar_U
  309. version: 18
  310. ret: uchar
  311. arg: rs_allocation a
  312. arg: uint32_t x
  313. arg: uint32_t y
  314. summary: Get the U component of an allocation of YUVs
  315. description:
  316. Extracts the U component of a single YUV value from a 2D allocation of YUVs.
  317. Inside an allocation, Y, U, and V components may be stored if different planes
  318. and at different resolutions. The x, y coordinates provided here are in the
  319. dimensions of the Y plane.
  320. See @rsGetElementAtYuv_uchar_Y().
  321. test: none
  322. end:
  323. function: rsGetElementAtYuv_uchar_V
  324. version: 18
  325. ret: uchar
  326. arg: rs_allocation a
  327. arg: uint32_t x
  328. arg: uint32_t y
  329. summary: Get the V component of an allocation of YUVs
  330. description:
  331. Extracts the V component of a single YUV value from a 2D allocation of YUVs.
  332. Inside an allocation, Y, U, and V components may be stored if different planes
  333. and at different resolutions. The x, y coordinates provided here are in the
  334. dimensions of the Y plane.
  335. See @rsGetElementAtYuv_uchar_Y().
  336. test: none
  337. end:
  338. function: rsGetElementAtYuv_uchar_Y
  339. version: 18
  340. ret: uchar
  341. arg: rs_allocation a
  342. arg: uint32_t x
  343. arg: uint32_t y
  344. summary: Get the Y component of an allocation of YUVs
  345. description:
  346. Extracts the Y component of a single YUV value from a 2D allocation of YUVs.
  347. Inside an allocation, Y, U, and V components may be stored if different planes
  348. and at different resolutions. The x, y coordinates provided here are in the
  349. dimensions of the Y plane.
  350. See @rsGetElementAtYuv_uchar_U() and @rsGetElementAtYuv_uchar_V().
  351. test: none
  352. end:
  353. function: rsSample
  354. version: 16
  355. ret: float4
  356. arg: rs_allocation a, "Allocation to sample from."
  357. arg: rs_sampler s, "Sampler state."
  358. arg: float location, "Location to sample from."
  359. summary: Sample a value from a texture allocation
  360. description:
  361. Fetches a value from a texture allocation in a way described by the sampler.
  362. If your allocation is 1D, use the variant with float for location. For 2D,
  363. use the float2 variant.
  364. See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.Sampler</a> for more details.
  365. test: none
  366. end:
  367. function: rsSample
  368. version: 16
  369. ret: float4
  370. arg: rs_allocation a
  371. arg: rs_sampler s
  372. arg: float location
  373. arg: float lod, "Mip level to sample from, for fractional values mip levels will be interpolated if RS_SAMPLER_LINEAR_MIP_LINEAR is used."
  374. test: none
  375. end:
  376. function: rsSample
  377. version: 16
  378. ret: float4
  379. arg: rs_allocation a
  380. arg: rs_sampler s
  381. arg: float2 location
  382. test: none
  383. end:
  384. function: rsSample
  385. version: 16
  386. ret: float4
  387. arg: rs_allocation a
  388. arg: rs_sampler s
  389. arg: float2 location
  390. arg: float lod
  391. test: none
  392. end:
  393. function: rsSetElementAt
  394. version: 18
  395. ret: void
  396. arg: rs_allocation a
  397. arg: void* ptr
  398. arg: uint32_t x
  399. summary: Set a cell of an allocation
  400. description:
  401. This function stores a value into a single cell of an allocation.
  402. When storing into a three dimensional allocations, use the x, y, z variant.
  403. Similarly, use the x, y variant for two dimensional allocations and x for
  404. the mono dimensional allocations.
  405. This function has two styles. One passes the value to be stored using a void*,
  406. the other has the actual value as an argument, e.g. rsSetElementAt() vs.
  407. rsSetElementAt_int4(). For primitive types, always use the latter as it is
  408. more efficient.
  409. See also @rsGetElementAt().
  410. test: none
  411. end:
  412. function: rsSetElementAt
  413. version: 18
  414. ret: void
  415. arg: rs_allocation a
  416. arg: void* ptr
  417. arg: uint32_t x
  418. arg: uint32_t y
  419. test: none
  420. end:
  421. function: rsSetElementAt_#2#1
  422. version: 18
  423. w: 1, 2, 3, 4
  424. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  425. ret: void
  426. arg: rs_allocation a
  427. arg: #2#1 val
  428. arg: uint32_t x
  429. test: none
  430. end:
  431. function: rsSetElementAt_#2#1
  432. version: 18
  433. w: 1, 2, 3, 4
  434. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  435. ret: void
  436. arg: rs_allocation a
  437. arg: #2#1 val
  438. arg: uint32_t x
  439. arg: uint32_t y
  440. test: none
  441. end:
  442. function: rsSetElementAt_#2#1
  443. version: 18
  444. w: 1, 2, 3, 4
  445. t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
  446. ret: void
  447. arg: rs_allocation a
  448. arg: #2#1 val
  449. arg: uint32_t x
  450. arg: uint32_t y
  451. arg: uint32_t z
  452. test: none
  453. end:
  454. function: rsSetElementAt_#2#1
  455. version: 23
  456. w: 1, 2, 3, 4
  457. t: f16
  458. ret: void
  459. arg: rs_allocation a
  460. arg: #2#1 val
  461. arg: uint32_t x
  462. test: none
  463. end:
  464. function: rsSetElementAt_#2#1
  465. version: 23
  466. w: 1, 2, 3, 4
  467. t: f16
  468. ret: void
  469. arg: rs_allocation a
  470. arg: #2#1 val
  471. arg: uint32_t x
  472. arg: uint32_t y
  473. test: none
  474. end:
  475. function: rsSetElementAt_#2#1
  476. version: 23
  477. w: 1, 2, 3, 4
  478. t: f16
  479. ret: void
  480. arg: rs_allocation a
  481. arg: #2#1 val
  482. arg: uint32_t x
  483. arg: uint32_t y
  484. arg: uint32_t z
  485. test: none
  486. end: