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