summaryrefslogtreecommitdiff
path: root/current/platform/rs/scriptc/rs_object_info.rsh
blob: 0b18de3f8748116f3c89cd0931cb61678c1f7ee4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.

/*
 * rs_object_info.rsh: Object Characteristics Functions
 *
 * The functions below can be used to query the characteristics of an Allocation, Element,
 * or Sampler object.  These objects are created from Java.  You can't create them from a
 * script.
 *
 * Allocations:
 *
 * Allocations are the primary method used to pass data to and from RenderScript kernels.
 *
 * They are a structured collection of cells that can be used to store bitmaps, textures,
 * arbitrary data points, etc.
 *
 * This collection of cells may have many dimensions (X, Y, Z, Array0, Array1, Array2, Array3),
 * faces (for cubemaps), and level of details (for mipmapping).
 *
 * See the android.renderscript.Allocation for details on to create Allocations.
 *
 * Elements:
 *
 * The term "element" is used a bit ambiguously in RenderScript, as both type information
 * for the cells of an Allocation and the instantiation of that type.  For example:
 * - rs_element is a handle to a type specification, and
 * - In functions like rsGetElementAt(), "element" means the instantiation of the type,
 *     i.e. a cell of an Allocation.
 *
 * The functions below let you query the characteristics of the type specificiation.
 *
 * An Element can specify a simple data types as found in C, e.g. an integer, float, or
 * boolean.  It can also specify a handle to a RenderScript object.  See rs_data_type for
 * a list of basic types.
 *
 * Elements can specify fixed size vector (of size 2, 3, or 4) versions of the basic types.
 * Elements can be grouped together into complex Elements, creating the equivalent of
 * C structure definitions.
 *
 * Elements can also have a kind, which is semantic information used to interpret pixel
 * data.  See rs_data_kind.
 *
 * When creating Allocations of common elements, you can simply use one of the many predefined
 * Elements like F32_2.
 *
 * To create complex Elements, use the Element.Builder Java class.
 *
 * Samplers:
 *
 * Samplers objects define how Allocations can be read as structure within a kernel.
 * See android.renderscript.S.
 */

#ifndef RENDERSCRIPT_RS_OBJECT_INFO_RSH
#define RENDERSCRIPT_RS_OBJECT_INFO_RSH

/*
 * rsAllocationGetDimFaces: Presence of more than one face
 *
 * If the Allocation is a cubemap, this function returns 1 if there's more than one face
 * present.  In all other cases, it returns 0.
 *
 * Use rsGetDimHasFaces() to get the dimension of a currently running kernel.
 *
 * Returns: Returns 1 if more than one face is present, 0 otherwise.
 */
extern uint32_t __attribute__((overloadable))
    rsAllocationGetDimFaces(rs_allocation a);

/*
 * rsAllocationGetDimLOD: Presence of levels of detail
 *
 * Query an Allocation for the presence of more than one Level Of Detail.  This is useful
 * for mipmaps.
 *
 * Use rsGetDimLod() to get the dimension of a currently running kernel.
 *
 * Returns: Returns 1 if more than one LOD is present, 0 otherwise.
 */
extern uint32_t __attribute__((overloadable))
    rsAllocationGetDimLOD(rs_allocation a);

/*
 * rsAllocationGetDimX: Size of the X dimension
 *
 * Returns the size of the X dimension of the Allocation.
 *
 * Use rsGetDimX() to get the dimension of a currently running kernel.
 *
 * Returns: X dimension of the Allocation.
 */
extern uint32_t __attribute__((overloadable))
    rsAllocationGetDimX(rs_allocation a);

/*
 * rsAllocationGetDimY: Size of the Y dimension
 *
 * Returns the size of the Y dimension of the Allocation.  If the Allocation has less
 * than two dimensions, returns 0.
 *
 * Use rsGetDimY() to get the dimension of a currently running kernel.
 *
 * Returns: Y dimension of the Allocation.
 */
extern uint32_t __attribute__((overloadable))
    rsAllocationGetDimY(rs_allocation a);

/*
 * rsAllocationGetDimZ: Size of the Z dimension
 *
 * Returns the size of the Z dimension of the Allocation.  If the Allocation has less
 * than three dimensions, returns 0.
 *
 * Use rsGetDimZ() to get the dimension of a currently running kernel.
 *
 * Returns: Z dimension of the Allocation.
 */
extern uint32_t __attribute__((overloadable))
    rsAllocationGetDimZ(rs_allocation a);

/*
 * rsAllocationGetElement: Get the object that describes the cell of an Allocation
 *
 * Get the Element object describing the type, kind, and other characteristics of a cell
 * of an Allocation.  See the rsElement* functions below.
 *
 * Parameters:
 *   a: Allocation to get data from.
 *
 * Returns: Element describing Allocation layout.
 */
extern rs_element __attribute__((overloadable))
    rsAllocationGetElement(rs_allocation a);

/*
 * rsClearObject: Release an object
 *
 * Tells the run time that this handle will no longer be used to access the the related
 * object.  If this was the last handle to that object, resource recovery may happen.
 *
 * After calling this function, *dst will be set to an empty handle.  See rsIsObject().
 */
extern void __attribute__((overloadable))
    rsClearObject(rs_element* dst);

extern void __attribute__((overloadable))
    rsClearObject(rs_type* dst);

extern void __attribute__((overloadable))
    rsClearObject(rs_allocation* dst);

extern void __attribute__((overloadable))
    rsClearObject(rs_sampler* dst);

extern void __attribute__((overloadable))
    rsClearObject(rs_script* dst);

/*
 * rsIsObject: Check for an empty handle
 *
 * Returns true if the handle contains a non-null reference.
 *
 * This function does not validate that the internal pointer used in the handle
 * points to an actual valid object; it only checks for null.
 *
 * This function can be used to check the Element returned by rsElementGetSubElement()
 * or see if rsClearObject() has been called on a handle.
 */
extern bool __attribute__((overloadable))
    rsIsObject(rs_element v);

extern bool __attribute__((overloadable))
    rsIsObject(rs_type v);

extern bool __attribute__((overloadable))
    rsIsObject(rs_allocation v);

extern bool __attribute__((overloadable))
    rsIsObject(rs_sampler v);

extern bool __attribute__((overloadable))
    rsIsObject(rs_script v);

/*
 * rsElementGetBytesSize: Size of an Element
 *
 * Returns the size in bytes that an instantiation of this Element will occupy.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetBytesSize(rs_element e);
#endif

/*
 * rsElementGetDataKind: Kind of an Element
 *
 * Returns the Element's data kind.  This is used to interpret pixel data.
 *
 * See rs_data_kind.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_data_kind __attribute__((overloadable))
    rsElementGetDataKind(rs_element e);
#endif

/*
 * rsElementGetDataType: Data type of an Element
 *
 * Returns the Element's base data type.  This can be a type similar to C/C++ (e.g.
 * RS_TYPE_UNSIGNED_8), a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a
 * more complex numerical type (e.g. RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4).
 * See rs_data_type.
 *
 * If the Element describes a vector, this function returns the data type of one of its items.
 * Use rsElementGetVectorSize to get the size of the vector.
 *
 * If the Element describes a structure, RS_TYPE_NONE is returned.  Use the rsElementGetSub*
 * functions to explore this complex Element.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_data_type __attribute__((overloadable))
    rsElementGetDataType(rs_element e);
#endif

/*
 * rsElementGetSubElement: Sub-element of a complex Element
 *
 * For Elements that represents a structure, this function returns the sub-element at the
 * specified index.
 *
 * If the Element is not a structure or the index is greater or equal to the number of
 * sub-elements, an invalid handle is returned.
 *
 * Parameters:
 *   e: Element to query.
 *   index: Index of the sub-element to return.
 *
 * Returns: Sub-element at the given index.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_element __attribute__((overloadable))
    rsElementGetSubElement(rs_element e, uint32_t index);
#endif

/*
 * rsElementGetSubElementArraySize: Array size of a sub-element of a complex Element
 *
 * For complex Elements, sub-elements can be statically sized arrays.  This function
 * returns the array size of the sub-element at the index.  This sub-element repetition
 * is different than fixed size vectors.
 *
 * Parameters:
 *   e: Element to query.
 *   index: Index of the sub-element.
 *
 * Returns: Array size of the sub-element.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetSubElementArraySize(rs_element e, uint32_t index);
#endif

/*
 * rsElementGetSubElementCount: Number of sub-elements
 *
 * Elements can be simple, such as an int or a float, or a structure with multiple
 * sub-elements.  This function returns zero for simple Elements and the number of
 * sub-elements for complex Elements.
 *
 * Parameters:
 *   e: Element to get data from.
 *
 * Returns: Number of sub-elements.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetSubElementCount(rs_element e);
#endif

/*
 * rsElementGetSubElementName: Name of a sub-element
 *
 * For complex Elements, this function returns the name of the sub-element at the
 * specified index.
 *
 * Parameters:
 *   e: Element to get data from.
 *   index: Index of the sub-element.
 *   name: Address of the array to store the name into.
 *   nameLength: Length of the provided name array.
 *
 * Returns: Number of characters copied, excluding the null terminator.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetSubElementName(rs_element e, uint32_t index, char* name, uint32_t nameLength);
#endif

/*
 * rsElementGetSubElementNameLength: Length of the name of a sub-element
 *
 * For complex Elements, this function returns the length of the name of the sub-element
 * at the specified index.
 *
 * Parameters:
 *   e: Element to get data from.
 *   index: Index of the sub-element.
 *
 * Returns: Length of the sub-element name including the null terminator.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetSubElementNameLength(rs_element e, uint32_t index);
#endif

/*
 * rsElementGetSubElementOffsetBytes: Offset of the instantiated sub-element
 *
 * This function returns the relative position of the instantiation of the specified
 * sub-element within the instantiation of the Element.
 *
 * For example, if the Element describes a 32 bit float followed by a 32 bit integer,
 * the offset return for the first will be 0 and the second 4.
 *
 * Parameters:
 *   e: Element to get data from.
 *   index: Index of the sub-element.
 *
 * Returns: Offset in bytes.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
#endif

/*
 * rsElementGetVectorSize: Vector size of the Element
 *
 * Returns the Element's vector size.  If the Element does not represent a vector,
 * 1 is returned.
 *
 * Parameters:
 *   e: Element to get data from.
 *
 * Returns: Length of the element vector.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern uint32_t __attribute__((overloadable))
    rsElementGetVectorSize(rs_element e);
#endif

/*
 * rsGetAllocation: Return the Allocation for a given pointer
 *
 * DEPRECATED.  Do not use.
 *
 * Returns the Allocation for a given pointer.  The pointer should point within a valid
 * allocation.  The results are undefined if the pointer is not from a valid Allocation.
 */
extern rs_allocation __attribute__((overloadable
#if (defined(RS_VERSION) && (RS_VERSION >= 22))
, deprecated("This function is deprecated and will be removed from the SDK in a future release.")
#endif
))
    rsGetAllocation(const void* p);

/*
 * rsSamplerGetAnisotropy: Anisotropy of the Sampler
 *
 * Get the Sampler's anisotropy.
 *
 * See android.renderscript.S.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern float __attribute__((overloadable))
    rsSamplerGetAnisotropy(rs_sampler s);
#endif

/*
 * rsSamplerGetMagnification: Sampler magnification value
 *
 * Get the Sampler's magnification value.
 *
 * See android.renderscript.S.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_sampler_value __attribute__((overloadable))
    rsSamplerGetMagnification(rs_sampler s);
#endif

/*
 * rsSamplerGetMinification: Sampler minification value
 *
 * Get the Sampler's minification value.
 *
 * See android.renderscript.S.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_sampler_value __attribute__((overloadable))
    rsSamplerGetMinification(rs_sampler s);
#endif

/*
 * rsSamplerGetWrapS: Sampler wrap S value
 *
 * Get the Sampler's wrap S value.
 *
 * See android.renderscript.S.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_sampler_value __attribute__((overloadable))
    rsSamplerGetWrapS(rs_sampler s);
#endif

/*
 * rsSamplerGetWrapT: Sampler wrap T value
 *
 * Get the sampler's wrap T value.
 *
 * See android.renderscript.S.
 */
#if (defined(RS_VERSION) && (RS_VERSION >= 16))
extern rs_sampler_value __attribute__((overloadable))
    rsSamplerGetWrapT(rs_sampler s);
#endif

/*
 * rsSetObject: For internal use.
 *
 */
extern void __attribute__((overloadable))
    rsSetObject(rs_element* dst, rs_element src);

extern void __attribute__((overloadable))
    rsSetObject(rs_type* dst, rs_type src);

extern void __attribute__((overloadable))
    rsSetObject(rs_allocation* dst, rs_allocation src);

extern void __attribute__((overloadable))
    rsSetObject(rs_sampler* dst, rs_sampler src);

extern void __attribute__((overloadable))
    rsSetObject(rs_script* dst, rs_script src);

#endif // RENDERSCRIPT_RS_OBJECT_INFO_RSH