blob: 25ac326bdc5c75b6541062ab40b4281ed1c36423 [file] [log] [blame]
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001/*
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
17// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
18
19/*
20 * rs_object_info.rsh: Element functions
21 *
22 * The term "element" is used a bit ambiguously in RenderScript, as both
23 * the type of an item of an allocation and the instantiation of that type:
24 *
25 * rs_element is a handle to a type specification, and
26 *
27 * In functions like rsGetElementAt(), "element" means the instantiation
28 * of the type, i.e. an item of an allocation.
29 *
30 * The functions below let you query the characteristics of the type specificiation.
31 *
32 * To create complex elements, use the Element.Builder Java class.
33 * For common elements, in Java you can simply use one of the many predefined elements
34 * like F32_2. You can't create elements from a script.
35 *
36 * An element can be a simple data type as found in C/C++, a handle type,
37 * a structure, or a fixed size vector (of size 2, 3, or 4) of sub-elements.
38 *
39 * Elements can also have a kind, which is semantic information used mostly to
40 * interpret pixel data.
41 */
42#ifndef RENDERSCRIPT_RS_OBJECT_INFO_RSH
43#define RENDERSCRIPT_RS_OBJECT_INFO_RSH
44
45/*
46 * rsAllocationGetDimFaces: Presence of more than one face
47 *
48 * If the allocation is a cubemap, this function returns 1 if there's more than one
49 * face present. In all other cases, it returns 0.
50 *
51 * Returns: Returns 1 if more than one face is present, 0 otherwise.
52 */
53extern uint32_t __attribute__((overloadable))
54 rsAllocationGetDimFaces(rs_allocation a);
55
56/*
57 * rsAllocationGetDimLOD: Presence of levels of details
58 *
59 * Query an allocation for the presence of more than one Level Of Details. This is useful for mipmaps.
60 *
61 * Returns: Returns 1 if more than one LOD is present, 0 otherwise.
62 */
63extern uint32_t __attribute__((overloadable))
64 rsAllocationGetDimLOD(rs_allocation a);
65
66/*
67 * rsAllocationGetDimX: Size of the X dimension
68 *
69 * Returns the size of the X dimension of the allocation.
70 *
71 * Returns: The X dimension of the allocation.
72 */
73extern uint32_t __attribute__((overloadable))
74 rsAllocationGetDimX(rs_allocation a);
75
76/*
77 * rsAllocationGetDimY: Size of the Y dimension
78 *
79 * Returns the size of the Y dimension of the allocation.
80 * If the allocation has less than two dimensions, returns 0.
81 *
82 * Returns: The Y dimension of the allocation.
83 */
84extern uint32_t __attribute__((overloadable))
85 rsAllocationGetDimY(rs_allocation a);
86
87/*
88 * rsAllocationGetDimZ: Size of the Z dimension
89 *
90 * Returns the size of the Z dimension of the allocation.
91 * If the allocation has less than three dimensions, returns 0.
92 *
93 * Returns: The Z dimension of the allocation.
94 */
95extern uint32_t __attribute__((overloadable))
96 rsAllocationGetDimZ(rs_allocation a);
97
98/*
99 * Get the element object describing the allocation's layout
100 *
101 * Parameters:
102 * a allocation to get data from
103 *
104 * Returns: element describing allocation layout
105 */
106extern rs_element __attribute__((overloadable))
107 rsAllocationGetElement(rs_allocation a);
108
109/*
110 * rsClearObject: For internal use.
111 *
112 */
113extern void __attribute__((overloadable))
114 rsClearObject(rs_element* dst);
115
116extern void __attribute__((overloadable))
117 rsClearObject(rs_type* dst);
118
119extern void __attribute__((overloadable))
120 rsClearObject(rs_allocation* dst);
121
122extern void __attribute__((overloadable))
123 rsClearObject(rs_sampler* dst);
124
125extern void __attribute__((overloadable))
126 rsClearObject(rs_script* dst);
127
128/*
129 * rsIsObject: For internal use.
130 *
131 */
132extern bool __attribute__((overloadable))
133 rsIsObject(rs_element v);
134
135extern bool __attribute__((overloadable))
136 rsIsObject(rs_type v);
137
138extern bool __attribute__((overloadable))
139 rsIsObject(rs_allocation v);
140
141extern bool __attribute__((overloadable))
142 rsIsObject(rs_sampler v);
143
144extern bool __attribute__((overloadable))
145 rsIsObject(rs_script v);
146
147/*
148 * rsElementGetBytesSize: Return the size of an element
149 *
150 * Returns the size in bytes that an instantiation of this element will occupy.
151 */
152#if (defined(RS_VERSION) && (RS_VERSION >= 16))
153extern uint32_t __attribute__((overloadable))
154 rsElementGetBytesSize(rs_element e);
155#endif
156
157/*
158 * rsElementGetDataKind: Return the kind of an element
159 *
160 * Returns the element's data kind. This is used to interpret pixel data.
161 *
162 * See rs_data_kind.
163 */
164#if (defined(RS_VERSION) && (RS_VERSION >= 16))
165extern rs_data_kind __attribute__((overloadable))
166 rsElementGetDataKind(rs_element e);
167#endif
168
169/*
170 * rsElementGetDataType: Return the data type of an element
171 *
172 * Returns the element's base data type. This can be a type similar to C/C++ (e.g. RS_TYPE_UNSIGNED_8),
173 * a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a more complex numerical type
174 * (e.g.RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4).
175 *
176 * If the element describes a vector, this function returns the data type of one of its items.
177 *
178 * If the element describes a structure, RS_TYPE_NONE is returned.
179 *
180 * See rs_data_type.
181 */
182#if (defined(RS_VERSION) && (RS_VERSION >= 16))
183extern rs_data_type __attribute__((overloadable))
184 rsElementGetDataType(rs_element e);
185#endif
186
187/*
188 * rsElementGetSubElement: Return a sub element of a complex element
189 *
190 * For the element represents a structure, this function returns the sub-element at
191 * the specified index.
192 *
193 * If the element is not a structure or the index is greater or equal to the number
194 * of sub-elements, an invalid handle is returned.
195 *
196 * Parameters:
197 * e Element to query
198 * index Index of the sub-element to return
199 *
200 * Returns: Sub-element at the given index
201 */
202#if (defined(RS_VERSION) && (RS_VERSION >= 16))
203extern rs_element __attribute__((overloadable))
204 rsElementGetSubElement(rs_element e, uint32_t index);
205#endif
206
207/*
208 * rsElementGetSubElementArraySize: Return the array size of a sub element of a complex element
209 *
210 * For complex elements, some sub-elements could be statically
211 * sized arrays. This function returns the array size of the
212 * sub-element at the index.
213 *
214 * Parameters:
215 * e Element to query
216 * index Index of the sub-element
217 *
218 * Returns: Array size of the sub-element at the given index
219 */
220#if (defined(RS_VERSION) && (RS_VERSION >= 16))
221extern uint32_t __attribute__((overloadable))
222 rsElementGetSubElementArraySize(rs_element e, uint32_t index);
223#endif
224
225/*
226 * rsElementGetSubElementCount: Return the number of sub-elements
227 *
228 * Elements could be simple, such as an int or a float, or a
229 * structure with multiple sub-elements, such as a collection of
230 * floats, float2, float4. This function returns zero for simple
231 * elements or the number of sub-elements otherwise.
232 *
233 * Parameters:
234 * e Element to get data from
235 *
236 * Returns: Number of sub-elements in this element
237 */
238#if (defined(RS_VERSION) && (RS_VERSION >= 16))
239extern uint32_t __attribute__((overloadable))
240 rsElementGetSubElementCount(rs_element e);
241#endif
242
243/*
244 * rsElementGetSubElementName: Return the name of a sub-element
245 *
246 * For complex elements, this function returns the name of the sub-element
247 * at the specified index.
248 *
249 * Parameters:
250 * e Element to get data from
251 * index Index of the sub-element
252 * name Array to store the name into
253 * nameLength Length of the provided name array
254 *
255 * Returns: Number of characters actually written, excluding the null terminator
256 */
257#if (defined(RS_VERSION) && (RS_VERSION >= 16))
258extern uint32_t __attribute__((overloadable))
259 rsElementGetSubElementName(rs_element e, uint32_t index, char* name, uint32_t nameLength);
260#endif
261
262/*
263 * rsElementGetSubElementNameLength: Return the length of the name of a sub-element
264 *
265 * For complex elements, this function will return the length of
266 * sub-element name at index
267 *
268 * Parameters:
269 * e Element to get data from
270 * index Index of the sub-element to return
271 *
272 * Returns: Length of the sub-element name including the null terminator (size of buffer needed to write the name)
273 */
274#if (defined(RS_VERSION) && (RS_VERSION >= 16))
275extern uint32_t __attribute__((overloadable))
276 rsElementGetSubElementNameLength(rs_element e, uint32_t index);
277#endif
278
279/*
280 * This function specifies the location of a sub-element within
281 * the element
282 *
283 * Parameters:
284 * e Element to get data from
285 * index Index of the sub-element
286 *
287 * Returns: Offset in bytes of sub-element in this element at given index
288 */
289#if (defined(RS_VERSION) && (RS_VERSION >= 16))
290extern uint32_t __attribute__((overloadable))
291 rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
292#endif
293
294/*
295 * Returns the element's vector size
296 *
297 * Parameters:
298 * e Element to get data from
299 *
300 * Returns: Length of the element vector (for float2, float3, etc.)
301 */
302#if (defined(RS_VERSION) && (RS_VERSION >= 16))
303extern uint32_t __attribute__((overloadable))
304 rsElementGetVectorSize(rs_element e);
305#endif
306
307/*
308 * rsGetAllocation: Returns the Allocation for a given pointer
309 *
310 * Returns the Allocation for a given pointer. The pointer should point within
311 * a valid allocation. The results are undefined if the pointer is not from a
312 * valid allocation.
313 *
314 * This function is deprecated and will be removed from the SDK in a future
315 * release.
316 */
317extern rs_allocation __attribute__((overloadable))
318 rsGetAllocation(const void* p);
319
320/*
321 * Get sampler anisotropy
322 *
323 * Parameters:
324 * s sampler to query
325 *
326 * Returns: anisotropy
327 */
328#if (defined(RS_VERSION) && (RS_VERSION >= 16))
329extern float __attribute__((overloadable))
330 rsSamplerGetAnisotropy(rs_sampler s);
331#endif
332
333/*
334 * Get sampler magnification value
335 *
336 * Parameters:
337 * s sampler to query
338 *
339 * Returns: magnification value
340 */
341#if (defined(RS_VERSION) && (RS_VERSION >= 16))
342extern rs_sampler_value __attribute__((overloadable))
343 rsSamplerGetMagnification(rs_sampler s);
344#endif
345
346/*
347 * Get sampler minification value
348 *
349 * Parameters:
350 * s sampler to query
351 *
352 * Returns: minification value
353 */
354#if (defined(RS_VERSION) && (RS_VERSION >= 16))
355extern rs_sampler_value __attribute__((overloadable))
356 rsSamplerGetMinification(rs_sampler s);
357#endif
358
359/*
360 * Get sampler wrap S value
361 *
362 * Parameters:
363 * s sampler to query
364 *
365 * Returns: wrap S value
366 */
367#if (defined(RS_VERSION) && (RS_VERSION >= 16))
368extern rs_sampler_value __attribute__((overloadable))
369 rsSamplerGetWrapS(rs_sampler s);
370#endif
371
372/*
373 * Get sampler wrap T value
374 *
375 * Parameters:
376 * s sampler to query
377 *
378 * Returns: wrap T value
379 */
380#if (defined(RS_VERSION) && (RS_VERSION >= 16))
381extern rs_sampler_value __attribute__((overloadable))
382 rsSamplerGetWrapT(rs_sampler s);
383#endif
384
385/*
386 * rsSetObject: For internal use.
387 *
388 */
389extern void __attribute__((overloadable))
390 rsSetObject(rs_element* dst, rs_element src);
391
392extern void __attribute__((overloadable))
393 rsSetObject(rs_type* dst, rs_type src);
394
395extern void __attribute__((overloadable))
396 rsSetObject(rs_allocation* dst, rs_allocation src);
397
398extern void __attribute__((overloadable))
399 rsSetObject(rs_sampler* dst, rs_sampler src);
400
401extern void __attribute__((overloadable))
402 rsSetObject(rs_script* dst, rs_script src);
403
404#endif // RENDERSCRIPT_RS_OBJECT_INFO_RSH