rs_allocation_create.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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 Creation Functions
  18. description:
  19. The functions below can be used to create Allocations from a Script.
  20. These functions can be called directly or indirectly from an invokable
  21. function. If some control-flow path can result in a call to these functions
  22. from a RenderScript kernel function, a compiler error will be generated.
  23. end:
  24. function: rsCreateElement
  25. version: 24
  26. ret: rs_element
  27. arg: rs_data_type data_type, "Data type of the Element"
  28. summary: Creates an rs_element object of the specified data type
  29. description:
  30. Creates an rs_element object of the specified data type. The data kind of
  31. the Element will be set to RS_KIND_USER and vector_width will be set to 1,
  32. indicating non-vector.
  33. test: none
  34. end:
  35. function: rsCreateVectorElement
  36. version: 24
  37. ret: rs_element
  38. arg: rs_data_type data_type, "Data type of the Element"
  39. arg: uint32_t vector_width, "Vector width (either 2, 3, or 4)"
  40. summary: Creates an rs_element object of the specified data type and vector width
  41. description:
  42. Creates an rs_element object of the specified data type and vector width.
  43. Value of vector_width must be 2, 3 or 4. The data kind of the Element will
  44. be set to RS_KIND_USER.
  45. test: none
  46. end:
  47. function: rsCreatePixelElement
  48. version: 24
  49. ret: rs_element
  50. arg: rs_data_type data_type, "Data type of the Element"
  51. arg: rs_data_kind data_kind, "Data kind of the Element"
  52. summary: Creates an rs_element object of the specified data type and data kind
  53. description:
  54. Creates an rs_element object of the specified data type and data kind. The
  55. vector_width of the Element will be set to 1, indicating non-vector.
  56. test: none
  57. end:
  58. function: rsCreateElement
  59. version: 24
  60. internal: true
  61. ret: rs_element
  62. arg: int32_t data_type
  63. arg: int32_t data_kind
  64. arg: bool isNormalized
  65. arg: uint32_t vecSize
  66. test: none
  67. end:
  68. function: rsCreateType
  69. version: 24
  70. ret: rs_type
  71. arg: rs_element element, "Element to be associated with the Type"
  72. arg: uint32_t dimX, "Size along the X dimension"
  73. arg: uint32_t dimY, "Size along the Y dimension"
  74. arg: uint32_t dimZ, "Size along the Z dimension"
  75. arg: bool mipmaps, "Flag indicating if the Type has a mipmap chain"
  76. arg: bool faces, "Flag indicating if the Type is a cubemap"
  77. arg: rs_yuv_format yuv_format, "YUV layout for the Type"
  78. summary: Creates an rs_type object with the specified Element and shape attributes
  79. description:
  80. Creates an rs_type object with the specified Element and shape attributes.
  81. dimX specifies the size of the X dimension.
  82. dimY, if present and non-zero, indicates that the Y dimension is present and
  83. indicates its size.
  84. dimZ, if present and non-zero, indicates that the Z dimension is present and
  85. indicates its size.
  86. mipmaps indicates the presence of level of detail (LOD).
  87. faces indicates the presence of cubemap faces.
  88. yuv_format indicates the associated YUV format (or RS_YUV_NONE).
  89. test: none
  90. end:
  91. function: rsCreateType
  92. version: 24
  93. ret: rs_type
  94. arg: rs_element element
  95. arg: uint32_t dimX
  96. arg: uint32_t dimY
  97. arg: uint32_t dimZ
  98. test:none
  99. end:
  100. function: rsCreateType
  101. version: 24
  102. ret: rs_type
  103. arg: rs_element element
  104. arg: uint32_t dimX
  105. arg: uint32_t dimY
  106. test:none
  107. end:
  108. function: rsCreateType
  109. version: 24
  110. ret: rs_type
  111. arg: rs_element element
  112. arg: uint32_t dimX
  113. test:none
  114. end:
  115. function: rsCreateAllocation
  116. version: 24
  117. ret: rs_allocation
  118. arg: rs_type type, "Type of the Allocation"
  119. arg: uint32_t usage, "Usage flag for the allocation"
  120. summary: Create an rs_allocation object of given Type.
  121. description:
  122. Creates an rs_allocation object of the given Type and usage.
  123. RS_ALLOCATION_USAGE_SCRIPT and RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE are the
  124. only supported usage flags for Allocations created from within a RenderScript
  125. Script.
  126. You can also use rsCreateAllocation_<type><width> wrapper functions to directly
  127. create Allocations of scalar and vector numerical types without creating
  128. intermediate rs_element or rs_type objects.
  129. E.g. rsCreateAllocation_int4() returns an Allocation of int4 data type of
  130. specified dimensions.
  131. test: none
  132. end:
  133. function: rsCreateAllocation
  134. version: 24
  135. ret: rs_allocation
  136. arg: rs_type type
  137. test: none
  138. end:
  139. function: rsCreateAllocation
  140. version: 24
  141. internal: true
  142. ret: rs_allocation
  143. arg: rs_type type
  144. arg: rs_allocation_mipmap_control mipmap
  145. arg: uint32_t usages
  146. arg: void* ptr
  147. test: none
  148. end:
  149. function: rsCreateAllocation_#1
  150. version: 24
  151. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  152. ret: rs_allocation
  153. arg: uint32_t dimX
  154. arg: uint32_t dimY
  155. arg: uint32_t dimZ
  156. inline:
  157. rs_element e = rsCreateElement(RS_TYPE_#RST_1);
  158. rs_type t = rsCreateType(e, dimX, dimY, dimZ);
  159. return rsCreateAllocation(t);
  160. test: none
  161. end:
  162. function: rsCreateAllocation_#2#1
  163. version: 24
  164. w: 2, 3, 4
  165. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  166. ret: rs_allocation
  167. arg: uint32_t dimX
  168. arg: uint32_t dimY
  169. arg: uint32_t dimZ
  170. inline:
  171. rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
  172. rs_type t = rsCreateType(e, dimX, dimY, dimZ);
  173. return rsCreateAllocation(t);
  174. test: none
  175. end:
  176. function: rsCreateAllocation_#1
  177. version: 24
  178. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  179. ret: rs_allocation
  180. arg: uint32_t dimX
  181. arg: uint32_t dimY
  182. inline:
  183. rs_element e = rsCreateElement(RS_TYPE_#RST_1);
  184. rs_type t = rsCreateType(e, dimX, dimY);
  185. return rsCreateAllocation(t);
  186. test: none
  187. end:
  188. function: rsCreateAllocation_#2#1
  189. version: 24
  190. w: 2, 3, 4
  191. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  192. ret: rs_allocation
  193. arg: uint32_t dimX
  194. arg: uint32_t dimY
  195. inline:
  196. rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
  197. rs_type t = rsCreateType(e, dimX, dimY);
  198. return rsCreateAllocation(t);
  199. test: none
  200. end:
  201. function: rsCreateAllocation_#1
  202. version: 24
  203. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  204. ret: rs_allocation
  205. arg: uint32_t dimX
  206. inline:
  207. rs_element e = rsCreateElement(RS_TYPE_#RST_1);
  208. rs_type t = rsCreateType(e, dimX);
  209. return rsCreateAllocation(t);
  210. test: none
  211. end:
  212. function: rsCreateAllocation_#2#1
  213. version: 24
  214. w: 2, 3, 4
  215. t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
  216. ret: rs_allocation
  217. arg: uint32_t dimX
  218. inline:
  219. rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
  220. rs_type t = rsCreateType(e, dimX);
  221. return rsCreateAllocation(t);
  222. test: none
  223. end: