blob: 72cb51c28c54f6e85aa60d0f2cd67a633b156307 [file] [log] [blame]
Alex Sakhartchouk14607a62012-03-21 09:58:15 -07001/*
2 * Copyright (C) 2012 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/*! \mainpage notitle
18 *
19 * Renderscript is a high-performance runtime that provides graphics rendering and
20 * compute operations at the native level. Renderscript code is compiled on devices
21 * at runtime to allow platform-independence as well.
22 * This reference documentation describes the Renderscript runtime APIs, which you
23 * can utilize to write Renderscript code in C99. The Renderscript header
24 * files are automatically included for you, except for the rs_graphics.rsh header. If
25 * you are doing graphics rendering, include the graphics header file like this:
26 *
27 * <code>#include "rs_graphics.rsh"</code>
28 *
29 * To use Renderscript, you need to utilize the Renderscript runtime APIs documented here
30 * as well as the Android framework APIs for Renderscript.
31 * For documentation on the Android framework APIs, see the <a target="_parent" href=
32 * "http://developer.android.com/reference/android/renderscript/package-summary.html">
33 * android.renderscript</a> package reference.
34 * For more information on how to develop with Renderscript and how the runtime and
35 * Android framework APIs interact, see the <a target="_parent" href=
36 * "http://developer.android.com/guide/topics/renderscript/index.html">Renderscript
37 * developer guide</a> and the <a target="_parent" href=
38 * "http://developer.android.com/resources/samples/RenderScript/index.html">
39 * Renderscript samples</a>.
40 */
41
42/** @file rs_element.rsh
43 * \brief Element routines
44 *
45 *
46 */
47
48#ifndef __RS_ELEMENT_RSH__
49#define __RS_ELEMENT_RSH__
50
51/**
52 * @param e element to get data from
53 * @return number of sub-elements in this element
54 */
55extern uint32_t __attribute__((overloadable))
56 rsElementGetSubElementCount(rs_element e);
57
58/**
59 * @param e element to get data from
60 * @param index index of the sub-element to return
61 * @return sub-element in this element at given index
62 */
63extern rs_element __attribute__((overloadable))
64 rsElementGetSubElement(rs_element, uint32_t index);
65
66/**
67 * @param e element to get data from
68 * @param index index of the sub-element to return
69 * @return length of the sub-element name including the null
70 * terminator (size of buffer needed to write the name)
71 */
72extern uint32_t __attribute__((overloadable))
73 rsElementGetSubElementNameLength(rs_element e, uint32_t index);
74
75/**
76 * @param e element to get data from
77 * @param index index of the sub-element
78 * @param name array to store the name into
79 * @param nameLength length of the provided name array
80 * @return number of characters actually written, excluding the
81 * null terminator
82 */
83extern uint32_t __attribute__((overloadable))
84 rsElementGetSubElementName(rs_element e, uint32_t index, char *name, uint32_t nameLength);
85
86/**
87 * @param e element to get data from
88 * @param index index of the sub-element
89 * @return array size of sub-element in this element at given
90 * index
91 */
92extern uint32_t __attribute__((overloadable))
93 rsElementGetSubElementArraySize(rs_element e, uint32_t index);
94
95/**
96 * @param e element to get data from
97 * @param index index of the sub-element
98 * @return offset in bytes of sub-element in this element at
99 * given index
100 */
101extern uint32_t __attribute__((overloadable))
102 rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
103
104/**
105 * @param e element to get data from
106 * @return total size of the element in bytes
107 */
108extern uint32_t __attribute__((overloadable))
109 rsElementGetSizeBytes(rs_element e);
110
111/**
112 * @param e element to get data from
113 * @return element's data type
114 */
115extern rs_data_type __attribute__((overloadable))
116 rsElementGetDataType(rs_element e);
117
118/**
119 * @param e element to get data from
120 * @return element's data size
121 */
122extern rs_data_kind __attribute__((overloadable))
123 rsElementGetDataKind(rs_element e);
124
125/**
126 * @param e element to get data from
127 * @return length of the element vector (for float2, float3,
128 * etc.)
129 */
130extern uint32_t __attribute__((overloadable))
131 rsElementGetVectorSize(rs_element e);
132
133#endif // __RS_ELEMENT_RSH__
134